2021-08-04 11:22:15 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.xhpc.order.mapper.HxpcChargeOrderMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.xhpc.order.domain.HxpcChargeOrder" id="HxpcChargeOrderResult">
|
|
|
|
|
<result column="charge_order_id" property="chargeOrderId"/>
|
|
|
|
|
<result column="charging_station_id" property="chargingStationId"/>
|
|
|
|
|
<result column="user_id" property="userId"/>
|
|
|
|
|
<result column="terminal_id" property="terminalId"/>
|
|
|
|
|
<result column="internet_serial_number" property="internetSerialNumber"/>
|
|
|
|
|
<result column="serial_number" property="serialNumber"/>
|
|
|
|
|
<result column="start_soc" property="startSoc"/>
|
2021-08-09 12:15:00 +08:00
|
|
|
<result column="end_soc" property="endSoc"/>
|
2021-08-04 11:22:15 +08:00
|
|
|
<result column="source" property="source"/>
|
|
|
|
|
<result column="status" property="status"/>
|
|
|
|
|
<result column="del_flag" property="delFlag"/>
|
|
|
|
|
<result column="create_time" property="createTime"/>
|
|
|
|
|
<result column="create_by" property="createBy"/>
|
|
|
|
|
<result column="update_time" property="updateTime"/>
|
|
|
|
|
<result column="update_by" property="updateBy"/>
|
|
|
|
|
<result column="remark" property="remark"/>
|
|
|
|
|
<result column="rate_model_id" property="rateModelId"/>
|
2021-08-09 12:15:00 +08:00
|
|
|
<result column="charging_mode" property="chargingMode"/>
|
|
|
|
|
<result column="start_time" property="startTime"/>
|
|
|
|
|
<result column="end_time" property="endTime"/>
|
|
|
|
|
<result column="charging_time" property="chargingTime"/>
|
|
|
|
|
<result column="charging_degree" property="chargingDegree"/>
|
|
|
|
|
<result column="type" property="type"/>
|
2021-08-04 11:22:15 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
2021-08-05 16:17:04 +08:00
|
|
|
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
|
|
|
|
|
<result property="terminalId" column="terminal_id"/>
|
|
|
|
|
<result property="chargingPileId" column="charging_pile_id"/>
|
|
|
|
|
<result property="chargingStationId" column="charging_station_id"/>
|
|
|
|
|
<result property="name" column="name"/>
|
|
|
|
|
<result property="serialNumber" column="serial_number"/>
|
|
|
|
|
<result property="pileSerialNumber" column="pile_serial_number"/>
|
|
|
|
|
<result property="gunStatus" column="gun_status"/>
|
|
|
|
|
<result property="workStatus" column="work_status"/>
|
|
|
|
|
<result property="status" column="status"/>
|
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
2021-08-05 20:30:16 +08:00
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
<result property="rateModelId" column="rate_model_id"/>
|
2021-08-05 16:17:04 +08:00
|
|
|
</resultMap>
|
2021-08-05 20:30:16 +08:00
|
|
|
|
2021-08-04 11:22:15 +08:00
|
|
|
<select id="getHistotyChargeOrderMessage" resultType="map">
|
|
|
|
|
select
|
|
|
|
|
rto.real_time_order_id as realTimeOrderId,
|
|
|
|
|
rto.charging_order_id as chargingOrderId,
|
|
|
|
|
rto.voltage as voltage,
|
|
|
|
|
rto.electric_current as electricCurrent,
|
|
|
|
|
(select power from xhpc_charging_pile where charging_pile_id=
|
|
|
|
|
(select charging_pile_id from xhpc_terminal where serial_number=rto.pile_number and del_flag=0 LIMIT 1))power,
|
|
|
|
|
rto.soc as soc,
|
|
|
|
|
rto.gun_number as gunNumber,
|
|
|
|
|
rto.charging_degree as chargingDegree,
|
|
|
|
|
rto.charging_time as chargingTime,
|
|
|
|
|
rto.remaining_time as remainingTime,
|
|
|
|
|
rto.amount_charged as amountCharged,
|
|
|
|
|
au.balance as balance
|
|
|
|
|
from xhpc_real_time_order as rto
|
|
|
|
|
LEFT JOIN xhpc_app_user as au on au.app_user_id = rto.user_id
|
|
|
|
|
where rto.charging_order_id =(select charge_order_id from xhpc_charge_order where status =0 and source = 0 ORDER BY create_time desc LIMIT 1)
|
|
|
|
|
and rto.user_id=#{userId}
|
|
|
|
|
</select>
|
2021-08-05 16:17:04 +08:00
|
|
|
|
|
|
|
|
<select id="getUserMessage" resultType="map">
|
|
|
|
|
select
|
|
|
|
|
app_user_id as appUserId,
|
|
|
|
|
balance as balance,
|
|
|
|
|
is_refund_application as isRefundApplication
|
|
|
|
|
from xhpc_app_user
|
|
|
|
|
where del_flag=0
|
|
|
|
|
</select>
|
|
|
|
|
<select id="countXhpcRealTimeOrder" resultType="int">
|
|
|
|
|
select count(real_time_order_id) from xhpc_real_time_order where user_id =#{userId} and type =2 order by create_time desc LIMIT 1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="countXhpcChargeOrder" resultType="int">
|
|
|
|
|
select count(charge_order_id) from xhpc_charge_order where user_id =#{userId} and status =2 and del_flag =0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getXhpcTerminalSerialNumber" resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
*
|
|
|
|
|
from xhpc_terminal
|
|
|
|
|
where serial_number=#{serialNumber} and del_flag=0 limit 1
|
|
|
|
|
</select>
|
|
|
|
|
|
2021-08-05 20:30:16 +08:00
|
|
|
<insert id="addXhpcTerminalSerial" parameterType="com.xhpc.order.domain.HxpcChargeOrder" useGeneratedKeys="true"
|
|
|
|
|
keyProperty="chargeOrderId">
|
|
|
|
|
insert into xhpc_charge_order
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="null != chargingStationId ">
|
|
|
|
|
charging_station_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != userId ">
|
|
|
|
|
user_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != terminalId ">
|
|
|
|
|
terminal_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != internetSerialNumber ">
|
|
|
|
|
internet_serial_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != serialNumber ">
|
|
|
|
|
serial_number,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != startSoc ">
|
|
|
|
|
start_soc,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != source ">
|
|
|
|
|
source,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != status ">
|
|
|
|
|
status,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != delFlag ">
|
|
|
|
|
del_flag,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != rateModelId ">
|
2021-08-09 12:15:00 +08:00
|
|
|
rate_model_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingMode ">
|
|
|
|
|
charging_mode,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != startTime ">
|
|
|
|
|
start_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != endTime ">
|
|
|
|
|
end_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingTime ">
|
|
|
|
|
charging_time,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingDegree ">
|
|
|
|
|
charging_degree
|
2021-08-05 20:30:16 +08:00
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="null != chargingStationId ">
|
|
|
|
|
#{chargingStationId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != userId ">
|
|
|
|
|
#{userId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != terminalId ">
|
|
|
|
|
#{terminalId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != internetSerialNumber ">
|
|
|
|
|
#{internetSerialNumber},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != serialNumber ">
|
|
|
|
|
#{serialNumber},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != startSoc ">
|
|
|
|
|
#{startSoc},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != source ">
|
|
|
|
|
#{source},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != status ">
|
|
|
|
|
#{status},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != delFlag ">
|
|
|
|
|
#{delFlag},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != rateModelId ">
|
2021-08-09 12:15:00 +08:00
|
|
|
#{rateModelId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingMode ">
|
|
|
|
|
#{chargingMode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != startTime ">
|
|
|
|
|
#{startTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != endTime ">
|
|
|
|
|
#{endTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingTime ">
|
|
|
|
|
#{chargingTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="null != chargingDegree ">
|
|
|
|
|
#{chargingDegree}
|
2021-08-05 20:30:16 +08:00
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
2021-08-09 12:15:00 +08:00
|
|
|
<update id="updateXhpcTerminalSerial" parameterType="com.xhpc.order.domain.HxpcChargeOrder">
|
|
|
|
|
update xhpc_charge_order
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="chargingStationId != null">end_soc = #{chargingStationId},</if>
|
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
|
<if test="endTime != null">end_time = #{endTime},</if>
|
|
|
|
|
<if test="chargingTime != null">charging_time = #{chargingTime},</if>
|
|
|
|
|
<if test="chargingDegree != null">charging_degree = #{chargingDegree},</if>
|
|
|
|
|
<if test="type != null">type = #{type},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where charge_order_id = #{chargingStationId}
|
|
|
|
|
</update>
|
2021-08-05 16:17:04 +08:00
|
|
|
|
|
|
|
|
<select id="getHistotyChargeOrderStatusList" resultType="map">
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
2021-08-04 11:22:15 +08:00
|
|
|
</mapper>
|