Files
peipei-backend/play-admin/src/main/resources/mapper/system/SysDictMapper.xml
2024-06-05 15:54:18 +08:00

60 lines
2.5 KiB
XML

<?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.starry.admin.modules.system.mapper.SysDictMapper">
<resultMap type="com.starry.admin.modules.system.entity.SysDictEntity" id="XlDictResult">
<result property="dictId" column="dict_id"/>
<result property="dictType" column="dict_type"/>
<result property="dictName" column="dict_name"/>
<result property="status" column="status"/>
<result property="remark" column="remark"/>
<result property="updatedTime" column="updated_time"/>
<result property="updatedBy" column="updated_by"/>
<result property="createdTime" column="created_time"/>
<result property="createdBy" column="created_by"/>
<result property="deleted" column="deleted"/>
<result property="version" column="version"/>
</resultMap>
<sql id="selectXlDictVo">
select dict_id,
dict_type,
dict_name,
status,
remark,
updated_time,
updated_by,
created_time,
created_by,
deleted
from sys_dict
</sql>
<select id="selectXlDictList" resultMap="XlDictResult">
<include refid="selectXlDictVo"/>
where deleted = 0
<if test="sysDictVo.dictName != null and sysDictVo.dictName != ''">
AND dict_name like concat('%', #{sysDictVo.dictName}, '%')
</if>
<if test="sysDictVo.dictType != null and sysDictVo.dictType != ''">
AND dict_type = #{sysDictVo.dictType}
</if>
<if test="sysDictVo.status != null and sysDictVo.status != ''">
AND status = #{sysDictVo.status}
</if>
<if test="sysDictVo.beginTime != null and sysDictVo.beginTime != ''">
<!-- 开始时间检索 -->
AND date_format(created_time, '%y%m%d') &gt;= date_format(#{sysDictVo.beginTime}, '%y%m%d')
</if>
<if test="sysDictVo.endTime != null and sysDictVo.endTime != ''">
<!-- 结束时间检索 -->
AND date_format(created_time, '%y%m%d') &lt;= date_format(#{sysDictVo.endTime}, '%y%m%d')
</if>
</select>
<select id="selectXlDictByDictId" parameterType="Long" resultMap="XlDictResult">
<include refid="selectXlDictVo"/>
where dict_id = #{dictId}
</select>
</mapper>