TransactionSignUpMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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.unis.transaction.server.dao.TransactionSignUpDao">
  4. <sql id="transactionsignupColumns">
  5. jybm,bdbm,bdh,apcc,sl,je,lsxz,lsxzmc,lslb,lslbmc,dwbm,dwmc,lxdh,bzj,sxfl,bmrq,fjid,
  6. spr,shzt,shztmc,shyj,shsj,hkje,hksj,hkdwbm,hkdwmc,hkpz,skzt,skztmc,tkzt,tkztmc,remark
  7. ,lspzbm,lspzmc
  8. </sql>
  9. <sql id="transactions">
  10. bm.jybm as jybm,
  11. bm.dwmc as dwmc,
  12. bm.jyfx as jyfx,
  13. bm.jyfxmc as jyfxmc,
  14. bm.jyfs as jyfs,
  15. bm.jyfsmc as jyfsmc,
  16. bm.bmrq as bmrq,
  17. bm.lxdh as lxdh,
  18. bm.sxfl as sxfl,
  19. bm.shzt as shzt,
  20. bm.shztmc as shztmc,
  21. bm.fjid as fjid,
  22. bm.wtbm as wtbm,
  23. bm.ccbm as ccbm,
  24. bm.bdh as bdh,
  25. bm.sl as sl,
  26. bm.yxsl as yxsl,
  27. bm.apcc as apcc,
  28. bm.jybzj as jybzj,
  29. bm.lybzj as lybzj,
  30. bm.jkje jkje
  31. </sql>
  32. <sql id="transaction">
  33. bm.jybm as jybm,
  34. bm.dwmc as dwmc,
  35. bm.bmrq as bmrq,
  36. bm.lxdh as lxdh,
  37. bm.sxfl as sxfl,
  38. bm.shzt as shzt,
  39. bm.skzt as skzt,
  40. bm.skztmc as skztmc,
  41. bm.shztmc as shztmc,
  42. bm.fjid as fjid,
  43. bm.wtbm as wtbm,
  44. cc.ccbm as ccbm,
  45. cc.zt as zt,
  46. bm.bdh as bdh,
  47. cc.sl as sl,
  48. cc.apcc as apcc,
  49. cc.bzj as bzj,
  50. wt.jyrq as jyrq,
  51. wt.pzmc as lspzmc
  52. </sql>
  53. <sql id="transactionsignupJoins">
  54. </sql>
  55. <select id="selectList" resultType="com.unis.transaction.server.entity.signuppay.TransactionSignUpDO" parameterType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  56. SELECT
  57. <include refid="transactionsignupColumns" />
  58. FROM ty_jybm <include refid="transactionsignupJoins" />
  59. <where>
  60. and status = 1
  61. <if test="shzt != null and shzt != ''">
  62. and shzt = #{shzt}
  63. </if>
  64. </where>
  65. </select>
  66. <select id="selectPageLists" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO" parameterType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  67. SELECT
  68. <include refid="transactions" />
  69. FROM ty_jybm bm
  70. left join ty_jycrkwt wt on bm.wtbm = wt.wtbm
  71. <where>
  72. and bm.status = 1
  73. <if test="shztList != null">
  74. and bm.shzt in
  75. <foreach collection="shztList" index="index" item="item" open="(" separator="," close=")">
  76. #{item}
  77. </foreach>
  78. </if>
  79. <if test="apcc != null and apcc != ''">
  80. and bm.apcc like '%'||#{apcc}||'%'
  81. </if>
  82. <if test="dwmc != null and dwmc != ''">
  83. and bm.dwmc like '%'||#{dwmc}||'%'
  84. </if>
  85. <if test="bmrqStart != null">
  86. and bm.bmrq &gt;= #{bmrqStart}
  87. </if>
  88. <if test="bmrqEnd != null">
  89. and bm.bmrq &lt;= #{bmrqEnd}
  90. </if>
  91. <if test="shsjStart != null">
  92. and bm.shsj &gt;= #{shsjStart}
  93. </if>
  94. <if test="shsjEnd != null">
  95. and bm.shsj &lt;= #{shsjEnd}
  96. </if>
  97. </where>
  98. order by bm.ccbm desc
  99. </select>
  100. <select id="selectTransactionSignPageList" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO" parameterType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  101. select cc.wtfmc, cc.jyfx, cc.jyfs,
  102. decode(cc.jyfx, '0', '采购', '1', '销售', '0,1', '采购,销售', '') jyfxmc,
  103. decode(cc.jyfs, '0', '竞价', '1', '挂牌', '2', '购销双向', '') jyfsmc,
  104. cc.ccbm, cc.zt, cc.apcc, cc.wtbm, cc.jybzj, cc.lybzj, cc.sl, cc.jyrq,
  105. bm.bmrq, bm.shzt, bm.shztmc, bm.jybm
  106. from (select * from ty_jycc where cczt='已发布') cc
  107. left join (select * from ty_jybm
  108. <where>
  109. <if test="dwbm != null and dwbm != ''">
  110. and dwbm =#{dwbm}
  111. </if>
  112. <if test="shztList != null">
  113. and shzt in
  114. <foreach collection="shztList" index="index" item="item" open="(" separator="," close=")">
  115. #{item}
  116. </foreach>
  117. </if>
  118. </where>
  119. ) bm on cc.ccbm = bm.ccbm
  120. <where>
  121. <!-- <if test="shzt !='91000079'.toString() and shzt !='1'.toString() and shzt !=''">
  122. and cc.zt=1 and bm.jybm is not null
  123. </if>
  124. <if test="shzt == '1'.toString()">
  125. and cc.zt=1 and bm.jybm is null
  126. </if>
  127. <if test="shzt=='91000079'.toString()">
  128. and cc.zt=0 and bm.jybm is null
  129. </if> -->
  130. <!-- 未报名 -->
  131. <if test="shzt == '1'.toString()">
  132. and cc.zt !=0 and bm.shzt is null
  133. </if>
  134. <!-- 除未报名和已过期外的-->
  135. <if test="shzt != '1'.toString() and shzt !='91000079'.toString()">
  136. <if test="shztList != null">
  137. and bm.shzt in
  138. <foreach collection="shztList" index="index" item="item" open="(" separator="," close=")">
  139. #{item}
  140. </foreach>
  141. </if>
  142. </if>
  143. <!-- 已过期 -->
  144. <if test="shzt=='91000079'.toString()">
  145. and cc.zt=0 and bm.jybm is null
  146. </if>
  147. <if test="apcc != null and apcc != '' and shzt == '1'.toString()">
  148. and cc.apcc like '%'||#{apcc}||'%'
  149. </if>
  150. <if test="apcc != null and apcc != '' and shzt != '1'.toString() and shzt == ''">
  151. and cc.apcc like '%'||#{apcc}||'%'
  152. </if>
  153. <if test="apcc != null and apcc != '' and shzt != '1'.toString() and shzt != ''">
  154. and bm.apcc like '%'||#{apcc}||'%'
  155. </if>
  156. <if test="bmrqEnd != null">
  157. and bm.bmrq &lt;= #{bmrqEnd}
  158. </if>
  159. <if test="bmrqStart != null">
  160. and bm.bmrq &gt;= #{bmrqStart}
  161. </if>
  162. </where>
  163. order by cc.jyrq desc, bm.bmrq desc
  164. </select>
  165. <select id="selectPageList" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO" parameterType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  166. select * from (SELECT
  167. <include refid="transaction" />
  168. FROM
  169. <if test="shztList == null and shzt == '1'.toString()">
  170. (select * from ty_jycc where ccbm not in(select ccbm from ty_jybm) and zt=1 )cc
  171. </if>
  172. <if test="shzt != null and shzt =='91000079'.toString() ">
  173. (select * from ty_jycc where ccbm not in(select ccbm from ty_jybm
  174. ) and zt=0 ) cc
  175. </if>
  176. <if test="shztList == null and shzt == ''">
  177. ty_jycc cc
  178. </if>
  179. <if test="shztList != null and shzt != '' and shzt != '1'">
  180. ty_jycc cc
  181. </if>
  182. join ty_jycrkwt wt on cc.wtbm = wt.wtbm
  183. <if test="apcc != null and apcc != ''">
  184. and cc.apcc like '%'||#{apcc}||'%'
  185. </if>
  186. <if test="shztList == null and shzt!=null and shzt == ''">
  187. left join ty_jybm bm on cc.ccbm = bm.ccbm and cc.cczt='已发布'
  188. </if>
  189. <if test="shztList == null and shzt!=null and shzt == '1'.toString()">
  190. left join ty_jybm bm on cc.ccbm = bm.ccbm and cc.cczt='已发布'
  191. </if>
  192. <if test="shztList == null and shzt!=null and shzt == '91000079'.toString()">
  193. left join ty_jybm bm on cc.ccbm = bm.ccbm and cc.cczt='已发布'
  194. </if>
  195. <if test="shztList != null">
  196. join ty_jybm bm on cc.ccbm = bm.ccbm and cc.cczt='已发布'
  197. </if>
  198. <if test="shztList != null">
  199. and bm.shzt in
  200. <foreach collection="shztList" index="index" item="item" open="(" separator="," close=")">
  201. #{item}
  202. </foreach>
  203. </if>
  204. <if test="dwmc != null and dwmc != ''">
  205. and bm.dwmc like '%'||#{dwmc}||'%'
  206. </if>
  207. <if test="dwbm != null and dwbm != ''">
  208. and bm.dwbm =#{dwbm}
  209. </if>
  210. <if test="shsjStart != null">
  211. and bm.shsj &gt;= #{shsjStart}
  212. </if>
  213. <if test="shsjEnd != null">
  214. and bm.shsj &lt;= #{shsjEnd}
  215. </if>
  216. order by bm.jybm desc) ts
  217. <where>
  218. <if test="bmrqStart != null">
  219. and ts.bmrq &gt;= #{bmrqStart}
  220. </if>
  221. <if test="bmrqEnd != null">
  222. and ts.bmrq &lt;= #{bmrqEnd}
  223. </if>
  224. </where>
  225. order by ccbm desc
  226. </select>
  227. <select id="selectDetail" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO" parameterType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  228. SELECT
  229. <include refid="transaction" />
  230. FROM ty_jycc cc
  231. left join ty_jycrkwt wt on cc.wtbm = wt.wtbm
  232. left join ty_jybm bm on cc.ccbm = bm.ccbm
  233. and cc.cczt='已发布'
  234. and cc.ccbm=#{value}
  235. </select>
  236. <insert id="insertTransactionSignUp">
  237. INSERT INTO ty_jybm(
  238. jybm,bdbm,bdh,apcc,sl,je,lsxz,lsxzmc,lslb,lslbmc,dwbm,dwmc,lxdh,bzj,sxfl,bmrq,fjid,spr,shzt,shztmc,shyj,shsj,hkje,hksj,hkdwbm,hkdwmc,hkpz,skzt,skztmc,tkzt,tkztmc,remark,lspzbm,lspzmc)
  239. VALUES (
  240. #{jybm},#{bdbm},#{bdh},#{apcc},#{sl},#{je},#{lsxz},#{lsxzmc},#{lslb},#{lslbmc},#{dwbm},#{dwmc},#{lxdh},#{bzj},#{sxfl},#{bmrq},#{fjid},#{spr},#{shzt},#{shztmc},#{shyj},#{shsj},#{hkje},#{hksj},#{hkdwbm},#{hkdwmc},#{hkpz},#{skzt},#{skztmc},#{tkzt},#{tkztmc},#{remark},#{lspzbm},#{lspzmc})
  241. </insert>
  242. <update id="updateTransactionSignUp">
  243. UPDATE ty_jybm SET
  244. jybm = #{jybm},bdbm = #{bdbm},bdh = #{bdh},apcc = #{apcc},sl = #{sl},je = #{je},lsxz = #{lsxz},lsxzmc = #{lsxzmc},lslb = #{lslb},lslbmc = #{lslbmc},dwbm = #{dwbm},dwmc = #{dwmc},lxdh = #{lxdh},bzj = #{bzj},sxfl = #{sxfl},bmrq = #{bmrq},fjid = #{fjid},spr = #{spr},shzt = #{shzt},shztmc = #{shztmc},shyj = #{shyj},shsj = #{shsj},hkje = #{hkje},hksj = #{hksj},hkdwbm = #{hkdwbm},hkdwmc = #{hkdwmc},hkpz = #{hkpz},skzt = #{skzt},skztmc = #{skztmc},tkzt = #{tkzt},tkztmc = #{tkztmc},remark = #{remark},lspzbm = #{lspzbm},lspzmc = #{lspzmc}
  245. WHERE jybm = #{jybm}
  246. </update>
  247. <update id="deleteTransactionSignUp">
  248. DELETE FROM ty_jybm
  249. WHERE jybm = #{jybm}
  250. </update>
  251. <select id="selectSceneList" resultType="com.unis.transaction.common.vo.signuppay.SceneVO">
  252. select
  253. bd.bdbm,
  254. bd.sl,
  255. ap.pzbm,
  256. ap.pzmc,
  257. bd.apcc
  258. from
  259. ty_jybd bd
  260. join ty_jycrkap ap on bd.apbm = ap.apbm
  261. left join ty_jybm bm on bm.apcc = bd.apcc and bm.status=1
  262. where bm.apcc is null
  263. </select>
  264. <select id="selectListNotInGiveBackBail" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  265. select apcc,ccbm from ty_jybm
  266. <where>
  267. jybm in (select jybm from ty_jybzjtk where tkfl ='0' ) and wtfbm = #{dwbm}
  268. <if test="htList != null">
  269. and ccbm in (
  270. select ccbm from ty_jybd where bdh in (select bdh from ty_jyht
  271. where htbm not in
  272. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  273. #{item}
  274. </foreach>
  275. )
  276. )
  277. </if>
  278. </where>
  279. order by ccbm desc
  280. </select>
  281. <select id="selectTransByCcbm" resultType="com.unis.transaction.server.entity.signuppay.TransactionSignUpDO">
  282. select * from ty_jybm ty where ty.ccbm=#{ccbm} and ty.creator_code = #{userId}
  283. </select>
  284. <select id="selectTransactionSignUpList" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  285. SELECT
  286. <include refid="transaction" />
  287. FROM (select * from ty_jycc where ccbm not in(select ccbm from ty_jybm) and zt =1) cc
  288. join ty_jycrkwt wt on cc.wtbm = wt.wtbm
  289. left join ty_jybm bm on cc.ccbm = bm.ccbm and cc.cczt='已发布'
  290. </select>
  291. <select id="selectListByCC" resultType="com.unis.transaction.server.entity.signuppay.TransactionSignUpDO"
  292. parameterType="java.lang.String">
  293. select jybm,dwbm,dwmc from ty_jybm where ccbm = #{value}
  294. </select>
  295. <select id="selectLists" resultType="com.unis.transaction.server.entity.signuppay.TransactionSignUpDO">
  296. SELECT
  297. DISTINCT dwbm,dwmc
  298. FROM ty_jybm where dwbm is not null
  299. </select>
  300. <select id="selectByDwbmAndCcbm" resultType="com.unis.transaction.server.entity.signuppay.TransactionSignUpDO">
  301. select * from ty_jybm where dwmc = #{dwmc} and ccbm = #{ccbm}
  302. </select>
  303. <select id="selectDwbmList" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  304. select DISTINCT dwbm,dwmc from ty_jybm where shzt = #{shzt} and ccbm = #{ccbm}
  305. </select>
  306. <select id="selectSiteAll" resultType="com.unis.transaction.server.entity.signuppay.TransactionSignUpDO">
  307. select distinct apcc,ccbm from ty_jybm
  308. where
  309. ccbm in
  310. (select ccbm from ty_jybd where bdbm in
  311. (select bdbm from ty_jyht where (sgdw=#{dwbm} or cmdw = #{dwbm})
  312. <if test="htList != null">
  313. and htbm not in
  314. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  315. #{item}
  316. </foreach>
  317. </if>
  318. )) order by ccbm desc
  319. </select>
  320. <select id="selectTranPageList" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  321. select * from ty_jybm
  322. <where>
  323. <if test="wtfbm != null and wtfbm !=''">
  324. and wtfbm = #{wtfbm}
  325. </if>
  326. <if test="dwbm != null and dwbm !=''">
  327. and dwbm = #{dwbm}
  328. </if>
  329. <if test="shzt != null and shzt !=''">
  330. and shzt = #{shzt}
  331. </if>
  332. <if test="apcc != null and apcc !=''">
  333. and apcc like '%'||#{apcc}||'%'
  334. </if>
  335. <if test="bmrqEnd != null">
  336. and bmrq &lt;= #{bmrqEnd}
  337. </if>
  338. <if test="bmrqStart != null">
  339. and bmrq &gt;= #{bmrqStart}
  340. </if>
  341. </where>
  342. order by jyrq desc, to_date(jysj, 'hh24:mi') desc
  343. </select>
  344. <select id="selectSiteAllNotice"
  345. resultType="com.unis.transaction.server.entity.signuppay.TransactionSignUpDO">
  346. select distinct apcc,ccbm from ty_jybm where ccbm in
  347. (select ccbm from ty_jybd where bdbm in
  348. (select bdbm from ty_jyht where htbm not in (select htbm from ty_jytkwth
  349. where zt &lt;&gt; #{zt})
  350. )) order by ccbm desc
  351. </select>
  352. <select id="selectSkztList" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  353. select DISTINCT dwbm,dwmc from ty_jybm where skzt = #{skzt} and ccbm = #{ccbm}
  354. </select>
  355. <select id="selectSkztListNew" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  356. select DISTINCT dwbm,dwmc from ty_jybm
  357. <where>
  358. <if test="skzt != null">
  359. and skzt = #{skzt}
  360. </if>
  361. <if test="ccbm != null and ccbm !=''">
  362. and ccbm = #{ccbm}
  363. </if>
  364. <if test="bdh != null and bdh !=''">
  365. and yxbd like '%' || #{bdh} || '%'
  366. </if>
  367. </where>
  368. </select>
  369. <select id="getGqsj" resultType="java.lang.String">
  370. select first 1 gqsj from ty_jybzjtk where ccbm = #{value}
  371. </select>
  372. <update id="updateSignUpTkzt">
  373. UPDATE ty_jybm SET
  374. tkzt = #{tkzt},tkztmc = #{tkztmc}
  375. WHERE apcc = #{apcc}
  376. </update>
  377. <select id="getSignUpBeforeDataCcbm" resultType="com.unis.transaction.common.vo.signuppay.TransactionSignUpVO">
  378. select
  379. wt.wtbm,
  380. wt.wtbh,
  381. wt.jyfx,
  382. wt.jyfxmc,
  383. wt.jyfs,
  384. wt.jyfsmc,
  385. cc.ccbm,
  386. cc.apcc,
  387. cc.jyrq as jyrq,
  388. cc.jysj,
  389. cc.jybzj,
  390. cc.lybzj
  391. from ty_jycc cc
  392. left join ty_jycrkwt wt on cc.wtbm = wt.wtbm
  393. where cc.ccbm = #{ccbm}
  394. </select>
  395. <select id="selectdwbmByTyshxydm" resultType="java.lang.String">
  396. select qy.qyjgdm from base:tz_slqy qy where qy.tyshxydm=#{tyshxydm}
  397. </select>
  398. </mapper>