TradeMarkMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  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.TradeMarkDao">
  4. <sql id="traderuleColumns">
  5. bd.bdbm as bdbm,
  6. bd.bdh as bdh,
  7. bd.apbm as apbm
  8. </sql>
  9. <sql id="siteColumns">
  10. wt.wtbh as wtbh,
  11. wt.wtbm as wtbm,
  12. wt.jyrq as jyrq,
  13. wt.pzmc as pz,
  14. cc.ccbm as ccbm,
  15. cc.wczt as wczt,
  16. cc.sl as sl,
  17. cc.jyxz as jyxz,
  18. cc.apcc as apcc,
  19. cc.jybzj as jybzj,
  20. cc.lybzj as lybzj,
  21. cc.cczt as cczt,
  22. wt.wtfmc,
  23. wt.jyfs,
  24. wt.jyfsmc,
  25. wt.jyfx,
  26. wt.jyfxmc,
  27. wt.fbzt,
  28. wt.fbztmc,
  29. wt.apzt,
  30. wt.apztmc,
  31. cc.jysj
  32. </sql>
  33. <sql id="markColumns">
  34. ap.wtbm as wtbm,
  35. ap.ztmc as ztmc,
  36. ap.apbm as apbm,
  37. ap.jylx as jylx,
  38. ap.dwmc as dwmc,
  39. ap.ccdd as ccdd,
  40. ap.pzmc as pzmc,
  41. ap.lssl as lssl,
  42. ap.scnd as scnd,
  43. bd.bdh as bdh,
  44. bd.bdbm as bdbm,
  45. bd.status as status
  46. </sql>
  47. <sql id="wtColumns">
  48. wt.wtbh as wtbh,
  49. wt.wtbm as wtbm
  50. </sql>
  51. <sql id="traderuleJoins">
  52. </sql>
  53. <sql id="jyht_colums">
  54. htbm, htbh, shbh, bdh, bdbm, cmmc, sgmc, qddd, status,
  55. dj, je, jylx, lssl, cdkmc, cckmc, fddbr, pzmc, mtel, sgtel,
  56. wtdlr, khyh, khzh, zh, yzbm, sgbm, cjrq, creator,
  57. creator_code, refresher, refresher_code, refresh_time,
  58. remark, create_date, sgdw, pdfs, lsdj, cmdw, adress,
  59. njhck, nmfcck, nch, nnf, nsflt, nqydj, nzcjl, nckjzrq,
  60. ncfbm, nmfbm, nbz, nqpj, fsdw
  61. </sql>
  62. <update id="updateBytrade">
  63. UPDATE ty_jybd
  64. <set>
  65. <if test="status != null and status != ''">
  66. status = #{status},
  67. </if>
  68. <if test="refresher != null and refresher != ''">
  69. refresher = #{refresher},
  70. </if>
  71. <if test="refresherCode != null and refresherCode != ''">
  72. refresher_code = #{refresherCode},
  73. </if>
  74. <if test="refreshTime != null">
  75. refresh_time = #{refreshTime},
  76. </if>
  77. <if test="apbm != null and apbm != ''">
  78. apbm = #{apbm},
  79. </if>
  80. <if test="wtbm != null and wtbm != ''">
  81. wtbm = #{wtbm},
  82. </if>
  83. <if test="bdh != null and bdh != ''">
  84. bdh = #{bdh},
  85. </if>
  86. <if test="sl != null and sl != ''">
  87. sl = #{sl},
  88. </if>
  89. <if test="qbj != null">
  90. qbj = #{qbj},
  91. </if>
  92. <if test="sgkdbm != null and sgkdbm != ''">
  93. sgkdbm = #{sgkdbm},
  94. </if>
  95. <if test="sgkdmc != null and sgkdmc != ''">
  96. sgkdmc = #{sgkdmc},
  97. </if>
  98. <if test="cckdbm != null and cckdbm != ''">
  99. cckdbm = #{cckdbm},
  100. </if>
  101. <if test="cckdmc != null and cckdmc != ''">
  102. cckdmc = #{cckdmc},
  103. </if>
  104. <if test="qydj != null and qydj != ''">
  105. qydj = #{qydj}
  106. </if>
  107. </set>
  108. where bdbm = #{bdbm}
  109. </update>
  110. <delete id="deleteTradeMarkSite" parameterType="java.lang.String">
  111. delete from ty_jybd where wtbm=#{wtbm} and ccbm is null
  112. </delete>
  113. <select id="findByBdh" resultType="com.unis.transaction.common.vo.tradeplan.TradeMarkVO"
  114. parameterType="java.lang.String">
  115. SELECT
  116. <include refid="traderuleColumns" />
  117. FROM ty_jybd bd <include refid="traderuleJoins" />
  118. <where>
  119. and bd.bdh like '%' || #{value} || '%'
  120. </where>
  121. </select>
  122. <select id="findByApbm" resultType="com.unis.transaction.common.vo.tradeplan.TradeMarkVO" parameterType="java.lang.String">
  123. SELECT
  124. <include refid="traderuleColumns" />
  125. FROM ty_jybd bd <include refid="traderuleJoins" />
  126. <where>
  127. and bd.apbm =#{value}
  128. </where>
  129. </select>
  130. <select id="selectPageList" resultType="com.unis.transaction.common.vo.tradeplan.SiteVO" parameterType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  131. SELECT
  132. <include refid="siteColumns" />
  133. FROM ty_jycc cc
  134. left join ty_jycrkwt wt on cc.wtbm = wt.wtbm
  135. <trim prefix="where" prefixOverrides = "and|or">
  136. <if test="apcc != null and apcc != ''">
  137. and instr(cc.apcc, #{apcc}) > 0
  138. </if>
  139. <if test="cczt != null and cczt != ''">
  140. and cc.cczt = #{cczt}
  141. </if>
  142. <if test="jylx != null and jylx != ''">
  143. and wt.jylx = #{jylx}
  144. </if>
  145. <if test="wtbh != null and wtbh != ''">
  146. and instr(cc.wtbh, #{wtbh}) > 0
  147. </if>
  148. <if test="jyfx != null and jyfx != ''">
  149. and cc.jyfx = #{jyfx}
  150. </if>
  151. <if test="jyfs != null and jyfs != ''">
  152. and cc.jyfs = #{jyfs}
  153. </if>
  154. <if test="wtfmc != null and wtfmc != ''">
  155. and instr(cc.wtfmc, #{wtfmc}) > 0
  156. </if>
  157. <if test="jyrq != null">
  158. and cc.jyrq = to_date(#{jyrq}, 'yyyy-mm-dd')
  159. </if>
  160. <if test="fbzt != null">
  161. and wt.fbzt = #{fbzt}
  162. </if>
  163. <if test="wtfbm != null and wtfbm != 'LS001020'">
  164. and wt.wtfbm = #{wtfbm}
  165. </if>
  166. <if test="apzt != null and apzt != ''">
  167. and wt.apzt = #{apzt}
  168. </if>
  169. <choose>
  170. <when test="pageType != null and pageType == 1">
  171. </when>
  172. <when test="pageType != null and pageType == 2">
  173. <if test="wtfbm != null and wtfbm == 'LS001020'">
  174. and wt.apzt = '91000600'
  175. </if>
  176. </when>
  177. <when test="pageType != null and pageType == 3">
  178. and cc.cczt = '已发布'
  179. </when>
  180. </choose>
  181. </trim>
  182. order by cc.ccbm desc
  183. </select>
  184. <select id="selectCode" resultType="java.lang.Integer">
  185. select max(cccode) from ty_jycc
  186. </select>
  187. <select id="valiCode" resultType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  188. select * from ty_jycc<include refid="traderuleJoins" />
  189. <where>
  190. <if test="cccode!=null and cccode != ''">
  191. and cccode = #{cccode}
  192. </if>
  193. <if test="ccbm!=null and ccbm != ''">
  194. and ccbm &lt;&gt; #{ccbm}
  195. </if>
  196. </where>
  197. </select>
  198. <select id="selectListBySite" resultType="com.unis.transaction.server.entity.tradeplan.EntryAndExitOrderDO">
  199. select <include refid="wtColumns" />
  200. FROM ty_jycrkwt wt where zt = '91000600'
  201. and wt.wtbm not in (select wtbm from ty_jycc where cczt = '已发布')
  202. order by wt.wtbh desc
  203. </select>
  204. <select id="selectPage" resultType="com.unis.transaction.common.vo.tradeplan.WarehousingArrangementVO">
  205. SELECT
  206. <include refid="markColumns" />
  207. FROM ty_jybd bd,ty_jycrkap ap<include refid="traderuleJoins" />
  208. <where>
  209. and bd.apbm = ap.apbm
  210. <if test="dwmc != null and dwmc != ''">
  211. and ap.dwmc like '%' || #{dwmc} || '%'
  212. </if>
  213. <if test="pzbm != null and pzbm != ''">
  214. and ap.pzbm = #{pzbm}
  215. </if>
  216. <if test="jylx != null">
  217. and ap.jylx = #{jylx}
  218. </if>
  219. <if test="wtfbm != null and wtfbm != ''">
  220. and ap.wtfbm = #{wtfbm}
  221. </if>
  222. <!-- <if test="wtfbm != null and wtfbm != ''">
  223. and ap.wtfbm like '%' || #{wtfbm} || '%'
  224. </if>-->
  225. <if test="status != null">
  226. and bd.status = #{status}
  227. </if>
  228. <if test="zt != null and zt != ''">
  229. and ap.zt = #{zt}
  230. </if>
  231. </where>
  232. order by bd.bdbm desc
  233. </select>
  234. <select id="selectContractPage" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
  235. select ht.*,
  236. decode(ht.jyfx, '0', '采购', '1', '销售', '0,1', '采购,销售', '') jyfxmc,
  237. decode(ht.jyfs, '0', '竞价', '1', '挂牌', '2', '购销双向', '') jyfsmc
  238. from ty_jyht ht
  239. <where>
  240. <if test="pzList">
  241. and ht.pzmc in
  242. <foreach collection="pzList" item="item" open="(" close=")" separator=",">
  243. #{item}
  244. </foreach>
  245. </if>
  246. <if test="startDate != null">
  247. and ht.cjrq &gt;= #{startDate}
  248. </if>
  249. <if test="endDate != null">
  250. and ht.cjrq &lt;= #{endDate}
  251. </if>
  252. <if test="cmmc != null and cmmc != ''">
  253. and instr(decode(ht.jylx, 0, ht.sgmc, 1, ht.cmmc), #{cmmc}) > 0
  254. </if>
  255. <if test="sgmc != null and sgmc != ''">
  256. and instr(decode(ht.jylx, 0, ht.cmmc, 1, ht.sgmc), #{sgmc}) > 0
  257. </if>
  258. <if test="pzmc != null and pzmc != ''">
  259. and instr(ht.pzmc, #{pzmc}) > 0
  260. </if>
  261. <if test="htbh != null and htbh != ''">
  262. and ht.htbh like '%' || #{htbh} || '%'
  263. </if>
  264. <if test="apcc != null and apcc != ''">
  265. and instr(ht.apcc, #{apcc}) > 0
  266. </if>
  267. <if test="fsdw != null and fsdw != ''">
  268. and fsdw = #{fsdw, jdbcType=VARCHAR}
  269. </if>
  270. </where>
  271. order by ht.create_date desc
  272. </select>
  273. <select id="selectTradeMarkAll" resultType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  274. select cc.apcc, cc.ccbm, cc.wtbm, cc.wtfmc, cc.wtfbm, cc.jyfx, cc.jyfs,cc.jybzj,cc.lybzj,cc.sxfl,
  275. cc.jyrq,
  276. decode(t1.lsxzbm, '1','121', '3', '121', '2', '122') lsxz
  277. from ty_jycc cc
  278. left join ty_jycrkwt t1 on t1.wtbm = cc.wtbm
  279. where cc.cczt = '已发布'
  280. -- and (select count(1) from ty_jybm bm where cc.ccbm = bm.ccbm and bm.shzt in ('91000003', '91000060')) > 0
  281. -- and cc.jyrq > ADD_MONTHS(today, -1)
  282. order by cc.jyrq desc, to_date(cc.jysj, 'hh24:mi') desc
  283. </select>
  284. <select id="selectContractList" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO" parameterType="java.lang.String">
  285. select ht.htbm,ht.htbh,ht.bdbm,ht.lssl from ty_jyht ht
  286. <where>
  287. <if test="ccbm!=null and ccbm!=''">
  288. and ht.bdbm in (select bd.bdbm from ty_jybd bd where bd.ccbm = #{ccbm})
  289. </if>
  290. <if test="dwbm!=null and dwbm!=''">
  291. and ht.sgdw = #{dwbm}
  292. </if>
  293. </where>
  294. </select>
  295. <select id="selectwarehousingArrangementByWtbm" resultType="com.unis.transaction.common.vo.tradeplan.WarehousingArrangementVO">
  296. select dwbm from ty_jycrkap where wtbm=#{value} and zt is not null
  297. </select>
  298. <select id="selectTradeMarkByBdh" resultType="com.unis.transaction.server.entity.tradeplan.TradeMarkDO">
  299. select bd.bdbm,bd.bdh from ty_jybd bd where bd.wtbm in (select tk.wtbm from ty_jybzjtk tk where tk.tkfl is
  300. null) and bd.bdh not in (select bdh from ty_jyht) and bd.bdh = #{value}
  301. </select>
  302. <select id="selectPrimaryByBdh" resultType="com.unis.transaction.server.entity.tradeplan.TradeMarkDO">
  303. select * from ty_jybd bd where bd.bdh = #{value}
  304. </select>
  305. <select id="selectByBdh" resultType="com.unis.transaction.common.vo.tradeplan.TradeMarkVO">
  306. select bd.bdbm,bd.bdh,bd.apbm from ty_jybd bd where bd.bdh = #{value}
  307. </select>
  308. <select id="selectSiteByBdbm" resultType="com.unis.transaction.server.entity.tradeplan.SiteDO">
  309. select * from ty_jycc where ccbm =(select ccbm from ty_jybd where bdbm =#{value})
  310. </select>
  311. <select id="selectDwbmList" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO" parameterType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  312. select cmmc,cmdw from ty_jyht
  313. <where>
  314. <if test="ccbm!=null and ccbm!=''">
  315. and bdh in (select bdh from ty_jybd where ccbm = #{ccbm})
  316. </if>
  317. <if test="htList!=null">
  318. and htbm not in
  319. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  320. #{item}
  321. </foreach>
  322. </if>
  323. </where>
  324. </select>
  325. <select id="selectDwbmLists" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO" parameterType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  326. select sgmc,sgdw from ty_jyht
  327. <where>
  328. <if test="ccbm!=null and ccbm!=''">
  329. and bdh in (select bdh from ty_jybd where ccbm = #{ccbm})
  330. </if>
  331. <if test="htList!=null">
  332. and htbm not in
  333. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  334. #{item}
  335. </foreach>
  336. </if>
  337. </where>
  338. </select>
  339. <select id="selectContractByDwbm" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
  340. select ht.*,
  341. nvl(ht.shcnf, ht.nnf) shcnf,
  342. nvl(ht.nch, ap.ccdd) as nch,
  343. nvl(ht.ncfbm, ap.cfbm) as ncfbm
  344. from ty_jyht ht
  345. left join ty_jybd bd on bd.bdbm = ht.bdbm
  346. left join ty_jycrkap ap on bd.apbm = ap.apbm
  347. <where>
  348. <if test="ccbm!=null and ccbm!=''">
  349. and ht.bdh in (select bdh from ty_jybd where ccbm = #{ccbm})
  350. </if>
  351. <if test="dwbm!=null and dwbm!=''">
  352. and ht.cmdw = #{dwbm}
  353. </if>
  354. <if test="jylx!=null and jylx!=''">
  355. and ht.jylx = #{jylx}
  356. </if>
  357. <if test="htList!=null">
  358. and ht.htbm not in
  359. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  360. #{item}
  361. </foreach>
  362. </if>
  363. </where>
  364. </select>
  365. <select id="selectContractByDwbms" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
  366. select * from ty_jyht
  367. <where>
  368. <if test="ccbm!=null and ccbm!=''">
  369. and bdh in (select bdh from ty_jybd where ccbm = #{ccbm})
  370. </if>
  371. <if test="dwbm!=null and dwbm!=''">
  372. and sgdw = #{dwbm}
  373. </if>
  374. <if test="htList!=null">
  375. and htbm not in
  376. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  377. #{item}
  378. </foreach>
  379. </if>
  380. </where>
  381. </select>
  382. <select id="selectContracts" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
  383. select htbm,htbh from ty_jyht
  384. <where>
  385. <if test="ccbm!=null and ccbm!=''">
  386. and bdh in (select bdh from ty_jybd where ccbm = #{ccbm})
  387. </if>
  388. <if test="dwbm!=null and dwbm!=''">
  389. and sgdw = #{dwbm}
  390. </if>
  391. <if test="zt!=null ">
  392. and htbm not in (select htbm from ty_jytkwth where zt &lt;&gt; #{zt})
  393. </if>
  394. </where>
  395. union
  396. select htbm,htbh from ty_jyht
  397. <where>
  398. <if test="ccbm!=null and ccbm!=''">
  399. and bdh in (select bdh from ty_jybd where ccbm = #{ccbm})
  400. </if>
  401. <if test="dwbm!=null and dwbm!=''">
  402. and cmdw = #{dwbm}
  403. </if>
  404. <if test="zt!=null ">
  405. and htbm not in (select htbm from ty_jytkwth where zt &lt;&gt; #{zt})
  406. </if>
  407. </where>
  408. </select>
  409. <select id="selectContractNotice" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
  410. select htbm,htbh from ty_jyht
  411. <where>
  412. <if test="ccbm!=null and ccbm!=''">
  413. and bdh in (select bdh from ty_jybd where ccbm = #{ccbm})
  414. </if>
  415. <if test="zt!=null ">
  416. and htbm not in (select htbm from ty_jytkwth where zt &lt;&gt; #{zt})
  417. </if>
  418. </where>
  419. </select>
  420. <select id="selectListByCcbm" resultType="com.unis.transaction.server.entity.tradeplan.TradeMarkDO">
  421. select ap.bdh, ap.bdbm
  422. from ty_jycrkap ap
  423. left join ty_jycc cc on cc.wtbm = ap.wtbm
  424. where cc.cczt = '已发布' and cc.ccbm = #{value}
  425. </select>
  426. <select id="selectByEntity" resultType="com.unis.transaction.server.entity.tradeplan.WarehousingArrangementDO" parameterType="com.unis.transaction.server.entity.tradeplan.WarehousingArrangementDO">
  427. select dwbm,dwmc,pzbm,pzmc,scnd from ty_jycrkap
  428. <where>
  429. <if test="wtbm!=null and wtbm!=''">
  430. and wtbm = #{wtbm}
  431. </if>
  432. <if test="sjlx!=null ">
  433. and sjlx = #{sjlx}
  434. </if>
  435. </where>
  436. </select>
  437. <select id="getDj" resultType="java.lang.Double">
  438. select min(qbj) from ty_jybd where ccbm = #{ccbm}
  439. </select>
  440. <select id="getCjsl" resultType="java.lang.String" parameterType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  441. select sum(ht.lssl) from ty_jyht ht where
  442. <if test="htList!=null">
  443. ht.bdbm in
  444. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  445. #{item}
  446. </foreach>
  447. </if>
  448. </select>
  449. <select id="getZdcjj" resultType="java.lang.String" parameterType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  450. select min(ht.dj) from ty_jyht ht where
  451. <if test="htList!=null">
  452. ht.bdbm in
  453. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  454. #{item}
  455. </foreach>
  456. </if>
  457. </select>
  458. <select id="getZgcjj" resultType="java.lang.String" parameterType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  459. select max(ht.dj) from ty_jyht ht where
  460. <if test="htList!=null">
  461. ht.bdbm in
  462. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  463. #{item}
  464. </foreach>
  465. </if>
  466. </select>
  467. <select id="getCjje" resultType="java.lang.String" parameterType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  468. select sum(ht.je) from ty_jyht ht where
  469. <if test="htList!=null">
  470. ht.bdbm in
  471. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  472. #{item}
  473. </foreach>
  474. </if>
  475. </select>
  476. <select id="selectContractByBdh" resultType="com.unis.transaction.server.entity.tradeplan.ContractDO">
  477. select * from ty_jyht ht where
  478. <if test="htList!=null">
  479. ht.bdbm in
  480. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  481. #{item}
  482. </foreach>
  483. </if>
  484. </select>
  485. <select id="selectContractByCmmc" resultType="com.unis.transaction.server.entity.tradeplan.ContractDO">
  486. select * from ty_jyht ht where
  487. <if test="htList!=null">
  488. ht.bdbm in
  489. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  490. #{item}
  491. </foreach>
  492. </if>
  493. order by cmmc
  494. </select>
  495. <select id="selectContractBySgmc" resultType="com.unis.transaction.server.entity.tradeplan.ContractDO">
  496. select * from ty_jyht ht where
  497. <if test="htList!=null">
  498. ht.bdbm in
  499. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  500. #{item}
  501. </foreach>
  502. </if>
  503. order by sgmc
  504. </select>
  505. <select id="selectContractByZt" resultType="com.unis.transaction.common.vo.tradeplan.SiteVO">
  506. select * from ty_jycc cc where cc.wczt = #{value}
  507. </select>
  508. <select id="selectContractLists" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
  509. select ht.htbm,ht.htbh,ht.bdbm,ht.lssl from ty_jyht ht
  510. <where>
  511. <if test="ccbm!=null and ccbm!=''">
  512. and ht.bdbm in (select bd.bdbm from ty_jybd bd where bd.ccbm = #{ccbm})
  513. </if>
  514. <if test="dwbm!=null and dwbm!=''">
  515. and ht.cmdw = #{dwbm}
  516. </if>
  517. </where>
  518. </select>
  519. <select id="getTotalSum" resultType="java.lang.String">
  520. select sum(ht.lssl) from ty_jyht ht
  521. <where>
  522. <if test="ccbm!=null and ccbm!=''">
  523. and ht.bdbm in (select bd.bdbm from ty_jybd bd where bd.ccbm = #{ccbm})
  524. </if>
  525. <if test="dwbm!=null and dwbm!=''">
  526. ht.cmdw = #{dwbm}
  527. </if>
  528. </where>
  529. </select>
  530. <select id="getTotalSums" resultType="java.lang.String">
  531. select sum(ht.lssl) from ty_jyht ht
  532. <where>
  533. <if test="ccbm!=null and ccbm!=''">
  534. and ht.bdbm in (select bd.bdbm from ty_jybd bd where bd.ccbm = #{ccbm})
  535. </if>
  536. <if test="dwbm!=null and dwbm!=''">
  537. and ht.sgdw = #{dwbm}
  538. </if>
  539. </where>
  540. </select>
  541. <select id="selectTkdwList" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
  542. select * from ty_jyht where bdbm in (select bdbm from ty_jybd where wtbm in (select wtbm from ty_jycrkwt
  543. where wtfbm = #{dwbm}))
  544. <if test="htList!=null">
  545. and htbm not in
  546. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  547. #{item}
  548. </foreach>
  549. </if>
  550. </select>
  551. <select id="selectTkdwHtList" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
  552. select htbm,htbh from (select * from ty_jyht where sgdw= #{wtbm} or cmdw = #{wtbm}) ht where bdbm in
  553. (select bdbm from ty_jybd where wtbm in (select wtbm from ty_jycrkwt where wtfbm = #{dwbm}))
  554. <if test="htList!=null">
  555. and htbm not in
  556. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  557. #{item}
  558. </foreach>
  559. </if>
  560. </select>
  561. <select id="selectOrgCode" resultType="java.lang.String">
  562. select qyjgdm from base:tz_slqy where zzjgdm =#{value}
  563. </select>
  564. <select id="selectContractHtByDwbm" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
  565. select * from ty_jyht
  566. <where>
  567. <if test="ccbm!=null and ccbm!=''">
  568. and bdh in (select bdh from ty_jybd where ccbm = #{ccbm})
  569. </if>
  570. <if test="dwbm!=null and dwbm!=''">
  571. and (cckdm = #{dwbm} or fsdw = #{dwbm})
  572. </if>
  573. <if test="jylx!=null and jylx!=''">
  574. and jylx = #{jylx}
  575. </if>
  576. <if test="htList!=null">
  577. and htbm not in
  578. <foreach collection="htList" index="index" item="item" open="(" separator="," close=")">
  579. #{item}
  580. </foreach>
  581. </if>
  582. <if test="dwList!=null">
  583. and (
  584. cckdm in
  585. <foreach collection="dwList" index="index" item="item" open="(" separator="," close=")">
  586. #{item}
  587. </foreach>
  588. or fsdw in
  589. <foreach collection="dwList" index="index" item="item" open="(" separator="," close=")">
  590. #{item}
  591. </foreach>
  592. )
  593. </if>
  594. </where>
  595. </select>
  596. <select id="selectGxgsList" resultType="java.lang.String">
  597. select org_code FROM usercenter:sys_orgainze where state_code='1'
  598. start with org_code = #{value}
  599. connect by prior org_code = parent_Code
  600. order by org_code
  601. </select>
  602. <select id="getKqdmByQyjgdm" resultType="java.lang.String">
  603. select
  604. kd.kqdm
  605. from base:d_kdxxsjy kd
  606. where kd.tyshxydm=
  607. (select
  608. qy.tyshxydm
  609. from base:tz_slqy qy
  610. where qyjgdm=#{cckdm})
  611. </select>
  612. </mapper>