FailureReasonDao.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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="cn.com.victorysoft.business.cyyzs.dao.FailureReasonDao">
  4. <update id="updateDetails">
  5. update water_failure_reason
  6. set gylx = #{gylx, jdbcType=VARCHAR},
  7. fsyz_ck = #{fsyzCk, jdbcType=VARCHAR},
  8. jgyz = #{jgyz, jdbcType=VARCHAR},
  9. fgq = #{fgq, jdbcType=VARCHAR},
  10. psq = #{psq, jdbcType=VARCHAR},
  11. xjf = #{xjf, jdbcType=VARCHAR},
  12. mdgj = #{mdgj, jdbcType=VARCHAR},
  13. mgz = #{mgz, jdbcType=VARCHAR},
  14. is_gzdx = #{isGzdx, jdbcType=VARCHAR},
  15. kzrq = #{kzrq, jdbcType=DATE},
  16. sxrq = #{sxrq, jdbcType=DATE},
  17. last_is_xjcg = #{lastIsXjcg, jdbcType=VARCHAR}
  18. where
  19. jh = #{jh, jdbcType=VARCHAR} and to_char(rq, 'yyyy-mm-dd') = to_char(#{rq, jdbcType=DATE}, 'yyyy-mm-dd')
  20. </update>
  21. <select id="selectDetails" resultType="cn.com.victorysoft.business.cyyzs.entity.FailureReasonDetails">
  22. select
  23. a.rq, a.dwdm, a.dydm, a.jh, a.gylx, b.flag_name gylx_name,
  24. case when fsyz_ck = 'Y' then '是' when fsyz_ck is null then '' else '否' end fsyz_ck,
  25. case when jgyz = 'Y' then '是' when jgyz is null then '' else '否' end jgyz,
  26. case when fgq = 'Y' then '是' when fgq is null then '' else '否' end fgq,
  27. case when psq = 'Y' then '是' when psq is null then '' else '否' end psq,
  28. case when xjf = 'Y' then '是' when xjf is null then '' else '否' end xjf,
  29. case when mdgj = 'Y' then '是' when mdgj is null then '' else '否' end mdgj,
  30. case when mgz = 'Y' then '是' when mgz is null then '' else '否' end mgz,
  31. case when is_gzdx = 'Y' then '是' when is_gzdx is null then '' else '否' end is_gzdx,
  32. case when last_is_xjcg = 'Y' then '是' when last_is_xjcg is null then '' else '否' end last_is_xjcg,
  33. gjwhxms, zyrj, kzrq, sxrq, yxq, sxyy, qgzfh, zsltbqk,
  34. d.unitname dwmc, c.blockname dymc,
  35. rownum xh
  36. from
  37. water_failure_reason a
  38. left join sys_flag b on a.gylx = b.flag_code
  39. left join sys_blockinfo c on a.dydm = c.blockcode
  40. left join sys_unitinfo d on a.dwdm = d.unitcode
  41. left join water_well_basic e on a.jh = e.jh
  42. where
  43. 1 = 1
  44. <if test="jh != null and jh != ''"> and a.jh = #{jh}</if>
  45. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  46. <if test="yclx != null and yclx != ''"> and e.yclx = #{yclx}</if>
  47. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  48. <if test="dwdm != null and dwdm != ''"> and a.dwdm in (select unitcode from sys_unitinfo start with unitcode = #{dwdm} connect by p_unitcode = prior unitcode) </if>
  49. </select>
  50. <select id="selectListGroupGylx" resultType="cn.com.victorysoft.business.cyyzs.entity.FailureReason">
  51. select
  52. a.*, rownum xh
  53. from (
  54. select
  55. a.gylx,
  56. (select flag_name from sys_flag where flag_code = a.gylx) gylx_name,
  57. sum(case when a.fsyz_ck = 'Y' then 1 else 0 end ) fsyz_ck,
  58. sum(case when a.jgyz = 'Y' then 1 else 0 end ) jgyz,
  59. sum(case when a.fgq = 'Y' then 1 else 0 end ) fgq,
  60. sum(case when a.psq = 'Y' then 1 else 0 end ) psq,
  61. sum(case when a.xjf = 'Y' then 1 else 0 end ) xjf,
  62. sum(case when a.mdgj = 'Y' then 1 else 0 end ) mdgj,
  63. sum(case when a.mgz = 'Y' then 1 else 0 end ) mgz
  64. from
  65. water_failure_reason a
  66. left join water_well_basic b on a.jh = b.jh
  67. where
  68. 1 = 1
  69. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  70. <if test="yclx != null and yclx != ''"> and b.yclx = #{yclx}</if>
  71. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  72. <if test="dwdm != null and dwdm != ''"> and a.dwdm in (select unitcode from sys_unitinfo start with unitcode = #{dwdm} connect by p_unitcode = prior unitcode) </if>
  73. group by
  74. a.gylx
  75. ) a
  76. </select>
  77. <select id="selectListGroupYclx" resultType="cn.com.victorysoft.business.cyyzs.entity.FailureReason">
  78. select
  79. a.*, rownum xh
  80. from (
  81. select
  82. b.yclx,
  83. (select flag_name from sys_flag where flag_code = b.yclx) yclx_name,
  84. sum(case when fsyz_ck = 'Y' then 1 else 0 end ) fsyz_ck,
  85. sum(case when jgyz = 'Y' then 1 else 0 end ) jgyz,
  86. sum(case when fgq = 'Y' then 1 else 0 end ) fgq,
  87. sum(case when psq = 'Y' then 1 else 0 end ) psq,
  88. sum(case when xjf = 'Y' then 1 else 0 end ) xjf,
  89. sum(case when mdgj = 'Y' then 1 else 0 end ) mdgj,
  90. sum(case when mgz = 'Y' then 1 else 0 end ) mgz
  91. from
  92. water_failure_reason a
  93. left join water_well_basic b on a.jh = b.jh
  94. where
  95. 1 = 1
  96. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  97. <if test="yclx != null and yclx != ''"> and b.yclx = #{yclx}</if>
  98. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  99. <if test="dwdm != null and dwdm != ''"> and a.dwdm in (select unitcode from sys_unitinfo start with unitcode = #{dwdm} connect by p_unitcode = prior unitcode) </if>
  100. group by
  101. b.yclx
  102. )
  103. </select>
  104. <select id="getBarData" resultType="cn.com.victorysoft.business.cyyzs.entity.FailureReason">
  105. select
  106. a.gylx,
  107. (select flag_name from sys_flag where flag_code = a.gylx) gylx_name,
  108. sum(case when fsyz_ck = 'Y' then 1 else 0 end ) fsyz_ck
  109. from
  110. water_failure_reason a
  111. left join water_well_basic b on a.jh = b.jh
  112. where
  113. 1 = 1
  114. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  115. <if test="yclx != null and yclx != ''"> and b.yclx = #{yclx}</if>
  116. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  117. <if test="dwdm != null and dwdm != ''"> and a.dwdm in (select unitcode from sys_unitinfo start with unitcode = #{dwdm} connect by p_unitcode = prior unitcode) </if>
  118. group by
  119. a.gylx
  120. </select>
  121. <select id="getPieData" resultType="org.apache.commons.collections.map.CaseInsensitiveMap">
  122. select
  123. sum(case when fsyz_ck = 'Y' then 1 else 0 end ) "油管腐蚀严重或穿孔",
  124. sum(case when jgyz = 'Y' then 1 else 0 end ) "油管结垢严重",
  125. sum(case when fgq = 'Y' then 1 else 0 end ) "封隔器",
  126. sum(case when psq = 'Y' then 1 else 0 end ) "配水器",
  127. sum(case when xjf = 'Y' then 1 else 0 end ) "洗井阀",
  128. sum(case when mdgj = 'Y' then 1 else 0 end ) "锚定工具",
  129. sum(case when mgz = 'Y' then 1 else 0 end ) "埋管柱"
  130. from
  131. water_failure_reason a
  132. left join water_well_basic b on a.jh = b.jh
  133. where
  134. 1 = 1
  135. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  136. <if test="yclx != null and yclx != ''"> and b.yclx = #{yclx}</if>
  137. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  138. <if test="dwdm != null and dwdm != ''"> and a.dwdm in (select unitcode from sys_unitinfo start with unitcode = #{dwdm} connect by p_unitcode = prior unitcode) </if>
  139. </select>
  140. <select id="selectDetailsOne" resultType="cn.com.victorysoft.business.cyyzs.entity.FailureReasonDetails">
  141. select
  142. *
  143. from
  144. water_failure_reason
  145. where
  146. 1 = 1
  147. <if test="jh != null and jh != ''"> and jh = #{jh}</if>
  148. <if test="rq != null and rq != ''"> and to_char(rq, 'yyyy-mm-dd') = #{rq}</if>
  149. </select>
  150. </mapper>