<?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.dg.core.db.gen.mapper.ReplyTemplateMapper">
|
|
<resultMap type="com.dg.core.db.gen.entity.ReplyTemplateEntity" id="ReplyTemplateResult">
|
<id property="id" column="id" />
|
<id property="name" column="name" />
|
<id property="handleState" column="handle_state" />
|
<id property="response" column="response" />
|
<id property="guidance" column="guidance" />
|
<id property="accessoryUrl" column="accessory_url" />
|
<id property="createTime" column="create_time" />
|
<id property="updateTime" column="update_time" />
|
<id property="accessoryName" column="accessory_name" />
|
<id property="videoUrl" column="video_url" />
|
<id property="videoName" column="video_name" />
|
<id property="createUserId" column="create_user_id" />
|
<id property="departmentId" column="department_id" />
|
<id property="pictureUrl" column="picture_url" />
|
<id property="pictureName" column="picture_name" />
|
<id property="accessoryId" column="accessory_id" />
|
|
</resultMap>
|
|
<sql id="selectReplyTemplateVo">
|
SELECT
|
id,
|
name,
|
create_time,
|
update_time,
|
handle_state,
|
response,
|
accessory_url,
|
accessory_name,
|
video_url,
|
video_name,
|
picture_url,
|
picture_name,
|
department_id,
|
create_user_id,
|
accessory_id,
|
(select organization_name from automessage_organization_chart where automessage_organization_chart.id=automessage_reply_template.department_id) as departmentName,
|
(select user_name from automessage_sys_user where automessage_sys_user.user_id=automessage_reply_template.create_user_id) as createUser,
|
guidance
|
FROM
|
automessage_reply_template
|
</sql>
|
|
<select id="selectConfigList" resultMap="ReplyTemplateResult">
|
SELECT
|
id,
|
name,
|
create_time,
|
update_time,
|
handle_state,
|
response,
|
accessory_url,
|
accessory_name,
|
video_url,
|
video_name,
|
picture_url,
|
picture_name,
|
department_id,
|
create_user_id,
|
<if test="userId!=null and userId!=''">
|
(case create_user_id when #{userId} then 1 else 0 end)isDelete,
|
</if>
|
<if test="userId==null or userId==''">
|
1 isDelete,
|
</if>
|
accessory_id,
|
(select organization_name from automessage_organization_chart where automessage_organization_chart.id=automessage_reply_template.department_id) as departmentName,
|
(select user_name from automessage_sys_user where automessage_sys_user.user_id=automessage_reply_template.create_user_id) as createUser,
|
guidance
|
FROM
|
automessage_reply_template
|
<where>
|
<if test="Name != null and Name != ''">
|
AND automessage_reply_template.name like concat('%', #{Name}, '%')
|
</if>
|
<if test="ids != null">
|
and department_id IN
|
<foreach collection="ids" item="param" open="(" close=")" separator=",">
|
#{param}
|
</foreach>
|
</if>
|
</where>
|
order by create_time desc
|
</select>
|
|
|
<select id="selectConfigData" parameterType="string" resultMap="ReplyTemplateResult">
|
<include refid="selectReplyTemplateVo"/>
|
where id=#{Id}
|
</select>
|
|
|
<insert id="insertConfig" parameterType="com.dg.core.db.gen.entity.ReplyTemplateEntity">
|
insert into automessage_reply_template (
|
<if test="id != null">id,</if>
|
<if test="name != null and name != '' ">name,</if>
|
<if test="handleState != null and handleState != '' ">handle_state,</if>
|
<if test="response != null and response != '' ">response,</if>
|
<if test="guidance != null and guidance != '' ">guidance,</if>
|
<if test="accessoryUrl != null and accessoryUrl != '' ">accessory_url,</if>
|
<if test="accessoryName != null and accessoryName != '' ">accessory_name,</if>
|
<if test="videoUrl != null and videoUrl != '' ">video_url,</if>
|
<if test="videoName != null and videoName != '' ">video_name,</if>
|
<if test="pictureUrl != null and pictureUrl != '' ">picture_url,</if>
|
<if test="pictureName != null and pictureName != '' ">picture_name,</if>
|
<if test="createUserId != null and createUserId != '' ">create_user_id,</if>
|
<if test="departmentId != null and departmentId != '' ">department_id,</if>
|
<if test="accessoryId != null and accessoryId != '' ">accessory_id,</if>
|
update_time,
|
create_time
|
)values(
|
<if test="id != null">#{id},</if>
|
<if test="name != null and name != '' ">#{name},</if>
|
<if test="handleState != null and handleState != '' ">#{handleState},</if>
|
<if test="response != null and response != '' ">#{response},</if>
|
<if test="guidance != null and guidance != '' ">#{guidance},</if>
|
<if test="accessoryUrl != null and accessoryUrl != '' ">#{accessoryUrl},</if>
|
<if test="accessoryName != null and accessoryName != '' ">#{accessoryName},</if>
|
<if test="videoUrl != null and videoUrl != '' ">#{videoUrl},</if>
|
<if test="videoName != null and videoName != '' ">#{videoName},</if>
|
<if test="pictureUrl != null and pictureUrl != '' ">#{pictureUrl},</if>
|
<if test="pictureName != null and pictureName != '' ">#{pictureName},</if>
|
<if test="createUserId != null and createUserId != '' ">#{createUserId},</if>
|
<if test="departmentId != null and departmentId != '' ">#{departmentId},</if>
|
<if test="accessoryId != null and accessoryId != '' ">#{accessoryId},</if>
|
sysdate(),
|
sysdate()
|
)
|
</insert>
|
|
<update id="updateConfig" parameterType="com.dg.core.db.gen.entity.ReplyTemplateEntity">
|
update automessage_reply_template
|
<set>
|
<if test="id != null">id=#{id},</if>
|
<if test="name != null and name != '' ">name=#{name},</if>
|
<if test="handleState != null and handleState != '' ">handle_state=#{handleState},</if>
|
<if test="response != null and response != '' ">response=#{response},</if>
|
<if test="guidance != null and guidance != '' ">guidance=#{guidance},</if>
|
<if test="accessoryUrl != null and accessoryUrl != '' ">accessory_url=#{accessoryUrl},</if>
|
<if test="accessoryName != null and accessoryName != '' ">accessory_name=#{accessoryName},</if>
|
<if test="videoUrl != null and videoUrl != '' ">video_url=#{videoUrl},</if>
|
<if test="videoName != null and videoName != '' ">video_name=#{videoName},</if>
|
<if test="pictureUrl != null and pictureUrl != '' ">picture_url=#{pictureUrl},</if>
|
<if test="pictureName != null and pictureName != '' ">picture_name=#{pictureName},</if>
|
<if test="createUserId != null and createUserId != '' ">create_user_id=#{createUserId},</if>
|
<if test="departmentId != null and departmentId != '' ">department_id=#{departmentId},</if>
|
<if test="accessoryId != null and accessoryId != '' ">accessory_id=#{accessoryId},</if>
|
update_time=sysdate()
|
</set>
|
where id= #{id}
|
</update>
|
|
<delete id="deleteConfigById" parameterType="string">
|
delete from automessage_reply_template where id= #{Id}
|
</delete>
|
|
<select id="countNum" parameterType="string" resultType="integer">
|
select count(id) from automessage_reply_template
|
<where>
|
<if test="Name != null and Name != ''">
|
AND name=#{Name}
|
</if>
|
<if test="ids != null">
|
and department_id IN
|
<foreach collection="ids" item="param" open="(" close=")" separator=",">
|
#{param}
|
</foreach>
|
</if>
|
</where>
|
</select>
|
|
</mapper>
|