|
@@ -1,16 +1,109 @@
|
|
|
<?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.steerinfo.dil.mapper.StatisticalReportMapper">
|
|
|
-
|
|
|
+ <sql id="orderBy">
|
|
|
+ <if test="orderField != null and orderField != ''">
|
|
|
+ order by "${orderField}"
|
|
|
+ <if test="orderType != null and orderType != ''">
|
|
|
+ ${orderType}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
<!--查询采购统计报表-->
|
|
|
<select id="getAllPurchaseFLRLReport" parameterType="map" resultType="java.util.Map">
|
|
|
select *
|
|
|
- from OMSTRUCK_ORDER OO
|
|
|
- left join TMSTRUCK_TOTAL_RESULT TTR
|
|
|
- on TTR.ORDER_ID = OO.ORDER_ID
|
|
|
-
|
|
|
- left join TMSTRUCK_ENFACTORY_RESULT TER
|
|
|
- on TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
|
|
|
-
|
|
|
+ from (select OO.ORDER_NUMBER "orderNumber",
|
|
|
+ RC.CAPACITY_NUMBER "capacityNumber",
|
|
|
+ TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
|
|
|
+ TWR.RESULT_NET_WEIGHT "resultNetWeight",
|
|
|
+ TQR.RESULT_DEDUCTION "resultDeduction",
|
|
|
+ TUR.RESULT_END_TIME "resultEndTime",
|
|
|
+ RW.WAREHOUSE_NAME "warehouseName",
|
|
|
+ TRR.INSERT_TIME "insertTime",
|
|
|
+ TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
|
|
|
+ OO.INSERT_TIME "insertTimee"
|
|
|
+ from OMSTRUCK_ORDER OO
|
|
|
+ left join TMSTRUCK_TOTAL_RESULT TTR
|
|
|
+ on TTR.ORDER_ID = OO.ORDER_ID
|
|
|
+ left join RMS_CAPACITY RC
|
|
|
+ on RC.CAPACITY_ID = OO.CAPACITY_ID
|
|
|
+ left join TMSTRUCK_ENFACTORY_RESULT TER
|
|
|
+ on TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
|
|
|
+ left join OMSTRUCK_ORDER_MATERIAL OOM
|
|
|
+ on OOM.ORDER_ID = OO.ORDER_ID
|
|
|
+ left join TMSTRUCK_WEIGHT_RESULT TWR
|
|
|
+ on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ left join TMSTRUCK_UNLOAD_RESULT TUR
|
|
|
+ on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ left join RMS_WAREHOUSE RW
|
|
|
+ on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
|
|
|
+ left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
|
|
|
+ on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ left join TMSTRUCK_RECEIPT_RESULT TRR
|
|
|
+ on TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ left join TMSTRUCK_QUALITY_RESULT TQR
|
|
|
+ on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
|
|
|
+ and OO.ORDER_TYPE = #{orderTypee}
|
|
|
+ )
|
|
|
+ <where>
|
|
|
+ <if test="orderNumber != null">
|
|
|
+ <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
|
|
|
+ "orderNumber" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="capacityNumber != null">
|
|
|
+ and
|
|
|
+ <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
|
|
|
+ "capacityNumber" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="resultEntryGateTime != null">
|
|
|
+ and
|
|
|
+ <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
|
|
|
+ "resultEntryGateTime" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="resultNetWeight != null">
|
|
|
+ and
|
|
|
+ <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
|
|
|
+ "resultNetWeight" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="resultDeduction != null">
|
|
|
+ and
|
|
|
+ <foreach collection="resultDeduction" item="item" open="(" separator="or" close=")">
|
|
|
+ "resultDeduction" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="resultEndTime != null">
|
|
|
+ and
|
|
|
+ <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
|
|
|
+ "resultEndTime" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="warehouseName != null">
|
|
|
+ and
|
|
|
+ <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
|
|
|
+ "warehouseName" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="insertTime != null">
|
|
|
+ and
|
|
|
+ <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
|
|
|
+ "insertTime" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="resultOutGateTime != null">
|
|
|
+ and
|
|
|
+ <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
|
|
|
+ "resultOutGateTime" like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <include refid="orderBy"></include>
|
|
|
+ <if test="orderField == null ">
|
|
|
+ order by "insertTimee" desc
|
|
|
+ </if>
|
|
|
</select>
|
|
|
</mapper>
|