111
k94314517
2023-08-18 82c525da4e13329733ecbd9bca30124f0eb91081
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package doumeemes.api.ext;
 
import doumeemes.api.BaseController;
import doumeemes.core.annotation.excel.ExcelExporter;
import doumeemes.core.annotation.pr.PreventRepeat;
import doumeemes.core.model.ApiResponse;
import doumeemes.core.model.PageWrap;
import doumeemes.core.model.PageData;
import doumeemes.dao.business.model.Department;
import doumeemes.dao.ext.dto.QueryDepartmentExtDTO;
import doumeemes.dao.ext.vo.DepartmentExtListVO;
import doumeemes.service.business.DepartmentService;
import doumeemes.service.ext.DepartmentExtService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;    
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * 组织信息接口
 * @author 江蹄蹄
 * @date 2022/04/20 10:59
 */
@RestController
@RequestMapping("/ext/departmentExt")
@Api(tags = "组织信息接口")
public class DepartmentExtController extends BaseController {
 
    @Autowired
    private DepartmentExtService departmentExtService;
 
    @PreventRepeat
    @ApiOperation("新建")
    @PostMapping("/create")
    @RequiresPermissions("ext:departmentext:create")
    public ApiResponse create(@RequestBody Department department) {
        return ApiResponse.success(departmentExtService.create(department));
    }
 
    @ApiOperation("根据ID删除")
    @GetMapping("/delete/{id}")
    @RequiresPermissions("ext:departmentext:delete")
    public ApiResponse deleteById(@PathVariable Integer id) {
        departmentExtService.deleteById(id);
        return ApiResponse.success(null);
    }
 
    @ApiOperation("批量删除")
    @GetMapping("/delete/batch")
    @RequiresPermissions("ext:departmentext:delete")
    public ApiResponse deleteByIds(@RequestParam String ids) {
        String [] idArray = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String id : idArray) {
            idList.add(Integer.valueOf(id));
        }
        departmentExtService.deleteByIdInBatch(idList);
        return ApiResponse.success(null);
    }
    @ApiOperation("切换当前公司级组织")
    @GetMapping("/changeCom/{id}")
//    @RequiresPermissions("system:user:delete")
    public ApiResponse changeCom(@PathVariable Integer id) {
        departmentExtService.changeCom(id);
        return ApiResponse.success(null);
    }
    @ApiOperation("根据ID修改")
    @PostMapping("/updateById")
    @RequiresPermissions("ext:departmentext:update")
    public ApiResponse updateById(@RequestBody Department department) {
        departmentExtService.updateById(department);
        return ApiResponse.success(null);
    }
 
    @ApiOperation("企业部门树形列表查询")
    @PostMapping("/treeComList")
    @RequiresPermissions("ext:departmentext:query")
    public ApiResponse<DepartmentExtListVO> treeComList (@RequestBody QueryDepartmentExtDTO pageWrap) {
        return ApiResponse.success(departmentExtService.treeComList(pageWrap));
    }
    @ApiOperation("分页查询")
    @PostMapping("/page")
    @RequiresPermissions("ext:departmentext:query")
    public ApiResponse<PageData<DepartmentExtListVO>> findPage (@RequestBody PageWrap<QueryDepartmentExtDTO> pageWrap) {
        return ApiResponse.success(departmentExtService.findPage(pageWrap));
    }
 
    @ApiOperation("导出Excel")
    @PostMapping("/exportExcel")
    @RequiresPermissions("ext:departmentext:exportExcel")
    public void exportExcel (@RequestBody PageWrap<QueryDepartmentExtDTO> pageWrap, HttpServletResponse response) {
        ExcelExporter.build(DepartmentExtListVO.class).export(departmentExtService.findPage(pageWrap).getRecords(), "组织信息", response);
    }
 
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
    @RequiresPermissions("ext:departmentext:query")
    public ApiResponse findById(@PathVariable Integer id) {
        return ApiResponse.success(departmentExtService.findById(id));
    }
 
 
    @ApiOperation("条件查询企业全部部门")
    @PostMapping("/getDepartmentListByConditon")
    @RequiresPermissions("ext:departmentext:query")
    public ApiResponse<List<DepartmentExtListVO>> getDepartmentListByConditon (@RequestBody QueryDepartmentExtDTO pageWrap) {
        return ApiResponse.success(departmentExtService.getDepartmentListByConditon(pageWrap));
    }
 
 
 
    @ApiOperation("同步钉钉全部数据")
    @GetMapping("/syncDingDingDepartment")
    @RequiresPermissions("ext:departmentext:update")
    public ApiResponse syncDingDingDepartment() {
        departmentExtService.syncDingDingDepartment();
        return ApiResponse.success(null);
    }
 
 
}