wip: 字典重构临时提交

This commit is contained in:
ray
2024-10-03 08:05:11 +08:00
parent 48877eaf32
commit 4aaea0ad1e
30 changed files with 626 additions and 426 deletions

View File

@@ -0,0 +1,52 @@
<?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="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,
sort,
status
FROM
sys_dict_data
<where>
<if test="queryParams.keywords!=null and queryParams.keywords.trim() neq ''">
AND (
value LIKE CONCAT('%', #{queryParams.keywords} ,'%')
OR
label LIKE CONCAT('%', #{queryParams.keywords} ,'%')
)
</if>
<if test="queryParams.dictCode!=null and queryParams.dictCode.trim() neq ''">
AND dict_code = #{queryParams.dictCode}
</if>
</where>
</select>
</mapper>

View File

@@ -1,24 +0,0 @@
<?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="com.youlai.boot.system.mapper.DictItemMapper">
<!-- 根据字典编码获取字典列表 -->
<select id="listDictItemsByDictId" resultType="com.youlai.boot.system.model.vo.DictPageVO$DictItem">
SELECT
id,
`name`,
value,
sort,
status
FROM
sys_dict_item
<where>
dict_id = #{dictId}
</where>
ORDER BY
sort ASC
</select>
</mapper>

View File

@@ -6,9 +6,9 @@
<!-- 字典映射 -->
<resultMap id="DictMap" type="com.youlai.boot.system.model.vo.DictPageVO">
<collection property="dictItems"
column="{dictId=id}"
select="com.youlai.boot.system.mapper.DictItemMapper.listDictItemsByDictId">
<collection property="dictData"
column="{dictCode=code}"
select="com.youlai.boot.system.mapper.DictDataMapper.getDictItemsByCode">
</collection>
</resultMap>
<!-- 字典分页列表 -->

View File

@@ -2,20 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.youlai.boot.system.mapper.UserNoticeMapper">
<!-- 获取用户未读通知列表 -->
<select id="listUnreadNotices" resultType="com.youlai.boot.system.model.vo.UserUnreadNoticeVO">
SELECT
t2.id,
t2.title
FROM
sys_user_notice t1
INNER JOIN sys_notice t2 ON t2.id = t1.notice_id AND t2.publish_status = 1 AND t2.is_deleted = 0
WHERE
t1.user_id = #{userId} AND t1.is_read = 0 AND t1.is_deleted = 0
ORDER BY
t2.publish_time DESC
</select>
<!-- 获取我的通知分页列表 -->
<select id="getMyNoticePage" resultType="com.youlai.boot.system.model.vo.UserNoticePageVO">
SELECT
@@ -25,19 +11,20 @@
t3.nickname publisherName,
t5.name levelLabel,
t2.publish_time,
t1.is_read
t1.is_read,
t2.level
FROM
sys_user_notice t1
INNER JOIN sys_notice ON t2.notice_id = t1.id AND t2.publish_status = 1
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'
WHERE
t1.user_id = #{queryParams.userId}
t1.user_id = #{queryParams.userId} AND t1.is_deleted = 0 AND t2.is_deleted = 0
<if test="queryParams.title != null and queryParams.title != ''">
AND t2.title LIKE CONCAT('%',#{queryParams.title},'%')
</if>
ORDER BY
t2.release_time DESC
t2.publish_time DESC
</select>
</mapper>