<?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">
|
<mapper namespace="com.stylefeng.guns.modular.system.dao.SystemNoticeMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.SystemNotice">
|
<id column="id" property="id"/>
|
<result column="type" property="type"/>
|
<result column="noticeType" property="noticeType"/>
|
<result column="userType" property="userType"/>
|
<result column="noticesId" property="noticesId"/>
|
<result column="content" property="content"/>
|
<result column="userId" property="userId"/>
|
<result column="insertTime" property="insertTime"/>
|
<result column="read" property="read"/>
|
</resultMap>
|
|
|
<select id="queryNoReadNoticeNum" resultType="int">
|
select count(id) from t_system_notice where userType = 1 and userId = #{uid} and `read` = 1
|
</select>
|
|
|
<select id="queryList" resultType="map">
|
select
|
id as id,
|
noticeType as noticeType,
|
`type` as `type`,
|
content as content,
|
DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as `time`,
|
`read` as `read`
|
from t_system_notice where `type` = 2 and userType = 1 and userId = #{uid} order by insertTime desc limit #{pageNum}, #{size}
|
</select>
|
|
|
|
<update id="readSystemNotice">
|
update t_system_notice set `read` = 2 where id = #{id} and userId = #{uid} and userType = 1
|
</update>
|
|
|
<delete id="delSystemNotice">
|
delete from t_system_notice where userType = 1
|
<if test="null != uid">
|
and userId = #{uid}
|
</if>
|
<if test="null != id">
|
and id = #{id}
|
</if>
|
</delete>
|
</mapper>
|