Merge branch 'dev'
This commit is contained in:
commit
f643d4789a
|
@ -7,8 +7,11 @@ import io.renren.common.validator.ValidatorUtils;
|
||||||
import io.renren.common.validator.group.AddGroup;
|
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.sys.dto.SysDeptDTO;
|
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.SysDeptService;
|
||||||
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -30,6 +33,8 @@ public class SysDeptController {
|
||||||
private SysDeptService sysDeptService;
|
private SysDeptService sysDeptService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcTemplate jdbcTemplate;
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
@ApiOperation("查询部门列表")
|
@ApiOperation("查询部门列表")
|
||||||
|
@ -41,6 +46,21 @@ public class SysDeptController {
|
||||||
return new Result<List<SysDeptDTO>>().ok(list);
|
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")
|
@GetMapping("all")
|
||||||
@ApiOperation("查询所有部门列表")
|
@ApiOperation("查询所有部门列表")
|
||||||
@LogOperation("查询所有部门列表")
|
@LogOperation("查询所有部门列表")
|
||||||
|
|
Loading…
Reference in New Issue