update 首页订单列表数据更换接口

This commit is contained in:
Lemon
2023-08-03 13:49:50 +08:00
parent 963adbe46e
commit 382d9bdcac
5 changed files with 301 additions and 232 deletions

View File

@@ -40,7 +40,8 @@
<result property="delFlag" column="del_flag"/>
</resultMap>
<resultMap id="OrderBasicInfoOrderDetailResult" type="com.jsowell.pile.domain.OrderBasicInfo" extends="OrderBasicInfoResult">
<resultMap id="OrderBasicInfoOrderDetailResult" type="com.jsowell.pile.domain.OrderBasicInfo"
extends="OrderBasicInfoResult">
<collection property="orderDetailList" notNullColumn="sub_id" javaType="java.util.List"
resultMap="OrderDetailResult"/>
</resultMap>
@@ -156,49 +157,49 @@
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.transaction_code as transactionCode,
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,
t1.start_mode as startMode,
t1.pay_mode as payMode,
t1.pay_status as payStatus,
t1.pay_amount as payAmount,
t1.pay_time as payTime,
t1.order_amount as orderAmount,
t1.virtual_amount as virtualAmount,
t1.settle_amount as settleAmount,
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,
t4.total_electricity_amount as totalElectricityAmount,
t4.total_service_amount as totalServiceAmount,
t5.payment_institutions as paymentInstitutions
<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.transaction_code as transactionCode,
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,
t1.start_mode as startMode,
t1.pay_mode as payMode,
t1.pay_status as payStatus,
t1.pay_amount as payAmount,
t1.pay_time as payTime,
t1.order_amount as orderAmount,
t1.virtual_amount as virtualAmount,
t1.settle_amount as settleAmount,
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,
t4.total_electricity_amount as totalElectricityAmount,
t4.total_service_amount as totalServiceAmount,
t5.payment_institutions as paymentInstitutions
from order_basic_info t1
left 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
left join member_transaction_record t5 on t5.order_code = t1.order_code and action_type = 'forward'
left 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
left join member_transaction_record t5 on t5.order_code = t1.order_code and action_type = 'forward'
where t1.del_flag = '0'
<if test="pileSn != null and pileSn != ''">
and t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
and t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
</if>
<if test="connectorCode != null and connectorCode != ''">
and t1.connector_code = #{connectorCode,jdbcType=VARCHAR}
and t1.connector_code = #{connectorCode,jdbcType=VARCHAR}
</if>
<if test="memberId != null and memberId != ''">
and t1.member_id = #{memberId,jdbcType=VARCHAR}
@@ -234,12 +235,12 @@
and t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
</if>
<!-- 数据范围过滤 -->
<!-- <if test="merchantDeptIds != null and merchantDeptIds.size() != 0">-->
<!-- and t3.dept_id in-->
<!-- <foreach collection="merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">-->
<!-- #{merchantDeptId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="merchantDeptIds != null and merchantDeptIds.size() != 0">-->
<!-- and t3.dept_id in-->
<!-- <foreach collection="merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">-->
<!-- #{merchantDeptId}-->
<!-- </foreach>-->
<!-- </if>-->
<if test="stationDeptIds != null and stationDeptIds.size() != 0">
and t3.dept_id in
<foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
@@ -297,7 +298,8 @@
where a.id = #{id}
</select>
<insert id="insertOrderBasicInfo" parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true" keyProperty="id">
<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">
@@ -629,20 +631,30 @@
</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,
valley_price, valley_used_electricity, valley_electricity_price, valley_service_price, valley_amount,
create_by,update_by)
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,
valley_price, valley_used_electricity, valley_electricity_price, valley_service_price,
valley_amount,
create_by, update_by)
values
<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},
#{item.createBy}, #{item.updateBy})
(#{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})
</foreach>
</insert>
@@ -753,7 +765,7 @@
<include refid="Base_Column_List"/>
from order_basic_info
where del_flag = '0'
and transaction_code = #{transactionCode,jdbcType=VARCHAR}
and transaction_code = #{transactionCode,jdbcType=VARCHAR}
</select>
<select id="queryOrderBasicInfo" resultMap="OrderBasicInfoResult">
@@ -761,9 +773,9 @@
<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}
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>
@@ -773,33 +785,32 @@
<include refid="Detail_Base_Column_List"/>
from order_detail
where del_flag = '0'
and order_code = #{orderCode,jdbcType=VARCHAR}
and order_code = #{orderCode,jdbcType=VARCHAR}
</select>
<select id="getListByMemberIdAndOrderStatus" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
SELECT
t1.id,
t1.order_code as orderCode,
t1.order_status as orderStatus,
t1.reason,
t1.station_id as stationId,
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,
t1.order_amount as orderAmount,
t1.virtual_amount as virtualAmount,
t1.settle_amount as settleAmount,
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
SELECT t1.id,
t1.order_code as orderCode,
t1.order_status as orderStatus,
t1.reason,
t1.station_id as stationId,
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,
t1.order_amount as orderAmount,
t1.virtual_amount as virtualAmount,
t1.settle_amount as settleAmount,
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
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 != ''">
@@ -818,37 +829,35 @@
</select>
<update id="updateOrderStatusByOrderCode">
update order_basic_info set order_status = #{orderStatus,jdbcType=VARCHAR}
update order_basic_info
set order_status = #{orderStatus,jdbcType=VARCHAR}
where del_flag = '0'
and order_code = #{orderCode,jdbcType=VARCHAR}
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)
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>
<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>
</if>
group by DATE_FORMAT(t1.create_time,'%Y-%m-%d')
<if test="dto.stationId != null and dto.stationId != ''">
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>
</if>
group by DATE_FORMAT(t1.create_time, '%Y-%m-%d')
</select>
<select id="getUnpaidOrderListOver15Min" resultMap="OrderBasicInfoResult">
@@ -856,14 +865,14 @@
<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}
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"/>
<include refid="Base_Column_List"/>
from order_basic_info
where del_flag = '0'
<if test="startTime != null and startTime != ''">
@@ -881,32 +890,31 @@
</select>
<update id="updateOrderStatusById">
update order_basic_info set order_status = #{orderStatus,jdbcType=VARCHAR}
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=")" >
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,
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,
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
SELECT t1.order_code as orderCode,
t1.pile_sn as pileSn,
t1.connector_code as connectorCode,
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,
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>
@@ -933,23 +941,20 @@
<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}
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'
AND t1.order_status = '6'
AND t1.del_flag = '0'
</select>
<select id="getAppointmentOrder" resultMap="OrderBasicInfoResult">
@@ -957,65 +962,60 @@
<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'
and appointment_time <![CDATA[ <= ]]> #{dateTime,jdbcType=TIMESTAMP}
and pay_status = '1'
and start_type = 'appointment'
and order_status = '0'
and appointment_time <![CDATA[ <= ]]> #{dateTime,jdbcType=TIMESTAMP}
</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
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
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
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
t1.order_code as orderCode,
t1.pile_connector_code as pileConnectorCode,
t1.pile_sn as pileSn,
t1.station_id as stationId,
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'
SELECT t1.order_code as orderCode,
t1.pile_connector_code as pileConnectorCode,
t1.pile_sn as pileSn,
t1.station_id as stationId,
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>
<select id="queryElecAmountNullList" resultMap="OrderDetailResult">
select
<include refid="Detail_Base_Column_List"/>
<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
and total_order_amount is not null
AND total_order_amount > '0.00'
and total_electricity_amount is null
</select>
<update id="batchUpdateOrderDetail">
@@ -1023,22 +1023,22 @@
<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 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 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 collection="list" separator="or" item="i" index="index">
id = #{i.id}
</foreach>
</update>
@@ -1047,56 +1047,52 @@
<include refid="Detail_Base_Column_List"/>
from order_detail
where del_flag = '0'
and order_code in
and order_code in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR}
</foreach>
</select>
<select id="tempQueryWeChatRefundOrders" resultMap="OrderBasicInfoResult">
select
<include refid="Base_Column_List"/>
<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}
and pay_mode = '4'
and refund_amount > '0.00'
and create_time BETWEEN #{startTime} and #{endTime}
</select>
<select id="getMerchantOrderInfoList" resultType="com.jsowell.pile.vo.base.MerchantOrderInfoVO">
select
t1.order_code as orderCode,
t1.transaction_code as transactionCode,
t1.order_status as orderStatus,
t1.station_id as stationId,
t2.station_name as stationName,
t1.order_amount as orderAmount,
t1.settlement_time as orderSettleTime
select t1.order_code as orderCode,
t1.transaction_code as transactionCode,
t1.order_status as orderStatus,
t1.station_id as stationId,
t2.station_name as stationName,
t1.order_amount as orderAmount,
t1.settlement_time as orderSettleTime
from order_basic_info t1
left join pile_station_info t2 on t1.station_id = t2.id
where
t1.del_flag = '0'
and t1.merchant_id = #{dto.merchantId,jdbcType=VARCHAR}
<if test="dto.startTime != null" >
left join pile_station_info t2 on t1.station_id = t2.id
where t1.del_flag = '0'
and t1.merchant_id = #{dto.merchantId,jdbcType=VARCHAR}
<if test="dto.startTime != null">
and t1.create_time <![CDATA[ >= ]]> #{dto.startTime,jdbcType=VARCHAR}
</if>
<if test="dto.endTime != null" >
<if test="dto.endTime != null">
and t1.settlement_time <![CDATA[ <= ]]> #{dto.endTime,jdbcType=VARCHAR}
</if>
order by t1.create_time desc
</select>
<select id="batchRefundQuery" resultType="com.jsowell.pile.vo.web.RefundOrder">
SELECT
t1.order_code as orderCode,
t1.`order_status` as orderStatus,
t1.station_id as stationId,
t2.station_name AS stationName,
t1.pay_amount AS payAmount,
t1.order_amount AS orderAmount,
t1.refund_amount AS refundAmount
FROM
order_basic_info t1
JOIN pile_station_info t2 ON t1.station_id = t2.id
SELECT t1.order_code as orderCode,
t1.`order_status` as orderStatus,
t1.station_id as stationId,
t2.station_name AS stationName,
t1.pay_amount AS payAmount,
t1.order_amount AS orderAmount,
t1.refund_amount AS refundAmount
FROM order_basic_info t1
JOIN pile_station_info t2 ON t1.station_id = t2.id
WHERE
t1.order_code IN
<foreach collection="list" item="itme" open="(" separator="," close=")">
@@ -1106,12 +1102,46 @@
<select id="queryOrderList" resultMap="OrderBasicInfoResult">
select
<include refid="Base_Column_List"/>
<include refid="Base_Column_List"/>
from order_basic_info
where del_flag = '0'
and order_code in
and order_code in
<foreach collection="orderCodeList" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR}
</foreach>
</select>
<select id="getIndexOrderInfoV2" resultType="com.jsowell.pile.vo.web.IndexOrderInfoVO">
SELECT trade_date AS date,
order_codes as orderCodes,
use_electricity AS totalElectricity,
total_amount as totalOrderAmount
from settle_order_report
where date(trade_date) >= DATE_SUB(CURDATE(), INTERVAL 30 day)
<if test="dto.stationId != null and dto.stationId != ''">
and station_id = #{dto.stationId,jdbcType=VARCHAR}
</if>
<if test="dto.stationIdList != null and dto.stationIdList.size() != 0">
and station_id in
<foreach collection="dto.stationIdList" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR}
</foreach>
</if>
group by trade_date
</select>
<select id="getIndexOrderDetail" resultType="com.jsowell.pile.vo.web.IndexOrderInfoVO">
select
sum(sharp_used_electricity) AS totalSharpUsedElectricity,
sum(peak_used_electricity) AS totalPeakUsedElectricity,
sum(flat_used_electricity) AS totalFlatUsedElectricity,
sum(valley_used_electricity) AS totalValleyUsedElectricity
from order_detail
<if test="list != null and list.size() != 0">
where order_code in
<foreach collection="list" item="orderCode" open="(" separator="," close=")">
#{orderCode,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper>