FireStatisticsMapper.xml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.bizmatics.mhfire.persistence.mapper.FireStatisticsMapper">
  4. <select id="selectCount" resultType="java.lang.Integer">
  5. select count(1)
  6. from `hzdc-hztjb`
  7. <where>
  8. <if test="startTime != null">
  9. and `起火时间_日期型` >= #{startTime}
  10. </if>
  11. <if test="endTime != null">
  12. and `起火时间_日期型` &lt;= #{endTime}
  13. </if>
  14. <if test="fireAddress != null and fireAddress != ''">
  15. and `起火地点` LIKE CONCAT(CONCAT('%', #{fireAddress}), '%')
  16. </if>
  17. <if test="level != null and level != ''">
  18. and `火灾原因分类(一级)` = #{level}
  19. </if>
  20. <if test="unitId != null and unitId != ''">
  21. and `单位代码` = #{unitId}
  22. </if>
  23. </where>
  24. </select>
  25. <select id="page" resultType="java.util.Map">
  26. select *
  27. from `hzdc-hztjb`
  28. <where>
  29. <if test="startTime != null">
  30. and `起火时间_日期型` >= #{startTime}
  31. </if>
  32. <if test="endTime !=null">
  33. and `起火时间_日期型` &lt;= #{endTime}
  34. </if>
  35. <if test="address !=null and address !=''">
  36. and `起火地点` LIKE CONCAT(CONCAT('%', #{address}), '%')
  37. </if>
  38. </where>
  39. order by isnull(`死亡人数`) || `死亡人数`='null' || `死亡人数`='' asc,`死亡人数` desc
  40. </select>
  41. <select id="getOne" resultType="java.util.Map">
  42. select * from `hzdc-hztjb` where `火灾序号` = #{id};
  43. </select>
  44. <select id="groupByCause" resultType="java.lang.String">
  45. select `火灾原因分类(一级)` from `hzdc-hztjb` group by `火灾原因分类(一级)`
  46. </select>
  47. <select id="getAddress" resultType="java.lang.String">
  48. select `行政区域` from `hzdc-hztjb` group by `行政区域`
  49. </select>
  50. <select id="selectMaxDate" resultType="java.util.Date">
  51. select max(`起火时间_日期型`) from `hzdc-hztjb`
  52. </select>
  53. <select id="selectMinDate" resultType="java.util.Date">
  54. select min(`起火时间_日期型`) from `hzdc-hztjb`
  55. </select>
  56. <select id="selectCountByRangeDate" resultType="java.lang.Integer">
  57. select count(1)
  58. from `hzdc-hztjb`
  59. <where>
  60. <if test="address != null and address != ''">
  61. and `起火地点` LIKE CONCAT(CONCAT('%', #{address}), '%')
  62. </if>
  63. <if test="fireType != null and fireType != ''">
  64. and `火灾原因分类(一级)` = #{fireType}
  65. </if>
  66. <if test="startTime != null and endTime != null">
  67. and `起火时间_日期型` between STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
  68. and STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
  69. </if>
  70. and Month(`起火时间_日期型`) = #{month}
  71. </where>
  72. </select>
  73. </mapper>