diff --git a/src/main/java/com/xkrs/controller/SysUserController.java b/src/main/java/com/xkrs/controller/SysUserController.java index 67222b5..835010e 100644 --- a/src/main/java/com/xkrs/controller/SysUserController.java +++ b/src/main/java/com/xkrs/controller/SysUserController.java @@ -229,22 +229,22 @@ public class SysUserController { /** * 用户完善信息 * @param files - * @param userUpdate + * @param * @param token * @return */ @PostMapping("/updateUserByUserId") - public String updateUserByUserId(@RequestParam("file") MultipartFile files, UserUpdate userUpdate, @RequestHeader(value="Authorization") String token) throws IOException { + public String updateUserByUserId(@RequestParam("file") MultipartFile files, String nickName, @RequestHeader(value="Authorization") String token) throws IOException { Locale locale = LocaleContextHolder.getLocale(); - if(userUpdate.getNickName() != null){ - SysUserEntity byNickName = sysUserDao.findByNickName(userUpdate.getNickName()); + if(nickName != null){ + SysUserEntity byNickName = sysUserDao.findByNickName(nickName); if(byNickName != null){ return outputEncapsulationObject(PromptMessageEnum.FILE_EXISTS,"该昵称已存在!",locale); } } String tokenUserName = TokenUtil.getTokenUserName(token); SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName); - return sysUserService.updateUserByUserId(files,userUpdate,sysUserEntity.getId()); + return sysUserService.updateUserByUserId(files,nickName,sysUserEntity.getId()); } /** diff --git a/src/main/java/com/xkrs/dao/SysUserDao.java b/src/main/java/com/xkrs/dao/SysUserDao.java index 934792d..994b916 100644 --- a/src/main/java/com/xkrs/dao/SysUserDao.java +++ b/src/main/java/com/xkrs/dao/SysUserDao.java @@ -110,13 +110,13 @@ public interface SysUserDao extends JpaRepository { * @param userId * @param nickName * @param avatar - * @param province - * @param city - * @param county + * @param + * @param + * @param */ @Modifying(clearAutomatically=true) - @Query(value = "update sys_user set nick_name = ?2,avatar = ?3,province = ?4,city = ?5,county = ?6 where id = ?1",nativeQuery = true) - void updateUserByUserId(Integer userId,String nickName,String avatar,String province,String city,String county); + @Query(value = "update sys_user set nick_name = ?2,avatar = ?3 where id = ?1",nativeQuery = true) + void updateUserByUserId(Integer userId,String nickName,String avatar); /** * 通过用户昵称查询用户信息 diff --git a/src/main/java/com/xkrs/service/SysUserService.java b/src/main/java/com/xkrs/service/SysUserService.java index 2b9ce3b..be06548 100644 --- a/src/main/java/com/xkrs/service/SysUserService.java +++ b/src/main/java/com/xkrs/service/SysUserService.java @@ -88,11 +88,11 @@ public interface SysUserService { /** * 用户完善个人信息 * @param files - * @param userUpdate + * @param * @param userId * @return */ - String updateUserByUserId(MultipartFile files, UserUpdate userUpdate, Integer userId) throws IOException; + String updateUserByUserId(MultipartFile files, String nickName, Integer userId) throws IOException; /** * 启用 diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index ef6c6fc..e64b2d2 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -234,21 +234,21 @@ public class SysUserServiceImpl implements SysUserService { /** * 用户完善个人信息 * @param files - * @param userUpdate + * @param * @param userId * @return */ @Transactional(rollbackFor=Exception.class) @Override - public String updateUserByUserId(MultipartFile files, UserUpdate userUpdate, Integer userId) throws IOException { + public String updateUserByUserId(MultipartFile files, String nickName, Integer userId) throws IOException { Locale locale = LocaleContextHolder.getLocale(); if(files == null){ String uploadAvatar = ""; - sysUserDao.updateUserByUserId(userId,userUpdate.getNickName(),uploadAvatar,userUpdate.getProvince(),userUpdate.getCity(),userUpdate.getCounty()); + sysUserDao.updateUserByUserId(userId,nickName,uploadAvatar); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"提交成功!",locale); } String memoryPhoto = PhotoUtil.memoryPhoto(files); - sysUserDao.updateUserByUserId(userId,userUpdate.getNickName(),memoryPhoto,userUpdate.getProvince(),userUpdate.getCity(),userUpdate.getCounty()); + sysUserDao.updateUserByUserId(userId,nickName,memoryPhoto); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"提交成功!",locale); }