package com.vci.frameworkcore.controller;
|
|
import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI;
|
import com.vci.frameworkcore.pagemodel.SmRoleVO;
|
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("/roleQueryController")
|
public class SmRoleQueryController {
|
|
/**
|
* 角色的查询服务
|
*/
|
@Autowired
|
private SmRoleQueryServiceI roleQueryService;
|
|
/**
|
* 角色的列表参照
|
* @param queryObject 查询对象,包含了查询条件,分页,排序等,即允许使用SmRoleVO里的所有属性作为查询条件
|
* @return 普通角色(不包含三员的角色)的显示对象列表数据,请获取其中的data属性
|
* @throws VciBaseException 查询出错的时候会抛出异常,如果是老的项目里不抛出异常
|
*/
|
@RequestMapping(value = "/refDataGrid",method = RequestMethod.GET)
|
@ResponseBody
|
public BaseResult<SmRoleVO> refDataGrid(BaseQueryObject queryObject) throws VciBaseException {
|
if(queryObject == null){
|
queryObject = new BaseQueryObject();
|
}
|
DataGrid<SmRoleVO> roleVODataGrid = roleQueryService.refGridRoles(queryObject.getConditionMap(),queryObject.getPageHelper());
|
return BaseResult.dataGrid(roleVODataGrid);
|
//如果是老的项目,应该在refGridRoles上添加try,catch,然后catch里应该使用下面的代码
|
//BaseResult.fail("这里返回前端的错误信息");
|
}
|
|
/**
|
* 角色的树形参照
|
* @param treeQueryObject 树形数据的查询对象,包括查询条件,上级主键,是否多选等,extandParamsMap中添加"showAllRoleNode"为"true"时,返回结果中会包含“所有角色”这个节点
|
* @return 角色的树形参照,无上下级关系
|
* @throws VciBaseException 查询出错的时候会抛出异常,如果是老的项目里不抛出异常
|
*/
|
@RequestMapping(value = "/refTree",method = RequestMethod.GET)
|
@ResponseBody
|
public BaseResult<Tree> refTree(TreeQueryObject treeQueryObject) throws VciBaseException{
|
List<Tree> roleTreeList = roleQueryService.refTreeRoles(treeQueryObject);
|
return BaseResult.tree(roleTreeList);
|
//老的项目依然是添加try catch,方法里不抛出异常
|
//BaseResult.fail("这里返回前端的错误信息");
|
}
|
|
}
|