Commit f5239621 authored by cq990612's avatar cq990612

优化代码结构

parent ceb5dcfb
......@@ -191,6 +191,7 @@ public class WorkUserServiceImpl implements WorkUserService {
public Boolean modifyRole(Integer userId, List<Integer> roleIds,Integer status) {
log.info("WorkUserServiceImpl[]modifyRole[].input.param.userId:{},roleIds:{},status:{}" + userId, roleIds,status);
PageHelper.clearPage();
WorkUser workUser = workUserMapper.selectById(userId);
if (null == workUser) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.QUERY_DATA_IS_NULL);
......@@ -218,6 +219,10 @@ public class WorkUserServiceImpl implements WorkUserService {
}
}
workUserRoleMapper.deleteByUserId(userId);
int i = workUserMapper.updateStatusById(userId, status);
if (i == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.UPDATE_DATA_FAIL);
}
if (1 == roleIds.size() && 0 == roleIds.get(0)) {
return true;
}
......@@ -247,10 +252,6 @@ public class WorkUserServiceImpl implements WorkUserService {
workCentreService.updateById(centre);
}
}
int i = workUserMapper.updateStatusById(userId, status);
if (i == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.UPDATE_DATA_FAIL);
}
workUserRoleMapper.insertBatch(userId, roleIds);
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment