44 lines
1.2 KiB
XML
44 lines
1.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.ai.da.mapper.primary.NotificationMapper">
|
||
|
|
|
||
|
|
<select id="getTypeCount" resultType="java.util.Map">
|
||
|
|
SELECT type, count(id) as count
|
||
|
|
FROM `t_notification`
|
||
|
|
WHERE receiver_id = #{receiverId}
|
||
|
|
AND is_read = 0
|
||
|
|
GROUP BY type
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getUniqueLikeAndFollow" resultType="com.ai.da.mapper.primary.entity.Notification">
|
||
|
|
SELECT *
|
||
|
|
FROM `t_notification`
|
||
|
|
WHERE type = #{type}
|
||
|
|
AND sender_id = #{senderId}
|
||
|
|
AND receiver_id = #{receiverId}
|
||
|
|
<if test="type == 'like'">
|
||
|
|
AND portfolio_id = #{portfolioId}
|
||
|
|
</if>
|
||
|
|
LIMIT 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<update id="updateUniqueLikeAndFollow" >
|
||
|
|
UPDATE `t_notification`
|
||
|
|
SET
|
||
|
|
is_read = 0,
|
||
|
|
create_time = #{time},
|
||
|
|
update_time = #{time},
|
||
|
|
is_deleted = 0
|
||
|
|
WHERE id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="deleteNotification" >
|
||
|
|
UPDATE `t_notification`
|
||
|
|
SET
|
||
|
|
update_time = #{time},
|
||
|
|
is_deleted = 1
|
||
|
|
WHERE id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
</mapper>
|