GiveBackMapper.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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.GiveBackDao">
  4. <sql id="givebackColumns">
  5. tkbm,jybm,wthbm,apcc,tkje,tksj,czr,tkpz,tkzt,tkztmc,remark,wtbm
  6. </sql>
  7. <sql id="givebackJoins">
  8. </sql>
  9. <select id="selectList" resultType="com.unis.transaction.server.entity.givebackbail.GiveBackDO" parameterType="com.unis.transaction.common.vo.givebackbail.GiveBackVO">
  10. SELECT
  11. *
  12. FROM ty_jybzjtk <include refid="givebackJoins" />
  13. <where>
  14. <if test="htbm != null and htbm != ''">
  15. and htbm like '%' || #{htbm} || '%'
  16. </if>
  17. <if test="ccbm != null and ccbm != ''">
  18. and ccbm = #{ccbm}
  19. </if>
  20. <if test="tkfl != null and tkfl != ''">
  21. and tkfl = #{tkfl}
  22. </if>
  23. </where>
  24. </select>
  25. <!--
  26. <select id="selectPageList" resultType="com.unis.transaction.common.vo.givebackbail.GiveBackVO" parameterType="com.unis.transaction.common.vo.givebackbail.GiveBackVO">
  27. select
  28. jybm.jybm,
  29. jybm.apcc,
  30. jybm.sl,
  31. jybm.je,
  32. jybm.dwmc,
  33. jybm.lxdh,
  34. jybm.bmrq,
  35. jybm.hkje,
  36. jybm.hksj,
  37. jybm.ccbm,
  38. jybm.remark,
  39. jybm.bzj,
  40. jybm.bmrq,
  41. jybm.wtbm,
  42. jybm.lspzmc,
  43. tk.wthbm,
  44. tk.tkbm,
  45. tk.tkfl,
  46. tk.tkzt,
  47. tk.tkztmc,
  48. tk.tksj
  49. from
  50. ty_jybzjtk tk
  51. join ty_jybm jybm on jybm.jybm = tk.jybm and jybm.status = 1
  52. left join ty_jytkwth tkwth on tkwth.apcc=jybm.apcc and tkwth.status = 1
  53. <where>
  54. and (tk.status = 1 or tk.status is null)
  55. <if test="apcc != null and apcc != ''">
  56. and jybm.apcc like '%' || #{apcc} || '%'
  57. </if>
  58. <if test="dwmc != null and dwmc != ''">
  59. and jybm.dwmc like '%' || #{dwmc} || '%'
  60. </if>
  61. <if test="hksjQuerystart != null">
  62. and jybm.hksj &gt;= #{hksjQuerystart}
  63. </if>
  64. <if test="htbm != null and htbm != ''">
  65. and tkwth.htbm like '%' || #{htbm} || '%'
  66. </if>
  67. <if test="hksjQueryEnd != null">
  68. and jybm.hksj &lt;= #{hksjQueryEnd}
  69. </if>
  70. <if test="tkzt != null">
  71. and tk.tkzt=#{tkzt}
  72. </if>
  73. <if test="tkfl != null">
  74. and tk.tkfl=#{tkfl}
  75. </if>
  76. <if test="jylx != null">
  77. and tk.wtbm in (select wtbm from ty_jycrkwt where jylx=#{jylx})
  78. </if>
  79. <if test="tkztList">
  80. and tk.tkzt in
  81. <foreach collection="tkztList" item="item" open="(" close=")" separator=",">
  82. #{item}
  83. </foreach>
  84. </if>
  85. </where>
  86. order by tk.tkbm desc
  87. </select>
  88. -->
  89. <select id="selectPageList" resultType="com.unis.transaction.common.vo.givebackbail.GiveBackVO" parameterType="com.unis.transaction.common.vo.givebackbail.GiveBackVO">
  90. select
  91. *
  92. from
  93. ty_jybzjtk tk
  94. <where>
  95. <if test="htbm != null and htbm != ''">
  96. and tk.htbm like '%' || #{htbm} || '%'
  97. </if>
  98. <if test="htbh != null and htbh != ''">
  99. and tk.htbh like '%' || #{htbh} || '%'
  100. </if>
  101. <if test="sjlx != null and sjlx != ''">
  102. and tk.sjlx = #{sjlx}
  103. </if>
  104. <if test="tkzt != null">
  105. and tk.tkzt=#{tkzt}
  106. </if>
  107. <if test="tkfl != null">
  108. and tk.tkfl=#{tkfl}
  109. </if>
  110. <if test="jylx != null">
  111. and tk.jylx=#{jylx}
  112. </if>
  113. <if test="tkztList!= null">
  114. and tk.tkzt in
  115. <foreach collection="tkztList" item="item" open="(" close=")" separator=",">
  116. #{item}
  117. </foreach>
  118. </if>
  119. </where>
  120. --order by tk.apcc desc
  121. order by tk.create_date desc
  122. </select>
  123. <select id="selectDetail" resultType="com.unis.transaction.server.entity.givebackbail.GiveBackDO"
  124. parameterType="com.unis.transaction.common.vo.givebackbail.GiveBackVO">
  125. SELECT
  126. *
  127. FROM ty_jybzjtk <include refid="givebackJoins" />
  128. <where>
  129. <if test="jybm != null and jybm != ''">
  130. and jybm = #{jybm}
  131. </if>
  132. <if test="sjlx != null and sjlx != ''">
  133. and sjlx = #{sjlx}
  134. </if>
  135. <if test="htbm != null and htbm != ''">
  136. and htbm = #{htbm}
  137. </if>
  138. <if test="ccbm != null and ccbm != ''">
  139. and ccbm = #{ccbm}
  140. </if>
  141. <if test="dwmc != null and dwmc != ''">
  142. and dwmc = #{dwmc}
  143. </if>
  144. <if test="dwbm != null and dwbm != ''">
  145. and dwbm = #{dwbm}
  146. </if>
  147. </where>
  148. </select>
  149. <select id="selectUnionDetail" resultType="com.unis.transaction.common.vo.givebackbail.GiveBackVO" parameterType="com.unis.transaction.common.vo.givebackbail.GiveBackVO">
  150. select
  151. jybm.jybm,
  152. jybm.apcc,
  153. jybm.sl,
  154. jybm.je,
  155. jybm.dwmc,
  156. jybm.lxdh,
  157. jybm.bmrq,
  158. jybm.hkje,
  159. jybm.lspzmc,
  160. jybm.sxfl,
  161. tkwth.wthbm,
  162. tk.tkbm,
  163. tk.tkzt,
  164. tk.tkztmc,
  165. tk.tkje,
  166. tk.tksj,
  167. tk.cwczr,
  168. tk.tksm,
  169. tk.hksj,
  170. tk.czr,
  171. tk.tkpz,
  172. tk.remark
  173. from
  174. ty_jybzjtk tk
  175. right join ty_jybm jybm on jybm.jybm = tk.jybm and jybm.status = 1
  176. left join ty_jytkwth tkwth on tkwth.apcc=jybm.apcc and tkwth.status = 1 and tkwth.zt = '91000051'
  177. <where>
  178. <if test="tkbm != null and tkbm !=''">
  179. and tk.tkbm = #{tkbm}
  180. </if>
  181. <if test="jybm != null and jybm !=''">
  182. and jybm.jybm = #{jybm}
  183. </if>
  184. </where>
  185. </select>
  186. <select id="selectGiveBackList" resultType="com.unis.transaction.common.vo.givebackbail.GiveBackVO">
  187. SELECT
  188. *
  189. FROM ty_jybzjtk <include refid="givebackJoins" />
  190. where tkfl is null and sjlx = '0'
  191. </select>
  192. <select id="selectDetailByWthbm" resultType="com.unis.transaction.server.entity.givebackbail.GiveBackDO">
  193. SELECT
  194. *
  195. FROM ty_jybzjtk <include refid="givebackJoins" />
  196. where wthbm =#{wthbm} and wtfbm = #{wtfbm} and dwbm= #{dwbm}
  197. </select>
  198. <select id="selectGivePassAll" resultType="com.unis.transaction.server.entity.givebackbail.GiveBackDO">
  199. SELECT
  200. *
  201. FROM ty_jybzjtk <include refid="givebackJoins" />
  202. where ccbm =#{ccbm}
  203. </select>
  204. <select id="selectDetails" resultType="com.unis.transaction.server.entity.givebackbail.GiveBackDO">
  205. SELECT
  206. *
  207. FROM ty_jybzjtk <include refid="givebackJoins" />
  208. <where>
  209. <if test="jybm != null and jybm != ''">
  210. and jybm = #{jybm}
  211. </if>
  212. <if test="sjlx != null and sjlx != ''">
  213. and sjlx = #{sjlx}
  214. </if>
  215. <if test="htbm != null and htbm != ''">
  216. and htbm = #{htbm}
  217. </if>
  218. <if test="ccbm != null and ccbm != ''">
  219. and ccbm = #{ccbm}
  220. </if>
  221. <if test="dwmc != null and dwmc != ''">
  222. and dwmc = #{dwmc}
  223. </if>
  224. <if test="dwbm != null and dwbm != ''">
  225. and dwbm = #{dwbm}
  226. </if>
  227. </where>
  228. </select>
  229. <select id="selectDetailByWthbms" resultType="com.unis.transaction.server.entity.givebackbail.GiveBackDO">
  230. SELECT
  231. *
  232. FROM ty_jybzjtk <include refid="givebackJoins" />
  233. where wthbm =#{wthbm} and wtfbm = #{wtfbm} and dwbm= #{dwbm}
  234. </select>
  235. <select id="selectGiveBackCjList" resultType="com.unis.transaction.common.vo.givebackbail.GiveBackVO">
  236. SELECT
  237. *
  238. FROM ty_jybzjtk <include refid="givebackJoins" />
  239. where tkfl=0 and sjlx = '1' and to_char(gqsj) like '%' || #{gqsj} || '%'
  240. </select>
  241. <insert id="insertGiveBack">
  242. INSERT INTO ty_jybzjtk(
  243. tkbm,jybm,wthbm,apcc,tkje,tksj,czr,tkpz,tkzt,tkztmc,remark)
  244. VALUES (
  245. #{tkbm},#{jybm},#{wthbm},#{apcc},#{tkje},#{tksj},#{czr},#{tkpz},#{tkzt},#{tkztmc},#{remark})
  246. </insert>
  247. <update id="updateGiveBackTkzt">
  248. UPDATE ty_jybzjtk SET
  249. tkzt = #{tkzt},tkztmc = #{tkztmc},wthbm = #{wthbm}
  250. WHERE
  251. <if test="apcc != null and apcc != ''">
  252. apcc = #{apcc}
  253. </if>
  254. <if test="jybm != null and jybm != ''">
  255. and jybm = #{jybm}
  256. </if>
  257. <if test="wtfbm != null and wtfbm != ''">
  258. and wtfbm = #{wtfbm}
  259. </if>
  260. <if test="dwbm != null and dwbm != ''">
  261. and dwbm = #{dwbm}
  262. </if>
  263. </update>
  264. <update id="deleteGiveBack">
  265. DELETE FROM ty_jybzjtk
  266. WHERE tkbm = #{tkbm}
  267. </update>
  268. <select id="selectGiveBackByCcbm" resultType="com.unis.transaction.common.vo.givebackbail.GiveBackVO">
  269. SELECT
  270. *
  271. FROM ty_jybzjtk <include refid="givebackJoins" />
  272. where ccbm = #{value}
  273. </select>
  274. <select id="selectGiveBackCjLists" resultType="com.unis.transaction.common.vo.givebackbail.GiveBackVO">
  275. SELECT
  276. *
  277. FROM ty_jybzjtk <include refid="givebackJoins" />
  278. where tkfl=0 and sjlx = '1' and ccbm= #{value}
  279. </select>
  280. </mapper>