代码更新

This commit is contained in:
lyd
2022-11-16 18:10:59 +08:00
parent 4092273220
commit 7c22c914ad
2 changed files with 13 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
package org.nl.modules.system.rest;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@@ -110,7 +111,10 @@ public class UserController {
public ResponseEntity<Object> create(@Validated @RequestBody User resources){
checkLevel(resources);
// 默认密码 123456
resources.setPassword(passwordEncoder.encode("123456"));
if (ObjectUtil.isEmpty(resources.getPassword()))
resources.setPassword(passwordEncoder.encode("123456"));
else
resources.setPassword(passwordEncoder.encode(resources.getPassword()));
userService.create(resources);
return new ResponseEntity<>(HttpStatus.CREATED);
}