Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

168 строки
5.6 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="queryWeekCarPayCount" resultType="Long" parameterType="hashmap">
  69. select count(id)
  70. from wx_car_cmd_log where tenant_id = #{tenantId} and cmd_type=#{cmdType}
  71. and create_date BETWEEN #{startdate} and #{enddate}
  72. </select>
  73. <select id="queryWeekCarPay" resultType="hashmap" parameterType="hashmap">
  74. select sum(fee) fee,c.create_time from (
  75. select id,DATE_FORMAT(create_date,'%m/%d') create_time,CONVERT(JSON_EXTRACT(cmd_json,'$.fee'), Decimal(16,2)) fee
  76. from wx_car_cmd_log where tenant_id = #{tenantId} and cmd_type=#{cmdType}
  77. and REPLACE (JSON_EXTRACT(cmd_json,'$.time'),'"','') BETWEEN #{startdate} and #{enddate}
  78. ) c group by c.create_time order by c.create_time
  79. </select>
  80. <select id="queryForSceneRepotyHistoryCar" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
  81. select DATE_FORMAT(ccl.create_date,'%Y-%m-%d') xTime, count(ccl.id) triggerCount
  82. from wx_c_user_car cuc, wx_car_cmd_log ccl
  83. where cuc.tenant_id = #{tenantId}
  84. and ccl.tenant_id = #{tenantId}
  85. and ccl.plateNumber = cuc.car_number
  86. and cmd_type=#{cmdType}
  87. <if test=" null != startTime and null != endTime">
  88. and create_date BETWEEN #{startTime} and #{endTime}
  89. </if>
  90. group by xTime
  91. </select>
  92. <select id="queryPlateNumberList" parameterType="hashmap" resultType="hashmap">
  93. select json_unquote(JSON_EXTRACT(cmd_json,'$.plateNumber')) plateNumber from wx_car_cmd_log where tenant_id=#{tenantId}
  94. <if test=" null != startdate and null != enddate">
  95. and create_date BETWEEN #{startdate} and #{enddate}
  96. </if>
  97. and json_unquote(JSON_EXTRACT(cmd_json,'$.plateNumber')) is not null
  98. group by plateNumber
  99. </select>
  100. <select id="queryTenantIdBySynId" parameterType="hashmap" resultType="String">
  101. select `tenant_id` from wx_car_cmd_log
  102. where cmd_type = 601 and syn_id = #{synId}
  103. <if test=" null != plateNumber">
  104. and plateNumber = #{plateNumber}
  105. </if>
  106. </select>
  107. <select id="queryByOrderId" parameterType="hashmap" resultType="com.iformall.domain.po.WxCarCmdLog">
  108. select *
  109. from wx_car_cmd_log
  110. where cmd_type = 604
  111. <if test=" null != tenantId">
  112. and tenant_id = #{tenantId}
  113. </if>
  114. <if test=" null != plateNumber">
  115. and plateNumber = #{plateNumber}
  116. </if>
  117. <if test=" null != orderId">
  118. and order_id = #{orderId}
  119. </if>
  120. <if test=" null != fee">
  121. and JSON_EXTRACT(cmd_json,'$.fee') = #{fee}
  122. </if>
  123. <if test=" null != feeTime">
  124. and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) &lt;= 15
  125. </if>
  126. </select>
  127. <select id="queryBySynId" parameterType="hashmap" resultType="com.iformall.domain.po.WxCarCmdLog">
  128. select *
  129. from wx_car_cmd_log
  130. where 1=1
  131. <if test=" null != tenantId">
  132. and tenant_id = #{tenantId}
  133. </if>
  134. <if test=" null != plateNumber">
  135. and plateNumber = #{plateNumber}
  136. </if>
  137. <if test=" null != cmdType">
  138. and cmd_type = #{cmdType}
  139. </if>
  140. <if test=" null != synId">
  141. and syn_id = #{synId}
  142. </if>
  143. limit 1
  144. </select>
  145. </mapper>