BmCbbMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.bmgl.mapper.BmCbbMapper">
  4. <select id="selectMaxId" resultType="decimal">
  5. SELECT NVL(MAX(to_number(CBBBM)), 0)
  6. FROM BM_CBB
  7. </select>
  8. <resultMap id="bmCbbMap" type="com.tofly.feesapi.bmgl.entity.BmCbb">
  9. <id property="cbbbm" column="CBBBM"/>
  10. <result property="cbbmc" column="CBBMC"/>
  11. <result property="dz" column="DZ"/>
  12. <result property="cby" column="CBY"/>
  13. <result property="ssgs" column="SSGS"/>
  14. <result property="sscbpq" column="SSCBPQ"/>
  15. <result property="bz" column="BZ"/>
  16. <result property="cdate" column="CDATE"/>
  17. <result property="xdate" column="XDATE"/>
  18. <result property="czry" column="CZRY"/>
  19. <result property="sxbz" column="SXBZ"/>
  20. <result property="xycby" column="XYCBY"/>
  21. <result property="qyfzr" column="QYFZR"/>
  22. <result property="qyfzrxm" column="QYFZRXM"/>
  23. <result property="isdisabled" column="ISDISABLED"/>
  24. </resultMap>
  25. <select id="getPage" resultType="com.tofly.feesapi.bmgl.entity.dto.BmCbbSelect">
  26. SELECT a.*, b.cbpqmc AS sscbpqmc FROM BM_CBB a
  27. LEFT JOIN BM_CBPQ b ON a.sscbpq = b.cbpqbm
  28. WHERE 1 = 1
  29. <if test="filter.cbbbm!=null">
  30. AND a.cbbbm like '%${filter.cbbbm}%'
  31. </if>
  32. <if test="filter.cbbmc!=null">
  33. AND a.cbbmc like '%${filter.cbbmc}%'
  34. </if>
  35. <if test="filter.ssgs!=null">
  36. AND a.ssgs=#{filter.ssgs}
  37. </if>
  38. <if test="filter.sscbpq!=null">
  39. AND a.sscbpq=#{filter.sscbpq}
  40. </if>
  41. <if test="filter.searchText!=null">
  42. AND (a.cbbbm like '%${filter.searchText}%' OR a.cbbmc like '%${filter.searchText}%' or a.bz like
  43. '%${filter.searchText}%')
  44. </if>
  45. <if test="filter.cby!=null">
  46. AND a.cby=#{filter.cby}
  47. </if>
  48. <if test="filter.qyfzr!=null">
  49. AND a.qyfzr=#{filter.qyfzr}
  50. </if>
  51. <if test="filter.isdisabled!=null">
  52. AND a.isdisabled=#{filter.isdisabled}
  53. </if>
  54. <if test="filter.userId!=null">
  55. AND a.cbbbm in (select cbbbm from yh_sjqx where user_id=#{filter.userId})
  56. </if>
  57. ORDER BY a.cbbbm
  58. </select>
  59. <select id="getPage2" resultType="com.tofly.feesapi.bmgl.entity.dto.BmCbbSelect2">
  60. SELECT
  61. a.cbbbm, MAX(a.cbbmc) AS cbbmc,
  62. MAX(a.dz) AS dz, MAX(a.cby) AS cby, COUNT(c.yhbh) AS yhsl
  63. FROM
  64. BM_CBB a
  65. LEFT JOIN
  66. yh_khjbxx b ON b.sscbb = a.cbbbm
  67. LEFT JOIN
  68. yy_cblr c ON c.yhbh = b.yhbh
  69. <if test="filter.cbbz!=null">
  70. AND c.cbbz = #{filter.cbbz}
  71. </if>
  72. <if test="filter.jsbz!=null">
  73. AND c.jsbz = #{filter.jsbz}
  74. </if>
  75. <if test="filter.cbbz!=null">
  76. AND c.shbz = #{filter.shbz}
  77. </if>
  78. WHERE 1 = 1
  79. /*排除水表用途为4的水表*/
  80. /*AND not exists (select 1 from yh_cbkxx aa where sbyt='4' and c.cbkid=aa.cbkid)*/
  81. /*排除子表水表与分表水表*/
  82. AND not exists (select 1 from yh_bjfl_fb fb left join yh_bjfl_zb zb on
  83. fb.zb_id=zb.id where <![CDATA[ fb.zb_id<>fb.id ]]> and zb.isdisabled='1' and (fb.yhbh||fb.cbkh)=c.cbkid)
  84. <if test="filter.cbbbm!=null">
  85. AND a.cbbbm like '%${filter.cbbbm}%'
  86. </if>
  87. <if test="filter.cbbmc!=null">
  88. AND a.cbbmc like '%${filter.cbbmc}%'
  89. </if>
  90. <if test="filter.ssgs!=null">
  91. AND a.ssgs=#{filter.ssgs}
  92. </if>
  93. <if test="filter.sscbpq!=null">
  94. AND a.sscbpq=#{filter.sscbpq}
  95. </if>
  96. <if test="filter.searchText!=null">
  97. AND (a.cbbbm like '%${filter.searchText}%' OR a.cbbmc like '%${filter.searchText}%' or a.bz like
  98. '%${filter.searchText}%')
  99. </if>
  100. <if test="filter.isdisabled!=null">
  101. AND a.isdisabled=#{filter.isdisabled}
  102. </if>
  103. <if test="filter.userId!=null">
  104. AND a.cbbbm in (select cbbbm from yh_sjqx where user_id=#{filter.userId})
  105. </if>
  106. <if test="filter.dxh!=null">
  107. AND b.dxh= #{filter.dxh}
  108. </if>
  109. GROUP BY a.cbbbm having count(c.yhbh)>0
  110. </select>
  111. <select id="getPage3" resultType="com.tofly.feesapi.bmgl.entity.dto.BmCbbSelect2">
  112. SELECT a.cbbbm, MAX(a.cbbmc) AS cbbmc, MAX(a.dz) AS dz, MAX(a.cby) AS cby, COUNT(b.yhbh) AS yhsl FROM BM_CBB a
  113. LEFT JOIN yh_khjbxx b ON b.sscbb = a.cbbbm
  114. WHERE 1 = 1
  115. <if test="filter.cbbbm!=null">
  116. AND a.cbbbm like '%${filter.cbbbm}%'
  117. </if>
  118. <if test="filter.cbbmc!=null">
  119. AND a.cbbmc like '%${filter.cbbmc}%'
  120. </if>
  121. <if test="filter.ssgs!=null">
  122. AND a.ssgs=#{filter.ssgs}
  123. </if>
  124. <if test="filter.sscbpq!=null">
  125. AND a.sscbpq=#{filter.sscbpq}
  126. </if>
  127. <if test="filter.searchText!=null">
  128. AND (a.cbbbm like '%${filter.searchText}%' OR a.cbbmc like '%${filter.searchText}%' or a.bz like
  129. '%${filter.searchText}%')
  130. </if>
  131. <if test="filter.isdisabled!=null">
  132. AND a.isdisabled=#{filter.isdisabled}
  133. </if>
  134. GROUP BY a.cbbbm having count(a.cbbbm)>0
  135. </select>
  136. </mapper>