DataMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.fdkankan.manage.mapper.IDataMapper">
  4. <select id="totalSceneCount" resultType="java.lang.Long">
  5. SELECT count(1) from t_scene_plus s
  6. left join jy_user jy on s.user_id = jy.user_id
  7. left join t_camera_detail d on s.camera_id = d.camera_id
  8. <include refid="commonWhere"></include>
  9. </select>
  10. <select id="totalUserCount" resultType="java.lang.Long">
  11. select count(1) from jy_user
  12. where rec_status = 'A'
  13. <if test="param.userId != null">
  14. and user_id =#{param.userId}
  15. </if>
  16. <if test="param.platformId != null">
  17. and platform_id =#{param.platformId}
  18. </if>
  19. </select>
  20. <select id="totalSceneUserCount" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  21. SELECT s.user_id as id,count(1) as count from t_scene_plus s
  22. left join jy_user jy on s.user_id = jy.user_id
  23. left join t_camera_detail d on s.camera_id = d.camera_id
  24. where s.rec_status = 'A'
  25. <if test="param.userId != null">
  26. and s.user_id =#{param.userId}
  27. </if>
  28. <if test="param.platformId != null">
  29. and jy.platform_id =#{param.platformId}
  30. </if>
  31. <if test="param.cameraType!=null ">
  32. and d.type = #{param.cameraType}
  33. </if>
  34. GROUP BY s.user_id
  35. </select>
  36. <select id="getSceneGroupByDay" resultType="com.fdkankan.manage.vo.response.GroupByCountVo">
  37. SELECT DATE(s.create_time) as groupKey,count(1) as totalCount from t_scene_plus s
  38. left join jy_user jy on s.user_id = jy.user_id
  39. left join t_camera_detail d on s.camera_id = d.camera_id
  40. <include refid="commonWhere"></include>
  41. GROUP BY DATE(s.create_time)
  42. </select>
  43. <select id="getUserGroupByDay" resultType="com.fdkankan.manage.vo.response.GroupByCountVo">
  44. SELECT DATE(s.create_time) as groupKey,s.user_id,count(1) as totalCount from t_scene_plus s
  45. left join jy_user jy on s.user_id = jy.user_id
  46. left join t_camera_detail d on s.camera_id = d.camera_id
  47. <include refid="commonWhere"></include>
  48. GROUP BY DATE(s.create_time), s.user_id
  49. </select>
  50. <select id="getSceneGroupByDistrict" resultType="com.fdkankan.manage.vo.response.GroupByCountVo">
  51. SELECT s.district_code as groupKey,count(1) as totalCount from t_scene_plus s
  52. left join jy_user jy on s.user_id = jy.user_id
  53. left join t_camera_detail d on s.camera_id = d.camera_id
  54. <include refid="commonWhere"></include>
  55. GROUP BY s.district_code
  56. </select>
  57. <select id="getExPortSceneList" resultType="com.fdkankan.manage.vo.response.ExportSceneList">
  58. select s.title,jy.ry_nick_name,jy.ry_no,a.sn_code, s.create_time ,e.shoot_count,s.k_no
  59. from t_scene_plus s LEFT JOIN t_scene_plus_ext e on s.id =e.plus_id
  60. left join jy_user jy on s.user_id = jy.user_id
  61. left join t_camera a on s.camera_id = a.id
  62. left join t_camera_detail d on s.camera_id = d.camera_id
  63. <include refid="commonWhere"></include>
  64. <if test="param.districtCodeList!=null and param.districtCodeList.size >0">
  65. and s.district_code in
  66. <foreach item="districtCode" collection="param.districtCodeList" open="(" separator="," close=")">
  67. #{districtCode}
  68. </foreach>
  69. </if>
  70. <if test="param.cameraTypeList!=null and param.cameraTypeList.size >0">
  71. and d.type in
  72. <foreach item="type" collection="param.cameraTypeList" open="(" separator="," close=")">
  73. #{type}
  74. </foreach>
  75. </if>
  76. </select>
  77. <select id="getLastSceneBuildTime" resultType="java.lang.String">
  78. SELECT max(e.algorithm_time) from t_scene_plus s
  79. LEFT JOIN t_scene_plus_ext e on s.id =e.plus_id
  80. left join jy_user jy on s.user_id = jy.user_id
  81. left join t_camera_detail d on s.camera_id = d.camera_id
  82. <include refid="commonWhere"></include>
  83. and s.create_time is not null
  84. </select>
  85. <sql id="commonWhere">
  86. where s.rec_status = 'A'
  87. <if test="param.userId != null">
  88. and s.user_id =#{param.userId}
  89. </if>
  90. <if test="param.platformId != null">
  91. and jy.platform_id =#{param.platformId}
  92. </if>
  93. <if test="param.startTime != null and param.startTime!=''">
  94. and s.create_time &gt;=#{param.startTime}
  95. </if>
  96. <if test="param.endTime != null and param.endTime!=''">
  97. and s.create_time &lt;=#{param.endTime}
  98. </if>
  99. <if test="param.districtCode!=null and param.districtCode != ''">
  100. and s.district_code = #{param.districtCode}
  101. </if>
  102. <if test="param.cameraType!=null ">
  103. and d.type = #{param.cameraType}
  104. </if>
  105. </sql>
  106. </mapper>