|
@@ -3,6 +3,8 @@
|
|
|
<mapper namespace="com.simuwang.base.mapper.daq.EmailTemplateMapper">
|
|
|
<resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTemplateDO">
|
|
|
<id column="id" property="id"/>
|
|
|
+ <result column="channel_id" property="channelId"/>
|
|
|
+ <result column="channel_name" property="channelName"/>
|
|
|
<result column="template_code" property="templateCode"/>
|
|
|
<result column="email_title" property="emailTitle"/>
|
|
|
<result column="email_body" property="emailBody"/>
|
|
@@ -14,9 +16,9 @@
|
|
|
<result column="updatetime" property="updateTime"/>
|
|
|
</resultMap>
|
|
|
<insert id="saveTemplateInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
- insert into email_template(template_code,email_title,email_body,open_status,isvalid,creatorid,createtime,updaterid,updatetime)
|
|
|
+ insert into email_template(channel_id,template_code,email_title,email_body,open_status,isvalid,creatorid,createtime,updaterid,updatetime)
|
|
|
values
|
|
|
- (#{templateCode},#{emailTitle},#{emailBody},#{openStatus},#{isvalid},#{creatorId},#{createTime},#{updaterId},#{updateTime})
|
|
|
+ (#{channelId},#{templateCode},#{emailTitle},#{emailBody},#{openStatus},#{isvalid},#{creatorId},#{createTime},#{updaterId},#{updateTime})
|
|
|
</insert>
|
|
|
<update id="deleteTemplateList">
|
|
|
update email_template set isvalid=0,updatetime=now(),updaterid=#{userId} where isvalid=1
|
|
@@ -26,45 +28,66 @@
|
|
|
</foreach>
|
|
|
</update>
|
|
|
<update id="updateTemplateInfo">
|
|
|
- update email_template set template_code=#{templateCode},email_title=#{emailTitle},email_body=#{emailBody},open_status=#{openStatus},updatetime=#{updateTime},updaterid=#{updaterId}
|
|
|
+ update email_template set channel_id = #{channelId}, template_code=#{templateCode},email_title=#{emailTitle},email_body=#{emailBody},open_status=#{openStatus},updatetime=#{updateTime},updaterid=#{updaterId}
|
|
|
where id=#{id} and isvalid=1
|
|
|
</update>
|
|
|
<update id="updateOpenStatus">
|
|
|
update email_template set open_status =#{item.status},updatetime=now(),updaterid=#{userId} where id=#{item.id}
|
|
|
</update>
|
|
|
<select id="searchEmailTemplateList" resultMap="BaseResultMap">
|
|
|
- select id,template_code,email_title,email_body,open_status,isvalid,creatorid,createtime,updaterid,updatetime
|
|
|
- from email_template where isvalid=1
|
|
|
+ select et.id,
|
|
|
+ et.channel_id,
|
|
|
+ ci.channel_name,
|
|
|
+ et.template_code,
|
|
|
+ et.email_title,
|
|
|
+ et.email_body,
|
|
|
+ et.open_status,
|
|
|
+ et.isvalid,
|
|
|
+ et.creatorid,
|
|
|
+ et.createtime,
|
|
|
+ et.updaterid,
|
|
|
+ et.updatetime
|
|
|
+ from email_template et
|
|
|
+ join channel_info ci on ci.id = et.channel_id
|
|
|
+ where et.isvalid=1 and ci.isvalid=1
|
|
|
<if test="emailTitle != null and emailTitle !=''">
|
|
|
- and email_title like concat('%',#{emailTitle},'%')
|
|
|
+ and et.email_title like concat('%',#{emailTitle},'%')
|
|
|
</if>
|
|
|
<if test="openStatus != null">
|
|
|
- and open_status =#{openStatus}
|
|
|
+ and et.open_status =#{openStatus}
|
|
|
+ </if>
|
|
|
+ <if test="channelName != null and channelName != ''">
|
|
|
+ and ci.channel_name =#{channelName}
|
|
|
</if>
|
|
|
order by updatetime desc
|
|
|
limit #{offset},#{pageSize}
|
|
|
</select>
|
|
|
<select id="countEmailTemplateList" resultType="java.lang.Long">
|
|
|
- select count(1)
|
|
|
- from email_template where isvalid=1
|
|
|
+ select count(et.id)
|
|
|
+ from email_template et
|
|
|
+ join channel_info ci on ci.id = et.channel_id
|
|
|
+ where et.isvalid=1 and ci.isvalid=1
|
|
|
<if test="emailTitle != null and emailTitle !=''">
|
|
|
- and email_title like concat('%',#{emailTitle},'%')
|
|
|
+ and et.email_title like concat('%',#{emailTitle},'%')
|
|
|
</if>
|
|
|
<if test="openStatus != null">
|
|
|
- and open_status =#{openStatus}
|
|
|
+ and et.open_status =#{openStatus}
|
|
|
+ </if>
|
|
|
+ <if test="channelName != null and channelName != ''">
|
|
|
+ and ci.channel_name =#{channelName}
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="searchTemplateById" resultMap="BaseResultMap">
|
|
|
- select id,template_code,email_title,email_body,open_status,isvalid,creatorid,createtime,updaterid,updatetime
|
|
|
+ select id,channel_id,template_code,email_title,email_body,open_status,isvalid,creatorid,createtime,updaterid,updatetime
|
|
|
from email_template where isvalid=1 and id=#{id}
|
|
|
</select>
|
|
|
<select id="searchTemplateByName" resultMap="BaseResultMap">
|
|
|
- select id,template_code,email_title,email_body,open_status,isvalid,creatorid,createtime,updaterid,updatetime
|
|
|
+ select id,channel_id,template_code,email_title,email_body,open_status,isvalid,creatorid,createtime,updaterid,updatetime
|
|
|
from email_template where isvalid=1 and email_title=#{emailTitle} limit 1
|
|
|
</select>
|
|
|
<select id="selectByCode" resultMap="BaseResultMap">
|
|
|
- select id,template_code,email_title,email_body,open_status,isvalid,creatorid,createtime,updaterid,updatetime
|
|
|
- from email_template where isvalid=1 and template_code=#{templateCode}
|
|
|
+ select id,channel_id,template_code,email_title,email_body,open_status,isvalid,creatorid,createtime,updaterid,updatetime
|
|
|
+ from email_template where isvalid=1 and template_code=#{templateCode} and channel_id=#{channelId}
|
|
|
</select>
|
|
|
|
|
|
|