From d1127f18844cdca09b5f69c8fbeb3788055fd793 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期四, 20 二月 2025 17:00:27 +0800
Subject: [PATCH] 项目增加项目子类型字段

---
 system/src/main/java/com/ycl/system/service/impl/SysDictDataServiceImpl.java |    6 +++
 system/src/main/resources/mapper/system/SysDictDataMapper.xml                |    8 ++++
 start/src/main/java/com/ycl/web/controller/system/SysDictDataController.java |   11 +++++
 business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java      |   13 ++++++
 system/src/main/java/com/ycl/system/service/ISysDictDataService.java         |   24 ++++++++---
 system/src/main/java/com/ycl/system/mapper/SysDictDataMapper.java            |    8 ++++
 6 files changed, 62 insertions(+), 8 deletions(-)

diff --git a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
index 5987493..769294e 100644
--- a/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
@@ -15,6 +15,7 @@
 import com.ycl.common.config.SysConfig;
 import com.ycl.common.constant.Constants;
 import com.ycl.common.core.domain.BaseEntity;
+import com.ycl.common.core.domain.entity.SysDictData;
 import com.ycl.common.enums.business.FileTypeEnum;
 import com.ycl.common.enums.business.ImportanceTypeEnum;
 import com.ycl.common.enums.business.ProjectCategoryEnum;
@@ -44,6 +45,8 @@
 import com.ycl.service.ProjectInfoWinUnitService;
 import com.ycl.service.ProjectInfoYearPlanService;
 import com.ycl.system.mapper.SysDeptMapper;
+import com.ycl.system.service.ISysDeptService;
+import com.ycl.system.service.ISysDictDataService;
 import lombok.RequiredArgsConstructor;
 import org.apache.commons.codec.Charsets;
 import org.springframework.stereotype.Service;
@@ -93,6 +96,7 @@
     private final ProjectInvestmentPolicyComplianceServiceImpl projectInvestmentPolicyComplianceServiceImpl;
     private final ProjectUnitRegistrationInfoServiceImpl projectUnitRegistrationInfoServiceImpl;
     private final SysDeptMapper sysDeptMapper;
+    private final ISysDictDataService dictDataService;
 
     /**
      * 娣诲姞
@@ -316,9 +320,16 @@
             copyToProjectVO(vo, projectVO);
             List<Long> departmentList = vo.getCompetentDepartmentList();
             projectVO.setAuditRole(SecurityUtils.isAdmin(SecurityUtils.getUserId()) || (!CollectionUtils.isEmpty(departmentList) && departmentList.contains(SecurityUtils.getDeptId())));
-            //缈昏瘧椤圭洰闃舵
+            // 缈昏瘧椤圭洰闃舵
             String phase = ProjectCategoryEnum.getPhaseByProjectStatus(projectVO.getProjectStatus(), projectVO.getProcessId() != null);
             projectVO.setProjectPhase(phase);
+            if (StringUtils.isNotEmpty(projectVO.getProjectSubType())) {
+                // 缈昏瘧椤圭洰瀛愮被鍨�
+                SysDictData dictData = dictDataService.selectDictDataByValue(projectVO.getProjectType(), projectVO.getProjectSubType(), "sys_project_type");
+                if (Objects.nonNull(dictData)) {
+                    projectVO.setProjectSubType(dictData.getDictLabel());
+                }
+            }
             list.add(projectVO);
         });
         return Result.ok().data(list).total(page.getTotal());
diff --git a/start/src/main/java/com/ycl/web/controller/system/SysDictDataController.java b/start/src/main/java/com/ycl/web/controller/system/SysDictDataController.java
index 97bf97d..2f667d3 100644
--- a/start/src/main/java/com/ycl/web/controller/system/SysDictDataController.java
+++ b/start/src/main/java/com/ycl/web/controller/system/SysDictDataController.java
@@ -125,4 +125,15 @@
         List<SysDictData> list = dictDataService.selectDictDataList(dictData);
         return success(list);
     }
+
+    /**
+     * 鏍规嵁鐖剁骇id鑾峰彇瀛愮骇鏁版嵁
+     */
+    @GetMapping("/child/by/parent/{parentId}")
+    public AjaxResult getChildList(@PathVariable("parentId") Long parentId) {
+        SysDictData dictData = new SysDictData();
+        dictData.setParentId(parentId);
+        List<SysDictData> list = dictDataService.selectDictDataList(dictData);
+        return success(list);
+    }
 }
diff --git a/system/src/main/java/com/ycl/system/mapper/SysDictDataMapper.java b/system/src/main/java/com/ycl/system/mapper/SysDictDataMapper.java
index 7c3fb08..ee7eff4 100644
--- a/system/src/main/java/com/ycl/system/mapper/SysDictDataMapper.java
+++ b/system/src/main/java/com/ycl/system/mapper/SysDictDataMapper.java
@@ -92,4 +92,12 @@
      * @return 缁撴灉
      */
     public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
