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.XhpcHistoryOrderReconciliationStatusMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.xhpc.order.domain.XhpcHistoryOrderReconciliationStatus"
|
|
|
|
|
id="XhpcHistoryOrderReconciliationStatusResult">
|
|
|
|
|
<result column="history_order_reconciliation_status_id" property="historyOrderReconciliationStatusId"/>
|
|
|
|
|
<result column="history_order_id" property="historyOrderId"/>
|
|
|
|
|
<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.XhpcHistoryOrderReconciliationStatus"
|
2021-07-27 18:38:32 +08:00
|
|
|
useGeneratedKeys="true" keyProperty="historyOrderReconciliationStatusId">
|
2021-08-13 10:24:10 +08:00
|
|
|
INSERT INTO xhpc_history_order_reconciliation_status
|
2021-07-24 18:07:51 +08:00
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="null != historyOrderId and '' != historyOrderId">
|
|
|
|
|
history_order_id,
|
|
|
|
|
</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 != historyOrderId and '' != historyOrderId">
|
|
|
|
|
#{historyOrderId},
|
|
|
|
|
</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>
|
|
|
|
|
|
|
|
|
|
<select id="internetUser" parameterType="java.lang.Long" resultType="java.util.Map">
|
2021-07-26 18:02:59 +08:00
|
|
|
select xiu.internet_user_id internetUserId,xiu.`name`,xiu.open_bank openbank,xiu.card_number
|
|
|
|
|
cardNumber,a.waitConfirmed,b.confirmed
|
2021-07-24 18:07:51 +08:00
|
|
|
from
|
2021-07-26 18:02:59 +08:00
|
|
|
sys_user su
|
|
|
|
|
LEFT JOIN (select sum(xho.act_price-xho.internet_commission-xho.internet_svc_commission)
|
|
|
|
|
waitConfirmed,xho.user_id
|
2021-07-24 18:07:51 +08:00
|
|
|
from xhpc_history_order xho
|
2021-08-23 11:58:30 +08:00
|
|
|
LEFT JOIN xhpc_charge_order xco on xco.charge_order_id = xho.charge_order_id
|
2021-07-26 18:02:59 +08:00
|
|
|
LEFT JOIN xhpc_charging_station xcs on xcs.charging_station_id = xho.charging_station_id
|
|
|
|
|
LEFT JOIN xhpc_operator xo on xo.operator_id = xcs.operator_id
|
|
|
|
|
<if test="chargingStation != null and chargingStation != ''">
|
|
|
|
|
LEFT JOIN xhpc_user_privilege xup on xup.charging_station_id = xcs.charging_station_id
|
|
|
|
|
</if>
|
|
|
|
|
where xho.del_flag = 0 and xho.reconciliation_status = 0
|
|
|
|
|
<if test="operatorId != null and operatorId != ''">
|
|
|
|
|
and xo.operator_id = #{operatorId }
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargingStation != null and chargingStation != ''">
|
|
|
|
|
and xho.user_id = #{userId}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY xho.user_id) a on su.user_id = a.user_id
|
2021-07-24 18:07:51 +08:00
|
|
|
LEFT JOIN
|
|
|
|
|
(select sum(xho.total_price-xho.promotion_discount-xho.internet_commission-xho.internet_svc_commission) confirmed ,xho.user_id
|
|
|
|
|
from xhpc_history_order xho
|
2021-08-23 11:58:30 +08:00
|
|
|
LEFT JOIN xhpc_charge_order xco on xco.charge_order_id = xho.charge_order_id
|
2021-07-26 18:02:59 +08:00
|
|
|
LEFT JOIN xhpc_charging_station xcs on xcs.charging_station_id = xho.charging_station_id
|
|
|
|
|
LEFT JOIN xhpc_operator xo on xo.operator_id = xcs.operator_id
|
|
|
|
|
<if test="chargingStation != null and chargingStation !=''">
|
|
|
|
|
LEFT JOIN xhpc_user_privilege xup on xup.charging_station_id = xcs.charging_station_id
|
|
|
|
|
</if>
|
|
|
|
|
where xho.del_flag = 0 and xho.reconciliation_status = 1
|
|
|
|
|
<if test="operatorId != null and operatorId !=''">
|
|
|
|
|
and xo.operator_id = #{operatorId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargingStation != null and chargingStation !=''">
|
|
|
|
|
and xcs.user_id = #{userId}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY xho.user_id) b on a.user_id = su.user_id
|
|
|
|
|
LEFT JOIN xhpc_internet_user xiu on xiu.internet_user_id = su.internet_user_id
|
2021-08-03 18:43:23 +08:00
|
|
|
where su.user_id = #{userId} limit 1
|
2021-07-24 18:07:51 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="page" parameterType="java.lang.Long" resultType="java.util.Map">
|
2021-08-06 18:46:55 +08:00
|
|
|
select xho.act_price-xho.internet_commission-xho.internet_svc_commission
|
|
|
|
|
realIncome,xho.history_order_id historyOrderId,
|
2021-07-28 17:36:39 +08:00
|
|
|
xho.user_id userId,xho.serial_number serialNumber,xho.create_time createTime,
|
2021-07-26 18:02:59 +08:00
|
|
|
xo.`name` operatorName,xcs.`name` chargingStationName,xho.`reconciliation_status`
|
2021-07-28 17:36:39 +08:00
|
|
|
reconciliationStatus,sdd.dict_label reconciliationStatusName
|
2021-07-24 18:07:51 +08:00
|
|
|
from xhpc_history_order xho
|
2021-08-23 11:58:30 +08:00
|
|
|
LEFT JOIN xhpc_charge_order xco on xco.charge_order_id = xho.charge_order_id
|
2021-07-24 18:07:51 +08:00
|
|
|
LEFT JOIN xhpc_charging_station xcs on xcs.charging_station_id = xho.charging_station_id
|
|
|
|
|
LEFT JOIN xhpc_operator xo on xo.operator_id = xcs.operator_id
|
2021-07-28 17:36:39 +08:00
|
|
|
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'reconciliation_status' and sdd.dict_value =
|
2021-07-26 18:02:59 +08:00
|
|
|
xho.`reconciliation_status`
|
|
|
|
|
<if test="chargingStation != null and chargingStation !=''">
|
|
|
|
|
LEFT JOIN xhpc_user_privilege xup on xup.charging_station_id = xcs.charging_station_id
|
|
|
|
|
</if>
|
2021-07-24 18:07:51 +08:00
|
|
|
where xho.del_flag = 0
|
2021-07-26 18:02:59 +08:00
|
|
|
<if test="userId != null and userId != ''">
|
|
|
|
|
and xho.user_id = #{userId}
|
2021-07-24 18:07:51 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="serialNumber != null and serialNumber != ''">
|
2021-12-27 15:45:06 +08:00
|
|
|
and xho.serial_number like concat('%', #{serialNumber}, '%')
|
2021-07-24 18:07:51 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="createTimeStart != null and createTimeStart != ''"><!-- 开始时间检索 -->
|
|
|
|
|
AND xco.create_time >= #{createTimeStart}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTimeEnd != null and createTimeEnd != ''"><!-- 结束时间检索 -->
|
|
|
|
|
AND xco.create_time <= #{createTimeEnd}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargingStationName != null and chargingStationName != ''">
|
2021-12-27 15:45:06 +08:00
|
|
|
and xcs.`name`like concat('%', #{chargingStationName}, '%')
|
2021-07-24 18:07:51 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="status != null and status != ''">
|
2021-07-28 17:36:39 +08:00
|
|
|
and xho.reconciliation_status = #{status}
|
2021-07-24 18:07:51 +08:00
|
|
|
</if>
|
2021-07-26 18:02:59 +08:00
|
|
|
<if test="operatorId != null and operatorId !=''">
|
|
|
|
|
and xo.operator_id = #{operatorId }
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargingStation != null and chargingStation !=''">
|
|
|
|
|
and xup.user_id = #{userId}
|
|
|
|
|
</if>
|
2021-07-28 17:36:39 +08:00
|
|
|
ORDER BY xho.create_time DESC
|
2021-07-24 18:07:51 +08:00
|
|
|
</select>
|
2021-08-06 18:46:55 +08:00
|
|
|
|
|
|
|
|
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
|
|
|
|
|
select sum(xho.act_price-xho.internet_commission-xho.internet_svc_commission)
|
|
|
|
|
realIncome,xho.history_order_id historyOrderId,
|
|
|
|
|
xho.user_id userId,xho.serial_number serialNumber,xho.create_time createTime,
|
|
|
|
|
xo.`name` operatorName,xcs.`name` chargingStationName,xho.`reconciliation_status`
|
|
|
|
|
reconciliationStatus,sdd.dict_label reconciliationStatusName,
|
|
|
|
|
xho.end_soc endSoc
|
|
|
|
|
from xhpc_history_order xho
|
2021-08-23 11:58:30 +08:00
|
|
|
LEFT JOIN xhpc_charge_order xco on xco.charge_order_id = xho.charge_order_id
|
2021-08-06 18:46:55 +08:00
|
|
|
LEFT JOIN xhpc_charging_station xcs on xcs.charging_station_id = xho.charging_station_id
|
|
|
|
|
LEFT JOIN xhpc_operator xo on xo.operator_id = xcs.operator_id
|
|
|
|
|
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'reconciliation_status' and sdd.dict_value =
|
|
|
|
|
xho.`reconciliation_status`
|
|
|
|
|
where xho.del_flag = 0 and xho.history_order_id = #{historyOrderId}
|
|
|
|
|
</select>
|
2021-07-24 18:07:51 +08:00
|
|
|
</mapper>
|