¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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: ãJTC-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: ãissues/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: ãissues/3709ãèªå®ä¹æ æ¥è¯¢æ¡ä»¶æ²¡æå¤çç¶IDï¼æ²¡ææ ç¶ç»æäº --> |
| | | </if> |
| | | <!-- udapte-end-author:sunjianlei date:20220110 for: ãJTC-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> |
| | | |
| | | |
| | | <!-- æ¥è¯¢åå
¸è¡¨çæ°æ® æ¯æè®¾ç½®è¿æ»¤æ¡ä»¶ã设置åå¨å¼ä½ä¸ºinæ¥è¯¢æ¡ä»¶ --> |
| | | <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> |