SysNoticeDao.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.ourwill.module.sys.dao.SysNoticeDao">
  4. <resultMap type="cn.ourwill.module.sys.entity.SysNotice" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="type" property="type"/>
  7. <result column="uuid" property="uuid"/>
  8. <result column="u_id" property="uId"/>
  9. <result column="u_time" property="uTime"/>
  10. <result column="c_id" property="cId"/>
  11. <result column="c_time" property="cTime"/>
  12. <result column="content" property="content"/>
  13. <result column="version" property="version"/>
  14. <result column="title" property="title"/>
  15. <result column="vcount" property="vcount"/>
  16. <result column="name" property="userName"/>
  17. <result column="sender" property="sender"/>
  18. </resultMap>
  19. <sql id="columns">
  20. sol.id ,
  21. sol.type ,
  22. sol.uuid ,
  23. sol.u_id ,
  24. sol.u_time ,
  25. sol.c_id ,
  26. sol.c_time ,
  27. sol.content ,
  28. sol.version ,
  29. sol.title ,
  30. sol.vcount,
  31. u.name,
  32. sol.sender
  33. </sql>
  34. <sql id="joinCols">
  35. left join sys_user u on sol.c_id=u.id
  36. </sql>
  37. <select id="get" resultMap="baseMap">
  38. SELECT
  39. <include refid="columns"/>
  40. FROM sys_notice a
  41. <include refid="joinCols"/>
  42. WHERE a.id = #{id}
  43. </select>
  44. <select id="findList" resultMap="baseMap">
  45. SELECT
  46. <include refid="columns"/>
  47. FROM sys_notice sol
  48. <include refid="joinCols"/>
  49. <where>
  50. <if test="id !=null">
  51. and sol.id = #{id}
  52. </if>
  53. <if test="searchStartDate !=null">
  54. and sol.c_time <![CDATA[ >= ]]> #{searchStartDate}
  55. </if>
  56. <if test="searchEndDate !=null">
  57. and sol.c_time &lt;= #{searchEndDate}
  58. </if>
  59. <if test="type !=null">
  60. and sol.`type` = #{type}
  61. </if>
  62. <if test="uuid !=null">
  63. and sol.uuid = #{uuid}
  64. </if>
  65. <if test="uId !=null">
  66. and sol.u_id = #{uId}
  67. </if>
  68. <if test="uTime !=null">
  69. and sol.u_time = #{uTime}
  70. </if>
  71. <if test="cId !=null">
  72. and sol.c_id = #{cId}
  73. </if>
  74. <if test="searchStartDate !=null">
  75. and sol.c_time <![CDATA[ >= ]]> #{searchStartDate}
  76. </if>
  77. <if test="searchEndDate !=null">
  78. and sol.c_time &lt;= #{searchEndDate}
  79. </if>
  80. <if test="content !=null">
  81. and sol.content = #{content}
  82. </if>
  83. <if test="version !=null">
  84. and sol.version = #{version}
  85. </if>
  86. <if test="title !=null">
  87. and sol.title = #{title}
  88. </if>
  89. <if test="vcount !=null">
  90. and sol.vcount = #{vcount}
  91. </if>
  92. <if test="userName !=null">
  93. and u.name = #{userName}
  94. </if>
  95. <if test="sender !=null">
  96. and sol.sender = #{sender}
  97. </if>
  98. </where>
  99. <choose>
  100. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  101. ORDER BY ${page.orderBy}
  102. </when>
  103. <otherwise>
  104. </otherwise>
  105. </choose>
  106. </select>
  107. <select id="findAllList" resultMap="baseMap">
  108. SELECT
  109. <include refid="columns"/>
  110. FROM sys_notice sol
  111. <include refid="joinCols"/>
  112. <where>
  113. <if test="id !=null">
  114. and sol.id = #{id}
  115. </if>
  116. <if test="searchStartDate !=null">
  117. and sol.c_time <![CDATA[ >= ]]> #{searchStartDate}
  118. </if>
  119. <if test="searchEndDate !=null">
  120. and sol.c_time &lt;= #{searchEndDate}
  121. </if>
  122. <if test="type !=null">
  123. and sol.`type` = #{type}
  124. </if>
  125. <if test="uuid !=null">
  126. and sol.uuid = #{uuid}
  127. </if>
  128. <if test="uId !=null">
  129. and sol.u_id = #{uId}
  130. </if>
  131. <if test="uTime !=null">
  132. and sol.u_time = #{uTime}
  133. </if>
  134. <if test="cId !=null">
  135. and sol.c_id = #{cId}
  136. </if>
  137. <if test="content !=null">
  138. and sol.content = #{content}
  139. </if>
  140. <if test="version !=null">
  141. and sol.version = #{version}
  142. </if>
  143. <if test="title !=null">
  144. and sol.title = #{title}
  145. </if>
  146. <if test="vcount !=null">
  147. and sol.vcount = #{vcount}
  148. </if>
  149. <if test="sender !=null">
  150. and sol.sender = #{sender}
  151. </if>
  152. <if test="userName !=null">
  153. and u.name = #{userName}
  154. </if>
  155. </where>
  156. <choose>
  157. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  158. ORDER BY ${page.orderBy}
  159. </when>
  160. <otherwise>
  161. </otherwise>
  162. </choose>
  163. </select>
  164. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  165. parameterType="cn.ourwill.module.sys.entity.SysNotice">
  166. INSERT INTO sys_notice
  167. <trim prefix="(" suffix=")" suffixOverrides=",">
  168. <if test=" id != null">
  169. id,
  170. </if>
  171. <if test=" type != null">
  172. `type`,
  173. </if>
  174. <if test=" uuid != null">
  175. uuid,
  176. </if>
  177. <if test=" uId != null">
  178. u_id,
  179. </if>
  180. <if test=" uTime != null">
  181. u_time,
  182. </if>
  183. <if test=" cId != null">
  184. c_id,
  185. </if>
  186. <if test=" cTime != null">
  187. c_time,
  188. </if>
  189. <if test=" content != null">
  190. content,
  191. </if>
  192. <if test=" version != null">
  193. version,
  194. </if>
  195. <if test=" title != null">
  196. title,
  197. </if>
  198. <if test=" vcount != null">
  199. vcount
  200. </if>
  201. <if test=" sender!=null">
  202. sender
  203. </if>
  204. </trim>
  205. <trim prefix="values (" suffix=")" suffixOverrides=",">
  206. <if test=" id != null">
  207. #{id}, </if>
  208. <if test=" type != null">
  209. #{type}, </if>
  210. <if test=" uuid != null">
  211. #{uuid}, </if>
  212. <if test=" uId != null">
  213. #{uId}, </if>
  214. <if test=" uTime != null">
  215. #{uTime}, </if>
  216. <if test=" cId != null">
  217. #{cId}, </if>
  218. <if test=" cTime != null">
  219. #{cTime}, </if>
  220. <if test=" content != null">
  221. #{content}, </if>
  222. <if test=" version != null">
  223. #{version}, </if>
  224. <if test=" title != null">
  225. #{title}, </if>
  226. <if test=" vcount != null">
  227. #{vcount} </if>
  228. <if test=" sender !=null">
  229. #{sender} </if>
  230. </trim>
  231. </insert>
  232. <update id="update" parameterType="cn.ourwill.module.sys.entity.SysNotice">
  233. UPDATE sys_notice <set>
  234. <if test="id != null">
  235. id= #{id} ,
  236. </if>
  237. <if test="type != null">
  238. `type`= #{type} ,
  239. </if>
  240. <if test="uuid != null">
  241. uuid= #{uuid} ,
  242. </if>
  243. <if test="uId != null">
  244. u_id= #{uId} ,
  245. </if>
  246. <if test="uTime != null">
  247. u_time= #{uTime} ,
  248. </if>
  249. <if test="cId != null">
  250. c_id= #{cId} ,
  251. </if>
  252. <if test="cTime != null">
  253. c_time= #{cTime} ,
  254. </if>
  255. <if test="content != null">
  256. content= #{content} ,
  257. </if>
  258. <if test="version != null">
  259. version= #{version} ,
  260. </if>
  261. <if test="title != null">
  262. title= #{title} ,
  263. </if>
  264. <if test="vcount != null">
  265. vcount= #{vcount}
  266. </if>
  267. <if test="sender != null">
  268. sender= #{sender}
  269. </if>
  270. </set>
  271. WHERE id = #{id}
  272. </update>
  273. <delete id="deleteById" parameterType="java.lang.Long">
  274. DELETE FROM sys_notice WHERE id = #{id}
  275. </delete>
  276. <delete id="deleteByIds" parameterType="java.util.List">
  277. DELETE FROM sys_notice WHERE id IN
  278. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  279. #{item}
  280. </foreach>
  281. </delete>
  282. </mapper>