MessageInfo.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <!-- namespace必须指向DAO接口 -->
  5. <mapper namespace="com.jpsoft.employment.modules.base.dao.MessageInfoDAO">
  6. <resultMap id="MessageInfoMap" type="com.jpsoft.employment.modules.base.entity.MessageInfo">
  7. <id property="id" column="id_" />
  8. <result property="type" column="type_" />
  9. <result property="sendTime" column="send_time" />
  10. <result property="title" column="title_" />
  11. <result property="content" column="content_" />
  12. <result property="senderId" column="sender_id" />
  13. <result property="recipientId" column="recipient_id" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="createBy" column="create_by" />
  17. <result property="updateBy" column="update_by" />
  18. <result property="delFlag" column="del_flag" />
  19. <result property="isRead" column="is_read" />
  20. <result property="category" column="category_" />
  21. </resultMap>
  22. <insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.MessageInfo">
  23. <!--
  24. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  25. select sys_guid() from dual
  26. </selectKey>
  27. -->
  28. <![CDATA[
  29. insert into base_message_info
  30. (id_,type_,send_time,title_,content_,sender_id,recipient_id,create_time,update_time,create_by,update_by,del_flag,is_read,category_)
  31. values
  32. (
  33. #{id,jdbcType=VARCHAR}
  34. ,#{type,jdbcType=VARCHAR}
  35. ,#{sendTime,jdbcType= TIMESTAMP }
  36. ,#{title,jdbcType=VARCHAR}
  37. ,#{content,jdbcType=VARCHAR}
  38. ,#{senderId,jdbcType=VARCHAR}
  39. ,#{recipientId,jdbcType=VARCHAR}
  40. ,#{createTime,jdbcType= TIMESTAMP }
  41. ,#{updateTime,jdbcType= TIMESTAMP }
  42. ,#{createBy,jdbcType=VARCHAR}
  43. ,#{updateBy,jdbcType=VARCHAR}
  44. ,#{delFlag,jdbcType= NUMERIC }
  45. ,#{isRead,jdbcType= NUMERIC }
  46. ,#{category,jdbcType=VARCHAR}
  47. )
  48. ]]>
  49. </insert>
  50. <delete id="delete" parameterType="string">
  51. delete from base_message_info where id_=#{id,jdbcType=VARCHAR}
  52. </delete>
  53. <update id="update" parameterType="com.jpsoft.employment.modules.base.entity.MessageInfo">
  54. update base_message_info
  55. <set>
  56. <if test="type!=null">
  57. type_=#{type,jdbcType=VARCHAR},
  58. </if>
  59. <if test="sendTime!=null">
  60. send_time=#{sendTime,jdbcType= TIMESTAMP },
  61. </if>
  62. <if test="title!=null">
  63. title_=#{title,jdbcType=VARCHAR},
  64. </if>
  65. <if test="content!=null">
  66. content_=#{content,jdbcType=VARCHAR},
  67. </if>
  68. <if test="senderId!=null">
  69. sender_id=#{senderId,jdbcType=VARCHAR},
  70. </if>
  71. <if test="recipientId!=null">
  72. recipient_id=#{recipientId,jdbcType=VARCHAR},
  73. </if>
  74. <if test="createTime!=null">
  75. create_time=#{createTime,jdbcType= TIMESTAMP },
  76. </if>
  77. <if test="updateTime!=null">
  78. update_time=#{updateTime,jdbcType= TIMESTAMP },
  79. </if>
  80. <if test="createBy!=null">
  81. create_by=#{createBy,jdbcType=VARCHAR},
  82. </if>
  83. <if test="updateBy!=null">
  84. update_by=#{updateBy,jdbcType=VARCHAR},
  85. </if>
  86. <if test="delFlag!=null">
  87. del_flag=#{delFlag,jdbcType= NUMERIC },
  88. </if>
  89. <if test="isRead!=null">
  90. is_read=#{isRead,jdbcType= NUMERIC },
  91. </if>
  92. <if test="category!=null">
  93. category_=#{category,jdbcType=VARCHAR},
  94. </if>
  95. </set>
  96. where id_=#{id}
  97. </update>
  98. <select id="get" parameterType="string" resultMap="MessageInfoMap">
  99. select * from base_message_info where id_=#{0}
  100. </select>
  101. <select id="exist" parameterType="string" resultType="int">
  102. select count(*) from base_message_info where id_=#{0}
  103. </select>
  104. <select id="list" resultMap="MessageInfoMap">
  105. select * from base_message_info
  106. </select>
  107. <select id="findByRecipientId" resultType="java.util.Map">
  108. select count(*) as 'count',type_ as 'type' from base_message_info
  109. where del_flag=false and is_read=false and recipient_id=#{0}
  110. group by type_
  111. </select>
  112. <select id="findByRecipientIdAndType" resultMap="MessageInfoMap">
  113. select * from base_message_info
  114. where del_flag=false and recipient_id=#{recipientId} and type_=#{type}
  115. </select>
  116. <select id="search" parameterType="hashmap" resultMap="MessageInfoMap">
  117. <![CDATA[
  118. select * from base_message_info
  119. ]]>
  120. <where>
  121. del_flag = false
  122. <if test="searchParams.type != null">
  123. and type_ = #{searchParams.type}
  124. </if>
  125. <if test="searchParams.recipientId != null">
  126. and recipient_id = #{searchParams.recipientId}
  127. </if>
  128. </where>
  129. <foreach item="sort" collection="sortList" open="order by" separator=",">
  130. ${sort.name} ${sort.order}
  131. </foreach>
  132. </select>
  133. <select id="getCount" resultType="int">
  134. SELECT COUNT(*) FROM base_message_info
  135. WHERE del_flag = 0
  136. AND is_read = 0
  137. AND type_ = #{type}
  138. <if test="senderId != null">
  139. AND sender_id = #{senderId}
  140. </if>
  141. <if test="recipientId != null">
  142. AND recipient_id = #{recipientId}
  143. </if>
  144. </select>
  145. </mapper>