后台服务
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

2 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 wx_car_cmd_log where cmd_type=#{cmdType}
  67. <if test=" null != tenantId and '' != tenantId">
  68. and `tenant_id` = #{tenantId}
  69. </if>
  70. <if test=" null != parentTenantId and '' != parentTenantId">
  71. and `parent_tenant_id` = #{parentTenantId}
  72. </if>
  73. and create_date BETWEEN #{startdate} and #{enddate}
  74. ) c
  75. group by c.create_date
  76. </select>
  77. <select id="queryHistoryCount" resultType="long" parameterType="hashmap">
  78. select count(id)
  79. from wx_car_cmd_log
  80. where cmd_type in
  81. <foreach collection="cmdTypes" index="index" item="cmdTypeItem" open="(" separator="," close=")">
  82. #{cmdTypeItem}
  83. </foreach>
  84. <if test=" null != tenantId and '' != tenantId">
  85. and `tenant_id` = #{tenantId}
  86. </if>
  87. <if test=" null != parentTenantId and '' != parentTenantId">
  88. and `parent_tenant_id` = #{parentTenantId}
  89. </if>
  90. and create_date BETWEEN #{startdate} and #{enddate}
  91. </select>
  92. <select id="queryTodayCar" resultType="hashmap" parameterType="com.iformall.domain.po.WxCarCmdLog">
  93. select DATE_FORMAT(DATE_ADD(create_date,INTERVAL 1 HOUR),'%H:00') create_time,count(id) carcount
  94. from wx_car_cmd_log where cmd_type in
  95. <foreach collection="cmdTypes" index="index" item="cmdTypeItem" open="(" separator="," close=")">
  96. #{cmdTypeItem}
  97. </foreach>
  98. <if test=" null != tenantId and '' != tenantId">
  99. and `tenant_id` = #{tenantId}
  100. </if>
  101. <if test=" null != parentTenantId and '' != parentTenantId">
  102. and `parent_tenant_id` = #{parentTenantId}
  103. </if>
  104. and create_date BETWEEN #{startdate} and #{enddate}
  105. group by create_time order by create_time
  106. </select>
  107. <select id="queryCarPay" resultType="String" parameterType="hashmap">
  108. select sum(CONVERT(JSON_EXTRACT(cmd_json,'$.fee'), Decimal(16,2))) fee
  109. from wx_car_cmd_log
  110. where cmd_type in
  111. <foreach collection="cmdTypes" index="index" item="cmdTypeItem" open="(" separator="," close=")">
  112. #{cmdTypeItem}
  113. </foreach>
  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. </select>
  122. <select id="queryWeekCarPay" resultType="hashmap" parameterType="hashmap">
  123. select sum(fee) fee,c.create_time from (
  124. select id,DATE_FORMAT(create_date,'%m/%d') create_time,CONVERT(JSON_EXTRACT(cmd_json,'$.fee'), Decimal(16,2)) fee
  125. from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
  126. SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix}
  127. </foreach>) wx_car_cmd_log where cmd_type=#{cmdType}
  128. <if test=" null != tenantId and '' != tenantId">
  129. and `tenant_id` = #{tenantId}
  130. </if>
  131. <if test=" null != parentTenantId and '' != parentTenantId">
  132. and `parent_tenant_id` = #{parentTenantId}
  133. </if>
  134. and REPLACE (JSON_EXTRACT(cmd_json,'$.time'),'"','') BETWEEN #{startdate} and #{enddate}
  135. ) c group by c.create_time order by c.create_time
  136. </select>
  137. <select id="queryForSceneRepotyHistoryCar" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
  138. select DATE_FORMAT(create_date,'%Y-%m-%d') xTime, count(id) triggerCount
  139. from wx_car_cmd_log
  140. where cmd_type in
  141. <foreach collection="cmdTypes" index="index" item="cmdTypeItem" open="(" separator="," close=")">
  142. #{cmdTypeItem}
  143. </foreach>
  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 != startTime and null != endTime">
  151. and create_date BETWEEN #{startTime} and #{endTime}
  152. </if>
  153. group by xTime
  154. </select>
  155. <select id="queryTenantInfoBySynId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog">
  156. select `tenant_id`,`parent_tenant_id` from wx_car_cmd_log
  157. where cmd_type = #{cmdType} and syn_id = #{synId}
  158. <if test=" null != plateNumber">
  159. and plateNumber = #{plateNumber}
  160. </if>
  161. </select>
  162. <select id="queryByOrderId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog">
  163. select *
  164. from wx_car_cmd_log
  165. where 1=1
  166. <if test=" null != tenantId and '' != tenantId">
  167. and `tenant_id` = #{tenantId}
  168. </if>
  169. <if test=" null != parentTenantId and '' != parentTenantId">
  170. and `parent_tenant_id` = #{parentTenantId}
  171. </if>
  172. <if test=" null != cmdType">
  173. and `cmd_type` = #{cmdType}
  174. </if>
  175. <if test=" null != plateNumber">
  176. and `plateNumber` = #{plateNumber}
  177. </if>
  178. <if test=" null != orderId">
  179. and `order_id` = #{orderId}
  180. </if>
  181. <if test=" null != fee">
  182. and JSON_EXTRACT(cmd_json,'$.fee') = #{fee}
  183. </if>
  184. <if test=" null != feeTime">
  185. and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) &lt;= 15
  186. </if>
  187. </select>
  188. <select id="queryBySynId" parameterType="hashmap" resultType="com.iformall.domain.po.WxCarCmdLog">
  189. select *
  190. from wx_car_cmd_log
  191. where 1=1
  192. <if test=" null != tenantId and '' != tenantId">
  193. and `tenant_id` = #{tenantId}
  194. </if>
  195. <if test=" null != parentTenantId and '' != parentTenantId">
  196. and `parent_tenant_id` = #{parentTenantId}
  197. </if>
  198. <if test=" null != plateNumber">
  199. and plateNumber = #{plateNumber}
  200. </if>
  201. <if test=" null != cmdType">
  202. and cmd_type = #{cmdType}
  203. </if>
  204. <if test=" null != synId">
  205. and syn_id = #{synId}
  206. </if>
  207. limit 1
  208. </select>
  209. </mapper>