348 lines
15 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">
<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"/>
<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"
keyProperty="historyOrderId">
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,
</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>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime">
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},
</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>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime">
#{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>
<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>
<if test="null != totalPrice">total_price = #{totalPrice},</if>
<if test="null != promotionDiscount">promotion_discount =
#{promotionDiscount},
</if>
<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 =
#{internetCommission},
</if>
<if test="null != internetSvcCommission">internet_svc_commission =
#{internetSvcCommission},
</if>
<if test="null != platformCommission">platform_commission =
#{platformCommission},
</if>
<if test="null != platformSvcCommisssion">platform_svc_commisssion =
#{platformSvcCommisssion},
</if>
<if test="null != operationCommission ">operation_commission =
#{operationCommission},
</if>
<if test="null != operationSvcCommission">operation_svc_commission =
#{operationSvcCommission},
</if>
<if test="null != startSoc and '' != startSoc">start_soc = #{startSoc},</if>
<if test="null != endSoc and '' != endSoc">end_soc = #{endSoc},</if>
<if test="null != reconciliationStatus ">reconciliation_status =
#{reconciliationStatus},
</if>
<if test="null != sortingStatus ">sorting_status = #{sortingStatus},</if>
<if test="null != type">type = #{type},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime">update_time = #{updateTime},</if>
<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,
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}
</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,
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,
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>
</mapper>