liyanqi
2022-09-08 bdf115fc3eec4f95fed6def5f3350b600e1b2b53
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.ycl.controller.depart;
 
 
import com.ycl.api.CommonResult;
import com.ycl.entity.depart.SccgDepart;
import com.ycl.entity.user.UmsMenu;
import com.ycl.service.depart.SccgDepartService;
import com.ycl.service.user.UmsMenuService;
import com.ycl.vo.depart.DepartVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * <p>
 * 部门表 前端控制器
 * </p>
 *
 * @author lyq
 * @since 2022-09-07
 */
@RestController
@Api(tags = "部门管理模块")
@RequestMapping("/depart")
public class DepartController {
 
    @Autowired
    private SccgDepartService departService;
 
    @ApiOperation("添加部门")
    @PostMapping(value = "/create")
    public CommonResult<Void> create(@Validated @RequestBody DepartVO.AddDepartVO addDepartVO) {
        departService.create(addDepartVO);
        return CommonResult.success(null);
    }
 
    @ApiOperation("删除")
    @PostMapping(value = "/delete")
    public CommonResult<Void> delete(@Validated @RequestBody DepartVO.IdDepartVO params) {
        departService.delete(params.getId());
        return CommonResult.success(null);
    }
 
    @ApiOperation("详情")
    @PostMapping(value = "/detail")
    public CommonResult<SccgDepart> detail(@Validated @RequestBody DepartVO.IdDepartVO params) {
        SccgDepart sccgDepart = departService.loadDepartById(params.getId());
        return CommonResult.success(sccgDepart);
    }
 
    @ApiOperation("树结构")
    @GetMapping(value = "/tree")
    public CommonResult<List<SccgDepart>> tree() {
        List<SccgDepart> tree = departService.tree();
        return CommonResult.success(tree);
    }
 
    @ApiOperation("修改部门状态")
    @PostMapping(value = "/status")
    public CommonResult<Void> status(@Validated @RequestBody DepartVO.StatusDepartVO params) {
        departService.updateStatus(params);
        return CommonResult.success(null);
    }
 
}