Skip to content

Commit

Permalink
refactor: 优化Setting保存逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-hao committed Feb 26, 2024
1 parent 3e11d65 commit cfc4f87
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.hswebframework.web.id.IDGenerator;
import org.jetlinks.community.auth.entity.UserSettingEntity;
import org.jetlinks.community.auth.service.UserSettingService;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -65,6 +66,9 @@ public Mono<Void> saveSetting(@PathVariable String type,
entity.setUserId(auth.getUser().getId());
entity.setType(type);
entity.setKey(key);
if(!StringUtils.hasText(entity.getName())){
entity.setName(entity.getKey());
}
entity.generateId();
return entity;
}
Expand Down

0 comments on commit cfc4f87

Please sign in to comment.