From 87a395a6024278594a0a80d25a24ba4ca5993513 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期六, 18 三月 2023 17:42:10 +0800
Subject: [PATCH] 统计修改

---
 ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml |   64 +++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 22 deletions(-)

diff --git a/ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml b/ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml
index 7ff04d6..f288084 100644
--- a/ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml
+++ b/ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml
@@ -4,29 +4,39 @@
 
     <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
     <resultMap id="BaseResultMap" type="com.ycl.entity.dict.DataDictionary">
-        <id column="id" property="id" />
-        <result column="name" property="name" />
-        <result column="code" property="code" />
-        <result column="type_name" property="typeName" />
-        <result column="type_code" property="typeCode" />
-        <result column="parent_id" property="parentId" />
-        <result column="level" property="level" />
-        <result column="remark" property="remark" />
+        <id column="id" property="id"/>
+        <result column="name" property="name"/>
+        <result column="code" property="code"/>
+        <result column="type_name" property="typeName"/>
+        <result column="type_code" property="typeCode"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="level" property="level"/>
+        <result column="remark" property="remark"/>
     </resultMap>
 
     <!-- 閫氱敤鏌ヨ缁撴灉鍒� -->
     <sql id="Base_Column_List">
-        id, name, code, type_name,type_code,parent_id,level,remark
+        id
+        , name, code, type_name,type_code,parent_id,level,remark
     </sql>
 
     <resultMap id="settingsResultMap" type="com.ycl.vo.IllegalBuildingSettingVO">
-        <id column="number" property="number" />
-        <result column="type" property="type" />
-        <result column="typeFirst" property="typeFirst" />
-        <result column="typeSecond" property="typeSecond" />
-        <result column="typeThird" property="typeThird" />
+        <id column="number" property="number"/>
+        <result column="type" property="type"/>
+        <result column="typeFirst" property="typeFirst"/>
+        <result column="typeSecond" property="typeSecond"/>
+        <result column="typeThird" property="typeThird"/>
     </resultMap>
 
+    <resultMap id="VoMap" type="com.ycl.vo.dict.DataDictionaryVo" extends="BaseResultMap">
+        <collection property="children" javaType="ArrayList" ofType="com.ycl.entity.dict.DataDictionary">
+            <result column="c_id" property="id"/>
+            <result column="c_name" property="name"/>
+            <result column="c_code" property="code"/>
+            <result column="c_level" property="level"/>
+            <result column="c_remark" property="remark"/>
+        </collection>
+    </resultMap>
 
     <select id="listDataDictionaryPage" resultType="com.ycl.vo.IllegalBuildingSettingVO">
         SELECT
@@ -40,8 +50,9 @@
             d1.`level` = '2'
             AND d1.type_code = '06'
             <if test="keyWord !=null and keyWord !=''">
-                AND (d1.`name` LIKE  '%${keyWord}%'
-                or d2.`name` LIKE  '%${keyWord}%')
+                AND (d1.`name` LIKE '%${keyWord}%'
+                or d2.`name` LIKE '%${keyWord}%')
+                or d2.`name` LIKE '%${keyWord}%')
             </if>
 
         </where>
@@ -56,16 +67,16 @@
         d4.`name` AS typeThird
         FROM `ums_data_dictionary` AS d1
         LEFT JOIN ums_data_dictionary AS d2 ON d1.parent_id = d2.id
-        LEFT JOIN ums_data_dictionary AS d3 ON d2.parent_id  = d3.id
-        LEFT JOIN ums_data_dictionary AS d4 ON d3.parent_id  = d4.id
+        LEFT JOIN ums_data_dictionary AS d3 ON d2.parent_id = d3.id
+        LEFT JOIN ums_data_dictionary AS d4 ON d3.parent_id = d4.id
         <where>
             d1.`level` = '4'
             AND d1.type_code = '01'
             <if test="keyWord !=null and keyWord !=''">
-                AND (d1.`name` LIKE  '%${keyWord}%'
-                or d2.`name` LIKE  '%${keyWord}%'
-                or d3.`name` LIKE  '%${keyWord}%'
-                or d4.`name` LIKE  '%${keyWord}%'
+                AND (d1.`name` LIKE '%${keyWord}%'
+                or d2.`name` LIKE '%${keyWord}%'
+                or d3.`name` LIKE '%${keyWord}%'
+                or d4.`name` LIKE '%${keyWord}%'
                 )
             </if>
 
@@ -74,4 +85,13 @@
         ORDER BY d1.parent_id,d2.parent_id,d3.parent_id,d4.parent_id
     </select>
 
+    <select id="queryTreeType" resultMap="VoMap">
+        SELECT p.*, c.id c_id, c.`name` c_name, c.`code` c_code, c.`level` c_level, c.remark c_remark
+        FROM ums_data_dictionary p
+                 LEFT JOIN ums_data_dictionary c on p.id = c.parent_id
+        WHERE p.`type_code` = #{typeCode}
+          and p.`level` = #{level}
+        ORDER BY p.id, c.id
+    </select>
+
 </mapper>

--
Gitblit v1.8.0