diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SelectController.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SelectController.java index e33d48e5..36bbe837 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SelectController.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SelectController.java @@ -22,13 +22,13 @@ public class SelectController { private SelectService service; @ApiOperation(value = "往来单位下拉选") - @PostMapping("getUnitData") + @PostMapping("getUnitCbx") public AjaxResult getUnitData(SelectDto dto) { return service.getUnitData(dto); } @ApiOperation(value = "工程下拉选") - @PostMapping("getProData") + @PostMapping("getSectionEngineeringCbx") public AjaxResult getProData(SelectDto dto) { return service.getProData(dto); } @@ -39,13 +39,6 @@ public class SelectController { return service.getMaTypeData(dto); } - @ApiOperation(value = "机具类型下拉树") - @PostMapping("getMaTypeTreeData") - public AjaxResult getMaTypeTreeData(SelectDto dto){ -// return service.getMaTypeTreeData(dto); - return null; - } - @ApiOperation(value = "数据字典下拉选") @PostMapping("getDictByPidCbx") public AjaxResult getDictByPidCbx(SelectDto dto){ @@ -75,4 +68,46 @@ public class SelectController { public AjaxResult getUnitTypeCbx(SelectDto dto){ return service.getUnitTypeCbx(dto); } + + @ApiOperation(value = "设备类型树") + @PostMapping("getDeviceTypeTree") + public AjaxResult getDeviceTypeTree(SelectDto dto){ + return service.getDeviceTypeTree(dto); + } + + @ApiOperation(value = "资产属性") + @PostMapping("getAssetAttributesCbx") + public AjaxResult getAssetAttributesCbx(SelectDto dto){ + return service.getAssetAttributesCbx(dto); + } + + @ApiOperation(value = "机具厂家") + @PostMapping("getDeviceFactoryCbx") + public AjaxResult getDeviceFactoryCbx(SelectDto dto){ + return service.getDeviceFactoryCbx(dto); + } + + @ApiOperation(value = "工程项目") + @PostMapping("getProCbx") + public AjaxResult getProCbx(SelectDto dto){ + return service.getProCbx(dto); + } + + @ApiOperation(value = "配件所属上级树") + @PostMapping("getAccessoryTree") + public AjaxResult getAccessoryTree(SelectDto dto){ + return service.getAccessoryTree(dto); + } + + @ApiOperation(value = "货架") + @PostMapping("getGoodsShelvesCbx") + public AjaxResult getGoodsShelvesCbx(SelectDto dto){ + return service.getGoodsShelvesCbx(dto); + } + + @ApiOperation(value = "用户/维修员/库管员/采购员") + @PostMapping("getUserByRoleIdCbx") + public AjaxResult getUserByRoleIdCbx(SelectDto dto){ + return service.getUserByRoleIdCbx(dto); + } } diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/domain/SelectDto.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/domain/SelectDto.java index 1f87e261..82de6cc1 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/domain/SelectDto.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/domain/SelectDto.java @@ -2,6 +2,8 @@ package com.bonus.sgzb.system.domain; import lombok.Data; +import java.util.List; + /** * @author 10488 */ @@ -19,4 +21,8 @@ public class SelectDto { /** 层级*/ private String level; + + /** 角色权限字符串*/ + private String roleKey; + } diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/mapper/SelectMapper.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/mapper/SelectMapper.java index 10f8a298..a592475d 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/mapper/SelectMapper.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/mapper/SelectMapper.java @@ -84,4 +84,76 @@ public interface SelectMapper { * @date 2023/12/20 18:01 */ List getUnitTypeCbx(SelectDto dto); + + /** + * @param dto + * @return List + * @description 设备类型树 + * @author cwchen + * @date 2023/12/20 18:15 + */ + List getDeviceTypeTree(SelectDto dto); + + /** + * @param dto + * @return List + * @description 资产属性 + * @author cwchen + * @date 2023/12/20 19:48 + */ + List getAssetAttributesCbx(SelectDto dto); + + /** + * @param dto + * @return List + * @description 机具厂家 + * @author cwchen + * @date 2023/12/20 19:57 + */ + List getDeviceFactoryCbx(SelectDto dto); + + /** + * @param dto + * @return List + * @description 工程项目 + * @author cwchen + * @date 2023/12/20 20:01 + */ + List getProCbx(SelectDto dto); + + /** + * @param dto + * @return List + * @description 配件所属上级树 + * @author cwchen + * @date 2023/12/20 20:26 + */ + List getAccessoryTree(SelectDto dto); + + /** + * @param dto + * @return List + * @description 货架 + * @author cwchen + * @date 2023/12/20 20:36 + */ + List getGoodsShelvesCbx(SelectDto dto); + + /** + * @param dto + * @return List + * @description 用户/维修员/库管员/采购员-下拉选 + * @author cwchen + * @date 2023/12/20 20:54 + */ + List getUserByRoleIdCbxSelect(SelectDto dto); + + /** + * @param dto + * @return List + * @description 用户/维修员/库管员/采购员-树 + * @author cwchen + * @date 2023/12/20 21:02 + */ + List getUserByRoleIdCbxTree(SelectDto dto); } diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/SelectService.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/SelectService.java index 5aef44f8..d937b1d1 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/SelectService.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/SelectService.java @@ -36,15 +36,6 @@ public interface SelectService { */ AjaxResult getMaTypeData(SelectDto dto); - /** - * @param dto - * @return AjaxResult - * @description 机具类型-下拉树 - * @author cwchen - * @date 2023/12/20 16:10 - */ -// AjaxResult getMaTypeTreeData(SelectDto dto); - /** * @param dto * @return AjaxResult @@ -89,4 +80,67 @@ public interface SelectService { * @date 2023/12/20 18:00 */ AjaxResult getUnitTypeCbx(SelectDto dto); + + /** + * @param dto + * @return AjaxResult + * @description 设备类型树 + * @author cwchen + * @date 2023/12/20 18:14 + */ + AjaxResult getDeviceTypeTree(SelectDto dto); + + /** + * @param dto + * @return AjaxResult + * @description 资产属性 + * @author cwchen + * @date 2023/12/20 19:47 + */ + AjaxResult getAssetAttributesCbx(SelectDto dto); + + /** + * @param dto + * @return AjaxResult + * @description 机具厂家 + * @author cwchen + * @date 2023/12/20 19:56 + */ + AjaxResult getDeviceFactoryCbx(SelectDto dto); + + /** + * @param dto + * @return AjaxResult + * @description 工程项目 + * @author cwchen + * @date 2023/12/20 20:01 + */ + AjaxResult getProCbx(SelectDto dto); + + /** + * @param dto + * @return AjaxResult + * @description 配件所属上级树 + * @author cwchen + * @date 2023/12/20 20:25 + */ + AjaxResult getAccessoryTree(SelectDto dto); + + /** + * @param dto + * @return AjaxResult + * @description 货架 + * @author cwchen + * @date 2023/12/20 20:36 + */ + AjaxResult getGoodsShelvesCbx(SelectDto dto); + + /** + * @param dto + * @return AjaxResult + * @description 用户/维修员/库管员/采购员 + * @author cwchen + * @date 2023/12/20 20:48 + */ + AjaxResult getUserByRoleIdCbx(SelectDto dto); } diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SelectServiceImpl.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SelectServiceImpl.java index 522630c4..b390ae75 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SelectServiceImpl.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SelectServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * @author 10488 @@ -120,4 +121,118 @@ public class SelectServiceImpl implements SelectService { } return AjaxResult.success(list); } + + @Override + public AjaxResult getDeviceTypeTree(SelectDto dto) { + List groupList = new ArrayList<>(); + List list = new ArrayList<>(); + try { + list = mapper.getDeviceTypeTree(dto); + if (CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + TreeBuild treeBuild = new TreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); + } + } catch (Exception e) { + log.error("单位树/归属部门/所属上级-查询失败", e); + } + return AjaxResult.success(groupList); + } + + @Override + public AjaxResult getAssetAttributesCbx(SelectDto dto) { + List list = new ArrayList<>(); + try { + list = mapper.getAssetAttributesCbx(dto); + } catch (Exception e) { + log.error("资产属性-查询失败", e); + } + return AjaxResult.success(list); + } + + @Override + public AjaxResult getDeviceFactoryCbx(SelectDto dto) { + List list = new ArrayList<>(); + try { + list = mapper.getDeviceFactoryCbx(dto); + } catch (Exception e) { + log.error("机具厂家-查询失败", e); + } + return AjaxResult.success(list); + } + + @Override + public AjaxResult getProCbx(SelectDto dto) { + List list = new ArrayList<>(); + try { + list = mapper.getProCbx(dto); + } catch (Exception e) { + log.error("工程项目-查询失败", e); + } + return AjaxResult.success(list); + } + + @Override + public AjaxResult getAccessoryTree(SelectDto dto) { + List groupList = new ArrayList<>(); + List list = new ArrayList<>(); + try { + list = mapper.getAccessoryTree(dto); + if (CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + TreeBuild treeBuild = new TreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); + } + } catch (Exception e) { + log.error("配件所属上级树-查询失败", e); + } + return AjaxResult.success(groupList); + } + + @Override + public AjaxResult getGoodsShelvesCbx(SelectDto dto) { + List groupList = new ArrayList<>(); + List list = new ArrayList<>(); + try { + list = mapper.getGoodsShelvesCbx(dto); + if (CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + TreeBuild treeBuild = new TreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); + } + } catch (Exception e) { + log.error("货架-查询失败", e); + } + return AjaxResult.success(groupList); + } + + @Override + public AjaxResult getUserByRoleIdCbx(SelectDto dto) { + try { + if(Objects.equals("1",dto.getType())){ + // 用户/维修员/库管员/采购员-下拉选 + List list = new ArrayList<>(); + list = mapper.getUserByRoleIdCbxSelect(dto); + return AjaxResult.success(list); + }else if(Objects.equals("2",dto.getType())){ + List groupList = new ArrayList<>(); + List list = new ArrayList<>(); + // 用户/维修员/库管员/采购员-树 + list = mapper.getUserByRoleIdCbxTree(dto); + if (CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + TreeBuild treeBuild = new TreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); + } + return AjaxResult.success(groupList); + } + } catch (Exception e) { + log.error("用户/维修员/库管员/采购员-查询失败",e); + } + return AjaxResult.success(null); + } } diff --git a/sgzb-modules/sgzb-system/src/main/resources/mapper/system/SelectMapper.xml b/sgzb-modules/sgzb-system/src/main/resources/mapper/system/SelectMapper.xml index e9cfd076..68d09f3c 100644 --- a/sgzb-modules/sgzb-system/src/main/resources/mapper/system/SelectMapper.xml +++ b/sgzb-modules/sgzb-system/src/main/resources/mapper/system/SelectMapper.xml @@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + + + + + + + + + + + + + + + \ No newline at end of file