优化代码,去除不必要的相关的代码。
This commit is contained in:
parent
62dc1bfe1d
commit
c9d066152f
|
@ -58,15 +58,11 @@ public class SysUserController extends BaseCrudRestController {
|
|||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentService departmentService;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@AuthorizationWrapper(value = @RequiresPermissions("list"), name = "列表")
|
||||
public JsonResult getVOList(SysUser sysUser, Pagination pagination, HttpServletRequest request) throws Exception{
|
||||
QueryWrapper<User> queryWrapper = super.buildQueryWrapper(sysUser);
|
||||
return super.getVOListWithPaging(queryWrapper, pagination, UserVO.class);
|
||||
return super.getVOListWithPaging(queryWrapper, pagination, SysUserVO.class);
|
||||
}
|
||||
|
||||
/***
|
||||
|
@ -157,13 +153,6 @@ public class SysUserController extends BaseCrudRestController {
|
|||
List<KeyValue> roleKvList = roleService.getKeyValueList(wrapper);
|
||||
modelMap.put("roleKvList", roleKvList);
|
||||
|
||||
//获取部门KV
|
||||
wrapper = new QueryWrapper<Department>()
|
||||
.lambda()
|
||||
.select(Department::getName, Department::getId);
|
||||
List<KeyValue> departmentKvList = departmentService.getKeyValueList(wrapper);
|
||||
modelMap.put("departmentKvList", departmentKvList);
|
||||
|
||||
//获取用户状态KV
|
||||
List<KeyValue> userStatusKvList = dictionaryService.getKeyValueList(SysUser.USER_STATUS);
|
||||
modelMap.put("userStatusKvList", userStatusKvList);
|
||||
|
|
|
@ -16,9 +16,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface SysUserService extends BaseService<SysUser> {
|
||||
|
||||
//获取列表数据
|
||||
List<SysUserVO> getSysUserList(Wrapper queryWrapper, Pagination pagination);
|
||||
|
||||
//获取详细
|
||||
SysUserVO getSysUser(Long id);
|
||||
|
||||
|
|
|
@ -38,25 +38,6 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
|
|||
@Autowired
|
||||
private UserRoleService userRoleService;
|
||||
|
||||
@Override
|
||||
public List<SysUserVO> getSysUserList(Wrapper queryWrapper, Pagination pagination) {
|
||||
List<SysUser> sysUserList = super.getEntityList(queryWrapper, pagination);
|
||||
List<SysUserVO> sysUserVOList = RelationsBinder.convertAndBind(sysUserList, SysUserVO.class);
|
||||
if(V.notEmpty(sysUserVOList)){
|
||||
for(SysUserVO sysUserVO : sysUserVOList){
|
||||
List<Role> roleList = sysUserVO.getRoleList();
|
||||
if(V.notEmpty(roleList)){
|
||||
List<String> roleNameList = new ArrayList();
|
||||
for(Role role : roleList){
|
||||
roleNameList.add(role.getName());
|
||||
}
|
||||
sysUserVO.setRoleNameList(roleNameList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sysUserVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUserVO getSysUser(Long id) {
|
||||
SysUserVO sysUserVO = super.getViewObject(id, SysUserVO.class);
|
||||
|
|
|
@ -21,9 +21,6 @@ public class SysUserVO extends SysUser {
|
|||
|
||||
private static final long serialVersionUID = 5921846275434221060L;
|
||||
|
||||
@BindField(entity=Department.class, field="name", condition="this.department_id=id")
|
||||
private String departmentName;
|
||||
|
||||
@BindDict(type="GENDER", field="gender")
|
||||
private String genderLabel;
|
||||
|
||||
|
@ -36,7 +33,4 @@ public class SysUserVO extends SysUser {
|
|||
@TableField(exist = false)
|
||||
private List<Long> roleIdList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> roleNameList;
|
||||
|
||||
}
|
Loading…
Reference in New Issue