diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java index ada88817..1782fe2f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java @@ -86,6 +86,22 @@ public class SelectController { } } + /** + * 领用工程下拉选 + * @param bmProject + * @return + */ + @ApiOperation(value = "领用工程下拉选") + @PostMapping("getLeaseProjectList") + public AjaxResult getLeaseProjectList(@RequestBody BmProject bmProject) { + try { + return service.getLeaseProjectList(bmProject); + } catch (Exception e) { + log.error("获取数据失败"); + return AjaxResult.error("获取数据失败"); + } + } + @ApiOperation(value = "机具类型下拉选") @PostMapping("getMaTypeData") public AjaxResult getMaTypeData(@RequestBody SelectDto dto){ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java index 748d9e8c..b7cae070 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java @@ -301,4 +301,11 @@ public interface SelectMapper { List getBzUseTypeTreeL4(BackApplyInfo bean); List getDeviceTypeTreeTwo(SelectDto dto); + + /** + * 获取工程下拉选 + * @param bmProject + * @return + */ + List getLeaseProjectList(BmProject bmProject); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java index acd8f3ed..817c1547 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/SelectService.java @@ -259,4 +259,11 @@ public interface SelectService { * @return */ AjaxResult getBzUseTypeTree(BackApplyInfo bean); + + /** + * 领用工程下拉选 + * @param bmProject + * @return + */ + AjaxResult getLeaseProjectList(BmProject bmProject); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java index f69f555f..80ea768f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java @@ -415,6 +415,36 @@ public class SelectServiceImpl implements SelectService { return AjaxResult.success(groupList); } + /** + * 领用工程下拉选 + * @param bmProject + * @return + */ + @Override + public AjaxResult getLeaseProjectList(BmProject bmProject) { + // 获取登陆用户的组织ID + Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); + // 判断是否开启过滤 + if (Objects.nonNull(bmProject) && Objects.nonNull(bmProject.getEnableFilter()) && bmProject.getEnableFilter()) { + bmProject.setDeptId(thisLoginUserDeptId); + } + + List groupList = new ArrayList<>(); + List list = new ArrayList<>(); + try { + list = mapper.getLeaseProjectList(bmProject); + if (CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + ProjectTreeBuild treeBuild = new ProjectTreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); + } + } catch (Exception e) { + log.error("工程类型树-查询失败", e); + } + return AjaxResult.success(groupList); + } + @Override public AjaxResult getDeviceTypeTree(SelectDto dto) { List groupList = new ArrayList<>(); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml index 324d33fa..71665378 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml @@ -345,7 +345,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" UNION SELECT DISTINCT concat( 'gs', sd.dept_id ) AS id, - sd.dept_name AS proName, + sd.dept_name AS name, '0' AS parentId, 1 AS level FROM @@ -925,4 +925,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml index 73ba2e0f..d9c1b2d2 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml @@ -875,6 +875,7 @@ select workflow_status from sys_workflow_record where task_id = #{taskId} + Limit 1