You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
7.2 KiB
XML

<?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.nmgs.mapper.zdzcpt.ZDZCMapper">
<select id="selectPage" resultType="java.util.Map">
SELECT
od.*,
nt.stationName,
nt.lineId
FROM
cmdatabaseall.overload_detail_pt_data od
LEFT JOIN cmdatabaseall.pt_ov_data_text nt ON od.sitecode = nt.siteId
<where>
nt.stationName is not NULL
<!-- 动态SQL条件 -->
<if test="params.lineId != null and params.lineId != ''">
AND nt.lineId = #{params.lineId}
</if>
<if test="params.stationid != null and params.stationid != ''">
AND nt.stationName = #{params.stationid}
</if>
<if test="params.vehplate != null and params.vehplate != ''">
AND od.vehplate LIKE CONCAT('%', #{params.vehplate}, '%')
</if>
<if test="params.plateColor != null and params.plateColor != ''">
AND od.platecolor = #{params.plateColor}
</if>
<if test="params.overlimitflag != null and params.overlimitflag != '' and params.overlimitflag ==1">
AND (od.totalweight) - od.limitweight > 0
</if>
<if test="params.overlimitflag != null and params.overlimitflag != '' and params.overlimitflag ==2">
AND ((od.totalweight ) - od.limitweight) &lt;= 0
</if>
<if test="params.overlimitflag != null and params.overlimitflag != '' and params.limitstart != null and params.limitstart != ''">
AND (((od.totalweight ) - od.limitweight)/od.limitweight)*100 > #{params.limitstart}
</if>
<if test="params.overlimitflag != null and params.overlimitflag != '' and params.limitend != null and params.limitend != ''">
AND (((od.totalweight ) - od.limitweight)/od.limitweight)*100 &lt;= #{params.limitend}
</if>
<if test="params.starttime != null and params.starttime != '' ">
AND od.detectiontime >= #{params.starttime}
</if>
<if test="params.endtime != null and params.endtime != ''">
AND od.detectiontime &lt;= #{params.endtime}
</if>
<if test="params.axiscountStart != null and params.axiscountEnd != null and params.axiscountStart != '' and params.axiscountEnd != ''">
AND od.axlenum BETWEEN #{params.axiscountStart} AND #{params.axiscountEnd}
</if>
<if test="params.inweightStart != null and params.inweightEnd != null and params.inweightStart != '' and params.inweightEnd != ''">
AND od.totalweight BETWEEN #{params.inweightStart} AND #{params.inweightEnd}
</if>
<if test="params.discountWeightStart != null and params.discountWeightEnd != null and params.discountWeightStart != '' and params.discountWeightEnd != ''">
AND (od.totalweight ) BETWEEN #{params.discountWeightStart} AND #{params.discountWeightEnd}
</if>
<if test="params.overWeightStart != null and params.overWeightEnd != null and params.limitweight != '' and params.overWeightEnd != ''">
AND od.limitweight BETWEEN #{params.overWeightStart} AND #{params.overWeightEnd}
</if>
</where>
ORDER BY od.detectiontime DESC
</select>
<select id="selectRoadInfo" resultType="java.util.Map">
SELECT lineId FROM cmdatabaseall.pt_ov_line_text order by lineId
</select>
<select id="selectStaListByLindId" resultType="java.util.Map">
SELECT * FROM cmdatabaseall.pt_ov_data_text WHERE lineId = #{lineId}
</select>
<select id="selectOverExcelList" resultType="com.nmgs.entity.export.ZDOverDetailExcel">
SELECT
od.*,
CASE
WHEN od.totalweight > od.limitweight THEN '超重'
ELSE '未超重'
END AS isOverweight,
nt.stationName,
nt.lineId
FROM
cmdatabaseall.overload_detail_pt_data od
LEFT JOIN cmdatabaseall.pt_ov_data_text nt ON od.sitecode = nt.siteId
<where>
nt.stationName is not NULL
<!-- 动态SQL条件 -->
<if test="params.lineId != null and params.lineId != ''">
AND nt.lineId = #{params.lineId}
</if>
<if test="params.stationid != null and params.stationid != ''">
AND nt.stationName = #{params.stationid}
</if>
<if test="params.vehplate != null and params.vehplate != ''">
AND od.vehplate LIKE CONCAT('%', #{params.vehplate}, '%')
</if>
<if test="params.plateColor != null and params.plateColor != ''">
AND od.platecolor = #{params.plateColor}
</if>
<if test="params.overlimitflag != null and params.overlimitflag != '' and params.overlimitflag ==1">
AND (od.totalweight) - od.limitweight > 0
</if>
<if test="params.overlimitflag != null and params.overlimitflag != '' and params.overlimitflag ==2">
AND ((od.totalweight ) - od.limitweight) &lt;= 0
</if>
<if test="params.overlimitflag != null and params.overlimitflag != '' and params.limitstart != null and params.limitstart != ''">
AND (((od.totalweight ) - od.limitweight)/od.limitweight)*100 > #{params.limitstart}
</if>
<if test="params.overlimitflag != null and params.overlimitflag != '' and params.limitend != null and params.limitend != ''">
AND (((od.totalweight ) - od.limitweight)/od.limitweight)*100 &lt;= #{params.limitend}
</if>
<if test="params.starttime != null and params.starttime != '' ">
AND od.detectiontime >= #{params.starttime}
</if>
<if test="params.endtime != null and params.endtime != ''">
AND od.detectiontime &lt;= #{params.endtime}
</if>
<if test="params.axiscountStart != null and params.axiscountEnd != null and params.axiscountStart != '' and params.axiscountEnd != ''">
AND od.axlenum BETWEEN #{params.axiscountStart} AND #{params.axiscountEnd}
</if>
<if test="params.inweightStart != null and params.inweightEnd != null and params.inweightStart != '' and params.inweightEnd != ''">
AND od.totalweight BETWEEN #{params.inweightStart} AND #{params.inweightEnd}
</if>
<if test="params.discountWeightStart != null and params.discountWeightEnd != null and params.discountWeightStart != '' and params.discountWeightEnd != ''">
AND (od.totalweight ) BETWEEN #{params.discountWeightStart} AND #{params.discountWeightEnd}
</if>
<if test="params.overWeightStart != null and params.overWeightEnd != null and params.limitweight != '' and params.overWeightEnd != ''">
AND od.limitweight BETWEEN #{params.overWeightStart} AND #{params.overWeightEnd}
</if>
</where>
ORDER BY od.detectiontime DESC
</select>
</mapper>