2023-03-04 16:29:55 +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.jsowell.pile.mapper.OrderBasicInfoMapper">
|
|
|
|
|
<resultMap type="com.jsowell.pile.domain.OrderBasicInfo" id="OrderBasicInfoResult">
|
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
|
<result property="orderCode" column="order_code"/>
|
|
|
|
|
<result property="orderStatus" column="order_status"/>
|
|
|
|
|
<result property="memberId" column="member_id"/>
|
|
|
|
|
<result property="stationId" column="station_id"/>
|
|
|
|
|
<result property="pileSn" column="pile_sn"/>
|
|
|
|
|
<result property="connectorCode" column="connector_code"/>
|
|
|
|
|
<result property="pileConnectorCode" column="pile_connector_code"/>
|
|
|
|
|
<result property="startMode" column="start_mode"/>
|
|
|
|
|
<result property="payMode" column="pay_mode"/>
|
|
|
|
|
<result property="payStatus" column="pay_status"/>
|
|
|
|
|
<result property="payAmount" column="pay_amount"/>
|
|
|
|
|
<result property="payTime" column="pay_time"/>
|
|
|
|
|
<result property="orderAmount" column="order_amount"/>
|
|
|
|
|
<result property="chargeStartTime" column="charge_start_time"/>
|
|
|
|
|
<result property="chargeEndTime" column="charge_end_time"/>
|
|
|
|
|
<result property="startSOC" column="start_soc"/>
|
|
|
|
|
<result property="endSOC" column="end_soc"/>
|
|
|
|
|
<result property="reason" column="reason"/>
|
|
|
|
|
<result property="settlementTime" column="settlement_time"/>
|
|
|
|
|
<result property="refundAmount" column="refund_amount"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap id="OrderBasicInfoOrderDetailResult" type="com.jsowell.pile.domain.OrderBasicInfo" extends="OrderBasicInfoResult">
|
|
|
|
|
<collection property="orderDetailList" notNullColumn="sub_id" javaType="java.util.List"
|
|
|
|
|
resultMap="OrderDetailResult"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.jsowell.pile.domain.OrderDetail" id="OrderDetailResult">
|
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
|
<result property="orderCode" column="order_code"/>
|
|
|
|
|
<result property="totalUsedElectricity" column="total_used_electricity"/>
|
|
|
|
|
<result property="totalOrderAmount" column="total_order_amount"/>
|
|
|
|
|
<result property="totalElectricityAmount" column="total_electricity_amount"/>
|
|
|
|
|
<result property="totalServiceAmount" column="total_service_amount"/>
|
2023-03-08 11:02:57 +08:00
|
|
|
<result property="sharpPrice" column="sharp_price"/>
|
2023-03-04 16:29:55 +08:00
|
|
|
<result property="sharpUsedElectricity" column="sharp_used_electricity"/>
|
|
|
|
|
<result property="sharpElectricityPrice" column="sharp_electricity_price"/>
|
|
|
|
|
<result property="sharpServicePrice" column="sharp_service_price"/>
|
2023-03-08 11:02:57 +08:00
|
|
|
<result property="sharpAmount" column="sharp_amount"/>
|
|
|
|
|
<result property="peakPrice" column="peak_price"/>
|
2023-03-04 16:29:55 +08:00
|
|
|
<result property="peakUsedElectricity" column="peak_used_electricity"/>
|
|
|
|
|
<result property="peakElectricityPrice" column="peak_electricity_price"/>
|
|
|
|
|
<result property="peakServicePrice" column="peak_service_price"/>
|
2023-03-08 11:02:57 +08:00
|
|
|
<result property="peakAmount" column="peak_amount"/>
|
|
|
|
|
<result property="flatPrice" column="flat_price"/>
|
2023-03-04 16:29:55 +08:00
|
|
|
<result property="flatUsedElectricity" column="flat_used_electricity"/>
|
|
|
|
|
<result property="flatElectricityPrice" column="flat_electricity_price"/>
|
|
|
|
|
<result property="flatServicePrice" column="flat_service_price"/>
|
2023-03-08 11:02:57 +08:00
|
|
|
<result property="flatAmount" column="flat_amount"/>
|
|
|
|
|
<result property="valleyPrice" column="valley_price"/>
|
2023-03-04 16:29:55 +08:00
|
|
|
<result property="valleyUsedElectricity" column="valley_used_electricity"/>
|
|
|
|
|
<result property="valleyElectricityPrice" column="valley_electricity_price"/>
|
|
|
|
|
<result property="valleyServicePrice" column="valley_service_price"/>
|
2023-03-08 11:02:57 +08:00
|
|
|
<result property="valleyAmount" column="valley_amount"/>
|
2023-03-04 16:29:55 +08:00
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectOrderBasicInfoVo">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
from order_basic_info
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
|
id,
|
|
|
|
|
order_code,
|
|
|
|
|
order_status,
|
|
|
|
|
member_id,
|
|
|
|
|
station_id,
|
|
|
|
|
pile_sn,
|
|
|
|
|
connector_code,
|
|
|
|
|
pile_connector_code,
|
|
|
|
|
start_mode,
|
|
|
|
|
pay_mode,
|
|
|
|
|
pay_status,
|
|
|
|
|
pay_amount,
|
|
|
|
|
pay_time,
|
|
|
|
|
order_amount,
|
|
|
|
|
charge_start_time,
|
|
|
|
|
charge_end_time,
|
|
|
|
|
start_soc,
|
|
|
|
|
end_soc,
|
|
|
|
|
reason,
|
|
|
|
|
settlement_time,
|
|
|
|
|
refund_amount,
|
|
|
|
|
create_by,
|
|
|
|
|
create_time,
|
|
|
|
|
update_by,
|
|
|
|
|
update_time,
|
|
|
|
|
del_flag
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<sql id="Detail_Base_Column_List">
|
|
|
|
|
id,
|
|
|
|
|
order_code,
|
|
|
|
|
total_used_electricity,
|
|
|
|
|
total_order_amount,
|
|
|
|
|
total_electricity_amount,
|
|
|
|
|
total_service_amount,
|
2023-03-08 11:02:57 +08:00
|
|
|
sharp_price,
|
2023-03-04 16:29:55 +08:00
|
|
|
sharp_used_electricity,
|
|
|
|
|
sharp_electricity_price,
|
|
|
|
|
sharp_service_price,
|
2023-03-08 11:02:57 +08:00
|
|
|
sharp_amount,
|
|
|
|
|
peak_price,
|
2023-03-04 16:29:55 +08:00
|
|
|
peak_used_electricity,
|
|
|
|
|
peak_electricity_price,
|
|
|
|
|
peak_service_price,
|
2023-03-08 11:02:57 +08:00
|
|
|
peak_amount,
|
|
|
|
|
flat_price,
|
2023-03-04 16:29:55 +08:00
|
|
|
flat_used_electricity,
|
|
|
|
|
flat_electricity_price,
|
|
|
|
|
flat_service_price,
|
2023-03-08 11:02:57 +08:00
|
|
|
flat_amount,
|
|
|
|
|
valley_price,
|
2023-03-04 16:29:55 +08:00
|
|
|
valley_used_electricity,
|
|
|
|
|
valley_electricity_price,
|
|
|
|
|
valley_service_price,
|
2023-03-08 11:02:57 +08:00
|
|
|
valley_amount,
|
2023-03-04 16:29:55 +08:00
|
|
|
create_by,
|
|
|
|
|
create_time,
|
|
|
|
|
update_by,
|
|
|
|
|
update_time,
|
|
|
|
|
del_flag
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectOrderBasicInfoList" parameterType="com.jsowell.pile.dto.QueryOrderDTO" resultType="com.jsowell.pile.vo.web.OrderListVO">
|
|
|
|
|
SELECT
|
|
|
|
|
t1.id as id,
|
|
|
|
|
t1.order_code as orderCode,
|
|
|
|
|
t1.order_status as orderStatus,
|
|
|
|
|
t1.member_id as memberId,
|
|
|
|
|
t2.nick_name as nickName,
|
|
|
|
|
t2.mobile_number as mobileNumber,
|
|
|
|
|
t1.station_id as stationId,
|
|
|
|
|
t3.station_name as stationName,
|
|
|
|
|
t1.pile_sn as pileSn,
|
|
|
|
|
t1.connector_code as connectorCode,
|
|
|
|
|
t1.start_mode as startMode,
|
|
|
|
|
t1.pay_mode as payMode,
|
|
|
|
|
t1.pay_status as payStatus,
|
|
|
|
|
t1.pay_amount as payAmount,
|
|
|
|
|
t1.order_amount as orderAmount,
|
|
|
|
|
t1.start_soc as startSoc,
|
|
|
|
|
t1.end_soc as endSoc,
|
|
|
|
|
t1.charge_start_time as chargeStartTime,
|
|
|
|
|
t1.charge_end_time as chargeEndTime,
|
|
|
|
|
t1.create_time as createTime,
|
|
|
|
|
t4.total_used_electricity as chargingDegree
|
|
|
|
|
from order_basic_info t1
|
|
|
|
|
join member_basic_info t2 on t1.member_id = t2.member_id
|
|
|
|
|
join pile_station_info t3 on t1.station_id = t3.id
|
|
|
|
|
join order_detail t4 on t4.order_code = t1.order_code
|
|
|
|
|
where t1.del_flag = '0'
|
|
|
|
|
<if test="pileSn != null and pileSn != ''">
|
|
|
|
|
and t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="connectorCode != null and connectorCode != ''">
|
|
|
|
|
and t1.connector_code = #{connectorCode,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="memberId != null and memberId != ''">
|
|
|
|
|
and t1.member_id = #{memberId,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderStatus != null and orderStatus != ''">
|
|
|
|
|
and t1.order_status = #{orderStatus,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderCode != null and orderCode != ''">
|
|
|
|
|
and t1.order_code = #{orderCode,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="mobileNumber != null and mobileNumber != ''">
|
|
|
|
|
and t2.mobile_number = #{mobileNumber,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="stationId != null and stationId != ''">
|
|
|
|
|
and t1.station_id = #{stationId,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
|
|
and t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
|
|
and t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<!-- 数据范围过滤 -->
|
|
|
|
|
${params.dataScope}
|
|
|
|
|
order by t1.create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectOrderBasicInfoById" parameterType="Long" resultMap="OrderBasicInfoOrderDetailResult">
|
|
|
|
|
select a.id,
|
|
|
|
|
a.order_code,
|
|
|
|
|
a.order_status,
|
|
|
|
|
a.member_id,
|
|
|
|
|
a.station_id,
|
|
|
|
|
a.pile_sn,
|
|
|
|
|
a.connector_code,
|
|
|
|
|
a.start_mode,
|
|
|
|
|
a.pay_mode,
|
|
|
|
|
a.pay_status,
|
|
|
|
|
a.pay_amount,
|
|
|
|
|
a.pay_time,
|
|
|
|
|
a.order_amount,
|
|
|
|
|
a.reason,
|
|
|
|
|
a.create_by,
|
|
|
|
|
a.create_time,
|
|
|
|
|
a.update_by,
|
|
|
|
|
a.update_time,
|
|
|
|
|
a.del_flag,
|
|
|
|
|
b.id as sub_id,
|
|
|
|
|
b.order_code as sub_order_code,
|
|
|
|
|
b.total_used_electricity as sub_total_used_electricity,
|
|
|
|
|
b.total_order_amount as sub_total_order_amount,
|
|
|
|
|
b.total_electricity_amount as sub_total_electricity_amount,
|
|
|
|
|
b.total_service_amount as sub_total_service_amount,
|
|
|
|
|
b.sharp_used_electricity as sub_sharp_used_electricity,
|
|
|
|
|
b.sharp_electricity_price as sub_sharp_electricity_price,
|
|
|
|
|
b.sharp_service_price as sub_sharp_service_price,
|
|
|
|
|
b.peak_used_electricity as sub_peak_used_electricity,
|
|
|
|
|
b.peak_electricity_price as sub_peak_electricity_price,
|
|
|
|
|
b.peak_service_price as sub_peak_service_price,
|
|
|
|
|
b.flat_used_electricity as sub_flat_used_electricity,
|
|
|
|
|
b.flat_electricity_price as sub_flat_electricity_price,
|
|
|
|
|
b.flat_service_price as sub_flat_service_price,
|
|
|
|
|
b.valley_used_electricity as sub_valley_used_electricity,
|
|
|
|
|
b.valley_electricity_price as sub_valley_electricity_price,
|
|
|
|
|
b.valley_service_price as sub_valley_service_price,
|
|
|
|
|
b.create_by as sub_create_by,
|
|
|
|
|
b.create_time as sub_create_time,
|
|
|
|
|
b.update_by as sub_update_by,
|
|
|
|
|
b.update_time as sub_update_time,
|
|
|
|
|
b.del_flag as sub_del_flag
|
|
|
|
|
from order_basic_info a
|
|
|
|
|
left join order_detail b on b.order_code = a.id
|
|
|
|
|
where a.id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertOrderBasicInfo" parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into order_basic_info
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="orderCode != null">
|
|
|
|
|
order_code,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderStatus != null">
|
|
|
|
|
order_status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="memberId != null">
|
|
|
|
|
member_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="stationId != null">
|
|
|
|
|
station_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pileSn != null">
|
|
|
|
|
pile_sn,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="connectorCode != null">
|
|
|
|
|
connector_code,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pileConnectorCode != null">
|
|
|
|
|
pile_connector_code,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startMode != null">
|
|
|
|
|
start_mode,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payMode != null">
|
|
|
|
|
pay_mode,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payStatus != null">
|
|
|
|
|
pay_status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payAmount != null">
|
|
|
|
|
pay_amount,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payTime != null">
|
|
|
|
|
pay_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderAmount != null">
|
|
|
|
|
order_amount,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargeStartTime != null">
|
|
|
|
|
charge_start_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargeEndTime != null">
|
|
|
|
|
charge_end_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startSOC != null">
|
|
|
|
|
start_soc,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endSOC != null">
|
|
|
|
|
end_soc,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="reason != null">
|
|
|
|
|
reason,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="settlementTime != null">
|
|
|
|
|
settlement_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="refundAmount != null">
|
|
|
|
|
refund_amount,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createBy != null">
|
|
|
|
|
create_by,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
create_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">
|
|
|
|
|
update_by,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
update_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
del_flag,
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="orderCode != null">
|
|
|
|
|
#{orderCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderStatus != null">
|
|
|
|
|
#{orderStatus},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="memberId != null">
|
|
|
|
|
#{memberId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="stationId != null">
|
|
|
|
|
#{stationId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pileSn != null">
|
|
|
|
|
#{pileSn,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="connectorCode != null">
|
|
|
|
|
#{connectorCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pileConnectorCode != null">
|
|
|
|
|
#{pileConnectorCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startMode != null">
|
|
|
|
|
#{startMode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payMode != null">
|
|
|
|
|
#{payMode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payStatus != null">
|
|
|
|
|
#{payStatus},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payAmount != null">
|
|
|
|
|
#{payAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payTime != null">
|
|
|
|
|
#{payTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderAmount != null">
|
|
|
|
|
#{orderAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargeStartTime != null">
|
|
|
|
|
#{chargeStartTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargeEndTime != null">
|
|
|
|
|
#{chargeEndTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startSOC != null">
|
|
|
|
|
#{startSOC},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endSOC != null">
|
|
|
|
|
#{endSOC},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="reason != null">
|
|
|
|
|
#{reason},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="settlementTime != null">
|
|
|
|
|
#{settlementTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="refundAmount != null">
|
|
|
|
|
#{refundAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createBy != null">
|
|
|
|
|
#{createBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
#{createTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">
|
|
|
|
|
#{updateBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
#{updateTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
#{delFlag},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateOrderBasicInfo" parameterType="com.jsowell.pile.domain.OrderBasicInfo">
|
|
|
|
|
update order_basic_info
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="orderCode != null">
|
|
|
|
|
order_code = #{orderCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderStatus != null">
|
|
|
|
|
order_status = #{orderStatus},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="memberId != null">
|
|
|
|
|
member_id = #{memberId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="stationId != null">
|
|
|
|
|
station_id = #{stationId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pileSn != null">
|
|
|
|
|
pile_sn = #{pileSn},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="connectorCode != null">
|
|
|
|
|
connector_code = #{connectorCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pileConnectorCode != null">
|
|
|
|
|
pile_connector_code = #{pileConnectorCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startMode != null">
|
|
|
|
|
start_mode = #{startMode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payMode != null">
|
|
|
|
|
pay_mode = #{payMode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payStatus != null">
|
|
|
|
|
pay_status = #{payStatus},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payAmount != null">
|
|
|
|
|
pay_amount = #{payAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payTime != null">
|
|
|
|
|
pay_time = #{payTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderAmount != null">
|
|
|
|
|
order_amount = #{orderAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargeStartTime != null">
|
|
|
|
|
charge_start_time = #{chargeStartTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="chargeEndTime != null">
|
|
|
|
|
charge_end_time = #{chargeEndTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startSOC != null">
|
|
|
|
|
start_soc = #{startSOC},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endSOC != null">
|
|
|
|
|
end_soc = #{endSOC},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="reason != null">
|
|
|
|
|
reason = #{reason},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="settlementTime != null">
|
|
|
|
|
settlement_time = #{settlementTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="refundAmount != null">
|
|
|
|
|
refund_amount = #{refundAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createBy != null">
|
|
|
|
|
create_by = #{createBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
create_time = #{createTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">
|
|
|
|
|
update_by = #{updateBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
update_time = #{updateTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
del_flag = #{delFlag},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteOrderBasicInfoByIds" parameterType="String">
|
|
|
|
|
delete
|
|
|
|
|
from order_basic_info where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteOrderDetailByOrderCodes" parameterType="String">
|
|
|
|
|
delete
|
|
|
|
|
from order_detail where order_code in
|
|
|
|
|
<foreach item="orderCode" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{orderCode}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteOrderDetailByOrderCode" parameterType="Long">
|
|
|
|
|
delete
|
|
|
|
|
from order_detail
|
|
|
|
|
where order_code = #{orderCode}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<insert id="batchOrderDetail">
|
2023-03-08 11:02:57 +08:00
|
|
|
insert into order_detail(id, order_code, total_used_electricity, total_order_amount, total_electricity_amount,total_service_amount,
|
|
|
|
|
sharp_price, sharp_used_electricity, sharp_electricity_price, sharp_service_price, sharp_amount,
|
|
|
|
|
peak_price, peak_used_electricity, peak_electricity_price, peak_service_price, peak_amount,
|
|
|
|
|
flat_price, flat_used_electricity, flat_electricity_price, flat_service_price, flat_amount,
|
2023-03-08 12:30:07 +08:00
|
|
|
valley_price, valley_used_electricity, valley_electricity_price, valley_service_price, valley_amount,
|
2023-03-08 11:02:57 +08:00
|
|
|
create_by,update_by)
|
|
|
|
|
values
|
2023-03-04 16:29:55 +08:00
|
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
2023-03-08 11:02:57 +08:00
|
|
|
(#{item.id}, #{item.orderCode}, #{item.totalUsedElectricity}, #{item.totalOrderAmount}, #{item.totalElectricityAmount}, #{item.totalServiceAmount},
|
|
|
|
|
#{item.sharpPrice}, #{item.sharpUsedElectricity}, #{item.sharpElectricityPrice}, #{item.sharpServicePrice}, #{item.sharpAmount},
|
|
|
|
|
#{item.peakPrice}, #{item.peakUsedElectricity}, #{item.peakElectricityPrice}, #{item.peakServicePrice}, #{item.peakAmount},
|
|
|
|
|
#{item.flatPrice}, #{item.flatUsedElectricity}, #{item.flatElectricityPrice}, #{item.flatServicePrice}, #{item.flatAmount},
|
|
|
|
|
#{item.valleyPrice}, #{item.valleyUsedElectricity}, #{item.valleyElectricityPrice}, #{item.valleyServicePrice}, #{item.valleyAmount},
|
|
|
|
|
#{item.createBy}, #{item.updateBy})
|
2023-03-04 16:29:55 +08:00
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateOrderDetail" parameterType="com.jsowell.pile.domain.OrderDetail">
|
|
|
|
|
update order_detail
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="orderCode != null">
|
|
|
|
|
order_code = #{orderCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="totalUsedElectricity != null">
|
|
|
|
|
total_used_electricity = #{totalUsedElectricity},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="totalOrderAmount != null">
|
|
|
|
|
total_order_amount = #{totalOrderAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="totalElectricityAmount != null">
|
|
|
|
|
total_electricity_amount = #{totalElectricityAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="totalServiceAmount != null">
|
|
|
|
|
total_service_amount = #{totalServiceAmount},
|
|
|
|
|
</if>
|
2023-03-08 11:02:57 +08:00
|
|
|
<if test="sharpPrice != null">
|
|
|
|
|
sharp_price = #{sharpPrice},
|
|
|
|
|
</if>
|
2023-03-04 16:29:55 +08:00
|
|
|
<if test="sharpUsedElectricity != null">
|
|
|
|
|
sharp_used_electricity = #{sharpUsedElectricity},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="sharpElectricityPrice != null">
|
|
|
|
|
sharp_electricity_price = #{sharpElectricityPrice},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="sharpServicePrice != null">
|
|
|
|
|
sharp_service_price = #{sharpServicePrice},
|
|
|
|
|
</if>
|
2023-03-08 11:02:57 +08:00
|
|
|
<if test="sharpAmount != null">
|
|
|
|
|
sharp_amount = #{sharpAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="peakPrice != null">
|
|
|
|
|
peak_price = #{peakPrice},
|
|
|
|
|
</if>
|
2023-03-04 16:29:55 +08:00
|
|
|
<if test="peakUsedElectricity != null">
|
|
|
|
|
peak_used_electricity = #{peakUsedElectricity},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="peakElectricityPrice != null">
|
|
|
|
|
peak_electricity_price = #{peakElectricityPrice},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="peakServicePrice != null">
|
|
|
|
|
peak_service_price = #{peakServicePrice},
|
|
|
|
|
</if>
|
2023-03-08 11:02:57 +08:00
|
|
|
<if test="peakAmount != null">
|
|
|
|
|
peak_amount = #{peakAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="flatPrice != null">
|
|
|
|
|
flat_price = #{flatPrice},
|
|
|
|
|
</if>
|
2023-03-04 16:29:55 +08:00
|
|
|
<if test="flatUsedElectricity != null">
|
|
|
|
|
flat_used_electricity = #{flatUsedElectricity},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="flatElectricityPrice != null">
|
|
|
|
|
flat_electricity_price = #{flatElectricityPrice},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="flatServicePrice != null">
|
|
|
|
|
flat_service_price = #{flatServicePrice},
|
|
|
|
|
</if>
|
2023-03-08 11:02:57 +08:00
|
|
|
<if test="flatAmount != null">
|
|
|
|
|
flat_amount = #{flatAmount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="valleyPrice != null">
|
|
|
|
|
valley_price = #{valleyPrice},
|
|
|
|
|
</if>
|
2023-03-04 16:29:55 +08:00
|
|
|
<if test="valleyUsedElectricity != null">
|
|
|
|
|
valley_used_electricity = #{valleyUsedElectricity},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="valleyElectricityPrice != null">
|
|
|
|
|
valley_electricity_price = #{valleyElectricityPrice},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="valleyServicePrice != null">
|
|
|
|
|
valley_service_price = #{valleyServicePrice},
|
|
|
|
|
</if>
|
2023-03-08 11:02:57 +08:00
|
|
|
<if test="valleyAmount != null">
|
|
|
|
|
valley_amount = #{valleyAmount},
|
|
|
|
|
</if>
|
2023-03-04 16:29:55 +08:00
|
|
|
<if test="createBy != null">
|
|
|
|
|
create_by = #{createBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
create_time = #{createTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateBy != null">
|
|
|
|
|
update_by = #{updateBy},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
update_time = #{updateTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="delFlag != null">
|
|
|
|
|
del_flag = #{delFlag},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getOrderInfoByOrderCode" resultMap="OrderBasicInfoResult">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
from order_basic_info
|
|
|
|
|
<where>
|
|
|
|
|
order_code = #{orderCode,jdbcType=VARCHAR}
|
|
|
|
|
</where>
|
|
|
|
|
and del_flag = '0'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="queryOrderBasicInfo" resultMap="OrderBasicInfoResult">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
from order_basic_info
|
|
|
|
|
where del_flag = '0'
|
|
|
|
|
and pile_sn = #{pileSn,jdbcType=VARCHAR}
|
|
|
|
|
and connector_code = #{connectorCode,jdbcType=VARCHAR}
|
|
|
|
|
and order_status = #{orderStatus,jdbcType=VARCHAR}
|
|
|
|
|
order by create_time DESC
|
|
|
|
|
limit 1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getOrderDetailByOrderCode" resultMap="OrderDetailResult">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Detail_Base_Column_List"/>
|
|
|
|
|
from order_detail
|
|
|
|
|
where del_flag = '0'
|
|
|
|
|
and order_code = #{orderCode,jdbcType=VARCHAR}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getListByMemberIdAndOrderStatus" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
|
|
|
|
|
SELECT
|
|
|
|
|
t1.order_code as orderCode,
|
|
|
|
|
t1.order_status as orderStatus,
|
|
|
|
|
t1.reason,
|
|
|
|
|
t1.station_id,
|
|
|
|
|
t3.station_name as stationName,
|
|
|
|
|
t1.pile_sn as pileSn,
|
|
|
|
|
t1.connector_code as connectorCode,
|
|
|
|
|
t1.pay_status as payStatus,
|
|
|
|
|
t1.order_amount as orderAmount,
|
|
|
|
|
t1.pay_amount as payAmount,
|
|
|
|
|
t2.total_used_electricity as chargingDegree,
|
|
|
|
|
t2.create_time as startTime,
|
|
|
|
|
t2.update_time as endTime
|
|
|
|
|
from order_basic_info t1
|
|
|
|
|
join order_detail t2 on t1.order_code = t2.order_code
|
|
|
|
|
join pile_station_info t3 on t1.station_id = t3.id
|
|
|
|
|
where t1.del_flag = '0'
|
|
|
|
|
and t1.member_id = #{memberId,jdbcType=VARCHAR}
|
|
|
|
|
<if test="orderStatusList != null and orderStatusList.size() != 0">
|
|
|
|
|
and t1.order_status in
|
|
|
|
|
<foreach collection="orderStatusList" item="orderStatus" open="(" separator="," close=")">
|
|
|
|
|
#{orderStatus,jdbcType=VARCHAR}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
order by t1.create_time desc
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<update id="updateOrderStatusByOrderCode">
|
|
|
|
|
update order_basic_info set order_status = #{orderStatus,jdbcType=VARCHAR}
|
|
|
|
|
where del_flag = '0'
|
|
|
|
|
and order_code = #{orderCode,jdbcType=VARCHAR}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="getIndexOrderInfo" resultType="com.jsowell.pile.vo.web.IndexOrderInfoVO">
|
|
|
|
|
SELECT
|
|
|
|
|
DATE_FORMAT(t1.create_time,'%Y-%m-%d') as date,
|
|
|
|
|
sum( t2.total_used_electricity ) AS totalElectricity,
|
|
|
|
|
sum( t2.total_order_amount ) AS totalOrderAmount,
|
|
|
|
|
sum( t2.sharp_used_electricity ) AS totalSharpUsedElectricity,
|
|
|
|
|
sum( t2.peak_used_electricity ) AS totalPeakUsedElectricity,
|
|
|
|
|
sum( t2.flat_used_electricity ) AS totalFlatUsedElectricity,
|
|
|
|
|
sum( t2.valley_used_electricity ) AS totalValleyUsedElectricity
|
|
|
|
|
FROM
|
|
|
|
|
order_basic_info t1
|
|
|
|
|
JOIN order_detail t2 ON t1.order_code = t2.order_code
|
|
|
|
|
AND t1.del_flag = '0'
|
|
|
|
|
WHERE
|
|
|
|
|
date(t1.create_time) >= DATE_SUB(CURDATE(),INTERVAL 30 day)
|
|
|
|
|
and t1.order_status = '6'
|
|
|
|
|
<if test="dto.stationId != null and dto.stationId != ''">
|
|
|
|
|
and t1,station_id = #{dto.stationId,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
group by DATE_FORMAT(t1.create_time,'%Y-%m-%d')
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getUnpaidOrderListOver15Min" resultMap="OrderBasicInfoResult">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
from order_basic_info
|
|
|
|
|
where del_flag = '0'
|
|
|
|
|
and order_status = '0'
|
|
|
|
|
and pay_status = '0'
|
|
|
|
|
and create_time <![CDATA[ <= ]]> #{createTime,jdbcType=VARCHAR}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectOrderListByTimeRangeAndStatus" resultMap="OrderBasicInfoResult">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
from order_basic_info
|
|
|
|
|
where del_flag = '0'
|
|
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
|
|
and create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
|
|
and create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderStatus != null and orderStatus != ''">
|
|
|
|
|
and order_status = #{orderStatus,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="payStatus != null and payStatus != ''">
|
|
|
|
|
and pay_status = #{payStatus,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<update id="updateOrderStatusById">
|
|
|
|
|
update order_basic_info set order_status = #{orderStatus,jdbcType=VARCHAR}
|
|
|
|
|
where del_flag = '0'
|
|
|
|
|
and id in
|
|
|
|
|
<foreach collection="orderIds" item="orderId" open="(" separator="," close=")" >
|
|
|
|
|
#{orderId,jdbcType=VARCHAR}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="selectOrderInfoByOrderCode" resultType="com.jsowell.pile.vo.uniapp.SendMessageVO">
|
|
|
|
|
SELECT
|
|
|
|
|
t1.order_code as orderCode,
|
|
|
|
|
t1.charge_start_time as chargeStartTime,
|
|
|
|
|
t1.charge_end_time as chargeStopTime,
|
|
|
|
|
t1.reason as stopReason,
|
|
|
|
|
t1.station_id as stationId,
|
|
|
|
|
t2.station_name as stationName,
|
|
|
|
|
t3.total_order_amount as orderAmount,
|
|
|
|
|
t4.open_id as openId
|
|
|
|
|
FROM
|
|
|
|
|
order_basic_info t1
|
|
|
|
|
JOIN pile_station_info t2 ON t1.station_id = t2.id
|
|
|
|
|
join order_detail t3 on t1.order_code = t3.order_code
|
|
|
|
|
join member_basic_info t4 on t1.member_id = t4.member_id
|
|
|
|
|
where t1.order_code = #{orderCode,jdbcType=VARCHAR}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getOrderBasicInfo" resultMap="OrderBasicInfoResult">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
from order_basic_info
|
|
|
|
|
where del_flag = '0'
|
|
|
|
|
<if test="memberId != null and memberId != ''">
|
|
|
|
|
AND member_id = #{memberId,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pileConnectorCode != null and pileConnectorCode != ''">
|
|
|
|
|
AND pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderStatus != null and orderStatus != ''">
|
|
|
|
|
AND order_status = #{orderStatus,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startMode != null and startMode != ''">
|
|
|
|
|
AND start_mode = #{startMode,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
order by create_time desc
|
|
|
|
|
limit 1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getAccumulativeInfo" resultType="com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO">
|
|
|
|
|
SELECT
|
|
|
|
|
t1.member_id as memberId,
|
|
|
|
|
t1.pile_connector_code as pileConnectorCode,
|
|
|
|
|
t1.pile_sn as pileSn,
|
|
|
|
|
t1.charge_start_time as chargeStartTime,
|
|
|
|
|
t1.charge_end_time as chargeEndTime,
|
|
|
|
|
t2.total_used_electricity as sumChargingDegree
|
|
|
|
|
FROM
|
|
|
|
|
order_basic_info t1
|
|
|
|
|
JOIN order_detail t2 ON t1.order_code = t2.order_code
|
|
|
|
|
WHERE
|
|
|
|
|
t1.pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
|
|
|
|
|
AND t1.member_id = #{memberId,jdbcType=VARCHAR}
|
|
|
|
|
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
|
|
|
|
|
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
|
|
|
|
|
AND t1.order_status = '6'
|
|
|
|
|
AND t1.del_flag = '0'
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|