| | |
| | | package com.vci.frameworkcore.controller; |
| | | |
| | | import com.vci.corba.common.PLException; |
| | | 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 com.vci.starter.web.util.VciBaseUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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 org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @author weidy |
| | | * @date 2020/3/4 |
| | | */ |
| | | @Controller |
| | | @RestController |
| | | @RequestMapping("/departmentQueryController") |
| | | @Slf4j |
| | | public class OrgDepartmentQueryController { |
| | | |
| | | /** |
| | |
| | | * @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("这里返回前端的错误信息"); |
| | | } |
| | | |
| | | /** |
| | | * 部门查询,带分页 |
| | | * @param queryObject |
| | | * @return |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | | /** |
| | | * 保存部门角色关联信息,带查重功能 |
| | | * @param userOIds 用户id |
| | | * @param deptId 部门oid |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/saveUsersDepts",method = RequestMethod.POST) |
| | | public BaseResult saveUsersDepts(String[] userOIds, String deptId){ |
| | | try { |
| | | return deptQueryService.saveUsersDept(userOIds,deptId) ? BaseResult.success("角色分配成功!"):BaseResult.fail("角色分配失败!"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String exceptionMessage = VciBaseUtil.getExceptionMessage(e); |
| | | log.error("根据用户主键获取,关联的角色时出现错误,原因:" + exceptionMessage); |
| | | return BaseResult.fail("根据用户主键获取,关联的角色时出现错误,原因:" + exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | } |