元气优淘服务端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
youtao/service/src/main/java/com/hfkj/dao/BsMessageMapperExt.java

36 lines
1.4 KiB

package com.hfkj.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* mapper扩展类
*/
public interface BsMessageMapperExt {
@Select("<script>" +
" select * from (" +
" select " +
" a.id," +
" a.user_id userId," +
" a.type," +
" a.title, " +
" a.carousel," +
" a.content," +
" a.create_time createTime," +
" case count(b.id) when 0 then false else true end readStatus" +
" from bs_message a" +
" LEFT JOIN bs_message_read b on b.message_id = a.id and b.user_id = #{param.userId} and b.`status` = 1" +
" where 1 = 1 and a.user_id = #{param.userId} or a.user_id is null" +
" <if test='param.msgStatus != null'> and a.`status` = #{param.msgStatus} </if>" +
" <if test='param.msgStatus != null'> and a.`status` = #{param.msgStatus} </if>" +
" <if test='param.type != null'> and a.type = #{param.type} </if>" +
" GROUP BY a.id" +
" ORDER BY a.create_time desc) a where 1 = 1" +
" <if test='param.readStatus != null'> and a.readStatus = #{param.readStatus} </if>" +
"</script>")
List<Map<String,Object>> queryUserMsgList(@Param("param") Map<String,Object> param);
}