Files
jsowell-charger-web/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml

1065 lines
42 KiB
XML
Raw Normal View History

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"/>
2023-03-13 15:51:41 +08:00
<result property="transactionCode" column="transaction_code"/>
2023-03-04 16:29:55 +08:00
<result property="orderStatus" column="order_status"/>
<result property="memberId" column="member_id"/>
<result property="stationId" column="station_id"/>
<result property="merchantId" column="merchant_id"/>
2023-03-04 16:29:55 +08:00
<result property="pileSn" column="pile_sn"/>
<result property="connectorCode" column="connector_code"/>
<result property="pileConnectorCode" column="pile_connector_code"/>
<result property="logicCard" column="logic_card"/>
2023-06-07 15:14:03 +08:00
<result property="vinCode" column="vin_code"/>
2023-03-04 16:29:55 +08:00
<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="virtualAmount" column="virtual_amount"/>
<result property="settleAmount" column="settle_amount"/>
2023-03-04 16:29:55 +08:00
<result property="chargeStartTime" column="charge_start_time"/>
<result property="chargeEndTime" column="charge_end_time"/>
<result property="startType" column="start_type"/>
<result property="appointmentTime" column="appointment_time"/>
2023-03-04 16:29:55 +08:00
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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,
2023-03-13 15:51:41 +08:00
transaction_code,
2023-03-04 16:29:55 +08:00
order_status,
member_id,
station_id,
merchant_id,
2023-03-04 16:29:55 +08:00
pile_sn,
connector_code,
pile_connector_code,
logic_card,
2023-06-07 15:14:03 +08:00
vin_code,
2023-03-04 16:29:55 +08:00
start_mode,
pay_mode,
pay_status,
pay_amount,
pay_time,
order_amount,
virtual_amount,
settle_amount,
2023-03-04 16:29:55 +08:00
charge_start_time,
charge_end_time,
start_type,
appointment_time,
2023-03-04 16:29:55 +08:00
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,
sharp_price,
2023-03-04 16:29:55 +08:00
sharp_used_electricity,
sharp_electricity_price,
sharp_service_price,
sharp_amount,
peak_price,
2023-03-04 16:29:55 +08:00
peak_used_electricity,
peak_electricity_price,
peak_service_price,
peak_amount,
flat_price,
2023-03-04 16:29:55 +08:00
flat_used_electricity,
flat_electricity_price,
flat_service_price,
flat_amount,
valley_price,
2023-03-04 16:29:55 +08:00
valley_used_electricity,
valley_electricity_price,
valley_service_price,
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,
2023-03-14 10:39:02 +08:00
t1.transaction_code as transactionCode,
2023-03-04 16:29:55 +08:00
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.logic_card as logicCard,
t1.vin_code as vinCode,
2023-03-04 16:29:55 +08:00
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,
2023-05-24 11:19:16 +08:00
t1.virtual_amount as virtualAmount,
t1.settle_amount as settleAmount,
2023-03-04 16:29:55 +08:00
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,
2023-06-05 15:07:38 +08:00
t1.virtual_amount as virtualAmount,
t1.settle_amount as settleAmount,
2023-05-30 15:37:15 +08:00
t4.total_used_electricity as chargingDegree,
2023-06-05 16:30:26 +08:00
t4.total_electricity_amount as totalElectricityAmount,
t4.total_service_amount as totalServiceAmount,
2023-05-30 15:37:15 +08:00
t5.payment_institutions as paymentInstitutions
2023-03-04 16:29:55 +08:00
from order_basic_info t1
2023-03-15 16:02:06 +08:00
left join member_basic_info t2 on t1.member_id = t2.member_id
join pile_station_info t3 on t1.station_id = t3.id
2023-03-04 16:29:55 +08:00
join order_detail t4 on t4.order_code = t1.order_code
2023-05-31 15:53:45 +08:00
left join member_transaction_record t5 on t5.order_code = t1.order_code and action_type = 'forward'
2023-03-04 16:29:55 +08:00
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>
2023-03-14 10:39:02 +08:00
<if test="transactionCode != null and transactionCode != ''">
and t1.transaction_code = #{transactionCode,jdbcType=VARCHAR}
</if>
2023-03-04 16:29:55 +08:00
<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>
<if test="merchantId != null and merchantId != ''">
and t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
</if>
2023-03-04 16:29:55 +08:00
<!-- 数据范围过滤 -->
<!-- <if test="merchantDeptIds != null and merchantDeptIds.size() != 0">-->
<!-- and t3.dept_id in-->
<!-- <foreach collection="merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">-->
<!-- #{merchantDeptId}-->
<!-- </foreach>-->
<!-- </if>-->
2023-03-09 11:58:11 +08:00
<if test="stationDeptIds != null and stationDeptIds.size() != 0">
and t3.dept_id in
<foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
#{stationDeptId}
</foreach>
</if>
2023-03-04 16:29:55 +08:00
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="transactionCode != null">
transaction_code,
</if>
2023-03-04 16:29:55 +08:00
<if test="orderStatus != null">
order_status,
</if>
<if test="memberId != null">
member_id,
</if>
<if test="stationId != null">
station_id,
</if>
<if test="merchantId != null">
merchant_id,
</if>
2023-03-04 16:29:55 +08:00
<if test="pileSn != null">
pile_sn,
</if>
<if test="connectorCode != null">
connector_code,
</if>
<if test="pileConnectorCode != null">
pile_connector_code,
</if>
2023-03-30 09:42:38 +08:00
<if test="logicCard != null">
logic_card,
</if>
<if test="logicCard != null">
vin_code,
</if>
2023-03-04 16:29:55 +08:00
<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="virtualAmount != null">
virtual_amount,
</if>
<if test="settleAmount != null">
settle_amount,
</if>
2023-03-04 16:29:55 +08:00
<if test="chargeStartTime != null">
charge_start_time,
</if>
<if test="chargeEndTime != null">
charge_end_time,
</if>
<if test="startType != null">
start_type,
</if>
<if test="appointmentTime != null">
appointment_time,
</if>
2023-03-04 16:29:55 +08:00
<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="transactionCode != null">
#{transactionCode},
</if>
2023-03-04 16:29:55 +08:00
<if test="orderStatus != null">
#{orderStatus},
</if>
<if test="memberId != null">
#{memberId},
</if>
<if test="stationId != null">
#{stationId},
</if>
<if test="merchantId != null">
#{merchantId},
</if>
2023-03-04 16:29:55 +08:00
<if test="pileSn != null">
#{pileSn,jdbcType=VARCHAR},
</if>
<if test="connectorCode != null">
#{connectorCode},
</if>
<if test="pileConnectorCode != null">
#{pileConnectorCode},
</if>
<if test="logicCard != null">
#{logicCard},
</if>
<if test="vinCode != null">
#{vinCode,jdbcType=VARCHAR},
</if>
2023-03-04 16:29:55 +08:00
<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>
2023-05-26 10:26:43 +08:00
<if test="virtualAmount != null">
#{virtualAmount},
</if>
<if test="settleAmount != null">
#{settleAmount},
</if>
2023-03-04 16:29:55 +08:00
<if test="chargeStartTime != null">
#{chargeStartTime},
</if>
<if test="chargeEndTime != null">
#{chargeEndTime},
</if>
<if test="startType != null">
#{startType},
</if>
<if test="appointmentTime != null">
#{appointmentTime},
</if>
2023-03-04 16:29:55 +08:00
<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="merchantId != null">
merchant_id = #{merchantId},
</if>
2023-03-04 16:29:55 +08:00
<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="logicCard != null">
logic_card = #{logicCard},
</if>
<if test="vinCode != null">
vin_code = #{vinCode},
</if>
2023-03-04 16:29:55 +08:00
<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="virtualAmount != null">
virtual_amount = #{virtualAmount},
</if>
<if test="settleAmount != null">
settle_amount = #{settleAmount},
</if>
2023-03-04 16:29:55 +08:00
<if test="chargeStartTime != null">
charge_start_time = #{chargeStartTime},
</if>
<if test="chargeEndTime != null">
charge_end_time = #{chargeEndTime},
</if>
<if test="startType != null">
start_type = #{startType},
</if>
<if test="appointmentTime != null">
appointment_time = #{appointmentTime},
</if>
2023-03-04 16:29:55 +08:00
<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">
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-15 14:17:12 +08:00
create_by,update_by, create_time)
values
2023-03-04 16:29:55 +08:00
<foreach item="item" index="index" collection="list" separator=",">
(#{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},
2023-03-15 11:43:30 +08:00
#{item.createBy}, #{item.updateBy}, #{item.createTime,jdbcType=TIMESTAMP})
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>
<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>
<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>
<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>
<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>
<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="getOrderInfoByTransactionCode" resultMap="OrderBasicInfoResult">
select
<include refid="Base_Column_List"/>
from order_basic_info
where del_flag = '0'
and transaction_code = #{transactionCode,jdbcType=VARCHAR}
</select>
2023-03-04 16:29:55 +08:00
<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.id,
2023-03-04 16:29:55 +08:00
t1.order_code as orderCode,
t1.order_status as orderStatus,
t1.reason,
2023-05-18 17:24:13 +08:00
t1.station_id as stationId,
2023-03-04 16:29:55 +08:00
t3.station_name as stationName,
t1.pile_sn as pileSn,
t1.connector_code as connectorCode,
t1.pay_status as payStatus,
t1.start_mode as startMode,
2023-03-04 16:29:55 +08:00
t1.order_amount as orderAmount,
2023-06-30 11:33:48 +08:00
t1.virtual_amount as virtualAmount,
t1.settle_amount as settleAmount,
2023-03-04 16:29:55 +08:00
t1.pay_amount as payAmount,
t2.total_used_electricity as chargingDegree,
2023-03-15 14:32:12 +08:00
t1.charge_start_time as startTime,
t1.charge_end_time as endTime,
t2.total_electricity_amount as totalElectricityAmount,
t2.total_service_amount as totalServiceAmount
2023-03-04 16:29:55 +08:00
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="stationId != null and stationId != ''">
and t1.station_id = #{stationId,jdbcType=VARCHAR}
</if>
2023-03-04 16:29:55 +08:00
<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>
<if test="dateTime != null">
and t1.create_time <![CDATA[ >= ]]> #{dateTime,jdbcType=VARCHAR}
</if>
2023-03-04 16:29:55 +08:00
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 != ''">
2023-05-13 17:51:16 +08:00
and t1.station_id = #{dto.stationId,jdbcType=VARCHAR}
</if>
<if test="dto.stationIdList != null and dto.stationIdList.size() != 0">
and t1.station_id in
<foreach collection="dto.stationIdList" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR}
</foreach>
2023-03-04 16:29:55 +08:00
</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.pile_sn as pileSn,
t1.connector_code as connectorCode,
2023-03-04 16:29:55 +08:00
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,
t3.total_used_electricity as chargingDegree,
2023-03-04 16:29:55 +08:00
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>
2023-03-25 11:10:15 +08:00
<select id="getAppointmentOrder" resultMap="OrderBasicInfoResult">
select
<include refid="Base_Column_List"/>
from order_basic_info
where del_flag = '0'
and pay_status = '1'
and start_type = 'appointment'
and order_status = '0'
2023-03-25 16:53:08 +08:00
and appointment_time <![CDATA[ <= ]]> #{dateTime,jdbcType=TIMESTAMP}
2023-03-25 11:10:15 +08:00
</select>
<select id="getListByOrderCodes" 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,
t1.charge_start_time as startTime,
t1.charge_end_time as endTime,
t2.total_electricity_amount as totalElectricityAmount,
t2.total_service_amount as totalServiceAmount
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.order_code in
<foreach collection="orderCodes" item="orderCode" open="(" separator="," close=")">
#{orderCode,jdbcType=VARCHAR}
</foreach>
</select>
<select id="getAccumulativeInfoForLianLian" resultType="com.jsowell.pile.vo.lianlian.AccumulativeInfoVO">
SELECT
2023-04-17 17:02:55 +08:00
t1.order_code as orderCode,
t1.pile_connector_code as pileConnectorCode,
t1.pile_sn as pileSn,
t1.station_id as stationId,
2023-04-17 17:02:55 +08:00
IFNULL(t2.total_used_electricity,0.00) as connectorElectricity
FROM
order_basic_info t1
JOIN order_detail t2 ON t1.order_code = t2.order_code
WHERE
t1.del_flag = '0'
AND t1.station_id = #{stationID,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
</select>
2023-04-18 15:44:13 +08:00
<select id="queryElecAmountNullList" resultMap="OrderDetailResult">
select
<include refid="Detail_Base_Column_List"/>
from order_detail
where del_flag = '0'
and total_order_amount is not null
AND total_order_amount > '0.00'
and total_electricity_amount is null
</select>
<update id="batchUpdateOrderDetail">
update order_detail
<trim prefix="set" suffixOverrides=",">
<trim prefix="total_electricity_amount =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.totalElectricityAmount!=null">
when id=#{item.id} then #{item.totalElectricityAmount}
</if>
</foreach>
</trim>
<trim prefix="total_service_amount =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.totalServiceAmount!=null">
when id=#{item.id} then #{item.totalServiceAmount}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
id=#{i.id}
</foreach>
</update>
2023-05-12 15:03:29 +08:00
<select id="getOrderDetailList" resultMap="OrderDetailResult">
select
<include refid="Detail_Base_Column_List"/>
from order_detail
where del_flag = '0'
and order_code in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR}
</foreach>
</select>
2023-05-31 13:59:27 +08:00
<select id="tempQueryWeChatRefundOrders" resultMap="OrderBasicInfoResult">
select
<include refid="Base_Column_List"/>
from order_basic_info
where del_flag = '0'
and pay_mode = '4'
and refund_amount > '0.00'
and create_time BETWEEN #{startTime} and #{endTime}
</select>
2023-03-04 16:29:55 +08:00
</mapper>