FailureReasonDao.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. <select id="selectDetails" resultType="cn.com.victorysoft.business.cyyzs.entity.FailureReasonDetails">
  5. select
  6. a.rq, a.dwdm, a.dydm, a.jh, a.gylx, b.flag_name gylx_name,
  7. case when fsyz_ck = 'Y' then '是' else '否' end fsyz_ck,
  8. case when jgyz = 'Y' then '是' else '否' end jgyz,
  9. case when fgq = 'Y' then '是' else '否' end fgq,
  10. case when psq = 'Y' then '是' else '否' end psq,
  11. case when xjf = 'Y' then '是' else '否' end xjf,
  12. case when mdgj = 'Y' then '是' else '否' end mdgj,
  13. case when mgz = 'Y' then '是' else '否' end mgz,
  14. case when is_gzdx = 'Y' then '是' else '否' end is_gzdx,
  15. case when last_is_xjcg = 'Y' then '是' else '否' end last_is_xjcg,
  16. gjwhxms, zyrj, kzrq, sxrq, yxq, sxyy, qgzfh, zsltbqk,
  17. d.unitname dwmc, c.blockname dymc
  18. from
  19. water_failure_reason a
  20. left join sys_flag b on a.gylx = b.flag_code
  21. left join sys_blockinfo c on a.dydm = c.blockcode
  22. left join sys_unitinfo d on a.dwdm = d.unitcode
  23. left join water_well_basic e on a.jh = e.jh
  24. where
  25. 1 = 1
  26. <if test="jh != null and jh != ''"> and a.jh = #{jh}</if>
  27. <if test="dwdm != null and dwdm != ''"> and a.dwdm = #{dwdm}</if>
  28. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  29. <if test="yclx != null and yclx != ''"> and e.yclx = #{yclx}</if>
  30. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  31. </select>
  32. <select id="selectListGroupGylx" resultType="cn.com.victorysoft.business.cyyzs.entity.FailureReason">
  33. select
  34. a.gylx,
  35. (select flag_name from sys_flag where flag_code = a.gylx) gylx_name,
  36. sum(case when a.fsyz_ck = 'Y' then 1 else 0 end ) fsyz_ck,
  37. sum(case when a.jgyz = 'Y' then 1 else 0 end ) jgyz,
  38. sum(case when a.fgq = 'Y' then 1 else 0 end ) fgq,
  39. sum(case when a.psq = 'Y' then 1 else 0 end ) psq,
  40. sum(case when a.xjf = 'Y' then 1 else 0 end ) xjf,
  41. sum(case when a.mdgj = 'Y' then 1 else 0 end ) mdgj,
  42. sum(case when a.mgz = 'Y' then 1 else 0 end ) mgz
  43. from
  44. water_failure_reason a
  45. left join water_well_basic b on a.jh = b.jh
  46. where
  47. 1 = 1
  48. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  49. <if test="yclx != null and yclx != ''"> and b.yclx = #{yclx}</if>
  50. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  51. <if test="dwdm != null and dwdm != ''"> and a.dwdm = #{dwdm}</if>
  52. group by
  53. a.gylx
  54. </select>
  55. <select id="selectListGroupYclx" resultType="cn.com.victorysoft.business.cyyzs.entity.FailureReason">
  56. select
  57. b.yclx,
  58. (select flag_name from sys_flag where flag_code = b.yclx) yclx_name,
  59. sum(case when fsyz_ck = 'Y' then 1 else 0 end ) fsyz_ck,
  60. sum(case when jgyz = 'Y' then 1 else 0 end ) jgyz,
  61. sum(case when fgq = 'Y' then 1 else 0 end ) fgq,
  62. sum(case when psq = 'Y' then 1 else 0 end ) psq,
  63. sum(case when xjf = 'Y' then 1 else 0 end ) xjf,
  64. sum(case when mdgj = 'Y' then 1 else 0 end ) mdgj,
  65. sum(case when mgz = 'Y' then 1 else 0 end ) mgz
  66. from
  67. water_failure_reason a
  68. left join water_well_basic b on a.jh = b.jh
  69. where
  70. 1 = 1
  71. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  72. <if test="yclx != null and yclx != ''"> and b.yclx = #{yclx}</if>
  73. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  74. <if test="dwdm != null and dwdm != ''"> and a.dwdm = #{dwdm}</if>
  75. group by
  76. b.yclx
  77. </select>
  78. <select id="getBarData" resultType="cn.com.victorysoft.business.cyyzs.entity.FailureReason">
  79. select
  80. a.gylx,
  81. (select flag_name from sys_flag where flag_code = a.gylx) gylx_name,
  82. sum(case when fsyz_ck = 'Y' then 1 else 0 end ) fsyz_ck
  83. from
  84. water_failure_reason a
  85. left join water_well_basic b on a.jh = b.jh
  86. where
  87. 1 = 1
  88. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  89. <if test="yclx != null and yclx != ''"> and b.yclx = #{yclx}</if>
  90. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  91. <if test="dwdm != null and dwdm != ''"> and a.dwdm = #{dwdm}</if>
  92. group by
  93. a.gylx
  94. </select>
  95. <select id="getPieData" resultType="org.apache.commons.collections.map.CaseInsensitiveMap">
  96. select
  97. sum(case when fsyz_ck = 'Y' then 1 else 0 end ) "油管腐蚀严重或穿孔",
  98. sum(case when jgyz = 'Y' then 1 else 0 end ) "油管结垢严重",
  99. sum(case when fgq = 'Y' then 1 else 0 end ) "封隔器",
  100. sum(case when psq = 'Y' then 1 else 0 end ) "配水器",
  101. sum(case when xjf = 'Y' then 1 else 0 end ) "洗井阀",
  102. sum(case when mdgj = 'Y' then 1 else 0 end ) "锚定工具",
  103. sum(case when mgz = 'Y' then 1 else 0 end ) "埋管柱"
  104. from
  105. water_failure_reason a
  106. left join water_well_basic b on a.jh = b.jh
  107. where
  108. 1 = 1
  109. <if test="gylx != null and gylx != ''"> and a.gylx = #{gylx}</if>
  110. <if test="yclx != null and yclx != ''"> and b.yclx = #{yclx}</if>
  111. <if test="dydm != null and dydm != ''"> and a.dydm = #{dydm}</if>
  112. <if test="dwdm != null and dwdm != ''"> and a.dwdm = #{dwdm}</if>
  113. </select>
  114. </mapper>