TurnoverDataMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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.TurnoverDataDao">
  4. <sql id="turnoverdataColumns">
  5. cjbm,sfbm,sfmc,htbm,hth,bdbm,bdh,mfcckbm,mfcckmc,jhckbm,jhckmc,chbm,chmc,scnf,sflt,sgdjbm,sgdjmc,hhqydjbm,hhqydjmc,
  6. cjsl,zcjsl,lsxzbm,lsxzmc,lspzbm,lspzmc,qpjg,cjdj,cjje,cjrq,fhkjzrq,ckjzrq,cjdwbm,cjdwmc,dzjlx,jyjbh,ztbm,ztmc,
  7. hxdf,sscc,sjlx,
  8. wtf,sskd,sskdmc,ssqy,ssqymc,remark
  9. </sql>
  10. <sql id="turnoverdata">
  11. cj.sscc,cj.cc,cj.cjrq,cj.qysl,cj.cd,cj.wbqy,cj.lsxzbm,cj.lsxzmc,cj.lspzmc,cj.lspzbm,cj.jylx,cj.jyxz,cj.lspzbm,sum
  12. (cj.zcjsl)
  13. cjsl,round((sum(cj.cjje)/sum(cj.zcjsl)),2) pjj,
  14. sum(cj.cjje) cjje,avg(cj.sxf) sxf,avg(cj.qpjg) qpjg,sum(cj.trsl) trsl,sum(cj.zcjsl)
  15. lysl,round((sum(cj.zcjsl)/sum(cj.trsl)*100),2) lyl
  16. </sql>
  17. <sql id="turnoverdataJoins">
  18. </sql>
  19. <select id="selectList" resultType="com.unis.transaction.server.entity.creditevaluate.TurnoverDataDO" parameterType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO">
  20. SELECT
  21. <include refid="turnoverdataColumns" />
  22. FROM ty_xycjsjwh <include refid="turnoverdataJoins" />
  23. <where>
  24. <if test="cjdwbm != null and cjdwbm != ''">
  25. and cjdwbm = #{cjdwbm}
  26. </if>
  27. <if test="cjbmList != null">
  28. and cjbm in
  29. <foreach collection="cjbmList" index="index" item="item" open="(" separator="," close=")">
  30. #{item}
  31. </foreach>
  32. </if>
  33. </where>
  34. </select>
  35. <select id="selectPageList" resultType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO" parameterType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO">
  36. SELECT
  37. <include refid="turnoverdata" />
  38. FROM ty_xycjsjwh cj<include refid="turnoverdataJoins" />
  39. <where>
  40. and cj.sjlx = '0'
  41. <if test="jylx != null">
  42. and cj.jylx = #{jylx}
  43. </if>
  44. <if test="jyxz != null and jyxz != ''">
  45. and cj.jyxz = #{jyxz}
  46. </if>
  47. <if test="lspzbm != null and lspzbm != ''">
  48. and cj.lspzbm = #{lspzbm}
  49. </if>
  50. <if test="lsxzbm != null and lsxzbm != ''">
  51. and cj.lsxzbm = #{lsxzbm}
  52. </if>
  53. <if test="cjrqStart != null">
  54. and cj.cjrq &gt;= #{cjrqStart}
  55. </if>
  56. <if test="cjrqEnd != null">
  57. and cj.cjrq &lt;= #{cjrqEnd}
  58. </if>
  59. <if test="cd != null and cd != ''">
  60. and cj.cd = #{cd}
  61. </if>
  62. </where>
  63. group by
  64. cj.sscc,cj.cc,cj.cd,cj.cjrq,cj.lsxzbm,cj.lsxzmc,cj.lspzmc,cj.lspzbm,cj.jylx,cj.jyxz,cj.lspzbm,cj.qysl,cj.wbqy
  65. order by
  66. cj.sscc desc
  67. </select>
  68. <select id="selectPageLists" resultType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO"
  69. parameterType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO">
  70. SELECT
  71. <include refid="turnoverdataColumns" />
  72. FROM ty_xycjsjwh <include refid="turnoverdataJoins" />
  73. <where>
  74. and status = 1
  75. <if test="cjdwmc != null and cjdwmc != ''">
  76. and cjdwmc like '%'||#{cjdwmc}||'%'
  77. </if>
  78. <if test="qyfj != null and qyfj != ''">
  79. and qyfj = #{qyfj}
  80. </if>
  81. <if test="hth != null and hth != ''">
  82. and hth like '%'||#{hth}||'%'
  83. </if>
  84. <if test="ztbm != null and ztbm != ''">
  85. and ztbm = #{ztbm}
  86. </if>
  87. <if test="lspzbm != null and lspzbm != ''">
  88. and lspzbm = #{lspzbm}
  89. </if>
  90. <if test="lsxzbm != null and lsxzbm != ''">
  91. and lsxzbm = #{lsxzbm}
  92. </if>
  93. <if test="cjrqStart != null">
  94. and cjrq &gt;= #{cjrqStart}
  95. </if>
  96. <if test="cjrqEnd != null">
  97. and cjrq &lt;= #{cjrqEnd}
  98. </if>
  99. <if test="cjdjStart != null">
  100. and cjdj &gt;= #{cjdjStart}
  101. </if>
  102. <if test="cjdjEnd != null">
  103. and cjdj &lt;= #{cjdjEnd}
  104. </if>
  105. </where>
  106. order by cjbm desc
  107. </select>
  108. <select id="selectDetail" resultType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO" parameterType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO">
  109. SELECT
  110. <include refid="turnoverdataColumns" />
  111. FROM ty_xycjsjwh <include refid="turnoverdataJoins" />
  112. WHERE cjbm = #{cjbm}
  113. </select>
  114. <select id="selectCjdwSummayDetail" resultType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO" parameterType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO">
  115. SELECT
  116. sum(hxdf) as hxdfTotal
  117. FROM ty_xycjsjwh <include refid="turnoverdataJoins" />
  118. WHERE cjbm = #{cjbm}
  119. </select>
  120. <select id="selectCjdwSummayPageList" resultType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO" parameterType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO">
  121. select
  122. hxzf as hxdf,
  123. cjdwmc,
  124. max( cjrq ) as cjrq,
  125. cjdwbm
  126. from
  127. ty_xycjsjwh
  128. <where>
  129. and status = 1
  130. <if test="cjdwmc != null and cjdwmc != ''">
  131. and cjdwmc like '%'||#{cjdwmc}||'%'
  132. </if>
  133. <if test="cjdwbm != null and cjdwbm != ''">
  134. and cjdwbm =#{cjdwbm}
  135. </if>
  136. <!--<if test="qyfj != null and qyfj != ''">
  137. and qyfj = #{qyfj}
  138. </if>-->
  139. <if test="hxdfStart != null and hxdfEnd != null">
  140. and hxzf &gt;= #{hxdfStart} and hxzf &lt; #{hxdfEnd}
  141. </if>
  142. <if test="hxdfStart != null and hxdfEnd == null">
  143. and hxzf &lt; #{hxdfStart}
  144. </if>
  145. <if test="hxdfStart == null and hxdfEnd != null">
  146. and hxzf &gt;= #{hxdfEnd}
  147. </if>
  148. </where>
  149. group by cjdwbm,cjdwmc,hxzf
  150. </select>
  151. <select id="selectZtbmByDwbm" resultType="com.unis.transaction.common.vo.creditevaluate.TurnoverDataVO">
  152. select
  153. cjdwmc,
  154. cjdwbm,
  155. hxzf,
  156. ztbm
  157. from
  158. ty_xycjsjwh
  159. <where>
  160. AND status =1
  161. <if test="cjdwbm != null and cjdwbm != ''">
  162. and cjdwbm =#{cjdwbm}
  163. </if>
  164. <if test="ztbm != null and ztbm != ''">
  165. and ztbm = #{ztbm}
  166. </if>
  167. </where>
  168. </select>
  169. <insert id="insertTurnoverData">
  170. INSERT INTO ty_xycjsjwh(
  171. cjbm,sfbm,sfmc,htbm,hth,bdbm,bdh,mfcckbm,mfcckmc,jhckbm,jhckmc,chbm,chmc,scnf,sflt,sgdjbm,sgdjmc,hhqydjbm,hhqydjmc,cjsl,zcjsl,lsxzbm,lsxzmc,lspzbm,lspzmc,qpjg,cjdj,cjje,cjrq,fhkjzrq,ckjzrq,cjdwbm,cjdwmc,dzjlx,jyjbh,ztbm,ztmc,hxdf,cc,wtf,sskd,sskdmc,ssqy,ssqymc)
  172. VALUES (
  173. #{cjbm},#{sfbm},#{sfmc},#{htbm},#{hth},#{bdbm},#{bdh},#{mfcckbm},#{mfcckmc},#{jhckbm},#{jhckmc},#{chbm},#{chmc},#{scnf},#{sflt},#{sgdjbm},#{sgdjmc},#{hhqydjbm},#{hhqydjmc},#{cjsl},#{zcjsl},#{lsxzbm},#{lsxzmc},#{lspzbm},#{lspzmc},#{qpjg},#{cjdj},#{cjje},#{cjrq},#{fhkjzrq},#{ckjzrq},#{cjdwbm},#{cjdwmc},#{dzjlx},#{jyjbh},#{ztbm},#{ztmc},#{hxdf},#{cc},#{wtf},#{sskd},#{sskdmc},#{ssqy},#{ssqymc})
  174. </insert>
  175. <update id="updateTurnoverData">
  176. UPDATE ty_xycjsjwh SET
  177. cjbm = #{cjbm},sfbm = #{sfbm},sfmc = #{sfmc},htbm = #{htbm},hth = #{hth},bdbm = #{bdbm},bdh = #{bdh},mfcckbm = #{mfcckbm},mfcckmc = #{mfcckmc},jhckbm = #{jhckbm},jhckmc = #{jhckmc},chbm = #{chbm},chmc = #{chmc},scnf = #{scnf},sflt = #{sflt},sgdjbm = #{sgdjbm},sgdjmc = #{sgdjmc},hhqydjbm = #{hhqydjbm},hhqydjmc = #{hhqydjmc},cjsl = #{cjsl},zcjsl = #{zcjsl},lsxzbm = #{lsxzbm},lsxzmc = #{lsxzmc},lspzbm = #{lspzbm},lspzmc = #{lspzmc},qpjg = #{qpjg},cjdj = #{cjdj},cjje = #{cjje},cjrq = #{cjrq},fhkjzrq = #{fhkjzrq},ckjzrq = #{ckjzrq},cjdwbm = #{cjdwbm},cjdwmc = #{cjdwmc},dzjlx = #{dzjlx},jyjbh = #{jyjbh},ztbm = #{ztbm},ztmc = #{ztmc},hxdf = #{hxdf},cc = #{cc},wtf = #{wtf},sskd = #{sskd},sskdmc = #{sskdmc},ssqy = #{ssqy},ssqymc = #{ssqymc}
  178. WHERE cjbm = #{cjbm}
  179. </update>
  180. <update id="deleteTurnoverData">
  181. DELETE FROM ty_xycjsjwh
  182. WHERE cjbm = #{cjbm}
  183. </update>
  184. <update id="updateHxdfByDwbm">
  185. UPDATE ty_xycjsjwh cj set cj.hxdf =0,cj.hxzf =0
  186. WHERE
  187. <if test="cjdwbm != null and cjdwbm != ''">
  188. cjdwbm = #{cjdwbm}
  189. </if>
  190. <if test="cjrq != null">
  191. and cjrq &gt; #{cjrq}
  192. </if>
  193. </update>
  194. <update id="updateHxzfByDwbm">
  195. UPDATE ty_xycjsjwh cj set cj.hxzf =#{hxzf}
  196. WHERE
  197. <if test="cjdwbm != null and cjdwbm != ''">
  198. cjdwbm = #{cjdwbm}
  199. </if>
  200. </update>
  201. </mapper>