From 203acef84d19ffc01bc8d5dd8ef85f90ba400f5c Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期日, 09 三月 2025 11:49:58 +0800
Subject: [PATCH] 容缺查询

---
 system/src/main/resources/mapper/system/SysDictDataMapper.xml |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/system/src/main/resources/mapper/system/SysDictDataMapper.xml b/system/src/main/resources/mapper/system/SysDictDataMapper.xml
index 8c115fe..a821325 100644
--- a/system/src/main/resources/mapper/system/SysDictDataMapper.xml
+++ b/system/src/main/resources/mapper/system/SysDictDataMapper.xml
@@ -2,9 +2,9 @@
 <!DOCTYPE mapper
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.hnct.system.mapper.SysDictDataMapper">
+<mapper namespace="com.ycl.system.mapper.SysDictDataMapper">
 
-	<resultMap type="com.hnct.system.domain.SysDictData" id="SysDictDataResult">
+	<resultMap type="SysDictData" id="SysDictDataResult">
 		<id     property="dictCode"   column="dict_code"   />
 		<result property="dictSort"   column="dict_sort"   />
 		<result property="dictLabel"  column="dict_label"  />
@@ -18,14 +18,15 @@
 		<result property="createTime" column="create_time" />
 		<result property="updateBy"   column="update_by"   />
 		<result property="updateTime" column="update_time" />
+		<result property="parentId" column="parent_id" />
 	</resultMap>
 
 	<sql id="selectDictDataVo">
-        select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
+        select dict_code, dict_sort,parent_id, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
 		from sys_dict_data
     </sql>
 
-	<select id="selectDictDataList" parameterType="com.hnct.system.domain.SysDictData" resultMap="SysDictDataResult">
+	<select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
 	    <include refid="selectDictDataVo"/>
 		<where>
 		    <if test="dictType != null and dictType != ''">
@@ -34,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>
@@ -41,7 +45,7 @@
 		order by dict_sort asc
 	</select>
 
-	<select id="selectDictDataByType" parameterType="String" resultMap="SysDictDataResult">
+	<select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult">
 		<include refid="selectDictDataVo"/>
 		where status = '0' and dict_type = #{dictType} order by dict_sort asc
 	</select>
@@ -71,10 +75,11 @@
         </foreach>
  	</delete>
 
-	<update id="updateDictData" parameterType="com.hnct.system.domain.SysDictData">
+	<update id="updateDictData" parameterType="SysDictData">
  		update sys_dict_data
  		<set>
  			<if test="dictSort != null">dict_sort = #{dictSort},</if>
+ 			<if test="parentId != null">parent_id = #{parentId},</if>
  			<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
  			<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
  			<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
@@ -93,9 +98,15 @@
  		update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
 	</update>
 
- 	<insert id="insertDictData" parameterType="com.hnct.system.domain.SysDictData">
+	<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>
+ 			<if test="parentId != null">parent_id,</if>
  			<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
  			<if test="dictValue != null and dictValue != ''">dict_value,</if>
  			<if test="dictType != null and dictType != ''">dict_type,</if>
@@ -108,6 +119,7 @@
  			create_time
  		)values(
  		    <if test="dictSort != null">#{dictSort},</if>
+ 		    <if test="parentId != null">#{parentId},</if>
  		    <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
  			<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
  			<if test="dictType != null and dictType != ''">#{dictType},</if>

--
Gitblit v1.8.0