Ldc
2024-04-07 0652600959e5e3b5796fb6e8da129704ca95347a
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
package com.vci.frameworkcore.controller;
 
import com.vci.frameworkcore.compatibility.OrgDutyQueryServiceI;
import com.vci.frameworkcore.pagemodel.OrgDutyVO;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.*;
import com.vci.web.pageModel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
 
import java.util.List;
 
/**
 * 职务查询的控制器
 * @author weidy
 * @date 2020/3/4
 */
@Controller
@RequestMapping("/dutyQueryController")
public class OrgDutyQueryController {
 
    /**
     * 职务查询服务
     */
    @Autowired
    private OrgDutyQueryServiceI dutyQueryService;
 
    /**
     * 职务的列表参照
     * @param queryObject 查询对象,包含了查询条件,分页,排序等,即允许使用OrgDutyVO里的所有属性作为查询条件
     * @return 职务的显示对象列表数据,请获取其中的data属性
     * @throws VciBaseException 查询出错的时候会抛出异常,如果是老的项目里不抛出异常
     */
    @RequestMapping(value = "/refDataGrid",method = RequestMethod.GET)
    @ResponseBody
    public BaseResult<OrgDutyVO> refDataGrid(BaseQueryObject queryObject) throws VciBaseException {
        if(queryObject == null){
            queryObject = new BaseQueryObject();
        }
        DataGrid<OrgDutyVO> dutyVODataGrid =  dutyQueryService.refGridDutys(queryObject.getConditionMap(),queryObject.getPageHelper());
        return BaseResult.dataGrid(dutyVODataGrid);
        //如果是老的项目,应该在refGridDutys上添加try,catch,然后catch里应该使用下面的代码
        //BaseResult.fail("这里返回前端的错误信息");
    }
 
    /**
     * 职务的树形参照
     * @param treeQueryObject 树形数据的查询对象,包括查询条件,上级主键,是否多选等,extandParamsMap中添加"showAllDutyNode"为"true"时,返回结果中会包含“所有职务”这个节点
     * @return 角色的树形参照,无上下级关系
     * @throws VciBaseException 查询出错的时候会抛出异常,如果是老的项目里不抛出异常
     */
    @RequestMapping(value = "/refTree",method = RequestMethod.GET)
    @ResponseBody
    public BaseResult<Tree> refTree(TreeQueryObject treeQueryObject) throws VciBaseException{
        List<Tree> dutyTreeList = dutyQueryService.refTreeDutys(treeQueryObject);
        return  BaseResult.tree(dutyTreeList);
        //老的项目依然是添加try catch,方法里不抛出异常
        //BaseResult.fail("这里返回前端的错误信息");
    }
}