区域部门管理员只出本区域部门信息
This commit is contained in:
parent
2af6dfc830
commit
fd7b66bba9
|
@ -8,8 +8,10 @@ import io.renren.common.validator.group.AddGroup;
|
||||||
import io.renren.common.validator.group.DefaultGroup;
|
import io.renren.common.validator.group.DefaultGroup;
|
||||||
import io.renren.common.validator.group.UpdateGroup;
|
import io.renren.common.validator.group.UpdateGroup;
|
||||||
import io.renren.modules.security.user.SecurityUser;
|
import io.renren.modules.security.user.SecurityUser;
|
||||||
|
import io.renren.modules.security.user.UserDetail;
|
||||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.dto.SysUserDTO;
|
import io.renren.modules.sys.dto.SysUserDTO;
|
||||||
|
import io.renren.modules.sys.enums.SuperAdminEnum;
|
||||||
import io.renren.modules.sys.service.SysDeptService;
|
import io.renren.modules.sys.service.SysDeptService;
|
||||||
import io.renren.modules.sys.service.SysUserService;
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
@ -66,12 +68,24 @@ public class SysDeptController {
|
||||||
@LogOperation("查询所有部门列表")
|
@LogOperation("查询所有部门列表")
|
||||||
// @RequiresPermissions("sys:dept:list")
|
// @RequiresPermissions("sys:dept:list")
|
||||||
public Result<List<Map<String, Object>>> all(String name) {
|
public Result<List<Map<String, Object>>> all(String name) {
|
||||||
|
UserDetail user = SecurityUser.getUser();
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
|
||||||
if (StringUtils.isNotEmpty(name)) {
|
if (StringUtils.isNotEmpty(name)) {
|
||||||
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `name` LIKE '%s';", "%" + name + "%"));
|
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `name` LIKE '%s';", "%" + name + "%"));
|
||||||
} else {
|
} else {
|
||||||
list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;");
|
list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;");
|
||||||
}
|
}
|
||||||
|
} else { // 区域管理员
|
||||||
|
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
|
||||||
|
if (sysDeptDTO.getDistrict() != null) {
|
||||||
|
if (StringUtils.isNotEmpty(name)) {
|
||||||
|
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `name` LIKE '%s' AND WHERE district = %d;", "%" + name + "%", sysDeptDTO.getDistrict()));
|
||||||
|
} else {
|
||||||
|
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE district = %d;", sysDeptDTO.getDistrict()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return new Result<List<Map<String, Object>>>().ok(list);
|
return new Result<List<Map<String, Object>>>().ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue