|  |  | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/user/update/auth") | 
 |  |  |     @ManagerAuth(memo = "系统用户修改") | 
 |  |  |     @Transactional | 
 |  |  |     public R update(User user){ | 
 |  |  |         if (Cools.isEmpty(user) || null==user.getId()){ | 
 |  |  |             return R.error(); | 
 |  |  |         } | 
 |  |  |         int count = userService.selectCount(new EntityWrapper<User>().ne("id", user.getId()).eq("username", user.getUsername())); | 
 |  |  |         if (count > 0) { | 
 |  |  |         if (userService.selectCount(new EntityWrapper<User>().ne("id", user.getId()).eq("username", user.getUsername())) > 0) { | 
 |  |  |             return R.error("账号已存在"); | 
 |  |  |         } | 
 |  |  |         userService.updateById(user); | 
 |  |  |         User one = userService.selectById(user.getId()); | 
 |  |  |         if (!one.getDeptId().equals(user.getDeptId())) { | 
 |  |  |             // todo: 修改关联数据的deptId字段 | 
 |  |  |         } | 
 |  |  |         if (!userService.updateById(user)) { | 
 |  |  |             throw new CoolException("修改用户失败"); | 
 |  |  |         } | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  |