+mock sql

This commit is contained in:
wuyu 2023-11-25 14:50:30 +08:00
parent da87be0db5
commit 00538e0484

View File

@ -9,16 +9,24 @@
</sql>
<select id="queryByTemplateCodes" resultType="cn.axzo.msg.center.domain.entity.PendingMessageRecord">
select * from (
select * from (SELECT * FROM (SELECT * FROM pending_message_record WHERE org_id=326 AND DATE(create_at) <![CDATA[<]]> CURDATE() AND state IN('HAS_BEEN_SENT')
AND template_code IN('d1d4793c84e14d20ae1cbc399338efa3','367ba552bb374049a73e737ac3b8b08c') ORDER BY create_at ASC) old_pending_message
UNION ALL
SELECT * FROM(SELECT * FROM pending_message_record WHERE org_id=326 AND DATE(create_at) = CURDATE() AND state IN('HAS_BEEN_SENT','COMPLETED')
AND template_code IN('d1d4793c84e14d20ae1cbc399338efa3','367ba552bb374049a73e737ac3b8b08c') ORDER BY create_at DESC) new_pending_message
UNION ALL
SELECT * FROM(SELECT * FROM pending_message_record WHERE org_id=326 AND DATE(create_at) = CURDATE() AND state IN('HAS_BEEN_SENT','COMPLETED')
AND template_code IN('出厂打卡') ORDER BY create_at DESC) new_pending_message1
UNION ALL
SELECT * FROM(SELECT * FROM pending_message_record WHERE org_id=326 AND DATE(create_at) = CURDATE() AND state IN('HAS_BEEN_SENT','COMPLETED')
AND template_code IN('进场打卡') ORDER BY create_at DESC) new_pending_message2)aa
<!--select * from (
SELECT * FROM (SELECT * FROM pending_message_record WHERE DATE(create_at) <![CDATA[<]]> #{selectDate} AND state IN('HAS_BEEN_SENT')
AND template_code IN('d1d4793c84e14d20ae1cbc399338efa3','367ba552bb374049a73e737ac3b8b08c')
<if test="workspaceId != null"> AND org_id=#{workspaceId} </if>
ORDER BY create_at ASC) old_pending_message
UNION ALL
SELECT * FROM(SELECT * FROM pending_message_record WHERE DATE(create_at) = #{selectDate} AND state IN
<foreach collection="templateCodes " item="item" open="(" separator="," close=")" index="index">
'${item}'
</foreach>
SELECT * FROM(SELECT * FROM pending_message_record WHERE DATE(create_at) = #{selectDate}
AND template_code IN('d1d4793c84e14d20ae1cbc399338efa3','367ba552bb374049a73e737ac3b8b08c') <if test="workspaceId != null"> AND org_id=#{workspaceId} </if> ORDER BY create_at DESC) new_pending_message
UNION ALL
SELECT * FROM(SELECT * FROM pending_message_record WHERE DATE(create_at) = #{selectDate} AND state IN('HAS_BEEN_SENT','COMPLETED')
@ -26,7 +34,7 @@
UNION ALL
SELECT * FROM(SELECT * FROM pending_message_record WHERE DATE(create_at) = #{selectDate} AND state IN('HAS_BEEN_SENT','COMPLETED')
AND template_code IN('进场打卡') <if test="workspaceId != null"> AND org_id=#{workspaceId} </if> ORDER BY create_at DESC) new_pending_message2
)cc
)cc-->
</select>