123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704 |
- <?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.TmstruckTotalResultMapper">
- <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckTotalResult">
- <id column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
- <result column="ORDER_ID" jdbcType="DECIMAL" property="orderId" />
- <result column="RESULT_DURATION" jdbcType="DECIMAL" property="resultDuration" />
- <result column="STANDARD_DATA_ID" jdbcType="DECIMAL" property="standardDataId" />
- <result column="RESULT_OUTLIER" jdbcType="DECIMAL" property="resultOutlier" />
- <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
- <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
- <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
- <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
- </resultMap>
- <sql id="columns">
- RESULT_TOTAL_ID, ORDER_ID, RESULT_DURATION, STANDARD_DATA_ID, RESULT_OUTLIER, INSERT_USERNAME,
- INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
- </sql>
- <sql id="columns_alias">
- t.RESULT_TOTAL_ID, t.ORDER_ID, t.RESULT_DURATION, t.STANDARD_DATA_ID, t.RESULT_OUTLIER,
- t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
- </sql>
- <sql id="select">
- SELECT <include refid="columns" /> FROM TMSTRUCK_TOTAL_RESULT
- </sql>
- <sql id="select_alias">
- SELECT <include refid="columns_alias" /> FROM TMSTRUCK_TOTAL_RESULT t
- </sql>
- <sql id="where">
- <where>
- <if test="resultTotalId != null">
- and RESULT_TOTAL_ID = #{resultTotalId}
- </if>
- <if test="orderId != null">
- and ORDER_ID = #{orderId}
- </if>
- <if test="resultDuration != null">
- and RESULT_DURATION = #{resultDuration}
- </if>
- <if test="standardDataId != null">
- and STANDARD_DATA_ID = #{standardDataId}
- </if>
- <if test="resultOutlier != null">
- and RESULT_OUTLIER = #{resultOutlier}
- </if>
- <if test="insertUsername != null and insertUsername != ''">
- and INSERT_USERNAME = #{insertUsername}
- </if>
- <if test="insertTime != null">
- and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
- </if>
- <if test="updateUsername != null and updateUsername != ''">
- and UPDATE_USERNAME = #{updateUsername}
- </if>
- <if test="updateTime != null">
- and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
- </if>
- <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
- and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
- </if>
- </where>
- </sql>
- <sql id="whereLike">
- <where>
- <if test="resultTotalId != null">
- and RESULT_TOTAL_ID = #{resultTotalId}
- </if>
- <if test="orderId != null">
- and ORDER_ID = #{orderId}
- </if>
- <if test="resultDuration != null">
- and RESULT_DURATION = #{resultDuration}
- </if>
- <if test="standardDataId != null">
- and STANDARD_DATA_ID = #{standardDataId}
- </if>
- <if test="resultOutlier != null">
- and RESULT_OUTLIER = #{resultOutlier}
- </if>
- <if test="insertUsername != null and insertUsername != ''">
- and INSERT_USERNAME LIKE '%${insertUsername}%'
- </if>
- <if test="insertTime != null">
- and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
- </if>
- <if test="updateUsername != null and updateUsername != ''">
- and UPDATE_USERNAME LIKE '%${updateUsername}%'
- </if>
- <if test="updateTime != null">
- and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
- </if>
- <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
- and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
- </if>
- </where>
- </sql>
- <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
- delete from TMSTRUCK_TOTAL_RESULT
- where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
- </delete>
- <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
- delete from TMSTRUCK_TOTAL_RESULT
- where 1!=1
- <if test="orderId != null">
- or ORDER_ID = #{orderId}
- </if>
- <if test="resultDuration != null">
- or RESULT_DURATION = #{resultDuration}
- </if>
- <if test="standardDataId != null">
- or STANDARD_DATA_ID = #{standardDataId}
- </if>
- <if test="resultOutlier != null">
- or RESULT_OUTLIER = #{resultOutlier}
- </if>
- <if test="insertUsername != null and insertUsername != ''">
- or INSERT_USERNAME = #{insertUsername}
- </if>
- <if test="insertTime != null">
- or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
- </if>
- <if test="updateUsername != null and updateUsername != ''">
- or UPDATE_USERNAME = #{updateUsername}
- </if>
- <if test="updateTime != null">
- or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
- </if>
- <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
- or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
- </if>
- </delete>
- <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
- insert into TMSTRUCK_TOTAL_RESULT (RESULT_TOTAL_ID, ORDER_ID, RESULT_DURATION,
- STANDARD_DATA_ID, RESULT_OUTLIER, INSERT_USERNAME,
- INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
- INSERT_UPDATE_REMARK)
- values (#{resultTotalId,jdbcType=DECIMAL}, #{orderId,jdbcType=DECIMAL}, #{resultDuration,jdbcType=DECIMAL},
- #{standardDataId,jdbcType=DECIMAL}, #{resultOutlier,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR},
- #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
- #{insertUpdateRemark,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
- insert into TMSTRUCK_TOTAL_RESULT
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="resultTotalId != null">
- RESULT_TOTAL_ID,
- </if>
- <if test="orderId != null">
- ORDER_ID,
- </if>
- <if test="resultDuration != null">
- RESULT_DURATION,
- </if>
- <if test="standardDataId != null">
- STANDARD_DATA_ID,
- </if>
- <if test="resultOutlier != null">
- RESULT_OUTLIER,
- </if>
- <if test="insertUsername != null">
- INSERT_USERNAME,
- </if>
- <if test="insertTime != null">
- INSERT_TIME,
- </if>
- <if test="updateUsername != null">
- UPDATE_USERNAME,
- </if>
- <if test="updateTime != null">
- UPDATE_TIME,
- </if>
- <if test="insertUpdateRemark != null">
- INSERT_UPDATE_REMARK,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="resultTotalId != null">
- #{resultTotalId,jdbcType=DECIMAL},
- </if>
- <if test="orderId != null">
- #{orderId,jdbcType=DECIMAL},
- </if>
- <if test="resultDuration != null">
- #{resultDuration,jdbcType=DECIMAL},
- </if>
- <if test="standardDataId != null">
- #{standardDataId,jdbcType=DECIMAL},
- </if>
- <if test="resultOutlier != null">
- #{resultOutlier,jdbcType=DECIMAL},
- </if>
- <if test="insertUsername != null">
- #{insertUsername,jdbcType=VARCHAR},
- </if>
- <if test="insertTime != null">
- #{insertTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateUsername != null">
- #{updateUsername,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="insertUpdateRemark != null">
- #{insertUpdateRemark,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
- update TMSTRUCK_TOTAL_RESULT
- set ORDER_ID = #{orderId,jdbcType=DECIMAL},
- RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
- STANDARD_DATA_ID = #{standardDataId,jdbcType=DECIMAL},
- RESULT_OUTLIER = #{resultOutlier,jdbcType=DECIMAL},
- INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
- INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
- UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
- UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
- INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
- where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
- update TMSTRUCK_TOTAL_RESULT
- <set>
- <if test="orderId != null">
- ORDER_ID = #{orderId,jdbcType=DECIMAL},
- </if>
- <if test="resultDuration != null">
- RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
- </if>
- <if test="standardDataId != null">
- STANDARD_DATA_ID = #{standardDataId,jdbcType=DECIMAL},
- </if>
- <if test="resultOutlier != null">
- RESULT_OUTLIER = #{resultOutlier,jdbcType=DECIMAL},
- </if>
- <if test="insertUsername != null">
- INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
- </if>
- <if test="insertTime != null">
- INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateUsername != null">
- UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="insertUpdateRemark != null">
- INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
- </if>
- </set>
- where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
- </update>
- <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
- <include refid="select" />
- where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
- </select>
- <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select" />
- <include refid="where" />
- </select>
- <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select" />
- <include refid="whereLike" />
- </select>
- <insert id="batchInsert" parameterType="java.util.List">
- insert into TMSTRUCK_TOTAL_RESULT
- (RESULT_TOTAL_ID,
- ORDER_ID, RESULT_DURATION, STANDARD_DATA_ID,
- RESULT_OUTLIER, INSERT_USERNAME,
- INSERT_TIME, UPDATE_USERNAME,
- UPDATE_TIME, INSERT_UPDATE_REMARK
- )
- ( <foreach collection="list" item="item" separator="union all">
- select
- #{item.resultTotalId,jdbcType=DECIMAL},
- #{item.orderId,jdbcType=DECIMAL}, #{item.resultDuration,jdbcType=DECIMAL}, #{item.standardDataId,jdbcType=DECIMAL},
- #{item.resultOutlier,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
- #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
- #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR}
- from dual
- </foreach> )
- </insert>
- <update id="batchUpdate" parameterType="java.util.List">
- update TMSTRUCK_TOTAL_RESULT
- set
- RESULT_TOTAL_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
- </foreach>
- ,ORDER_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.orderId,jdbcType=DECIMAL}
- </foreach>
- ,RESULT_DURATION=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.resultDuration,jdbcType=DECIMAL}
- </foreach>
- ,STANDARD_DATA_ID=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.standardDataId,jdbcType=DECIMAL}
- </foreach>
- ,RESULT_OUTLIER=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.resultOutlier,jdbcType=DECIMAL}
- </foreach>
- ,INSERT_USERNAME=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
- </foreach>
- ,INSERT_TIME=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
- </foreach>
- ,UPDATE_USERNAME=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
- </foreach>
- ,UPDATE_TIME=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
- </foreach>
- ,INSERT_UPDATE_REMARK=
- <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
- when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
- </foreach>
- where RESULT_TOTAL_ID in
- <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
- #{item.resultTotalId,jdbcType=DECIMAL}
- </foreach>
- </update>
- <delete id="batchDelete" parameterType="java.util.List">
- delete from TMSTRUCK_TOTAL_RESULT
- where RESULT_TOTAL_ID in
- <foreach close=")" collection="list" item="id" open="(" separator=",">
- #{id}
- </foreach>
- </delete>
- <!-- 友情提示!!!-->
- <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
- <!-- 查询计数实绩 -->
- <select id="selectCountList" resultType="java.util.Map" parameterType="java.lang.String">
- SELECT *
- FROM (
- SELECT RM.MATERIAL_NAME "materialName",
- OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- RW1.WAREHOUSE_NAME "warehouseName1",
- RW2.WAREHOUSE_NAME "warehouseName2",
- RCT.CAPACITY_TYPE_NAME "capacityTypeName",
- RS.SHIPPER_NAME "shipperName",
- AIR.REQUIREMENT_WORK_CONTENT "requirmentWorkContent",
- AIR.INSERT_TIME "insertTime",
- (
- select TWR.RESULT_NET_WEIGHT
- from TMSTRUCK_WEIGHT_RESULT TWR
- where TWR.RESULT_TOTAL_ID=TWR2.RESULT_TOTAL_ID
- and TWR.RESULT_NET_WEIGHT is not null
- )
- "netweight"
- FROM AMSTRUCK_INWARD_PLAN AIP
- LEFT JOIN OMSTRUCK_ORDER OO
- ON OO.ORDER_PLAN_ID = AIP.PLAN_ID
- LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
- ON ARP.PLAN_ID=AIP.PLAN_ID
- LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
- ON AIR.REQUIREMENT_ID=ARP.REQUIREMENT_ID
- LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
- ON OO.ORDER_ID = OOM.ORDER_ID
- LEFT JOIN AMSTRUCK_REQUIREMENT_MATERIAL ARM
- ON ARM.REQUIREMENT_ID=AIR.REQUIREMENT_ID
- LEFT JOIN RMS_MATERIAL RM
- ON RM.MATERIAL_ID = OOM.MATERIAL_ID
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
- ON TTR.ORDER_ID = OO.ORDER_ID
- LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR2
- ON TTR.RESULT_TOTAL_ID = TWR2.RESULT_TOTAL_ID
- LEFT JOIN RMS_WAREHOUSE RW1
- ON ARM.REQUIREMENT_PLATFORM_ID = RW1.WAREHOUSE_ID
- LEFT JOIN RMS_WAREHOUSE RW2
- ON ARM.REQUIREMENT_UNLOAD_UNIT_ID = RW2.WAREHOUSE_ID
- LEFT JOIN RMS_CAPACITY RC
- ON OO.CAPACITY_ID = RC.CAPACITY_ID
- LEFT JOIN RMS_CAPACITY_TYPE RCT
- ON RCT.CAPACITY_TYPE_ID = RC.CAPACITY_TYPE_ID
- LEFT JOIN RMS_SHIPPER RS
- ON AIR.REQUIREMENT_SHIPPER_ID = RS.SHIPPER_ID
- WHERE AIR.REQUIREMENT_TYPE = '计次' and OO.ORDER_STATUS = 2
- )
- <where>
- <if test="materialName != null">
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="orderNumber != null">
- and
- <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="warehouseName1 != null">
- and
- <foreach collection="warehouseName1" item="item" open="(" separator="or" close=")">
- "warehouseName1" like '%${item}%'
- </foreach>
- </if>
- <if test="warehouseName2 != null">
- and
- <foreach collection="warehouseName2" item="item" open="(" separator="or" close=")">
- "warehouseName2" like '%${item}%'
- </foreach>
- </if>
- <if test="driverName != null">
- and
- <foreach collection="driverName" item="item" open="(" separator="or" close=")">
- "driverName" like '%${item}%'
- </foreach>
- </if>
- <if test="capacityTypeName != null">
- and
- <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
- "capacityTypeName" like '%${item}%'
- </foreach>
- </if>
- <if test="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="requirmentWorkContent != null">
- and
- <foreach collection="requirmentWorkContent" item="item" open="(" separator="or" close=")">
- "requirmentWorkContent" like '%${item}%'
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- <if test="orderField == null ">
- order by "insertTime" desc
- </if>
- </select>
- <!-- 查询所有的包月作业实绩 -->
- <select id="getTmstruckMonthResult" parameterType="java.util.Map" resultType="java.util.Map">
- select * from tmstruck_total_result ttr
- left join omstruck_order oo on ttr.order_id = oo.order_id
- left join amstruck_inward_plan aip on oo.order_plan_id = aip.plan_id
- left join amstruck_requirement_plan arp on aip.plan_id = arp.plan_id
- left join amstruck_inward_requirement air on arp.requirement_plan_id = air.requirement_id
- where oo.order_type = 11 and air.requirement_type = '包月'
- </select>
- <select id="getAllReverseResult" resultType="java.util.Map">
- SELECT * FROM (
- SELECT
- OO.ORDER_NUMBER "orderNumber",
- RC.CAPACITY_NUMBER "capacityNumber",
- RM.MATERIAL_NAME "materialName",
- CONCAT(CONCAT(RM.MATERIAL_MODEL, '('), CONCAT(MATERIAL_SPECIFICATION, ')')) "materialMC",
- OOM.ORDER_MATERIAL_NUMBER "materialNumber",
- SUM(RMS.MATERIAL_THEORETICAL_WEIGHT)/1000 || '吨' "weight",
- RS.SHIPPER_NAME "shipperName",
- RW1.WAREHOUSE_NAME "loadName",
- RW.WAREHOUSE_NAME "unloadName",
- TLR.RESULT_LOAD_START_TIME "loadStartTime",
- TLR.RESULT_LOAD_END_TIME "loadEndTime",
- TUR.RESULT_START_TIME "unloadStartTime",
- TUR.RESULT_END_TIME"unloadEndTime"
- from OMSTRUCK_ORDER OO
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON OO.ORDER_ID=TTR.ORDER_ID
- LEFT JOIN TMSTRUCK_LOAD_RESULT TLR ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR ON TUR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
- LEFT JOIN WMSP_OUTBOUND_RESULT WOR ON WOR.BILL_LADING_ID=OO.ORDER_ID
- LEFT JOIN WMSP_OUTBOUND_SCAN_RESULT WOSR ON WOSR.OUTBOUND_RESULT_ID=WOR.RESULT_ID
- LEFT JOIN WMSP_INBOUND_SCAN_RESULT WISR ON WOSR.INBOUND_RESULT_ID=WISR.INBOUND_RESULT_ID
- LEFT JOIN RMS_MATERIAL_STEEL RMS ON RMS.MATERIAL_STEEL_ID=WISR.MATERIAL_ID
- LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OOM.ORDER_ID=OO.ORDER_ID
- LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID=RMS.MATERIAL_ID
- LEFT JOIN RMS_CAPACITY RC ON RC.CAPACITY_ID=OO.CAPACITY_ID
- LEFT JOIN AMSTRUCK_INWARD_PLAN AIP ON OO.ORDER_PLAN_ID = AIP.PLAN_ID
- LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP ON ARP.PLAN_ID = AIP.PLAN_ID
- LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR ON AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
- LEFT JOIN RMS_SHIPPER RS ON RS.SHIPPER_ID = AIR.REQUIREMENT_SHIPPER_ID
- LEFT JOIN AMSTRUCK_REQUIREMENT_MATERIAL ARM ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
- LEFT JOIN RMS_WAREHOUSE RW ON RW.WAREHOUSE_ID = ARM.REQUIREMENT_UNLOAD_UNIT_ID
- LEFT JOIN RMS_WAREHOUSE RW1 ON RW1.WAREHOUSE_ID = ARM.REQUIREMENT_PLATFORM_ID
- WHERE OO.ORDER_TYPE=25 AND OO.ORDER_STATUS=2
- <if test="oneDate != null">
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TUR.RESULT_END_TIME
- </if>
- <if test="startDate != null">
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TUR.RESULT_END_TIME
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TUR.RESULT_END_TIME
- </if>
- GROUP BY OO.ORDER_NUMBER,RC.CAPACITY_NUMBER,OOM.ORDER_MATERIAL_NUMBER,RM.MATERIAL_NAME,RM.MATERIAL_MODEL,MATERIAL_SPECIFICATION,RW1.WAREHOUSE_NAME,RW.WAREHOUSE_NAME,RS.SHIPPER_NAME,TLR.RESULT_LOAD_START_TIME,
- TLR.RESULT_LOAD_END_TIME,TUR.RESULT_START_TIME,TUR.RESULT_END_TIME
- ORDER BY TUR.RESULT_END_TIME DESC
- )
- <where>
- <if test="orderNumber != null">
- and
- <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="shipperName != null">
- and
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialName != null">
- <foreach collection="materialName" item="item" open="(" separator="or" close=")">
- "materialName" like '%${item}%'
- </foreach>
- </if>
- <if test="materialMC != null">
- <foreach collection="materialMC" item="item" open="(" separator="or" close=")">
- "materialMC" like '%${item}%'
- </foreach>
- </if>
- <if test="materialNumber != null">
- <foreach collection="materialNumber" item="item" open="(" separator="or" close=")">
- "materialNumber" = #{item}
- </foreach>
- </if>
- <if test="weight != null">
- <foreach collection="weight" item="item" open="(" separator="or" close=")">
- "weight" = #{item}
- </foreach>
- </if>
- <if test="shipperName != null">
- <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
- "shipperName" like '%${item}%'
- </foreach>
- </if>
- <if test="loadName != null">
- <foreach collection="loadName" item="item" open="(" separator="or" close=")">
- "loadName" like '%${item}%'
- </foreach>
- </if>
- <if test="unloadName != null">
- <foreach collection="unloadName" item="item" open="(" separator="or" close=")">
- "unloadName" like '%${item}%'
- </foreach>
- </if>
- <if test="loadStartTime != null">
- <foreach collection="loadStartTime" item="item" open="(" separator="or" close=")">
- "loadStartTime" = #{item}
- </foreach>
- </if>
- <if test="unloadStartTime != null">
- <foreach collection="unloadStartTime" item="item" open="(" separator="or" close=")">
- "unloadStartTime" = #{item}
- </foreach>
- </if>
- <if test="loadEndTime != null">
- <foreach collection="loadEndTime" item="item" open="(" separator="or" close=")">
- "loadEndTime" = #{item}
- </foreach>
- </if>
- <if test="unloadEndTime != null">
- <foreach collection="unloadEndTime" item="item" open="(" separator="or" close=")">
- "unloadEndTime" = #{item}
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <sql id="orderBy">
- <if test="orderField != null and orderField != ''">
- order by "${orderField}"
- <if test="orderType != null and orderType != ''">
- ${orderType}
- </if>
- </if>
- </sql>
- <select id="getOrderForBulu" resultType="java.math.BigDecimal">
- SELECT OO .ORDER_ID FROM OMSTRUCK_ORDER OO
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR .ORDER_ID = OO .ORDER_ID
- WHERE TTR .RESULT_TOTAL_ID IS NULL and ORDER_STATUS=5
- </select>
- <select id="getLineId" resultType="java.util.Map">
- SELECT
- TTR.RESULT_TOTAL_ID "resultTotalId",
- OO.LINE_ID "lineId",
- OO.ORDER_STATUS "orderStatus"
- FROM OMSTRUCK_ORDER OO
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR .ORDER_ID = OO .ORDER_ID
- WHERE OO.ORDER_ID = #{orderId} AND OO.ORDER_STATUS IN (4,5) AND OO.ORDER_TYPE=5
- </select>
- <select id="getLineMesByOrderId" resultType="java.util.Map">
- select RLS.SEGMENT_SQE "segmentSqe",
- RLS.SEGMENT_START_NODE_ID "type",
- RL.LINK_NAME "linkName",
- RLI.LINE_TYPE "lineType"
- from RMS_LINE_SEGEMNT RLS
- left join RMS_LINK RL
- on RL.LINK_ID = RLS.SEGMENT_START_NODE_ID
- left join RMS_LINE RLI
- ON RLI.LINE_ID = RLS.LINE_ID
- where RLS.LINE_ID = #{lineId}
- AND RLS.DELETED = 0
- order by "segmentSqe"
- </select>
- <update id="updateLineId">
- UPDATE OMSTRUCK_ORDER
- SET LINE_ID=#{lineId}
- <if test="orderStatus!=null">
- ,ORDER_STATUS=#{orderStatus}
- </if>
- WHERE ORDER_ID=#{orderId}
- </update>
- <select id="selectAllEnfactory" resultType="com.steerinfo.dil.model.TmstruckEnfactoryResult">
- SELECT RESULT_ID "resultId",
- RESULT_TOTAL_ID "resultTotalId",
- TMSTRUCK_ENFACTORY_RESULT.GATEPOST_ID "gatepostId",
- RESULT_ENTRY_MODE "resultEntryMode",
- RESULT_ENTRY_GATE_TIME "resultEntryGateTime"
- FROM TMSTRUCK_ENFACTORY_RESULT
- WHERE RESULT_TOTAL_ID=#{resultTotalId}
- <if test="flag==null || flag==1">
- AND RESULT_ENTRY_GATE_TIME IS NOT NULL
- </if>
- </select>
- <select id="selectAllWeight" resultType="com.steerinfo.dil.model.TmstruckWeightResult">
- SELECT TMSTRUCK_WEIGHT_RESULT.WEIGHT_TASK_RESULT_ID "weightTaskResultId",
- TMSTRUCK_WEIGHT_RESULT.RESULT_TOTAL_ID "resultTotalId",
- TMSTRUCK_WEIGHT_RESULT.RESULT_POUND_NO "resultPoundNo",
- TMSTRUCK_WEIGHT_RESULT.RESULT_GROSS_WEIGHT "resultGrossWeight",
- TMSTRUCK_WEIGHT_RESULT.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
- TMSTRUCK_WEIGHT_RESULT.RESULT_TARE_WEIGHT "resultTareWeight",
- TMSTRUCK_WEIGHT_RESULT.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
- TMSTRUCK_WEIGHT_RESULT.RESULT_NET_WEIGHT "resultNetWeight",
- TMSTRUCK_WEIGHT_RESULT.RESULT_GROSS_PLACE_ID "resultGrossPlaceId",
- TMSTRUCK_WEIGHT_RESULT.RESULT_TARE_PLACE_ID "resultTarePlaceId",
- TMSTRUCK_WEIGHT_RESULT.MATERIAL_ID "materialId"
- FROM TMSTRUCK_WEIGHT_RESULT
- WHERE RESULT_TOTAL_ID=#{resultTotalId}
- <if test="flag==null || flag==1">
- AND (RESULT_TARE_WEIGHT_TIME IS NOT NULL OR RESULT_GROSS_WEIGHT_TIME IS NOT NULL)
- </if>
- </select>
- <select id="selectAllLoad" resultType="com.steerinfo.dil.model.TmstruckLoadResult">
- SELECT *
- FROM TMSTRUCK_LOAD_RESULT
- WHERE RESULT_TOTAL_ID=#{resultTotalId}
- <if test="flag==null || flag==1">
- AND RESULT_LOAD_END_TIME IS NOT NULL
- </if>
- </select>
- <select id="selectAllUnload" resultType="com.steerinfo.dil.model.TmstruckUnloadResult">
- SELECT
- TMSTRUCK_UNLOAD_RESULT.RESULT_ID "resultId",
- TMSTRUCK_UNLOAD_RESULT.RESULT_TOTAL_ID "resultTotalId",
- TMSTRUCK_UNLOAD_RESULT.RESULT_START_TIME "resultStartTime",
- TMSTRUCK_UNLOAD_RESULT.RESULT_END_TIME "resultEndTime"
- FROM TMSTRUCK_UNLOAD_RESULT
- WHERE RESULT_TOTAL_ID=#{resultTotalId}
- <if test="flag==null || flag==1">
- AND RESULT_END_TIME IS NOT NULL
- </if>
- </select>
- <select id="selectAllLeavefactory" resultType="com.steerinfo.dil.model.TmstruckLeaveFactoryResult">
- SELECT
- TMSTRUCK_LEAVE_FACTORY_RESULT.RESULT_ID "resultId",
- TMSTRUCK_LEAVE_FACTORY_RESULT.RESULT_TOTAL_ID "resultTotalId",
- TMSTRUCK_LEAVE_FACTORY_RESULT.GATEPOST_ID "gatepostId",
- TMSTRUCK_LEAVE_FACTORY_RESULT.RESULT_OUT_MODE "resultOutMode",
- TMSTRUCK_LEAVE_FACTORY_RESULT.RESULT_OUT_GATE_TIME "resultOutGateTime"
- FROM TMSTRUCK_LEAVE_FACTORY_RESULT
- WHERE RESULT_TOTAL_ID=#{resultTotalId}
- <if test="flag==null || flag==1">
- AND RESULT_OUT_GATE_TIME IS NOT NULL
- </if>
- </select>
- <delete id="deleteEnByEnTotal">
- DELETE FROM TMSTRUCK_ENFACTORY_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
- </delete>
- <delete id="deleteWeightByEnTotal">
- DELETE FROM TMSTRUCK_WEIGHT_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
- </delete>
- <delete id="deleteUnloadByEnTotal">
- DELETE FROM TMSTRUCK_UNLOAD_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
- </delete>
- <delete id="deleteLeaveByEnTotal">
- DELETE FROM TMSTRUCK_LEAVE_FACTORY_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
- </delete>
- </mapper>
|