From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期三, 25 六月 2025 11:51:38 +0800 Subject: [PATCH] Merge branch 'mdc_hyjs_master' --- lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml | 241 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 241 insertions(+), 0 deletions(-) diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml new file mode 100644 index 0000000..40fe54f --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml @@ -0,0 +1,241 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.jeecg.modules.system.mapper.SysDictMapper"> + + <!-- 閫氳繃瀛楀吀code鑾峰彇瀛楀吀鏁版嵁 --> + <select id="queryDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select s.item_value as "value",s.item_text as "text" from sys_dict_item s + where dict_id = (select id from sys_dict where dict_code = #{code}) + order by s.sort_order asc + </select> + + <!-- 閫氳繃瀛楀吀code鑾峰彇鏈夋晥鐨勫瓧鍏告暟鎹」 --> + <select id="queryEnableDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select s.item_value as "value",s.item_text as "text" from sys_dict_item s + where dict_id = (select id from sys_dict where dict_code = #{code}) + and s.status = 1 + order by s.sort_order asc + </select> + + <!-- 閫氳繃澶氫釜瀛楀吀code鑾峰彇瀛楀吀鏁版嵁 --> + <select id="queryDictItemsByCodeList" parameterType="String" resultType="org.jeecg.common.system.vo.DictModelMany"> + SELECT + dict.dict_code, + item.item_text AS "text", + item.item_value AS "value" + FROM + sys_dict_item item + INNER JOIN sys_dict dict ON dict.id = item.dict_id + WHERE dict.dict_code IN ( + <foreach item="dictCode" collection="dictCodeList" separator=","> + #{dictCode} + </foreach> + ) + ORDER BY item.sort_order ASC + </select> + + <!-- 閫氳繃瀛楀吀code鑾峰彇瀛楀吀鏁版嵁 --> + <select id="queryDictTextByKey" parameterType="String" resultType="String"> + select s.item_text from sys_dict_item s + where s.dict_id = (select id from sys_dict where dict_code = #{code}) + and s.item_value = #{key} + </select> + + <!-- 閫氳繃瀛楀吀code鑾峰彇瀛楀吀鏁版嵁锛屽彲鎵归噺鏌ヨ --> + <select id="queryManyDictByKeys" parameterType="String" resultType="org.jeecg.common.system.vo.DictModelMany"> + SELECT + dict.dict_code, + item.item_text AS "text", + item.item_value AS "value" + FROM + sys_dict_item item + INNER JOIN sys_dict dict ON dict.id = item.dict_id + WHERE dict.dict_code IN ( + <foreach item="dictCode" collection="dictCodeList" separator=","> + #{dictCode} + </foreach> + ) + AND item.item_value IN ( + <foreach item="key" collection="keys" separator=","> + #{key} + </foreach> + ) + </select> + + <!--閫氳繃鏌ヨ鎸囧畾table鐨� text code 鑾峰彇瀛楀吀--> + <select id="queryTableDictItemsByCode" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select ${text} as "text",${code} as "value" from ${table} + </select> + + <!--閫氳繃鏌ヨ鎸囧畾table鐨� text code 鑾峰彇瀛楀吀锛堟寚瀹氭煡璇㈡潯浠讹級--> + <select id="queryTableDictItemsByCodeAndFilter" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select ${text} as "text",${code} as "value" from ${table} + <if test="filterSql != null and filterSql != ''"> + where ${filterSql} + </if> + </select> + + <!--閫氳繃鏌ヨ鎸囧畾table鐨� text code key 鑾峰彇瀛楀吀鍊�--> + <select id="queryTableDictTextByKey" parameterType="String" resultType="String"> + select ${text} as "text" from ${table} where ${code}= #{key} + </select> + + <!--閫氳繃鏌ヨ鎸囧畾table鐨� text code key 鑾峰彇瀛楀吀鍊硷紝鍙壒閲忔煡璇� + <select id="queryTableDictTextByKeys" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select ${text} as "text", ${code} as "value" from ${table} where ${code} IN ( + <foreach item="key" collection="keys" separator=","> + #{key} + </foreach> + ) + </select>--> + + <!--閫氳繃鏌ヨ鎸囧畾table鐨� text code key 鑾峰彇瀛楀吀鍊硷紝鍖呭惈value + <select id="queryTableDictByKeys" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select ${text} as "text", ${code} as "value" from ${table} where ${code} in + <foreach item="key" collection="keyArray" open="(" separator="," close=")"> + #{key} + </foreach> + </select>--> + + <!-- 閲嶅鏍¢獙 sql璇彞 --> + <select id="duplicateCheckCountSql" resultType="Long" parameterType="org.jeecg.modules.system.model.DuplicateCheckVo"> + SELECT COUNT(1) FROM ${tableName} WHERE ${fieldName} = #{fieldVal} and id <> #{dataId} + <if test="delFlag != null and delFlag "> + and del_flag=0 + </if> + </select> + + <!-- 閲嶅鏍¢獙 sql璇彞 --> + <select id="duplicateCheckCountSqlNoDataId" resultType="Long" parameterType="org.jeecg.modules.system.model.DuplicateCheckVo"> + SELECT COUNT(1) FROM ${tableName} WHERE ${fieldName} = #{fieldVal} + <if test="delFlag != null and delFlag "> + and del_flag=0 + </if> + </select> + + <!-- 鏌ヨ閮ㄩ棬淇℃伅 浣滀负瀛楀吀鏁版嵁 --> + <select id="queryAllDepartBackDictModel" resultType="org.jeecg.common.system.vo.DictModel"> + select id as "value",depart_name as "text" from sys_depart where del_flag = '0' + </select> + + <!-- 鏌ヨ鐢ㄦ埛淇℃伅 浣滀负瀛楀吀鏁版嵁 --> + <select id="queryAllUserBackDictModel" resultType="org.jeecg.common.system.vo.DictModel"> + select username as "value",realname as "text" from sys_user where del_flag = '0' + </select> + + <!--閫氳繃鏌ヨ鎸囧畾table鐨� text code 鑾峰彇瀛楀吀鏁版嵁锛屼笖鏀寔鍏抽敭瀛楁煡璇� + <select id="queryTableDictItems" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select ${text} as "text",${code} as "value" from ${table} where ${text} like #{keyword} + </select> --> + + <!-- 鏍规嵁琛ㄥ悕銆佹樉绀哄瓧娈靛悕銆佸瓨鍌ㄥ瓧娈靛悕銆佺埗ID鏌ヨ鏍� --> + <select id="queryTreeList" parameterType="Object" resultType="org.jeecg.modules.system.model.TreeSelectModel"> + select ${text} as "title", + ${code} as "key", + <!-- udapte-begin-author:taoyan date:20211115 for: 鑷畾涔夋爲鎺т欢鍙樉绀虹埗鑺傜偣锛屽瓙鑺傜偣鏃犳硶灞曞紑 (姝ゅ杩樺師涓嶅彲鍐嶆敼) /issues/I4HZAL --> + <if test="hasChildField != null and hasChildField != ''"> + <choose> + <when test="converIsLeafVal!=null and converIsLeafVal==1"> + (case when ${hasChildField} = '1' then 0 else 1 end) as isLeaf, + </when> + <otherwise> + ${hasChildField} as isLeaf, + </otherwise> + </choose> + </if> + <!-- udapte-end-author:taoyan date:20211115 for: 鑷畾涔夋爲鎺т欢鍙樉绀虹埗鑺傜偣锛屽瓙鑺傜偣鏃犳硶灞曞紑 (姝ゅ杩樺師涓嶅彲鍐嶆敼) /issues/I4HZAL --> + ${pidField} as parentId + from ${table} + where + <!-- udapte-begin-author:sunjianlei date:20220110 for: 銆怞TC-597銆戣嚜瀹氫箟鏍戞煡璇㈡潯浠舵煡涓嶅嚭鏁版嵁 --> + <if test="query == null"> + <choose> + <when test="pid != null and pid != ''"> + ${pidField} = #{pid} + </when> + <otherwise> + (${pidField} = '' OR ${pidField} IS NULL) + </otherwise> + </choose> + </if> + <if test="query!= null"> + 1 = 1 + <foreach collection="query.entrySet()" item="value" index="key" > + and ${key} LIKE #{value} + </foreach> + <!-- udapte-end-author:sunjianlei date:20220615 for: 銆恑ssues/3709銆戣嚜瀹氫箟鏍戞煡璇㈡潯浠舵病鏈夊鐞嗙埗ID锛屾病鏈夋爲鐘剁粨鏋勪簡 --> + <choose> + <when test="pid != null and pid != ''"> + and ${pidField} = #{pid} + </when> + <otherwise> + and (${pidField} = '' OR ${pidField} IS NULL) + </otherwise> + </choose> + <!-- udapte-end-author:sunjianlei date:20220615 for: 銆恑ssues/3709銆戣嚜瀹氫箟鏍戞煡璇㈡潯浠舵病鏈夊鐞嗙埗ID锛屾病鏈夋爲鐘剁粨鏋勪簡 --> + </if> + <!-- udapte-end-author:sunjianlei date:20220110 for: 銆怞TC-597銆戣嚜瀹氫箟鏍戞煡璇㈡潯浠舵煡涓嶅嚭鏁版嵁 --> + </select> + + + <!-- 鍒嗛〉鏌ヨ瀛楀吀琛ㄦ暟鎹� --> + <select id="queryDictTablePageList" parameterType="Object" resultType="org.jeecg.common.system.vo.DictModel"> + select ${query.text} as "text",${query.code} as "value" from ${query.table} + where 1 = 1 + <if test="query.keyword != null and query.keyword != ''"> + <bind name="bindKeyword" value="'%'+query.keyword+'%'"/> + and (${query.text} like #{bindKeyword} or ${query.code} like #{bindKeyword}) + </if> + <if test="query.codeValue != null and query.codeValue != ''"> + and ${query.code} = #{query.codeValue} + </if> + </select> + + <!--閫氳繃鏌ヨ鎸囧畾table鐨� text code 鑾峰彇瀛楀吀鏁版嵁锛屼笖鏀寔鍏抽敭瀛楀拰鑷畾涔夋煡璇㈡潯浠舵煡璇� 鍒嗛〉--> + <select id="queryTableDictWithFilter" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select ${text} as "text", ${code} as "value" from ${table} + <if test="filterSql != null and filterSql != ''"> + ${filterSql} + </if> + </select> + + <!--閫氳繃鏌ヨ鎸囧畾table鐨� text code 鑾峰彇瀛楀吀鏁版嵁锛屼笖鏀寔鍏抽敭瀛楀拰鑷畾涔夋煡璇㈡潯浠舵煡璇� 鑾峰彇鎵�鏈� --> + <select id="queryAllTableDictItems" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select ${text} as "text", ${code} as "value" from ${table} + <if test="filterSql != null and filterSql != ''"> + ${filterSql} + </if> + </select> + + + <!-- 鏌ヨ瀛楀吀琛ㄧ殑鏁版嵁 鏀寔璁剧疆杩囨护鏉′欢銆佽缃瓨鍌ㄥ�间綔涓篿n鏌ヨ鏉′欢 --> + <select id="queryTableDictByKeysAndFilterSql" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select ${text} as "text", ${code} as "value" from ${table} where ${code} IN ( + <foreach item="key" collection="codeValues" separator=","> + #{key} + </foreach> + ) + <if test="filterSql != null and filterSql != ''"> + and ${filterSql} + </if> + </select> + <select id="queryTableDictTextBySubSql" resultType="java.lang.String"> + select ${text} as "text" from ${table} where ${subSql} + </select> + <select id="queryTableFieldByParams" resultType="java.util.Map"> + select ${columns},${paramName} as paramValue + from ${table} where ${paramName} in + <foreach item="key" collection="paramValues" open="(" separator="," close=")"> + #{key} + </foreach> + </select> + + <!-- 閫氳繃瀛楀吀code,itemText鑾峰彇itemValue --> + <select id="queryDictItemValueByCodeAndText" parameterType="String" resultType="org.jeecg.common.system.vo.DictModel"> + select s.item_value as "value",s.item_text as "text" from sys_dict_item s + where dict_id = (select id from sys_dict where dict_code = #{code}) + and s.item_text = #{itemText} + order by s.sort_order asc + </select> + +</mapper> -- Gitblit v1.9.3