Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

236 righe
8.5 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, (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
  126. SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix}
  127. </foreach>) ccl
  128. where ccl.plateNumber = cuc.car_number and cmd_type=#{cmdType}
  129. <if test=" null != tenantId and '' != tenantId">
  130. and cuc.`tenant_id` = #{tenantId}
  131. and ccl.`tenant_id` = #{tenantId}
  132. </if>
  133. <if test=" null != parentTenantId and '' != parentTenantId">
  134. and cuc.`parent_tenant_id` = #{parentTenantId}
  135. and ccl.`parent_tenant_id` = #{parentTenantId}
  136. </if>
  137. <if test=" null != startTime and null != endTime">
  138. and create_date BETWEEN #{startTime} and #{endTime}
  139. </if>
  140. group by xTime
  141. </select>
  142. <select id="queryPlateNumberList" parameterType="hashmap" resultType="hashmap">
  143. select json_unquote(JSON_EXTRACT(cmd_json,'$.plateNumber')) plateNumber from wx_car_cmd_log where 1=1
  144. <if test=" null != tenantId and '' != tenantId">
  145. and `tenant_id` = #{tenantId}
  146. </if>
  147. <if test=" null != parentTenantId and '' != parentTenantId">
  148. and `parent_tenant_id` = #{parentTenantId}
  149. </if>
  150. <if test=" null != startdate and null != enddate">
  151. and create_date BETWEEN #{startdate} and #{enddate}
  152. </if>
  153. and json_unquote(JSON_EXTRACT(cmd_json,'$.plateNumber')) is not null
  154. group by plateNumber
  155. </select>
  156. <select id="queryTenantInfoBySynId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog">
  157. select `tenant_id`,`parent_tenant_id` from wx_car_cmd_log
  158. where cmd_type = #{cmdType} and syn_id = #{synId}
  159. <if test=" null != plateNumber">
  160. and plateNumber = #{plateNumber}
  161. </if>
  162. </select>
  163. <select id="queryByOrderId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog">
  164. select *
  165. from wx_car_cmd_log
  166. where 1=1
  167. <if test=" null != tenantId and '' != tenantId">
  168. and `tenant_id` = #{tenantId}
  169. </if>
  170. <if test=" null != parentTenantId and '' != parentTenantId">
  171. and `parent_tenant_id` = #{parentTenantId}
  172. </if>
  173. <if test=" null != cmdType">
  174. and `cmd_type` = #{cmdType}
  175. </if>
  176. <if test=" null != plateNumber">
  177. and `plateNumber` = #{plateNumber}
  178. </if>
  179. <if test=" null != orderId">
  180. and `order_id` = #{orderId}
  181. </if>
  182. <if test=" null != fee">
  183. and JSON_EXTRACT(cmd_json,'$.fee') = #{fee}
  184. </if>
  185. <if test=" null != feeTime">
  186. and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) &lt;= 15
  187. </if>
  188. </select>
  189. <select id="queryBySynId" parameterType="hashmap" resultType="com.iformall.domain.po.WxCarCmdLog">
  190. select *
  191. from wx_car_cmd_log
  192. where 1=1
  193. <if test=" null != tenantId and '' != tenantId">
  194. and `tenant_id` = #{tenantId}
  195. </if>
  196. <if test=" null != parentTenantId and '' != parentTenantId">
  197. and `parent_tenant_id` = #{parentTenantId}
  198. </if>
  199. <if test=" null != plateNumber">
  200. and plateNumber = #{plateNumber}
  201. </if>
  202. <if test=" null != cmdType">
  203. and cmd_type = #{cmdType}
  204. </if>
  205. <if test=" null != synId">
  206. and syn_id = #{synId}
  207. </if>
  208. limit 1
  209. </select>
  210. </mapper>