yjh_yyds c5f219ee11 Revert "优化接口、订单最大功率统计"
This reverts commit 34b663e774ff9a16addc871ed8cfe355acf377fd.
2024-08-14 09:24:13 +08:00

1751 lines
77 KiB
XML

<?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">
<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="activity_power_price_total" jdbcType="DECIMAL" property="activityPowerPriceTotal"/>
<result column="activity_service_price_total" jdbcType="DECIMAL" property="activityServicePriceTotal"/>
<result column="activity_total_price" jdbcType="DECIMAL" property="activityTotalPrice"/>
<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="end_time" jdbcType="TIMESTAMP" property="endTime"/>
<result column="stop_reason_evcs" jdbcType="INTEGER" property="stopReasonEvcs"/>
<result column="rate_model_id" jdbcType="BIGINT" property="rateModelId"/>
<result column="total_power" jdbcType="DOUBLE" property="totalPower"/>
<result column="user_name_evcs" jdbcType="VARCHAR" property="userNameEvcs"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="internet_degree_commission" jdbcType="DECIMAL" property="internetDegreeCommission"/>
<result column="source" jdbcType="INTEGER" property="source"/>
<result column="activity_id" jdbcType="VARCHAR" property="activityId"/>
<result column="parking_voucher" jdbcType="INTEGER" property="parkingVoucher"/>
</resultMap>
<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, rate_model_id
</sql>
<insert id="insert" parameterType="com.xhpc.order.domain.XhpcHistoryOrder" useGeneratedKeys="true"
keyProperty="historyOrderId">
INSERT INTO xhpc_history_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="chargingStationId != null">
charging_station_id,
</if>
<if test="chargeOrderId != null">
charge_order_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="terminalId != null">
terminal_id,
</if>
<if test="serialNumber != null">
serial_number,
</if>
<if test="internetSerialNumber != null and ''!=internetSerialNumber">
internet_serial_number,
</if>
<if test="powerPriceTotal != null">
power_price_total,
</if>
<if test="servicePriceTotal != null">
service_price_total,
</if>
<if test="totalPrice != null">
total_price,
</if>
<if test="promotionDiscount != null">
promotion_discount,
</if>
<if test="actPrice != null">
act_price,
</if>
<if test="actPowerPrice != null">
act_power_price,
</if>
<if test="actServicePrice != null">
act_service_price,
</if>
<if test="internetCommission != null">
internet_commission,
</if>
<if test="internetSvcCommission != null">
internet_svc_commission,
</if>
<if test="platformCommission != null">
platform_commission,
</if>
<if test="platformSvcCommisssion != null">
platform_svc_commisssion,
</if>
<if test="operationCommission != null">
operation_commission,
</if>
<if test="operationSvcCommission != null">
operation_svc_commission,
</if>
<if test="startSoc != null">
start_soc,
</if>
<if test="endSoc != null">
end_soc,
</if>
<if test="reconciliationStatus != null">
reconciliation_status,
</if>
<if test="sortingStatus != null">
sorting_status,
</if>
<if test="type != null">
type,
</if>
<if test="status != null">
status,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="remark != null">
remark,
</if>
<if test="state != null">
state,
</if>
<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>
<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 and ''!=operatorId3rdptyEvcs">
operator_id3rdpty_evcs,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="stopReasonEvcs != null">
stop_reason_evcs,
</if>
<if test="null != rateModelId">
rate_model_id,
</if>
<if test="totalPower != null">
total_power,
</if>
<if test="userNameEvcs != null">
user_name_evcs,
</if>
<if test="phone != null">
phone,
</if>
<if test="chargingMode != null">
charging_mode,
</if>
<if test="source != null">
source,
</if>
<if test="internetDegreeCommission != null">
internet_degree_commission,
</if>
<if test="activityPowerPriceTotal != null">
activity_power_price_total,
</if>
<if test="activityServicePriceTotal != null">
activity_service_price_total,
</if>
<if test="activityTotalPrice != null">
activity_total_price,
</if>
<if test="activityId != null and activityId !=''">
activity_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="chargingStationId != null">
#{chargingStationId,jdbcType=BIGINT},
</if>
<if test="chargeOrderId != null">
#{chargeOrderId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="terminalId != null">
#{terminalId,jdbcType=BIGINT},
</if>
<if test="serialNumber != null">
#{serialNumber,jdbcType=VARCHAR},
</if>
<if test="internetSerialNumber != null and ''!=internetSerialNumber">
#{internetSerialNumber,jdbcType=VARCHAR},
</if>
<if test="powerPriceTotal != null">
#{powerPriceTotal,jdbcType=DECIMAL},
</if>
<if test="servicePriceTotal != null">
#{servicePriceTotal,jdbcType=DECIMAL},
</if>
<if test="totalPrice != null">
#{totalPrice,jdbcType=DECIMAL},
</if>
<if test="promotionDiscount != null">
#{promotionDiscount},
</if>
<if test="actPrice != null">
#{actPrice,jdbcType=DECIMAL},
</if>
<if test="actPowerPrice != null">
#{actPowerPrice,jdbcType=DECIMAL},
</if>
<if test="actServicePrice != null">
#{actServicePrice,jdbcType=DECIMAL},
</if>
<if test="internetCommission != null">
#{internetCommission,jdbcType=DECIMAL},
</if>
<if test="internetSvcCommission != null">
#{internetSvcCommission,jdbcType=DECIMAL},
</if>
<if test="platformCommission != null">
#{platformCommission,jdbcType=DECIMAL},
</if>
<if test="platformSvcCommisssion != null">
#{platformSvcCommisssion,jdbcType=DECIMAL},
</if>
<if test="operationCommission != null">
#{operationCommission,jdbcType=DECIMAL},
</if>
<if test="operationSvcCommission != null">
#{operationSvcCommission,jdbcType=DECIMAL},
</if>
<if test="startSoc != null">
#{startSoc,jdbcType=VARCHAR},
</if>
<if test="endSoc != null">
#{endSoc,jdbcType=VARCHAR},
</if>
<if test="reconciliationStatus != null">
#{reconciliationStatus,jdbcType=INTEGER},
</if>
<if test="sortingStatus != null">
#{sortingStatus,jdbcType=INTEGER},
</if>
<if test="type != null">
#{type,jdbcType=TINYINT},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="state != null">
#{state,jdbcType=INTEGER},
</if>
<if test="vinNormal != null">
#{vinNormal,jdbcType=VARCHAR},
</if>
<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 and ''!=operatorId3rdptyEvcs">
#{operatorId3rdptyEvcs,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="stopReasonEvcs != null">
#{stopReasonEvcs,jdbcType=INTEGER},
</if>
<if test="null != rateModelId">
#{rateModelId},
</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>
<if test="chargingMode != null">
#{chargingMode,jdbcType=VARCHAR},
</if>
<if test="source != null">
#{source},
</if>
<if test="internetDegreeCommission != null">
#{internetDegreeCommission},
</if>
<if test="activityPowerPriceTotal != null">
#{activityPowerPriceTotal},
</if>
<if test="activityServicePriceTotal != null">
#{activityServicePriceTotal},
</if>
<if test="activityTotalPrice != null">
#{activityTotalPrice},
</if>
<if test="activityId != null and activityId !=''">
#{activityId},
</if>
</trim>
</insert>
<insert id="insertXhpcWorkHistoryOrderDto" parameterType="com.xhpc.order.dto.XhpcWorkHistoryOrderDto" useGeneratedKeys="true"
keyProperty="historyOrderId">
INSERT INTO xhpc_work_history_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="chargingStationId != null">
charging_station_id,
</if>
<if test="chargeOrderId != null">
charge_order_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="terminalId != null">
terminal_id,
</if>
<if test="serialNumber != null">
serial_number,
</if>
<if test="internetSerialNumber != null and ''!=internetSerialNumber">
internet_serial_number,
</if>
<if test="powerPriceTotal != null">
power_price_total,
</if>
<if test="servicePriceTotal != null">
service_price_total,
</if>
<if test="totalPrice != null">
total_price,
</if>
<if test="promotionDiscount != null">
promotion_discount,
</if>
<if test="actPrice != null">
act_price,
</if>
<if test="actPowerPrice != null">
act_power_price,
</if>
<if test="actServicePrice != null">
act_service_price,
</if>
<if test="internetCommission != null">
internet_commission,
</if>
<if test="internetSvcCommission != null">
internet_svc_commission,
</if>
<if test="platformCommission != null">
platform_commission,
</if>
<if test="platformSvcCommisssion != null">
platform_svc_commisssion,
</if>
<if test="operationCommission != null">
operation_commission,
</if>
<if test="operationSvcCommission != null">
operation_svc_commission,
</if>
<if test="startSoc != null">
start_soc,
</if>
<if test="endSoc != null">
end_soc,
</if>
<if test="reconciliationStatus != null">
reconciliation_status,
</if>
<if test="sortingStatus != null">
sorting_status,
</if>
<if test="type != null">
type,
</if>
<if test="status != null">
status,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="remark != null">
remark,
</if>
<if test="state != null">
state,
</if>
<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>
<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 and ''!=operatorId3rdptyEvcs">
operator_id3rdpty_evcs,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="stopReasonEvcs != null">
stop_reason_evcs,
</if>
<if test="null != rateModelId">
rate_model_id,
</if>
<if test="totalPower != null">
total_power,
</if>
<if test="userNameEvcs != null">
user_name_evcs,
</if>
<if test="phone != null">
phone,
</if>
<if test="chargingMode != null">
charging_mode,
</if>
<if test="source != null">
source,
</if>
<if test="internetDegreeCommission != null">
internet_degree_commission,
</if>
<if test="activityPowerPriceTotal != null">
activity_power_price_total,
</if>
<if test="activityServicePriceTotal != null">
activity_service_price_total,
</if>
<if test="activityTotalPrice != null">
activity_total_price,
</if>
<if test="activityId != null and activityId !=''">
activity_id,
</if>
<if test="stopReasonEvcsName != null and stopReasonEvcsName !=''">
stop_reason_evcs_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="chargingStationId != null">
#{chargingStationId,jdbcType=BIGINT},
</if>
<if test="chargeOrderId != null">
#{chargeOrderId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="terminalId != null">
#{terminalId,jdbcType=BIGINT},
</if>
<if test="serialNumber != null">
#{serialNumber,jdbcType=VARCHAR},
</if>
<if test="internetSerialNumber != null and ''!=internetSerialNumber">
#{internetSerialNumber,jdbcType=VARCHAR},
</if>
<if test="powerPriceTotal != null">
#{powerPriceTotal,jdbcType=DECIMAL},
</if>
<if test="servicePriceTotal != null">
#{servicePriceTotal,jdbcType=DECIMAL},
</if>
<if test="totalPrice != null">
#{totalPrice,jdbcType=DECIMAL},
</if>
<if test="promotionDiscount != null">
#{promotionDiscount},
</if>
<if test="actPrice != null">
#{actPrice,jdbcType=DECIMAL},
</if>
<if test="actPowerPrice != null">
#{actPowerPrice,jdbcType=DECIMAL},
</if>
<if test="actServicePrice != null">
#{actServicePrice,jdbcType=DECIMAL},
</if>
<if test="internetCommission != null">
#{internetCommission,jdbcType=DECIMAL},
</if>
<if test="internetSvcCommission != null">
#{internetSvcCommission,jdbcType=DECIMAL},
</if>
<if test="platformCommission != null">
#{platformCommission,jdbcType=DECIMAL},
</if>
<if test="platformSvcCommisssion != null">
#{platformSvcCommisssion,jdbcType=DECIMAL},
</if>
<if test="operationCommission != null">
#{operationCommission,jdbcType=DECIMAL},
</if>
<if test="operationSvcCommission != null">
#{operationSvcCommission,jdbcType=DECIMAL},
</if>
<if test="startSoc != null">
#{startSoc,jdbcType=VARCHAR},
</if>
<if test="endSoc != null">
#{endSoc,jdbcType=VARCHAR},
</if>
<if test="reconciliationStatus != null">
#{reconciliationStatus,jdbcType=INTEGER},
</if>
<if test="sortingStatus != null">
#{sortingStatus,jdbcType=INTEGER},
</if>
<if test="type != null">
#{type,jdbcType=TINYINT},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="state != null">
#{state,jdbcType=INTEGER},
</if>
<if test="vinNormal != null">
#{vinNormal,jdbcType=VARCHAR},
</if>
<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 and ''!=operatorId3rdptyEvcs">
#{operatorId3rdptyEvcs,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="stopReasonEvcs != null">
#{stopReasonEvcs,jdbcType=INTEGER},
</if>
<if test="null != rateModelId">
#{rateModelId},
</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>
<if test="chargingMode != null">
#{chargingMode,jdbcType=VARCHAR},
</if>
<if test="source != null">
#{source},
</if>
<if test="internetDegreeCommission != null">
#{internetDegreeCommission},
</if>
<if test="activityPowerPriceTotal != null">
#{activityPowerPriceTotal},
</if>
<if test="activityServicePriceTotal != null">
#{activityServicePriceTotal},
</if>
<if test="activityTotalPrice != null">
#{activityTotalPrice},
</if>
<if test="activityId != null and activityId !=''">
#{activityId},
</if>
<if test="stopReasonEvcsName != null and stopReasonEvcsName !=''">
#{stopReasonEvcsName},
</if>
</trim>
</insert>
<update id="update" parameterType="com.xhpc.order.domain.XhpcHistoryOrder">
UPDATE xhpc_history_order
<set>
<if test="chargingStationId != null">
charging_station_id = #{chargingStationId},
</if>
<if test="chargeOrderId != null">
charge_order_id = #{chargeOrderId},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="terminalId != null">
terminal_id = #{terminalId},
</if>
<if test="serialNumber != null">
serial_number = #{serialNumber},
</if>
<if test="internetSerialNumber != null">
internet_serial_number = #{internetSerialNumber},
</if>
<if test="powerPriceTotal != null">
power_price_total = #{powerPriceTotal},
</if>
<if test="servicePriceTotal != null">
service_price_total = #{servicePriceTotal},
</if>
<if test="totalPrice != null">
total_price = #{totalPrice},
</if>
<if test="promotionDiscount != null">
promotion_discount = #{promotionDiscount},
</if>
<if test="actPrice != null">
act_price = #{actPrice},
</if>
<if test="actPowerPrice != null">
act_power_price = #{actPowerPrice},
</if>
<if test="actServicePrice != null">
act_service_price = #{actServicePrice},
</if>
<if test="internetCommission != null">
internet_commission = #{internetCommission},
</if>
<if test="internetSvcCommission != null">
internet_svc_commission = #{internetSvcCommission},
</if>
<if test="platformCommission != null">
platform_commission = #{platformCommission},
</if>
<if test="platformSvcCommisssion != null">
platform_svc_commisssion = #{platformSvcCommisssion},
</if>
<if test="operationCommission != null">
operation_commission = #{operationCommission},
</if>
<if test="operationSvcCommission != null">
operation_svc_commission = #{operationSvcCommission},
</if>
<if test="startSoc != null">
start_soc = #{startSoc},
</if>
<if test="endSoc != null">
end_soc = #{endSoc},
</if>
<if test="reconciliationStatus != null">
reconciliation_status = #{reconciliationStatus},
</if>
<if test="sortingStatus != null">
sorting_status = #{sortingStatus},
</if>
<if test="type != null">
`type` = #{type},
</if>
<if test="status != null">
`status` = #{status},
</if>
<if test="delFlag != null">
del_flag = #{delFlag},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="createBy != null">
create_by = #{createBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="state != null">
`state` = #{state},
</if>
<if test="vinNormal != null">
vin_normal = #{vinNormal},
</if>
<if test="searchValue != null">
search_value = #{searchValue},
</if>
<if test="operatorIdEvcs != null">
operator_id_evcs = #{operatorIdEvcs},
</if>
<if test="chargeModelEvcs != null">
charge_model_evcs = #{chargeModelEvcs},
</if>
<if test="connectorPowerEvcs != null">
connector_power_evcs = #{connectorPowerEvcs},
</if>
<if test="meterValueEndEvcs != null">
meter_value_end_evcs = #{meterValueEndEvcs},
</if>
<if test="meterValueStartEvcs != null">
meter_value_start_evcs = #{meterValueStartEvcs},
</if>
<if test="operatorId3rdptyEvcs != null">
operator_id3rdpty_evcs = #{operatorId3rdptyEvcs},
</if>
<if test="startTime != null">
start_time = #{startTime},
</if>
<if test="stopReasonEvcs != null">
stop_reason_evcs = #{stopReasonEvcs},
</if>
<if test="totalPower != null">
total_power = #{totalPower},
</if>
<if test="userNameEvcs != null">
user_name_evcs = #{userNameEvcs},
</if>
<if test="phone != null">
phone = #{phone},
</if>
</set>
where history_order_id = #{historyOrderId}
</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>
<update id="updateReconciliation" parameterType="java.lang.String">
update xhpc_history_order set reconciliation_status = #{status} where history_order_id in
<foreach collection="xhpcHistoryOrderIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="updateSorting" parameterType="java.lang.String">
update xhpc_history_order set sorting_status = #{status} where history_order_id in
<foreach collection="xhpcHistoryOrderIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<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,
cs.name as chargingStationName,
te.name as terminalName,
ho.act_price as actPrice,
ho.total_power as chargingDegree,
co.charging_time as chargingTime,
case when ho.parking_voucher=1 then '否'
else '是'
end as 'barrierGateRecordName'
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
left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id
where ho.status=0 and ho.del_flag=0 and ho.user_id =#{userId}
<if test="tenantId !=null and tenantId !=''">
and ho.tenant_id =#{tenantId}
</if>
<if test="source !=null">
and ho.source =#{source}
</if>
order by ho.create_time desc
</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,
ho.total_power as chargingDegree,
ho.total_price as totalPrice,
ho.power_price_total as powerPriceTotal,
ho.promotion_discount as promotionDiscount,
DATE_FORMAT(ho.start_time,'%m月%d日') as daysOne,
DATE_FORMAT(ho.start_time,'%H:%i:%s') as timeOne,
DATE_FORMAT(ho.end_time,'%m月%d日') as daysTwo,
DATE_FORMAT(ho.end_time,'%H:%i:%s') as timeTwo,
co.status as status,
ho.start_soc as startSoc,
ho.end_soc as endSoc,
ho.internet_serial_number as internetSerialNumber,
te.serial_number as terminalSerialNumber,
co.Plate_num as plateNum,
ho.stop_reason_evcs as typeName,
case when ho.parking_voucher=2 then '是'
else '否'
end as 'barrierGateRecordName'
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
left join xhpc_charge_order as co on co.charge_order_id =ho.charge_order_id
where ho.status=0 and ho.del_flag=0
<if test="userId !=null">
and ho.user_id =#{userId}
</if>
<if test="historyOrderId !=null">
and ho.history_order_id =#{historyOrderId}
</if>
<if test="chargingOrderId !=null">
and ho.charge_order_id =#{chargingOrderId}
</if>
<if test="tenantId !=null and tenantId !=''">
and ho.tenant_id =#{tenantId}
</if>
<if test="source !=null ">
and ho.source =#{source}
</if>
order by ho.create_time desc
</select>
<select id="getListPage" resultType="map">
select
ho.history_order_id as historyOrderId,
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.vin_normal as vinCode,
ho.internet_serial_number as internetSerialNumber,
ho.evcs_order_no as evcsOrderNo,
ho.total_price as totalPrice,
ho.act_price as actPrice,
ho.confirm_Result as confirmResult,
co.charging_time as chargingTime,
ho.total_power as chargingDegree,
ho.start_time as startTime,
ho.end_time as endTime,
co.update_time as updateTime,
co.source as source,
co.Plate_num as plateNum,
dispute_order_status as disputeOrderStatus,
co.driver_id as internetUserPhone,
inu.name as internetName,
apu.phone as appUserPhone,
ho.power_price_total as powerPriceTotal,
ho.service_price_total as servicePriceTotal,
ho.promotion_discount as promotionDiscount,
ho.activity_power_price_total as activityPowerPriceTotal,
ho.activity_service_price_total as activityServicePriceTotal,
ho.activity_total_price as activityTotalPrice,
ho.act_power_price as actPowerPrice,
ho.act_service_price as actServicePrice,
(ho.act_power_price+ho.act_service_price) as actSumPrice,
ho.internet_commission as internetCommission,
ho.internet_svc_commission as internetSvcCommission,
ho.internet_degree_commission as internetDegreeCommission,
ho.platform_commission as platformCommission,
ho.platform_svc_commisssion as platformSvcCommisssion,
ho.operation_commission as operationCommission,
ho.operation_svc_commission as operationSvcCommission,
ho.stop_reason_evcs as stopReasonEvcs,
cop.account as communityAccount,
cup.account as customersAccount,
case when co.source=0 then "C端用户"
when co.source=1 then "流量方用户"
when co.source=2 then "社区用户"
else "B端客户!"
end sourceName,
case when ho.parking_voucher=1 then '否'
else '是'
end as 'barrierGateRecordName',
case when ho.charging_mode="1" then "快电"
when ho.charging_mode="2" then "恒大"
when ho.charging_mode="3" then "新电途"
when ho.charging_mode="4" then "小桔"
when ho.charging_mode="微信" then "微信"
when ho.charging_mode="支付宝" then "支付宝"
else "刷卡"
end chargingModeName
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
left join et_dispute_orders as ed on ed.start_charge_seq = ho.internet_serial_number and ed.dispute_order_status !=2
left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null and ho.source=1
left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null and ho.source=0
left join xhpc_community_personnel as cop on cop.community_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=2
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=3
<if test="number==1">
inner join (
select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where xau.phone LIKE concat('%',#{phone}, '%')
union
select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2 and xcp.account LIKE concat('%',#{phone}, '%')
union
select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%')
) ut on ut.history_order_id = ho.history_order_id
</if>
where ho.status =0 and ho.del_flag=0
<if test="chargingStationId !=null">
and ho.charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and ho.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId} and del_flag=0)
</if>
<if test="terminalId !=null">
and ho.terminal_id=#{terminalId}
</if>
<if test="confirmResult !=null">
and ho.confirm_Result =#{confirmResult}
</if>
<if test="type !=null">
and ho.type=#{type}
</if>
<if test="source !=null">
and ho.source=#{source}
</if>
<if test="plateNum !=null and plateNum !=''">
and co.Plate_num like concat('%', #{plateNum}, '%')
</if>
<if test="internetId !=null">
and inu.internet_user_id=#{internetId}
</if>
<if test="internetSerialNumber !=null and internetSerialNumber !=''">
and ho.internet_serial_number like concat('%', #{internetSerialNumber}, '%')
</if>
<if test="terminalName !=null and terminalName !=''">
and ter.name like concat(#{terminalName}, '%')
</if>
<if test="vinCode !=null and vinCode !=''">
and ho.vin_normal like concat('%', #{vinCode}, '%')
</if>
<if test="evcsOrderNo !=null and evcsOrderNo !=''">
and co.evcs_order_no like concat('%', #{evcsOrderNo}, '%')
</if>
<if test="beginStartTime !=null and beginStartTime !=''">
and ho.start_time &gt;= #{beginStartTime}
</if>
<if test="beginEndTime !=null and beginEndTime !=''">
and ho.start_time &lt;= #{beginEndTime}
</if>
<if test="overStartTime !=null and overStartTime !=''">
and ho.end_time &gt;= #{overStartTime}
</if>
<if test="overEndTime !=null and overEndTime !=''">
and ho.end_time &lt;= #{overEndTime}
</if>
<if test="transactionNumber !=null and transactionNumber !=''">
and ho.serial_number like concat('%', #{transactionNumber}, '%')
</if>
<if test="chargingStationName !=null and chargingStationName !=''">
and ct.name like concat('%', #{chargingStationName}, '%')
</if>
<if test="operatorId !=null">
and op.operator_id =#{operatorId}
</if>
<if test="number==2">
<if test="source ==0">
and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0)
</if>
<if test="source ==1">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1)
</if>
<if test="source ==2">
and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2)
</if>
<if test="source ==3">
and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3)
</if>
</if>
<if test="number==3">
<if test="source ==0">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0 and xau.phone LIKE concat('%',#{phone}, '%'))
</if>
<if test="source ==1">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1 and xiu.phone LIKE concat('%',#{phone}, '%'))
</if>
<if test="source ==2">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2 and xcp.account LIKE concat('%',#{phone}, '%'))
</if>
<if test="source ==3">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%'))
</if>
</if>
<if test="status==1">
and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<if test="status==2">
and co.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if>
<if test="personnelId !=null">
and ho.user_id=#{personnelId}
</if>
<if test="tenantId !=null and '' !=tenantId">
and ho.tenant_id=#{tenantId}
</if>
<if test="isNotNull==1">
and ho.total_price &gt;=0
</if>
order by ho.end_time desc
</select>
<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_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{startTime}
)
<if test="endTime !='' and endTime !=null and endTime !='00:00:00' ">
<if test="endTime !='24:00:00' ">
or rt.rate_time_id in (
SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time &lt;= #{endTime} AND replace(end_time, '00:00:00', '23:59:59') &gt;= #{endTime}
)
</if>
</if>
and rt.rate_model_id = #{rateModelId}
</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,
ho.start_time as startTime,
ho.end_time as endTime,
co.update_time as updateTime,
co.charging_time as chargingTimeTotal,
ho.total_price as totalPrice,
ho.remark as remark,
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.activity_power_price_total as activityPowerPriceTotal,
ho.activity_service_price_total as activityServicePriceTotal,
ho.activity_total_price as activityTotalPrice,
ho.internet_commission as internetCommission,
ho.internet_svc_commission as internetSvcCommission,
ho.internet_degree_commission as internetDegreeCommission,
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,
ho.total_power as totalPower,
ed.total_power as sanTotalPower,
ed.total_money as sanTotalMoney,
case when ed.dispute_reason=1 then "交易不存在"
when ed.dispute_reason=2 then "交易金额错误"
when ed.dispute_reason=3 then "交易电量错误"
else "自定义!"
end sanDisputeReason,
ed.check_order_seq as sanCheckOrderSeq,
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id and ho.source=0) as appUserPhone,
co.driver_id as internetUserPhone,
(SELECT account from xhpc_community_personnel where community_personnel_id = co.user_id and ho.source=2) as communityAccount,
(SELECT account from xhpc_customers_personnel where customers_personnel_id = co.user_id and ho.source=3) as customersAccount,
co.Plate_num as plateNum,
(SELECT name from xhpc_internet_user where internet_user_id = co.user_id and co.source =1) as internetName,
ho.stop_reason_evcs as stopReasonRvcsName
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
left join et_dispute_orders as ed on ed.start_charge_seq = ho.internet_serial_number and ed.dispute_order_status !=2
where ho.history_order_id=#{historyOrderId}
</select>
<select id="getStatistisList" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
select 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.internet_degree_commission as internetDegreeCommission,
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,
ho.start_time as startTime,
ho.end_time as endTime,
co.charging_time_number as chargingTimeNumber,
ho.total_power as chargingDegree,
co.rate_model_id as rateModelId,
cs.operator_id as operatorId,
te.charging_pile_id as chargingPileId,
co.user_id as userId,
co.user_id as internetUserId,
ho.charging_mode as chargingMode,
ho.activity_power_price_total as activityPowerPriceTotal,
ho.activity_service_price_total as activityServicePriceTotal,
ho.activity_total_price as activityTotalPrice,
ho.create_time as createTime
from xhpc_history_order ho
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 ho.state = #{state} and ho.total_price is not null
limit 0,#{number}
</select>
<select id="getNoStatisticsOrderTime" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
select
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.internet_degree_commission as internetDegreeCommission,
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,
ho.start_time as startTime,
ho.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,
co.user_id as internetUserId,
ho.charging_mode as chargingMode,
ho.activity_power_price_total as activityPowerPriceTotal,
ho.activity_service_price_total as activityServicePriceTotal,
ho.activity_total_price as activityTotalPrice,
ho.create_time as createTime
from xhpc_history_order ho
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 ho.history_order_id not in (select history_order_id from xhpc_statistics_time_interval where DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= create_time)
and ho.total_price is not null and DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= ho.end_time and now() &gt;DATE_ADD(ho.end_time,interval 6 hour)
limit 0,#{number}
</select>
<select id="getNoStatisticsOrderDay" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
select
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.internet_degree_commission as internetDegreeCommission,
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,
ho.start_time as startTime,
ho.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,
co.user_id as internetUserId,
ho.charging_mode as chargingMode,
ho.activity_power_price_total as activityPowerPriceTotal,
ho.activity_service_price_total as activityServicePriceTotal,
ho.activity_total_price as activityTotalPrice,
ho.create_time as createTime
from xhpc_history_order ho
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 ho.history_order_id not in (select history_order_id from xhpc_statistics_station where type =2 and DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= create_time)
and ho.total_price is not null and DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= ho.end_time and now() &gt;DATE_ADD(ho.end_time,interval 6 hour)
limit 0,#{number}
</select>
<select id="getNoStatisticsOrder" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
select
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.internet_degree_commission as internetDegreeCommission,
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,
ho.start_time as startTime,
ho.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,
co.user_id as internetUserId,
ho.charging_mode as chargingMode,
ho.activity_power_price_total as activityPowerPriceTotal,
ho.activity_service_price_total as activityServicePriceTotal,
ho.activity_total_price as activityTotalPrice,
ho.create_time as createTime
from xhpc_history_order ho
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 ho.history_order_id not in (select history_order_id from xhpc_statistics_station and type =2 )
and ho.total_price is not null and now() >DATE_ADD(ho.end_time,interval 6 hour)
limit 0,#{number}
</select>
<update id="updateXhpcHistoryOrder">
update xhpc_history_order set state = #{state} where history_order_id=#{historyOrderId}
</update>
<select id="getLandUser" resultType="map">
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
</select>
<select id="getchargingOrderById" resultType="map">
select
co.serial_number AS serialNumber,
co.charging_time AS chargingTime,
co.charging_degree AS chargingDegree,
co.rate_model_id AS rateModelId,
DATE_FORMAT(co.start_time, '%m月%d日') AS daysOne,
DATE_FORMAT(co.start_time, '%H:%i:%s') AS timeOne,
DATE_FORMAT(co.end_time, '%m月%d日') AS daysTwo,
DATE_FORMAT(co.end_time, '%H:%i:%s') AS timeTwo,
te. NAME AS terminalName,
co. STATUS AS STATUS,
co.type AS type,
cs. NAME AS chargingStationName,
te. NAME AS terminalName,
co.type as typeName
from xhpc_charge_order co
LEFT JOIN xhpc_terminal AS te ON te.terminal_id = co.terminal_id
LEFT JOIN xhpc_charging_station AS cs ON cs.charging_station_id = co.charging_station_id
where charge_order_id=#{chargingOrderId}
<if test="userId !=null">
and co.user_id = #{userId}
</if>
<if test="source !=null">
and co.source = #{source}
</if>
<if test="tenantId !=null and tenantId !=''">
and co.tenant_id = #{tenantId}
</if>
</select>
<update id="updateXhpcHistoryOrderSerialNumber" parameterType="com.xhpc.order.domain.XhpcHistoryOrder">
UPDATE xhpc_history_order
<set>
<if test="chargingStationId != null">
charging_station_id = #{chargingStationId},
</if>
<if test="chargeOrderId != null">
charge_order_id = #{chargeOrderId},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="terminalId != null">
terminal_id = #{terminalId},
</if>
<if test="serialNumber != null">
serial_number = #{serialNumber},
</if>
<if test="internetSerialNumber != null and ''!=internetSerialNumber">
internet_serial_number = #{internetSerialNumber},
</if>
<if test="powerPriceTotal != null">
power_price_total = #{powerPriceTotal},
</if>
<if test="servicePriceTotal != null">
service_price_total = #{servicePriceTotal},
</if>
<if test="totalPrice != null">
total_price = #{totalPrice},
</if>
<if test="promotionDiscount != null">
promotion_discount = #{promotionDiscount},
</if>
<if test="actPrice != null">
act_price = #{actPrice},
</if>
<if test="actPowerPrice != null">
act_power_price = #{actPowerPrice},
</if>
<if test="actServicePrice != null">
act_service_price = #{actServicePrice},
</if>
<if test="internetCommission != null">
internet_commission = #{internetCommission},
</if>
<if test="internetSvcCommission != null">
internet_svc_commission = #{internetSvcCommission},
</if>
<if test="platformCommission != null">
platform_commission = #{platformCommission},
</if>
<if test="platformSvcCommisssion != null">
platform_svc_commisssion = #{platformSvcCommisssion},
</if>
<if test="operationCommission != null">
operation_commission = #{operationCommission},
</if>
<if test="operationSvcCommission != null">
operation_svc_commission = #{operationSvcCommission},
</if>
<if test="startSoc != null">
start_soc = #{startSoc},
</if>
<if test="endSoc != null">
end_soc = #{endSoc},
</if>
<if test="reconciliationStatus != null">
reconciliation_status = #{reconciliationStatus},
</if>
<if test="sortingStatus != null">
sorting_status = #{sortingStatus},
</if>
<if test="type != null">
`type` = #{type},
</if>
<if test="status != null">
`status` = #{status},
</if>
<if test="delFlag != null">
del_flag = #{delFlag},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="createBy != null">
create_by = #{createBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="state != null">
`state` = #{state},
</if>
<if test="vinNormal != null">
vin_normal = #{vinNormal},
</if>
<if test="searchValue != null">
search_value = #{searchValue},
</if>
<if test="operatorIdEvcs != null">
operator_id_evcs = #{operatorIdEvcs},
</if>
<if test="chargeModelEvcs != null">
charge_model_evcs = #{chargeModelEvcs},
</if>
<if test="connectorPowerEvcs != null">
connector_power_evcs = #{connectorPowerEvcs},
</if>
<if test="meterValueEndEvcs != null">
meter_value_end_evcs = #{meterValueEndEvcs},
</if>
<if test="meterValueStartEvcs != null">
meter_value_start_evcs = #{meterValueStartEvcs},
</if>
<if test="operatorId3rdptyEvcs != null">
operator_id3rdpty_evcs = #{operatorId3rdptyEvcs},
</if>
<if test="startTime != null">
start_time = #{startTime},
</if>
<if test="stopReasonEvcs != null">
stop_reason_evcs = #{stopReasonEvcs},
</if>
<if test="totalPower != null">
total_power = #{totalPower},
</if>
<if test="userNameEvcs != null">
user_name_evcs = #{userNameEvcs},
</if>
<if test="phone != null">
phone = #{phone},
</if>
<if test="parkingVoucher != null">
parking_voucher = #{parkingVoucher},
</if>
</set>
where internet_serial_number = #{internetSerialNumber}
</update>
<update id="updateXhpcHistoryOrderParkingVoucher" parameterType="com.xhpc.order.domain.XhpcHistoryOrder">
UPDATE xhpc_history_order set parking_voucher = 2 where history_order_id = #{historyOrderId}
</update>
<select id="getHistoryOrderById" resultType="com.xhpc.order.domain.XhpcHistoryOrder">
select * from xhpc_history_order
where 1=1
<if test="historyOrderId!=null">
and history_order_id=#{historyOrderId}
</if>
<if test="serialNumber !=null and serialNumber !=''">
and serial_number=#{serialNumber}
</if>
</select>
<select id="getXhpcRealTimeOrderTwentyFour" resultType="map">
select max(real_time_order_id),
amount_charged as amountCharged,
charging_degree as chargingDegree
from xhpc_real_time_order where create_time &lt;= #{time} and charging_order_id=#{chargingOrderId}
</select>
<select id="getToday" resultType="int">
select count(history_order_id) number
from xhpc_history_order
where source =1 and create_time &gt;= #{time} and confirm_Result !=0
<if test="tenantId !=null and '' !=tenantId">
and tenant_id=#{tenantId}
</if>
<if test="status==1">
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="status==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
<if test="status==3">
and find_in_set (charging_station_id,(select station_ids from xhpc_work_user where work_user_id=#{logOperatorId}))
</if>
</select>
<select id="getChengDuShiToday" resultType="int">
select
count(history_order_id) number
from xhpc_history_order
where history_order_id> (select last_push_order from et_auth_sec_token where id=2)
</select>
<select id="getConfirmResultPage" resultType="map">
SELECT
xho.history_order_id as historyOrderId,
xcs.name as chargingStationName,
xho.serial_number as serialNumber,
xho.confirm_Result as status,
xho.start_time as startTime,
xho.end_time as endTime,
xho.source as source,
xho.internet_serial_number as internetSerialNumber,
case when xho.charging_mode="1" then "快电"
when xho.charging_mode="2" then "恒大"
when xho.charging_mode="3" then "新电途"
when xho.charging_mode="4" then "小桔"
when xho.charging_mode="微信" then "微信"
when xho.charging_mode="支付宝" then "支付宝"
else "刷卡"
end chargingModeName
FROM xhpc_history_order xho
LEFT JOIN xhpc_charging_station xcs on xcs.charging_station_id = xho.charging_station_id
<if test="status==null">
where ((xho.confirm_Result !=0 and xho.source =1)
or xho.history_order_id >(select last_push_order from et_auth_sec_token where id=2))
</if>
<if test="status==0">
where (xho.history_order_id >(select last_push_order from et_auth_sec_token where id=2) or xho.source !=1)
</if>
<if test="status==1">
where xho.confirm_Result =-1 and xho.source =1
</if>
<if test="status==2">
where xho.confirm_Result &gt;=1 and xho.source =1
</if>
<if test="number==1">
and xho.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
</if>
<if test="number==2">
and xho.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
</if>
<if test="number==3">
and find_in_set (xho.charging_station_id,(select station_ids from xhpc_work_user where work_user_id=#{logOperatorId}))
</if>
</select>
<update id="updateOrderConfirmResult">
UPDATE xhpc_history_order set confirm_Result =0 where history_order_id=#{historyOrderId}
</update>
<update id="updateOrderInternetPush">
UPDATE xhpc_history_order set confirm_Result =-1 where history_order_id=#{historyOrderId}
</update>
<update id="cancelOrders">
UPDATE xhpc_history_order set confirm_Result =0 where history_order_id=#{historyOrderId}
</update>
<update id="updateChengDuPush">
UPDATE et_auth_sec_token set last_push_order =#{historyOrderId} where id=2
</update>
<select id="getXhpcRateTimeFee" resultType="map">
select xrt.rate_time_id as rateTimeId,
xrt.rate_id as rateId,
xrt.start_time as startTime,
xrt.end_time as endTime,
xr.power_fee as powerFee,
xr.service_fee as serviceFee
from xhpc_rate_time xrt
left join xhpc_rate xr on xr.rate_id = xrt.rate_id
where xrt.rate_model_id = #{rateModelId}
and xrt.start_time &lt;= #{date}
and replace(xrt.end_time, '00:00:00', '24:00:00') &gt;= #{date}
and xrt.status = 0
and xrt.del_flag = 0
limit 1
</select>
</mapper>