DilNoticeMapper.xml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  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="or" close=")">
  459. to_date(to_char("insertTime",'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')
  460. in to_date(#{item},'yyyy-mm-dd hh24:mi:ss')
  461. </foreach>
  462. </if>
  463. <if test="insertUsername!= null">
  464. and
  465. <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
  466. "insertUsername" in #{item}
  467. </foreach>
  468. </if>
  469. </where>
  470. <include refid="orderBy"></include>
  471. </select>
  472. <!--销售公司查询通知-->
  473. <select id="getMarketingNoticeList" parameterType="java.util.Map" resultType="java.util.Map">
  474. SELECT * FROM
  475. (
  476. SELECT
  477. DN.NOTICE_ID AS "noticeId",
  478. DN.NOTICE_TITLE AS "noticeTitle",
  479. DN.NOTICE_CONTENT AS "noticeContent",
  480. DN.INSERT_TIME AS "insertTime",
  481. DN.INSERT_USERNAME AS "insertUsername",
  482. DN.PERMISSION AS "permission",
  483. DN.STATUS AS "status",
  484. DN.UPDATE_TITLE AS "updateTitle",
  485. DN.UPDATE_CONTENT AS "updateContent",
  486. DN.UPDATE_TIME AS "updateTime",
  487. DN.UPDATE_USERNAME AS "updateUsername"
  488. FROM DIL_NOTICE DN
  489. WHERE DN.DELETED !=1 and (DN.PERMISSION='qita' or DN.PERMISSION='wuliuyunshubu')
  490. <if test="con!=null">
  491. and DN.NOTICE_TITLE || DN.INSERT_USERNAME like #{con}
  492. </if>
  493. ORDER BY DN.INSERT_TIME DESC
  494. )
  495. <where>
  496. <if test="noticeId!= null">
  497. and
  498. <foreach collection="noticeId" item="item" open="(" separator="," close=")">
  499. "noticeId" in #{item}
  500. </foreach>
  501. </if>
  502. <if test="noticeTitle!= null">
  503. and
  504. <foreach collection="noticeTitle" item="item" open="(" separator="," close=")">
  505. "noticeTitle" in #{item}
  506. </foreach>
  507. </if>
  508. <if test="noticeContent!= null">
  509. and
  510. <foreach collection="noticeContent" item="item" open="(" separator="," close=")">
  511. "noticeContent" in #{item}
  512. </foreach>
  513. </if>
  514. <if test="insertTime!= null">
  515. and
  516. <foreach collection="insertTime" item="item" open="(" separator="," close=")">
  517. "insertTime" in #{item}
  518. </foreach>
  519. </if>
  520. <if test="insertUsername!= null">
  521. and
  522. <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
  523. "insertUsername" in #{item}
  524. </foreach>
  525. </if>
  526. </where>
  527. <include refid="orderBy"></include>
  528. </select>
  529. <!--收货用户查询通知-->
  530. <select id="getClientNoticeList" parameterType="java.util.Map" resultType="java.util.Map">
  531. SELECT * FROM
  532. (
  533. SELECT
  534. DN.NOTICE_ID AS "noticeId",
  535. DN.NOTICE_TITLE AS "noticeTitle",
  536. DN.NOTICE_CONTENT AS "noticeContent",
  537. DN.INSERT_TIME AS "insertTime",
  538. DN.INSERT_USERNAME AS "insertUsername",
  539. DN.PERMISSION AS "permission",
  540. DN.STATUS AS "status",
  541. DN.UPDATE_TITLE AS "updateTitle",
  542. DN.UPDATE_CONTENT AS "updateContent",
  543. DN.UPDATE_TIME AS "updateTime",
  544. DN.UPDATE_USERNAME AS "updateUsername"
  545. FROM DIL_NOTICE DN
  546. WHERE DN.DELETED !=1 and (DN.PERMISSION='qita' or DN.PERMISSION='shouhuokehu')
  547. <if test="con!=null">
  548. and DN.NOTICE_TITLE || DN.INSERT_USERNAME like #{con}
  549. </if>
  550. ORDER BY DN.INSERT_TIME DESC
  551. )
  552. <where>
  553. <if test="noticeId!= null">
  554. and
  555. <foreach collection="noticeId" item="item" open="(" separator="," close=")">
  556. "noticeId" in #{item}
  557. </foreach>
  558. </if>
  559. <if test="noticeTitle!= null">
  560. and
  561. <foreach collection="noticeTitle" item="item" open="(" separator="," close=")">
  562. "noticeTitle" in #{item}
  563. </foreach>
  564. </if>
  565. <if test="noticeContent!= null">
  566. and
  567. <foreach collection="noticeContent" item="item" open="(" separator="," close=")">
  568. "noticeContent" in #{item}
  569. </foreach>
  570. </if>
  571. <if test="insertTime!= null">
  572. and
  573. <foreach collection="insertTime" item="item" open="(" separator="," close=")">
  574. "insertTime" in #{item}
  575. </foreach>
  576. </if>
  577. <if test="insertUsername!= null">
  578. and
  579. <foreach collection="insertUsername" item="item" open="(" separator="," close=")">
  580. "insertUsername" in #{item}
  581. </foreach>
  582. </if>
  583. </where>
  584. <include refid="orderBy"></include>
  585. </select>
  586. <!--根据Id查询公告-->
  587. <select id="getNoticeById" resultType="java.util.LinkedHashMap" >
  588. SELECT
  589. DN.NOTICE_ID AS "noticeId",
  590. DN.NOTICE_TITLE AS "noticeTitle",
  591. DN.NOTICE_CONTENT AS "noticeContent",
  592. DN.INSERT_TIME AS "insertTime",
  593. DN.INSERT_USERNAME AS "insertUsername",
  594. decode(DN.PERMISSION,'qita','全部可见',
  595. 'chengyunshang','承运商',
  596. 'wuliuyunshubu','销售公司',
  597. 'shouhuokehu','收货客户') "permission"
  598. FROM DIL_NOTICE DN
  599. WHERE DN.NOTICE_ID=#{id}
  600. </select>
  601. <!--根据Id查询公告(修改过后的)-->
  602. <select id="getNoticeById1" resultType="java.util.LinkedHashMap" >
  603. SELECT
  604. DN.NOTICE_ID AS "noticeId",
  605. DN.UPDATE_TITLE AS "noticeTitle",
  606. DN.UPDATE_CONTENT AS "noticeContent",
  607. DN.UPDATE_TIME AS "insertTime",
  608. DN.UPDATE_USERNAME AS "insertUsername",
  609. decode(DN.PERMISSION,'qita','全部可见',
  610. 'chengyunshang','承运商',
  611. 'wuliuyunshubu','销售公司',
  612. 'shouhuokehu','收货客户') "permission"
  613. FROM DIL_NOTICE DN
  614. WHERE DN.NOTICE_ID=#{id}
  615. </select>
  616. <!--根据permission查询最新公告-->
  617. <select id="getNewNoticeByPermission" resultType="java.util.LinkedHashMap" >
  618. SELECT
  619. DN.NOTICE_ID AS "noticeId",
  620. DN.NOTICE_TITLE AS "noticeTitle",
  621. DN.NOTICE_CONTENT AS "noticeContent",
  622. DN.INSERT_TIME AS "insertTime",
  623. DN.INSERT_USERNAME AS "insertUsername"
  624. FROM DIL_NOTICE DN
  625. WHERE DN.INSERT_TIME = (SELECT MAX(DN.INSERT_TIME) FROM DIL_NOTICE DN WHERE DN.PERMISSION = #{permission} OR DN.PERMISSION =0)
  626. </select>
  627. <!-- /* DN.INSERT_TIME = DN.PERMISSION =#{permission} OR DN.PERMISSION =0 AND*/-->
  628. <!--获取信息-->
  629. <select id="getNoticeData" parameterType="java.lang.String" resultType="java.util.Map">
  630. select * from(
  631. SELECT DN.NOTICE_TITLE AS "noticetitle",
  632. DN.NOTICE_CONTENT AS "noticecontent",
  633. DN.INSERT_USERNAME AS "insertusername",
  634. DN.INSERT_TIME AS "inserttime",
  635. DN.NOTICE_ID AS "noticeId",
  636. (select count(DNU.NOTICE_ID) from DIL_NOTICE_USERS DNU
  637. LEFT JOIN DIL_NOTICE DN
  638. ON DN.NOTICE_ID=DNU.NOTICE_ID
  639. where DNU.STATUS =0
  640. and DNU.USER_ID=#{userId}
  641. and DN.INSERT_TIME <![CDATA[<]]> SYSDATE) "taskAllNum"
  642. FROM DIL_NOTICE_USERS DNU
  643. LEFT JOIN DIL_NOTICE DN
  644. ON DN.NOTICE_ID=DNU.NOTICE_ID
  645. WHERE DNU.USER_ID=#{userId}
  646. and sysdate > DN.INSERT_TIME
  647. order by DN.INSERT_TIME DESC)
  648. where rownum <![CDATA[<]]> 4
  649. </select>
  650. <!--获取信息-->
  651. <select id="getNoticeData1" resultType="java.util.Map">
  652. select
  653. t.NOTICE_TITLE AS "noticetitle",
  654. t.NOTICE_CONTENT AS "noticecontent",
  655. t.INSERT_USERNAME AS "insertusername",
  656. t.INSERT_TIME AS "inserttime",
  657. (select count(*) INSERT_USERNAME from DIL_NOTICE where PERMISSION = 0) AS "taskAllNum"
  658. from DIL_NOTICE t
  659. where t.PERMISSION = 0
  660. and t.Deleted =0
  661. </select>
  662. <!--向通知与用户中间表存储数据-->
  663. <insert id="insertIntoNoticeUser">
  664. INSERT INTO DIL_NOTICE_USERS
  665. (select DN.NOTICE_ID ,
  666. SU.USER_ID,
  667. SU.USER_NAME,
  668. SU.ORG_CODE,
  669. 0 "STATUS"
  670. from DIL_NOTICE DN ,"SSO".SYS_USER SU
  671. WHERE DN.NOTICE_ID=#{noticeId}
  672. AND SU.ORG_CODE=#{permission})
  673. </insert>
  674. <insert id="insertIntoNoticeUser1">
  675. INSERT INTO DIL_NOTICE_USERS
  676. (select DN.NOTICE_ID ,
  677. SU.USER_ID,
  678. SU.USER_NAME,
  679. SU.ORG_CODE,
  680. 0 "STATUS"
  681. from DIL_NOTICE DN ,"SSO".SYS_USER SU
  682. WHERE DN.NOTICE_ID=#{noticeId}
  683. AND SU.ORG_CODE != 'yunli')
  684. </insert>
  685. <update id="updateNotice">
  686. update DIL_NOTICE
  687. set NOTICE_TITLE= #{noticeTitle},
  688. NOTICE_CONTENT=#{noticeContent},
  689. INSERT_USERNAME=#{insertUsername},
  690. PERMISSION=#{permission},
  691. UPDATE_USERNAME=#{updateUsername},
  692. UPDATE_TIME=#{updateTime}
  693. where NOTICE_ID=#{noticeId}
  694. </update>
  695. <delete id="deleteNotice">
  696. delete from DIL_NOTICE DN
  697. where DN.notice_id=#{noticeId}
  698. </delete>
  699. <delete id="deleteNoticeUsers">
  700. delete from DIL_NOTICE_USERS DNU
  701. where DNU.notice_id=#{noticeId}
  702. </delete>
  703. <update id="updatestatus">
  704. update DIL_NOTICE_USERS DNU
  705. SET STATUS=1
  706. WHERE DNU.USER_ID=#{userId}
  707. and DNU.NOTICE_ID=#{noticeId}
  708. </update>
  709. <select id="gettaskAllNum" resultType="java.lang.Integer">
  710. select count(DNU.NOTICE_ID) from DIL_NOTICE_USERS DNU
  711. LEFT JOIN DIL_NOTICE DN
  712. ON DN.NOTICE_ID=DNU.NOTICE_ID
  713. where DNU.STATUS =0
  714. and DNU.USER_ID=#{userId}
  715. and DN.INSERT_TIME <![CDATA[<]]> SYSDATE
  716. </select>
  717. <select id="queryName" resultType="java.lang.String">
  718. select SU.USER_NAME "userName"
  719. from "SSO".SYS_USER SU
  720. where SU.USER_ID=#{userId}
  721. </select>
  722. <select id="getorgCode" resultType="java.lang.String">
  723. select DN.PERMISSION "permission"
  724. from DIL_NOTICE DN
  725. where DN.NOTICE_ID=#{noticeId}
  726. </select>
  727. <select id="gethistoryorgCode" resultMap="BaseResultMap">
  728. select *
  729. from DIL_NOTICE DN
  730. where DN.NOTICE_ID=#{noticeId}
  731. </select>
  732. <update id="updatehistorydata">
  733. update DIL_NOTICE
  734. set NOTICE_TITLE=#{noticeTitle},
  735. NOTICE_CONTENT=#{noticeContent},
  736. INSERT_USERNAME=#{insertUsername},
  737. INSERT_TIME=#{insertTime},
  738. UPDATE_TIME=null,UPDATE_TITLE=null,UPDATE_CONTENT=null,UPDATE_USERNAME=null,STATUS=0
  739. WHERE NOTICE_ID=#{noticeId}
  740. </update>
  741. <update id="updateTime">
  742. update DIL_NOTICE
  743. set INSERT_TIME=#{insertTime}
  744. where NOTICE_ID=#{noticeId}
  745. </update>
  746. <update id="modifyData">
  747. update DIL_NOTICE
  748. set UPDATE_TITLE=#{updateTitle},
  749. UPDATE_CONTENT=#{updateContent},
  750. UPDATE_USERNAME=#{updateUsername},
  751. UPDATE_TIME=#{updateTime},
  752. PERMISSION=#{permission},
  753. STATUS=#{status}
  754. WHERE NOTICE_ID=#{noticeId}
  755. </update>
  756. <select id="getStatus" resultType="java.lang.String">
  757. select DN.STATUS "status"
  758. from DIL_NOTICE DN
  759. where DN.NOTICE_ID=#{id}
  760. </select>
  761. <select id="getNoticeAll" resultType="java.util.Map">
  762. SELECT DN.NOTICE_TITLE AS "noticetitle",
  763. DN.NOTICE_CONTENT AS "noticecontent",
  764. DN.INSERT_USERNAME AS "insertusername",
  765. DN.INSERT_TIME AS "inserttime",
  766. DN.NOTICE_ID AS "noticeId",
  767. DNU.STATUS "status"
  768. FROM DIL_NOTICE DN
  769. LEFT JOIN DIL_NOTICE_USERS DNU ON DNU .NOTICE_ID=DN .NOTICE_ID
  770. WHERE DNU.USER_ID=#{userId}
  771. AND SYSDATE > DN.INSERT_TIME
  772. AND DNU .NOTICE_ID IS NOT NULL
  773. ORDER BY DN.INSERT_TIME DESC
  774. FETCH NEXT 99 ROWS ONLY
  775. </select>
  776. <update id="readAll">
  777. update DIL_NOTICE_USERS
  778. SET STATUS=1
  779. WHERE USER_ID=#{userId}
  780. and NOTICE_ID IN(
  781. SELECT NOTICE_ID FROM DIL_NOTICE
  782. WHERE INSERT_USERNAME = #{insertUserName}
  783. )
  784. </update>
  785. <select id="getNoticeUser" resultType="java.util.Map">
  786. SELECT DN.NOTICE_TITLE AS "noticetitle",
  787. DN.NOTICE_CONTENT AS "noticecontent",
  788. DN.INSERT_USERNAME AS "insertusername",
  789. DN.INSERT_TIME AS "inserttime",
  790. DN.NOTICE_ID AS "noticeId",
  791. SU .USER_NAME "userName",
  792. decode(DNU.STATUS,1,'已读','未读') "status"
  793. FROM DIL_NOTICE DN
  794. LEFT JOIN DIL_NOTICE_USERS DNU ON DNU .NOTICE_ID=DN .NOTICE_ID
  795. LEFT JOIN SSO.SYS_USER SU ON SU .USER_ID = DNU .USER_ID
  796. <where>
  797. <if test="noticeId!=null">
  798. AND DNU.NOTICE_ID=#{noticeId}
  799. </if>
  800. <if test="userId!=null">
  801. AND DNU.USER_ID=#{userId}
  802. </if>
  803. AND DNU.NOTICE_ID IS NOT NULL
  804. AND SYSDATE > DN.INSERT_TIME
  805. ORDER BY DN.INSERT_TIME DESC
  806. </where>
  807. </select>
  808. <select id="findErrorOrder" resultType="java.util.Map">
  809. SELECT APO .PURCHASE_ORDER_NO "purchaseOrderNo",
  810. APO .PURCHASE_ORDER_BUYER "purchaseOrderBuyer"
  811. FROM AMS_PURCHASE_ORDER APO
  812. LEFT JOIN DIL_BATCH DB ON DB .BATCH_ID = APO .BATCH_ID
  813. LEFT JOIN DIL_NOTICE DN ON DN .INSERT_UPDATE_REMARK = APO.PURCHASE_ORDER_NO
  814. WHERE
  815. APO.DELETED=0
  816. AND (DB .RESULT_FOREIGN_SHIP_NAME='烧结' OR DB .RESULT_FOREIGN_SHIP_NAME='泰昕')
  817. AND NVL(DN .DELETED,1) != 0
  818. ORDER BY APO .INSERT_TIME DESC
  819. </select>
  820. <insert id="insertIntoNoticeUserToOne">
  821. INSERT INTO DIL_NOTICE_USERS
  822. (select DN.NOTICE_ID ,
  823. SU.USER_ID,
  824. SU.USER_NAME,
  825. SU.ORG_CODE,
  826. 0 "STATUS"
  827. from DIL_NOTICE DN ,"SSO".SYS_USER SU
  828. WHERE DN.NOTICE_ID=#{noticeId}
  829. AND SU.USER_ID=#{userId})
  830. </insert>
  831. </mapper>