HtDpVideoAnalysisMapper.xml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="cn.com.taiji.video.mapper.HtDpVideoAnalysisMapper">
  6. <select id="selectFilter" resultType="AnalysisDTO">
  7. SELECT type,sum(pic_filter_count) AS count FROM `ht_dp_video_analysis`
  8. <where>
  9. <if test="year != null and year != ''">
  10. and `year` = #{year}
  11. </if>
  12. <if test="yearMonth != null and yearMonth != ''">
  13. and `year_month` = #{yearMonth}
  14. </if>
  15. </where>
  16. GROUP BY type
  17. </select>
  18. <select id="selecttotal" resultType="cn.com.taiji.video.model.VideoAnalysisLineDTO">
  19. SELECT
  20. <if test="year != null and year != ''">
  21. t.`year_month` as time,
  22. (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.`year_month` = t.`year_month` and t1.type = 1) as face,
  23. (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.`year_month` = t.`year_month` and t1.type = 2) as car,
  24. (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.`year_month` = t.`year_month` and t1.type = 3) as body
  25. </if>
  26. <if test="yearMonth != null and yearMonth != ''">
  27. t.stat_date as time,
  28. (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.stat_date = t.stat_date and t1.type = 1) as face,
  29. (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.stat_date = t.stat_date and t1.type = 2) as car,
  30. (select sum(pic_filter_count) from `ht_dp_video_analysis` t1 where t1.stat_date = t.stat_date and t1.type = 3) as body
  31. </if>
  32. FROM `ht_dp_video_analysis` t
  33. where
  34. <if test="year != null and year != ''">
  35. t.`year` = #{year}
  36. </if>
  37. <if test="yearMonth != null and yearMonth != ''">
  38. t.`year_month` = #{yearMonth}
  39. </if>
  40. GROUP BY
  41. <if test="year != null and year != ''">
  42. t.`year_month`
  43. </if>
  44. <if test="yearMonth != null and yearMonth != ''">
  45. t.stat_date
  46. </if>
  47. </select>
  48. </mapper>