huanghongfa
2021-01-05 d9eee1919dbff7ffddc48b1f4fee2ec41a54a2a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.panzhihua.service_user.dao;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.common.model.vos.user.NoticeUnReadVO;
import com.panzhihua.service_user.model.dos.SysUserNoticeDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 通知
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2021-01-04 17:24
 **/
@Mapper
public interface SysUserNoticeDAO extends BaseMapper<SysUserNoticeDO> {
 
    @Select("SELECT \n" +
            "COUNT(case WHEN type=1 then id else null end )activityUnread,\n" +
            "COUNT(case WHEN type=2 then id else null end )serviceUnread,\n" +
            "COUNT(case WHEN type=3 then id else null end )systemUnread,\n" +
            "COUNT(case WHEN type=4 then id else null end )scoreUnread\n" +
            "FROM\n" +
            "sys_user_notice \n" +
            "WHERE\n" +
            "user_id =#{userId} and `status`=0")
    NoticeUnReadVO noticeUnreadNum(Long userId);
}