<?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.bj1890.avenue.admin.mapper.SysUserMsgMapper">

<select id="getPmUserMsg" resultType="com.bj1890.avenue.admin.api.entity.SysUserMsg">
select * from sys_user_msg
<where>
	<if test="dto.userId != null ">
		AND user_id = #{dto.userId}
	</if>

	<if test="dto.msgContent != null and dto.msgContent != ''">
		<bind name="likeMsgContent" value="'%'+dto.msgContent+'%'"/>
		AND msg_content LIKE #{likeMsgContent}
	</if>
	<if test="dto.readstate != null  ">
		AND readstate = #{dto.readstate}
	</if>
</where>
order by create_time desc
</select>

</mapper>