查询所有部门
This commit is contained in:
parent
4cc31af90e
commit
213f25085e
|
@ -7,30 +7,26 @@ 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.security.user.UserDetail;
|
|
||||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.service.SysDeptService;
|
import io.renren.modules.sys.service.SysDeptService;
|
||||||
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.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理
|
* 部门管理
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/sys/dept")
|
@RequestMapping("/sys/dept")
|
||||||
@Api(tags="部门管理")
|
@Api(tags = "部门管理")
|
||||||
public class SysDeptController {
|
public class SysDeptController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDeptService sysDeptService;
|
private SysDeptService sysDeptService;
|
||||||
|
@ -41,17 +37,27 @@ public class SysDeptController {
|
||||||
@ApiOperation("查询部门列表")
|
@ApiOperation("查询部门列表")
|
||||||
@LogOperation("查询部门列表")
|
@LogOperation("查询部门列表")
|
||||||
// @RequiresPermissions("sys:dept:list")
|
// @RequiresPermissions("sys:dept:list")
|
||||||
public Result<List<SysDeptDTO>> list(){
|
public Result<List<SysDeptDTO>> list() {
|
||||||
List<SysDeptDTO> list = sysDeptService.list(new HashMap<>(1));
|
List<SysDeptDTO> list = sysDeptService.list(new HashMap<>(1));
|
||||||
|
|
||||||
return new Result<List<SysDeptDTO>>().ok(list);
|
return new Result<List<SysDeptDTO>>().ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("all")
|
||||||
|
@ApiOperation("查询所有部门列表")
|
||||||
|
@LogOperation("查询所有部门列表")
|
||||||
|
// @RequiresPermissions("sys:dept:list")
|
||||||
|
public Result<List<Map<String, Object>>> all() {
|
||||||
|
List<Map<String, Object>> list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;");
|
||||||
|
|
||||||
|
return new Result<List<Map<String, Object>>>().ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@ApiOperation("查询部门详细信息")
|
@ApiOperation("查询部门详细信息")
|
||||||
@LogOperation("查询部门详细信息")
|
@LogOperation("查询部门详细信息")
|
||||||
// @RequiresPermissions("sys:dept:info")
|
// @RequiresPermissions("sys:dept:info")
|
||||||
public Result<SysDeptDTO> get(@PathVariable("id") Long id){
|
public Result<SysDeptDTO> get(@PathVariable("id") Long id) {
|
||||||
SysDeptDTO data = sysDeptService.get(id);
|
SysDeptDTO data = sysDeptService.get(id);
|
||||||
|
|
||||||
return new Result<SysDeptDTO>().ok(data);
|
return new Result<SysDeptDTO>().ok(data);
|
||||||
|
@ -61,7 +67,7 @@ public class SysDeptController {
|
||||||
@ApiOperation("新增部门")
|
@ApiOperation("新增部门")
|
||||||
@LogOperation("新增部门")
|
@LogOperation("新增部门")
|
||||||
// @RequiresPermissions("sys:dept:save")
|
// @RequiresPermissions("sys:dept:save")
|
||||||
public Result save(@RequestBody SysDeptDTO dto){
|
public Result save(@RequestBody SysDeptDTO dto) {
|
||||||
//效验数据
|
//效验数据
|
||||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
@ -74,7 +80,7 @@ public class SysDeptController {
|
||||||
@ApiOperation("修改部门信息")
|
@ApiOperation("修改部门信息")
|
||||||
@LogOperation("修改部门信息")
|
@LogOperation("修改部门信息")
|
||||||
// @RequiresPermissions("sys:dept:update")
|
// @RequiresPermissions("sys:dept:update")
|
||||||
public Result update(@RequestBody SysDeptDTO dto){
|
public Result update(@RequestBody SysDeptDTO dto) {
|
||||||
//效验数据
|
//效验数据
|
||||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
@ -87,7 +93,7 @@ public class SysDeptController {
|
||||||
@ApiOperation("删除部门")
|
@ApiOperation("删除部门")
|
||||||
@LogOperation("删除部门")
|
@LogOperation("删除部门")
|
||||||
// @RequiresPermissions("sys:dept:delete")
|
// @RequiresPermissions("sys:dept:delete")
|
||||||
public Result delete(@PathVariable("id") Long id){
|
public Result delete(@PathVariable("id") Long id) {
|
||||||
//效验数据
|
//效验数据
|
||||||
AssertUtils.isNull(id, "id");
|
AssertUtils.isNull(id, "id");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue