<?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="org.linlinjava.jz.db.dao.HmNoticeUserMappers">
	<resultMap id="BaseResultMap"
		type="org.linlinjava.jz.db.dto.hm.HmNoticeDataDto">
		<!-- WARNING - @mbg.generated This element is automatically generated by 
			MyBatis Generator, do not modify. -->
		<id column="id" jdbcType="BIGINT" property="id" />
		<result column="notice_id" jdbcType="BIGINT"
			property="noticeId" />
		<result column="notice_content" jdbcType="VARCHAR"
			property="noticeContent" />
		<result column="ticket_status" jdbcType="VARCHAR"
			property="ticketStatus" />
		<result column="app_user_id" jdbcType="BIGINT"
			property="appUserId" />
		<result column="is_read" jdbcType="INTEGER" property="isRead" />
		<result column="read_time" jdbcType="TIMESTAMP"
			property="readTime" />
		<result column="create_time" jdbcType="TIMESTAMP"
			property="createTime" />

		<result column="r_type" jdbcType="VARCHAR" property="rType" />
		<result column="r_id" jdbcType="VARCHAR" property="rId" />
	</resultMap>


	<select id="getUserNoticeList"  resultMap="BaseResultMap">
		SELECT
		hnu.id,
		hnu.notice_id,
		hnu.notice_content,
		hnu.create_time,
		hn.r_type,
		hn.r_id,
		hn.remark
		FROM
		hm_notice_user hnu
		LEFT JOIN hm_notice hn ON hnu.notice_id = hn.id
		where hnu.is_read=0 
		and hnu.app_user_id=#{appUserId}
		 and FIND_IN_SET(hn.r_type,#{rType})
		 and hnu.create_time>#{sevenDay,jdbcType=TIMESTAMP}
		order by hnu.id desc
	</select>


</mapper>