No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

234 líneas
8.3 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="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="vendor_type" jdbcType="INTEGER" property="vendorType"/>
  9. <result column="cmd_type" jdbcType="INTEGER" property="cmdType"/>
  10. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  11. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  12. <result column="cmd_json" jdbcType="VARCHAR" property="cmdJson"/>
  13. </resultMap>
  14. <sql id="allColumns">
  15. `id`,`tenant_id`,`parent_tenant_id`,`vendor_type`,`cmd_type`,`create_date`,`update_date`,`cmd_json`
  16. </sql>
  17. <sql id="dynamicWhereConditions">
  18. where 1 = 1
  19. <if test=" null != id ">
  20. and `id` = #{id}
  21. </if>
  22. <if test=" null != tenantId and '' != tenantId">
  23. and `tenant_id` = #{tenantId}
  24. </if>
  25. <if test=" null != parentTenantId and '' != parentTenantId">
  26. and `parent_tenant_id` = #{parentTenantId}
  27. </if>
  28. <if test=" null != vendorType ">
  29. and `vendor_type` = #{vendorType}
  30. </if>
  31. <if test=" null != cmdType ">
  32. and `cmd_type` = #{cmdType}
  33. </if>
  34. <if test=" null != createDate ">
  35. and `create_date` = #{createDate}
  36. </if>
  37. <if test=" null != updateDate ">
  38. and `update_date` = #{updateDate}
  39. </if>
  40. <if test=" null != cmdJson ">
  41. and `cmd_json` like concat('%', #{cmdJson},'%')
  42. </if>
  43. <if test=" null != ids ">
  44. and id in
  45. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  46. #{idItem}
  47. </foreach>
  48. </if>
  49. <if test=" null != sortColumns">order by ${sortColumns}</if>
  50. </sql>
  51. <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  52. select <include refid="allColumns"/> from wx_car_cmd_log where id = #{id} and tenant_id = #{tenantId}
  53. </select>
  54. <delete id="deleteById" parameterType="java.util.HashMap">
  55. delete from wx_car_cmd_log where id = #{id} and tenant_id = #{tenantId}
  56. </delete>
  57. <select id="findList" parameterType="com.iformall.domain.po.WxCarCmdLog" resultMap="BaseResultMap">
  58. select
  59. <include refid="allColumns"/>
  60. from wx_car_cmd_log
  61. <include refid="dynamicWhereConditions"/>
  62. </select>
  63. <select id="queryHistory" resultType="hashmap" parameterType="hashmap">
  64. select count(c.id) carcount,c.create_date from (
  65. select id,DATE_FORMAT(create_date,'%Y-%m-%d') create_date
  66. from
  67. (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
  68. SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix}
  69. </foreach>) wx_car_cmd_log where cmd_type=#{cmdType}
  70. <if test=" null != tenantId and '' != tenantId">
  71. and `tenant_id` = #{tenantId}
  72. </if>
  73. <if test=" null != parentTenantId and '' != parentTenantId">
  74. and `parent_tenant_id` = #{parentTenantId}
  75. </if>
  76. and create_date BETWEEN #{startdate} and #{enddate}
  77. ) c
  78. group by c.create_date
  79. </select>
  80. <select id="queryTodayCar" resultType="hashmap" parameterType="hashmap">
  81. select count(c.id) carcount,c.create_time from (
  82. select id,DATE_FORMAT(DATE_ADD(create_date,INTERVAL 1 HOUR),'%H:00') create_time
  83. from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
  84. SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix}
  85. </foreach>) wx_car_cmd_log where cmd_type=#{cmdType}
  86. <if test=" null != tenantId and '' != tenantId">
  87. and `tenant_id` = #{tenantId}
  88. </if>
  89. <if test=" null != parentTenantId and '' != parentTenantId">
  90. and `parent_tenant_id` = #{parentTenantId}
  91. </if>
  92. and create_date BETWEEN #{startdate} and #{enddate}
  93. ) c group by c.create_time order by c.create_time
  94. </select>
  95. <select id="queryWeekCarPayCount" resultType="Long" parameterType="hashmap">
  96. select count(id)
  97. from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
  98. SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix}
  99. </foreach>) wx_car_cmd_log where cmd_type=#{cmdType}
  100. <if test=" null != tenantId and '' != tenantId">
  101. and `tenant_id` = #{tenantId}
  102. </if>
  103. <if test=" null != parentTenantId and '' != parentTenantId">
  104. and `parent_tenant_id` = #{parentTenantId}
  105. </if>
  106. and create_date BETWEEN #{startdate} and #{enddate}
  107. </select>
  108. <select id="queryWeekCarPay" resultType="hashmap" parameterType="hashmap">
  109. select sum(fee) fee,c.create_time from (
  110. select id,DATE_FORMAT(create_date,'%m/%d') create_time,CONVERT(JSON_EXTRACT(cmd_json,'$.fee'), Decimal(16,2)) fee
  111. from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
  112. SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix}
  113. </foreach>) wx_car_cmd_log where cmd_type=#{cmdType}
  114. <if test=" null != tenantId and '' != tenantId">
  115. and `tenant_id` = #{tenantId}
  116. </if>
  117. <if test=" null != parentTenantId and '' != parentTenantId">
  118. and `parent_tenant_id` = #{parentTenantId}
  119. </if>
  120. and REPLACE (JSON_EXTRACT(cmd_json,'$.time'),'"','') BETWEEN #{startdate} and #{enddate}
  121. ) c group by c.create_time order by c.create_time
  122. </select>
  123. <select id="queryForSceneRepotyHistoryCar" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
  124. select DATE_FORMAT(ccl.create_date,'%Y-%m-%d') xTime, count(ccl.id) triggerCount
  125. from wx_c_user_car cuc, wx_car_cmd_log ccl
  126. where ccl.plateNumber = cuc.car_number and cmd_type=#{cmdType}
  127. <if test=" null != tenantId and '' != tenantId">
  128. and cuc.`tenant_id` = #{tenantId}
  129. and ccl.`tenant_id` = #{tenantId}
  130. </if>
  131. <if test=" null != parentTenantId and '' != parentTenantId">
  132. and cuc.`parent_tenant_id` = #{parentTenantId}
  133. and ccl.`parent_tenant_id` = #{parentTenantId}
  134. </if>
  135. <if test=" null != startTime and null != endTime">
  136. and create_date BETWEEN #{startTime} and #{endTime}
  137. </if>
  138. group by xTime
  139. </select>
  140. <select id="queryPlateNumberList" parameterType="hashmap" resultType="hashmap">
  141. select json_unquote(JSON_EXTRACT(cmd_json,'$.plateNumber')) plateNumber from wx_car_cmd_log where 1=1
  142. <if test=" null != tenantId and '' != tenantId">
  143. and `tenant_id` = #{tenantId}
  144. </if>
  145. <if test=" null != parentTenantId and '' != parentTenantId">
  146. and `parent_tenant_id` = #{parentTenantId}
  147. </if>
  148. <if test=" null != startdate and null != enddate">
  149. and create_date BETWEEN #{startdate} and #{enddate}
  150. </if>
  151. and json_unquote(JSON_EXTRACT(cmd_json,'$.plateNumber')) is not null
  152. group by plateNumber
  153. </select>
  154. <select id="queryTenantInfoBySynId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog">
  155. select `tenant_id`,`parent_tenant_id` from wx_car_cmd_log
  156. where cmd_type = #{cmdType} and syn_id = #{synId}
  157. <if test=" null != plateNumber">
  158. and plateNumber = #{plateNumber}
  159. </if>
  160. </select>
  161. <select id="queryByOrderId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog">
  162. select *
  163. from wx_car_cmd_log
  164. where 1=1
  165. <if test=" null != tenantId and '' != tenantId">
  166. and `tenant_id` = #{tenantId}
  167. </if>
  168. <if test=" null != parentTenantId and '' != parentTenantId">
  169. and `parent_tenant_id` = #{parentTenantId}
  170. </if>
  171. <if test=" null != cmdType">
  172. and `cmd_type` = #{cmdType}
  173. </if>
  174. <if test=" null != plateNumber">
  175. and `plateNumber` = #{plateNumber}
  176. </if>
  177. <if test=" null != orderId">
  178. and `order_id` = #{orderId}
  179. </if>
  180. <if test=" null != fee">
  181. and JSON_EXTRACT(cmd_json,'$.fee') = #{fee}
  182. </if>
  183. <if test=" null != feeTime">
  184. and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) &lt;= 15
  185. </if>
  186. </select>
  187. <select id="queryBySynId" parameterType="hashmap" resultType="com.iformall.domain.po.WxCarCmdLog">
  188. select *
  189. from wx_car_cmd_log
  190. where 1=1
  191. <if test=" null != tenantId and '' != tenantId">
  192. and `tenant_id` = #{tenantId}
  193. </if>
  194. <if test=" null != parentTenantId and '' != parentTenantId">
  195. and `parent_tenant_id` = #{parentTenantId}
  196. </if>
  197. <if test=" null != plateNumber">
  198. and plateNumber = #{plateNumber}
  199. </if>
  200. <if test=" null != cmdType">
  201. and cmd_type = #{cmdType}
  202. </if>
  203. <if test=" null != synId">
  204. and syn_id = #{synId}
  205. </if>
  206. limit 1
  207. </select>
  208. </mapper>