You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

122 lines
4.1 KiB

  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.iformall.mapper.WxCarCmdLogMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCarCmdLog">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="vendor_type" jdbcType="INTEGER" property="vendorType"/>
  8. <result column="cmd_type" jdbcType="INTEGER" property="cmdType"/>
  9. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  10. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  11. <result column="cmd_json" jdbcType="VARCHAR" property="cmdJson"/>
  12. </resultMap>
  13. <sql id="allColumns">
  14. `id`,`tenant_id`,`vendor_type`,`cmd_type`,`create_date`,`update_date`,`cmd_json`
  15. </sql>
  16. <sql id="dynamicWhereConditions">
  17. where 1 = 1
  18. <if test=" null != id ">
  19. and `id` = #{id}
  20. </if>
  21. <if test=" null != tenantId ">
  22. and `tenant_id` = #{tenantId}
  23. </if>
  24. <if test=" null != vendorType ">
  25. and `vendor_type` = #{vendorType}
  26. </if>
  27. <if test=" null != cmdType ">
  28. and `cmd_type` = #{cmdType}
  29. </if>
  30. <if test=" null != createDate ">
  31. and `create_date` = #{createDate}
  32. </if>
  33. <if test=" null != updateDate ">
  34. and `update_date` = #{updateDate}
  35. </if>
  36. <if test=" null != cmdJson ">
  37. and `cmd_json` like concat('%', #{cmdJson},'%')
  38. </if>
  39. <if test=" null != ids ">
  40. and id in
  41. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  42. #{idItem}
  43. </foreach>
  44. </if>
  45. <if test=" null != sortColumns">order by ${sortColumns}</if>
  46. </sql>
  47. <select id="findList" parameterType="com.iformall.domain.po.WxCarCmdLog" resultMap="BaseResultMap">
  48. select
  49. <include refid="allColumns"/>
  50. from wx_car_cmd_log
  51. <include refid="dynamicWhereConditions"/>
  52. </select>
  53. <select id="queryHistory" resultType="hashmap" parameterType="hashmap">
  54. select count(c.id) carcount,c.create_date from (
  55. select id,DATE_FORMAT(create_date,'%Y-%m-%d') create_date
  56. from wx_car_cmd_log where tenant_id = #{tenantId} and cmd_type=#{cmdType}
  57. and create_date BETWEEN #{startdate} and #{enddate}
  58. ) c
  59. group by c.create_date
  60. </select>
  61. <select id="queryTodayCar" resultType="hashmap" parameterType="hashmap">
  62. select count(c.id) carcount,c.create_time from (
  63. select id,DATE_FORMAT(DATE_ADD(create_date,INTERVAL 1 HOUR),'%H:00') create_time
  64. from wx_car_cmd_log where tenant_id = #{tenantId} and cmd_type=#{cmdType}
  65. and create_date BETWEEN #{startdate} and #{enddate}
  66. ) c group by c.create_time order by c.create_time
  67. </select>
  68. <select id="queryWeekCarPay" resultType="hashmap" parameterType="hashmap">
  69. select count(c.id) carcount,c.create_time from (
  70. select id,DATE_FORMAT(create_date,'%m/%d') create_time
  71. from wx_car_cmd_log where tenant_id = #{tenantId} and cmd_type=#{cmdType}
  72. and create_date BETWEEN #{startdate} and #{enddate}
  73. ) c group by c.create_time order by c.create_time
  74. </select>
  75. <select id="queryForSceneRepotyHistoryCar" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
  76. select DATE_FORMAT(create_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
  77. from wx_car_cmd_log c where tenant_id = #{tenantId} and cmd_type=#{cmdType}
  78. <if test=" null != startTime and null != endTime">
  79. and create_date BETWEEN #{startTime} and #{endTime}
  80. </if>
  81. group by xTime
  82. </select>
  83. <select id="queryPlateNumberList" parameterType="hashmap" resultType="hashmap">
  84. select json_unquote(JSON_EXTRACT(cmd_json,'$.plateNumber')) plateNumber from wx_car_cmd_log where tenant_id=#{tenantId}
  85. <if test=" null != startdate and null != enddate">
  86. and create_date BETWEEN #{startdate} and #{enddate}
  87. </if>
  88. and json_unquote(JSON_EXTRACT(cmd_json,'$.plateNumber')) is not null
  89. group by plateNumber
  90. </select>
  91. <select id="queryTenantIdBySynId" parameterType="hashmap" resultType="String">
  92. select `tenant_id` from wx_car_cmd_log
  93. where cmd_type = 601 and json_extract(cmd_json, "$.synId") = #{synId}
  94. </select>
  95. </mapper>