Commit 7c155e22 by 郑永强

【1002900】消息提醒已读状态接口优化

parent f5c94d91
......@@ -112,7 +112,9 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
CultivateNotify byId = cultivateNotifyDao.getById(messageId);
notifyDTO.setMessageType(byId.getMessageType());
notifyDTO.setTitle(byId.getTitle());
cultivateNotifySendDao.updateIsRead(wechatUserId,messageId);
// cultivateNotifySendDao.updateIsRead(wechatUserId,messageId);
// 更新之前的所有未读消息都不显示到主页
cultivateNotifySendDao.updateShowHome(wechatUserId);
return notifyDTO;
}
......
......@@ -13,6 +13,8 @@ public interface CultivateNotifySendDao extends BaseDao<CultivateNotifySend> {
void updateIsRead(Long wechatUserId, Long messageId);
void updateShowHome(Long wechatUserId);
List<CultivateNotifyTypeDTO> getNotify4Type(Long wechatUserId);
List<CultivateNotifyDTO> getNotifyListByType(Long wechatUserId, Integer messageType,Integer currentPage,Integer numPerPage);
......
......@@ -28,6 +28,13 @@ public class CultivateNotifySendDaoImpl extends BaseDaoImpl<CultivateNotifySend>
}
@Override
public void updateShowHome(Long wechatUserId) {
Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId);
super.getSessionTemplate().update(getStatement("updateShowHome"),map);
}
@Override
public List<CultivateNotifyTypeDTO> getNotify4Type(Long wechatUserId) {
return super.getSessionTemplate().selectList(getStatement("getNotify4Type"),wechatUserId);
}
......
......@@ -27,6 +27,7 @@
message_id,
message_type,
is_read,
show_home,
create_time,
update_time
)
......@@ -39,6 +40,7 @@
#{item.messageId},
#{item.messageType},
0,
1,
NOW(),
NOW()
)
......@@ -48,7 +50,7 @@
<select id="getFirstNoReadNotify" parameterType="Long" resultType="Long">
select message_id messageId from cultivate_notify_send
where wechat_user_id=#{wechatUserId}
and is_read=0
and is_read=0 AND show_home=1
order by create_time desc limit 1
</select>
......@@ -78,6 +80,11 @@
and message_id=#{messageId}
</update>
<update id="updateShowHome" parameterType="map">
update cultivate_notify_send set show_home=0,update_time=now()
where wechat_user_id=#{wechatUserId} AND show_home=1
</update>
<select id="getNotify4Type" resultType="com.pcloud.book.cultivate.dto.CultivateNotifyTypeDTO">
select message_type messageType ,MAX(create_time) firstNoReadDate ,count(1) noReadCounts from cultivate_notify_send
where is_read=0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment