<?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.envaccess.mapper.EnvWeighbridgeSystemMapper">
|
|
<select id="listPage" resultType="com.ruoyi.envaccess.pojo.EnvWeighbridgeSystem">
|
SELECT * FROM env_weighbridge_system
|
<where>
|
<if test="req.plateNumber != null and req.plateNumber != ''">
|
AND plate_number LIKE CONCAT('%',#{req.plateNumber},'%')
|
</if>
|
<if test="req.cargoName != null and req.cargoName != ''">
|
AND cargo_name LIKE CONCAT('%',#{req.cargoName},'%')
|
</if>
|
<if test="req.driverName != null and req.driverName != ''">
|
AND driver_name LIKE CONCAT('%',#{req.driverName},'%')
|
</if>
|
<if test="req.weighbridgeNumber != null and req.weighbridgeNumber != ''">
|
AND weighbridge_number = #{req.weighbridgeNumber}
|
</if>
|
</where>
|
ORDER BY weight_time DESC, id DESC
|
</select>
|
|
<select id="dailyReport" resultType="java.util.Map">
|
SELECT
|
DATE_FORMAT(weight_time, '%Y-%m-%d') AS date,
|
COUNT(*) AS tripCount,
|
ROUND(SUM(IFNULL(net_weight, IFNULL(gross_weight, 0) - IFNULL(tare_weight, 0))) / 1000, 2) AS cargoVolume,
|
ROUND(AVG(IFNULL(position_offset, 0)), 2) AS deviationRate
|
FROM env_weighbridge_system
|
<where>
|
<if test="startDate != null and startDate != ''">
|
AND weight_time >= #{startDate}
|
</if>
|
<if test="endDate != null and endDate != ''">
|
AND weight_time <= #{endDate}
|
</if>
|
</where>
|
GROUP BY DATE_FORMAT(weight_time, '%Y-%m-%d')
|
ORDER BY date
|
</select>
|
</mapper>
|