GoafHdangerStatisMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.zhyc.xps.goaf.mapper.GoafHdangerStatisMapper">
  4. <!--列表查询-->
  5. <select id="getStatisNum" parameterType="java.util.Map" resultType="com.zhyc.xps.goaf.vo.HdangerStatisVo">
  6. SELECT
  7. IFNULL(SUM( CASE WHEN hdanger_level = 0 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerLevelLowerNum',
  8. IFNULL(SUM( CASE WHEN hdanger_level = 1 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerLevelGeneralNum',
  9. IFNULL(SUM( CASE WHEN hdanger_level = 2 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerLevelMajorNum',
  10. IFNULL(SUM( CASE WHEN hdanger_level = 3 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerLevelSeriousNum',
  11. IFNULL(SUM( CASE WHEN status = 0 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerStatusTosubmitNum',
  12. IFNULL(SUM( CASE WHEN status = 1 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerStatusToforreviewlNum',
  13. IFNULL(SUM( CASE WHEN status = 2 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerStatusTorectifyNum',
  14. IFNULL(SUM( CASE WHEN status = 3 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerStatusToacceptNum',
  15. IFNULL(SUM( CASE WHEN status = 4 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerStatusCompleteNum',
  16. IFNULL(SUM( CASE WHEN status = -1 THEN 1 ELSE 0 END ), 0) AS 'goafHdangerStatusCancelNum'
  17. FROM goaf_hdanger AS A
  18. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.status != -1
  19. <!-- <if test="keywords != null and keywords != ''">-->
  20. <!-- AND A.hdanger_id like "%"#{keyword}"%"-->
  21. <!-- </if>-->
  22. <if test="submitAccountId != null">
  23. AND A.submit_account_id = #{submitAccountId ,jdbcType=BIGINT}
  24. </if>
  25. <if test="submitGroupId != null">
  26. AND A.submit_group_id = #{submitGroupId ,jdbcType=BIGINT}
  27. </if>
  28. <if test="hdangerType != null">
  29. AND A.hdanger_type = #{hdangerType ,jdbcType=BIGINT}
  30. </if>
  31. <if test="hdangerLevel != null">
  32. AND A.hdanger_level = #{hdangerLevel ,jdbcType=BIGINT}
  33. </if>
  34. <if test="reviewAccountId != null">
  35. AND A.review_account_id = #{reviewAccountId ,jdbcType=BIGINT}
  36. </if>
  37. <if test="reviewGroupId != null">
  38. AND A.review_group_id = #{reviewGroupId ,jdbcType=BIGINT}
  39. </if>
  40. <if test="rectifyAccountId != null">
  41. AND A.rectify_account_id = #{rectifyAccountId ,jdbcType=BIGINT}
  42. </if>
  43. <if test="rectifyGroupId != null">
  44. AND A.rectify_group_id = #{rectifyGroupId ,jdbcType=BIGINT}
  45. </if>
  46. <if test="acceptAccountId != null">
  47. AND A.accept_account_id = #{acceptAccountId ,jdbcType=BIGINT}
  48. </if>
  49. <if test="acceptGroupId != null">
  50. AND A.accept_group_id = #{acceptGroupId ,jdbcType=BIGINT}
  51. </if>
  52. <if test="status != null">
  53. AND A.status = #{status ,jdbcType=BIGINT}
  54. </if>
  55. <if test="startSubmitTime != null and endSubmitTime != null">
  56. <![CDATA[
  57. AND A.submit_time >= #{startSubmitTime, jdbcType=TIMESTAMP}
  58. AND A.submit_time <= #{endSubmitTime, jdbcType=TIMESTAMP}
  59. ]]>
  60. </if>
  61. <if test="handleAccountId != null">
  62. AND (
  63. A.submit_account_id = #{submitAccountId ,jdbcType=BIGINT}
  64. OR
  65. A.review_account_id = #{handleAccountId ,jdbcType=BIGINT}
  66. OR
  67. A.rectify_account_id = #{handleAccountId ,jdbcType=BIGINT}
  68. OR
  69. A.accept_account_id = #{handleAccountId ,jdbcType=BIGINT}
  70. )
  71. </if>
  72. <if test="handleGroupId != null">
  73. AND (
  74. A.submit_group_id = #{submitGroupId ,jdbcType=BIGINT}
  75. OR
  76. A.review_group_id = #{handleGroupId ,jdbcType=BIGINT}
  77. OR
  78. A.rectify_group_id = #{handleGroupId ,jdbcType=BIGINT}
  79. OR
  80. A.accept_group_id = #{handleGroupId ,jdbcType=BIGINT}
  81. )
  82. </if>
  83. ORDER BY A.submit_time DESC
  84. </select>
  85. </mapper>