|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.iformall.mapper.WxCarCmdLogMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCarCmdLog">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
- <result column="vendor_type" jdbcType="INTEGER" property="vendorType"/>
- <result column="cmd_type" jdbcType="INTEGER" property="cmdType"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="cmd_json" jdbcType="VARCHAR" property="cmdJson"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`vendor_type`,`cmd_type`,`create_date`,`update_date`,`cmd_json`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != vendorType ">
- and `vendor_type` = #{vendorType}
- </if>
-
- <if test=" null != cmdType ">
- and `cmd_type` = #{cmdType}
- </if>
-
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and `update_date` = #{updateDate}
- </if>
-
- <if test=" null != cmdJson ">
- and `cmd_json` like concat('%', #{cmdJson},'%')
- </if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select <include refid="allColumns"/> from wx_car_cmd_log where id = #{id} and tenant_id = #{tenantId}
- </select>
-
- <delete id="deleteById" parameterType="java.util.HashMap">
- delete from wx_car_cmd_log where id = #{id} and tenant_id = #{tenantId}
- </delete>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxCarCmdLog" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_car_cmd_log
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="queryHistory" resultType="hashmap" parameterType="hashmap">
- select count(c.id) carcount,c.create_date from (
- select id,DATE_FORMAT(create_date,'%Y-%m-%d') create_date
- from wx_car_cmd_log where cmd_type=#{cmdType}
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and create_date BETWEEN #{startdate} and #{enddate}
- ) c
- group by c.create_date
- </select>
-
- <select id="queryHistoryCount" resultType="long" parameterType="hashmap">
- select count(id)
- from wx_car_cmd_log
- where cmd_type in
- <foreach collection="cmdTypes" index="index" item="cmdTypeItem" open="(" separator="," close=")">
- #{cmdTypeItem}
- </foreach>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and create_date BETWEEN #{startdate} and #{enddate}
- </select>
-
- <select id="queryTodayCar" resultType="hashmap" parameterType="com.iformall.domain.po.WxCarCmdLog">
- select DATE_FORMAT(DATE_ADD(create_date,INTERVAL 1 HOUR),'%H:00') create_time,count(id) carcount
- from wx_car_cmd_log where cmd_type in
- <foreach collection="cmdTypes" index="index" item="cmdTypeItem" open="(" separator="," close=")">
- #{cmdTypeItem}
- </foreach>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and create_date BETWEEN #{startdate} and #{enddate}
- group by create_time order by create_time
- </select>
-
- <select id="queryCarPay" resultType="String" parameterType="hashmap">
- select sum(CONVERT(JSON_EXTRACT(cmd_json,'$.fee'), Decimal(16,2))) fee
- from wx_car_cmd_log
- where cmd_type in
- <foreach collection="cmdTypes" index="index" item="cmdTypeItem" open="(" separator="," close=")">
- #{cmdTypeItem}
- </foreach>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and REPLACE (JSON_EXTRACT(cmd_json,'$.time'),'"','') BETWEEN #{startdate} and #{enddate}
- </select>
-
- <select id="queryWeekCarPay" resultType="hashmap" parameterType="hashmap">
- select sum(fee) fee,c.create_time from (
- select id,DATE_FORMAT(create_date,'%m/%d') create_time,CONVERT(JSON_EXTRACT(cmd_json,'$.fee'), Decimal(16,2)) fee
- from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
- SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix}
- </foreach>) wx_car_cmd_log where cmd_type=#{cmdType}
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and REPLACE (JSON_EXTRACT(cmd_json,'$.time'),'"','') BETWEEN #{startdate} and #{enddate}
- ) c group by c.create_time order by c.create_time
- </select>
-
- <select id="queryForSceneRepotyHistoryCar" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
- select DATE_FORMAT(create_date,'%Y-%m-%d') xTime, count(id) triggerCount
- from wx_car_cmd_log
- where cmd_type in
- <foreach collection="cmdTypes" index="index" item="cmdTypeItem" open="(" separator="," close=")">
- #{cmdTypeItem}
- </foreach>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != startTime and null != endTime">
- and create_date BETWEEN #{startTime} and #{endTime}
- </if>
- group by xTime
- </select>
-
- <select id="queryTenantInfoBySynId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog">
- select `tenant_id`,`parent_tenant_id` from wx_car_cmd_log
- where cmd_type = #{cmdType} and syn_id = #{synId}
- <if test=" null != plateNumber">
- and plateNumber = #{plateNumber}
- </if>
- </select>
-
- <select id="queryByOrderId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog">
- select *
- from wx_car_cmd_log
- where 1=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != cmdType">
- and `cmd_type` = #{cmdType}
- </if>
- <if test=" null != plateNumber">
- and `plateNumber` = #{plateNumber}
- </if>
- <if test=" null != orderId">
- and `order_id` = #{orderId}
- </if>
- <if test=" null != fee">
- and JSON_EXTRACT(cmd_json,'$.fee') = #{fee}
- </if>
- <if test=" null != feeTime">
- and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) <= 15
- </if>
- </select>
-
- <select id="queryBySynId" parameterType="hashmap" resultType="com.iformall.domain.po.WxCarCmdLog">
- select *
- from wx_car_cmd_log
- where 1=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != plateNumber">
- and plateNumber = #{plateNumber}
- </if>
- <if test=" null != cmdType">
- and cmd_type = #{cmdType}
- </if>
- <if test=" null != synId">
- and syn_id = #{synId}
- </if>
- limit 1
- </select>
-
-
- </mapper>
|