2021-07-24 18:07:51 +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.XhpcHistoryOrderMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.xhpc.order.domain.XhpcHistoryOrder" id="XhpcHistoryOrderResult">
|
|
|
|
|
<result column="history_order_id" property="historyOrderId"/>
|
|
|
|
|
<result column="charging_station_id" property="chargingStationId"/>
|
2021-08-09 18:47:43 +08:00
|
|
|
<result column="charging_order_id" property="chargeOrderId"/>
|
2021-07-24 18:07:51 +08:00
|
|
|
<result column="user_id" property="userId"/>
|
|
|
|
|
<result column="terminal_id" property="terminalId"/>
|
|
|
|
|
<result column="serial_number" property="serialNumber"/>
|
|
|
|
|
<result column="internet_serial_number" property="internetSerialNumber"/>
|
|
|
|
|
<result column="total_price" property="totalPrice"/>
|
|
|
|
|
<result column="promotion_discount" property="promotionDiscount"/>
|
|
|
|
|
<result column="act_price" property="actPrice"/>
|
|
|
|
|
<result column="act_power_price" property="actPowerPrice"/>
|
|
|
|
|
<result column="act_service_price" property="actServicePrice"/>
|
|
|
|
|
<result column="internet_commission" property="internetCommission"/>
|
|
|
|
|
<result column="internet_svc_commission" property="internetSvcCommission"/>
|
|
|
|
|
<result column="platform_commission" property="platformCommission"/>
|
|
|
|
|
<result column="platform_svc_commisssion" property="platformSvcCommisssion"/>
|
|
|
|
|
<result column="operation_commission" property="operationCommission"/>
|
|
|
|
|
<result column="start_soc" property="startSoc"/>
|
|
|
|
|
<result column="end_soc" property="endSoc"/>
|
|
|
|
|
<result column="reconciliation_status" property="reconciliationStatus"/>
|
|
|
|
|
<result column="sorting_status" property="sortingStatus"/>
|
|
|
|
|
<result column="type" property="type"/>
|
|
|
|
|
<result column="status" property="status"/>
|
|
|
|
|
<result column="del_flag" property="delFlag"/>
|
|
|
|
|
<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"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<insert id="insert" parameterType="com.xhpc.order.domain.XhpcHistoryOrder" useGeneratedKeys="true"
|
2021-07-27 18:38:32 +08:00
|
|
|
keyProperty="historyOrderId">
|
2021-07-24 18:07:51 +08:00
|
|
|
INSERT INTO xhpc_history_order
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="null != chargingStationId and '' != chargingStationId">
|
|
|
|
|
charging_station_id,
|
|
|
|
|
</if>
|
2021-08-09 18:47:43 +08:00
|
|
|
<if test="null != chargeOrderId and '' != chargeOrderId">
|
|
|
|
|
charge_order_id,
|
2021-07-24 18:07:51 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="null != userId and '' != userId">
|
|
|
|
|
user_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != terminalId and '' != terminalId">
|
|
|
|
|
terminal_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != serialNumber and '' != serialNumber">
|
|
|
|
|
serial_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != internetSerialNumber and '' != internetSerialNumber">
|
|
|
|
|
internet_serial_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != totalPrice and '' != totalPrice">
|
|
|
|
|
total_price,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != promotionDiscount and '' != promotionDiscount">
|
|
|
|
|
promotion_discount,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != actPrice and '' != actPrice">
|
|
|
|
|
act_price,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != actPowerPrice and '' != actPowerPrice">
|
|
|
|
|
act_power_price,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != actServicePrice and '' != actServicePrice">
|
|
|
|
|
act_service_price,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != internetCommission and '' != internetCommission">
|
|
|
|
|
internet_commission,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != internetSvcCommission and '' != internetSvcCommission">
|
|
|
|
|
internet_svc_commission,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != platformCommission and '' != platformCommission">
|
|
|
|
|
platform_commission,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != platformSvcCommisssion and '' != platformSvcCommisssion">
|
|
|
|
|
platform_svc_commisssion,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != operationCommission and '' != operationCommission">
|
|
|
|
|
operation_commission,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != operationSvcCommission and '' != operationSvcCommission">
|
|
|
|
|
operation_svc_commission,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != startSoc and '' != startSoc">
|
|
|
|
|
start_soc,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != endSoc and '' != endSoc">
|
|
|
|
|
end_soc,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != reconciliationStatus and '' != reconciliationStatus">
|
|
|
|
|
reconciliation_status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != sortingStatus and '' != sortingStatus">
|
|
|
|
|
sorting_status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != type and '' != type">
|
|
|
|
|
type,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != status and '' != status">
|
|
|
|
|
status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != delFlag and '' != delFlag">
|
|
|
|
|
del_flag,
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != createTime ">
|
2021-07-24 18:07:51 +08:00
|
|
|
create_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != createBy and '' != createBy">
|
|
|
|
|
create_by,
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != updateTime">
|
2021-07-24 18:07:51 +08:00
|
|
|
update_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != updateBy and '' != updateBy">
|
|
|
|
|
update_by,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != remark and '' != remark">
|
|
|
|
|
remark
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="null != chargingStationId and '' != chargingStationId">
|
|
|
|
|
#{chargingStationId},
|
|
|
|
|
</if>
|
2021-08-09 18:47:43 +08:00
|
|
|
<if test="null != chargeOrderId and '' != chargeOrderId">
|
|
|
|
|
#{chargeOrderId},
|
2021-07-24 18:07:51 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="null != userId and '' != userId">
|
|
|
|
|
#{userId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != terminalId and '' != terminalId">
|
|
|
|
|
#{terminalId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != serialNumber and '' != serialNumber">
|
|
|
|
|
#{serialNumber},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != internetSerialNumber and '' != internetSerialNumber">
|
|
|
|
|
#{internetSerialNumber},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != totalPrice and '' != totalPrice">
|
|
|
|
|
#{totalPrice},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != promotionDiscount and '' != promotionDiscount">
|
|
|
|
|
#{promotionDiscount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != actPrice and '' != actPrice">
|
|
|
|
|
#{actPrice},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != actPowerPrice and '' != actPowerPrice">
|
|
|
|
|
#{actPowerPrice},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != actServicePrice and '' != actServicePrice">
|
|
|
|
|
#{actServicePrice},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != internetCommission and '' != internetCommission">
|
|
|
|
|
#{internetCommission},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != internetSvcCommission and '' != internetSvcCommission">
|
|
|
|
|
#{internetSvcCommission},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != platformCommission and '' != platformCommission">
|
|
|
|
|
#{platformCommission},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != platformSvcCommisssion and '' != platformSvcCommisssion">
|
|
|
|
|
#{platformSvcCommisssion},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != operationCommission and '' != operationCommission">
|
|
|
|
|
#{operationCommission},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != operationSvcCommission and '' != operationSvcCommission">
|
|
|
|
|
#{operationSvcCommission},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != startSoc and '' != startSoc">
|
|
|
|
|
#{startSoc},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != endSoc and '' != endSoc">
|
|
|
|
|
#{endSoc},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != reconciliationStatus and '' != reconciliationStatus">
|
|
|
|
|
#{reconciliationStatus},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != sortingStatus and '' != sortingStatus">
|
|
|
|
|
#{sortingStatus},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != type and '' != type">
|
|
|
|
|
#{type},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != status and '' != status">
|
|
|
|
|
#{status},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != delFlag and '' != delFlag">
|
|
|
|
|
#{delFlag},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != createTime ">
|
2021-07-24 18:07:51 +08:00
|
|
|
#{createTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != createBy and '' != createBy">
|
|
|
|
|
#{createBy},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != updateTime">
|
2021-07-24 18:07:51 +08:00
|
|
|
#{updateTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != updateBy and '' != updateBy">
|
|
|
|
|
#{updateBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != remark and '' != remark">
|
|
|
|
|
#{remark}
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="update" parameterType="com.xhpc.order.domain.XhpcHistoryOrder">
|
|
|
|
|
UPDATE xhpc_history_order
|
|
|
|
|
<set>
|
|
|
|
|
<if test="null != chargingStationId and '' != chargingStationId">charging_station_id =
|
|
|
|
|
#{chargingStationId},
|
|
|
|
|
</if>
|
2021-08-09 18:47:43 +08:00
|
|
|
<if test="null != chargeOrderId and '' != chargeOrderId">charge_order_id = #{chargeOrderId},</if>
|
2021-07-24 18:07:51 +08:00
|
|
|
<if test="null != userId and '' != userId">user_id = #{userId},</if>
|
|
|
|
|
<if test="null != terminalId and '' != terminalId">terminal_id = #{terminalId},</if>
|
|
|
|
|
<if test="null != serialNumber and '' != serialNumber">serial_number = #{serialNumber},</if>
|
|
|
|
|
<if test="null != internetSerialNumber and '' != internetSerialNumber">internet_serial_number =
|
|
|
|
|
#{internetSerialNumber},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != totalPrice">total_price = #{totalPrice},</if>
|
|
|
|
|
<if test="null != promotionDiscount">promotion_discount =
|
2021-07-24 18:07:51 +08:00
|
|
|
#{promotionDiscount},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != actPrice">act_price = #{actPrice},</if>
|
|
|
|
|
<if test="null != actPowerPrice">act_power_price = #{actPowerPrice},</if>
|
|
|
|
|
<if test="null != actServicePrice">act_service_price = #{actServicePrice},</if>
|
|
|
|
|
<if test="null != internetCommission ">internet_commission =
|
2021-07-24 18:07:51 +08:00
|
|
|
#{internetCommission},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != internetSvcCommission">internet_svc_commission =
|
2021-07-24 18:07:51 +08:00
|
|
|
#{internetSvcCommission},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != platformCommission">platform_commission =
|
2021-07-24 18:07:51 +08:00
|
|
|
#{platformCommission},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != platformSvcCommisssion">platform_svc_commisssion =
|
2021-07-24 18:07:51 +08:00
|
|
|
#{platformSvcCommisssion},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != operationCommission ">operation_commission =
|
2021-07-24 18:07:51 +08:00
|
|
|
#{operationCommission},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != operationSvcCommission">operation_svc_commission =
|
2021-07-24 18:07:51 +08:00
|
|
|
#{operationSvcCommission},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != startSoc and '' != startSoc">start_soc = #{startSoc},</if>
|
|
|
|
|
<if test="null != endSoc and '' != endSoc">end_soc = #{endSoc},</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != reconciliationStatus ">reconciliation_status =
|
2021-07-24 18:07:51 +08:00
|
|
|
#{reconciliationStatus},
|
|
|
|
|
</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != sortingStatus ">sorting_status = #{sortingStatus},</if>
|
|
|
|
|
<if test="null != type">type = #{type},</if>
|
|
|
|
|
<if test="null != status">status = #{status},</if>
|
2021-07-24 18:07:51 +08:00
|
|
|
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != createTime ">create_time = #{createTime},</if>
|
2021-07-24 18:07:51 +08:00
|
|
|
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
|
2021-07-27 18:38:32 +08:00
|
|
|
<if test="null != updateTime">update_time = #{updateTime},</if>
|
2021-07-24 18:07:51 +08:00
|
|
|
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="null != remark and '' != remark">remark = #{remark}</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>
|
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,
|
2021-08-09 21:18:02 +08:00
|
|
|
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,
|
2021-08-09 12:15:00 +08:00
|
|
|
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,
|
2021-08-09 12:15:00 +08:00
|
|
|
co.charging_time as chargingTime,
|
|
|
|
|
co.charging_degree as chargingDegree,
|
|
|
|
|
DATE_FORMAT(co.start_time,'%m月%d日') as daysOne,
|
|
|
|
|
DATE_FORMAT(co.start_time,'%H:%m') as timeOne,
|
|
|
|
|
DATE_FORMAT(co.end_time,'%m月%d日') as daysTwo,
|
|
|
|
|
DATE_FORMAT(co.end_time,'%H:%m') as timeTwo,
|
2021-08-11 16:25:10 +08:00
|
|
|
co.status as status,
|
2021-08-09 12:15:00 +08:00
|
|
|
co.type as type
|
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-03 22:41:53 +08:00
|
|
|
</select>
|
2021-08-23 19:59:57 +08:00
|
|
|
|
|
|
|
|
<select id="getListPage" resultType="map">
|
|
|
|
|
select
|
|
|
|
|
ho.history_order_id as historyOrderId,
|
|
|
|
|
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 !=''">
|
|
|
|
|
and ho.start_time >= #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endTime !=null and endTime !=''">
|
|
|
|
|
and ho.start_time <= #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="transactionNumber !=null and transactionNumber !=''">
|
|
|
|
|
and ho.serial_number like concat('%', #{transactionNumber}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargingStationName !=null and chargingStationName !=''">
|
|
|
|
|
and co.serial_number 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>
|
2021-08-24 17:04:48 +08:00
|
|
|
<if test="status==2">
|
2021-08-23 19:59:57 +08:00
|
|
|
and co.source =0
|
|
|
|
|
and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
|
|
|
|
</if>
|
2021-08-24 17:04:48 +08:00
|
|
|
<if test="status==3">
|
2021-08-23 19:59:57 +08:00
|
|
|
and co.source =1
|
|
|
|
|
and co.user_id=#{userId}
|
|
|
|
|
</if>
|
|
|
|
|
order by ho.create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
2021-07-24 18:07:51 +08:00
|
|
|
</mapper>
|