Files
vlv-ai-analytic-center/ai-analytic-center-biz/src/main/resources/mapper/TmOdsVdqwMessagearchivingMapper.xml
2025-03-25 18:39:12 +08:00

83 lines
3.2 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.volvo.ai.analytic.center.mapper.TmOdsVdqwMessagearchivingMapper">
<select id="countOdsVdqwMessageByData" resultType="java.lang.Integer">
select count(1) from (
SELECT
tovm.from_user_id as fromUserUnId,
tovm.accept_user_id as acceptUserId,
tovm.msg_time as msgTime,
tovm.chat_type as chatType
FROM
`tm_ods_vdqw_messagearchiving` tovm
WHERE tovm.is_deleted = 0
AND tovm.msg_time between #{statTime} and #{endTime}
AND tovm.chat_type = 0
<if test="retry==true">
and not exists(
select 1 from tt_vdqw_record t
where t.from_accept_user_id = CONCAT(LEAST(tovm.from_user_id, tovm.accept_user_id),'_',GREATEST(tovm.from_user_id, tovm.accept_user_id))
AND t.msg_time between #{statTime} and #{endTime}
)
</if>
GROUP BY
LEAST(tovm.from_user_id, tovm.accept_user_id),
GREATEST(tovm.from_user_id, tovm.accept_user_id)
) tab
</select>
<select id="queryOdsVdqwMessageByData" resultType="com.volvo.ai.analytic.center.dto.corpus.OdsVdqwMessageOTD" >
SELECT
tovm.from_user_id as fromUserId,
tovm.accept_user_id as acceptUserId,
tovm.msg_time as msgTime,
tovm.chat_type as chatType,
CONCAT(LEAST(tovm.from_user_id, tovm.accept_user_id),'_',GREATEST(tovm.from_user_id, tovm.accept_user_id)) as fromAcceptUserId
FROM
`tm_ods_vdqw_messagearchiving` tovm
WHERE tovm.is_deleted = 0
AND tovm.msg_time between #{statTime} and #{endTime}
AND tovm.chat_type = 0
<if test="retry==true">
and not exists(
select 1 from tt_vdqw_record t
where t.from_accept_user_id = CONCAT(LEAST(tovm.from_user_id, tovm.accept_user_id),'_',GREATEST(tovm.from_user_id, tovm.accept_user_id))
AND t.msg_time between #{statTime} and #{endTime}
)
</if>
GROUP BY
LEAST(tovm.from_user_id, tovm.accept_user_id),
GREATEST(tovm.from_user_id, tovm.accept_user_id)
LIMIT #{offset}, #{pageSize}
</select>
<select id="queryOdsVdqwMessageByFromUserIdAndAcceptUserId" resultType="com.volvo.ai.analytic.center.dto.corpus.OdsVdqwMessageOTD" >
SELECT
tovm.msg_time,
tovm.content,
tovm.from_user_id,
tovm.accept_user_id
FROM
`tm_ods_vdqw_messagearchiving` tovm
WHERE tovm.is_deleted = 0
AND tovm.msg_time between #{statTime} and #{endTime}
AND tovm.from_user_id IN
<foreach collection="userIdList" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
AND tovm.accept_user_id IN
<foreach collection="userIdList" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
AND tovm.chat_type = 0
and tovm.msg_type='text'
and tovm.action_type='send'
ORDER BY
tovm.msg_time
</select>
</mapper>