MessageNotice.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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.MessageNoticeDAO">
  6. <resultMap id="MessageNoticeMap" type="com.jpsoft.employment.modules.base.entity.MessageNotice">
  7. <id property="id" column="id_" />
  8. <result property="title" column="title_" />
  9. <result property="content" column="content_" />
  10. <result property="recipientId" column="recipient_id" />
  11. <result property="status" column="status_" />
  12. <result property="delFlag" column="del_flag" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createByN" column="create_by_name" />
  15. <result property="createTime" column="create_time" />
  16. <result property="updateBy" column="update_by" />
  17. <result property="updateTime" column="update_time" />
  18. <result property="classify" column="classify_" />
  19. <result property="type" column="type_" />
  20. <result property="noticeLink" column="notice_link" />
  21. <result property="sendWechat" column="send_wechat" />
  22. <result property="wechatCode" column="wechat_code" />
  23. <result property="isNeedAgree" column="is_need_agree" />
  24. <result property="deliverId" column="deliver_id" />
  25. </resultMap>
  26. <insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.MessageNotice">
  27. <!--
  28. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  29. select sys_guid() from dual
  30. </selectKey>
  31. -->
  32. <![CDATA[
  33. insert into base_message_notice
  34. (id_,title_,content_,recipient_id,status_,del_flag,create_by,create_time,update_by,update_time,classify_,type_,notice_link,send_wechat,wechat_code,
  35. is_need_agree,deliver_id)
  36. values
  37. (
  38. #{id,jdbcType=VARCHAR}
  39. ,#{title,jdbcType=VARCHAR}
  40. ,#{content,jdbcType= NUMERIC }
  41. ,#{recipientId,jdbcType= NUMERIC }
  42. ,#{status,jdbcType= NUMERIC }
  43. ,#{delFlag,jdbcType= NUMERIC }
  44. ,#{createBy,jdbcType=VARCHAR}
  45. ,#{createTime,jdbcType= TIMESTAMP }
  46. ,#{updateBy,jdbcType=VARCHAR}
  47. ,#{updateTime,jdbcType= TIMESTAMP }
  48. ,#{classify,jdbcType=VARCHAR}
  49. ,#{type,jdbcType=VARCHAR}
  50. ,#{noticeLink,jdbcType=VARCHAR}
  51. ,#{sendWechat,jdbcType= NUMERIC }
  52. ,#{wechatCode,jdbcType=VARCHAR}
  53. ,#{isNeedAgree,jdbcType=NUMERIC}
  54. ,#{deliverId,jdbcType=VARCHAR}
  55. )
  56. ]]>
  57. </insert>
  58. <delete id="delete" parameterType="string">
  59. delete from base_message_notice where id_=#{id,jdbcType=VARCHAR}
  60. </delete>
  61. <update id="update" parameterType="com.jpsoft.employment.modules.base.entity.MessageNotice">
  62. update base_message_notice
  63. <set>
  64. <if test="title!=null">
  65. title_=#{title,jdbcType=VARCHAR},
  66. </if>
  67. <if test="content!=null">
  68. content_=#{content,jdbcType= NUMERIC },
  69. </if>
  70. <if test="recipientId!=null">
  71. recipient_id=#{recipientId,jdbcType= NUMERIC },
  72. </if>
  73. <if test="status!=null">
  74. status_=#{status,jdbcType= NUMERIC },
  75. </if>
  76. <if test="delFlag!=null">
  77. del_flag=#{delFlag,jdbcType= NUMERIC },
  78. </if>
  79. <if test="createBy!=null">
  80. create_by=#{createBy,jdbcType=VARCHAR},
  81. </if>
  82. <if test="createTime!=null">
  83. create_time=#{createTime,jdbcType= TIMESTAMP },
  84. </if>
  85. <if test="updateBy!=null">
  86. update_by=#{updateBy,jdbcType=VARCHAR},
  87. </if>
  88. <if test="updateTime!=null">
  89. update_time=#{updateTime,jdbcType= TIMESTAMP },
  90. </if>
  91. <if test="classify!=null">
  92. classify_=#{classify,jdbcType=VARCHAR},
  93. </if>
  94. <if test="type!=null">
  95. type_=#{type,jdbcType=VARCHAR},
  96. </if>
  97. <if test="noticeLink!=null">
  98. notice_link=#{noticeLink,jdbcType=VARCHAR},
  99. </if>
  100. <if test="sendWechat!=null">
  101. send_wechat=#{sendWechat,jdbcType= NUMERIC },
  102. </if>
  103. <if test="wechatCode!=null">
  104. wechat_code=#{wechatCode,jdbcType=VARCHAR},
  105. </if>
  106. <if test="isNeedAgree!=null">
  107. is_need_agree=#{isNeedAgree,jdbcType=NUMERIC},
  108. </if>
  109. <if test="jobResumeId!=null">
  110. job_resume_id=#{jobResumeId,jdbcType=VARCHAR},
  111. </if>
  112. <if test="jobRecruitmentId!=null">
  113. job_recruitment_id=#{jobRecruitmentId,jdbcType=VARCHAR},
  114. </if>
  115. <if test="deliverId!=null">
  116. deliver_id=#{deliverId,jdbcType=VARCHAR},
  117. </if>
  118. </set>
  119. where id_=#{id}
  120. </update>
  121. <select id="get" parameterType="string" resultMap="MessageNoticeMap">
  122. select * from base_message_notice where id_=#{0}
  123. </select>
  124. <select id="exist" parameterType="string" resultType="int">
  125. select count(*) from base_message_notice where id_=#{0}
  126. </select>
  127. <select id="list" resultMap="MessageNoticeMap">
  128. select * from base_message_notice
  129. </select>
  130. <select id="search" parameterType="hashmap" resultMap="MessageNoticeMap">
  131. <![CDATA[
  132. select
  133. a.*,
  134. b.real_name AS create_by_name
  135. from base_message_notice a
  136. LEFT JOIN sys_user b ON a.create_by = b.id_
  137. ]]>
  138. <where>
  139. a.del_flag=0
  140. <if test="searchParams.id != null">
  141. and a.ID_ like #{searchParams.id}
  142. </if>
  143. <if test="searchParams.recipientId != null">
  144. and a.recipient_id = #{searchParams.recipientId}
  145. </if>
  146. <if test="searchParams.recipientIdAndNull != null">
  147. and (a.recipient_id = #{searchParams.recipientIdAndNull}
  148. or a.recipient_id is null)
  149. </if>
  150. <if test="searchParams.classify != null">
  151. and a.classify_ = #{searchParams.classify}
  152. </if>
  153. <if test="searchParams.type != null">
  154. and a.type_ = #{searchParams.type}
  155. </if>
  156. <if test="searchParams.status != null">
  157. and a.status_ = #{searchParams.status}
  158. </if>
  159. <if test="searchParams.title != null">
  160. and a.title_ like #{searchParams.title}
  161. </if>
  162. </where>
  163. <foreach item="sort" collection="sortList" open="order by" separator=",">
  164. ${sort.name} ${sort.order}
  165. </foreach>
  166. </select>
  167. <select id="findByUserIdAndClassify" resultMap="MessageNoticeMap">
  168. SELECT
  169. *
  170. FROM
  171. base_message_notice
  172. WHERE
  173. del_flag = 0
  174. AND classify_ = #{classify}
  175. AND ( recipient_id = #{userId} OR recipient_id IS NULL )
  176. AND status_ = '1'
  177. AND type_ = '1'
  178. </select>
  179. <select id="findByUserId" resultMap="MessageNoticeMap">
  180. SELECT
  181. *
  182. FROM
  183. base_message_notice
  184. WHERE
  185. del_flag = 0
  186. AND recipient_id = #{userId}
  187. AND status_ = '1'
  188. AND type_ = '1'
  189. </select>
  190. <select id="findTopByUserIdAndClassify" resultMap="MessageNoticeMap">
  191. SELECT
  192. *
  193. FROM
  194. base_message_notice
  195. WHERE
  196. del_flag = 0
  197. AND classify_ = #{classify}
  198. AND ( recipient_id = #{userId} OR recipient_id IS NULL )
  199. AND status_ = '1'
  200. AND type_ = '1'
  201. ORDER BY
  202. create_time
  203. LIMIT 1
  204. </select>
  205. <select id="findNotRead" resultType="int">
  206. SELECT
  207. count(a.id_)
  208. FROM
  209. base_message_notice a
  210. LEFT JOIN base_message_read b ON a.id_ = b.message_id
  211. WHERE
  212. a.del_flag = 0
  213. <if test="classify != null">
  214. AND a.classify_ = #{classify}
  215. </if>
  216. AND ( recipient_id = #{userId} OR recipient_id IS NULL )
  217. AND a.status_ = '1'
  218. AND a.type_ = '1'
  219. AND ( b.is_read IS NULL OR b.is_read = FALSE )
  220. ORDER BY
  221. a.create_time
  222. </select>
  223. </mapper>