DilNoticeMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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="com.steerinfo.dil.mapper.DilNoticeMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.DilNotice">
  5. <id column="NOTICE_ID" jdbcType="DECIMAL" property="noticeId" />
  6. <result column="NOTICE_TITLE" jdbcType="VARCHAR" property="noticeTitle" />
  7. <result column="NOTICE_CONTENT" jdbcType="VARCHAR" property="noticeContent" />
  8. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  9. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  10. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  11. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  12. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  13. <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
  14. </resultMap>
  15. <sql id="columns">
  16. NOTICE_ID, NOTICE_TITLE, NOTICE_CONTENT, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  17. UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED
  18. </sql>
  19. <sql id="columns_alias">
  20. t.NOTICE_ID, t.NOTICE_TITLE, t.NOTICE_CONTENT, t.INSERT_USERNAME, t.INSERT_TIME,
  21. t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED
  22. </sql>
  23. <sql id="select">
  24. SELECT <include refid="columns"/> FROM DIL_NOTICE
  25. </sql>
  26. <sql id="select_alias">
  27. SELECT <include refid="columns_alias"/> FROM DIL_NOTICE t
  28. </sql>
  29. <sql id="where">
  30. <where>
  31. <if test="noticeId != null">
  32. and NOTICE_ID = #{noticeId}
  33. </if>
  34. <if test="noticeTitle != null and noticeTitle != ''">
  35. and NOTICE_TITLE = #{noticeTitle}
  36. </if>
  37. <if test="noticeContent != null and noticeContent != ''">
  38. and NOTICE_CONTENT = #{noticeContent}
  39. </if>
  40. <if test="insertUsername != null and insertUsername != ''">
  41. and INSERT_USERNAME = #{insertUsername}
  42. </if>
  43. <if test="insertTime != null">
  44. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  45. </if>
  46. <if test="updateUsername != null and updateUsername != ''">
  47. and UPDATE_USERNAME = #{updateUsername}
  48. </if>
  49. <if test="updateTime != null">
  50. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  51. </if>
  52. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  53. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  54. </if>
  55. <if test="deleted != null">
  56. and DELETED = #{deleted}
  57. </if>
  58. </where>
  59. </sql>
  60. <sql id="whereLike">
  61. <where>
  62. <if test="noticeId != null">
  63. and NOTICE_ID = #{noticeId}
  64. </if>
  65. <if test="noticeTitle != null and noticeTitle != ''">
  66. and NOTICE_TITLE LIKE '%${noticeTitle}%'
  67. </if>
  68. <if test="noticeContent != null and noticeContent != ''">
  69. and NOTICE_CONTENT LIKE '%${noticeContent}%'
  70. </if>
  71. <if test="insertUsername != null and insertUsername != ''">
  72. and INSERT_USERNAME LIKE '%${insertUsername}%'
  73. </if>
  74. <if test="insertTime != null">
  75. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  76. </if>
  77. <if test="updateUsername != null and updateUsername != ''">
  78. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  79. </if>
  80. <if test="updateTime != null">
  81. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  82. </if>
  83. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  84. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  85. </if>
  86. <if test="deleted != null">
  87. and DELETED = #{deleted}
  88. </if>
  89. </where>
  90. </sql>
  91. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  92. delete from DIL_NOTICE
  93. where NOTICE_ID = #{noticeId,jdbcType=DECIMAL}
  94. </delete>
  95. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  96. delete from DIL_NOTICE
  97. where 1!=1
  98. <if test="noticeTitle != null and noticeTitle != ''">
  99. or NOTICE_TITLE = #{noticeTitle}
  100. </if>
  101. <if test="noticeContent != null and noticeContent != ''">
  102. or NOTICE_CONTENT = #{noticeContent}
  103. </if>
  104. <if test="insertUsername != null and insertUsername != ''">
  105. or INSERT_USERNAME = #{insertUsername}
  106. </if>
  107. <if test="insertTime != null">
  108. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  109. </if>
  110. <if test="updateUsername != null and updateUsername != ''">
  111. or UPDATE_USERNAME = #{updateUsername}
  112. </if>
  113. <if test="updateTime != null">
  114. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  115. </if>
  116. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  117. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  118. </if>
  119. <if test="deleted != null">
  120. or DELETED = #{deleted}
  121. </if>
  122. </delete>
  123. <insert id="insert" parameterType="com.steerinfo.dil.model.DilNotice">
  124. insert into DIL_NOTICE (NOTICE_ID, NOTICE_TITLE, NOTICE_CONTENT,
  125. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  126. UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED
  127. )
  128. values (#{noticeId,jdbcType=DECIMAL}, #{noticeTitle,jdbcType=VARCHAR}, #{noticeContent,jdbcType=VARCHAR},
  129. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  130. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL}
  131. )
  132. </insert>
  133. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.DilNotice">
  134. insert into DIL_NOTICE
  135. <trim prefix="(" suffix=")" suffixOverrides=",">
  136. <if test="noticeId != null">
  137. NOTICE_ID,
  138. </if>
  139. <if test="noticeTitle != null">
  140. NOTICE_TITLE,
  141. </if>
  142. <if test="noticeContent != null">
  143. NOTICE_CONTENT,
  144. </if>
  145. <if test="insertUsername != null">
  146. INSERT_USERNAME,
  147. </if>
  148. <if test="insertTime != null">
  149. INSERT_TIME,
  150. </if>
  151. <if test="updateUsername != null">
  152. UPDATE_USERNAME,
  153. </if>
  154. <if test="updateTime != null">
  155. UPDATE_TIME,
  156. </if>
  157. <if test="insertUpdateRemark != null">
  158. INSERT_UPDATE_REMARK,
  159. </if>
  160. <if test="deleted != null">
  161. DELETED,
  162. </if>
  163. </trim>
  164. <trim prefix="values (" suffix=")" suffixOverrides=",">
  165. <if test="noticeId != null">
  166. #{noticeId,jdbcType=DECIMAL},
  167. </if>
  168. <if test="noticeTitle != null">
  169. #{noticeTitle,jdbcType=VARCHAR},
  170. </if>
  171. <if test="noticeContent != null">
  172. #{noticeContent,jdbcType=VARCHAR},
  173. </if>
  174. <if test="insertUsername != null">
  175. #{insertUsername,jdbcType=VARCHAR},
  176. </if>
  177. <if test="insertTime != null">
  178. #{insertTime,jdbcType=TIMESTAMP},
  179. </if>
  180. <if test="updateUsername != null">
  181. #{updateUsername,jdbcType=VARCHAR},
  182. </if>
  183. <if test="updateTime != null">
  184. #{updateTime,jdbcType=TIMESTAMP},
  185. </if>
  186. <if test="insertUpdateRemark != null">
  187. #{insertUpdateRemark,jdbcType=VARCHAR},
  188. </if>
  189. <if test="deleted != null">
  190. #{deleted,jdbcType=DECIMAL},
  191. </if>
  192. </trim>
  193. </insert>
  194. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.DilNotice">
  195. update DIL_NOTICE
  196. set NOTICE_TITLE = #{noticeTitle,jdbcType=VARCHAR},
  197. NOTICE_CONTENT = #{noticeContent,jdbcType=VARCHAR},
  198. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  199. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  200. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  201. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  202. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  203. DELETED = #{deleted,jdbcType=DECIMAL}
  204. where NOTICE_ID = #{noticeId,jdbcType=DECIMAL}
  205. </update>
  206. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.DilNotice">
  207. update DIL_NOTICE
  208. <set>
  209. <if test="noticeTitle != null">
  210. NOTICE_TITLE = #{noticeTitle,jdbcType=VARCHAR},
  211. </if>
  212. <if test="noticeContent != null">
  213. NOTICE_CONTENT = #{noticeContent,jdbcType=VARCHAR},
  214. </if>
  215. <if test="insertUsername != null">
  216. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  217. </if>
  218. <if test="insertTime != null">
  219. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  220. </if>
  221. <if test="updateUsername != null">
  222. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  223. </if>
  224. <if test="updateTime != null">
  225. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  226. </if>
  227. <if test="insertUpdateRemark != null">
  228. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  229. </if>
  230. <if test="deleted != null">
  231. DELETED = #{deleted,jdbcType=DECIMAL},
  232. </if>
  233. </set>
  234. where NOTICE_ID = #{noticeId,jdbcType=DECIMAL}
  235. </update>
  236. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  237. <include refid="select"/>
  238. where NOTICE_ID = #{noticeId,jdbcType=DECIMAL}
  239. </select>
  240. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  241. <include refid="select"/>
  242. <include refid="where"/>
  243. </select>
  244. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  245. <include refid="select"/>
  246. <include refid="whereLike"/>
  247. </select>
  248. <insert id="batchInsert" parameterType="java.util.List">
  249. insert into DIL_NOTICE
  250. (NOTICE_ID,
  251. NOTICE_TITLE, NOTICE_CONTENT, INSERT_USERNAME,
  252. INSERT_TIME, UPDATE_USERNAME,
  253. UPDATE_TIME, INSERT_UPDATE_REMARK,
  254. DELETED)
  255. ( <foreach collection="list" item="item" separator="union all">
  256. select
  257. #{item.noticeId,jdbcType=DECIMAL},
  258. #{item.noticeTitle,jdbcType=VARCHAR}, #{item.noticeContent,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
  259. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  260. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  261. #{item.deleted,jdbcType=DECIMAL} from dual
  262. </foreach> )
  263. </insert>
  264. <update id="batchUpdate" parameterType="java.util.List">
  265. update DIL_NOTICE
  266. set
  267. NOTICE_ID=
  268. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  269. when #{item.noticeId,jdbcType=DECIMAL} then #{item.noticeId,jdbcType=DECIMAL}
  270. </foreach>
  271. ,NOTICE_TITLE=
  272. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  273. when #{item.noticeId,jdbcType=DECIMAL} then #{item.noticeTitle,jdbcType=VARCHAR}
  274. </foreach>
  275. ,NOTICE_CONTENT=
  276. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  277. when #{item.noticeId,jdbcType=DECIMAL} then #{item.noticeContent,jdbcType=VARCHAR}
  278. </foreach>
  279. ,INSERT_USERNAME=
  280. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  281. when #{item.noticeId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  282. </foreach>
  283. ,INSERT_TIME=
  284. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  285. when #{item.noticeId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  286. </foreach>
  287. ,UPDATE_USERNAME=
  288. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  289. when #{item.noticeId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  290. </foreach>
  291. ,UPDATE_TIME=
  292. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  293. when #{item.noticeId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  294. </foreach>
  295. ,INSERT_UPDATE_REMARK=
  296. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  297. when #{item.noticeId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  298. </foreach>
  299. ,DELETED=
  300. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  301. when #{item.noticeId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  302. </foreach>
  303. where NOTICE_ID in
  304. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  305. #{item.noticeId,jdbcType=DECIMAL}
  306. </foreach>
  307. </update>
  308. <delete id="batchDelete" parameterType="java.util.List">
  309. delete from DIL_NOTICE
  310. where NOTICE_ID in
  311. <foreach collection="list" item="id" open="(" close=")" separator=",">
  312. #{id}
  313. </foreach>
  314. </delete>
  315. <!-- 友情提示!!!-->
  316. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  317. <!-- 信息列表 -->
  318. <select id="getNoticeList" parameterType="java.util.Map" resultType="java.util.Map">
  319. SELECT * FROM
  320. (
  321. SELECT
  322. DN.NOTICE_ID AS "noticeId",
  323. DN.NOTICE_TITLE AS "noticeTitle",
  324. DN.NOTICE_CONTENT AS "noticeContent",
  325. DN.INSERT_TIME AS "insertTime",
  326. DN.INSERT_USERNAME AS "insertUsername"
  327. FROM DIL_NOTICE DN
  328. WHERE DN.DELETED !=1
  329. ORDER BY DN.INSERT_TIME DESC
  330. )
  331. <where>
  332. <if test="noticeId!= null">
  333. and
  334. <foreach collection="noticeId" item="item" open="(" separator="," close=")">
  335. "noticeId" in #{item}
  336. </foreach>
  337. </if>
  338. <if test="noticeTitle!= null">
  339. and
  340. <foreach collection="noticeTitle" item="item" open="(" separator="," close=")">
  341. "noticeTitle" in #{item}
  342. </foreach>
  343. </if>
  344. <if test="noticeContent!= null">
  345. and
  346. <foreach collection="noticeContent" item="item" open="(" separator="," close=")">
  347. "noticeContent" in #{item}
  348. </foreach>
  349. </if>
  350. <if test="insertTime!= null">
  351. and
  352. <foreach collection="insertTime" item="item" open="(" separator="," close=")">
  353. "insertTime" in #{item}
  354. </foreach>
  355. </if>
  356. <if test="insertUsername!= null">
  357. and
  358. <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
  359. "insertUsername" in #{item}
  360. </foreach>
  361. </if>
  362. </where>
  363. </select>
  364. <!--根据Id查询公告-->
  365. <select id="getNoticeById" resultType="java.util.LinkedHashMap" >
  366. SELECT
  367. DN.NOTICE_ID AS "noticeId",
  368. DN.NOTICE_TITLE AS "noticeTitle",
  369. DN.NOTICE_CONTENT AS "noticeContent",
  370. DN.INSERT_TIME AS "insertTime",
  371. DN.INSERT_USERNAME AS "insertUsername"
  372. FROM DIL_NOTICE DN
  373. WHERE DN.NOTICE_ID=#{id}
  374. </select>
  375. </mapper>