<?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.stylefeng.guns.modular.system.dao.TCompanyMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TCompany">
|
<id column="id" property="id" />
|
<result column="isSpe" property="isSpe" />
|
<result column="isTaxi" property="isTaxi" />
|
<result column="isCross" property="isCross" />
|
<result column="isCrossLogistics" property="isCrossLogistics" />
|
<result column="isSameLogistics" property="isSameLogistics" />
|
<result column="isCharter" property="isCharter" />
|
<result column="isSpeFixedOrProportional" property="isSpeFixedOrProportional" />
|
<result column="isTaxiFixedOrProportional" property="isTaxiFixedOrProportional" />
|
<result column="isCrossLogisticsFixedOrProportional" property="isCrossLogisticsFixedOrProportional" />
|
<result column="isSameLogisticsFixedOrProportional" property="isSameLogisticsFixedOrProportional" />
|
<result column="speMoney" property="speMoney" />
|
<result column="taxiMoney" property="taxiMoney" />
|
<result column="crossLogisticsMoney" property="crossLogisticsMoney" />
|
<result column="sameLogisticsMoney" property="sameLogisticsMoney" />
|
<result column="isNeedFerry" property="isNeedFerry" />
|
<result column="name" property="name" />
|
<result column="type" property="type" />
|
<result column="superiorId" property="superiorId" />
|
<result column="principalName" property="principalName" />
|
<result column="principalPhone" property="principalPhone" />
|
<result column="adminName" property="adminName" />
|
<result column="adminPhone" property="adminPhone" />
|
<result column="urgentPhoen" property="urgentPhoen" />
|
<result column="setupTime" property="setupTime" />
|
<result column="identifier" property="identifier" />
|
<result column="addressCode" property="addressCode" />
|
<result column="businessScope" property="businessScope" />
|
<result column="contactAddress" property="contactAddress" />
|
<result column="documentAddress" property="documentAddress" />
|
<result column="economicType" property="economicType" />
|
<result column="regCapital" property="regCapital" />
|
<result column="legalName" property="legalName" />
|
<result column="legalId" property="legalId" />
|
<result column="legalPhone" property="legalPhone" />
|
<result column="legalPhotoUrl" property="legalPhotoUrl" />
|
<result column="licensingAgency" property="licensingAgency" />
|
<result column="licenseTime" property="licenseTime" />
|
<result column="licenseStartTime" property="licenseStartTime" />
|
<result column="licenseEndTime" property="licenseEndTime" />
|
<result column="licenseNumber" property="licenseNumber" />
|
<result column="carNum" property="carNum" />
|
<result column="driverNum" property="driverNum" />
|
<result column="mac" property="mac" />
|
<result column="state" property="state" />
|
<result column="flag" property="flag" />
|
<result column="upload" property="upload" />
|
<result column="insertTime" property="insertTime" />
|
<result column="detailAddress" property="detailAddress" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, isSpe, isTaxi, isCross, isCrossLogistics, isSameLogistics, isCharter, isSpeFixedOrProportional, isTaxiFixedOrProportional, isCrossLogisticsFixedOrProportional, isSameLogisticsFixedOrProportional, speMoney, taxiMoney, crossLogisticsMoney, sameLogisticsMoney, isNeedFerry, name, type, superiorId, principalName, principalPhone, adminName, adminPhone, urgentPhoen, setupTime, identifier, addressCode, businessScope, contactAddress, documentAddress, economicType, regCapital, legalName, legalId, legalPhone, legalPhotoUrl, licensingAgency, licenseTime, licenseStartTime, licenseEndTime, licenseNumber, carNum, driverNum, mac, state, flag, upload, insertTime, detailAddress
|
</sql>
|
|
|
<!--根据条件查询分公司列表-->
|
<select id="getCompanyList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
|
SELECT * FROM (SELECT ui.account,IFNULL(ci.num,0) as franchiseeNum,IFNULL(ca.num,0) as carNumber,IFNULL(di.num,0) as driverNumber,
|
CONCAT(case when cc.isSpe = 1 then '专车,' else '' end,
|
case when cc.isTaxi = 1 then '出租车,' else '' end,
|
case when cc.isCross = 1 then '跨城出行,' else '' end,
|
case when cc.isCrossLogistics = 1 then '跨城小件物流,' else '' end,
|
case when cc.isSameLogistics = 1 then '同城小件物流,' else '' end,
|
case when cc.isCharter = 1 then '包车,' else '' end) as serverStr,
|
cc.* FROM t_company as cc
|
LEFT JOIN (SELECT * FROM sys_user where roleType = 2) as ui on ui.objectId = cc.id
|
LEFT JOIN (SELECT COUNT(id) as num,superiorId FROM t_company where type = 3 and flag != 3 GROUP BY superiorId) as ci on ci.superiorId = cc.id
|
LEFT JOIN (SELECT COUNT(id) as num,companyId FROM t_car where state = 1 GROUP BY companyId) as ca on ca.companyId = cc.id
|
LEFT JOIN (SELECT COUNT(id) as num,companyId FROM t_driver where flag != 3 GROUP BY companyId) as di on di.companyId = cc.id
|
) as o
|
<where>
|
o.type = 2 and o.flag != 3
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
AND (o.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
|
</if>
|
<if test="name != null and name != ''">
|
and o.name LIKE CONCAT('%',#{name},'%')
|
</if>
|
<if test="principalName != null and principalName != ''">
|
and o.principalName LIKE CONCAT('%',#{principalName},'%')
|
</if>
|
<if test="principalPhone != null and principalPhone != ''">
|
and o.principalPhone LIKE CONCAT('%',#{principalPhone},'%')
|
</if>
|
<if test="adminName != null and adminName != ''">
|
and o.adminName LIKE CONCAT('%',#{adminName},'%')
|
</if>
|
<if test="adminPhone != null and adminPhone != ''">
|
and o.adminPhone LIKE CONCAT('%',#{adminPhone},'%')
|
</if>
|
<if test="serviceStr != null and serviceStr != ''">
|
and o.serverStr LIKE CONCAT('%',#{serviceStr},'%')
|
</if>
|
<if test="state != null and state != '' and state == 1">
|
and o.state = 1
|
</if>
|
<if test="state != null and state != '' and state == 2">
|
and o.state = 0
|
</if>
|
</where>
|
order by o.id desc
|
</select>
|
|
<!--根据公司ID获取公司经营区域-->
|
<select id="getCompanyScopeById" resultType="map">
|
SELECT CONCAT(case when r1.`name` is not null then r1.`name` else '' end,
|
case when r2.`name` is not null then r2.`name` else '' end,
|
case when r3.`name` is not null then r3.`name` else '' end) as value,cc.* FROM t_company_city as cc
|
LEFT JOIN t_region as r1 on r1.code = cc.provinceCode
|
LEFT JOIN t_region as r2 on r2.code = cc.cityCode
|
LEFT JOIN t_region as r3 on r3.code = cc.areaCode
|
where cc.companyId = #{id} and cc.state = 1 order by id asc
|
</select>
|
|
<!--根据条件查询加盟商列表-->
|
<select id="getFranchiseeList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
|
SELECT * FROM (SELECT ui.account,ci.`name` as companyName,IFNULL(ca.num,0) as carNumber,IFNULL(di.num,0) as driverNumber,
|
CONCAT(case when cc.isSpe = 1 then '专车,' else '' end,
|
case when cc.isTaxi = 1 then '出租车,' else '' end,
|
case when cc.isCross = 1 then '跨城出行,' else '' end,
|
case when cc.isCrossLogistics = 1 then '跨城小件物流,' else '' end,
|
case when cc.isSameLogistics = 1 then '同城小件物流,' else '' end,
|
case when cc.isCharter = 1 then '包车,' else '' end) as serverStr,
|
cc.* FROM t_company as cc
|
LEFT JOIN (SELECT * FROM sys_user where roleType = 3) as ui on ui.objectId = cc.id
|
LEFT JOIN (select * from t_company where type = 2 and flag != 3) as ci on ci.id = cc.superiorId
|
LEFT JOIN (SELECT COUNT(id) as num,franchiseeId FROM t_car where state = 1 GROUP BY franchiseeId) as ca on ca.franchiseeId = cc.id
|
LEFT JOIN (SELECT COUNT(id) as num,franchiseeId FROM t_driver where flag != 3 GROUP BY franchiseeId) as di on di.franchiseeId = cc.id) as o
|
<where>
|
o.type = 3 and o.flag != 3
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
AND (o.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
|
</if>
|
<if test="name != null and name != ''">
|
and o.name LIKE CONCAT('%',#{name},'%')
|
</if>
|
<if test="account != null and account != ''">
|
and o.account LIKE CONCAT('%',#{account},'%')
|
</if>
|
<if test="principalName != null and principalName != ''">
|
and o.principalName LIKE CONCAT('%',#{principalName},'%')
|
</if>
|
<if test="principalPhone != null and principalPhone != ''">
|
and o.principalPhone LIKE CONCAT('%',#{principalPhone},'%')
|
</if>
|
<if test="serviceStr != null and serviceStr != ''">
|
and o.serverStr LIKE CONCAT('%',#{serviceStr},'%')
|
</if>
|
<if test="state != null and state != '' and state == 1">
|
and o.state = 1
|
</if>
|
<if test="state != null and state != '' and state == 2">
|
and o.state = 0
|
</if>
|
<if test="roleType != null and roleType != '' and roleType == 2">
|
and o.superiorId = #{nowUserId}
|
</if>
|
</where>
|
order by o.id desc
|
</select>
|
|
|
<select id="queryOperationalData" resultType="map">
|
|
select
|
*,
|
ROUND(if(orderNum != 0, cancelNum / orderNum, 0) * 100, 2) as cancelProportion,
|
(onlinePay + offlinePay) as total,
|
ROUND((onlinePay / (onlinePay + offlinePay)) * 100, 2) as payProportion
|
from (
|
select
|
aa.time,
|
sum(aa.register) as register,
|
sum(aa.`online`) as `online`,
|
sum(aa.orderNum) as orderNum,
|
sum(aa.cancelNum) as cancelNum,
|
sum(aa.onlinePay) as onlinePay,
|
sum(aa.offlinePay) as offlinePay,
|
sum(aa.money) as money,
|
sum(aa.complaint) as complaint
|
from (
|
select DATE_FORMAT(insertTime, '%Y-%m-%d') as time, count(id) as register, 0 as `online`, 0 as orderNum, 0 as cancelNum, 0 as onlinePay, 0 as offlinePay, 0 as money, 0 as complaint
|
from t_user
|
where flag != 3 and state = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(insertTime, '%Y-%m-%d')
|
union all
|
select DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, 0, count(a.id) as `online`, 0 as orderNum, 0 as cancelNum, 0 as onlinePay, 0 as offlinePay, 0 as money, 0 as complaint
|
from t_driver_online a
|
left join t_driver b on (a.driverId = b.id)
|
where 1 = 1
|
<if test="null != companyId">
|
and if(b.franchiseeId is null or b.franchiseeId = 0, b.companyId = #{companyId}, b.franchiseeId = #{companyId})
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(a.insertTime, '%Y-%m-%d')
|
union all
|
<if test="1 == type">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_private_car where isDelete = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="2 == type">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_taxi where isDelete = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="3 == type">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_cross_city where isDelete = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="4 == type">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_logistics where isDelete = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 1">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_private_car where isDelete = 1 and state in (10, 12)
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 2">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_taxi where isDelete = 1 and state in (10, 12)
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 3">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_cross_city where isDelete = 1 and state in (10, 12)
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 4">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_logistics where isDelete = 1 and state in (10, 12)
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 1">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_private_car where isDelete = 1 and payManner = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 2">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_taxi where isDelete = 1 and payManner = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 3">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_cross_city where isDelete = 1 and payManner = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 4">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_logistics where isDelete = 1 and payManner = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 1">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_private_car where isDelete = 1 and payManner = 2
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 2">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_taxi where isDelete = 1 and payManner = 2
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 3">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_cross_city where isDelete = 1 and payManner = 2
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 4">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_logistics where isDelete = 1 and payManner = 2
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
select DATE_FORMAT(a.insert_time, '%Y-%m-%d'), 0, 0, 0, 0, 0, 0, 0, count(a.id) from t_complaint a
|
left join t_driver b on (a.driverId = b.id)
|
where 1 = 1
|
<if test="null != companyId">
|
and if(b.franchiseeId is null or b.franchiseeId = 0, b.companyId = #{companyId}, b.franchiseeId = #{companyId})
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(a.insert_time, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(a.insert_time, '%Y-%m-%d')
|
) as aa group by aa.time
|
) as da order by `time` desc
|
<if test="null != offset and null != limit">
|
limit #{offset}, #{limit}
|
</if>
|
</select>
|
|
|
|
<select id="queryOperationalDataCount" resultType="int">
|
|
select
|
count(`time`)
|
from (
|
select
|
aa.time,
|
sum(aa.register) as register,
|
sum(aa.`online`) as `online`,
|
sum(aa.orderNum) as orderNum,
|
sum(aa.cancelNum) as cancelNum,
|
sum(aa.onlinePay) as onlinePay,
|
sum(aa.offlinePay) as offlinePay,
|
sum(aa.money) as money,
|
sum(aa.complaint) as complaint
|
from (
|
select DATE_FORMAT(insertTime, '%Y-%m-%d') as time, count(id) as register, 0 as `online`, 0 as orderNum, 0 as cancelNum, 0 as onlinePay, 0 as offlinePay, 0 as money, 0 as complaint
|
from t_user
|
where flag != 3 and state = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(insertTime, '%Y-%m-%d')
|
union all
|
select DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, 0, count(a.id) as `online`, 0 as orderNum, 0 as cancelNum, 0 as onlinePay, 0 as offlinePay, 0 as money, 0 as complaint from t_driver_online a
|
left join t_driver b on (a.driverId = b.id)
|
where 1 = 1
|
<if test="null != companyId">
|
and if(b.franchiseeId is null or b.franchiseeId = 0, b.companyId = #{companyId}, b.franchiseeId = #{companyId})
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(a.insertTime, '%Y-%m-%d')
|
union all
|
<if test="1 == type">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_private_car where isDelete = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="2 == type">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_taxi where isDelete = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="3 == type">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_cross_city where isDelete = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="4 == type">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_logistics where isDelete = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 1">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_private_car where isDelete = 1 and state in (10, 12)
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 2">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_taxi where isDelete = 1 and state in (10, 12)
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 3">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_cross_city where isDelete = 1 and state in (10, 12)
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 4">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_logistics where isDelete = 1 and state in (10, 12)
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 1">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_private_car where isDelete = 1 and payManner = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 2">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_taxi where isDelete = 1 and payManner = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 3">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_cross_city where isDelete = 1 and payManner = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 4">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_logistics where isDelete = 1 and payManner = 1
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 1">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_private_car where isDelete = 1 and payManner = 2
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 2">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_taxi where isDelete = 1 and payManner = 2
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 3">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_cross_city where isDelete = 1 and payManner = 2
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
<if test="type == 4">
|
select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_logistics where isDelete = 1 and payManner = 2
|
<if test="null != companyId">
|
and companyId = #{companyId}
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(travelTime, '%Y-%m-%d')
|
union all
|
</if>
|
select DATE_FORMAT(a.insert_time, '%Y-%m-%d'), 0, 0, 0, 0, 0, 0, 0, count(a.id) from t_complaint a
|
left join t_driver b on (a.driverId = b.id)
|
where 1 = 1
|
<if test="null != companyId">
|
and if(b.franchiseeId is null or b.franchiseeId = 0, b.companyId = #{companyId}, b.franchiseeId = #{companyId})
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(a.insert_time, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
group by DATE_FORMAT(a.insert_time, '%Y-%m-%d')
|
) as aa group by aa.time
|
) as da order by `time` desc
|
</select>
|
</mapper>
|