package com.vci.frameworkcore.controller;
|
|
import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI;
|
import com.vci.frameworkcore.pagemodel.OrgDepartmentVO;
|
import com.vci.starter.web.exception.VciBaseException;
|
import com.vci.starter.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("/departmentQueryController")
|
public class OrgDepartmentQueryController {
|
|
/**
|
* 部门的查询服务
|
*/
|
@Autowired
|
private OrgDeptQueryServiceI deptQueryService;
|
|
/**
|
* 部门的树形参照
|
* @param treeQueryObject 树形数据的查询对象,包括查询条件,上级主键,是否多选等,(extandParamsMap中添加"showAllDepartmentNode"为"true"时,并且parentOid为空,返回结果中会包含“所有部门”这个节点)
|
* @return 部门的树形参照,已经转换了上下级关系
|
* @throws VciBaseException 查询出错的时候会抛出异常,如果是老的项目里不抛出异常
|
*/
|
@RequestMapping(value = "/refTree",method = RequestMethod.GET)
|
@ResponseBody
|
public BaseResult<Tree> refTree(TreeQueryObject treeQueryObject) throws VciBaseException{
|
List<Tree> deptTreeList = deptQueryService.refTreeDept(treeQueryObject);
|
return BaseResult.tree(deptTreeList);
|
//老的项目依然是添加try catch,方法里不抛出异常
|
//BaseResult.fail("这里返回前端的错误信息");
|
}
|
@RequestMapping(value = "/refDataGrid",method = RequestMethod.GET)
|
@ResponseBody
|
public BaseResult<OrgDepartmentVO> refDataGrid(BaseQueryObject queryObject){
|
DataGrid<OrgDepartmentVO> dataGrid=deptQueryService.gridDepts(queryObject.getConditionMap(), queryObject.getPageHelper());
|
return BaseResult.dataGrid(dataGrid);
|
}
|
}
|