+
+    /**
+     * 鏍规嵁鍊兼煡璇㈠瓧鍏稿瓙绫诲瀷鏁版嵁
+     *
+     * @param value
+     * @return
+     */
+    SysDictData selectDictDataByValue(@Param("parentValue") String parentValue, @Param("dictValue") String value, @Param("dictType") String dictType);
 }
diff --git a/system/src/main/java/com/ycl/system/service/ISysDictDataService.java b/system/src/main/java/com/ycl/system/service/ISysDictDataService.java
index a60b432..1f2bc88 100644
--- a/system/src/main/java/com/ycl/system/service/ISysDictDataService.java
+++ b/system/src/main/java/com/ycl/system/service/ISysDictDataService.java
@@ -5,14 +5,14 @@
 
 /**
  * 瀛楀吀 涓氬姟灞�
- * 
+ *
  * @author ycl
  */
 public interface ISysDictDataService
 {
     /**
      * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ瀛楀吀鏁版嵁
-     * 
+     *
      * @param dictData 瀛楀吀鏁版嵁淇℃伅
      * @return 瀛楀吀鏁版嵁闆嗗悎淇℃伅
      */
@@ -20,7 +20,7 @@
 
     /**
      * 鏍规嵁瀛楀吀绫诲瀷鍜屽瓧鍏搁敭鍊兼煡璇㈠瓧鍏告暟鎹俊鎭�
-     * 
+     *
      * @param dictType 瀛楀吀绫诲瀷
      * @param dictValue 瀛楀吀閿��
      * @return 瀛楀吀鏍囩
@@ -29,7 +29,7 @@
 
     /**
      * 鏍规嵁瀛楀吀鏁版嵁ID鏌ヨ淇℃伅
-     * 
+     *
      * @param dictCode 瀛楀吀鏁版嵁ID
      * @return 瀛楀吀鏁版嵁
      */
@@ -37,14 +37,14 @@
 
     /**
      * 鎵归噺鍒犻櫎瀛楀吀鏁版嵁淇℃伅
-     * 
+     *
      * @param dictCodes 闇�瑕佸垹闄ょ殑瀛楀吀鏁版嵁ID
      */
     public void deleteDictDataByIds(Long[] dictCodes);
 
     /**
      * 鏂板淇濆瓨瀛楀吀鏁版嵁淇℃伅
-     * 
+     *
      * @param dictData 瀛楀吀鏁版嵁淇℃伅
      * @return 缁撴灉
      */
@@ -52,9 +52,19 @@
 
     /**
      * 淇敼淇濆瓨瀛楀吀鏁版嵁淇℃伅
-     * 
+     *
      * @param dictData 瀛楀吀鏁版嵁淇℃伅
      * @return 缁撴灉
      */
     public int updateDictData(SysDictData dictData);
+
+    /**
+     * 鏍规嵁鍊兼煡璇㈠瓧鍏稿瓙绫诲瀷鏁版嵁
+     *
+     * @param parentValue
+     * @param value
+     * @param dictType 瀛楀吀绫诲瀷
+     * @return
+     */
+    SysDictData selectDictDataByValue(String parentValue, String value, String dictType);
 }
diff --git a/system/src/main/java/com/ycl/system/service/impl/SysDictDataServiceImpl.java b/system/src/main/java/com/ycl/system/service/impl/SysDictDataServiceImpl.java
index 47bb61e..3886cac 100644
--- a/system/src/main/java/com/ycl/system/service/impl/SysDictDataServiceImpl.java
+++ b/system/src/main/java/com/ycl/system/service/impl/SysDictDataServiceImpl.java
@@ -108,4 +108,10 @@
         }
         return row;
     }
+
+
+    @Override
+    public SysDictData selectDictDataByValue(String parentValue, String value, String dictType) {
+        return dictDataMapper.selectDictDataByValue(parentValue, value, dictType);
+    }
 }
diff --git a/system/src/main/resources/mapper/system/SysDictDataMapper.xml b/system/src/main/resources/mapper/system/SysDictDataMapper.xml
index 8cdd912..a821325 100644
--- a/system/src/main/resources/mapper/system/SysDictDataMapper.xml
+++ b/system/src/main/resources/mapper/system/SysDictDataMapper.xml
@@ -35,6 +35,9 @@
 			<if test="dictLabel != null and dictLabel != ''">
 				AND dict_label like concat('%', #{dictLabel}, '%')
 			</if>
+			<if test="parentId != null">
+				AND parent_id = #{parentId}
+			</if>
 			<if test="status != null and status != ''">
 				AND status = #{status}
 			</if>
@@ -95,6 +98,11 @@
  		update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
 	</update>
 
+	<select id="selectDictDataByValue" parameterType="string" resultMap="SysDictDataResult">
+		<include refid="selectDictDataVo"/>
+		where dict_value = #{dictValue} AND parent_id = (SELECT dict_code FROM sys_dict_data WHERE dict_value = #{parentValue} AND dict_type = #{dictType}) AND dict_type = #{dictType}
+	</select>
+
  	<insert id="insertDictData" parameterType="SysDictData">
  		insert into sys_dict_data(
  			<if test="dictSort != null">dict_sort,</if>

--
Gitblit v1.8.0