YhCbkxxMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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.bjgl.mapper.YhCbkxxMapper">
  4. <!--查询用户水表档案 -->
  5. <select id="SelectYhcbkxx" resultType="com.tofly.feesapi.bjgl.entity.YhCbkxx2">
  6. select * from yh_cbkxx where 1=1
  7. <if test="yhbh!=null and yhbh!=''">
  8. and yhbh=#{yhbh}
  9. </if>
  10. <if test="cbkh!=null and cbkh!=''">
  11. and cbkh=#{cbkh}
  12. </if>
  13. </select>
  14. <!--自定义获取用户是否存在 -->
  15. <select id="selectExistYhbh" resultType="int">
  16. SELECT COUNT(0) sl FROM yh_cbkxx WHERE yhbh=#{yhbh} and cbkh#{cbkh}
  17. </select>
  18. <!--查询用户档案连表查询信息-->
  19. <select id="getYhdaSbdaPage" resultType="com.tofly.feesapi.bjgl.entity.YhDaCbkxxSelect">
  20. select a.yhbh,a.yhxm,a.yhdz,a.lxdh,a.ssgs,a.sscbpq,a.sscbb,b.sblb,b.sbsccj,b.sbbh,b.sblc,b.sbxh,b.sbkj,b.bjwz from yh_khjbxx a,yh_cbkxx b where a.yhbh=b.yhbh
  21. <!--模糊查询 -->
  22. <if test="searchText!=null">
  23. AND ( a.yhbh like '%${searchText}%'
  24. OR a.yhxm like '%${searchText}%'
  25. OR a.yhdz like '%${searchText}%'
  26. OR a.lxdh like '%${searchText}%')
  27. </if>
  28. <if test="sscbpq!=null and sscbpq!=''">
  29. and a.sscbpq=#{sscbpq}
  30. </if>
  31. <if test="sscbb!=null and sscbb!=''">
  32. and a.sscbb=#{sscbb}
  33. </if>
  34. </select>
  35. <!--换表查看用户、水表档案 -->
  36. <select id="SelectYhdaSbda" resultType="com.tofly.feesapi.bjgl.entity.YhDaCbkxxSelect">
  37. select a.yhbh,a.yhxm,a.yhdz,a.lxdh,a.ssgs,a.sscbpq,a.sscbb,b.sblb,b.sbsccj,b.sbbh,b.sblc,b.sbxh,b.sbkj,b.bjwz from yh_khjbxx a,yh_cbkxx b where a.yhbh=b.yhbh
  38. <if test="yhbh!=null and yhbh!=''">
  39. and a.yhbh=#{yhbh}
  40. </if>
  41. <if test="cbkh!=null and cbkh!=''">
  42. and b.cbkh=#{cbkh}
  43. </if>
  44. </select>
  45. <select id="getList" resultType="com.tofly.feesapi.bjgl.entity.vo.YhCbkxxSelect">
  46. SELECT yhbh, cbkh, cbkid, c.name AS sblbmc, d.name AS sbsccjmc, sbccrq,
  47. e.name AS sbxhmc, f.ccname AS sbkjmc, sbbh, b.name sjmc, jfzt
  48. FROM yh_cbkxx a
  49. LEFT JOIN bm_sj b ON a.sjbm = b.code
  50. LEFT JOIN bm_sblb c ON a.sblb = c.code
  51. LEFT JOIN bm_sbsccj d ON a.sbsccj = d.code
  52. LEFT JOIN bm_sbxh e ON a.sbxh = e.code
  53. LEFT JOIN (SELECT * FROM sys_child_code WHERE pcid='12') f ON a.sbkj = f.cccode
  54. WHERE a.yhbh=#{yhbh}
  55. </select>
  56. <!--自定义水表档案分页查询 -->
  57. <select id="getPage" resultType="com.tofly.feesapi.bjgl.entity.vo.YhCbkxxSelect2">
  58. <include refid="sql2"></include>
  59. </select>
  60. <sql id="sql2">
  61. SELECT a.yhbh, a.cbkh, c.yhxm, c.yhdz, a.ybdjbz, a.wsfbz, a.sjbm, a.sjbm1, a.slbl1, a.sjbm2, a.slbl2, a.sjbm3, a.slbl3, a.cbxh, f.cbbmc AS sscbbmc
  62. FROM yh_cbkxx a
  63. LEFT JOIN yh_khjbxx c ON a.yhbh = c.yhbh
  64. LEFT JOIN bm_cbb f ON c.sscbb = f.cbbbm
  65. WHERE 1=1
  66. <!--模糊查询 -->
  67. <if test="filter.searchText!=null">
  68. AND ( c.yhbh like '%${filter.searchText}%'
  69. OR c.yhxm like '%${filter.searchText}%'
  70. OR c.yhdz like '%${filter.searchText}%'
  71. OR c.lxdh like '%${filter.searchText}%')
  72. </if>
  73. <!--所属公司-->
  74. <if test="filter.ssgs!=null">
  75. AND c.ssgs=#{filter.ssgs}
  76. </if>
  77. <!--所属片区-->
  78. <if test="filter.sscbpq!=null">
  79. AND c.sscbpq=#{filter.sscbpq}
  80. </if>
  81. <!--所属抄表本-->
  82. <if test="filter.sscbb!=null">
  83. AND c.sscbb=#{filter.sscbb}
  84. </if>
  85. <!-- 用户状态-->
  86. <if test="filter.yhzt!=null">
  87. AND c.yhzt=#{filter.yhzt}
  88. </if>
  89. <!-- 垃圾费标志-->
  90. <if test="filter.ljfbz!=null">
  91. AND a.ljfbz=#{filter.ljfbz}
  92. </if>
  93. <!--建档日期-->
  94. <if test="filter.jdrqStart!=null and filter.jdrqEnd!=null">
  95. AND TRUNC(c.jdrq) BETWEEN #{filter.jdrqStart} AND
  96. #{filter.jdrqEnd}
  97. </if>
  98. <!-- 用户姓名-->
  99. <if test="filter.yhxm!=null">
  100. AND c.yhxm=#{filter.yhxm}
  101. </if>
  102. <!-- 用户编号-->
  103. <if test="filter.yhbh!=null">
  104. AND c.yhbh=#{filter.yhbh}
  105. </if>
  106. <!-- 用户地址-->
  107. <if test="filter.yhdz!=null">
  108. AND c.yhdz=#{filter.yhdz}
  109. </if>
  110. <!-- 联系电话-->
  111. <if test="filter.lxdh!=null">
  112. AND c.lxdh=#{filter.lxdh}
  113. </if>
  114. <!-- 是否分配抄表本(册)-->
  115. <if test="filter.sffpcbb!=null">
  116. <if test="filter.sffpcbb">
  117. AND c.sscbb IS NOT NULL
  118. </if>
  119. <if test="!filter.sffpcbb">
  120. AND c.sscbb IS NULL
  121. </if>
  122. </if>
  123. <!-- 抄表序号-->
  124. <if test="filter.cbxh!=null">
  125. AND a.cbxh=#{filter.cbxh}
  126. </if>
  127. <!-- 是否分配抄表序号-->
  128. <if test="filter.sffpcbxh!=null">
  129. <if test="filter.sffpcbxh">
  130. AND (a.cbxh IS NOT NULL AND a.cbxh > 0)
  131. </if>
  132. <if test="!filter.sffpcbxh">
  133. AND (a.cbxh IS NULL OR a.cbxh = 0)
  134. </if>
  135. </if>
  136. </sql>
  137. <select id="getMaxCbxh" resultType="Integer">
  138. SELECT NVL(MAX(cbxh),0) AS cbxh FROM yh_cbkxx WHERE yhbh IN
  139. <foreach collection="yhbhs" item="yhbh" index="index" open="(" close=")" separator=",">
  140. #{yhbh}
  141. </foreach>
  142. </select>
  143. <select id="getUp" resultType="com.tofly.feesapi.bjgl.entity.YhCbkxx">
  144. SELECT
  145. c.sscbb,
  146. a.*
  147. FROM
  148. yh_cbkxx a
  149. LEFT JOIN yh_khjbxx c ON
  150. a.yhbh = c.yhbh
  151. WHERE
  152. c.sscbb = #{sscbb}
  153. AND ${cbxh} > a.cbxh
  154. AND a.cbxh > 0
  155. AND ROWNUM = 1
  156. ORDER BY
  157. a.cbxh
  158. </select>
  159. <select id="getDown" resultType="com.tofly.feesapi.bjgl.entity.YhCbkxx">
  160. SELECT
  161. c.sscbb,
  162. a.*
  163. FROM
  164. yh_cbkxx a
  165. LEFT JOIN yh_khjbxx c ON
  166. a.yhbh = c.yhbh
  167. WHERE
  168. c.sscbb = #{sscbb}
  169. AND a.cbxh > ${cbxh}
  170. AND a.cbxh > 0
  171. AND ROWNUM = 1
  172. ORDER BY
  173. a.cbxh
  174. </select>
  175. </mapper>