<?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.ruoyi.chargingPile.mapper.TParkingRecordMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ruoyi.chargingPile.api.model.TParkingRecord">
|
<id column="id" property="id" />
|
<result column="app_user_id" property="appUserId" />
|
<result column="license_plate" property="licensePlate" />
|
<result column="vehicle_color" property="vehicleColor" />
|
<result column="charging_order_id" property="chargingOrderId" />
|
<result column="parking_lot_id" property="parkingLotId" />
|
<result column="in_parking_time" property="inParkingTime" />
|
<result column="out_parking_time" property="outParkingTime" />
|
<result column="parking_duration" property="parkingDuration" />
|
<result column="order_amount" property="orderAmount" />
|
<result column="status" property="status" />
|
<result column="out_parking_type" property="outParkingType" />
|
<result column="create_time" property="createTime" />
|
<result column="code" property="code" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, app_user_id, license_plate, vehicle_color, charging_order_id, parking_lot_id, in_parking_time, out_parking_time, parking_duration, order_amount, status, out_parking_type, create_time
|
</sql>
|
<select id="getSum" resultType="java.math.BigDecimal">
|
select sum(timeout_amount) from t_parking_record where in_parking_time >= #{sixBefore}
|
</select>
|
<select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.TParkingRecordVO">
|
select
|
tpr.id, tpr.app_user_id, tpr.license_plate, tpr.vehicle_color, tpr.charging_order_id, tpr.parking_lot_id, tpr.in_parking_time, tpr.out_parking_time,
|
tpr.parking_duration, tpr.order_amount, tpr.status, tpr.out_parking_type, tpr.create_time,(tpr.order_amount - tpr.timeout_amount) as parkingFee,
|
(tpr.parking_duration - tpr.free_duration) as feeDuration,ts.name as siteName
|
from t_parking_record tpr
|
left join t_parking_lot tpl on tpr.parking_lot_id = tpl.id
|
left join t_site ts on tpl.site_id = ts.id
|
<where>
|
<if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
|
AND tpr.create_time BETWEEN #{query.startTime} AND #{query.endTime}
|
</if>
|
<if test="query.code != null and query.code != ''">
|
AND tpr.code LIKE concat('%',#{query.code},'%')
|
</if>
|
<if test="query.licensePlate != null and query.licensePlate != ''">
|
AND tpr.licensePlate LIKE concat('%',#{query.licensePlate},'%')
|
</if>
|
<if test="query.lotIds != null and query.lotIds.size()>0">
|
AND tpr.parking_lot_id IN
|
<foreach collection="query.lotIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
AND tpr.status = 3
|
</where>
|
ORDER BY tpr.create_time DESC
|
</select>
|
<select id="getParkingRecordCount" resultType="com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO">
|
SELECT count(id) as orderCount,
|
sum(timeout_amount) as timeoutAmountSum,
|
sum(parking_duration - free_duration) as feeDurationSum,
|
sum(parking_duration) as parkingDurationSum
|
from t_parking_record
|
<where>
|
<if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
|
AND create_time BETWEEN #{query.startTime} AND #{query.endTime}
|
</if>
|
<if test="query.code != null and query.code != ''">
|
AND code LIKE concat('%',#{query.code},'%')
|
</if>
|
<if test="query.licensePlate != null and query.licensePlate != ''">
|
AND licensePlate LIKE concat('%',#{query.licensePlate},'%')
|
</if>
|
<if test="query.lotIds != null and query.lotIds.size()>0">
|
AND parking_lot_id IN
|
<foreach collection="query.lotIds" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
AND status = 3
|
</where>
|
ORDER BY create_time DESC
|
</select>
|
|
</mapper>
|