forked from zhangyuan/epmet-cloud-lingshan
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
5.0 KiB
149 lines
5.0 KiB
<?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.epmet.dao.PersonalTemplateDao">
|
|
|
|
<resultMap type="com.epmet.entity.PersonalTemplateEntity" id="personalTemplateMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="customerId" column="CUSTOMER_ID"/>
|
|
<result property="clientType" column="CLIENT_TYPE"/>
|
|
<result property="appId" column="APP_ID"/>
|
|
<result property="pid" column="PID"/>
|
|
<result property="priTmplId" column="PRI_TMPL_ID"/>
|
|
<result property="type" column="TYPE"/>
|
|
<result property="title" column="TITLE"/>
|
|
<result property="keyWords" column="KEY_WORDS"/>
|
|
<result property="sceneDesc" column="SCENE_DESC"/>
|
|
<result property="revision" column="REVISION"/>
|
|
<result property="delFlag" column="DEL_FLAG"/>
|
|
<result property="createdBy" column="CREATED_BY"/>
|
|
<result property="createdTime" column="CREATED_TIME"/>
|
|
<result property="updatedBy" column="UPDATED_BY"/>
|
|
<result property="updatedTime" column="UPDATED_TIME"/>
|
|
</resultMap>
|
|
<select id="selectListByPid" resultType="com.epmet.dto.PersonalTemplateDTO">
|
|
SELECT ID,
|
|
CUSTOMER_ID,
|
|
CLIENT_TYPE,
|
|
PRI_TMPL_ID
|
|
FROM personal_template
|
|
WHERE DEL_FLAG = '0'
|
|
AND PID = #{pid}
|
|
</select>
|
|
<select id="selectListByAppId" resultType="com.epmet.dto.PersonalTemplateDTO">
|
|
SELECT *
|
|
FROM personal_template
|
|
WHERE DEL_FLAG = '0'
|
|
AND APP_ID = #{appId}
|
|
ORDER BY CREATED_TIME DESC
|
|
</select>
|
|
<select id="selectSetTemp" resultType="com.epmet.dto.PersonalTemplateDTO">
|
|
SELECT ID,
|
|
CUSTOMER_ID,
|
|
CLIENT_TYPE,
|
|
APP_ID,
|
|
PID,
|
|
PRI_TMPL_ID,
|
|
TYPE,
|
|
TID,
|
|
TITLE,
|
|
KEY_IDS,
|
|
KEY_WORDS,
|
|
SCENE_DESC
|
|
FROM personal_template
|
|
WHERE DEL_FLAG = '0'
|
|
AND CUSTOMER_ID = #{customerId}
|
|
AND PID = #{pid}
|
|
</select>
|
|
<select id="selectListByCustomerId" resultType="com.epmet.dto.result.TemplateDTO">
|
|
SELECT
|
|
t1.ID AS id,
|
|
t1.PRI_TMPL_ID AS tmplId,
|
|
IFNULL(t2.ID, '') AS personalId,
|
|
IFNULL(t2.PRI_TMPL_ID, '') AS personalTempId,
|
|
t1.TITLE AS title,
|
|
IF(ISNULL(t2.ID),'0','1') AS state
|
|
FROM
|
|
(SELECT
|
|
ID,
|
|
TITLE,
|
|
PRI_TMPL_ID,
|
|
CREATED_TIME
|
|
FROM
|
|
personal_template
|
|
WHERE
|
|
DEL_FLAG = '0'
|
|
AND APP_ID = #{appId}) t1
|
|
LEFT JOIN
|
|
(SELECT
|
|
ID,
|
|
TITLE,
|
|
PID,
|
|
PRI_TMPL_ID
|
|
FROM
|
|
personal_template
|
|
WHERE
|
|
DEL_FLAG = '0'
|
|
AND CUSTOMER_ID = #{customerId}
|
|
AND CLIENT_TYPE = #{clientType}) t2
|
|
ON t1.PRI_TMPL_ID = t2.PID
|
|
ORDER BY t1.CREATED_TIME DESC
|
|
</select>
|
|
|
|
<select id="selectTemplateList" resultType="com.epmet.dto.result.GetTemplateListResultDTO">
|
|
SELECT
|
|
title AS "templateType",
|
|
pri_tmpl_id AS "templateId"
|
|
FROM
|
|
personal_template
|
|
WHERE
|
|
del_flag = '0'
|
|
AND customer_id = #{customerId}
|
|
AND app_id = #{appId}
|
|
AND title = #{templateType}
|
|
AND key_ids = '5,4,2'<!-- 消息更新,详情内容,时间 -->
|
|
ORDER BY created_time ASC
|
|
</select>
|
|
|
|
<select id="selectCustomerTemplateList" resultType="com.epmet.dto.result.CustomerTemplateListResultDTO">
|
|
SELECT
|
|
pt.title AS "templateType",
|
|
pt.pri_tmpl_id AS "templateId",
|
|
cm.client AS "clientType"
|
|
FROM
|
|
personal_template pt
|
|
LEFT JOIN customer_mp cm ON pt.app_id = cm.app_id
|
|
WHERE
|
|
pt.del_flag = '0'
|
|
AND cm.del_flag = '0'
|
|
AND pt.customer_id = #{customerId}
|
|
AND pt.tid = #{publicId}
|
|
AND key_ids = #{keyIds}<!-- 消息更新,详情内容,时间 -->
|
|
ORDER BY pt.created_time ASC
|
|
</select>
|
|
<select id="selectListByKey" resultType="com.epmet.dto.PersonalTemplateDTO">
|
|
SELECT ID
|
|
FROM personal_template
|
|
WHERE DEL_FLAG = '0'
|
|
AND APP_ID=#{appId}
|
|
AND TID = #{tid}
|
|
AND KEY_IDS = #{keyIds}
|
|
</select>
|
|
|
|
<select id="selectTemplateListV2" resultType="com.epmet.dto.result.TemplateListV2ResultDTO">
|
|
SELECT
|
|
tid as "tid",
|
|
title AS "type",
|
|
pri_tmpl_id AS "templateId"
|
|
FROM
|
|
personal_template
|
|
WHERE
|
|
del_flag = '0'
|
|
AND customer_id = #{customerId}
|
|
AND client_type = #{app}
|
|
AND (
|
|
(KEY_IDS = '5,7,6' and tid = '8171')or
|
|
(KEY_IDS = '4,9,3' and tid = '2092'))
|
|
ORDER BY created_time ASC
|
|
</select>
|
|
</mapper>
|
|
|