| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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">
- <!-- namespace必须指向DAO接口 -->
- <mapper namespace="com.jpsoft.employment.modules.base.dao.MessageInfoDAO">
- <resultMap id="MessageInfoMap" type="com.jpsoft.employment.modules.base.entity.MessageInfo">
- <id property="id" column="id_" />
- <result property="type" column="type_" />
- <result property="sendTime" column="send_time" />
- <result property="title" column="title_" />
- <result property="content" column="content_" />
- <result property="senderId" column="sender_id" />
- <result property="recipientId" column="recipient_id" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="createBy" column="create_by" />
- <result property="updateBy" column="update_by" />
- <result property="delFlag" column="del_flag" />
- <result property="isRead" column="is_read" />
- <result property="category" column="category_" />
- </resultMap>
- <insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.MessageInfo">
- <!--
- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
- select sys_guid() from dual
- </selectKey>
- -->
- <![CDATA[
- insert into base_message_info
- (id_,type_,send_time,title_,content_,sender_id,recipient_id,create_time,update_time,create_by,update_by,del_flag,is_read,category_)
- values
- (
- #{id,jdbcType=VARCHAR}
- ,#{type,jdbcType=VARCHAR}
- ,#{sendTime,jdbcType= TIMESTAMP }
- ,#{title,jdbcType=VARCHAR}
- ,#{content,jdbcType=VARCHAR}
- ,#{senderId,jdbcType=VARCHAR}
- ,#{recipientId,jdbcType=VARCHAR}
- ,#{createTime,jdbcType= TIMESTAMP }
- ,#{updateTime,jdbcType= TIMESTAMP }
- ,#{createBy,jdbcType=VARCHAR}
- ,#{updateBy,jdbcType=VARCHAR}
- ,#{delFlag,jdbcType= NUMERIC }
- ,#{isRead,jdbcType= NUMERIC }
- ,#{category,jdbcType=VARCHAR}
- )
- ]]>
- </insert>
- <delete id="delete" parameterType="string">
- delete from base_message_info where id_=#{id,jdbcType=VARCHAR}
- </delete>
- <update id="update" parameterType="com.jpsoft.employment.modules.base.entity.MessageInfo">
- update base_message_info
- <set>
- <if test="type!=null">
- type_=#{type,jdbcType=VARCHAR},
- </if>
- <if test="sendTime!=null">
- send_time=#{sendTime,jdbcType= TIMESTAMP },
- </if>
- <if test="title!=null">
- title_=#{title,jdbcType=VARCHAR},
- </if>
- <if test="content!=null">
- content_=#{content,jdbcType=VARCHAR},
- </if>
- <if test="senderId!=null">
- sender_id=#{senderId,jdbcType=VARCHAR},
- </if>
- <if test="recipientId!=null">
- recipient_id=#{recipientId,jdbcType=VARCHAR},
- </if>
- <if test="createTime!=null">
- create_time=#{createTime,jdbcType= TIMESTAMP },
- </if>
- <if test="updateTime!=null">
- update_time=#{updateTime,jdbcType= TIMESTAMP },
- </if>
- <if test="createBy!=null">
- create_by=#{createBy,jdbcType=VARCHAR},
- </if>
- <if test="updateBy!=null">
- update_by=#{updateBy,jdbcType=VARCHAR},
- </if>
- <if test="delFlag!=null">
- del_flag=#{delFlag,jdbcType= NUMERIC },
- </if>
- <if test="isRead!=null">
- is_read=#{isRead,jdbcType= NUMERIC },
- </if>
- <if test="category!=null">
- category_=#{category,jdbcType=VARCHAR},
- </if>
- </set>
- where id_=#{id}
- </update>
- <select id="get" parameterType="string" resultMap="MessageInfoMap">
- select * from base_message_info where id_=#{0}
- </select>
- <select id="exist" parameterType="string" resultType="int">
- select count(*) from base_message_info where id_=#{0}
- </select>
- <select id="list" resultMap="MessageInfoMap">
- select * from base_message_info
- </select>
- <select id="findByRecipientId" resultType="java.util.Map">
- select count(*) as 'count',type_ as 'type' from base_message_info
- where del_flag=false and is_read=false and recipient_id=#{0}
- group by type_
- </select>
- <select id="findByRecipientIdAndType" resultMap="MessageInfoMap">
- select * from base_message_info
- where del_flag=false and recipient_id=#{recipientId} and type_=#{type}
- </select>
- <select id="search" parameterType="hashmap" resultMap="MessageInfoMap">
- <![CDATA[
- select * from base_message_info
- ]]>
- <where>
- del_flag = false
- <if test="searchParams.type != null">
- and type_ = #{searchParams.type}
- </if>
- <if test="searchParams.recipientId != null">
- and recipient_id = #{searchParams.recipientId}
- </if>
- </where>
- <foreach item="sort" collection="sortList" open="order by" separator=",">
- ${sort.name} ${sort.order}
- </foreach>
- </select>
- <select id="getCount" resultType="int">
- SELECT COUNT(*) FROM base_message_info
- WHERE del_flag = 0
- AND is_read = 0
- AND type_ = #{type}
- <if test="senderId != null">
- AND sender_id = #{senderId}
- </if>
- <if test="recipientId != null">
- AND recipient_id = #{recipientId}
- </if>
- </select>
- </mapper>
|