123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <?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.ym.mec.biz.dal.dao.SysMessageDao">
- <resultMap type="com.ym.mec.biz.dal.entity.SysMessage" id="message">
- <result column="id_" property="id"/>
- <result column="title_" property="title"/>
- <result column="content_" property="content"/>
- <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="receiver_" property="receiver"/>
- <result column="send_time_" property="sendTime"/>
- <result column="error_msg_" property="errorMsg"/>
- <result column="create_on_" property="createOn"/>
- <result column="modify_on_" property="modifyOn"/>
- <result column="user_id_" property="userId"/>
- <result column="memo_" property="memo"/>
- <result column="read_status_" property="readStatus"/>
- </resultMap>
- <sql id="queryCondition">
- <where>
- <if test="userId != null">
- and user_id_ = #{userId,jdbcType=BIGINT}
- </if>
- <if test="receiver != null">
- and receiver_ like '%' #{receiver} '%'
- </if>
- <if test="status != null">
- and status_ = #{status,jdbcType=TINYINT}
- </if>
- <if test="readStatus != null">
- and read_status_ = #{readStatus,jdbcType=TINYINT}
- </if>
- <if test="title != null">
- and title_ like '%' #{title} '%'
- </if>
- <if test="type != null">
- and type_ = #{type}
- </if>
- </where>
- </sql>
- <select id="get" resultMap="message" parameterType="java.lang.Long">
- select
- <include refid="Base_Column_List" />
- from sys_message
- where id_ = #{id,jdbcType=BIGINT}
- </select>
- <delete id="delete" parameterType="java.lang.Long">
- delete from
- sys_message
- where
- id_ = #{id,jdbcType=BIGINT}
- </delete>
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysMessage">
- insert into sys_message (id_, user_id_,
- title_, content_,
- type_, status_, receiver_,
- send_time_, error_msg_,read_status_,memo_, create_on_,
- modify_on_)
- values (#{id,jdbcType=BIGINT},#{userId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR},
- #{content,jdbcType=VARCHAR},
- #{type,jdbcType=TINYINT},
- #{status,jdbcType=TINYINT}, #{receiver,jdbcType=VARCHAR},
- #{sendTime},#{errorMsg,jdbcType=VARCHAR},#{readStatus},#{memo},
- #{createOn},
- #{modifyOn})
- </insert>
- <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.SysMessage">
- insert into sys_message (id_, user_id_,
- title_, content_,
- type_, status_, receiver_,
- send_time_, error_msg_,read_status_,memo_, create_on_,
- modify_on_)
- values
- <foreach collection="list" item="item" index="index"
- separator=",">
- (
- #{item.id,jdbcType=BIGINT},#{item.userId,jdbcType=BIGINT}, #{item.title,jdbcType=VARCHAR},
- #{item.content,jdbcType=VARCHAR},
- #{item.type,jdbcType=TINYINT},
- #{item.status,jdbcType=TINYINT}, #{item.receiver,jdbcType=VARCHAR},
- #{item.sendTime},#{item.errorMsg,jdbcType=VARCHAR},#{item.readStatus},#{item.memo},
- #{item.createOn},
- #{item.modifyOn}
- )
- </foreach>
- </insert>
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.SysMessage">
- update sys_message
- <set>
- <if test="userId != null">
- user_id_ = #{userId,jdbcType=BIGINT},
- </if>
- <if test="title != null">
- title_ = #{title,jdbcType=VARCHAR},
- </if>
- <if test="content != null">
- content_ = #{content,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- type_ = #{type,jdbcType=TINYINT},
- </if>
- <if test="status != null">
- status_ = #{status,jdbcType=TINYINT},
- </if>
- <if test="receiver != null">
- receiver_ = #{receiver,jdbcType=VARCHAR},
- </if>
- <if test="sendTime != null">
- send_time_ = #{sendTime},
- </if>
- <if test="errorMsg != null">
- error_msg_ = #{errorMsg,jdbcType=VARCHAR},
- </if>
- <if test="readStatus != null">
- read_status_ = #{readStatus,jdbcType=TINYINT},
- </if>
- <if test="memo != null">
- memo_ = #{memo,jdbcType=VARCHAR},
- </if>
- <if test="createOn != null">
- create_on_ = #{createOn},
- </if>
- <if test="modifyOn != null">
- modify_on_ = #{modifyOn},
- </if>
- </set>
- where id_ = #{id,jdbcType=BIGINT}
- </update>
- <update id="updateStatus">
- update sys_message set read_status_=#{status}
- where user_id_ =#{userId}
- </update>
- <update id="updateOneStatus">
- update sys_message set read_status_=#{status}
- where id_ =#{id}
- </update>
- <select id="queryCount" parameterType="map" resultType="int">
- select count(*) from sys_message
- <include refid="queryCondition" />
- </select>
- <select id="queryPage" parameterType="map" resultMap="message">
- select * from sys_message
- <include refid="queryCondition" />
- <include refid="global.orderby" />
- <include refid="global.limit" />
- </select>
- <select id="queryByStatusAndTime" resultMap="message">
- select
- <include refid="Base_Column_List" />
- from sys_message where status_ = #{status} and <![CDATA[DATE_ADD(CURDATE(),
- INTERVAL #{recentMin} MINUTE) >= date(send_time_)]]>
- </select>
- <select id="queryCountOfUnread" resultType="int" parameterType="java.lang.Long">
- select count(*) from sys_message
- where user_id_ = #{userId,jdbcType=BIGINT} and read_status_ = 0
- </select>
- </mapper>
|