auth-server-annotation/auth-dao/dao-base/src/main/resources/mapper/v1/EmailTemplateMapper.xml

93 lines
4.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.auth.dao.base.mapper.v1.EmailTemplateMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.auth.dao.base.entity.base.EmailTemplateEntity">
<id column="id" property="id"/>
<id column="template_name" property="templateName"/>
<id column="email_user" property="emailUser"/>
<id column="subject" property="subject"/>
<id column="body" property="body"/>
<id column="type" property="type"/>
<id column="is_default" property="isDefault"/>
<id column="is_deleted" property="isDeleted"/>
<id column="template_code" property="templateCode"/>
<id column="email_config_id" property="emailConfigId"/>
<id column="content" property="content"/>
<id column="template_type" property="templateType"/>
<id column="cc_list" property="ccList"/>
<id column="bcc_list" property="bccList"/>
<id column="params_config" property="paramsConfig"/>
<id column="create_time" property="createTime"/>
<id column="update_time" property="updateTime"/>
<id column="create_user" property="createUser"/>
<id column="update_user" property="updateUser"/>
<id column="is_deleted" property="isDeleted"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
template_name,email_user,subject,body,type,is_default,is_deleted,template_code,email_config_id,content,template_type,cc_list,bcc_list,params_config,
create_time, update_time, create_user, update_user, is_deleted
</sql>
<!-- 分页查询邮件模板表内容 -->
<select id="selectListByPage" resultType="com.auth.model.base.vo.EmailTemplateVo">
select
base.*,
create_user.username as create_username,
update_user.username as update_username
from sys_email_template base
left join sys_user create_user on create_user.id = base.create_user
left join sys_user update_user on update_user.id = base.update_user
<where>
base.is_deleted = 0
<if test="dto.templateName != null and dto.templateName != ''">
and base.template_name like CONCAT('%',#{dto.templateName},'%')
</if>
<if test="dto.emailUser != null and dto.emailUser != ''">
and base.email_user like CONCAT('%',#{dto.emailUser},'%')
</if>
<if test="dto.subject != null and dto.subject != ''">
and base.subject like CONCAT('%',#{dto.subject},'%')
</if>
<if test="dto.body != null and dto.body != ''">
and base.body like CONCAT('%',#{dto.body},'%')
</if>
<if test="dto.type != null and dto.type != ''">
and base.type like CONCAT('%',#{dto.type},'%')
</if>
<if test="dto.isDefault != null and dto.isDefault != ''">
and base.is_default like CONCAT('%',#{dto.isDefault},'%')
</if>
<if test="dto.isDeleted != null and dto.isDeleted != ''">
and base.is_deleted like CONCAT('%',#{dto.isDeleted},'%')
</if>
<if test="dto.templateCode != null and dto.templateCode != ''">
and base.template_code like CONCAT('%',#{dto.templateCode},'%')
</if>
<if test="dto.emailConfigId != null and dto.emailConfigId != ''">
and base.email_config_id like CONCAT('%',#{dto.emailConfigId},'%')
</if>
<if test="dto.content != null and dto.content != ''">
and base.content like CONCAT('%',#{dto.content},'%')
</if>
<if test="dto.templateType != null and dto.templateType != ''">
and base.template_type like CONCAT('%',#{dto.templateType},'%')
</if>
<if test="dto.ccList != null and dto.ccList != ''">
and base.cc_list like CONCAT('%',#{dto.ccList},'%')
</if>
<if test="dto.bccList != null and dto.bccList != ''">
and base.bcc_list like CONCAT('%',#{dto.bccList},'%')
</if>
<if test="dto.paramsConfig != null and dto.paramsConfig != ''">
and base.params_config like CONCAT('%',#{dto.paramsConfig},'%')
</if>
</where>
</select>
</mapper>