wip: 字典重构临时提交

This commit is contained in:
ray
2024-10-03 17:41:38 +08:00
parent 7dc8e61989
commit 3f2a5a28df
15 changed files with 82 additions and 85 deletions

View File

@@ -4,30 +4,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.youlai.boot.system.mapper.DictDataMapper">
<!-- 根据字典编码获取字典列表 -->
<select id="getDictItemsByCode" resultType="com.youlai.boot.system.model.vo.DictPageVO$DictItem">
SELECT
id,
`name`,
value,
sort,
status
FROM
sys_dict_item
<where>
dict_code = #{dictCode}
</where>
ORDER BY
sort ASC
</select>
<!-- 获取字典数据分页列表 -->
<select id="getDictDataPage" resultType="com.youlai.boot.system.model.vo.DictDataPageVO">
SELECT
id,
dict_code,
value,
label,
value,
sort,
status
FROM
@@ -44,9 +27,20 @@
AND dict_code = #{queryParams.dictCode}
</if>
</where>
</select>
<!-- 根据字典编码获取字典数据列表 -->
<select id="listDictDataByDictCode" resultType="com.youlai.boot.common.model.Option">
SELECT
value,
label
FROM
sys_dict_data
<where>
dict_code = #{dictCode}
</where>
ORDER BY
sort ASC
</select>
</mapper>

View File

@@ -3,20 +3,12 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.youlai.boot.system.mapper.DictMapper">
<!-- 字典映射 -->
<resultMap id="DictMap" type="com.youlai.boot.system.model.vo.DictPageVO">
<collection property="dictData"
column="{dictCode=code}"
select="com.youlai.boot.system.mapper.DictDataMapper.getDictItemsByCode">
</collection>
</resultMap>
<!-- 字典分页列表 -->
<select id="getDictPage" resultMap="DictMap">
<select id="getDictPage" resultType="com.youlai.boot.system.model.vo.DictPageVO">
SELECT
t1.id,
t1.name,
t1.code,
t1.dict_code,
t1.status
FROM
sys_dict t1
@@ -25,7 +17,8 @@
<if test='queryParams.keywords!=null and queryParams.keywords.trim() neq ""'>
AND (
t1.name LIKE CONCAT('%',#{queryParams.keywords},'%')
OR t1.code LIKE CONCAT('%',#{queryParams.keywords},'%')
OR
t1.dict_code LIKE CONCAT('%',#{queryParams.keywords},'%')
)
</if>
</where>

View File

@@ -20,8 +20,8 @@
FROM
sys_notice t1
LEFT JOIN sys_user t2 ON t2.id = t1.publisher_id
LEFT JOIN sys_dict_item t3 ON t1.type = t3.value AND t3.dict_code = 'notice_type'
LEFT JOIN sys_dict_item t4 ON t1.level = t4.value AND t4.dict_code = 'notice_level'
LEFT JOIN sys_dict_data t3 ON t1.type = t3.value AND t3.dict_code = 'notice_type'
LEFT JOIN sys_dict_data t4 ON t1.level = t4.value AND t4.dict_code = 'notice_level'
WHERE
t1.is_deleted = 0
<if test="queryParams.title != null and queryParams.title != ''">

View File

@@ -17,8 +17,8 @@
sys_user_notice t1
INNER JOIN sys_notice t2 ON t1.notice_id = t2.id AND t2.publish_status = 1
LEFT JOIN sys_user t3 ON t2.publisher_id = t3.id
LEFT JOIN sys_dict_item t4 ON t2.type = t4.value AND t4.dict_code = 'notice_type'
LEFT JOIN sys_dict_item t5 ON t2.level = t5.value AND t5.dict_code = 'notice_level'
LEFT JOIN sys_dict_data t4 ON t2.type = t4.value AND t4.dict_code = 'notice_type'
LEFT JOIN sys_dict_data t5 ON t2.level = t5.value AND t5.dict_code = 'notice_level'
WHERE
t1.user_id = #{queryParams.userId} AND t1.is_deleted = 0 AND t2.is_deleted = 0
<if test="queryParams.title != null and queryParams.title != ''">