2021-08-07 17:29:45 +08:00
|
|
|
<?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.xhpc.order.mapper.XhpcRealTimeOrderMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.xhpc.order.domain.XhpcRealTimeOrder" id="XhpcRealTimeOrderMap">
|
|
|
|
|
<result column="real_time_order_id" property="realTimeOrderId"/>
|
|
|
|
|
<result column="charging_order_id" property="chargingOrderId"/>
|
|
|
|
|
<result column="transaction_number" property="transactionNumber"/>
|
|
|
|
|
<result column="pile_number" property="pileNumber"/>
|
|
|
|
|
<result column="gun_number" property="gunNumber"/>
|
|
|
|
|
<result column="pile_gun_status" property="pileGunStatus"/>
|
|
|
|
|
<result column="vehicle_gun_status" property="vehicleGunStatus"/>
|
|
|
|
|
<result column="voltage" property="voltage"/>
|
|
|
|
|
<result column="electric_current" property="electricCurrent"/>
|
|
|
|
|
<result column="gun_line_temperature" property="gunLineTemperature"/>
|
|
|
|
|
<result column="gun_line_number" property="gunLineNumber"/>
|
|
|
|
|
<result column="soc" property="soc"/>
|
|
|
|
|
<result column="max_temperature" property="maxTemperature"/>
|
|
|
|
|
<result column="charging_time" property="chargingTime"/>
|
|
|
|
|
<result column="remaining_time" property="remainingTime"/>
|
|
|
|
|
<result column="charging_degree" property="chargingDegree"/>
|
|
|
|
|
<result column="loss_charging_degree" property="lossChargingDegree"/>
|
|
|
|
|
<result column="amount_charged" property="amountCharged"/>
|
|
|
|
|
<result column="hardware_fault" property="hardwareFault"/>
|
|
|
|
|
<result column="status" property="status"/>
|
|
|
|
|
<result column="create_time" property="createTime"/>
|
|
|
|
|
<result column="create_by" property="createBy"/>
|
|
|
|
|
<result column="update_time" property="updateTime"/>
|
|
|
|
|
<result column="update_by" property="updateBy"/>
|
|
|
|
|
<result column="remark" property="remark"/>
|
|
|
|
|
<result column="user_id" property="userId"/>
|
|
|
|
|
<result column="charging_station_id" property="chargingStationId"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<insert id="addXhpcRealTimeOrder" parameterType="com.xhpc.order.domain.XhpcRealTimeOrder" useGeneratedKeys="true"
|
|
|
|
|
keyProperty="realTimeOrderId">
|
|
|
|
|
insert into xhpc_real_time_order
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="null != chargingOrderId ">
|
|
|
|
|
charging_order_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != transactionNumber ">
|
|
|
|
|
transaction_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != pileNumber ">
|
|
|
|
|
pile_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != gunNumber ">
|
|
|
|
|
gun_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != pileGunStatus ">
|
|
|
|
|
pile_gun_status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != vehicleGunStatus ">
|
|
|
|
|
vehicle_gun_status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != voltage ">
|
|
|
|
|
voltage,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != electricCurrent ">
|
|
|
|
|
electric_current,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != gunLineTemperature ">
|
|
|
|
|
gun_line_temperature,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != gunLineNumber ">
|
|
|
|
|
gun_line_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != soc ">
|
|
|
|
|
soc,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != maxTemperature ">
|
|
|
|
|
max_temperature,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingTime ">
|
|
|
|
|
charging_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != remainingTime ">
|
|
|
|
|
remaining_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingDegree ">
|
|
|
|
|
charging_degree,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != lossChargingDegree ">
|
|
|
|
|
loss_charging_degree,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != amountCharged ">
|
|
|
|
|
amount_charged,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != hardwareFault ">
|
|
|
|
|
hardware_fault,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != status ">
|
|
|
|
|
status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != createTime ">
|
|
|
|
|
create_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != createBy ">
|
|
|
|
|
create_by,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != updateTime ">
|
|
|
|
|
update_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != updateBy ">
|
|
|
|
|
update_by,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != remark ">
|
|
|
|
|
remark,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != userId ">
|
|
|
|
|
user_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingStationId ">
|
|
|
|
|
charging_station_id
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="null != chargingOrderId ">
|
|
|
|
|
#{chargingOrderId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != transactionNumber ">
|
|
|
|
|
#{transactionNumber},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != pileNumber ">
|
|
|
|
|
#{pileNumber},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != gunNumber ">
|
|
|
|
|
#{gunNumber},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != pileGunStatus ">
|
|
|
|
|
#{pileGunStatus},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != vehicleGunStatus ">
|
|
|
|
|
#{vehicleGunStatus},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != voltage ">
|
|
|
|
|
#{voltage},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != electricCurrent ">
|
|
|
|
|
#{electricCurrent},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != gunLineTemperature ">
|
|
|
|
|
#{gunLineTemperature},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != gunLineNumber ">
|
|
|
|
|
#{gunLineNumber},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != soc ">
|
|
|
|
|
#{soc},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != maxTemperature ">
|
|
|
|
|
#{maxTemperature},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingTime ">
|
|
|
|
|
#{chargingTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != remainingTime ">
|
|
|
|
|
#{remainingTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingDegree ">
|
|
|
|
|
#{chargingDegree},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != lossChargingDegree ">
|
|
|
|
|
#{lossChargingDegree},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != amountCharged ">
|
|
|
|
|
#{amountCharged},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != hardwareFault ">
|
|
|
|
|
#{hardwareFault},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != status ">
|
|
|
|
|
#{status},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != createTime ">
|
|
|
|
|
#{createTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != createBy ">
|
|
|
|
|
#{createBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != updateTime ">
|
|
|
|
|
#{updateTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != updateBy ">
|
|
|
|
|
#{updateBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != remark ">
|
|
|
|
|
#{remark},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != userId ">
|
|
|
|
|
#{userId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingStationId ">
|
|
|
|
|
#{chargingStationId}
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
2021-08-10 13:46:33 +08:00
|
|
|
</insert>
|
2021-08-07 17:29:45 +08:00
|
|
|
|
|
|
|
|
|
2021-08-10 13:46:33 +08:00
|
|
|
<select id="list" resultType="map">
|
2021-08-10 18:52:50 +08:00
|
|
|
select
|
2021-08-11 16:25:10 +08:00
|
|
|
ro.real_time_order_id as realTimeOrderId,
|
|
|
|
|
co.serial_number as serialNumber,
|
|
|
|
|
ct.name as chargingStationName,
|
|
|
|
|
ter.pile_serial_number as pileSerialNumber,
|
|
|
|
|
ter.name as terminalName,
|
|
|
|
|
op.operator_id as operatorId,
|
|
|
|
|
op.name as operatorName,
|
|
|
|
|
cp.power as power,
|
|
|
|
|
cp.type as type,
|
|
|
|
|
ro.soc as soc,
|
|
|
|
|
co.status as status,
|
|
|
|
|
co.create_time as createTime,
|
|
|
|
|
ro.charging_degree as chargingDegree,
|
|
|
|
|
ro.charging_time as chargingTime,
|
|
|
|
|
co.source as source,
|
|
|
|
|
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone,
|
|
|
|
|
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone
|
2021-08-10 18:52:50 +08:00
|
|
|
from xhpc_charge_order co
|
|
|
|
|
left join xhpc_real_time_order as ro on co.serial_number = ro.transaction_number
|
|
|
|
|
left join xhpc_charging_station as ct on ct.charging_station_id = ro.charging_station_id
|
|
|
|
|
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
|
|
|
|
left join xhpc_terminal as ter on ter.serial_number = ro.gun_number
|
|
|
|
|
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
|
|
|
|
|
where co.status=0 and co.del_flag=0
|
|
|
|
|
<if test="startTime !=null and startTime !=''">
|
|
|
|
|
and co.start_time >= #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endTime !=null and endTime !=''">
|
|
|
|
|
and co.start_time <= #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="transactionNumber !=null and transactionNumber !=''">
|
|
|
|
|
and co.serial_number like concat('%', #{transactionNumber}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargingStationName !=null and chargingStationName !=''">
|
|
|
|
|
and co.serial_number like concat('%', #{transactionNumber}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="terminalName !=null and terminalName !=''">
|
|
|
|
|
and ter.name like concat('%', #{terminalName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="operatorId !=null">
|
|
|
|
|
and op.operator_id =#{operatorId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="type==1">
|
2021-08-11 16:25:10 +08:00
|
|
|
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%')) or
|
2021-08-10 18:52:50 +08:00
|
|
|
co.user_id in (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%'))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="type==2">
|
|
|
|
|
<if test="source !=null and source ==0">
|
2021-08-11 16:25:10 +08:00
|
|
|
and co.user_id in (SELECT app_user_id FROM xhpc_app_user)
|
2021-08-10 18:52:50 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="source !=null and source ==1">
|
2021-08-11 16:25:10 +08:00
|
|
|
and co.user_id in (SELECT internet_user_id from xhpc_internet_user)
|
2021-08-10 18:52:50 +08:00
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="type==3">
|
|
|
|
|
<if test="source !=null and source ==0">
|
2021-08-11 16:25:10 +08:00
|
|
|
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%'))
|
2021-08-10 18:52:50 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="source !=null and source ==1">
|
2021-08-11 16:25:10 +08:00
|
|
|
and co.user_id in (SELECT internet_user_id from xhpc_internet_user where phone like concat('%',
|
|
|
|
|
#{phone}, '%'))
|
2021-08-10 18:52:50 +08:00
|
|
|
</if>
|
|
|
|
|
</if>
|
2021-08-11 16:25:10 +08:00
|
|
|
group by charging_order_id
|
2021-08-10 18:52:50 +08:00
|
|
|
order by co.create_time desc
|
2021-08-10 13:46:33 +08:00
|
|
|
</select>
|
2021-08-11 16:25:10 +08:00
|
|
|
|
|
|
|
|
<select id="getMessage" resultType="map">
|
|
|
|
|
select
|
|
|
|
|
ro.real_time_order_id as realTimeOrderId,
|
|
|
|
|
co.serial_number as serialNumber,
|
|
|
|
|
ct.name as chargingStationName,
|
|
|
|
|
ter.pile_serial_number as pileSerialNumber,
|
|
|
|
|
ter.name as terminalName,
|
|
|
|
|
op.operator_id as operatorId,
|
|
|
|
|
op.name as operatorName,
|
|
|
|
|
cp.power as power,
|
|
|
|
|
cp.type as type,
|
|
|
|
|
ro.soc as soc,
|
|
|
|
|
co.status as status,
|
|
|
|
|
co.create_time as createTime,
|
|
|
|
|
ro.charging_degree as chargingDegree,
|
|
|
|
|
ro.charging_time as chargingTime,
|
|
|
|
|
co.source as source,
|
|
|
|
|
co.internet_serial_number as internetSerialNumber,
|
|
|
|
|
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone,
|
|
|
|
|
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone
|
|
|
|
|
from xhpc_real_time_order ro
|
|
|
|
|
Left join xhpc_charge_order co on co.serial_number = ro.transaction_number
|
|
|
|
|
Left join xhpc_charging_station as ct on ct.charging_station_id = ro.charging_station_id
|
|
|
|
|
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
|
|
|
|
left join xhpc_terminal as ter on ter.serial_number = ro.gun_number
|
|
|
|
|
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
|
|
|
|
|
where ro.real_time_order_id=#{realTimeOrderId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="timeList" resultType="map">
|
|
|
|
|
select
|
|
|
|
|
create_time as createTime,
|
|
|
|
|
voltage,
|
|
|
|
|
electric_current as electricCurrent,
|
|
|
|
|
soc,
|
|
|
|
|
charging_degree as chargingDegree,
|
|
|
|
|
loss_charging_degree as lossChargingDegree,
|
|
|
|
|
gun_line_temperature as gunLineTemperature,
|
|
|
|
|
charging_time as chargingTime,
|
|
|
|
|
remaining_time as remainingTime,
|
|
|
|
|
vehicle_gun_status as vehicleGunStatus
|
|
|
|
|
from xhpc_real_time_order
|
|
|
|
|
where charging_order_id=#{chargingOrderId}
|
|
|
|
|
order by create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="timeChartSOCList" resultType="map">
|
|
|
|
|
select
|
|
|
|
|
group_concat(soc) as soc,
|
|
|
|
|
group_concat(DATE_FORMAT(create_time,'%H:%i:%s')) createTime
|
|
|
|
|
from xhpc_charge_order_soc
|
|
|
|
|
where charge_order_id=#{chargingOrderId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="timeChartVoltageList" resultType="map">
|
|
|
|
|
select
|
|
|
|
|
group_concat(voltage) as voltage,
|
|
|
|
|
group_concat(DATE_FORMAT(create_time,'%H:%i:%s')) createTime
|
|
|
|
|
from xhpc_charge_order_voltage
|
|
|
|
|
where charge_order_id=#{chargingOrderId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="timeChartCurrentList" resultType="map">
|
|
|
|
|
select
|
|
|
|
|
group_concat(current) as current,
|
|
|
|
|
group_concat(DATE_FORMAT(create_time,'%H:%i:%s')) createTime
|
|
|
|
|
from xhpc_charge_order_current
|
|
|
|
|
where charge_order_id=#{chargingOrderId}
|
|
|
|
|
</select>
|
2021-08-07 17:29:45 +08:00
|
|
|
</mapper>
|