<?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"><mappernamespace="com.testor.module.messageNotice.dao.TMsgNoticeDao"><!-- 开启二级缓存 --><!-- <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> --><!-- 通用查询映射结果 --><resultMapid="BaseResultMap"type="com.testor.module.messageNotice.model.domain.TMsgNotice"><idcolumn="id"property="id"/><idcolumn="business_key"property="businessKey"/><idcolumn="business_id"property="businessId"/><idcolumn="title"property="title"/><idcolumn="content"property="content"/><idcolumn="is_read"property="isRead"/><idcolumn="tenant_id"property="tenantId"/><idcolumn="user_id"property="userId"/></resultMap><resultMapid="countUnReadResult"type="java.util.HashMap"><resultcolumn="num"property="num"javaType="java.lang.String"/><resultcolumn="businessKey"property="businessKey"javaType="java.lang.String"/></resultMap><selectid="countUnRead"resultMap="countUnReadResult"> select count(id) num, business_key businessKey FROM t_msg_notice WHERE user_id= #{userId} and status = 0 and is_read = 0 group by business_key</select></mapper>