Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-10-25 15:04:50 +08:00
commit 3b609a7b60
1 changed files with 20 additions and 0 deletions

View File

@ -7,8 +7,11 @@ import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -30,6 +33,8 @@ public class SysDeptController {
private SysDeptService sysDeptService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private SysUserService sysUserService;
@GetMapping("list")
@ApiOperation("查询部门列表")
@ -41,6 +46,21 @@ public class SysDeptController {
return new Result<List<SysDeptDTO>>().ok(list);
}
@GetMapping("listForRegion")
@ApiOperation("查询区域管理员管理的部门")
@LogOperation("查询区域管理员管理的部门")
public Result<List<Map<String, Object>>> listForRegion() {
List<Map<String, Object>> list = new ArrayList<>();
SysUserDTO userDTO = sysUserService.get(SecurityUser.getUserId());
if (userDTO.getDeptId() != null) { // 区域管理员
SysDeptDTO sysDeptDTO = sysDeptService.get(userDTO.getDeptId());
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `district` = %d", sysDeptDTO.getDistrict()));
} else if (userDTO.getSuperAdmin() == 1) { // 超级管理员
list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;");
}
return new Result<List<Map<String, Object>>>().ok(list);
}
@GetMapping("all")
@ApiOperation("查询所有部门列表")
@LogOperation("查询所有部门列表")