| | |
| | | import com.example.service.DepartmentService; |
| | | import com.example.service.UserService; |
| | | import com.example.utils.Md5Util; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | |
| | | @PostMapping |
| | | public Result<Boolean> save(@RequestBody User user) { |
| | | User user1 = new User(); |
| | | String currentDeptCode = UserContext.getCurrentDeptCode(); |
| | | List<String> deptCodes = departmentService.getChildDeptCodes(currentDeptCode); |
| | | if (!deptCodes.contains(user.getDeptCode())) { |
| | |
| | | } else { |
| | | user.setPassword(Md5Util.encrypt("123456")); |
| | | } |
| | | return Result.success(userService.save(user)); |
| | | BeanUtils.copyProperties(user,user1); |
| | | System.out.println(user1); |
| | | return Result.success(userService.save(user1)); |
| | | } |
| | | |
| | | @PutMapping |