YyWyjtzMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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.tofly.feesapi.sfgl.mapper.YyWyjtzMapper">
  4. <resultMap id="yyWyjtzMap" type="com.tofly.feesapi.sfgl.entity.YyWyjtz">
  5. <id property="id" column="ID"/>
  6. <result property="yhbh" column="YHBH"/>
  7. <result property="qfid" column="QFID"/>
  8. <result property="ssgs" column="SSGS"/>
  9. <result property="ysyf" column="YSYF"/>
  10. <result property="cwrq" column="CWRQ"/>
  11. <result property="tzqje" column="TZQJE"/>
  12. <result property="tzje" column="TZJE"/>
  13. <result property="tzhje" column="TZHJE"/>
  14. <result property="tzyy" column="TZYY"/>
  15. <result property="shry" column="SHRY"/>
  16. <result property="shyj" column="SHYJ"/>
  17. <result property="czrybm" column="CZRYBM"/>
  18. <result property="czryxm" column="CZRYXM"/>
  19. <result property="czsj" column="CZSJ"/>
  20. <result property="sfbz" column="SFBZ"/>
  21. <result property="gdbh" column="GDBH"/>
  22. <result property="gdzt" column="GDZT"/>
  23. <result property="cbrq" column="CBRQ"/>
  24. <result property="yssl" column="YSSL"/>
  25. <result property="yssf" column="YSSF"/>
  26. <result property="type" column="TYPE"/>
  27. <result property="jmyj" column="JMYJ"/>
  28. <result property="gdlsbh" column="GDLSBH"/>
  29. </resultMap>
  30. <select id="getPage" resultType="com.tofly.feesapi.sfgl.entity.vo.YyWyjtzVo">
  31. select a.id,a.yhbh,b.yhxm,a.cwrq,a.ysyf,a.cbrq,a.yssl,a.yssf,a.tzqje,a.tzje,
  32. a.tzyy,a.type,a.jmyj,a.qfid,a.gdbh,a.czsj,a.shry,a.czryxm
  33. from yy_wyjtz a
  34. left join yh_khjbxx b on a.yhbh=b.yhbh
  35. where 1=1
  36. <!--模糊查询 -->
  37. <if test="dto.searchText!=null">
  38. AND ( a.yhbh like '%${dto.searchText}%'
  39. OR b.yhxm like '%${dto.searchText}%'
  40. OR b.yhdz like '%${dto.searchText}%' )
  41. </if>
  42. <if test="dto.sscbb!=null">
  43. AND a.sscbb = #{dto.sscbb}
  44. </if>
  45. <if test="dto.sscbpq!=null">
  46. AND a.sscbpq = #dto.sscbpq
  47. </if>
  48. <if test="dto.yhbh!=null">
  49. AND a.yhbh = #{dto.yhbh}
  50. </if>
  51. <if test="dto.gdzt!=null">
  52. AND a.gdzt = #{dto.gdzt}
  53. </if>
  54. <if test="dto.sfbz!=null">
  55. AND a.sfbz = #{dto.sfbz}
  56. </if>
  57. <if test="dto.ssgs!=null">
  58. AND b.ssgs = #{dto.ssgs}
  59. </if>
  60. <if test="dto.czry!=null">
  61. AND a.czrybm = #{dto.czry}
  62. </if>
  63. <if test="dto.cwrq!=null">
  64. AND a.cwrq = #{dto.cwrq}
  65. </if>
  66. <if test="dto.ysyfStart!=null">
  67. AND a.ysyf >= #{dto.ysyfStart}
  68. </if>
  69. <if test="dto.ysyfEnd!=null">
  70. AND a.ysyf &lt;= #{dto.ysyfEnd}
  71. </if>
  72. <if test="dto.czsjStart!=null and dto.czsjEnd!=null">
  73. AND a.czsj BETWEEN #{dto.czsjStart} AND #{dto.czsjEnd}
  74. </if>
  75. </select>
  76. <select id="getWyjhj" resultType="com.tofly.feesapi.sfgl.entity.vo.YyQfmxWyjSelect">
  77. select nvl(sum(a.tzje),0) tzje
  78. from yy_wyjtz a
  79. left join yh_khjbxx b on a.yhbh=b.yhbh
  80. where 1=1
  81. <!--模糊查询 -->
  82. <if test="dto.searchText!=null">
  83. AND ( a.yhbh like '%${dto.searchText}%'
  84. OR b.yhxm like '%${dto.searchText}%'
  85. OR b.yhdz like '%${dto.searchText}%' )
  86. </if>
  87. <if test="dto.sscbb!=null">
  88. AND a.sscbb = #{dto.sscbb}
  89. </if>
  90. <if test="dto.sscbpq!=null">
  91. AND a.sscbpq = #dto.sscbpq
  92. </if>
  93. <if test="dto.yhbh!=null">
  94. AND a.yhbh = #{dto.yhbh}
  95. </if>
  96. <if test="dto.gdzt!=null">
  97. AND a.gdzt = #{dto.gdzt}
  98. </if>
  99. <if test="dto.sfbz!=null">
  100. AND a.sfbz = #{dto.sfbz}
  101. </if>
  102. <if test="dto.ssgs!=null">
  103. AND b.ssgs = #{dto.ssgs}
  104. </if>
  105. <if test="dto.czry!=null">
  106. AND a.czrybm = #{dto.czry}
  107. </if>
  108. <if test="dto.cwrq!=null">
  109. AND a.cwrq = #{dto.cwrq}
  110. </if>
  111. <if test="dto.ysyfStart!=null">
  112. AND a.ysyf >= #{dto.ysyfStart}
  113. </if>
  114. <if test="dto.ysyfEnd!=null">
  115. AND a.ysyf &lt;= #{dto.ysyfEnd}
  116. </if>
  117. <if test="dto.czsjStart!=null and dto.czsjEnd!=null">
  118. AND a.czsj BETWEEN #{dto.czsjStart} AND #{dto.czsjEnd}
  119. </if>
  120. </select>
  121. <select id="getGdPage" resultType="com.tofly.feesapi.sfgl.entity.vo.YyWyjtzVo">
  122. select a.yhbh,b.yhxm,
  123. (case
  124. when <![CDATA[ min(a.cwrq)<>max(a.cwrq) ]]> then
  125. (min(a.cwrq)||'-'||max(a.cwrq))
  126. else min(a.cwrq)
  127. end )
  128. cwrq,
  129. (case
  130. when <![CDATA[ min(a.cbrq)<>max(a.cbrq) ]]> then
  131. (min(to_char(a.cbrq,'yyyy-MM-dd hh24:mi:ss'))||'-'||max(to_char(a.cbrq,'yyyy-MM-dd hh24:mi:ss')))
  132. else min(to_char(a.cbrq,'yyyy-MM-dd hh24:mi:ss'))
  133. end )cbrq,
  134. sum(nvl(a.yssl,0)) yssl,
  135. sum(nvl(a.yssf,0))yssf,
  136. sum(nvl(a.tzqje,0))tzqje,
  137. sum(nvl(a.tzje,0))tzje,
  138. sum(nvl(c.znj,0)) znj,
  139. a.jmyj,
  140. a.gdlsbh,
  141. a.gdbh,
  142. a.tzyy,
  143. a.type,
  144. count(a.id) countnum
  145. from yy_wyjtz a
  146. left join yh_khjbxx b on a.yhbh=b.yhbh
  147. left join yy_qfmx c on a.qfid=c.id
  148. where 1=1
  149. <!--模糊查询 -->
  150. <if test="dto.searchText!=null">
  151. AND ( a.yhbh like '%${dto.searchText}%'
  152. OR b.yhxm like '%${dto.searchText}%'
  153. OR b.yhdz like '%${dto.searchText}%' )
  154. </if>
  155. <if test="dto.gdzt!=null">
  156. AND a.gdzt = #{dto.gdzt}
  157. </if>
  158. <if test="dto.sfbz!=null">
  159. AND a.sfbz = #{dto.sfbz}
  160. </if>
  161. <if test="dto.ssgs!=null">
  162. AND b.ssgs = #{dto.ssgs}
  163. </if>
  164. <if test="dto.sscbpq!=null">
  165. AND b.sscbpq = #dto.sscbpq
  166. </if>
  167. <if test="dto.sscbb!=null">
  168. AND b.sscbb = #{dto.sscbb}
  169. </if>
  170. <if test="dto.qyfzr!=null">
  171. AND b.sscbb in (select cbbbm from bm_cbb where qyfzr=#{dto.qyfzr})
  172. </if>
  173. <if test="dto.gdlsbh!=null">
  174. AND a.gdlsbh = #{dto.gdlsbh}
  175. </if>
  176. group by a.yhbh,b.yhxm,a.gdlsbh,a.gdbh,a.tzyy,a.type,a.jmyj
  177. </select>
  178. </mapper>