Commit 9979ba7f authored by liming's avatar liming

聊天记录已读未读状态更新

parent b6eafe5f
......@@ -88,4 +88,10 @@ public class SportUserController {
public ResponseEntity<Result<List<SportUserCurrencyPageVO>>> getUserCurrencyPage(@PathVariable("sportUserId") Long sportUserId, @RequestBody SportUserCurrencyPageDTO param) {
return success(sportUserGameCurrencyService.getUserCurrencyPage(sportUserId, param));
}
@ApiOperation("获取用户是否有未读消息接口")
@GetMapping("/new/message/{sportUserId}")
public ResponseEntity<Result<NewMessageVO>> getUserNewMessage(@PathVariable("sportUserId") Long sportUserId) {
return success(sportUserService.getUserNewMessage(sportUserId));
}
}
package com.antai.sport.http.server.server.api.business.user.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@ApiModel("是否有新消息对象")
@Data
public class NewMessageVO {
private Boolean hasNewFriendRequest;
private Boolean hasNewMessage;
}
package com.antai.sport.http.server.server.api.business.user.mapper;
import com.antai.sport.http.server.repository.sport.entity.SportUserSummary;
import com.antai.sport.http.server.server.api.business.user.dto.NewMessageVO;
import org.apache.ibatis.annotations.Param;
public interface SportUserSummaryBusinessMapper {
int updateUserPraise(@Param("userId") Long userId, @Param("sportType") Integer sportType);
SportUserSummary selectBySportTypeAndUserId(@Param("userId") Long userId, @Param("sportType") Integer sportType);
NewMessageVO getUserNewMessage(@Param("sportUserId") Long sportUserId);
}
......@@ -8,6 +8,7 @@ import com.antai.sport.http.server.repository.sport.mapper.SportUserMapper;
import com.antai.sport.http.server.server.api.business.achievement.service.AchievementService;
import com.antai.sport.http.server.server.api.business.traininglog.dto.SportUserTrainingLogSummaryVO;
import com.antai.sport.http.server.server.api.business.traininglog.service.SportUserTrainingLogService;
import com.antai.sport.http.server.server.api.business.user.dto.NewMessageVO;
import com.antai.sport.http.server.server.api.business.user.dto.RespUserHomeInfo;
import com.antai.sport.http.server.server.api.business.user.mapper.SportUserSummaryBusinessMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -124,4 +125,8 @@ public class SportUserService {
continuousLoginDays.setLastLoginDate(LocalDate.now());
sportUserContinuousLoginDaysMapper.updateById(continuousLoginDays);
}
public NewMessageVO getUserNewMessage(Long sportUserId) {
return sportUserSummaryBusinessMapper.getUserNewMessage(sportUserId);
}
}
......@@ -6,11 +6,22 @@
set total_praise_num = ifnull(total_praise_num, 0) + 1
where user_id = #{userId} and type = #{sportType}
</update>
<select id="selectBySportTypeAndUserId"
resultType="com.antai.sport.http.server.repository.sport.entity.SportUserSummary">
select *
from sport_user_summary
where user_id = #{userId} and type = #{sportType}
</select>
<select id="getUserNewMessage" resultType="com.antai.sport.http.server.server.api.business.user.dto.NewMessageVO">
select (select count(1) > 0
from sport_user_friend_request
where status = 10
and target_user_id = #{sportUserId}) as hasNewFriendRequest,
(select count(1) > 0
from sport_chat_history
where status = 1
and receiver_id = #{sportUserId}) as hasNewMessage
</select>
</mapper>
\ No newline at end of file
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