|
|
@@ -5,85 +5,95 @@
|
|
|
<!-- 获取充电订单信息分页列表 -->
|
|
|
<select id="getChargeOrderInfoPage" resultType="com.zsElectric.boot.business.model.vo.ChargeOrderInfoVO">
|
|
|
SELECT
|
|
|
- a.id,
|
|
|
- a.user_id,
|
|
|
- a.order_type,
|
|
|
- a.equipment_id,
|
|
|
- a.charge_order_no,
|
|
|
- a.start_time,
|
|
|
- a.end_time,
|
|
|
- a.charge_time,
|
|
|
- a.status,
|
|
|
- a.third_party_total_cost,
|
|
|
- a.third_party_serverfee,
|
|
|
- a.third_party_elecfee,
|
|
|
- a.total_charge,
|
|
|
- a.real_cost,
|
|
|
- a.real_service_cost,
|
|
|
- a.stop_type,
|
|
|
- a.phone_num,
|
|
|
- a.plate_num,
|
|
|
- a.stop_reason,
|
|
|
- a.charge_details,
|
|
|
- a.third_party_station_id,
|
|
|
- a.pre_amt,
|
|
|
- a.real_predict_service_cost,
|
|
|
- a.masp_amount,
|
|
|
- a.masp_real_amount,
|
|
|
- a.total_masp_money,
|
|
|
- a.masp_status,
|
|
|
- a.masp_time,
|
|
|
- a.masp_desc,
|
|
|
- a.discount_money,
|
|
|
- a.discount_desc,
|
|
|
- a.discount_info_id,
|
|
|
- a.real_third_cost,
|
|
|
- a.firm_id,
|
|
|
- a.firm_price,
|
|
|
- a.coupon_price,
|
|
|
- a.coupon_id,
|
|
|
- a.remark,
|
|
|
- a.create_by,
|
|
|
- a.create_time,
|
|
|
- a.update_by,
|
|
|
- a.update_time,
|
|
|
- a.version,
|
|
|
- a.is_deleted,
|
|
|
- b.phone
|
|
|
+ coi.id,
|
|
|
+ coi.user_id,
|
|
|
+ coi.order_type,
|
|
|
+ psi.station_name,
|
|
|
+ coi.equipment_id,
|
|
|
+ coi.charge_order_no,
|
|
|
+ coi.start_time,
|
|
|
+ coi.end_time,
|
|
|
+ coi.charge_time,
|
|
|
+ coi.status,
|
|
|
+ coi.third_party_total_cost,
|
|
|
+ coi.third_party_serverfee,
|
|
|
+ coi.third_party_elecfee,
|
|
|
+ coi.total_charge,
|
|
|
+ coi.real_cost,
|
|
|
+ coi.real_service_cost,
|
|
|
+ coi.stop_type,
|
|
|
+ ui.phone AS phoneNum,
|
|
|
+ coi.plate_num,
|
|
|
+ coi.stop_reason,
|
|
|
+ coi.charge_details,
|
|
|
+ coi.third_party_station_id,
|
|
|
+ coi.pre_amt,
|
|
|
+ coi.real_predict_service_cost,
|
|
|
+ coi.masp_amount,
|
|
|
+ coi.masp_real_amount,
|
|
|
+ coi.total_masp_money,
|
|
|
+ coi.masp_status,
|
|
|
+ coi.masp_time,
|
|
|
+ coi.masp_desc,
|
|
|
+ coi.discount_money,
|
|
|
+ coi.discount_desc,
|
|
|
+ coi.discount_info_id,
|
|
|
+ coi.real_third_cost,
|
|
|
+ coi.firm_id,
|
|
|
+ coi.firm_price,
|
|
|
+ coi.coupon_price,
|
|
|
+ coi.coupon_id,
|
|
|
+ CASE
|
|
|
+ WHEN coi.remark IS NULL OR coi.remark = '' THEN '无'
|
|
|
+ ELSE coi.remark
|
|
|
+ END AS remark,
|
|
|
+ coi.create_by,
|
|
|
+ coi.create_time,
|
|
|
+ coi.update_by,
|
|
|
+ coi.update_time,
|
|
|
+ coi.version,
|
|
|
+ coi.is_deleted,
|
|
|
+ pci.connector_id,
|
|
|
+ pci.connector_name
|
|
|
FROM
|
|
|
- c_charge_order_info a
|
|
|
- left join c_user_info b ON a.user_id = b.id
|
|
|
+ c_charge_order_info coi
|
|
|
+ LEFT JOIN c_user_info ui ON coi.user_id = ui.id
|
|
|
+ left JOIN third_party_connector_info pci ON coi.connector_id = pci.connector_id
|
|
|
+ LEFT JOIN third_party_station_info psi ON coi.third_party_station_id = psi.id
|
|
|
<where>
|
|
|
- a.is_deleted = 0
|
|
|
+ coi.is_deleted = 0
|
|
|
<if test="queryParams.equipmentId != null">
|
|
|
- AND a.equipment_id = #{queryParams.equipmentId}
|
|
|
+ AND coi.equipment_id = #{queryParams.equipmentId}
|
|
|
</if>
|
|
|
<if test="queryParams.maspStatus != null">
|
|
|
- AND a.masp_status = #{queryParams.maspStatus}
|
|
|
+ AND coi.masp_status = #{queryParams.maspStatus}
|
|
|
</if>
|
|
|
<if test="queryParams.status != null">
|
|
|
- AND a.status = #{queryParams.status}
|
|
|
+ AND coi.status = #{queryParams.status}
|
|
|
</if>
|
|
|
<if test="queryParams.startTime != null">
|
|
|
- AND a.create_time <![CDATA[ >= ]]> #{queryParams.startTime,jdbcType=DATE}
|
|
|
+ AND coi.create_time <![CDATA[ >= ]]> #{queryParams.startTime,jdbcType=DATE}
|
|
|
</if>
|
|
|
<if test="queryParams.endTime != null">
|
|
|
- AND a.create_time <![CDATA[ <= ]]> #{queryParams.endTime,jdbcType=DATE}
|
|
|
+ AND coi.create_time <![CDATA[ <= ]]> #{queryParams.endTime,jdbcType=DATE}
|
|
|
</if>
|
|
|
<if test="queryParams.stopType != null">
|
|
|
- AND a.stop_type = #{queryParams.stopType}
|
|
|
+ AND coi.stop_type = #{queryParams.stopType}
|
|
|
</if>
|
|
|
<if test="queryParams.orderType != null">
|
|
|
- AND a.order_type = #{queryParams.orderType}
|
|
|
+ AND coi.order_type = #{queryParams.orderType}
|
|
|
</if>
|
|
|
<if test="queryParams.phoneNum != null and queryParams.phoneNum != ''">
|
|
|
- AND b.phone like concat('%',#{queryParams.phoneNum},'%')
|
|
|
+ AND ui.phone like concat('%',#{queryParams.phoneNum},'%')
|
|
|
</if>
|
|
|
<if test="queryParams.chargeOrderNo != null and queryParams.chargeOrderNo != ''">
|
|
|
- AND a.charge_order_no like concat('%',#{queryParams.chargeOrderNo},'%')
|
|
|
+ AND coi.charge_order_no like concat('%',#{queryParams.chargeOrderNo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.thirdStationId != null">
|
|
|
+ AND coi.third_party_station_id = #{queryParams.thirdStationId}
|
|
|
</if>
|
|
|
</where>
|
|
|
- ORDER BY a.create_time DESC
|
|
|
+ ORDER BY coi.create_time DESC
|
|
|
</select>
|
|
|
<select id="getPage" resultType="com.zsElectric.boot.business.model.vo.ChargeOrderInfoVO">
|
|
|
SELECT
|
|
|
@@ -124,7 +134,10 @@
|
|
|
coi.firm_price,
|
|
|
coi.coupon_price,
|
|
|
coi.coupon_id,
|
|
|
- coi.remark,
|
|
|
+ CASE
|
|
|
+ WHEN coi.remark IS NULL OR coi.remark = '' THEN '无'
|
|
|
+ ELSE coi.remark
|
|
|
+ END AS remark,
|
|
|
coi.create_by,
|
|
|
coi.create_time,
|
|
|
coi.update_by,
|
|
|
@@ -161,6 +174,7 @@
|
|
|
coi.id,
|
|
|
coi.user_id,
|
|
|
coi.order_type,
|
|
|
+ psi.station_name,
|
|
|
coi.equipment_id,
|
|
|
coi.charge_order_no,
|
|
|
coi.start_time,
|
|
|
@@ -174,7 +188,7 @@
|
|
|
coi.real_cost,
|
|
|
coi.real_service_cost,
|
|
|
coi.stop_type,
|
|
|
- coi.phone_num,
|
|
|
+ ui.phone AS phoneNum,
|
|
|
coi.plate_num,
|
|
|
coi.stop_reason,
|
|
|
coi.charge_details,
|
|
|
@@ -195,7 +209,10 @@
|
|
|
coi.firm_price,
|
|
|
coi.coupon_price,
|
|
|
coi.coupon_id,
|
|
|
- coi.remark,
|
|
|
+ CASE
|
|
|
+ WHEN coi.remark IS NULL OR coi.remark = '' THEN '无'
|
|
|
+ ELSE coi.remark
|
|
|
+ END AS remark,
|
|
|
coi.create_by,
|
|
|
coi.create_time,
|
|
|
coi.update_by,
|
|
|
@@ -203,12 +220,12 @@
|
|
|
coi.version,
|
|
|
coi.is_deleted,
|
|
|
pci.connector_id,
|
|
|
- pci.connector_name,
|
|
|
- psi.station_name
|
|
|
+ pci.connector_name
|
|
|
FROM
|
|
|
c_charge_order_info coi
|
|
|
+ LEFT JOIN c_user_info ui ON coi.user_id = ui.id
|
|
|
left JOIN third_party_connector_info pci ON coi.connector_id = pci.connector_id
|
|
|
- LEFT JOIN third_party_station_info psi ON pci.station_id = psi.station_id
|
|
|
+ LEFT JOIN third_party_station_info psi ON coi.third_party_station_id = psi.id
|
|
|
<where>
|
|
|
coi.is_deleted = 0
|
|
|
<if test="chargeOrderNo != null and chargeOrderNo !=''">
|
|
|
@@ -217,4 +234,100 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 获取充电订单信息导出列表 -->
|
|
|
+ <select id="listExportChargeOrderInfo" resultType="com.zsElectric.boot.business.model.dto.ChargeOrderInfoExportDTO">
|
|
|
+ SELECT
|
|
|
+ a.charge_order_no,
|
|
|
+ b.phone,
|
|
|
+ CASE a.order_type
|
|
|
+ WHEN 0 THEN '个人订单'
|
|
|
+ WHEN 1 THEN '集团订单'
|
|
|
+ ELSE '未知'
|
|
|
+ END AS order_type_name,
|
|
|
+ psi.station_name,
|
|
|
+ pci.connector_name,
|
|
|
+ a.equipment_id,
|
|
|
+ a.start_time,
|
|
|
+ a.end_time,
|
|
|
+ a.charge_time,
|
|
|
+ CASE a.status
|
|
|
+ WHEN 0 THEN '待启动'
|
|
|
+ WHEN 1 THEN '充电中'
|
|
|
+ WHEN 2 THEN '结算中'
|
|
|
+ WHEN 3 THEN '已完成'
|
|
|
+ WHEN 5 THEN '未成功充电'
|
|
|
+ ELSE '未知'
|
|
|
+ END AS status_name,
|
|
|
+ a.total_charge,
|
|
|
+ a.real_cost,
|
|
|
+ a.real_service_cost,
|
|
|
+ a.third_party_total_cost,
|
|
|
+ a.third_party_serverfee,
|
|
|
+ a.third_party_elecfee,
|
|
|
+ a.pre_amt,
|
|
|
+ a.discount_money,
|
|
|
+ a.discount_desc,
|
|
|
+ a.coupon_price,
|
|
|
+ CASE a.stop_type
|
|
|
+ WHEN 1 THEN '主动停止'
|
|
|
+ WHEN 2 THEN '充满停止'
|
|
|
+ WHEN 3 THEN '余额不足停止'
|
|
|
+ WHEN 4 THEN '电桩按钮停止'
|
|
|
+ ELSE ''
|
|
|
+ END AS stop_type_name,
|
|
|
+ CASE a.stop_reason
|
|
|
+ WHEN 0 THEN '用户手动停止充电'
|
|
|
+ WHEN 1 THEN '客户归属地运营商平台停止充电'
|
|
|
+ WHEN 2 THEN 'BMS停止充电'
|
|
|
+ WHEN 3 THEN '充电机设备故障'
|
|
|
+ WHEN 4 THEN '连接器断开'
|
|
|
+ WHEN 99 THEN '其他'
|
|
|
+ ELSE ''
|
|
|
+ END AS stopReason,
|
|
|
+ CASE
|
|
|
+ WHEN a.remark IS NULL OR a.remark = '' THEN '无'
|
|
|
+ ELSE a.remark
|
|
|
+ END AS remark,
|
|
|
+ a.create_time
|
|
|
+ FROM
|
|
|
+ c_charge_order_info a
|
|
|
+ LEFT JOIN c_user_info b ON a.user_id = b.id
|
|
|
+ LEFT JOIN third_party_connector_info pci ON a.connector_id = pci.connector_id
|
|
|
+ LEFT JOIN third_party_station_info psi ON a.third_party_station_id = psi.id
|
|
|
+ <where>
|
|
|
+ a.is_deleted = 0
|
|
|
+ <if test="queryParams.equipmentId != null">
|
|
|
+ AND a.equipment_id = #{queryParams.equipmentId}
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.maspStatus != null">
|
|
|
+ AND a.masp_status = #{queryParams.maspStatus}
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.status != null">
|
|
|
+ AND a.status = #{queryParams.status}
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.startTime != null">
|
|
|
+ AND a.create_time <![CDATA[ >= ]]> #{queryParams.startTime,jdbcType=DATE}
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.endTime != null">
|
|
|
+ AND a.create_time <![CDATA[ <= ]]> #{queryParams.endTime,jdbcType=DATE}
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.stopType != null">
|
|
|
+ AND a.stop_type = #{queryParams.stopType}
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.orderType != null">
|
|
|
+ AND a.order_type = #{queryParams.orderType}
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.phoneNum != null and queryParams.phoneNum != ''">
|
|
|
+ AND b.phone like concat('%',#{queryParams.phoneNum},'%')
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.chargeOrderNo != null and queryParams.chargeOrderNo != ''">
|
|
|
+ AND a.charge_order_no like concat('%',#{queryParams.chargeOrderNo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="queryParams.thirdStationId != null">
|
|
|
+ AND a.third_party_station_id = #{queryParams.thirdStationId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY a.create_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|