746 lines
33 KiB
XML
Raw Normal View History

<?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.XhpcHistoryOrderMapper">
<resultMap type="com.xhpc.order.domain.XhpcHistoryOrder" id="XhpcHistoryOrderResult">
2021-09-23 10:42:06 +08:00
<id column="history_order_id" jdbcType="BIGINT" property="historyOrderId"/>
<result column="charging_station_id" jdbcType="BIGINT" property="chargingStationId"/>
<result column="charge_order_id" jdbcType="BIGINT" property="chargeOrderId"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="terminal_id" jdbcType="BIGINT" property="terminalId"/>
<result column="serial_number" jdbcType="VARCHAR" property="serialNumber"/>
<result column="internet_serial_number" jdbcType="VARCHAR" property="internetSerialNumber"/>
<result column="power_price_total" jdbcType="DECIMAL" property="powerPriceTotal"/>
<result column="service_price_total" jdbcType="DECIMAL" property="servicePriceTotal"/>
<result column="total_price" jdbcType="DECIMAL" property="totalPrice"/>
<result column="promotion_discount" jdbcType="DECIMAL" property="promotionDiscount"/>
<result column="act_price" jdbcType="DECIMAL" property="actPrice"/>
<result column="act_power_price" jdbcType="DECIMAL" property="actPowerPrice"/>
<result column="act_service_price" jdbcType="DECIMAL" property="actServicePrice"/>
<result column="internet_commission" jdbcType="DECIMAL" property="internetCommission"/>
<result column="internet_svc_commission" jdbcType="DECIMAL" property="internetSvcCommission"/>
<result column="platform_commission" jdbcType="DECIMAL" property="platformCommission"/>
<result column="platform_svc_commisssion" jdbcType="DECIMAL" property="platformSvcCommisssion"/>
<result column="operation_commission" jdbcType="DECIMAL" property="operationCommission"/>
<result column="operation_svc_commission" jdbcType="DECIMAL" property="operationSvcCommission"/>
<result column="start_soc" jdbcType="VARCHAR" property="startSoc"/>
<result column="end_soc" jdbcType="VARCHAR" property="endSoc"/>
<result column="reconciliation_status" jdbcType="INTEGER" property="reconciliationStatus"/>
<result column="sorting_status" jdbcType="INTEGER" property="sortingStatus"/>
<result column="type" jdbcType="TINYINT" property="type"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="state" jdbcType="INTEGER" property="state"/>
<result column="vin_normal" jdbcType="VARCHAR" property="vinNormal"/>
<result column="search_value" jdbcType="VARCHAR" property="searchValue"/>
<result column="operator_id_evcs" jdbcType="VARCHAR" property="operatorIdEvcs"/>
<result column="charge_model_evcs" jdbcType="INTEGER" property="chargeModelEvcs"/>
<result column="connector_power_evcs" jdbcType="DOUBLE" property="connectorPowerEvcs"/>
<result column="meter_value_end_evcs" jdbcType="DOUBLE" property="meterValueEndEvcs"/>
<result column="meter_value_start_evcs" jdbcType="DOUBLE" property="meterValueStartEvcs"/>
<result column="operator_id3rdpty_evcs" jdbcType="VARCHAR" property="operatorId3rdptyEvcs"/>
<result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
<result column="stop_reason_evcs" jdbcType="INTEGER" property="stopReasonEvcs"/>
<result column="total_power" jdbcType="DOUBLE" property="totalPower"/>
<result column="user_name_evcs" jdbcType="VARCHAR" property="userNameEvcs"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
</resultMap>
2021-09-23 10:42:06 +08:00
<sql id="Base_Column_List">
history_order_id, charging_station_id, charge_order_id, user_id, terminal_id, serial_number,
internet_serial_number, power_price_total, service_price_total, total_price, promotion_discount,
act_price, act_power_price, act_service_price, internet_commission, internet_svc_commission,
platform_commission, platform_svc_commisssion, operation_commission, operation_svc_commission,
start_soc, end_soc, reconciliation_status, sorting_status, `type`, `status`, del_flag,
create_time, create_by, update_time, update_by, remark, `state`, vin_normal, search_value,
operator_id_evcs, charge_model_evcs, connector_power_evcs, meter_value_end_evcs,
meter_value_start_evcs, operator_id3rdpty_evcs, start_time, stop_reason_evcs, total_power,
user_name_evcs, phone
</sql>
<insert id="insert" parameterType="com.xhpc.order.domain.XhpcHistoryOrder" useGeneratedKeys="true"
keyProperty="historyOrderId">
INSERT INTO xhpc_history_order
<trim prefix="(" suffix=")" suffixOverrides=",">
2021-09-23 10:42:06 +08:00
<if test="chargingStationId != null">
charging_station_id,
</if>
2021-09-23 10:42:06 +08:00
<if test="chargeOrderId != null">
2021-08-09 18:47:43 +08:00
charge_order_id,
</if>
2021-09-23 10:42:06 +08:00
<if test="userId != null">
user_id,
</if>
2021-09-23 10:42:06 +08:00
<if test="terminalId != null">
terminal_id,
</if>
2021-09-23 10:42:06 +08:00
<if test="serialNumber != null">
serial_number,
</if>
2021-09-23 10:42:06 +08:00
<if test="internetSerialNumber != null">
internet_serial_number,
</if>
2021-09-23 10:42:06 +08:00
<if test="powerPriceTotal != null">
power_price_total,
</if>
<if test="servicePriceTotal != null">
service_price_total,
</if>
<if test="totalPrice != null">
total_price,
</if>
2021-09-23 10:42:06 +08:00
<if test="promotionDiscount != null">
promotion_discount,
</if>
2021-09-23 10:42:06 +08:00
<if test="actPrice != null">
act_price,
</if>
2021-09-23 10:42:06 +08:00
<if test="actPowerPrice != null">
act_power_price,
</if>
2021-09-23 10:42:06 +08:00
<if test="actServicePrice != null">
act_service_price,
</if>
2021-09-23 10:42:06 +08:00
<if test="internetCommission != null">
internet_commission,
</if>
2021-09-23 10:42:06 +08:00
<if test="internetSvcCommission != null">
internet_svc_commission,
</if>
2021-09-23 10:42:06 +08:00
<if test="platformCommission != null">
platform_commission,
</if>
2021-09-23 10:42:06 +08:00
<if test="platformSvcCommisssion != null">
platform_svc_commisssion,
</if>
2021-09-23 10:42:06 +08:00
<if test="operationCommission != null">
operation_commission,
</if>
2021-09-23 10:42:06 +08:00
<if test="operationSvcCommission != null">
operation_svc_commission,
</if>
2021-09-23 10:42:06 +08:00
<if test="startSoc != null">
start_soc,
</if>
2021-09-23 10:42:06 +08:00
<if test="endSoc != null">
end_soc,
</if>
2021-09-23 10:42:06 +08:00
<if test="reconciliationStatus != null">
reconciliation_status,
</if>
2021-09-23 10:42:06 +08:00
<if test="sortingStatus != null">
sorting_status,
</if>
2021-09-23 10:42:06 +08:00
<if test="type != null">
`type`,
</if>
2021-09-23 10:42:06 +08:00
<if test="status != null">
`status`,
</if>
2021-09-23 10:42:06 +08:00
<if test="delFlag != null">
del_flag,
</if>
2021-09-23 10:42:06 +08:00
<if test="createTime != null">
create_time,
</if>
2021-09-23 10:42:06 +08:00
<if test="createBy != null">
create_by,
</if>
2021-09-23 10:42:06 +08:00
<if test="updateTime != null">
update_time,
</if>
2021-09-23 10:42:06 +08:00
<if test="updateBy != null">
update_by,
</if>
2021-09-23 10:42:06 +08:00
<if test="remark != null">
2021-08-25 18:45:52 +08:00
remark,
</if>
2021-09-23 10:42:06 +08:00
<if test="state != null">
`state`,
2021-08-25 18:45:52 +08:00
</if>
2021-09-23 10:42:06 +08:00
<if test="vinNormal != null">
vin_normal,
</if>
<if test="searchValue != null">
search_value,
</if>
<if test="operatorIdEvcs != null">
operator_id_evcs,
</if>
<if test="chargeModelEvcs != null">
charge_model_evcs,
</if>
2021-09-23 10:42:06 +08:00
<if test="connectorPowerEvcs != null">
connector_power_evcs,
</if>
<if test="meterValueEndEvcs != null">
meter_value_end_evcs,
</if>
<if test="meterValueStartEvcs != null">
meter_value_start_evcs,
</if>
<if test="operatorId3rdptyEvcs != null">
operator_id3rdpty_evcs,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="stopReasonEvcs != null">
stop_reason_evcs,
</if>
<if test="totalPower != null">
total_power,
</if>
<if test="userNameEvcs != null">
user_name_evcs,
</if>
<if test="phone != null">
phone,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
2021-09-23 10:42:06 +08:00
<if test="chargingStationId != null">
#{chargingStationId,jdbcType=BIGINT},
</if>
<if test="chargeOrderId != null">
#{chargeOrderId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
2021-09-23 10:42:06 +08:00
<if test="terminalId != null">
#{terminalId,jdbcType=BIGINT},
</if>
2021-09-23 10:42:06 +08:00
<if test="serialNumber != null">
#{serialNumber,jdbcType=VARCHAR},
</if>
2021-09-23 10:42:06 +08:00
<if test="internetSerialNumber != null">
#{internetSerialNumber,jdbcType=VARCHAR},
</if>
2021-09-23 10:42:06 +08:00
<if test="powerPriceTotal != null">
#{powerPriceTotal,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="servicePriceTotal != null">
#{servicePriceTotal,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="totalPrice != null">
#{totalPrice,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="promotionDiscount != null">
#{promotionDiscount,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="actPrice != null">
#{actPrice,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="actPowerPrice != null">
#{actPowerPrice,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="actServicePrice != null">
#{actServicePrice,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="internetCommission != null">
#{internetCommission,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="internetSvcCommission != null">
#{internetSvcCommission,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="platformCommission != null">
#{platformCommission,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="platformSvcCommisssion != null">
#{platformSvcCommisssion,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="operationCommission != null">
#{operationCommission,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="operationSvcCommission != null">
#{operationSvcCommission,jdbcType=DECIMAL},
</if>
2021-09-23 10:42:06 +08:00
<if test="startSoc != null">
#{startSoc,jdbcType=VARCHAR},
</if>
2021-09-23 10:42:06 +08:00
<if test="endSoc != null">
#{endSoc,jdbcType=VARCHAR},
</if>
2021-09-23 10:42:06 +08:00
<if test="reconciliationStatus != null">
#{reconciliationStatus,jdbcType=INTEGER},
</if>
2021-09-23 10:42:06 +08:00
<if test="sortingStatus != null">
#{sortingStatus,jdbcType=INTEGER},
</if>
2021-09-23 10:42:06 +08:00
<if test="type != null">
#{type,jdbcType=TINYINT},
</if>
2021-09-23 10:42:06 +08:00
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
2021-09-23 10:42:06 +08:00
<if test="delFlag != null">
#{delFlag,jdbcType=INTEGER},
</if>
2021-09-23 10:42:06 +08:00
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
2021-09-23 10:42:06 +08:00
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
2021-09-23 10:42:06 +08:00
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
2021-09-23 10:42:06 +08:00
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
2021-09-23 10:42:06 +08:00
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
2021-08-25 18:45:52 +08:00
</if>
2021-09-23 10:42:06 +08:00
<if test="state != null">
#{state,jdbcType=INTEGER},
2021-08-25 18:45:52 +08:00
</if>
2021-09-23 10:42:06 +08:00
<if test="vinNormal != null">
#{vinNormal,jdbcType=VARCHAR},
</if>
2021-09-23 10:42:06 +08:00
<if test="searchValue != null">
#{searchValue,jdbcType=VARCHAR},
</if>
<if test="operatorIdEvcs != null">
#{operatorIdEvcs,jdbcType=VARCHAR},
</if>
<if test="chargeModelEvcs != null">
#{chargeModelEvcs,jdbcType=INTEGER},
</if>
<if test="connectorPowerEvcs != null">
#{connectorPowerEvcs,jdbcType=DOUBLE},
</if>
<if test="meterValueEndEvcs != null">
#{meterValueEndEvcs,jdbcType=DOUBLE},
</if>
<if test="meterValueStartEvcs != null">
#{meterValueStartEvcs,jdbcType=DOUBLE},
</if>
<if test="operatorId3rdptyEvcs != null">
#{operatorId3rdptyEvcs,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="stopReasonEvcs != null">
#{stopReasonEvcs,jdbcType=INTEGER},
</if>
<if test="totalPower != null">
#{totalPower,jdbcType=DOUBLE},
</if>
<if test="userNameEvcs != null">
#{userNameEvcs,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="update" parameterType="com.xhpc.order.domain.XhpcHistoryOrder">
UPDATE xhpc_history_order
<set>
2021-09-23 10:42:06 +08:00
<if test="chargingStationId != null">
charging_station_id = #{chargingStationId,jdbcType=BIGINT},
</if>
<if test="chargeOrderId != null">
charge_order_id = #{chargeOrderId,jdbcType=BIGINT},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="terminalId != null">
terminal_id = #{terminalId,jdbcType=BIGINT},
</if>
<if test="serialNumber != null">
serial_number = #{serialNumber,jdbcType=VARCHAR},
</if>
<if test="internetSerialNumber != null">
internet_serial_number = #{internetSerialNumber,jdbcType=VARCHAR},
</if>
<if test="powerPriceTotal != null">
power_price_total = #{powerPriceTotal,jdbcType=DECIMAL},
</if>
<if test="servicePriceTotal != null">
service_price_total = #{servicePriceTotal,jdbcType=DECIMAL},
</if>
<if test="totalPrice != null">
total_price = #{totalPrice,jdbcType=DECIMAL},
</if>
<if test="promotionDiscount != null">
promotion_discount = #{promotionDiscount,jdbcType=DECIMAL},
</if>
<if test="actPrice != null">
act_price = #{actPrice,jdbcType=DECIMAL},
</if>
<if test="actPowerPrice != null">
act_power_price = #{actPowerPrice,jdbcType=DECIMAL},
</if>
<if test="actServicePrice != null">
act_service_price = #{actServicePrice,jdbcType=DECIMAL},
</if>
<if test="internetCommission != null">
internet_commission = #{internetCommission,jdbcType=DECIMAL},
</if>
<if test="internetSvcCommission != null">
internet_svc_commission = #{internetSvcCommission,jdbcType=DECIMAL},
</if>
<if test="platformCommission != null">
platform_commission = #{platformCommission,jdbcType=DECIMAL},
</if>
<if test="platformSvcCommisssion != null">
platform_svc_commisssion = #{platformSvcCommisssion,jdbcType=DECIMAL},
</if>
<if test="operationCommission != null">
operation_commission = #{operationCommission,jdbcType=DECIMAL},
</if>
<if test="operationSvcCommission != null">
operation_svc_commission = #{operationSvcCommission,jdbcType=DECIMAL},
</if>
<if test="startSoc != null">
start_soc = #{startSoc,jdbcType=VARCHAR},
</if>
<if test="endSoc != null">
end_soc = #{endSoc,jdbcType=VARCHAR},
</if>
<if test="reconciliationStatus != null">
reconciliation_status = #{reconciliationStatus,jdbcType=INTEGER},
</if>
<if test="sortingStatus != null">
sorting_status = #{sortingStatus,jdbcType=INTEGER},
</if>
<if test="type != null">
`type` = #{type,jdbcType=TINYINT},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="state != null">
`state` = #{state,jdbcType=INTEGER},
</if>
<if test="vinNormal != null">
vin_normal = #{vinNormal,jdbcType=VARCHAR},
</if>
<if test="searchValue != null">
search_value = #{searchValue,jdbcType=VARCHAR},
</if>
<if test="operatorIdEvcs != null">
operator_id_evcs = #{operatorIdEvcs,jdbcType=VARCHAR},
</if>
<if test="chargeModelEvcs != null">
charge_model_evcs = #{chargeModelEvcs,jdbcType=INTEGER},
</if>
<if test="connectorPowerEvcs != null">
connector_power_evcs = #{connectorPowerEvcs,jdbcType=DOUBLE},
</if>
<if test="meterValueEndEvcs != null">
meter_value_end_evcs = #{meterValueEndEvcs,jdbcType=DOUBLE},
</if>
<if test="meterValueStartEvcs != null">
meter_value_start_evcs = #{meterValueStartEvcs,jdbcType=DOUBLE},
</if>
<if test="operatorId3rdptyEvcs != null">
operator_id3rdpty_evcs = #{operatorId3rdptyEvcs,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="stopReasonEvcs != null">
stop_reason_evcs = #{stopReasonEvcs,jdbcType=INTEGER},
</if>
<if test="totalPower != null">
total_power = #{totalPower,jdbcType=DOUBLE},
</if>
<if test="userNameEvcs != null">
user_name_evcs = #{userNameEvcs,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
</set>
2021-09-23 10:42:06 +08:00
where history_order_id = #{historyOrderId,jdbcType=BIGINT}
</update>
<select id="info" parameterType="java.lang.Long" resultMap="XhpcHistoryOrderResult">
select *
from xhpc_history_order xho
where xho.del_flag = 0 and xho.history_order_id = #{historyOrderId}
</select>
2021-07-26 18:02:59 +08:00
2021-08-06 18:46:55 +08:00
<update id="updateReconciliation" parameterType="java.lang.String">
2021-07-26 18:02:59 +08:00
update xhpc_history_order set reconciliation_status = #{status} where history_order_id in
2021-08-06 18:46:55 +08:00
<foreach collection="xhpcHistoryOrderIds" item="item" open="(" separator="," close=")">
#{item}
2021-07-26 18:02:59 +08:00
</foreach>
</update>
2021-08-06 18:46:55 +08:00
<update id="updateSorting" parameterType="java.lang.String">
2021-07-26 18:02:59 +08:00
update xhpc_history_order set sorting_status = #{status} where history_order_id in
2021-08-06 18:46:55 +08:00
<foreach collection="xhpcHistoryOrderIds" item="item" open="(" separator="," close=")">
#{item}
2021-07-26 18:02:59 +08:00
</foreach>
</update>
2021-08-03 22:41:53 +08:00
<select id="list" resultType="map">
SELECT
ho.history_order_id as historyOrderId,
ho.serial_number as serialNumber,
ho.create_time as createTime,
co.status as status,
2021-08-03 22:41:53 +08:00
cs.name as chargingStationName,
te.name as terminalName,
ho.act_price as actPrice,
co.charging_degree as chargingDegree,
co.charging_time as chargingTime
2021-08-03 22:41:53 +08:00
FROM xhpc_history_order as ho
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
2021-08-09 18:47:43 +08:00
left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id
2021-08-03 22:41:53 +08:00
where ho.status=0 and ho.del_flag=0 and ho.user_id =#{userId}
2021-08-24 13:59:16 +08:00
order by ho.create_time desc
2021-08-03 22:41:53 +08:00
</select>
<select id="gethistotyOrderMessage" resultType="map">
SELECT
ho.history_order_id as historyOrderId,
ho.serial_number as serialNumber,
ho.type as type,
cs.name as chargingStationName,
te.name as terminalName,
ho.act_price as actPrice,
ho.act_power_price as actPowerPrice,
co.charging_time as chargingTime,
co.charging_degree as chargingDegree,
DATE_FORMAT(co.start_time,'%m月%d日') as daysOne,
2021-09-02 20:08:21 +08:00
DATE_FORMAT(co.start_time,'%H:%i:%s') as timeOne,
DATE_FORMAT(co.end_time,'%m月%d日') as daysTwo,
2021-09-02 20:08:21 +08:00
DATE_FORMAT(co.end_time,'%H:%i:%s') as timeTwo,
2021-08-11 16:25:10 +08:00
co.status as status,
2021-09-03 14:24:44 +08:00
co.type as type,
case when co.type=40 then "APP远程停止"
when co.type=41 then "SOC达到100%"
when co.type=42 then "充电电量满足设定条件"
when co.type=43 then "充电金额满足设定条件"
when co.type=44 then "充电时间满足设定条件"
when co.type=45 then "手动停止充电"
when co.type=46 then "手动停止充电."
when co.type=47 then "手动停止充电.."
when co.type=48 then "急停停止充电"
when co.type=49 then "手动停止充电..."
end typeName
2021-08-03 22:41:53 +08:00
FROM xhpc_history_order as ho
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
2021-08-09 18:47:43 +08:00
left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id
2021-08-11 16:25:10 +08:00
where ho.status=0 and ho.del_flag=0
2021-08-03 22:41:53 +08:00
<if test="userId !=null">
and ho.user_id =#{userId}
</if>
2021-08-11 16:25:10 +08:00
<if test="historyOrderId !=null">
and ho.history_order_id =#{historyOrderId}
</if>
<if test="chargingOrderId !=null">
and ho.charge_order_id =#{chargingOrderId}
</if>
2021-08-31 19:47:36 +08:00
order by ho.create_time desc
2021-08-03 22:41:53 +08:00
</select>
<select id="getListPage" resultType="map">
select
ho.history_order_id as historyOrderId,
2021-08-25 18:45:52 +08:00
co.charge_order_id as chargeOrderId,
ho.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,
ho.type as orderType,
ho.start_soc as startSoc,
ho.end_soc as endSoc,
ho.internet_serial_number as internetSerialNumber,
ho.total_price as totalPrice,
ho.act_price as actPrice,
co.charging_time as chargingTime,
co.charging_degree as chargingDegree,
co.start_time as startTime,
co.end_time as endTime,
co.update_time as updateTime,
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
from xhpc_history_order as ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
where ho.status =0 and ho.del_flag=0
<if test="type !=null">
and ho.type=#{type}
</if>
<if test="startTime !=null and startTime !=''">
2021-08-25 15:27:57 +08:00
and co.start_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
2021-08-25 15:27:57 +08:00
and co.start_time &lt;= #{startTime}
</if>
<if test="transactionNumber !=null and transactionNumber !=''">
and ho.serial_number like concat('%', #{transactionNumber}, '%')
</if>
<if test="chargingStationName !=null and chargingStationName !=''">
2021-08-25 15:27:57 +08:00
and ct.name like concat('%', #{transactionNumber}, '%')
</if>
<if test="operatorId !=null">
and op.operator_id =#{operatorId}
</if>
<if test="number==1">
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%')) or
co.user_id in (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%'))
</if>
<if test="number==2">
<if test="source !=null and source ==0">
and co.user_id in (SELECT app_user_id FROM xhpc_app_user)
</if>
<if test="source !=null and source ==1">
and co.user_id in (SELECT internet_user_id from xhpc_internet_user)
</if>
</if>
<if test="number==3">
<if test="source !=null and source ==0">
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%'))
</if>
<if test="source !=null and source ==1">
and co.user_id in (SELECT internet_user_id from xhpc_internet_user where phone like concat('%',
#{phone}, '%'))
</if>
</if>
<if test="status==2">
and co.source =0
and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<if test="status==3">
and co.source =1
and co.user_id=#{userId}
</if>
order by ho.create_time desc
</select>
2021-08-25 18:45:52 +08:00
<select id="getReatTimeList" resultType="map">
select
rt.start_time as startTime,
rt.end_time as endTime,
ra.power_fee as powerFee,
ra.service_fee as serviceFee
from xhpc_rate_time as rt
left join xhpc_rate ra on rt.rate_id =ra.rate_id
where rt.rate_model_id=#{rateModelId}
2021-09-02 20:08:21 +08:00
and (rt.start_time &lt;= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') &gt;= #{startTime})
and (rt.start_time &lt;= #{endTime} and replace(rt.end_time, '00:00:00', '23:59:59') &gt;= #{endTime})
2021-08-25 18:45:52 +08:00
</select>
<select id="getById" resultType="map">
select
ho.history_order_id as historyOrderId,
co.charge_order_id as chargeOrderId,
ho.serial_number as serialNumber,
ho.internet_serial_number as internetSerialNumber,
co.source as source,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.type as type,
co.type as orderType,
co.create_time as createTime,
co.start_time as startTime,
co.end_time as endTime,
co.update_time as updateTime,
ho.total_price as totalPrice,
ho.promotion_discount as promotionDiscount,
ho.act_price as actPrice,
co.erro_remark as erroRemark,
ho.power_price_total as powerPriceTotal,
ho.service_price_total as servicePriceTotal,
ho.internet_commission as internetCommission,
ho.internet_svc_commission as internetSvcCommission,
ho.platform_commission as platformCommission,
ho.platform_svc_commisssion as platformSvcCommisssion,
ho.operation_commission as operationCommission,
ho.operation_svc_commission as operationSvcCommission,
ho.act_power_price as actPowerPrice,
ho.act_service_price as actServicePrice,
(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_history_order ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
where ho.history_order_id=#{historyOrderId}
</select>
2021-09-02 20:08:21 +08:00
<select id="getStatistisList" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
2021-09-02 20:08:21 +08:00
select
2021-09-23 10:42:06 +08:00
ho.history_order_id as historyOrderId,
ho.power_price_total as powerPriceTotal,
ho.service_price_total as servicePriceTotal,
ho.promotion_discount as promotionDiscount,
ho.total_price as totalPrice,
ho.act_price as actPrice,
ho.act_power_price as actPowerPrice,
ho.act_service_price as actServicePrice,
ho.internet_commission as internetCommission,
ho.internet_svc_commission as internetSvcCommission,
ho.platform_commission as platformCommission,
ho.platform_svc_commisssion as platformSvcCommisssion,
ho.operation_commission as operationCommission,
ho.operation_svc_commission as operationSvcCommission,
co.source as source,
co.charge_order_id as chargeOrderId,
co.charging_station_id as chargingStationId,
co.terminal_id as terminalId,
co.start_time as startTime,
co.end_time as endTime,
co.charging_time_number as chargingTimeNumber,
co.charging_degree as chargingDegree,
co.rate_model_id as rateModelId,
cs.operator_id as operatorId,
te.charging_pile_id as chargingPileId,
co.user_id as userId
2021-09-02 20:08:21 +08:00
from xhpc_history_order ho
2021-09-23 10:42:06 +08:00
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
left join xhpc_terminal as te on te.terminal_id = ho.terminal_id
where state = #{state}
limit 0,#{number}
2021-09-02 20:08:21 +08:00
</select>
2021-09-23 10:42:06 +08:00
</mapper>