DilNoticeMapper.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  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. <result column="PERMISSION" jdbcType="VARCHAR" property="permission" />
  15. <result column="HISTORICAL_CHANGES" jdbcType="VARCHAR" property="historicalChanges"></result>
  16. <result column="UPDATE_TITLE" jdbcType="VARCHAR" property="updateTitle"></result>
  17. <result column="UPDATE_CONTENT" jdbcType="VARCHAR" property="updateContent"></result>
  18. <result column="STATUS" jdbcType="VARCHAR" property="status"></result>
  19. </resultMap>
  20. <sql id="columns">
  21. NOTICE_ID, NOTICE_TITLE, NOTICE_CONTENT, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  22. UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, PERMISSION,HISTORICAL_CHANGES,UPDATE_TITLE,
  23. UPDATE_CONTENT,STATUS
  24. </sql>
  25. <sql id="columns_alias">
  26. t.NOTICE_ID, t.NOTICE_TITLE, t.NOTICE_CONTENT, t.INSERT_USERNAME, t.INSERT_TIME,
  27. t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED, t.PERMISSION,
  28. t.HISTORICAL_CHANGES,t.UPDATE_TITLE,t.UPDATE_CONTENT,t.STATUS
  29. </sql>
  30. <sql id="orderBy">
  31. <if test="orderField != null and orderField != ''">
  32. order by "${orderField}"
  33. <if test="orderType != null and orderType != ''">
  34. ${orderType}
  35. </if>
  36. </if>
  37. <if test="orderField == null ">
  38. order by "insertTime" desc
  39. </if>
  40. </sql>
  41. <sql id="select">
  42. SELECT <include refid="columns"/> FROM DIL_NOTICE
  43. </sql>
  44. <sql id="select_alias">
  45. SELECT <include refid="columns_alias"/> FROM DIL_NOTICE t
  46. </sql>
  47. <sql id="where">
  48. <where>
  49. <if test="noticeId != null">
  50. and NOTICE_ID = #{noticeId}
  51. </if>
  52. <if test="noticeTitle != null and noticeTitle != ''">
  53. and NOTICE_TITLE = #{noticeTitle}
  54. </if>
  55. <if test="noticeContent != null and noticeContent != ''">
  56. and NOTICE_CONTENT = #{noticeContent}
  57. </if>
  58. <if test="insertUsername != null and insertUsername != ''">
  59. and INSERT_USERNAME = #{insertUsername}
  60. </if>
  61. <if test="insertTime != null">
  62. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  63. </if>
  64. <if test="updateUsername != null and updateUsername != ''">
  65. and UPDATE_USERNAME = #{updateUsername}
  66. </if>
  67. <if test="updateTime != null">
  68. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  69. </if>
  70. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  71. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  72. </if>
  73. <if test="deleted != null">
  74. and DELETED = #{deleted}
  75. </if>
  76. <if test="permission != null">
  77. and PERMISSION = #{permission}
  78. </if>
  79. </where>
  80. </sql>
  81. <sql id="whereLike">
  82. <where>
  83. <if test="noticeId != null">
  84. and NOTICE_ID = #{noticeId}
  85. </if>
  86. <if test="noticeTitle != null and noticeTitle != ''">
  87. and NOTICE_TITLE LIKE '%${noticeTitle}%'
  88. </if>
  89. <if test="noticeContent != null and noticeContent != ''">
  90. and NOTICE_CONTENT LIKE '%${noticeContent}%'
  91. </if>
  92. <if test="insertUsername != null and insertUsername != ''">
  93. and INSERT_USERNAME LIKE '%${insertUsername}%'
  94. </if>
  95. <if test="insertTime != null">
  96. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  97. </if>
  98. <if test="updateUsername != null and updateUsername != ''">
  99. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  100. </if>
  101. <if test="updateTime != null">
  102. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  103. </if>
  104. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  105. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  106. </if>
  107. <if test="deleted != null">
  108. and DELETED = #{deleted}
  109. </if>
  110. <if test="permission != null">
  111. and PERMISSION = #{permission}
  112. </if>
  113. </where>
  114. </sql>
  115. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  116. delete from DIL_NOTICE
  117. where NOTICE_ID = #{noticeId,jdbcType=DECIMAL}
  118. </delete>
  119. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  120. delete from DIL_NOTICE
  121. where 1!=1
  122. <if test="noticeTitle != null and noticeTitle != ''">
  123. or NOTICE_TITLE = #{noticeTitle}
  124. </if>
  125. <if test="noticeContent != null and noticeContent != ''">
  126. or NOTICE_CONTENT = #{noticeContent}
  127. </if>
  128. <if test="insertUsername != null and insertUsername != ''">
  129. or INSERT_USERNAME = #{insertUsername}
  130. </if>
  131. <if test="insertTime != null">
  132. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  133. </if>
  134. <if test="updateUsername != null and updateUsername != ''">
  135. or UPDATE_USERNAME = #{updateUsername}
  136. </if>
  137. <if test="updateTime != null">
  138. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  139. </if>
  140. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  141. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  142. </if>
  143. <if test="deleted != null">
  144. or DELETED = #{deleted}
  145. </if>
  146. <if test="permission != null">
  147. or PERMISSION = #{permission}
  148. </if>
  149. </delete>
  150. <insert id="insert" parameterType="com.steerinfo.dil.model.DilNotice">
  151. insert into DIL_NOTICE (NOTICE_ID, NOTICE_TITLE, NOTICE_CONTENT,
  152. INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
  153. UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED,
  154. PERMISSION)
  155. values (#{noticeId,jdbcType=DECIMAL}, #{noticeTitle,jdbcType=VARCHAR}, #{noticeContent,jdbcType=VARCHAR},
  156. #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
  157. #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL},
  158. #{permission,jdbcType=DECIMAL})
  159. </insert>
  160. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.DilNotice">
  161. insert into DIL_NOTICE
  162. <trim prefix="(" suffix=")" suffixOverrides=",">
  163. <if test="noticeId != null">
  164. NOTICE_ID,
  165. </if>
  166. <if test="noticeTitle != null">
  167. NOTICE_TITLE,
  168. </if>
  169. <if test="noticeContent != null">
  170. NOTICE_CONTENT,
  171. </if>
  172. <if test="insertUsername != null">
  173. INSERT_USERNAME,
  174. </if>
  175. <if test="insertTime != null">
  176. INSERT_TIME,
  177. </if>
  178. <if test="updateUsername != null">
  179. UPDATE_USERNAME,
  180. </if>
  181. <if test="updateTime != null">
  182. UPDATE_TIME,
  183. </if>
  184. <if test="insertUpdateRemark != null">
  185. INSERT_UPDATE_REMARK,
  186. </if>
  187. <if test="deleted != null">
  188. DELETED,
  189. </if>
  190. <if test="permission != null">
  191. PERMISSION,
  192. </if>
  193. <if test="status != null">
  194. STATUS,
  195. </if>
  196. </trim>
  197. <trim prefix="values (" suffix=")" suffixOverrides=",">
  198. <if test="noticeId != null">
  199. #{noticeId,jdbcType=DECIMAL},
  200. </if>
  201. <if test="noticeTitle != null">
  202. #{noticeTitle,jdbcType=VARCHAR},
  203. </if>
  204. <if test="noticeContent != null">
  205. #{noticeContent,jdbcType=VARCHAR},
  206. </if>
  207. <if test="insertUsername != null">
  208. #{insertUsername,jdbcType=VARCHAR},
  209. </if>
  210. <if test="insertTime != null">
  211. #{insertTime,jdbcType=TIMESTAMP},
  212. </if>
  213. <if test="updateUsername != null">
  214. #{updateUsername,jdbcType=VARCHAR},
  215. </if>
  216. <if test="updateTime != null">
  217. #{updateTime,jdbcType=TIMESTAMP},
  218. </if>
  219. <if test="insertUpdateRemark != null">
  220. #{insertUpdateRemark,jdbcType=VARCHAR},
  221. </if>
  222. <if test="deleted != null">
  223. #{deleted,jdbcType=DECIMAL},
  224. </if>
  225. <if test="permission != null">
  226. #{permission,jdbcType=DECIMAL},
  227. </if>
  228. <if test="status != null">
  229. #{status,jdbcType=DECIMAL},
  230. </if>
  231. </trim>
  232. </insert>
  233. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.DilNotice">
  234. update DIL_NOTICE
  235. set NOTICE_TITLE = #{noticeTitle,jdbcType=VARCHAR},
  236. NOTICE_CONTENT = #{noticeContent,jdbcType=VARCHAR},
  237. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  238. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  239. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  240. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  241. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  242. DELETED = #{deleted,jdbcType=DECIMAL},
  243. PERMISSION = #{permission,jdbcType=DECIMAL}
  244. where NOTICE_ID = #{noticeId,jdbcType=DECIMAL}
  245. </update>
  246. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.DilNotice">
  247. update DIL_NOTICE
  248. <set>
  249. <if test="noticeTitle != null">
  250. NOTICE_TITLE = #{noticeTitle,jdbcType=VARCHAR},
  251. </if>
  252. <if test="noticeContent != null">
  253. NOTICE_CONTENT = #{noticeContent,jdbcType=VARCHAR},
  254. </if>
  255. <if test="insertUsername != null">
  256. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  257. </if>
  258. <if test="insertTime != null">
  259. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  260. </if>
  261. <if test="updateUsername != null">
  262. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  263. </if>
  264. <if test="updateTime != null">
  265. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  266. </if>
  267. <if test="insertUpdateRemark != null">
  268. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  269. </if>
  270. <if test="deleted != null">
  271. DELETED = #{deleted,jdbcType=DECIMAL},
  272. </if>
  273. <if test="permission != null">
  274. PERMISSION = #{permission,jdbcType=DECIMAL},
  275. </if>
  276. <if test="historicalChanges != null">
  277. HISTORICAL_CHANGES = #{historicalChanges,jdbcType=DECIMAL},
  278. </if>
  279. </set>
  280. where NOTICE_ID = #{noticeId,jdbcType=DECIMAL}
  281. </update>
  282. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  283. <include refid="select"/>
  284. where NOTICE_ID = #{noticeId,jdbcType=DECIMAL}
  285. </select>
  286. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  287. <include refid="select"/>
  288. <include refid="where"/>
  289. </select>
  290. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  291. <include refid="select"/>
  292. <include refid="whereLike"/>
  293. </select>
  294. <insert id="batchInsert" parameterType="java.util.List">
  295. insert into DIL_NOTICE
  296. (NOTICE_ID,
  297. NOTICE_TITLE, NOTICE_CONTENT, INSERT_USERNAME,
  298. INSERT_TIME, UPDATE_USERNAME,
  299. UPDATE_TIME, INSERT_UPDATE_REMARK,
  300. DELETED, PERMISSION)
  301. ( <foreach collection="list" item="item" separator="union all">
  302. select
  303. #{item.noticeId,jdbcType=DECIMAL},
  304. #{item.noticeTitle,jdbcType=VARCHAR}, #{item.noticeContent,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
  305. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  306. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  307. #{item.deleted,jdbcType=DECIMAL}, #{item.permission,jdbcType=DECIMAL} from dual
  308. </foreach> )
  309. </insert>
  310. <update id="batchUpdate" parameterType="java.util.List">
  311. update DIL_NOTICE
  312. set
  313. NOTICE_ID=
  314. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  315. when #{item.noticeId,jdbcType=DECIMAL} then #{item.noticeId,jdbcType=DECIMAL}
  316. </foreach>
  317. ,NOTICE_TITLE=
  318. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  319. when #{item.noticeId,jdbcType=DECIMAL} then #{item.noticeTitle,jdbcType=VARCHAR}
  320. </foreach>
  321. ,NOTICE_CONTENT=
  322. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  323. when #{item.noticeId,jdbcType=DECIMAL} then #{item.noticeContent,jdbcType=VARCHAR}
  324. </foreach>
  325. ,INSERT_USERNAME=
  326. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  327. when #{item.noticeId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  328. </foreach>
  329. ,INSERT_TIME=
  330. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  331. when #{item.noticeId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  332. </foreach>
  333. ,UPDATE_USERNAME=
  334. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  335. when #{item.noticeId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  336. </foreach>
  337. ,UPDATE_TIME=
  338. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  339. when #{item.noticeId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  340. </foreach>
  341. ,INSERT_UPDATE_REMARK=
  342. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  343. when #{item.noticeId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  344. </foreach>
  345. ,DELETED=
  346. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  347. when #{item.noticeId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  348. </foreach>
  349. ,PERMISSION=
  350. <foreach collection="list" item="item" index="index" separator=" " open="case NOTICE_ID" close="end">
  351. when #{item.noticeId,jdbcType=DECIMAL} then #{item.permission,jdbcType=DECIMAL}
  352. </foreach>
  353. where NOTICE_ID in
  354. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  355. #{item.noticeId,jdbcType=DECIMAL}
  356. </foreach>
  357. </update>
  358. <delete id="batchDelete" parameterType="java.util.List">
  359. delete from DIL_NOTICE
  360. where NOTICE_ID in
  361. <foreach collection="list" item="id" open="(" close=")" separator=",">
  362. #{id}
  363. </foreach>
  364. </delete>
  365. <!-- 友情提示!!!-->
  366. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  367. <!-- 信息列表 -->
  368. <select id="getNoticeList" parameterType="java.util.Map" resultType="java.util.Map">
  369. SELECT * FROM
  370. (
  371. SELECT
  372. DN.NOTICE_ID AS "noticeId",
  373. DN.NOTICE_TITLE AS "noticeTitle",
  374. DN.NOTICE_CONTENT AS "noticeContent",
  375. DN.INSERT_TIME AS "insertTime",
  376. DN.INSERT_USERNAME AS "insertUsername"
  377. FROM DIL_NOTICE DN
  378. WHERE DN.DELETED !=1
  379. ORDER BY DN.INSERT_TIME DESC
  380. )
  381. <where>
  382. <if test="noticeId!= null">
  383. and
  384. <foreach collection="noticeId" item="item" open="(" separator="," close=")">
  385. "noticeId" in #{item}
  386. </foreach>
  387. </if>
  388. <if test="noticeTitle!= null">
  389. and
  390. <foreach collection="noticeTitle" item="item" open="(" separator="," close=")">
  391. "noticeTitle" in #{item}
  392. </foreach>
  393. </if>
  394. <if test="noticeContent!= null">
  395. and
  396. <foreach collection="noticeContent" item="item" open="(" separator="," close=")">
  397. "noticeContent" in #{item}
  398. </foreach>
  399. </if>
  400. <if test="insertTime!= null">
  401. and
  402. <foreach collection="insertTime" item="item" open="(" separator="," close=")">
  403. "insertTime" in #{item}
  404. </foreach>
  405. </if>
  406. <if test="insertUsername!= null">
  407. and
  408. <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
  409. "insertUsername" in #{item}
  410. </foreach>
  411. </if>
  412. </where>
  413. </select>
  414. <!--承运商查询通知-->
  415. <select id="getCarrierNoticeList" parameterType="java.util.Map" resultType="java.util.Map">
  416. SELECT * FROM
  417. (
  418. SELECT
  419. DN.NOTICE_ID AS "noticeId",
  420. DN.NOTICE_TITLE AS "noticeTitle",
  421. DN.NOTICE_CONTENT AS "noticeContent",
  422. DN.INSERT_TIME AS "insertTime",
  423. DN.INSERT_USERNAME AS "insertUsername",
  424. DN.PERMISSION AS "permission",
  425. DN.STATUS AS "status",
  426. DN.UPDATE_TITLE AS "updateTitle",
  427. DN.UPDATE_CONTENT AS "updateContent",
  428. DN.UPDATE_TIME AS "updateTime",
  429. DN.UPDATE_USERNAME AS "updateUsername"
  430. FROM DIL_NOTICE DN
  431. WHERE DN.DELETED !=1 and (DN.PERMISSION='qita' or DN.PERMISSION='chengyunshang')
  432. <if test="con!=null">
  433. and DN.NOTICE_TITLE || DN.INSERT_USERNAME like #{con}
  434. </if>
  435. ORDER BY DN.INSERT_TIME DESC
  436. )
  437. <where>
  438. <if test="noticeId!= null">
  439. and
  440. <foreach collection="noticeId" item="item" open="(" separator="," close=")">
  441. "noticeId" in #{item}
  442. </foreach>
  443. </if>
  444. <if test="noticeTitle!= null">
  445. and
  446. <foreach collection="noticeTitle" item="item" open="(" separator="," close=")">
  447. "noticeTitle" in #{item}
  448. </foreach>
  449. </if>
  450. <if test="noticeContent!= null">
  451. and
  452. <foreach collection="noticeContent" item="item" open="(" separator="," close=")">
  453. "noticeContent" in #{item}
  454. </foreach>
  455. </if>
  456. <if test="insertTime!= null">
  457. and
  458. <foreach collection="insertTime" item="item" open="(" separator="," close=")">
  459. "insertTime" in #{item}
  460. </foreach>
  461. </if>
  462. <if test="insertUsername!= null">
  463. and
  464. <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
  465. "insertUsername" in #{item}
  466. </foreach>
  467. </if>
  468. </where>
  469. <include refid="orderBy"></include>
  470. </select>
  471. <!--销售公司查询通知-->
  472. <select id="getMarketingNoticeList" parameterType="java.util.Map" resultType="java.util.Map">
  473. SELECT * FROM
  474. (
  475. SELECT
  476. DN.NOTICE_ID AS "noticeId",
  477. DN.NOTICE_TITLE AS "noticeTitle",
  478. DN.NOTICE_CONTENT AS "noticeContent",
  479. DN.INSERT_TIME AS "insertTime",
  480. DN.INSERT_USERNAME AS "insertUsername",
  481. DN.PERMISSION AS "permission",
  482. DN.STATUS AS "status",
  483. DN.UPDATE_TITLE AS "updateTitle",
  484. DN.UPDATE_CONTENT AS "updateContent",
  485. DN.UPDATE_TIME AS "updateTime",
  486. DN.UPDATE_USERNAME AS "updateUsername"
  487. FROM DIL_NOTICE DN
  488. WHERE DN.DELETED !=1 and (DN.PERMISSION='qita' or DN.PERMISSION='wuliuyunshubu')
  489. <if test="con!=null">
  490. and DN.NOTICE_TITLE || DN.INSERT_USERNAME like #{con}
  491. </if>
  492. ORDER BY DN.INSERT_TIME DESC
  493. )
  494. <where>
  495. <if test="noticeId!= null">
  496. and
  497. <foreach collection="noticeId" item="item" open="(" separator="," close=")">
  498. "noticeId" in #{item}
  499. </foreach>
  500. </if>
  501. <if test="noticeTitle!= null">
  502. and
  503. <foreach collection="noticeTitle" item="item" open="(" separator="," close=")">
  504. "noticeTitle" in #{item}
  505. </foreach>
  506. </if>
  507. <if test="noticeContent!= null">
  508. and
  509. <foreach collection="noticeContent" item="item" open="(" separator="," close=")">
  510. "noticeContent" in #{item}
  511. </foreach>
  512. </if>
  513. <if test="insertTime!= null">
  514. and
  515. <foreach collection="insertTime" item="item" open="(" separator="," close=")">
  516. "insertTime" in #{item}
  517. </foreach>
  518. </if>
  519. <if test="insertUsername!= null">
  520. and
  521. <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
  522. "insertUsername" in #{item}
  523. </foreach>
  524. </if>
  525. </where>
  526. <include refid="orderBy"></include>
  527. </select>
  528. <!--收货用户查询通知-->
  529. <select id="getClientNoticeList" parameterType="java.util.Map" resultType="java.util.Map">
  530. SELECT * FROM
  531. (
  532. SELECT
  533. DN.NOTICE_ID AS "noticeId",
  534. DN.NOTICE_TITLE AS "noticeTitle",
  535. DN.NOTICE_CONTENT AS "noticeContent",
  536. DN.INSERT_TIME AS "insertTime",
  537. DN.INSERT_USERNAME AS "insertUsername",
  538. DN.PERMISSION AS "permission",
  539. DN.STATUS AS "status",
  540. DN.UPDATE_TITLE AS "updateTitle",
  541. DN.UPDATE_CONTENT AS "updateContent",
  542. DN.UPDATE_TIME AS "updateTime",
  543. DN.UPDATE_USERNAME AS "updateUsername"
  544. FROM DIL_NOTICE DN
  545. WHERE DN.DELETED !=1 and (DN.PERMISSION='qita' or DN.PERMISSION='shouhuokehu')
  546. <if test="con!=null">
  547. and DN.NOTICE_TITLE || DN.INSERT_USERNAME like #{con}
  548. </if>
  549. ORDER BY DN.INSERT_TIME DESC
  550. )
  551. <where>
  552. <if test="noticeId!= null">
  553. and
  554. <foreach collection="noticeId" item="item" open="(" separator="," close=")">
  555. "noticeId" in #{item}
  556. </foreach>
  557. </if>
  558. <if test="noticeTitle!= null">
  559. and
  560. <foreach collection="noticeTitle" item="item" open="(" separator="," close=")">
  561. "noticeTitle" in #{item}
  562. </foreach>
  563. </if>
  564. <if test="noticeContent!= null">
  565. and
  566. <foreach collection="noticeContent" item="item" open="(" separator="," close=")">
  567. "noticeContent" in #{item}
  568. </foreach>
  569. </if>
  570. <if test="insertTime!= null">
  571. and
  572. <foreach collection="insertTime" item="item" open="(" separator="," close=")">
  573. "insertTime" in #{item}
  574. </foreach>
  575. </if>
  576. <if test="insertUsername!= null">
  577. and
  578. <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
  579. "insertUsername" in #{item}
  580. </foreach>
  581. </if>
  582. </where>
  583. <include refid="orderBy"></include>
  584. </select>
  585. <!--根据Id查询公告-->
  586. <select id="getNoticeById" resultType="java.util.LinkedHashMap" >
  587. SELECT
  588. DN.NOTICE_ID AS "noticeId",
  589. DN.NOTICE_TITLE AS "noticeTitle",
  590. DN.NOTICE_CONTENT AS "noticeContent",
  591. DN.INSERT_TIME AS "insertTime",
  592. DN.INSERT_USERNAME AS "insertUsername",
  593. decode(DN.PERMISSION,'qita','全部可见',
  594. 'chengyunshang','承运商',
  595. 'wuliuyunshubu','销售公司',
  596. 'shouhuokehu','收货客户') "permission"
  597. FROM DIL_NOTICE DN
  598. WHERE DN.NOTICE_ID=#{id}
  599. </select>
  600. <!--根据Id查询公告(修改过后的)-->
  601. <select id="getNoticeById1" resultType="java.util.LinkedHashMap" >
  602. SELECT
  603. DN.NOTICE_ID AS "noticeId",
  604. DN.UPDATE_TITLE AS "noticeTitle",
  605. DN.UPDATE_CONTENT AS "noticeContent",
  606. DN.UPDATE_TIME AS "insertTime",
  607. DN.UPDATE_USERNAME AS "insertUsername",
  608. decode(DN.PERMISSION,'qita','全部可见',
  609. 'chengyunshang','承运商',
  610. 'wuliuyunshubu','销售公司',
  611. 'shouhuokehu','收货客户') "permission"
  612. FROM DIL_NOTICE DN
  613. WHERE DN.NOTICE_ID=#{id}
  614. </select>
  615. <!--根据permission查询最新公告-->
  616. <select id="getNewNoticeByPermission" resultType="java.util.LinkedHashMap" >
  617. SELECT
  618. DN.NOTICE_ID AS "noticeId",
  619. DN.NOTICE_TITLE AS "noticeTitle",
  620. DN.NOTICE_CONTENT AS "noticeContent",
  621. DN.INSERT_TIME AS "insertTime",
  622. DN.INSERT_USERNAME AS "insertUsername"
  623. FROM DIL_NOTICE DN
  624. WHERE DN.INSERT_TIME = (SELECT MAX(DN.INSERT_TIME) FROM DIL_NOTICE DN WHERE DN.PERMISSION = #{permission} OR DN.PERMISSION =0)
  625. </select>
  626. <!-- /* DN.INSERT_TIME = DN.PERMISSION =#{permission} OR DN.PERMISSION =0 AND*/-->
  627. <!--获取信息-->
  628. <select id="getNoticeData" parameterType="java.lang.String" resultType="java.util.Map">
  629. select * from(
  630. SELECT DN.NOTICE_TITLE AS "noticetitle",
  631. DN.NOTICE_CONTENT AS "noticecontent",
  632. DN.INSERT_USERNAME AS "insertusername",
  633. DN.INSERT_TIME AS "inserttime",
  634. DN.NOTICE_ID AS "noticeId",
  635. (select count(DNU.NOTICE_ID) from DIL_NOTICE_USERS DNU
  636. LEFT JOIN DIL_NOTICE DN
  637. ON DN.NOTICE_ID=DNU.NOTICE_ID
  638. where DNU.STATUS =0
  639. and DNU.USER_ID=#{userId}
  640. and DN.INSERT_TIME <![CDATA[<]]> SYSDATE) "taskAllNum"
  641. FROM DIL_NOTICE_USERS DNU
  642. LEFT JOIN DIL_NOTICE DN
  643. ON DN.NOTICE_ID=DNU.NOTICE_ID
  644. WHERE DNU.USER_ID=#{userId}
  645. and sysdate > DN.INSERT_TIME
  646. order by DN.INSERT_TIME DESC)
  647. where rownum <![CDATA[<]]> 4
  648. </select>
  649. <!--获取信息-->
  650. <select id="getNoticeData1" resultType="java.util.Map">
  651. select
  652. t.NOTICE_TITLE AS "noticetitle",
  653. t.NOTICE_CONTENT AS "noticecontent",
  654. t.INSERT_USERNAME AS "insertusername",
  655. t.INSERT_TIME AS "inserttime",
  656. (select count(*) INSERT_USERNAME from DIL_NOTICE where PERMISSION = 0) AS "taskAllNum"
  657. from DIL_NOTICE t
  658. where t.PERMISSION = 0
  659. and t.Deleted =0
  660. </select>
  661. <!--向通知与用户中间表存储数据-->
  662. <insert id="insertIntoNoticeUser">
  663. INSERT INTO DIL_NOTICE_USERS
  664. (select DN.NOTICE_ID ,
  665. SU.USER_ID,
  666. SU.USER_NAME,
  667. SU.ORG_CODE,
  668. 0 "STATUS"
  669. from DIL_NOTICE DN ,"SSO".SYS_USER SU
  670. WHERE DN.NOTICE_ID=#{noticeId}
  671. AND SU.ORG_CODE=#{permission})
  672. </insert>
  673. <insert id="insertIntoNoticeUser1">
  674. INSERT INTO DIL_NOTICE_USERS
  675. (select DN.NOTICE_ID ,
  676. SU.USER_ID,
  677. SU.USER_NAME,
  678. SU.ORG_CODE,
  679. 0 "STATUS"
  680. from DIL_NOTICE DN ,"SSO".SYS_USER SU
  681. WHERE DN.NOTICE_ID=#{noticeId}
  682. AND SU.ORG_CODE != 'yunli')
  683. </insert>
  684. <update id="updateNotice">
  685. update DIL_NOTICE
  686. set NOTICE_TITLE= #{noticeTitle},
  687. NOTICE_CONTENT=#{noticeContent},
  688. INSERT_USERNAME=#{insertUsername},
  689. PERMISSION=#{permission},
  690. UPDATE_USERNAME=#{updateUsername},
  691. UPDATE_TIME=#{updateTime}
  692. where NOTICE_ID=#{noticeId}
  693. </update>
  694. <delete id="deleteNotice">
  695. delete from DIL_NOTICE DN
  696. where DN.notice_id=#{noticeId}
  697. </delete>
  698. <delete id="deleteNoticeUsers">
  699. delete from DIL_NOTICE_USERS DNU
  700. where DNU.notice_id=#{noticeId}
  701. </delete>
  702. <update id="updatestatus">
  703. update DIL_NOTICE_USERS DNU
  704. SET STATUS=1
  705. WHERE DNU.USER_ID=#{userId}
  706. and DNU.NOTICE_ID=#{noticeId}
  707. </update>
  708. <select id="gettaskAllNum" resultType="java.lang.Integer">
  709. select count(DNU.NOTICE_ID) from DIL_NOTICE_USERS DNU
  710. LEFT JOIN DIL_NOTICE DN
  711. ON DN.NOTICE_ID=DNU.NOTICE_ID
  712. where DNU.STATUS =0
  713. and DNU.USER_ID=#{userId}
  714. and DN.INSERT_TIME <![CDATA[<]]> SYSDATE
  715. </select>
  716. <select id="queryName" resultType="java.lang.String">
  717. select SU.USER_NAME "userName"
  718. from "SSO".SYS_USER SU
  719. where SU.USER_ID=#{userId}
  720. </select>
  721. <select id="getorgCode" resultType="java.lang.String">
  722. select DN.PERMISSION "permission"
  723. from DIL_NOTICE DN
  724. where DN.NOTICE_ID=#{noticeId}
  725. </select>
  726. <select id="gethistoryorgCode" resultMap="BaseResultMap">
  727. select *
  728. from DIL_NOTICE DN
  729. where DN.NOTICE_ID=#{noticeId}
  730. </select>
  731. <update id="updatehistorydata">
  732. update DIL_NOTICE
  733. set NOTICE_TITLE=#{noticeTitle},
  734. NOTICE_CONTENT=#{noticeContent},
  735. INSERT_USERNAME=#{insertUsername},
  736. INSERT_TIME=#{insertTime},
  737. UPDATE_TIME=null,UPDATE_TITLE=null,UPDATE_CONTENT=null,UPDATE_USERNAME=null,STATUS=0
  738. WHERE NOTICE_ID=#{noticeId}
  739. </update>
  740. <update id="updateTime">
  741. update DIL_NOTICE
  742. set INSERT_TIME=#{insertTime}
  743. where NOTICE_ID=#{noticeId}
  744. </update>
  745. <update id="modifyData">
  746. update DIL_NOTICE
  747. set UPDATE_TITLE=#{updateTitle},
  748. UPDATE_CONTENT=#{updateContent},
  749. UPDATE_USERNAME=#{updateUsername},
  750. UPDATE_TIME=#{updateTime},
  751. PERMISSION=#{permission},
  752. STATUS=#{status}
  753. WHERE NOTICE_ID=#{noticeId}
  754. </update>
  755. <select id="getStatus" resultType="java.lang.String">
  756. select DN.STATUS "status"
  757. from DIL_NOTICE DN
  758. where DN.NOTICE_ID=#{id}
  759. </select>
  760. <select id="getNoticeAll" resultType="java.util.Map">
  761. SELECT DN.NOTICE_TITLE AS "noticetitle",
  762. DN.NOTICE_CONTENT AS "noticecontent",
  763. DN.INSERT_USERNAME AS "insertusername",
  764. DN.INSERT_TIME AS "inserttime",
  765. DN.NOTICE_ID AS "noticeId",
  766. DNU.STATUS "status"
  767. FROM DIL_NOTICE DN
  768. LEFT JOIN DIL_NOTICE_USERS DNU ON DNU .NOTICE_ID=DN .NOTICE_ID
  769. WHERE DNU.USER_ID=#{userId}
  770. AND SYSDATE > DN.INSERT_TIME
  771. AND DNU .NOTICE_ID IS NOT NULL
  772. ORDER BY DN.INSERT_TIME DESC
  773. FETCH NEXT 99 ROWS ONLY
  774. </select>
  775. <update id="readAll">
  776. update DIL_NOTICE_USERS
  777. SET STATUS=1
  778. WHERE USER_ID=#{userId}
  779. and NOTICE_ID IN(
  780. SELECT NOTICE_ID FROM DIL_NOTICE
  781. WHERE INSERT_USERNAME = #{insertUserName}
  782. )
  783. </update>
  784. <select id="getNoticeUser" resultType="java.util.Map">
  785. SELECT DN.NOTICE_TITLE AS "noticetitle",
  786. DN.NOTICE_CONTENT AS "noticecontent",
  787. DN.INSERT_USERNAME AS "insertusername",
  788. DN.INSERT_TIME AS "inserttime",
  789. DN.NOTICE_ID AS "noticeId",
  790. SU .USER_NAME "userName",
  791. decode(DNU.STATUS,1,'已读','未读') "status"
  792. FROM DIL_NOTICE DN
  793. LEFT JOIN DIL_NOTICE_USERS DNU ON DNU .NOTICE_ID=DN .NOTICE_ID
  794. LEFT JOIN SSO.SYS_USER SU ON SU .USER_ID = DNU .USER_ID
  795. <where>
  796. <if test="noticeId!=null">
  797. AND DNU.NOTICE_ID=#{noticeId}
  798. </if>
  799. <if test="userId!=null">
  800. AND DNU.USER_ID=#{userId}
  801. </if>
  802. AND DNU.NOTICE_ID IS NOT NULL
  803. AND SYSDATE > DN.INSERT_TIME
  804. ORDER BY DN.INSERT_TIME DESC
  805. </where>
  806. </select>
  807. </mapper>