txf 3 rokov pred
rodič
commit
01aa58a46e
22 zmenil súbory, kde vykonal 2539 pridanie a 1245 odobranie
  1. 5 5
      pom.xml
  2. 3 52
      src/main/java/com/steerinfo/dil/controller/TmstrainLoadingResultController.java
  3. 20 12
      src/main/java/com/steerinfo/dil/controller/TmstrainPleaseApproveResultController.java
  4. 9 43
      src/main/java/com/steerinfo/dil/controller/TmstrainWagonUnloadResultController.java
  5. 10 0
      src/main/java/com/steerinfo/dil/mapper/TmstrainLoadingResultMapper.java
  6. 1 1
      src/main/java/com/steerinfo/dil/mapper/TmstrainPleaseApproveResultMapper.java
  7. 17 0
      src/main/java/com/steerinfo/dil/mapper/TmstrainTotalResultMapper.java
  8. 21 0
      src/main/java/com/steerinfo/dil/mapper/TmstrainTruckTotalResultMapper.java
  9. 18 2
      src/main/java/com/steerinfo/dil/mapper/TmstrainWagonUnloadResultMapper.java
  10. 199 0
      src/main/java/com/steerinfo/dil/model/TmstrainTotalResult.java
  11. 184 0
      src/main/java/com/steerinfo/dil/model/TmstrainTruckTotalResult.java
  12. 12 1
      src/main/java/com/steerinfo/dil/service/ITmstrainLoadingResultService.java
  13. 2 2
      src/main/java/com/steerinfo/dil/service/ITmstrainPleaseApproveResultService.java
  14. 1 1
      src/main/java/com/steerinfo/dil/service/ITmstrainWagonUnloadResultService.java
  15. 115 48
      src/main/java/com/steerinfo/dil/service/impl/TmstrainLoadingResultServiceImpl.java
  16. 20 39
      src/main/java/com/steerinfo/dil/service/impl/TmstrainPleaseApproveResultServiceImpl.java
  17. 67 19
      src/main/java/com/steerinfo/dil/service/impl/TmstrainWagonUnloadResultServiceImpl.java
  18. 57 31
      src/main/resources/com/steerinfo/dil/mapper/TmstrainLoadingResultMapper.xml
  19. 900 872
      src/main/resources/com/steerinfo/dil/mapper/TmstrainPleaseApproveResultMapper.xml
  20. 380 0
      src/main/resources/com/steerinfo/dil/mapper/TmstrainTotalResultMapper.xml
  21. 356 0
      src/main/resources/com/steerinfo/dil/mapper/TmstrainTruckTotalResultMapper.xml
  22. 142 117
      src/main/resources/com/steerinfo/dil/mapper/TmstrainWagonUnloadResultMapper.xml

+ 5 - 5
pom.xml

@@ -105,14 +105,14 @@
                 <artifactId>generator-maven-plugin</artifactId>
                 <version>3.0</version>
                 <configuration>
-                    <connUrl>jdbc:oracle:thin:@192.168.1.51:1521:steerinfo</connUrl>
-                    <user>dilusr</user>
-                    <password>stinf#0420</password>
+                    <connUrl>jdbc:oracle:thin:@172.16.33.163:1521:ilsdbpri</connUrl>
+                    <user>dil</user>
+                    <password>Dil123789</password>
                     <!--包名-->
                     <targetPackage>com.steerinfo.dil</targetPackage>
                     <tables>
-<!--                                                <table>AMS_PURCHASE_ORDER</table>&lt;!&ndash;采购订单&ndash;&gt;-->
-<!--                                                <table>TMSTRAIN_PLEASE_APPROVE_RESULT</table>&lt;!&ndash;请车作业&ndash;&gt;-->
+<!--                                                <table>TMSTRAIN_TOTAL_RESULT</table>&lt;!&ndash;采购订单&ndash;&gt;-->
+                                                <table>TMSTRAIN_TRUCK_TOTAL_RESULT</table><!--请车作业-->
 <!--                                                <table>TMSTRAIN_WAGON_LOAD_RESULT</table>&lt;!&ndash;车皮装车作业&ndash;&gt;-->
 <!--                                                <table>TMSTRAIN_LOADING_RESULT</table>&lt;!&ndash;车皮装车作业&ndash;&gt;-->
 <!--                                                <table>TMSTRAIN_WAGON_UNLOAD_RESULT</table>&lt;!&ndash;车皮卸车作业&ndash;&gt;-->

+ 3 - 52
src/main/java/com/steerinfo/dil/controller/TmstrainLoadingResultController.java

@@ -230,9 +230,9 @@ public class TmstrainLoadingResultController extends BaseRESTfulController {
 
     //内转物流新增装车
     @ApiOperation(value = "内转物流新增装车")
-    @GetMapping(value = "/addTrainLoadResultForConverted")
-    public RESTfulResult addTrainLoadResultForConverted(TmstrainLoadingResult tmstrainLoadingResult) {
-        return success(tmstrainLoadingResultService.addTrainLoadResultForConverted(tmstrainLoadingResult));
+    @PostMapping(value = "/addTrainLoadResultForConverted")
+    public RESTfulResult addTrainLoadResultForConverted(@RequestBody(required = false) Map<String, Object> map) {
+        return success(tmstrainLoadingResultService.addTrainLoadResultForConverted(map));
     }
 
     /**
@@ -251,53 +251,4 @@ public class TmstrainLoadingResultController extends BaseRESTfulController {
         System.out.println(loadingResultByResultId);
         return success(loadingResultByResultId);
     }
-
-    /**
-     * 内转展示车皮装车实绩
-     */
-
-    @ApiOperation(value = "查询装车作业信息")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "apiId(203)", value = "表头", required = false, dataType = "Interger")
-    })
-    @PostMapping("/getTmstrainWagonLoadForConverted")
-    public RESTfulResult getTmstrainWagonLoadForConverted(@RequestBody(required = false) Map<String, Object> mapValue,
-                                                          Integer apiId,
-                                                          Integer pageNum,
-                                                          Integer pageSize,
-                                                          String con) {
-        if (con != null) {
-            if (!"undefined".equals(con)) {
-                //设置要查询的索引名称
-                String index = "get_wagon_load_converted";
-                //获取查询结果
-                return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
-            }
-        }
-        //初始化过滤
-        List<Map<String, Object>> wagonLoadForConverted = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if (mapValue.size() == 0) {
-            //将查询结果存入索引中
-            wagonLoadForConverted = tmstrainLoadingResultService.selectLoadedForConverted(null);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index", "get_wagon_load_converted");
-            //添加id
-            map.put("indexId", "result2");
-            wagonLoadForConverted.add(map);
-            //新建索引
-            String s = JSON.toJSONString(wagonLoadForConverted);
-            esFeign.insertIndex(wagonLoadForConverted);
-            //删除
-            wagonLoadForConverted.remove(wagonLoadForConverted.size() - 1);
-        }
-        if (wagonLoadForConverted == null) {
-            wagonLoadForConverted = tmstrainLoadingResultService.selectLoadedForConverted(mapValue);
-        }
-        PageHelper.startPage(pageNum, pageSize);
-        List<Map<String, Object>> tmstrainWagonLoad1 = tmstrainLoadingResultService.selectLoadedForConverted(mapValue);
-        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, wagonLoadForConverted, tmstrainWagonLoad1);
-        return success(pageList);
-    }
 }

+ 20 - 12
src/main/java/com/steerinfo/dil/controller/TmstrainPleaseApproveResultController.java

@@ -65,7 +65,15 @@ public class TmstrainPleaseApproveResultController extends BaseRESTfulController
                                            Integer pageSize,
                                            Integer status,
                                            Integer resultType,
+                                           Integer resultId,
                                            String con) {
+        int count = 2;
+        mapValue.put("resultType", resultType);
+        mapValue.put("status", status);
+        if(resultId != null){
+            mapValue.put("resultId", resultId);
+            count++;
+        }
         if (con != null) {
             if (!"undefined".equals(con)) {
                 //设置要查询的索引名称
@@ -76,13 +84,10 @@ public class TmstrainPleaseApproveResultController extends BaseRESTfulController
         }
         //初始化过滤
         List<Map<String, Object>> wagonPleaseList = null;
-        mapValue.put("resultType", resultType);
-        mapValue.put("status", status);
         //如果有条件查询则跳过初始化,和创建索引
-        if (mapValue.size() == 2) {
+        if (mapValue.size() == count) {
             //将查询结果存入索引中
             wagonPleaseList = tmstrainPleaseApproveResultService.getAllWagonPlease(mapValue);
-            DataChange.changeDateToDayDate(wagonPleaseList, "resultPleaseDate", "resultPlanDate");
             Map<String, Object> map = new HashMap<>();
             //添加索引
             map.put("index", "get_all_wagon_please");
@@ -100,7 +105,6 @@ public class TmstrainPleaseApproveResultController extends BaseRESTfulController
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
         List<Map<String, Object>> wagonPlease = tmstrainPleaseApproveResultService.getAllWagonPlease(mapValue);
-        DataChange.changeDateToDayDate(wagonPlease, "resultPleaseDate", "resultPlanDate");
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId, wagonPleaseList, wagonPlease);
         return success(pageList);
     }
@@ -208,8 +212,15 @@ public class TmstrainPleaseApproveResultController extends BaseRESTfulController
                                                   Integer apiId,
                                                   Integer pageNum,
                                                   Integer pageSize,
+                                                  Integer status,
                                                   Integer resultType,
                                                   String con) {
+        int count = 1;
+        mapValue.put("resultType", resultType);
+        if(status != null){
+            mapValue.put("status", status);
+            count++;
+        }
         if (con != null) {
             if (!"undefined".equals(con)) {
                 //设置要查询的索引名称
@@ -220,12 +231,10 @@ public class TmstrainPleaseApproveResultController extends BaseRESTfulController
         }
         //初始化过滤
         List<Map<String, Object>> approveWagonPleaseList = null;
-        mapValue.put("resultType", resultType);
         //如果有条件查询则跳过初始化,和创建索引
-        if (mapValue.size() == 1 ) {
+        if (mapValue.size() == count ) {
             //将查询结果存入索引中
             approveWagonPleaseList = tmstrainPleaseApproveResultService.getAllApproveWagonPlease(mapValue);
-            DataChange.changeDateToDayDate(approveWagonPleaseList, "resultApproveDate");
             Map<String, Object> map = new HashMap<>();
             //添加索引
             map.put("index", "get_approve_wagon_please");
@@ -243,7 +252,6 @@ public class TmstrainPleaseApproveResultController extends BaseRESTfulController
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
         List<Map<String, Object>> wagonPlease = tmstrainPleaseApproveResultService.getAllApproveWagonPlease(mapValue);
-        DataChange.changeDateToDayDate(wagonPlease, "resultApproveDate");
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId, approveWagonPleaseList, wagonPlease);
         return success(pageList);
     }
@@ -304,9 +312,9 @@ public class TmstrainPleaseApproveResultController extends BaseRESTfulController
     @ApiImplicitParams({
             @ApiImplicitParam(name = "amstrainWagonPlease", value = "请车作业对象", required = false, dataType = "AmstrainWagonPlease"),
     })
-    @PostMapping("/addWagonApprove")
-    public RESTfulResult addWagonApprove(@RequestBody Map<String, Object> map) {
-        int i = tmstrainPleaseApproveResultService.addPleaseApprove(map);
+    @PostMapping("/addWagonPleaseForNZ")
+    public RESTfulResult addPleaseForNZ(@RequestBody Map<String, Object> map) {
+        int i = tmstrainPleaseApproveResultService.addPleaseForNZ(map);
         return success(i);
     }
 

+ 9 - 43
src/main/java/com/steerinfo/dil/controller/TmstrainWagonUnloadResultController.java

@@ -129,8 +129,8 @@ public class TmstrainWagonUnloadResultController extends BaseRESTfulController {
     })
     @PostMapping(value = "/insertTmstrainWagonUnLoadResult")
     public RESTfulResult insertTmstrainWagonUnLoadResult(@RequestBody(required = false) TmstrainWagonUnloadResult tmstrainWagonUnloadResult, Integer orderType) {
-        tmstrainWagonUnloadResultService.insertTmstrainWagonUnLoadResult(tmstrainWagonUnloadResult);
-        return success();
+        int i = tmstrainWagonUnloadResultService.insertTmstrainWagonUnLoadResult(tmstrainWagonUnloadResult);
+        return success(i);
     }
 
     /**
@@ -240,51 +240,17 @@ public class TmstrainWagonUnloadResultController extends BaseRESTfulController {
         return success(mes);
     }
 
-    //********内转物流展示卸车实绩**************************************
-    @ApiOperation(value = "查询卸车作业信息")
+    //********内转实绩**************************************
+    @ApiOperation(value = "内转新增卸车实绩")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "apiId(201)", value = "表头", required = false, dataType = "Interger")
     })
-    @PostMapping("/selectWagonUnLoadResultForConverted")
-    public RESTfulResult selectWagonUnLoadResultForConverted(@RequestBody(required = false) Map<String, Object> mapValue,
-                                                             Integer apiId,
-                                                             Integer pageNum,
-                                                             Integer pageSize,
-                                                             String con) {
-        if (con != null) {
-            if (!"undefined".equals(con)) {
-                //设置要查询的索引名称
-                String index = "wagon_unload_result";
-                //获取查询结果
-                return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
-            }
-        }
-        //初始化过滤
-        List<Map<String, Object>> wagonUnLoadResult = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if (mapValue.size() == 0) {
-            //将查询结果存入索引中
-            wagonUnLoadResult = tmstrainWagonUnloadResultService.selectWagonUnLoadResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index", "wagon_unload_result");
-            //添加id
-            map.put("indexId", "trainUnloadId");
-            wagonUnLoadResult.add(map);
-            //新建索引
-            esFeign.insertIndex(wagonUnLoadResult);
-            //删除
-            wagonUnLoadResult.remove(wagonUnLoadResult.size() - 1);
-        }
-        if (wagonUnLoadResult == null) {
-            wagonUnLoadResult = tmstrainWagonUnloadResultService.selectWagonUnLoadResult(mapValue);
-        }
-        PageHelper.startPage(pageNum, pageSize);
-        List<Map<String, Object>> tmstrainWagonUnLoad1 = tmstrainWagonUnloadResultService.selectWagonUnLoadResult(mapValue);
-        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, wagonUnLoadResult, tmstrainWagonUnLoad1);
-        return success(pageList);
+    @PostMapping(value = "/addTmsTrainUnloadResultForNZ")
+    public RESTfulResult addTmsTrainUnloadResultForNZ(@RequestBody(required = false)Map<String, Object> map) {
+        int i = tmstrainWagonUnloadResultService.addTmsTrainUnloadResultForNZ(map);
+        return success(i);
     }
 
+
     //*********内转物流查询火车卸车实绩************************************
     @ApiOperation(value = "查询火车卸车信息")
     @ApiImplicitParams({

+ 10 - 0
src/main/java/com/steerinfo/dil/mapper/TmstrainLoadingResultMapper.java

@@ -3,6 +3,7 @@ package com.steerinfo.dil.mapper;
 import com.steerinfo.dil.model.TmstrainLoadingResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.math.BigDecimal;
@@ -41,4 +42,13 @@ public interface TmstrainLoadingResultMapper extends IBaseMapper<TmstrainLoading
     List<Map<String,Object>> selectLoadedForConverted(Map<String,Object> map);
     //内转物流通过id查询装车作业
     List<Map<String,Object>> selectLoadByResultId(BigDecimal resultId);
+
+    //通过车皮号与发运计划ID查询火车装车实绩ID
+    Integer getLoadingIdByWnoAndRailPlanId(@Param("resultWagonNo")String resultWagonNo, @Param("railPlanId")Integer railPlanId);
+
+    //拿到扫描结果匹配扫描出库中出库主键ID
+    Integer getOutBoundResultIdByScan(@Param("scanText") String scanText);
+
+    //通过出库主键ID查询订单总实绩ID
+    Map<String, Object> getResultTotalIdByOutBoundResultId(Integer outboundResultId);
 }

+ 1 - 1
src/main/java/com/steerinfo/dil/mapper/TmstrainPleaseApproveResultMapper.java

@@ -43,7 +43,7 @@ public interface TmstrainPleaseApproveResultMapper extends IBaseMapper<TmstrainP
     //根据用户id查找用户
     String selectPersonNameByPersonnelId(Integer personnelId);
 
-   //查询请车计划
+   //内转物流查询请车计划
     List<Map<String,Object>> selectPleaseApprovePlanForConverted(Map<String,Object> map);
 
     //获取发站/到站下拉框

+ 17 - 0
src/main/java/com/steerinfo/dil/mapper/TmstrainTotalResultMapper.java

@@ -0,0 +1,17 @@
+package com.steerinfo.dil.mapper;
+
+import com.steerinfo.dil.model.TmstrainTotalResult;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.math.BigDecimal;
+
+@Mapper
+public interface TmstrainTotalResultMapper extends IBaseMapper<TmstrainTotalResult, BigDecimal> {
+    @Select("select seq_train_total.nextval from dual")
+    BigDecimal selectMaxId();
+
+    //通过火运装车实绩ID查询火运总实绩ID
+    BigDecimal getTotalIdByLoadingId(Integer loadingId);
+}

+ 21 - 0
src/main/java/com/steerinfo/dil/mapper/TmstrainTruckTotalResultMapper.java

@@ -0,0 +1,21 @@
+package com.steerinfo.dil.mapper;
+
+import com.steerinfo.dil.model.TmstrainTruckTotalResult;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface TmstrainTruckTotalResultMapper extends IBaseMapper<TmstrainTruckTotalResult, BigDecimal> {
+
+    @Select("select SEQ_TMSTRAIN_LOAD_TRUCK.nextval from dual")
+    BigDecimal selectMaxId();
+
+    //通过物资ID和汽运总实绩ID和火运总实绩ID查物资中间表ID
+    Integer getIdByMateAndTruckAndTrainTotalId(Map<String, Object> map);
+
+}

+ 18 - 2
src/main/java/com/steerinfo/dil/mapper/TmstrainWagonUnloadResultMapper.java

@@ -3,6 +3,7 @@ package com.steerinfo.dil.mapper;
 import com.steerinfo.dil.model.TmstrainWagonUnloadResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.math.BigDecimal;
@@ -11,7 +12,7 @@ import java.util.Map;
 
 @Mapper
 public interface TmstrainWagonUnloadResultMapper extends IBaseMapper<TmstrainWagonUnloadResult, BigDecimal> {
-    //查询所有卸车作业信息
+    //查询采购卸车作业信息
     List<Map<String, Object>> getTmsWagonUnLoadInfo(Map<String,Object>map);
     //查询主键最大值
     @Select("select seq_tmstrian_wagon_unload.nextval from dual")
@@ -28,8 +29,23 @@ public interface TmstrainWagonUnloadResultMapper extends IBaseMapper<TmstrainWag
     List<Map<String, Object>> selectByUnLoadingId(BigDecimal unloadingId);
 
     //内转物流查询卸车实绩
-    List<Map<String,Object>> selectWagonUnLoadResult(Map<String,Object> map);
+    List<Map<String,Object>> selectWagonUnLoadResultForNZ(Map<String,Object> map);
 
     //内转物流查询火车卸货实绩
     List<Map<String,Object>> getTrainResult(Map<String,Object> map);
+
+    /**
+     * txf
+     */
+    //通过运输订单ID查询当前订单关联的装车实绩ID
+    List<Map<String, Object>> getTotalIdByOrderId(BigDecimal orderId);
+
+    //通过火运总实绩ID查询火运装车实绩ID
+    Integer getLoadingIdByTrainTotalId(BigDecimal trainTotalId);
+
+    //通过装车实绩ID查询车皮号与发运计划ID
+    Map<String, Object> getWagonNoAndRailPlanByLoadingId(Integer loadingId);
+
+    //通过车皮号与发运计划ID匹配卸车实绩
+    Integer getUnloadIdByWagonNoAndRailPlanId(@Param("resultWagonNo") String resultWagonNo, @Param("railPlanId") BigDecimal railPlanId);
 }

+ 199 - 0
src/main/java/com/steerinfo/dil/model/TmstrainTotalResult.java

@@ -0,0 +1,199 @@
+package com.steerinfo.dil.model;
+
+import com.steerinfo.framework.model.IBasePO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@ApiModel(value="火运总实绩")
+public class TmstrainTotalResult implements IBasePO<BigDecimal> {
+    /**
+     * 主键ID(TOTAL_RESULT_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="主键ID",required=true)
+    private BigDecimal totalResultId;
+
+    /**
+     * 火运装车实绩ID(LOADING_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="火运装车实绩ID",required=false)
+    private BigDecimal loadingId;
+
+    /**
+     * 火运卸车实绩ID(UNLOADING_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="火运卸车实绩ID",required=false)
+    private BigDecimal unloadingId;
+
+    /**
+     * 厂内滞留总时长=驶离时间-抵达时间(RESULT_TOTAL_STAY_DURATION,DECIMAL,0)
+     */
+    @ApiModelProperty(value="厂内滞留总时长=驶离时间-抵达时间",required=false)
+    private Short resultTotalStayDuration;
+
+    /**
+     * 运输标准时长(STANDARD_DATA_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="运输标准时长",required=true)
+    private BigDecimal standardDataId;
+
+    /**
+     * 运输时长异常值(RESULT_OUTLIER,DECIMAL,0)
+     */
+    @ApiModelProperty(value="运输时长异常值",required=false)
+    private Short resultOutlier;
+
+    /**
+     * 记录创建人(INSERT_USERNAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="记录创建人",required=false)
+    private String insertUsername;
+
+    /**
+     * 记录创建时间(INSERT_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="记录创建时间",required=false)
+    private Date insertTime;
+
+    /**
+     * 记录修改人(UPDATE_USERNAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="记录修改人",required=false)
+    private String updateUsername;
+
+    /**
+     * 记录修改时间(UPDATE_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="记录修改时间",required=false)
+    private Date updateTime;
+
+    /**
+     * 记录创建或修改备注(INSERT_UPDATE_REMARK,VARCHAR,100)
+     */
+    @ApiModelProperty(value="记录创建或修改备注",required=false)
+    private String insertUpdateRemark;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public BigDecimal getId() {
+        return this.totalResultId;
+    }
+
+    @Override
+    public void setId(BigDecimal totalResultId) {
+        this.totalResultId = totalResultId;
+    }
+
+    public BigDecimal getTotalResultId() {
+        return totalResultId;
+    }
+
+    public void setTotalResultId(BigDecimal totalResultId) {
+        this.totalResultId = totalResultId;
+    }
+
+    public BigDecimal getLoadingId() {
+        return loadingId;
+    }
+
+    public void setLoadingId(BigDecimal loadingId) {
+        this.loadingId = loadingId;
+    }
+
+    public BigDecimal getUnloadingId() {
+        return unloadingId;
+    }
+
+    public void setUnloadingId(BigDecimal unloadingId) {
+        this.unloadingId = unloadingId;
+    }
+
+    public Short getResultTotalStayDuration() {
+        return resultTotalStayDuration;
+    }
+
+    public void setResultTotalStayDuration(Short resultTotalStayDuration) {
+        this.resultTotalStayDuration = resultTotalStayDuration;
+    }
+
+    public BigDecimal getStandardDataId() {
+        return standardDataId;
+    }
+
+    public void setStandardDataId(BigDecimal standardDataId) {
+        this.standardDataId = standardDataId;
+    }
+
+    public Short getResultOutlier() {
+        return resultOutlier;
+    }
+
+    public void setResultOutlier(Short resultOutlier) {
+        this.resultOutlier = resultOutlier;
+    }
+
+    public String getInsertUsername() {
+        return insertUsername;
+    }
+
+    public void setInsertUsername(String insertUsername) {
+        this.insertUsername = insertUsername == null ? null : insertUsername.trim();
+    }
+
+    public Date getInsertTime() {
+        return insertTime;
+    }
+
+    public void setInsertTime(Date insertTime) {
+        this.insertTime = insertTime;
+    }
+
+    public String getUpdateUsername() {
+        return updateUsername;
+    }
+
+    public void setUpdateUsername(String updateUsername) {
+        this.updateUsername = updateUsername == null ? null : updateUsername.trim();
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getInsertUpdateRemark() {
+        return insertUpdateRemark;
+    }
+
+    public void setInsertUpdateRemark(String insertUpdateRemark) {
+        this.insertUpdateRemark = insertUpdateRemark == null ? null : insertUpdateRemark.trim();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", totalResultId=").append(totalResultId);
+        sb.append(", loadingId=").append(loadingId);
+        sb.append(", unloadingId=").append(unloadingId);
+        sb.append(", resultTotalStayDuration=").append(resultTotalStayDuration);
+        sb.append(", standardDataId=").append(standardDataId);
+        sb.append(", resultOutlier=").append(resultOutlier);
+        sb.append(", insertUsername=").append(insertUsername);
+        sb.append(", insertTime=").append(insertTime);
+        sb.append(", updateUsername=").append(updateUsername);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 184 - 0
src/main/java/com/steerinfo/dil/model/TmstrainTruckTotalResult.java

@@ -0,0 +1,184 @@
+package com.steerinfo.dil.model;
+
+import com.steerinfo.framework.model.IBasePO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@ApiModel(value="火运总实绩与总实绩中间表")
+public class TmstrainTruckTotalResult implements IBasePO<BigDecimal> {
+    /**
+     * 主键ID(RESULT_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="主键ID",required=true)
+    private BigDecimal resultId;
+
+    /**
+     * 火运总实绩ID(TMSTRAIN_TOTAL_RESULT_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="火运总实绩ID",required=false)
+    private BigDecimal tmstrainTotalResultId;
+
+    /**
+     * 汽运总实绩ID(TMSTRUCK_TOTAL_RESULT_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="汽运总实绩ID",required=false)
+    private BigDecimal tmstruckTotalResultId;
+
+    /**
+     * 物资ID(MATERIAL_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="物资ID",required=false)
+    private BigDecimal materialId;
+
+    /**
+     * 记录创建人(INSERT_USERNAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="记录创建人",required=false)
+    private String insertUsername;
+
+    /**
+     * 记录创建时间(INSERT_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="记录创建时间",required=false)
+    private Date insertTime;
+
+    /**
+     * 记录修改人(UPDATE_USERNAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="记录修改人",required=false)
+    private String updateUsername;
+
+    /**
+     * 记录修改时间(UPDATE_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="记录修改时间",required=false)
+    private Date updateTime;
+
+    /**
+     * 记录创建或修改备注(INSERT_UPDATE_REMARK,VARCHAR,100)
+     */
+    @ApiModelProperty(value="记录创建或修改备注",required=false)
+    private String insertUpdateRemark;
+
+    /**
+     * 0:已装车 1:已卸车(LOAD_STATUS,DECIMAL,0)
+     */
+    @ApiModelProperty(value="0:已装车 1:已卸车",required=false)
+    private BigDecimal loadStatus;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public BigDecimal getId() {
+        return this.resultId;
+    }
+
+    @Override
+    public void setId(BigDecimal resultId) {
+        this.resultId = resultId;
+    }
+
+    public BigDecimal getResultId() {
+        return resultId;
+    }
+
+    public void setResultId(BigDecimal resultId) {
+        this.resultId = resultId;
+    }
+
+    public BigDecimal getTmstrainTotalResultId() {
+        return tmstrainTotalResultId;
+    }
+
+    public void setTmstrainTotalResultId(BigDecimal tmstrainTotalResultId) {
+        this.tmstrainTotalResultId = tmstrainTotalResultId;
+    }
+
+    public BigDecimal getTmstruckTotalResultId() {
+        return tmstruckTotalResultId;
+    }
+
+    public void setTmstruckTotalResultId(BigDecimal tmstruckTotalResultId) {
+        this.tmstruckTotalResultId = tmstruckTotalResultId;
+    }
+
+    public BigDecimal getMaterialId() {
+        return materialId;
+    }
+
+    public void setMaterialId(BigDecimal materialId) {
+        this.materialId = materialId;
+    }
+
+    public String getInsertUsername() {
+        return insertUsername;
+    }
+
+    public void setInsertUsername(String insertUsername) {
+        this.insertUsername = insertUsername == null ? null : insertUsername.trim();
+    }
+
+    public Date getInsertTime() {
+        return insertTime;
+    }
+
+    public void setInsertTime(Date insertTime) {
+        this.insertTime = insertTime;
+    }
+
+    public String getUpdateUsername() {
+        return updateUsername;
+    }
+
+    public void setUpdateUsername(String updateUsername) {
+        this.updateUsername = updateUsername == null ? null : updateUsername.trim();
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getInsertUpdateRemark() {
+        return insertUpdateRemark;
+    }
+
+    public void setInsertUpdateRemark(String insertUpdateRemark) {
+        this.insertUpdateRemark = insertUpdateRemark == null ? null : insertUpdateRemark.trim();
+    }
+
+    public BigDecimal getLoadStatus() {
+        return loadStatus;
+    }
+
+    public void setLoadStatus(BigDecimal loadStatus) {
+        this.loadStatus = loadStatus;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", resultId=").append(resultId);
+        sb.append(", tmstrainTotalResultId=").append(tmstrainTotalResultId);
+        sb.append(", tmstruckTotalResultId=").append(tmstruckTotalResultId);
+        sb.append(", materialId=").append(materialId);
+        sb.append(", insertUsername=").append(insertUsername);
+        sb.append(", insertTime=").append(insertTime);
+        sb.append(", updateUsername=").append(updateUsername);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
+        sb.append(", loadStatus=").append(loadStatus);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 12 - 1
src/main/java/com/steerinfo/dil/service/ITmstrainLoadingResultService.java

@@ -22,26 +22,37 @@ import java.util.Map;
 public interface ITmstrainLoadingResultService{
     //查询所有装车作业信息
     List<Map<String, Object>> getTmstrainWagonLoad(Map<String,Object> map);
+
     //新增车皮装车作业实绩
     int addTmstrainLoadingResult(TmstrainLoadingResult tmstrainLoadingResult);
+
     //获得发站地点名称
     List<Map<String, Object>> getSendStationName();
+
     //获得到站地点名称
     List<Map<String, Object>> getArrivalStationName();
+
     //获得批次ID
     List<Map<String, Object>> getBatchId();
+
     //获得装车车皮号
     List<Map<String, Object>> getWagonNo(Map<String, Object> map);
+
     //通过主键获得车皮装车信息
     List<Map<String, Object>> getTmstrainLoadingResultByResultId(BigDecimal resultId);
+
     //修改车皮装车作业实绩
     int updateTmstrainLoadingResult(TmstrainLoadingResult tmstrainLoadingResult);
+
     //通过主键删除车皮装车作业实绩
     int deleteTmstrainLoadingResultByResultId(BigDecimal resultId);
+
      //内转新增装车实绩
-    int addTrainLoadResultForConverted(TmstrainLoadingResult tmstrainLoadingResult);
+    int addTrainLoadResultForConverted(Map<String, Object> map);
+
     //内转物流通过id查询装车作业
     List<Map<String,Object>> selectLoadByResultId(BigDecimal resultId);
+
     //内转查询装车实绩
     List<Map<String,Object>> selectLoadedForConverted(Map<String,Object> map);
 }

+ 2 - 2
src/main/java/com/steerinfo/dil/service/ITmstrainPleaseApproveResultService.java

@@ -19,7 +19,7 @@ import java.util.Map;
  * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  */
 public interface ITmstrainPleaseApproveResultService{
-    //查询所有已下发的请车作业
+    //查询所有的请车作业
     List<Map<String, Object>> getAllWagonPlease(Map<String, Object> mapValue);
 
     //获取最大ID主键值
@@ -47,7 +47,7 @@ public interface ITmstrainPleaseApproveResultService{
     List<Map<String, Object>> getWagonPleaseById(Integer resultId);
 
     //内转新增请车计划
-    int addPleaseApprove(Map<String,Object> map);
+    int addPleaseForNZ(Map<String,Object> map);
 
     //获取发站/到站下拉框
     List<Map<String,Object>> getArrivalSend();

+ 1 - 1
src/main/java/com/steerinfo/dil/service/ITmstrainWagonUnloadResultService.java

@@ -41,7 +41,7 @@ public interface ITmstrainWagonUnloadResultService{
     List<Map<String, Object>> getTmstrainWagonUnLoadResultByUnLoadingId(BigDecimal unloadingId);
 
     //内转物流新增卸车实绩
-//    int addTmstrainWagonLoadResultForConverted(TmstrainWagonUnloadResult tmstrainWagonUnloadResult);
+    int addTmsTrainUnloadResultForNZ(Map<String, Object> map);
 
     //内转物流查询卸车实绩
     List<Map<String,Object>> selectWagonUnLoadResult(Map<String,Object> map);

+ 115 - 48
src/main/java/com/steerinfo/dil/service/impl/TmstrainLoadingResultServiceImpl.java

@@ -2,7 +2,11 @@ package com.steerinfo.dil.service.impl;
 
 import com.steerinfo.dil.feign.WmshBoundFeign;
 import com.steerinfo.dil.mapper.TmstrainLoadingResultMapper;
+import com.steerinfo.dil.mapper.TmstrainTotalResultMapper;
+import com.steerinfo.dil.mapper.TmstrainTruckTotalResultMapper;
 import com.steerinfo.dil.model.TmstrainLoadingResult;
+import com.steerinfo.dil.model.TmstrainTotalResult;
+import com.steerinfo.dil.model.TmstrainTruckTotalResult;
 import com.steerinfo.dil.service.ITmstrainLoadingResultService;
 import com.steerinfo.dil.util.DataChange;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +41,11 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
     @Autowired
     private WmshBoundFeign wmshBoundFeign;
 
+    @Autowired
+    private TmstrainTruckTotalResultMapper tmstrainTruckTotalResultMapper;
+
+    @Autowired
+    private TmstrainTotalResultMapper tmstrainTotalResultMapper;
 
     /**
      * 查看所有装车实绩
@@ -50,8 +59,9 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
             case 1:
             case 2:
             case 3:
-                return tmstrainLoadingResultMapper.getTmsWagonLoadInfo(map);
+                return tmstrainLoadingResultMapper.getTmsWagonLoadInfo(map); // apiId = 58
             case 4:
+                return tmstrainLoadingResultMapper.selectLoadedForConverted(map); //apiId = 203
         }
         return null;
     }
@@ -82,32 +92,11 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
             BigDecimal maxId = tmstrainLoadingResultMapper.selectMaxId();
             //生成主键id
             tmstrainLoadingResult.setResultId(maxId);
-
-            //获得车皮号
-            String LoadwagonNo=tmstrainLoadingResult.getResultWagonNo();
-            String number=LoadwagonNo.substring(0,2);
-            if (number.equals("14"))
-            {
-                String No=LoadwagonNo.substring(0,3);
-                if (No.equals("143")||No.equals("140")||No.equals("141")||No.equals("142")){
-                    tmstrainLoadingResult.setResultBillableTonnage(new BigDecimal(60));
-                }
-                else if (No.equals("145")){
-                    tmstrainLoadingResult.setResultBillableTonnage(new BigDecimal(61));
-                }
-            }
-            else  if(number.equals("45")||number.equals("46")){
-                tmstrainLoadingResult.setResultBillableTonnage(new BigDecimal(60));
-            }
-            else if(number.equals("42")||number.equals("47")||number.equals("48")||number.equals("49")){
-                tmstrainLoadingResult.setResultBillableTonnage(new BigDecimal(61));
-            }
-            else  if(number.equals("15")||number.equals("16")||number.equals("17")||number.equals("18")){
-                tmstrainLoadingResult.setResultBillableTonnage(new BigDecimal(70));
-            }
-             count += tmstrainLoadingResultMapper.insertSelective(tmstrainLoadingResult);
-             totalWeight += tmstrainLoadingResult.getResultBillableTonnage().doubleValue();
-
+            //通过车皮号计算车皮标重
+            int wagonWeight = calculateWagonWeight(tmstrainLoadingResult.getResultWagonNo());
+            tmstrainLoadingResult.setResultBillableTonnage(new BigDecimal(wagonWeight));
+            count += tmstrainLoadingResultMapper.insertSelective(tmstrainLoadingResult);
+            totalWeight += tmstrainLoadingResult.getResultBillableTonnage().doubleValue();
         }
 
         //如果订单类型为采购进口矿火运(万州港---老区轨道衡 || 万州港--老区轨道衡)
@@ -118,6 +107,34 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
         return count;
     }
 
+    /**
+     * 通过车皮标重计算车皮标重
+     * @return
+     */
+    public int calculateWagonWeight(String wagonNo){
+        String number = wagonNo.substring(0,2);
+        if (number.equals("14"))
+        {
+            String No = wagonNo.substring(0,3);
+            if (No.equals("143")||No.equals("140")||No.equals("141")||No.equals("142")){
+                return 60;
+            }
+            else if (No.equals("145")){
+                return 61;
+            }
+        }
+        else  if(number.equals("45")||number.equals("46")){
+            return 60;
+        }
+        else if(number.equals("42")||number.equals("47")||number.equals("48")||number.equals("49")){
+            return 61;
+        }
+        else  if(number.equals("15")||number.equals("16")||number.equals("17")||number.equals("18")){
+            return 70;
+        }
+        return 0;
+    }
+
     /**
      * 添加港存库出库实绩
      * @param tmstrainLoadingResult
@@ -180,28 +197,73 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
         return tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
     }
 
+    /**
+     * 内转添加装车实绩
+     *      "railPlanId": 1,
+     *     "resultClass":"白班",
+     *     "resultWagonNo":"1609999",
+     *     "insertUpdateRemark": "这是第二条",
+     *     "scanCodeText": "HRB400E-12-21706023-9-3077-385-20210909120037-a0691de83a1a1fef-08010103010100014-20"
+     * @param map
+     * @return
+     */
     @Override
-    public int addTrainLoadResultForConverted(TmstrainLoadingResult tmstrainLoadingResult) {
-        //设置主键id
-        BigDecimal maxId = tmstrainLoadingResultMapper.selectMaxId();
-        //生成主键id
-        tmstrainLoadingResult.setResultId(maxId);
-        //获取发运计划id
-        BigDecimal planId= tmstrainLoadingResult.getPurchaseOrderRailPlanId();
-        //通过发运计划号查找物资信息
-        Map<String,Object> map=tmstrainLoadingResultMapper.getMaterialInfoByRailPlanId(planId.intValue());
-        //获取物资id
-        Integer materialId =(Integer) map.get("materialId");
-        tmstrainLoadingResult.setMaterialId(DataChange.dataToBigDecimal(materialId));
-        //获取物资件数
-        Integer materialNumber = (Integer)map.get("materialNumber");
-        tmstrainLoadingResult.setResultMaterialNumber(DataChange.dataToBigDecimal(materialNumber));
-        //获取物资理重
-        Integer materialWeight = (Integer)map.get("materialWeight");
-        tmstrainLoadingResult.setResultMaterialTheoryweight(DataChange.dataToBigDecimal(materialWeight));
-        tmstrainLoadingResult.setInsertTime(new Date());
-        tmstrainLoadingResult.setInsertUsername("admin");
-        return tmstrainLoadingResultMapper.insertSelective(tmstrainLoadingResult);
+    @Transactional
+    public int addTrainLoadResultForConverted(Map<String, Object> map) {
+        int count = 0;
+        TmstrainLoadingResult tmstrainLoadingResult = new TmstrainLoadingResult();
+        String resultWagonNo = (String) map.get("resultWagonNo"); //车皮号
+        BigDecimal railPlanId = DataChange.dataToBigDecimal(map.get("railPlanId")); //发运计划ID
+        Integer loadingId = tmstrainLoadingResultMapper.getLoadingIdByWnoAndRailPlanId(resultWagonNo, railPlanId.intValue());
+        //通过火运装车实绩ID查询火运总实绩ID 如果火运装车实绩不为空
+        BigDecimal trainTotalId = null;
+        if(loadingId != null){
+            trainTotalId = tmstrainTotalResultMapper.getTotalIdByLoadingId(loadingId);
+        }
+        //如果没有这个车皮号和发运计划的装车实绩,则新增一条装车实绩
+        if(loadingId == null){
+            //获取装车实绩主键ID
+            BigDecimal maxId = tmstrainLoadingResultMapper.selectMaxId();
+            tmstrainLoadingResult.setId(maxId);
+            //获取发运计划ID
+            tmstrainLoadingResult.setPurchaseOrderRailPlanId(railPlanId);
+            tmstrainLoadingResult.setResultWagonNo(resultWagonNo);
+            //通过车皮号计算车皮标重
+            tmstrainLoadingResult.setResultBillableTonnage(new BigDecimal(calculateWagonWeight(resultWagonNo)));
+            tmstrainLoadingResult.setResultLoadingDate(new Date());
+            tmstrainLoadingResult.setResultClass((String) map.get("resultClass")); //班别
+            tmstrainLoadingResult.setInsertUpdateRemark((String) map.get("insertUpdateRemark"));
+            tmstrainLoadingResult.setInsertTime(new Date());
+            tmstrainLoadingResult.setInsertUsername("admin");
+            tmstrainLoadingResult.setResultType(new BigDecimal(4)); //内转类型
+            tmstrainLoadingResult.setDeleted(new BigDecimal(0)); //逻辑删除0
+            //添加车皮装车实绩
+            count += tmstrainLoadingResultMapper.insertSelective(tmstrainLoadingResult);
+            //添加火运总实绩
+            TmstrainTotalResult tmstrainTotalResult = new TmstrainTotalResult();
+            trainTotalId = tmstrainTotalResultMapper.selectMaxId();
+            tmstrainTotalResult.setId(trainTotalId); //获取添加火运总实绩主键ID
+            //添加火运装车实绩ID
+            tmstrainTotalResult.setLoadingId(maxId);
+            count += tmstrainTotalResultMapper.insertSelective(tmstrainTotalResult);
+        }
+
+        //通过物资扫描结果匹配出库主键ID
+        Integer outBoundResultId = tmstrainLoadingResultMapper.getOutBoundResultIdByScan((String) map.get("scanCodeText"));
+        //通过出库主键查询汽运总实绩ID和物资ID
+        Map<String, Object> mesMap = tmstrainLoadingResultMapper.getResultTotalIdByOutBoundResultId(outBoundResultId);
+        //添加火运物资中间表
+        TmstrainTruckTotalResult tmstrainTruckTotalResult = new TmstrainTruckTotalResult();
+        tmstrainTruckTotalResult.setResultId(tmstrainTruckTotalResultMapper.selectMaxId());//添加火运物资中间表主键ID
+        tmstrainTruckTotalResult.setTmstruckTotalResultId(DataChange.dataToBigDecimal(mesMap.get("resultTotalId")));//添加汽运总实绩ID
+        tmstrainTruckTotalResult.setMaterialId(DataChange.dataToBigDecimal(mesMap.get("materialId")));//添加物资ID
+        tmstrainTruckTotalResult.setTmstrainTotalResultId(trainTotalId);//添加火运总实绩ID
+        tmstrainTruckTotalResult.setLoadStatus(new BigDecimal(0)); //已装车
+        tmstrainTruckTotalResult.setInsertTime(new Date());
+        tmstrainTruckTotalResult.setInsertUsername("admin");
+        count += tmstrainTruckTotalResultMapper.insertSelective(tmstrainTruckTotalResult);
+
+        return count;
     }
 
     @Override
@@ -209,6 +271,11 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
         return tmstrainLoadingResultMapper.selectLoadByResultId(resultId);
     }
 
+    /**
+     * 内转查询装车实绩
+     * @param map
+     * @return
+     */
     @Override
     public List<Map<String, Object>> selectLoadedForConverted(Map<String, Object> map) {
         return tmstrainLoadingResultMapper.selectLoadedForConverted(map);

+ 20 - 39
src/main/java/com/steerinfo/dil/service/impl/TmstrainPleaseApproveResultServiceImpl.java

@@ -44,8 +44,9 @@ public class TmstrainPleaseApproveResultServiceImpl implements ITmstrainPleaseAp
         switch (resultType.intValue()){
             case 1:
             case 3:
-                return tmstrainPleaseApproveResultMapper.getAllWagonPlease(mapValue);
+                return tmstrainPleaseApproveResultMapper.getAllWagonPlease(mapValue); //api:57
             case 4:
+                return tmstrainPleaseApproveResultMapper.selectPleaseApprovePlanForConverted(mapValue);//api:253
         }
         return null;
     }
@@ -61,8 +62,9 @@ public class TmstrainPleaseApproveResultServiceImpl implements ITmstrainPleaseAp
         switch (resultType.intValue()){
             case 1:
             case 3:
-                return tmstrainPleaseApproveResultMapper.getAllApproveWagonPlease(mapValue);
+                return tmstrainPleaseApproveResultMapper.getAllApproveWagonPlease(mapValue); //apiID: 70
             case 4:
+                return tmstrainPleaseApproveResultMapper.selectPleaseApprovePlanForConverted(mapValue); //api:254
         }
         return null;
     }
@@ -86,19 +88,12 @@ public class TmstrainPleaseApproveResultServiceImpl implements ITmstrainPleaseAp
     public int insertSelective(TmstrainPleaseApproveResult tmstrainPleaseApproveResult) {
         //生成主键ID
         BigDecimal maxId = selectMaxId();
-        long id = maxId.longValue();
+        int id = maxId.intValue();
         tmstrainPleaseApproveResult.setResultId(maxId);
         //设置状态 新增的为未下发状态
         tmstrainPleaseApproveResult.setStatus(new BigDecimal(0));
         //生成请车计划号
-        String resultPleasePlanNo;
-        if(id >= 100){
-            resultPleasePlanNo = "WQCJH" + id;
-        }else if(id >= 10) {
-            resultPleasePlanNo = "WQCJH0" + id;
-        }else {
-            resultPleasePlanNo = "WQCJH00" + id;
-        }
+        String resultPleasePlanNo = DataChange.generateEightDigitsNumber("WQCJH", id);
         tmstrainPleaseApproveResult.setResultPleasePlanNo(resultPleasePlanNo);
         //生成请车日期
         tmstrainPleaseApproveResult.setInsertUsername("admin");
@@ -142,45 +137,31 @@ public class TmstrainPleaseApproveResultServiceImpl implements ITmstrainPleaseAp
      * @return
      */
     @Override
-    public int addPleaseApprove(Map<String, Object> map) {
+    public int addPleaseForNZ(Map<String, Object> map) {
         //生成主键ID
         BigDecimal maxId = selectMaxId();
-        long id = maxId.longValue();
-        TmstrainPleaseApproveResult tmstrainPleaseApproveResult=new TmstrainPleaseApproveResult();
+        int id = maxId.intValue();
+        TmstrainPleaseApproveResult tmstrainPleaseApproveResult = new TmstrainPleaseApproveResult();
         //新增请车id
         tmstrainPleaseApproveResult.setResultId(maxId);
         //设置状态 新增的为未下发状态
         tmstrainPleaseApproveResult.setStatus(new BigDecimal(0));
+        tmstrainPleaseApproveResult.setResultType(new BigDecimal(4));//内转
         //生成请车计划号
-        String resultPleasePlanNo;
-        if(id >= 100){
-            resultPleasePlanNo = "WQCJH" + id;
-        }else if(id >= 10) {
-            resultPleasePlanNo = "WQCJH0" + id;
-        }else {
-            resultPleasePlanNo = "WQCJH00" + id;
-        }
+        String resultPleasePlanNo = DataChange.generateEightDigitsNumber("WQCJH", id);
         tmstrainPleaseApproveResult.setResultPleasePlanNo(resultPleasePlanNo);
         //新增请车人
-        Integer personnelId =(Integer) map.get("personnelId");
-        String personelName=tmstrainPleaseApproveResultMapper.selectPersonNameByPersonnelId(personnelId);
-        tmstrainPleaseApproveResult.setInsertUsername(personelName);
-        //获取发运计划id
-        Integer deplanId=(Integer)map.get("id");
+        tmstrainPleaseApproveResult.setInsertUsername("admin");
+//        Integer personnelId =(Integer) map.get("personnelId");
+//        String personelName=tmstrainPleaseApproveResultMapper.selectPersonNameByPersonnelId(personnelId);
+//        tmstrainPleaseApproveResult.setInsertUsername(personelName);
         //设置发运计划id
-        tmstrainPleaseApproveResult.setRailPlanId(DataChange.dataToBigDecimal(deplanId));
-        //获取请车数
-        Integer approveCarNo =(Integer)map.get("approveCarNo");
+        tmstrainPleaseApproveResult.setRailPlanId(DataChange.dataToBigDecimal(map.get("railPlanId")));
         //设置请车数
-        tmstrainPleaseApproveResult.setResultPleaseNumber(new BigDecimal(approveCarNo));
-        //获取请车时间
-        Date approveTime =(Date) map.get("approveTime");
-        //设置请车时间
-        tmstrainPleaseApproveResult.setResultPleaseDate(approveTime);
-        //获取发站id
-        Integer sendId=(Integer)map.get("sendId");
-        tmstrainPleaseApproveResult.setSendStationId(DataChange.dataToBigDecimal(sendId));
-        //执行新增
+        tmstrainPleaseApproveResult.setResultPleaseNumber(DataChange.dataToBigDecimal(map.get("resultPleaseNumber")));
+        //设置请车时日期
+        tmstrainPleaseApproveResult.setResultPleaseDate(new Date((long) map.get("resultPleaseDate")));
+        tmstrainPleaseApproveResult.setInsertTime(new Date());
         return tmstrainPleaseApproveResultMapper.insertSelective(tmstrainPleaseApproveResult);
     }
 

+ 67 - 19
src/main/java/com/steerinfo/dil/service/impl/TmstrainWagonUnloadResultServiceImpl.java

@@ -1,8 +1,12 @@
 package com.steerinfo.dil.service.impl;
 
 import com.steerinfo.dil.mapper.TmstrainLoadingResultMapper;
+import com.steerinfo.dil.mapper.TmstrainTotalResultMapper;
+import com.steerinfo.dil.mapper.TmstrainTruckTotalResultMapper;
 import com.steerinfo.dil.mapper.TmstrainWagonUnloadResultMapper;
 import com.steerinfo.dil.model.TmstrainLoadingResult;
+import com.steerinfo.dil.model.TmstrainTotalResult;
+import com.steerinfo.dil.model.TmstrainTruckTotalResult;
 import com.steerinfo.dil.model.TmstrainWagonUnloadResult;
 import com.steerinfo.dil.service.ITmstrainWagonUnloadResultService;
 import com.steerinfo.dil.util.DataChange;
@@ -36,6 +40,11 @@ public class TmstrainWagonUnloadResultServiceImpl implements ITmstrainWagonUnloa
     @Autowired
     private TmstrainLoadingResultServiceImpl tmstrainLoadingResultService;
 
+    @Autowired
+    private TmstrainTotalResultMapper tmstrainTotalResultMapper;
+
+    @Autowired
+    private TmstrainTruckTotalResultMapper tmstrainTruckTotalResultMapper;
     /**
      * 查看所有卸车实绩
      * 1采购进口矿(万州港-达州站/万州港-老区轨道衡) 2采购进口矿(海港-老区轨道衡) 3采购国产矿  4内转
@@ -49,8 +58,9 @@ public class TmstrainWagonUnloadResultServiceImpl implements ITmstrainWagonUnloa
             case 1:
             case 2:
             case 3:
-                return tmstrainWagonUnloadResultMapper.getTmsWagonUnLoadInfo(map);
+                return tmstrainWagonUnloadResultMapper.getTmsWagonUnLoadInfo(map); //apiId: 60
             case 4:
+                return tmstrainWagonUnloadResultMapper.selectWagonUnLoadResultForNZ(map);//apiId:256
         }
         return null;
     }
@@ -83,8 +93,6 @@ public class TmstrainWagonUnloadResultServiceImpl implements ITmstrainWagonUnloa
             case 3:
                 i = addTmstrainWagonLoadResult(tmstrainWagonUnloadResult);
                 break;
-            case 4:
-                i = addTmstrainWagonLoadResultForConverted(tmstrainWagonUnloadResult);
         }
         return i;
     }
@@ -174,28 +182,68 @@ public class TmstrainWagonUnloadResultServiceImpl implements ITmstrainWagonUnloa
 
     /**
      * 内转物流新增卸车实绩
-     * @param tmstrainWagonUnloadResult
+     *      "orderId": 2,
+     *     "materialId": 197,
+     *     "arrivalDate": 1637910978000,
+     *     "bigTicketWeight":111,
+     *     "railHorizontalWeight":110
+     * @param map
      * @return
      */
-    public int addTmstrainWagonLoadResultForConverted(TmstrainWagonUnloadResult tmstrainWagonUnloadResult) {
-        //生成主键id
-        tmstrainWagonUnloadResult.setUnloadingId(tmstrainWagonUnloadResultMapper.selectMaxId());
-        //通过装车车皮号得到并插入采购订单id
-        BigDecimal planId = tmstrainWagonUnloadResultMapper.getPurchaseOrderId(tmstrainWagonUnloadResult.getResultWagonNo());
-        tmstrainWagonUnloadResult.setPurchaseOrderRailPlanId(planId);
-        //常规字段插入
-        tmstrainWagonUnloadResult.setInsertUsername("admin");
-        tmstrainWagonUnloadResult.setInsertTime(new Date());
-        tmstrainWagonUnloadResult.setUpdateUsername("admin");
-        tmstrainWagonUnloadResult.setUpdateTime(new Date());
-        tmstrainWagonUnloadResult.setInsertUpdateRemark("无");
-        tmstrainWagonUnloadResult.setDeleted(new BigDecimal(0));
-        return tmstrainWagonUnloadResultMapper.insertSelective(tmstrainWagonUnloadResult);
+    public int addTmsTrainUnloadResultForNZ(Map<String, Object> map) {
+        BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
+        BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
+        //通过传入的运输订单ID查询这个运输订单关联的火运总实绩和汽运总实绩
+        List<Map<String, Object>> totalIdList = tmstrainWagonUnloadResultMapper.getTotalIdByOrderId(orderId);
+        Map<String, Object> mesMap = totalIdList.get(0);
+        BigDecimal trainTotalId = DataChange.dataToBigDecimal(mesMap.get("trainTotalId"));
+        BigDecimal truckTotalId = DataChange.dataToBigDecimal(mesMap.get("truckTotalId"));
+        mesMap.put("materialId", materialId);
+        //通过火运总实绩ID查询装车实绩ID
+        Integer loadingId = tmstrainWagonUnloadResultMapper.getLoadingIdByTrainTotalId(trainTotalId);
+        //拿到装车实绩ID后查询车皮号与发运计划号
+        Map<String, Object> noAndIdMap = tmstrainWagonUnloadResultMapper.getWagonNoAndRailPlanByLoadingId(loadingId);
+        String resultWagonNo = (String) noAndIdMap.get("resultWagonNo");
+        BigDecimal railPlanId = DataChange.dataToBigDecimal(noAndIdMap.get("railPlanId"));
+        //通过车皮号与发运计划号匹配卸车作业中是否含有记录
+        Integer unloadId = tmstrainWagonUnloadResultMapper.getUnloadIdByWagonNoAndRailPlanId(resultWagonNo, railPlanId);
+        //如果没有卸车实绩则新增卸车实绩
+        int count = 0;
+        if(unloadId == null){
+            TmstrainWagonUnloadResult tmstrainWagonUnloadResult = new TmstrainWagonUnloadResult();
+            BigDecimal maxId = tmstrainWagonUnloadResultMapper.selectMaxId();
+            tmstrainWagonUnloadResult.setId(maxId);
+            tmstrainWagonUnloadResult.setResultWagonNo(resultWagonNo);//添加车皮号
+            tmstrainWagonUnloadResult.setPurchaseOrderRailPlanId(railPlanId);//添加发运计划ID
+            tmstrainWagonUnloadResult.setResultUnloadTime(new Date());//卸车日期
+            tmstrainWagonUnloadResult.setResultArrivalDate(new Date((long) map.get("arrivalDate")));//到达日期
+            tmstrainWagonUnloadResult.setResultBigTicketWeight(DataChange.dataToBigDecimal(map.get("bigTicketWeight")));//大票重量
+            tmstrainWagonUnloadResult.setResultRailHorizontalWeight(DataChange.dataToBigDecimal(map.get("railHorizontalWeight")));//轨道衡重量
+            tmstrainWagonUnloadResult.setDeleted(new BigDecimal(0));
+            tmstrainWagonUnloadResult.setResultType(new BigDecimal(4));
+            tmstrainWagonUnloadResult.setInsertTime(new Date());
+            tmstrainWagonUnloadResult.setInsertUsername("admin");
+            count += tmstrainWagonUnloadResultMapper.insertSelective(tmstrainWagonUnloadResult);
+            //往火运总实绩中添加卸车实绩
+            TmstrainTotalResult tmstrainTotalResult = new TmstrainTotalResult();
+            tmstrainTotalResult.setTotalResultId(trainTotalId);
+            tmstrainTotalResult.setUnloadingId(maxId);
+            tmstrainTotalResult.setUpdateTime(new Date());
+            count += tmstrainTotalResultMapper.updateByPrimaryKeySelective(tmstrainTotalResult);
+        }
+        //通过物资ID、汽运总实绩ID、火运总实绩ID 查找中间表主键
+        Integer id = tmstrainTruckTotalResultMapper.getIdByMateAndTruckAndTrainTotalId(mesMap);
+        //修改火运物资中间表为已卸车
+        TmstrainTruckTotalResult tmstrainTruckTotalResult = new TmstrainTruckTotalResult();
+        tmstrainTruckTotalResult.setId(new BigDecimal(id));
+        tmstrainTruckTotalResult.setLoadStatus(new BigDecimal(1));//已卸车
+        count += tmstrainTruckTotalResultMapper.updateByPrimaryKeySelective(tmstrainTruckTotalResult);
+        return count;
     }
 
     @Override
     public List<Map<String, Object>> selectWagonUnLoadResult(Map<String, Object> map) {
-        return tmstrainWagonUnloadResultMapper.selectWagonUnLoadResult(map);
+        return tmstrainWagonUnloadResultMapper.selectWagonUnLoadResultForNZ(map);
     }
 
 

+ 57 - 31
src/main/resources/com/steerinfo/dil/mapper/TmstrainLoadingResultMapper.xml

@@ -902,37 +902,34 @@
    WHERE AROD.DAYPLAN_ID=#{dayPlanId}
   </select>
 <!-- 内转物流查询装车作业 -->
-  <select id="selectLoadedForConverted" resultType="java.util.Map">
-  select TLR.RESULT_BILLABLE_TONNAGE "tonnage",
-         TLR.RESULT_MATERIAL_THEORYWEIGHT "meterialTheoryweight",
-         AROD.DAYPLAN_NO "dayplanNo",
-         TLR.RESULT_CLASS "resultClass",
-         TLR.INSERT_UPDATE_REMARK "remark",
-         TLR.RESULT_LOADING_DATE "date",
-         TLR.RESULT_WAGON_NO "wagonNo",
-         RAS.ARRIVAL_NAME "arrivalName",
-         RAS2.ARRIVAL_NAME "arrivalName2",
-         RM.MATERIAL_NAME "materialName",
-         TLR.RESULT_MATERIAL_NUMBER "materialNumber",
-          RC2.CONSIGNEE_COMPANY_NAME "companyName",
-         AROD.DAYPLAN_CONSIGNEE_NAME "consigeeName",
-         AROD.DAYPLAN_CONSIGNEE_TEL "tel",
-         RAS2.DAYPLAN_DEDICATED_LINE "line",
-         RC.CAPACITY_NUMBER "capacityNumber"
-  from TMSTRAIN_LOADING_RESULT TLR
-  LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
-  ON AROD.DAYPLAN_ID=TLR.PURCHASE_ORDER_RAIL_PLAN_ID
-  LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
-  ON RAS.ARRIVAL_ID=TLR.ARRIVAL_STATION_ID
-  LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS2
-  ON TLR.SEND_STATION_ID=RAS2.ARRIVAL_ID
-  LEFT JOIN RMS_CAPACITY RC
-  ON RC.CAPACITY_ID=TLR.CAPACITY_ID
-  LEFT JOIN RMS_MATERIAL RM
-  ON RM.MATERIAL_ID=TLR.MATERIAL_ID
-  LEFT JOIN  RMS_CONSIGNEE RC2
-  ON RC2.CONSIGNEE_ID=AROD.RECEIVING_UNIT_ID
-  WHERE TLR.DELETED=0
+  <select id="selectLoadedForConverted" parameterType="java.util.Map" resultType="java.util.Map">
+    select
+           TLR.RESULT_ID                    "resultId",
+           TLR.RESULT_BILLABLE_TONNAGE      "resultBillableTonnage",
+           AROD.DAYPLAN_NO                  "dayplanNo",
+           TLR.RESULT_CLASS                 "resultClass",
+           TLR.INSERT_UPDATE_REMARK         "insertUpdateRemark",
+           TO_CHAR(TLR.RESULT_LOADING_DATE, 'yyyy-mm-dd')    "resultLoadingDate",
+           TLR.RESULT_WAGON_NO              "resultWagonNo",
+           RAS.ARRIVAL_NAME                 "dayplanSendStationName",
+           RAS2.ARRIVAL_NAME                "dayplanToTheStationName",
+           AROD.DAYPLAN_CONSIGNEE_NAME      "dayplanConsigneeName",
+           AROD.DAYPLAN_CONSIGNEE_TEL       "dayplanConsigneeTel",
+           RAS2.DAYPLAN_DEDICATED_LINE      "dayplanDedicatedLine",
+           RS.SHIPPER_NAME                  "shipperName",
+           RC.CONSIGNEE_COMPANY_NAME        "consigneeCompanyName"
+    from TMSTRAIN_LOADING_RESULT TLR
+           LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
+                     ON AROD.DAYPLAN_ID = TLR.PURCHASE_ORDER_RAIL_PLAN_ID
+           LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
+                     ON RAS.ARRIVAL_ID = AROD.DAYPLAN_SEND_STATION_ID
+           LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS2
+                     ON AROD.DAYPLAN_TO_THE_STATION_ID = RAS2.ARRIVAL_ID
+           LEFT JOIN RMS_CONSIGNEE RC
+                     ON RC.CONSIGNEE_ID = AROD.RECEIVING_UNIT_ID
+           LEFT JOIN RMS_SHIPPER RS
+                     ON RS.SHIPPER_ID = AROD.SHIPPER_ID
+    WHERE TLR.DELETED = 0 AND TLR.RESULT_TYPE = 4
   </select>
 
   <select id="selectLoadByResultId" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
@@ -950,4 +947,33 @@
     where t_load.RESULT_ID = #{resultId}
   </select>
 
+<!--  通过扫描结果匹配 出库扫描实绩中出库实绩Id -->
+    <select id="getOutBoundResultIdByScan" parameterType="string" resultType="java.lang.Integer">
+        SELECT WOSR.OUTBOUND_RESULT_ID
+
+        FROM WMSP_OUTBOUND_SCAN_RESULT WOSR
+        WHERE WOSR.RESULT_MATERIAL = #{scanText} AND WOSR.RESULT_CHECK = 0
+    </select>
+
+<!-- 通过出库主键ID查询订单总实绩ID -->
+  <select id="getResultTotalIdByOutBoundResultId" parameterType="int" resultType="java.util.Map">
+        SELECT WOR.MATERIAL_ID "materialId",
+               (
+                    select TTR.RESULT_TOTAL_ID
+                    from TMSTRUCK_TOTAL_RESULT TTR
+                    where TTR.ORDER_ID = WOR.BILL_LADING_ID
+            ) "resultTotalId"
+        FROM WMSP_OUTBOUND_RESULT WOR
+        WHERE WOR.RESULT_ID = #{outboundResultId}
+
+  </select>
+
+<!-- 通过发运计划ID和车皮号查询装车实绩ID -->
+  <select id="getLoadingIdByWnoAndRailPlanId" parameterType="java.util.Map" resultType="java.lang.Integer">
+        SELECT
+               TLR.RESULT_ID
+        FROM TMSTRAIN_LOADING_RESULT TLR
+        WHERE TLR.RESULT_WAGON_NO = #{resultWagonNo} AND TLR.PURCHASE_ORDER_RAIL_PLAN_ID = #{railPlanId}
+  </select>
+
 </mapper>

+ 900 - 872
src/main/resources/com/steerinfo/dil/mapper/TmstrainPleaseApproveResultMapper.xml

@@ -1,900 +1,928 @@
 <?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.TmstrainPleaseApproveResultMapper">
-  <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
-    <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
-    <result column="RAIL_PLAN_ID" jdbcType="DECIMAL" property="railPlanId" />
-    <result column="RESULT_PLEASE_PLAN_NO" jdbcType="VARCHAR" property="resultPleasePlanNo" />
-    <result column="RESULT_PLAN_DATE" jdbcType="TIMESTAMP" property="resultPlanDate" />
-    <result column="RESULT_CATEGORY" jdbcType="VARCHAR" property="resultCategory" />
-    <result column="SHIPPER_ID" jdbcType="DECIMAL" property="shipperId" />
-    <result column="SEND_STATION_ID" jdbcType="DECIMAL" property="sendStationId" />
-    <result column="TO_THE_STATION_ID" jdbcType="DECIMAL" property="toTheStationId" />
-    <result column="RESULT_PLEASE_NUMBER" jdbcType="DECIMAL" property="resultPleaseNumber" />
-    <result column="RESULT_PLEASE_DATE" jdbcType="TIMESTAMP" property="resultPleaseDate" />
-    <result column="RESULT_APPROVE_NUMBER" jdbcType="DECIMAL" property="resultApproveNumber" />
-    <result column="RESULT_APPROVE_DATE" jdbcType="TIMESTAMP" property="resultApproveDate" />
-    <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" />
-    <result column="STATUS" jdbcType="DECIMAL" property="status" />
-    <result column="RESULT_TYPE" jdbcType="DECIMAL" property="resultType" />
-  </resultMap>
-  <sql id="columns">
-    RESULT_ID, RAIL_PLAN_ID, RESULT_PLEASE_PLAN_NO, RESULT_PLAN_DATE, RESULT_CATEGORY, 
+    <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
+        <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId"/>
+        <result column="RAIL_PLAN_ID" jdbcType="DECIMAL" property="railPlanId"/>
+        <result column="RESULT_PLEASE_PLAN_NO" jdbcType="VARCHAR" property="resultPleasePlanNo"/>
+        <result column="RESULT_PLAN_DATE" jdbcType="TIMESTAMP" property="resultPlanDate"/>
+        <result column="RESULT_CATEGORY" jdbcType="VARCHAR" property="resultCategory"/>
+        <result column="SHIPPER_ID" jdbcType="DECIMAL" property="shipperId"/>
+        <result column="SEND_STATION_ID" jdbcType="DECIMAL" property="sendStationId"/>
+        <result column="TO_THE_STATION_ID" jdbcType="DECIMAL" property="toTheStationId"/>
+        <result column="RESULT_PLEASE_NUMBER" jdbcType="DECIMAL" property="resultPleaseNumber"/>
+        <result column="RESULT_PLEASE_DATE" jdbcType="TIMESTAMP" property="resultPleaseDate"/>
+        <result column="RESULT_APPROVE_NUMBER" jdbcType="DECIMAL" property="resultApproveNumber"/>
+        <result column="RESULT_APPROVE_DATE" jdbcType="TIMESTAMP" property="resultApproveDate"/>
+        <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"/>
+        <result column="STATUS" jdbcType="DECIMAL" property="status"/>
+        <result column="RESULT_TYPE" jdbcType="DECIMAL" property="resultType"/>
+    </resultMap>
+    <sql id="columns">
+        RESULT_ID, RAIL_PLAN_ID, RESULT_PLEASE_PLAN_NO, RESULT_PLAN_DATE, RESULT_CATEGORY,
     SHIPPER_ID, SEND_STATION_ID, TO_THE_STATION_ID, RESULT_PLEASE_NUMBER, RESULT_PLEASE_DATE, 
     RESULT_APPROVE_NUMBER, RESULT_APPROVE_DATE, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, 
     UPDATE_TIME, INSERT_UPDATE_REMARK, STATUS, RESULT_TYPE
-  </sql>
-  <sql id="columns_alias">
-    t.RESULT_ID, t.RAIL_PLAN_ID, t.RESULT_PLEASE_PLAN_NO, t.RESULT_PLAN_DATE, t.RESULT_CATEGORY, 
+    </sql>
+    <sql id="columns_alias">
+        t.RESULT_ID, t.RAIL_PLAN_ID, t.RESULT_PLEASE_PLAN_NO, t.RESULT_PLAN_DATE, t.RESULT_CATEGORY,
     t.SHIPPER_ID, t.SEND_STATION_ID, t.TO_THE_STATION_ID, t.RESULT_PLEASE_NUMBER, t.RESULT_PLEASE_DATE, 
     t.RESULT_APPROVE_NUMBER, t.RESULT_APPROVE_DATE, t.INSERT_USERNAME, t.INSERT_TIME, 
     t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.STATUS, t.RESULT_TYPE
-  </sql>
-  <sql id="select">
-    SELECT <include refid="columns"/> FROM TMSTRAIN_PLEASE_APPROVE_RESULT
-  </sql>
-  <sql id="select_alias">
-    SELECT <include refid="columns_alias"/> FROM TMSTRAIN_PLEASE_APPROVE_RESULT t
-  </sql>
-  <sql id="where">
-    <where>
-      <if test="resultId != null">
-        and RESULT_ID = #{resultId}
-      </if>
-      <if test="railPlanId != null">
-        and RAIL_PLAN_ID = #{railPlanId}
-      </if>
-      <if test="resultPleasePlanNo != null and resultPleasePlanNo != ''">
-        and RESULT_PLEASE_PLAN_NO = #{resultPleasePlanNo}
-      </if>
-      <if test="resultPlanDate != null">
-        and TO_CHAR(RESULT_PLAN_DATE,'yyyy-MM-dd') = #{resultPlanDate}
-      </if>
-      <if test="resultCategory != null and resultCategory != ''">
-        and RESULT_CATEGORY = #{resultCategory}
-      </if>
-      <if test="shipperId != null">
-        and SHIPPER_ID = #{shipperId}
-      </if>
-      <if test="sendStationId != null">
-        and SEND_STATION_ID = #{sendStationId}
-      </if>
-      <if test="toTheStationId != null">
-        and TO_THE_STATION_ID = #{toTheStationId}
-      </if>
-      <if test="resultPleaseNumber != null">
-        and RESULT_PLEASE_NUMBER = #{resultPleaseNumber}
-      </if>
-      <if test="resultPleaseDate != null">
-        and TO_CHAR(RESULT_PLEASE_DATE,'yyyy-MM-dd') = #{resultPleaseDate}
-      </if>
-      <if test="resultApproveNumber != null">
-        and RESULT_APPROVE_NUMBER = #{resultApproveNumber}
-      </if>
-      <if test="resultApproveDate != null">
-        and TO_CHAR(RESULT_APPROVE_DATE,'yyyy-MM-dd') = #{resultApproveDate}
-      </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>
-      <if test="status != null">
-        and STATUS = #{status}
-      </if>
-      <if test="resultType != null">
-        and RESULT_TYPE = #{resultType}
-      </if>
-    </where>
-  </sql>
-  <sql id="whereLike">
-    <where>
-      <if test="resultId != null">
-        and RESULT_ID = #{resultId}
-      </if>
-      <if test="railPlanId != null">
-        and RAIL_PLAN_ID = #{railPlanId}
-      </if>
-      <if test="resultPleasePlanNo != null and resultPleasePlanNo != ''">
-        and RESULT_PLEASE_PLAN_NO LIKE '%${resultPleasePlanNo}%'
-      </if>
-      <if test="resultPlanDate != null">
-        and TO_CHAR(RESULT_PLAN_DATE,'yyyy-MM-dd') = #{resultPlanDate}
-      </if>
-      <if test="resultCategory != null and resultCategory != ''">
-        and RESULT_CATEGORY LIKE '%${resultCategory}%'
-      </if>
-      <if test="shipperId != null">
-        and SHIPPER_ID = #{shipperId}
-      </if>
-      <if test="sendStationId != null">
-        and SEND_STATION_ID = #{sendStationId}
-      </if>
-      <if test="toTheStationId != null">
-        and TO_THE_STATION_ID = #{toTheStationId}
-      </if>
-      <if test="resultPleaseNumber != null">
-        and RESULT_PLEASE_NUMBER = #{resultPleaseNumber}
-      </if>
-      <if test="resultPleaseDate != null">
-        and TO_CHAR(RESULT_PLEASE_DATE,'yyyy-MM-dd') = #{resultPleaseDate}
-      </if>
-      <if test="resultApproveNumber != null">
-        and RESULT_APPROVE_NUMBER = #{resultApproveNumber}
-      </if>
-      <if test="resultApproveDate != null">
-        and TO_CHAR(RESULT_APPROVE_DATE,'yyyy-MM-dd') = #{resultApproveDate}
-      </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>
-      <if test="status != null">
-        and STATUS = #{status}
-      </if>
-      <if test="resultType != null">
-        and RESULT_TYPE = #{resultType}
-      </if>
-    </where>
-  </sql>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
-    delete from TMSTRAIN_PLEASE_APPROVE_RESULT
-    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
-  </delete>
-  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
-    delete from TMSTRAIN_PLEASE_APPROVE_RESULT
-    where 1!=1
-    <if test="railPlanId != null">
-      or RAIL_PLAN_ID = #{railPlanId}
-    </if>
-    <if test="resultPleasePlanNo != null and resultPleasePlanNo != ''">
-      or RESULT_PLEASE_PLAN_NO = #{resultPleasePlanNo}
-    </if>
-    <if test="resultPlanDate != null">
-      or TO_CHAR(RESULT_PLAN_DATE,'yyyy-MM-dd') = '#{resultPlanDate}'
-    </if>
-    <if test="resultCategory != null and resultCategory != ''">
-      or RESULT_CATEGORY = #{resultCategory}
-    </if>
-    <if test="shipperId != null">
-      or SHIPPER_ID = #{shipperId}
-    </if>
-    <if test="sendStationId != null">
-      or SEND_STATION_ID = #{sendStationId}
-    </if>
-    <if test="toTheStationId != null">
-      or TO_THE_STATION_ID = #{toTheStationId}
-    </if>
-    <if test="resultPleaseNumber != null">
-      or RESULT_PLEASE_NUMBER = #{resultPleaseNumber}
-    </if>
-    <if test="resultPleaseDate != null">
-      or TO_CHAR(RESULT_PLEASE_DATE,'yyyy-MM-dd') = '#{resultPleaseDate}'
-    </if>
-    <if test="resultApproveNumber != null">
-      or RESULT_APPROVE_NUMBER = #{resultApproveNumber}
-    </if>
-    <if test="resultApproveDate != null">
-      or TO_CHAR(RESULT_APPROVE_DATE,'yyyy-MM-dd') = '#{resultApproveDate}'
-    </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>
-    <if test="status != null">
-      or STATUS = #{status}
-    </if>
-    <if test="resultType != null">
-      or RESULT_TYPE = #{resultType}
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
-    insert into TMSTRAIN_PLEASE_APPROVE_RESULT (RESULT_ID, RAIL_PLAN_ID, RESULT_PLEASE_PLAN_NO,
-                                                RESULT_PLAN_DATE, RESULT_CATEGORY, SHIPPER_ID,
-                                                SEND_STATION_ID, TO_THE_STATION_ID, RESULT_PLEASE_NUMBER,
-                                                RESULT_PLEASE_DATE, RESULT_APPROVE_NUMBER,
-                                                RESULT_APPROVE_DATE, INSERT_USERNAME, INSERT_TIME,
-                                                UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
-                                                STATUS, RESULT_TYPE)
-    values (#{resultId,jdbcType=DECIMAL}, #{railPlanId,jdbcType=DECIMAL}, #{resultPleasePlanNo,jdbcType=VARCHAR},
-            #{resultPlanDate,jdbcType=TIMESTAMP}, #{resultCategory,jdbcType=VARCHAR}, #{shipperId,jdbcType=DECIMAL},
-            #{sendStationId,jdbcType=DECIMAL}, #{toTheStationId,jdbcType=DECIMAL}, #{resultPleaseNumber,jdbcType=DECIMAL},
-            #{resultPleaseDate,jdbcType=TIMESTAMP}, #{resultApproveNumber,jdbcType=DECIMAL},
-            #{resultApproveDate,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
-            #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
-            #{status,jdbcType=DECIMAL}, #{resultType,jdbcType=DECIMAL})
-  </insert>
-  <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
-    insert into TMSTRAIN_PLEASE_APPROVE_RESULT
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="resultId != null">
-        RESULT_ID,
-      </if>
-      <if test="railPlanId != null">
-        RAIL_PLAN_ID,
-      </if>
-      <if test="resultPleasePlanNo != null">
-        RESULT_PLEASE_PLAN_NO,
-      </if>
-      <if test="resultPlanDate != null">
-        RESULT_PLAN_DATE,
-      </if>
-      <if test="resultCategory != null">
-        RESULT_CATEGORY,
-      </if>
-      <if test="shipperId != null">
-        SHIPPER_ID,
-      </if>
-      <if test="sendStationId != null">
-        SEND_STATION_ID,
-      </if>
-      <if test="toTheStationId != null">
-        TO_THE_STATION_ID,
-      </if>
-      <if test="resultPleaseNumber != null">
-        RESULT_PLEASE_NUMBER,
-      </if>
-      <if test="resultPleaseDate != null">
-        RESULT_PLEASE_DATE,
-      </if>
-      <if test="resultApproveNumber != null">
-        RESULT_APPROVE_NUMBER,
-      </if>
-      <if test="resultApproveDate != null">
-        RESULT_APPROVE_DATE,
-      </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>
-      <if test="status != null">
-        STATUS,
-      </if>
-      <if test="resultType != null">
-        RESULT_TYPE,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="resultId != null">
-        #{resultId,jdbcType=DECIMAL},
-      </if>
-      <if test="railPlanId != null">
-        #{railPlanId,jdbcType=DECIMAL},
-      </if>
-      <if test="resultPleasePlanNo != null">
-        #{resultPleasePlanNo,jdbcType=VARCHAR},
-      </if>
-      <if test="resultPlanDate != null">
-        #{resultPlanDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="resultCategory != null">
-        #{resultCategory,jdbcType=VARCHAR},
-      </if>
-      <if test="shipperId != null">
-        #{shipperId,jdbcType=DECIMAL},
-      </if>
-      <if test="sendStationId != null">
-        #{sendStationId,jdbcType=DECIMAL},
-      </if>
-      <if test="toTheStationId != null">
-        #{toTheStationId,jdbcType=DECIMAL},
-      </if>
-      <if test="resultPleaseNumber != null">
-        #{resultPleaseNumber,jdbcType=DECIMAL},
-      </if>
-      <if test="resultPleaseDate != null">
-        #{resultPleaseDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="resultApproveNumber != null">
-        #{resultApproveNumber,jdbcType=DECIMAL},
-      </if>
-      <if test="resultApproveDate != null">
-        #{resultApproveDate,jdbcType=TIMESTAMP},
-      </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>
-      <if test="status != null">
-        #{status,jdbcType=DECIMAL},
-      </if>
-      <if test="resultType != null">
-        #{resultType,jdbcType=DECIMAL},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
-    update TMSTRAIN_PLEASE_APPROVE_RESULT
-    set RAIL_PLAN_ID = #{railPlanId,jdbcType=DECIMAL},
-        RESULT_PLEASE_PLAN_NO = #{resultPleasePlanNo,jdbcType=VARCHAR},
-        RESULT_PLAN_DATE = #{resultPlanDate,jdbcType=TIMESTAMP},
-        RESULT_CATEGORY = #{resultCategory,jdbcType=VARCHAR},
-        SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
-        SEND_STATION_ID = #{sendStationId,jdbcType=DECIMAL},
-        TO_THE_STATION_ID = #{toTheStationId,jdbcType=DECIMAL},
-        RESULT_PLEASE_NUMBER = #{resultPleaseNumber,jdbcType=DECIMAL},
-        RESULT_PLEASE_DATE = #{resultPleaseDate,jdbcType=TIMESTAMP},
-        RESULT_APPROVE_NUMBER = #{resultApproveNumber,jdbcType=DECIMAL},
-        RESULT_APPROVE_DATE = #{resultApproveDate,jdbcType=TIMESTAMP},
-        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},
-        STATUS = #{status,jdbcType=DECIMAL},
-        RESULT_TYPE = #{resultType,jdbcType=DECIMAL}
-    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
-    update TMSTRAIN_PLEASE_APPROVE_RESULT
-    <set>
-      <if test="railPlanId != null">
-        RAIL_PLAN_ID = #{railPlanId,jdbcType=DECIMAL},
-      </if>
-      <if test="resultPleasePlanNo != null">
-        RESULT_PLEASE_PLAN_NO = #{resultPleasePlanNo,jdbcType=VARCHAR},
-      </if>
-      <if test="resultPlanDate != null">
-        RESULT_PLAN_DATE = #{resultPlanDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="resultCategory != null">
-        RESULT_CATEGORY = #{resultCategory,jdbcType=VARCHAR},
-      </if>
-      <if test="shipperId != null">
-        SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
-      </if>
-      <if test="sendStationId != null">
-        SEND_STATION_ID = #{sendStationId,jdbcType=DECIMAL},
-      </if>
-      <if test="toTheStationId != null">
-        TO_THE_STATION_ID = #{toTheStationId,jdbcType=DECIMAL},
-      </if>
-      <if test="resultPleaseNumber != null">
-        RESULT_PLEASE_NUMBER = #{resultPleaseNumber,jdbcType=DECIMAL},
-      </if>
-      <if test="resultPleaseDate != null">
-        RESULT_PLEASE_DATE = #{resultPleaseDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="resultApproveNumber != null">
-        RESULT_APPROVE_NUMBER = #{resultApproveNumber,jdbcType=DECIMAL},
-      </if>
-      <if test="resultApproveDate != null">
-        RESULT_APPROVE_DATE = #{resultApproveDate,jdbcType=TIMESTAMP},
-      </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>
-      <if test="status != null">
-        STATUS = #{status,jdbcType=DECIMAL},
-      </if>
-      <if test="resultType != null">
-        RESULT_TYPE = #{resultType,jdbcType=DECIMAL},
-      </if>
-    </set>
-    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
-  </update>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
-    <include refid="select"/>
-    where RESULT_ID = #{resultId,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 TMSTRAIN_PLEASE_APPROVE_RESULT
-    (RESULT_ID,
-    RAIL_PLAN_ID, RESULT_PLEASE_PLAN_NO,
-    RESULT_PLAN_DATE, RESULT_CATEGORY,
-    SHIPPER_ID, SEND_STATION_ID, TO_THE_STATION_ID,
-    RESULT_PLEASE_NUMBER, RESULT_PLEASE_DATE,
-    RESULT_APPROVE_NUMBER, RESULT_APPROVE_DATE,
-    INSERT_USERNAME, INSERT_TIME,
-    UPDATE_USERNAME, UPDATE_TIME,
-    INSERT_UPDATE_REMARK, STATUS, RESULT_TYPE
-    )
-    ( <foreach collection="list" item="item" separator="union all">
-    select
-    #{item.resultId,jdbcType=DECIMAL},
-    #{item.railPlanId,jdbcType=DECIMAL}, #{item.resultPleasePlanNo,jdbcType=VARCHAR},
-    #{item.resultPlanDate,jdbcType=TIMESTAMP}, #{item.resultCategory,jdbcType=VARCHAR},
-    #{item.shipperId,jdbcType=DECIMAL}, #{item.sendStationId,jdbcType=DECIMAL}, #{item.toTheStationId,jdbcType=DECIMAL},
-    #{item.resultPleaseNumber,jdbcType=DECIMAL}, #{item.resultPleaseDate,jdbcType=TIMESTAMP},
-    #{item.resultApproveNumber,jdbcType=DECIMAL}, #{item.resultApproveDate,jdbcType=TIMESTAMP},
-    #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
-    #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
-    #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.status,jdbcType=DECIMAL}, #{item.resultType,jdbcType=DECIMAL}
-    from dual
-  </foreach> )
-  </insert>
-  <update id="batchUpdate" parameterType="java.util.List">
-    update TMSTRAIN_PLEASE_APPROVE_RESULT
-    set
-    RESULT_ID=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
-    </foreach>
-    ,RAIL_PLAN_ID=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.railPlanId,jdbcType=DECIMAL}
-    </foreach>
-    ,RESULT_PLEASE_PLAN_NO=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultPleasePlanNo,jdbcType=VARCHAR}
-    </foreach>
-    ,RESULT_PLAN_DATE=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultPlanDate,jdbcType=TIMESTAMP}
-    </foreach>
-    ,RESULT_CATEGORY=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultCategory,jdbcType=VARCHAR}
-    </foreach>
-    ,SHIPPER_ID=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.shipperId,jdbcType=DECIMAL}
-    </foreach>
-    ,SEND_STATION_ID=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.sendStationId,jdbcType=DECIMAL}
-    </foreach>
-    ,TO_THE_STATION_ID=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.toTheStationId,jdbcType=DECIMAL}
-    </foreach>
-    ,RESULT_PLEASE_NUMBER=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultPleaseNumber,jdbcType=DECIMAL}
-    </foreach>
-    ,RESULT_PLEASE_DATE=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultPleaseDate,jdbcType=TIMESTAMP}
-    </foreach>
-    ,RESULT_APPROVE_NUMBER=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultApproveNumber,jdbcType=DECIMAL}
-    </foreach>
-    ,RESULT_APPROVE_DATE=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultApproveDate,jdbcType=TIMESTAMP}
-    </foreach>
-    ,INSERT_USERNAME=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
-    </foreach>
-    ,INSERT_TIME=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
-    </foreach>
-    ,UPDATE_USERNAME=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
-    </foreach>
-    ,UPDATE_TIME=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
-    </foreach>
-    ,INSERT_UPDATE_REMARK=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
-    </foreach>
-    ,STATUS=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.status,jdbcType=DECIMAL}
-    </foreach>
-    ,RESULT_TYPE=
-    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultType,jdbcType=DECIMAL}
-    </foreach>
-    where RESULT_ID in
-    <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
-      #{item.resultId,jdbcType=DECIMAL}
-    </foreach>
-  </update>
-  <delete id="batchDelete" parameterType="java.util.List">
-    delete from TMSTRAIN_PLEASE_APPROVE_RESULT
-    where RESULT_ID in
-    <foreach collection="list" item="id" open="(" close=")" separator=",">
-      #{id}
-    </foreach>
-  </delete>
-  <!-- 友情提示!!!-->
-  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
-
-<!-- 查询未下发0 已下发1 请车作业  -->
-  <select id="getAllWagonPlease" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
-    select
-    *
-    from
-    (
-    select
-    t1.RESULT_ID "resultId", t1.RESULT_PLEASE_PLAN_NO "resultPleasePlanNo",t1.RESULT_PLEASE_NUMBER "resultPleaseNumber",
-    t1.RESULT_PLEASE_DATE "resultPleaseDate",  t1.RESULT_PLAN_DATE "resultPlanDate", t2.SHIPPER_NAME "shipperName",
-    t3.ARRIVAL_NAME "forwardName", t4.ARRIVAL_NAME "arrivalName", t1.RESULT_CATEGORY "resultCategory",
-    t1.INSERT_USERNAME "insertUserName"
-
-    from TMSTRAIN_PLEASE_APPROVE_RESULT t1
-    left join RMS_SHIPPER t2
-    on t1.SHIPPER_ID = t2.SHIPPER_ID
-    left join RMSTRAIN_ARRIVAL_SEND t3
-    on t1.SEND_STATION_ID = t3.ARRIVAL_ID
-    left join RMSTRAIN_ARRIVAL_SEND t4
-    on t1.TO_THE_STATION_ID = t4.ARRIVAL_ID
-
-    where t1.STATUS = #{status} and t1.RESULT_TYPE = #{resultType}
-    )
-    <where>
-      <if test="resultId != null">
-        <foreach collection="resultId" item="item" open="(" separator="or" close=")">
-          "resultId" like '%${item}%'
+    </sql>
+    <sql id="select">
+        SELECT
+        <include refid="columns"/>
+        FROM TMSTRAIN_PLEASE_APPROVE_RESULT
+    </sql>
+    <sql id="select_alias">
+        SELECT
+        <include refid="columns_alias"/>
+        FROM TMSTRAIN_PLEASE_APPROVE_RESULT t
+    </sql>
+    <sql id="where">
+        <where>
+            <if test="resultId != null">
+                and RESULT_ID = #{resultId}
+            </if>
+            <if test="railPlanId != null">
+                and RAIL_PLAN_ID = #{railPlanId}
+            </if>
+            <if test="resultPleasePlanNo != null and resultPleasePlanNo != ''">
+                and RESULT_PLEASE_PLAN_NO = #{resultPleasePlanNo}
+            </if>
+            <if test="resultPlanDate != null">
+                and TO_CHAR(RESULT_PLAN_DATE,'yyyy-MM-dd') = #{resultPlanDate}
+            </if>
+            <if test="resultCategory != null and resultCategory != ''">
+                and RESULT_CATEGORY = #{resultCategory}
+            </if>
+            <if test="shipperId != null">
+                and SHIPPER_ID = #{shipperId}
+            </if>
+            <if test="sendStationId != null">
+                and SEND_STATION_ID = #{sendStationId}
+            </if>
+            <if test="toTheStationId != null">
+                and TO_THE_STATION_ID = #{toTheStationId}
+            </if>
+            <if test="resultPleaseNumber != null">
+                and RESULT_PLEASE_NUMBER = #{resultPleaseNumber}
+            </if>
+            <if test="resultPleaseDate != null">
+                and TO_CHAR(RESULT_PLEASE_DATE,'yyyy-MM-dd') = #{resultPleaseDate}
+            </if>
+            <if test="resultApproveNumber != null">
+                and RESULT_APPROVE_NUMBER = #{resultApproveNumber}
+            </if>
+            <if test="resultApproveDate != null">
+                and TO_CHAR(RESULT_APPROVE_DATE,'yyyy-MM-dd') = #{resultApproveDate}
+            </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>
+            <if test="status != null">
+                and STATUS = #{status}
+            </if>
+            <if test="resultType != null">
+                and RESULT_TYPE = #{resultType}
+            </if>
+        </where>
+    </sql>
+    <sql id="whereLike">
+        <where>
+            <if test="resultId != null">
+                and RESULT_ID = #{resultId}
+            </if>
+            <if test="railPlanId != null">
+                and RAIL_PLAN_ID = #{railPlanId}
+            </if>
+            <if test="resultPleasePlanNo != null and resultPleasePlanNo != ''">
+                and RESULT_PLEASE_PLAN_NO LIKE '%${resultPleasePlanNo}%'
+            </if>
+            <if test="resultPlanDate != null">
+                and TO_CHAR(RESULT_PLAN_DATE,'yyyy-MM-dd') = #{resultPlanDate}
+            </if>
+            <if test="resultCategory != null and resultCategory != ''">
+                and RESULT_CATEGORY LIKE '%${resultCategory}%'
+            </if>
+            <if test="shipperId != null">
+                and SHIPPER_ID = #{shipperId}
+            </if>
+            <if test="sendStationId != null">
+                and SEND_STATION_ID = #{sendStationId}
+            </if>
+            <if test="toTheStationId != null">
+                and TO_THE_STATION_ID = #{toTheStationId}
+            </if>
+            <if test="resultPleaseNumber != null">
+                and RESULT_PLEASE_NUMBER = #{resultPleaseNumber}
+            </if>
+            <if test="resultPleaseDate != null">
+                and TO_CHAR(RESULT_PLEASE_DATE,'yyyy-MM-dd') = #{resultPleaseDate}
+            </if>
+            <if test="resultApproveNumber != null">
+                and RESULT_APPROVE_NUMBER = #{resultApproveNumber}
+            </if>
+            <if test="resultApproveDate != null">
+                and TO_CHAR(RESULT_APPROVE_DATE,'yyyy-MM-dd') = #{resultApproveDate}
+            </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>
+            <if test="status != null">
+                and STATUS = #{status}
+            </if>
+            <if test="resultType != null">
+                and RESULT_TYPE = #{resultType}
+            </if>
+        </where>
+    </sql>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
+        delete
+        from TMSTRAIN_PLEASE_APPROVE_RESULT
+        where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+    </delete>
+    <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+        delete from TMSTRAIN_PLEASE_APPROVE_RESULT
+        where 1!=1
+        <if test="railPlanId != null">
+            or RAIL_PLAN_ID = #{railPlanId}
+        </if>
+        <if test="resultPleasePlanNo != null and resultPleasePlanNo != ''">
+            or RESULT_PLEASE_PLAN_NO = #{resultPleasePlanNo}
+        </if>
+        <if test="resultPlanDate != null">
+            or TO_CHAR(RESULT_PLAN_DATE,'yyyy-MM-dd') = '#{resultPlanDate}'
+        </if>
+        <if test="resultCategory != null and resultCategory != ''">
+            or RESULT_CATEGORY = #{resultCategory}
+        </if>
+        <if test="shipperId != null">
+            or SHIPPER_ID = #{shipperId}
+        </if>
+        <if test="sendStationId != null">
+            or SEND_STATION_ID = #{sendStationId}
+        </if>
+        <if test="toTheStationId != null">
+            or TO_THE_STATION_ID = #{toTheStationId}
+        </if>
+        <if test="resultPleaseNumber != null">
+            or RESULT_PLEASE_NUMBER = #{resultPleaseNumber}
+        </if>
+        <if test="resultPleaseDate != null">
+            or TO_CHAR(RESULT_PLEASE_DATE,'yyyy-MM-dd') = '#{resultPleaseDate}'
+        </if>
+        <if test="resultApproveNumber != null">
+            or RESULT_APPROVE_NUMBER = #{resultApproveNumber}
+        </if>
+        <if test="resultApproveDate != null">
+            or TO_CHAR(RESULT_APPROVE_DATE,'yyyy-MM-dd') = '#{resultApproveDate}'
+        </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>
+        <if test="status != null">
+            or STATUS = #{status}
+        </if>
+        <if test="resultType != null">
+            or RESULT_TYPE = #{resultType}
+        </if>
+    </delete>
+    <insert id="insert" parameterType="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
+        insert into TMSTRAIN_PLEASE_APPROVE_RESULT (RESULT_ID, RAIL_PLAN_ID, RESULT_PLEASE_PLAN_NO,
+                                                    RESULT_PLAN_DATE, RESULT_CATEGORY, SHIPPER_ID,
+                                                    SEND_STATION_ID, TO_THE_STATION_ID, RESULT_PLEASE_NUMBER,
+                                                    RESULT_PLEASE_DATE, RESULT_APPROVE_NUMBER,
+                                                    RESULT_APPROVE_DATE, INSERT_USERNAME, INSERT_TIME,
+                                                    UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
+                                                    STATUS, RESULT_TYPE)
+        values (#{resultId,jdbcType=DECIMAL}, #{railPlanId,jdbcType=DECIMAL}, #{resultPleasePlanNo,jdbcType=VARCHAR},
+                #{resultPlanDate,jdbcType=TIMESTAMP}, #{resultCategory,jdbcType=VARCHAR}, #{shipperId,jdbcType=DECIMAL},
+                #{sendStationId,jdbcType=DECIMAL}, #{toTheStationId,jdbcType=DECIMAL},
+                #{resultPleaseNumber,jdbcType=DECIMAL},
+                #{resultPleaseDate,jdbcType=TIMESTAMP}, #{resultApproveNumber,jdbcType=DECIMAL},
+                #{resultApproveDate,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR},
+                #{insertTime,jdbcType=TIMESTAMP},
+                #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
+                #{insertUpdateRemark,jdbcType=VARCHAR},
+                #{status,jdbcType=DECIMAL}, #{resultType,jdbcType=DECIMAL})
+    </insert>
+    <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
+        insert into TMSTRAIN_PLEASE_APPROVE_RESULT
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="resultId != null">
+                RESULT_ID,
+            </if>
+            <if test="railPlanId != null">
+                RAIL_PLAN_ID,
+            </if>
+            <if test="resultPleasePlanNo != null">
+                RESULT_PLEASE_PLAN_NO,
+            </if>
+            <if test="resultPlanDate != null">
+                RESULT_PLAN_DATE,
+            </if>
+            <if test="resultCategory != null">
+                RESULT_CATEGORY,
+            </if>
+            <if test="shipperId != null">
+                SHIPPER_ID,
+            </if>
+            <if test="sendStationId != null">
+                SEND_STATION_ID,
+            </if>
+            <if test="toTheStationId != null">
+                TO_THE_STATION_ID,
+            </if>
+            <if test="resultPleaseNumber != null">
+                RESULT_PLEASE_NUMBER,
+            </if>
+            <if test="resultPleaseDate != null">
+                RESULT_PLEASE_DATE,
+            </if>
+            <if test="resultApproveNumber != null">
+                RESULT_APPROVE_NUMBER,
+            </if>
+            <if test="resultApproveDate != null">
+                RESULT_APPROVE_DATE,
+            </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>
+            <if test="status != null">
+                STATUS,
+            </if>
+            <if test="resultType != null">
+                RESULT_TYPE,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="resultId != null">
+                #{resultId,jdbcType=DECIMAL},
+            </if>
+            <if test="railPlanId != null">
+                #{railPlanId,jdbcType=DECIMAL},
+            </if>
+            <if test="resultPleasePlanNo != null">
+                #{resultPleasePlanNo,jdbcType=VARCHAR},
+            </if>
+            <if test="resultPlanDate != null">
+                #{resultPlanDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="resultCategory != null">
+                #{resultCategory,jdbcType=VARCHAR},
+            </if>
+            <if test="shipperId != null">
+                #{shipperId,jdbcType=DECIMAL},
+            </if>
+            <if test="sendStationId != null">
+                #{sendStationId,jdbcType=DECIMAL},
+            </if>
+            <if test="toTheStationId != null">
+                #{toTheStationId,jdbcType=DECIMAL},
+            </if>
+            <if test="resultPleaseNumber != null">
+                #{resultPleaseNumber,jdbcType=DECIMAL},
+            </if>
+            <if test="resultPleaseDate != null">
+                #{resultPleaseDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="resultApproveNumber != null">
+                #{resultApproveNumber,jdbcType=DECIMAL},
+            </if>
+            <if test="resultApproveDate != null">
+                #{resultApproveDate,jdbcType=TIMESTAMP},
+            </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>
+            <if test="status != null">
+                #{status,jdbcType=DECIMAL},
+            </if>
+            <if test="resultType != null">
+                #{resultType,jdbcType=DECIMAL},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
+        update TMSTRAIN_PLEASE_APPROVE_RESULT
+        set RAIL_PLAN_ID          = #{railPlanId,jdbcType=DECIMAL},
+            RESULT_PLEASE_PLAN_NO = #{resultPleasePlanNo,jdbcType=VARCHAR},
+            RESULT_PLAN_DATE      = #{resultPlanDate,jdbcType=TIMESTAMP},
+            RESULT_CATEGORY       = #{resultCategory,jdbcType=VARCHAR},
+            SHIPPER_ID            = #{shipperId,jdbcType=DECIMAL},
+            SEND_STATION_ID       = #{sendStationId,jdbcType=DECIMAL},
+            TO_THE_STATION_ID     = #{toTheStationId,jdbcType=DECIMAL},
+            RESULT_PLEASE_NUMBER  = #{resultPleaseNumber,jdbcType=DECIMAL},
+            RESULT_PLEASE_DATE    = #{resultPleaseDate,jdbcType=TIMESTAMP},
+            RESULT_APPROVE_NUMBER = #{resultApproveNumber,jdbcType=DECIMAL},
+            RESULT_APPROVE_DATE   = #{resultApproveDate,jdbcType=TIMESTAMP},
+            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},
+            STATUS                = #{status,jdbcType=DECIMAL},
+            RESULT_TYPE           = #{resultType,jdbcType=DECIMAL}
+        where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstrainPleaseApproveResult">
+        update TMSTRAIN_PLEASE_APPROVE_RESULT
+        <set>
+            <if test="railPlanId != null">
+                RAIL_PLAN_ID = #{railPlanId,jdbcType=DECIMAL},
+            </if>
+            <if test="resultPleasePlanNo != null">
+                RESULT_PLEASE_PLAN_NO = #{resultPleasePlanNo,jdbcType=VARCHAR},
+            </if>
+            <if test="resultPlanDate != null">
+                RESULT_PLAN_DATE = #{resultPlanDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="resultCategory != null">
+                RESULT_CATEGORY = #{resultCategory,jdbcType=VARCHAR},
+            </if>
+            <if test="shipperId != null">
+                SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
+            </if>
+            <if test="sendStationId != null">
+                SEND_STATION_ID = #{sendStationId,jdbcType=DECIMAL},
+            </if>
+            <if test="toTheStationId != null">
+                TO_THE_STATION_ID = #{toTheStationId,jdbcType=DECIMAL},
+            </if>
+            <if test="resultPleaseNumber != null">
+                RESULT_PLEASE_NUMBER = #{resultPleaseNumber,jdbcType=DECIMAL},
+            </if>
+            <if test="resultPleaseDate != null">
+                RESULT_PLEASE_DATE = #{resultPleaseDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="resultApproveNumber != null">
+                RESULT_APPROVE_NUMBER = #{resultApproveNumber,jdbcType=DECIMAL},
+            </if>
+            <if test="resultApproveDate != null">
+                RESULT_APPROVE_DATE = #{resultApproveDate,jdbcType=TIMESTAMP},
+            </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>
+            <if test="status != null">
+                STATUS = #{status,jdbcType=DECIMAL},
+            </if>
+            <if test="resultType != null">
+                RESULT_TYPE = #{resultType,jdbcType=DECIMAL},
+            </if>
+        </set>
+        where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+    </update>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
+        <include refid="select"/>
+        where RESULT_ID = #{resultId,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 TMSTRAIN_PLEASE_APPROVE_RESULT
+        (RESULT_ID,
+        RAIL_PLAN_ID, RESULT_PLEASE_PLAN_NO,
+        RESULT_PLAN_DATE, RESULT_CATEGORY,
+        SHIPPER_ID, SEND_STATION_ID, TO_THE_STATION_ID,
+        RESULT_PLEASE_NUMBER, RESULT_PLEASE_DATE,
+        RESULT_APPROVE_NUMBER, RESULT_APPROVE_DATE,
+        INSERT_USERNAME, INSERT_TIME,
+        UPDATE_USERNAME, UPDATE_TIME,
+        INSERT_UPDATE_REMARK, STATUS, RESULT_TYPE
+        )
+        ( <foreach collection="list" item="item" separator="union all">
+        select
+        #{item.resultId,jdbcType=DECIMAL},
+        #{item.railPlanId,jdbcType=DECIMAL}, #{item.resultPleasePlanNo,jdbcType=VARCHAR},
+        #{item.resultPlanDate,jdbcType=TIMESTAMP}, #{item.resultCategory,jdbcType=VARCHAR},
+        #{item.shipperId,jdbcType=DECIMAL}, #{item.sendStationId,jdbcType=DECIMAL},
+        #{item.toTheStationId,jdbcType=DECIMAL},
+        #{item.resultPleaseNumber,jdbcType=DECIMAL}, #{item.resultPleaseDate,jdbcType=TIMESTAMP},
+        #{item.resultApproveNumber,jdbcType=DECIMAL}, #{item.resultApproveDate,jdbcType=TIMESTAMP},
+        #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
+        #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
+        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.status,jdbcType=DECIMAL},
+        #{item.resultType,jdbcType=DECIMAL}
+        from dual
+    </foreach> )
+    </insert>
+    <update id="batchUpdate" parameterType="java.util.List">
+        update TMSTRAIN_PLEASE_APPROVE_RESULT
+        set
+        RESULT_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
         </foreach>
-      </if>
-
-      <if test="shipperName != null">
-        and
-        <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
-          "shipperName" like '%${item}%'
+        ,RAIL_PLAN_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.railPlanId,jdbcType=DECIMAL}
         </foreach>
-      </if>
-
-      <if test="forwardName != null">
-        and
-        <foreach collection="forwardName" item="item" open="(" separator="or" close=")">
-          "forwardName" like '%${item}%'
+        ,RESULT_PLEASE_PLAN_NO=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultPleasePlanNo,jdbcType=VARCHAR}
         </foreach>
-      </if>
-
-      <if test="resultPleasePlanNo != null">
-        and
-        <foreach collection="resultPleasePlanNo" item="item" open="(" separator="or" close=")">
-          "resultPleasePlanNo" like '%${item}%'
+        ,RESULT_PLAN_DATE=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultPlanDate,jdbcType=TIMESTAMP}
         </foreach>
-      </if>
-
-      <if test="arrivalName != null">
-        and
-        <foreach collection="arrivalName" item="item" open="(" separator="or" close=")">
-          "arrivalName" like '%${item}%'
+        ,RESULT_CATEGORY=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultCategory,jdbcType=VARCHAR}
         </foreach>
-      </if>
-
-      <if test="pleaseCategory != null">
-        and
-        <foreach collection="pleaseCategory" item="item" open="(" separator="or" close=")">
-          "pleaseCategory" like '%${item}%'
+        ,SHIPPER_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.shipperId,jdbcType=DECIMAL}
         </foreach>
-      </if>
-
-      <if test="resultPleaseNumber != null">
-        and
-        <foreach collection="resultPleaseNumber" item="item" open="(" separator="or" close=")">
-          "resultPleaseNumber" like '%${item}%'
+        ,SEND_STATION_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.sendStationId,jdbcType=DECIMAL}
         </foreach>
-      </if>
-
-      <if test="resultPleaseDate != null">
-        and
-        <foreach collection="resultPleaseDate" item="item" open="(" separator="or" close=")">
-          "resultPleaseDate" like '%${item}%'
+        ,TO_THE_STATION_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.toTheStationId,jdbcType=DECIMAL}
         </foreach>
-      </if>
-
-      <if test="resultPlanDate != null">
-        and
-        <foreach collection="resultPlanDate" item="item" open="(" separator="or" close=")">
-          "resultPlanDate" like '%${item}%'
+        ,RESULT_PLEASE_NUMBER=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultPleaseNumber,jdbcType=DECIMAL}
         </foreach>
-      </if>
-      <if test="insertUserName != null">
-        and
-        <foreach collection="insertUserName" item="item" open="(" separator="or" close=")">
-          "insertUserName" like '%${item}%'
+        ,RESULT_PLEASE_DATE=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultPleaseDate,jdbcType=TIMESTAMP}
         </foreach>
-      </if>
-
-    </where>
-    <include refid="orderBy">
-    </include>
-    <if test="orderField == null  ">
-      order by "resultPleaseDate" desc
-    </if>
-
-  </select>
-
-  <!--  排序 -->
-  <sql id="orderBy">
-    <if test="orderField != null and orderField != ''">
-      order by  "${orderField}"
-      <if test="orderType != null and orderType != ''">
-        ${orderType}
-      </if>
-    </if>
-  </sql>
-
-
-<!--  查询所有已批车作业 状态码为 2 -->
-  <select id="getAllApproveWagonPlease" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
-    select
-    *
-    from
-    (
-    select
-           t1.RESULT_ID "resultId",
-           t1.RESULT_PLEASE_PLAN_NO "resultPleasePlanNo",
-           t1.RESULT_APPROVE_DATE "resultApproveDate",
-           t1.RESULT_APPROVE_NUMBER "resultApproveNumber",
-           t2.SHIPPER_NAME "shipperName",
-           t1.RESULT_CATEGORY "resultCategory",
-           t3.ARRIVAL_NAME "forwardName",
-           t4.ARRIVAL_NAME "arrivalName"
-    from TMSTRAIN_PLEASE_APPROVE_RESULT t1
-    left join RMS_SHIPPER t2
-    on t1.SHIPPER_ID = t2.SHIPPER_ID
-    left join RMSTRAIN_ARRIVAL_SEND t3
-    on t1.SEND_STATION_ID = t3.ARRIVAL_ID
-    left join RMSTRAIN_ARRIVAL_SEND t4
-    on t1.TO_THE_STATION_ID = t4.ARRIVAL_ID
-
-    where t1.STATUS = 2 and t1.RESULT_TYPE = #{resultType}
-    )
-    <where>
-      <if test="resultId != null">
-        <foreach collection="resultId" item="item" open="(" separator="or" close=")">
-          "resultId" like '%${item}%'
+        ,RESULT_APPROVE_NUMBER=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultApproveNumber,jdbcType=DECIMAL}
         </foreach>
-      </if>
-
-      <if test="shipperName != null">
-        and
-        <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
-          "shipperName" like '%${item}%'
+        ,RESULT_APPROVE_DATE=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultApproveDate,jdbcType=TIMESTAMP}
         </foreach>
-      </if>
-
-      <if test="forwardName != null">
-        and
-        <foreach collection="forwardName" item="item" open="(" separator="or" close=")">
-          "forwardName" like '%${item}%'
+        ,INSERT_USERNAME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
         </foreach>
-      </if>
-
-      <if test="resultPleasePlanNo != null">
-        and
-        <foreach collection="resultPleasePlanNo" item="item" open="(" separator="or" close=")">
-          "resultPleasePlanNo" like '%${item}%'
+        ,INSERT_TIME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
         </foreach>
-      </if>
-
-      <if test="arrivalName != null">
-        and
-        <foreach collection="arrivalName" item="item" open="(" separator="or" close=")">
-          "arrivalName" like '%${item}%'
+        ,UPDATE_USERNAME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
         </foreach>
-      </if>
-
-      <if test="pleaseCategory != null">
-        and
-        <foreach collection="pleaseCategory" item="item" open="(" separator="or" close=")">
-          "pleaseCategory" like '%${item}%'
+        ,UPDATE_TIME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
         </foreach>
-      </if>
-
-      <if test="resultApproveDate != null">
-        and
-        <foreach collection="resultApproveDate" item="item" open="(" separator="or" close=")">
-          "resultApproveDate" like '%${item}%'
+        ,INSERT_UPDATE_REMARK=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
         </foreach>
-      </if>
-
-      <if test="resultApproveNumber != null">
-        and
-        <foreach collection="resultApproveNumber" item="item" open="(" separator="or" close=")">
-          "resultApproveNumber" like '%${item}%'
+        ,STATUS=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.status,jdbcType=DECIMAL}
+        </foreach>
+        ,RESULT_TYPE=
+        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultType,jdbcType=DECIMAL}
+        </foreach>
+        where RESULT_ID in
+        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+            #{item.resultId,jdbcType=DECIMAL}
+        </foreach>
+    </update>
+    <delete id="batchDelete" parameterType="java.util.List">
+        delete from TMSTRAIN_PLEASE_APPROVE_RESULT
+        where RESULT_ID in
+        <foreach collection="list" item="id" open="(" close=")" separator=",">
+            #{id}
         </foreach>
-      </if>
-    </where>
-    <include refid="orderBy">
-    </include>
-    <if test="orderField == null  ">
-      order by "resultApproveDate" desc
-    </if>
-  </select>
-
-  <!--  //通过Id查询请车作业 getWagonPleaseById(Integer pleasePlanId);-->
-  <select id="getWagonPleaseById" parameterType="int" resultType="java.util.Map">
-    select
-        APAR.RESULT_PLEASE_PLAN_NO "resultPleasePlanNo", APAR.SHIPPER_ID "shipperId", APAR.SEND_STATION_ID "sendStationId",
-        APAR.TO_THE_STATION_ID "toTheStationId", APAR.RESULT_CATEGORY "resultCategory", APAR.RESULT_PLEASE_NUMBER "resultPleaseNumber",
-        APAR.RESULT_PLAN_DATE "resultPlanDate", APAR.INSERT_USERNAME "insertUsername", APAR.RAIL_PLAN_ID "railPlanId"
-    from TMSTRAIN_PLEASE_APPROVE_RESULT APAR
-    where RESULT_ID = #{resultId}
-  </select>
-
-
-  <!-- 通过Id查询批车作业-->
-  <select id="getApproveWagonPleaseById" parameterType="int" resultType="java.util.Map">
-    select
-      AOD.DAYPLAN_NO "dayplanNo",
-      APAR.RESULT_PLEASE_PLAN_NO "resultPleasePlanNo",
-      APAR.RESULT_APPROVE_DATE "resultApproveDate",
-      APAR.RESULT_APPROVE_NUMBER "resultApproveNumber",
-      APAR.SHIPPER_ID "shipperId",
-      APAR.RESULT_CATEGORY "resultCategory",
-      APAR.SEND_STATION_ID "sendStationId",
-      APAR.TO_THE_STATION_ID "toTheStationId"
-    from TMSTRAIN_PLEASE_APPROVE_RESULT APAR
-    left join AMS_RAIL_OFFSET_DAYPLAN AOD
-    on APAR.RAIL_PLAN_ID = AOD.DAYPLAN_ID
-    where RESULT_ID = #{resultId}
-  </select>
-
-
-  <!--  下拉框中获取收货单位 -->
-  <select id="getShipper" resultType="java.util.LinkedHashMap">
-    select
-      RS.SHIPPER_ID "id",
-      RS.SHIPPER_ID "value",
-      RS.SHIPPER_NAME "label"
-    from
-      RMS_SHIPPER RS
-  </select>
-
-  <!--  下拉框中获取发运计划 -->
-  <select id="getRailPlan" resultType="java.util.LinkedHashMap">
-    select
-      AOD.DAYPLAN_ID "id",
-      AOD.DAYPLAN_ID "value",
-      AOD.DAYPLAN_NO "label"
-    from
-      AMS_RAIL_OFFSET_DAYPLAN AOD
-  </select>
-
-  <!--根据id查找用户名    -->
-  <select id="selectPersonNameByPersonnelId" resultType="java.lang.String" parameterType="java.lang.Integer">
-    select RP.PERSONNEL_NAME "personnelName"
-    from  RMS_PERSONNEL RP
-    where RP.PERSONNEL_ID=#{personnelId}
-  </select>
-
-<!--内转物流查询请车计划-->
-  <select id="selectPleaseApprovePlanForConverted" parameterType="java.lang.Integer" resultType="java.util.Map">
-    SELECT RS.SHIPPER_NAME "shipperName",
-           AROD.DAYPLAN_NO "dayplanNo",
-           RM.MATERIAL_NAME "materialName",
-           AROM.OFFSET_MATERIAL_WEIGHT "theoreticalWeight",
-           AROM.OFFSET_MATERIAL_NUMBER "meterialNumber",
-           RAS.ARRIVAL_NAME "arriverName",
-           RAS2.ARRIVAL_NAME "arriverName2",
-           RAS2.DAYPLAN_DEDICATED_LINE "dayPlanDedicatedLine",
-           RC.CONSIGNEE_CONTACT_NAME "deliveryAdress",
-           AROD.DAYPLAN_CONSIGNEE_TEL "tel",
-           AROD.DAYPLAN_CONSIGNEE_NAME  "consigneeName"
-
-    FROM TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
-    LEFT JOIN  AMS_RAIL_OFFSET_DAYPLAN AROD
-    ON  AROD.DAYPLAN_ID=TPAR.RAIL_PLAN_ID
-    LEFT JOIN AMS_RAIL_OFFSET_MATERIAL AROM
-    ON AROM.DAYPLAN_ID=AROD.DAYPLAN_ID
-    LEFT JOIN  RMS_MATERIAL RM
-    ON RM.MATERIAL_ID=AROM.MATERIAL_ID
-    LEFT JOIN RMS_SHIPPER RS
-    ON RS.SHIPPER_ID=TPAR.SHIPPER_ID
-    LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
-    ON RAS.ARRIVAL_ID=TPAR.SEND_STATION_ID
-    LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS2
-    ON RAS2.ARRIVAL_ID=TPAR.TO_THE_STATION_ID
-    LEFT JOIN RMS_CONSIGNEE RC
-    ON RC.CONSIGNEE_ID=AROD.RECEIVING_UNIT_ID
-    WHERE TPAR.STATUS=#{status}
-  </select>
-<!-- 发站/到站下拉框 -->
-  <select id="getArrivalSend" resultType="java.util.LinkedHashMap">
-    select
-      RAS.ARRIVAL_ID "id",
-      RAS.ARRIVAL_ID "value",
-      RAS.ARRIVAL_NAME "label"
-    from
-      RMSTRAIN_ARRIVAL_SEND RAS
-  </select>
-<!-- 请车计划号-->
-  <select id="getPleasePlanNo" resultType="java.util.LinkedHashMap">
-    select TPAR.RESULT_ID "id",
-           TPAR.RESULT_ID "value",
-           TPAR.RESULT_APPROVE_NUMBER "label"
-    from   TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
-  </select>
-
-  <!--通过id渲染查询内转物流请车计划 -->
-  <select id="selectPleasePlanByResultId" parameterType="java.lang.Integer" resultType="java.util.LinkedHashMap">
-    SELECT TPAR.RESULT_PLEASE_PLAN_NO "planNo",
-           TPAR.RAIL_PLAN_ID "planId",
-           TPAR.SEND_STATION_ID "sendStationId",
-           TPAR.RESULT_APPROVE_NUMBER "approveNumber",
-           TPAR.RESULT_APPROVE_DATE "approveDate"
-   FROM TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
-   WHERE TPAR.RESULT_ID=#{resultId}
-  </select>
-
-<!-- 通过id渲染批车计划 -->
-  <select id="selectApproveBYResultId" parameterType="java.lang.Integer" resultType="java.util.LinkedHashMap">
-    SELECT TPAR.RESULT_PLEASE_PLAN_NO "pleaseNo",
-           TPAR.RESULT_APPROVE_NUMBER "approveNumber",
-           TPAR.RESULT_APPROVE_DATE "approveDate"
-    FROM TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
-    WHERE TPAR.RESULT_ID=#{resultId}
-  </select>
+    </delete>
+    <!-- 友情提示!!!-->
+    <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
+    <!-- 查询未下发0 已下发1 请车作业  -->
+    <select id="getAllWagonPlease" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
+        select
+        *
+        from
+        (
+        select
+        t1.RESULT_ID "resultId",
+               t1.RESULT_PLEASE_PLAN_NO "resultPleasePlanNo",
+               t1.RESULT_PLEASE_NUMBER "resultPleaseNumber",
+        TO_CHAR(t1.RESULT_PLEASE_DATE , 'yyyy-mm-dd')"resultPleaseDate",
+        TO_CHAR(t1.RESULT_PLAN_DATE, 'yyyy-mm-dd')  "resultPlanDate",
+               t2.SHIPPER_NAME "shipperName",
+        t3.ARRIVAL_NAME "forwardName",
+               t4.ARRIVAL_NAME "arrivalName",
+               t1.RESULT_CATEGORY "resultCategory",
+        t1.INSERT_USERNAME "insertUserName"
+
+        from TMSTRAIN_PLEASE_APPROVE_RESULT t1
+        left join RMS_SHIPPER t2
+        on t1.SHIPPER_ID = t2.SHIPPER_ID
+        left join RMSTRAIN_ARRIVAL_SEND t3
+        on t1.SEND_STATION_ID = t3.ARRIVAL_ID
+        left join RMSTRAIN_ARRIVAL_SEND t4
+        on t1.TO_THE_STATION_ID = t4.ARRIVAL_ID
+
+        where t1.STATUS = #{status} and t1.RESULT_TYPE = #{resultType}
+        )
+        <where>
+            <if test="resultId != null">
+                <foreach collection="resultId" item="item" open="(" separator="or" close=")">
+                    "resultId" 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="forwardName != null">
+                and
+                <foreach collection="forwardName" item="item" open="(" separator="or" close=")">
+                    "forwardName" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="resultPleasePlanNo != null">
+                and
+                <foreach collection="resultPleasePlanNo" item="item" open="(" separator="or" close=")">
+                    "resultPleasePlanNo" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="arrivalName != null">
+                and
+                <foreach collection="arrivalName" item="item" open="(" separator="or" close=")">
+                    "arrivalName" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="pleaseCategory != null">
+                and
+                <foreach collection="pleaseCategory" item="item" open="(" separator="or" close=")">
+                    "pleaseCategory" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="resultPleaseNumber != null">
+                and
+                <foreach collection="resultPleaseNumber" item="item" open="(" separator="or" close=")">
+                    "resultPleaseNumber" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="resultPleaseDate != null">
+                and
+                <foreach collection="resultPleaseDate" item="item" open="(" separator="or" close=")">
+                    "resultPleaseDate" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="resultPlanDate != null">
+                and
+                <foreach collection="resultPlanDate" item="item" open="(" separator="or" close=")">
+                    "resultPlanDate" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="insertUserName != null">
+                and
+                <foreach collection="insertUserName" item="item" open="(" separator="or" close=")">
+                    "insertUserName" like '%${item}%'
+                </foreach>
+            </if>
+
+        </where>
+        <include refid="orderBy">
+        </include>
+        <if test="orderField == null  ">
+            order by "resultPleaseDate" desc
+        </if>
+
+    </select>
+
+    <!--  排序 -->
+    <sql id="orderBy">
+        <if test="orderField != null and orderField != ''">
+            order by "${orderField}"
+            <if test="orderType != null and orderType != ''">
+                ${orderType}
+            </if>
+        </if>
+    </sql>
+
+
+    <!--  查询所有已批车作业 状态码为 2 -->
+    <select id="getAllApproveWagonPlease" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
+        select
+        *
+        from
+        (
+        select
+        t1.RESULT_ID "resultId",
+        t1.RESULT_PLEASE_PLAN_NO "resultPleasePlanNo",
+        TO_CHAR(t1.RESULT_APPROVE_DATE, 'yyyy-mm-dd') "resultApproveDate",
+        t1.RESULT_APPROVE_NUMBER "resultApproveNumber",
+        t2.SHIPPER_NAME "shipperName",
+        t1.RESULT_CATEGORY "resultCategory",
+        t3.ARRIVAL_NAME "forwardName",
+        t4.ARRIVAL_NAME "arrivalName"
+        from TMSTRAIN_PLEASE_APPROVE_RESULT t1
+        left join RMS_SHIPPER t2
+        on t1.SHIPPER_ID = t2.SHIPPER_ID
+        left join RMSTRAIN_ARRIVAL_SEND t3
+        on t1.SEND_STATION_ID = t3.ARRIVAL_ID
+        left join RMSTRAIN_ARRIVAL_SEND t4
+        on t1.TO_THE_STATION_ID = t4.ARRIVAL_ID
+
+        where t1.STATUS = 2 and t1.RESULT_TYPE = #{resultType}
+        )
+        <where>
+            <if test="resultId != null">
+                <foreach collection="resultId" item="item" open="(" separator="or" close=")">
+                    "resultId" 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="forwardName != null">
+                and
+                <foreach collection="forwardName" item="item" open="(" separator="or" close=")">
+                    "forwardName" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="resultPleasePlanNo != null">
+                and
+                <foreach collection="resultPleasePlanNo" item="item" open="(" separator="or" close=")">
+                    "resultPleasePlanNo" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="arrivalName != null">
+                and
+                <foreach collection="arrivalName" item="item" open="(" separator="or" close=")">
+                    "arrivalName" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="pleaseCategory != null">
+                and
+                <foreach collection="pleaseCategory" item="item" open="(" separator="or" close=")">
+                    "pleaseCategory" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="resultApproveDate != null">
+                and
+                <foreach collection="resultApproveDate" item="item" open="(" separator="or" close=")">
+                    "resultApproveDate" like '%${item}%'
+                </foreach>
+            </if>
+
+            <if test="resultApproveNumber != null">
+                and
+                <foreach collection="resultApproveNumber" item="item" open="(" separator="or" close=")">
+                    "resultApproveNumber" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy">
+        </include>
+        <if test="orderField == null  ">
+            order by "resultApproveDate" desc
+        </if>
+    </select>
+
+    <!--  //通过Id查询请车作业 getWagonPleaseById(Integer pleasePlanId);-->
+    <select id="getWagonPleaseById" parameterType="int" resultType="java.util.Map">
+        select APAR.RESULT_PLEASE_PLAN_NO "resultPleasePlanNo",
+               APAR.SHIPPER_ID            "shipperId",
+               APAR.SEND_STATION_ID       "sendStationId",
+               APAR.TO_THE_STATION_ID     "toTheStationId",
+               APAR.RESULT_CATEGORY       "resultCategory",
+               APAR.RESULT_PLEASE_NUMBER  "resultPleaseNumber",
+               APAR.RESULT_PLAN_DATE      "resultPlanDate",
+               APAR.INSERT_USERNAME       "insertUsername",
+               APAR.RAIL_PLAN_ID          "railPlanId",
+               APAR.RESULT_PLEASE_DATE    "resultPleaseDate",
+               APAR.RESULT_APPROVE_DATE   "resultApproveDate",
+               APAR.RESULT_APPROVE_NUMBER "resultApproveNumber"
+        from TMSTRAIN_PLEASE_APPROVE_RESULT APAR
+        where RESULT_ID = #{resultId}
+    </select>
+
+
+    <!-- 通过Id查询批车作业-->
+    <select id="getApproveWagonPleaseById" parameterType="int" resultType="java.util.Map">
+        select AOD.DAYPLAN_NO             "dayplanNo",
+               APAR.RESULT_PLEASE_PLAN_NO "resultPleasePlanNo",
+               APAR.RESULT_APPROVE_DATE   "resultApproveDate",
+               APAR.RESULT_APPROVE_NUMBER "resultApproveNumber",
+               APAR.SHIPPER_ID            "shipperId",
+               APAR.RESULT_CATEGORY       "resultCategory",
+               APAR.SEND_STATION_ID       "sendStationId",
+               APAR.TO_THE_STATION_ID     "toTheStationId"
+        from TMSTRAIN_PLEASE_APPROVE_RESULT APAR
+                 left join AMS_RAIL_OFFSET_DAYPLAN AOD
+                           on APAR.RAIL_PLAN_ID = AOD.DAYPLAN_ID
+        where RESULT_ID = #{resultId}
+    </select>
+
+
+    <!--  下拉框中获取收货单位 -->
+    <select id="getShipper" resultType="java.util.LinkedHashMap">
+        select RS.SHIPPER_ID   "id",
+               RS.SHIPPER_ID   "value",
+               RS.SHIPPER_NAME "label"
+        from RMS_SHIPPER RS
+    </select>
+
+    <!--  下拉框中获取发运计划 -->
+    <select id="getRailPlan" resultType="java.util.LinkedHashMap">
+        select AOD.DAYPLAN_ID "id",
+               AOD.DAYPLAN_ID "value",
+               AOD.DAYPLAN_NO "label"
+        from AMS_RAIL_OFFSET_DAYPLAN AOD
+    </select>
+
+    <!--根据id查找用户名    -->
+    <select id="selectPersonNameByPersonnelId" resultType="java.lang.String" parameterType="java.lang.Integer">
+        select RP.PERSONNEL_NAME "personnelName"
+        from RMS_PERSONNEL RP
+        where RP.PERSONNEL_ID = #{personnelId}
+    </select>
+
+    <!--内转物流查询请车计划-->
+    <select id="selectPleaseApprovePlanForConverted" parameterType="java.util.Map" resultType="java.util.Map">
+        SELECT
+               TPAR.RESULT_ID "resultId",
+               AROD.DAYPLAN_ID "dayplanId",
+               TPAR.RESULT_PLEASE_PLAN_NO "resultPleasePlanNo",
+               TPAR.RESULT_PLEASE_NUMBER "resultPleaseNumber",
+               TPAR.INSERT_USERNAME "insertUsername",
+               TO_CHAR(TPAR.RESULT_PLEASE_DATE, 'yyyy-mm-dd') "resultPleaseDate",
+               AROD.DAYPLAN_NO             "dayplanNo",
+               RS.SHIPPER_NAME             "shipperName",
+               TO_CHAR(AROD.DAYPLAN_DATE,'yyyy-mm-dd')  "dayplanDate",
+               RAS.ARRIVAL_NAME            "dayplanSendStationName",
+               RAS2.ARRIVAL_NAME           "dayplanToTheStationName",
+               RAS2.DAYPLAN_DEDICATED_LINE "dayPlanDedicatedLine",
+               RC.CONSIGNEE_COMPANY_NAME   "consigneeCompanyName",
+               AROD.DAYPLAN_CONSIGNEE_TEL  "dayplanConsigneeTel",
+               AROD.DAYPLAN_CONSIGNEE_NAME "dayplanConsigneeName",
+               TO_char(TPAR.RESULT_APPROVE_DATE, 'yyyy-mm-dd') "resultApproveDate",
+               TPAR.RESULT_APPROVE_NUMBER "resultApproveNumber",
+               TO_CHAR(AROD.DAYPLAN_DELIVERY_DATE, 'yyyy-mm-dd') "dayplanDeliveryDate"
+        FROM TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
+                 LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
+                           ON AROD.DAYPLAN_ID = TPAR.RAIL_PLAN_ID
+                 LEFT JOIN RMS_SHIPPER RS
+                           ON RS.SHIPPER_ID = AROD.SHIPPER_ID
+                 LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS --发站
+                           ON AROD.DAYPLAN_SEND_STATION_ID = RAS.ARRIVAL_ID
+                 LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS2 --到站
+                           ON AROD.DAYPLAN_TO_THE_STATION_ID = RAS2.ARRIVAL_ID
+                 LEFT JOIN RMS_SHIPPER RSH
+                           ON RSH.SHIPPER_ID = AROD.SHIPPER_ID
+                 LEFT JOIN RMS_CONSIGNEE RC
+                           ON RC.CONSIGNEE_ID = AROD.RECEIVING_UNIT_ID
+        WHERE
+              TPAR.STATUS = #{status}
+              AND TPAR.RESULT_TYPE = 4
+              <if test="resultId != null">
+                AND TPAR.RESULT_ID = #{resultId}
+              </if>
+    </select>
+
+    <!-- 发站/到站下拉框 -->
+    <select id="getArrivalSend" resultType="java.util.LinkedHashMap">
+        select RAS.ARRIVAL_ID   "id",
+               RAS.ARRIVAL_ID   "value",
+               RAS.ARRIVAL_NAME "label"
+        from RMSTRAIN_ARRIVAL_SEND RAS
+    </select>
+    <!-- 请车计划号-->
+    <select id="getPleasePlanNo" resultType="java.util.LinkedHashMap">
+        select TPAR.RESULT_ID             "id",
+               TPAR.RESULT_ID             "value",
+               TPAR.RESULT_APPROVE_NUMBER "label"
+        from TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
+    </select>
+
+    <!--通过id渲染查询内转物流请车计划 -->
+    <select id="selectPleasePlanByResultId" parameterType="java.lang.Integer" resultType="java.util.LinkedHashMap">
+        SELECT TPAR.RESULT_PLEASE_PLAN_NO "planNo",
+               TPAR.RAIL_PLAN_ID          "planId",
+               TPAR.SEND_STATION_ID       "sendStationId",
+               TPAR.RESULT_APPROVE_NUMBER "approveNumber",
+               TPAR.RESULT_APPROVE_DATE   "approveDate"
+        FROM TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
+        WHERE TPAR.RESULT_ID = #{resultId}
+    </select>
+
+    <!-- 通过id渲染批车计划 -->
+    <select id="selectApproveBYResultId" parameterType="java.lang.Integer" resultType="java.util.LinkedHashMap">
+        SELECT TPAR.RESULT_PLEASE_PLAN_NO "pleaseNo",
+               TPAR.RESULT_APPROVE_NUMBER "approveNumber",
+               TPAR.RESULT_APPROVE_DATE   "approveDate"
+        FROM TMSTRAIN_PLEASE_APPROVE_RESULT TPAR
+        WHERE TPAR.RESULT_ID = #{resultId}
+    </select>
 </mapper>

+ 380 - 0
src/main/resources/com/steerinfo/dil/mapper/TmstrainTotalResultMapper.xml

@@ -0,0 +1,380 @@
+<?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.TmstrainTotalResultMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstrainTotalResult">
+    <id column="TOTAL_RESULT_ID" jdbcType="DECIMAL" property="totalResultId" />
+    <result column="LOADING_ID" jdbcType="DECIMAL" property="loadingId" />
+    <result column="UNLOADING_ID" jdbcType="DECIMAL" property="unloadingId" />
+    <result column="RESULT_TOTAL_STAY_DURATION" jdbcType="DECIMAL" property="resultTotalStayDuration" />
+    <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">
+    TOTAL_RESULT_ID, LOADING_ID, UNLOADING_ID, RESULT_TOTAL_STAY_DURATION, STANDARD_DATA_ID, 
+    RESULT_OUTLIER, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+  </sql>
+  <sql id="columns_alias">
+    t.TOTAL_RESULT_ID, t.LOADING_ID, t.UNLOADING_ID, t.RESULT_TOTAL_STAY_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 TMSTRAIN_TOTAL_RESULT
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias" /> FROM TMSTRAIN_TOTAL_RESULT t
+  </sql>
+  <sql id="where">
+    <where>
+      <if test="totalResultId != null">
+        and TOTAL_RESULT_ID = #{totalResultId}
+      </if>
+      <if test="loadingId != null">
+        and LOADING_ID = #{loadingId}
+      </if>
+      <if test="unloadingId != null">
+        and UNLOADING_ID = #{unloadingId}
+      </if>
+      <if test="resultTotalStayDuration != null">
+        and RESULT_TOTAL_STAY_DURATION = #{resultTotalStayDuration}
+      </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="totalResultId != null">
+        and TOTAL_RESULT_ID = #{totalResultId}
+      </if>
+      <if test="loadingId != null">
+        and LOADING_ID = #{loadingId}
+      </if>
+      <if test="unloadingId != null">
+        and UNLOADING_ID = #{unloadingId}
+      </if>
+      <if test="resultTotalStayDuration != null">
+        and RESULT_TOTAL_STAY_DURATION = #{resultTotalStayDuration}
+      </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 TMSTRAIN_TOTAL_RESULT
+    where TOTAL_RESULT_ID = #{totalResultId,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from TMSTRAIN_TOTAL_RESULT
+    where 1!=1
+    <if test="loadingId != null">
+      or LOADING_ID = #{loadingId}
+    </if>
+    <if test="unloadingId != null">
+      or UNLOADING_ID = #{unloadingId}
+    </if>
+    <if test="resultTotalStayDuration != null">
+      or RESULT_TOTAL_STAY_DURATION = #{resultTotalStayDuration}
+    </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.TmstrainTotalResult">
+    insert into TMSTRAIN_TOTAL_RESULT (TOTAL_RESULT_ID, LOADING_ID, UNLOADING_ID,
+                                       RESULT_TOTAL_STAY_DURATION, STANDARD_DATA_ID,
+                                       RESULT_OUTLIER, INSERT_USERNAME, INSERT_TIME,
+                                       UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+    )
+    values (#{totalResultId,jdbcType=DECIMAL}, #{loadingId,jdbcType=DECIMAL}, #{unloadingId,jdbcType=DECIMAL},
+            #{resultTotalStayDuration,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.TmstrainTotalResult">
+    insert into TMSTRAIN_TOTAL_RESULT
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="totalResultId != null">
+        TOTAL_RESULT_ID,
+      </if>
+      <if test="loadingId != null">
+        LOADING_ID,
+      </if>
+      <if test="unloadingId != null">
+        UNLOADING_ID,
+      </if>
+      <if test="resultTotalStayDuration != null">
+        RESULT_TOTAL_STAY_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="totalResultId != null">
+        #{totalResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="loadingId != null">
+        #{loadingId,jdbcType=DECIMAL},
+      </if>
+      <if test="unloadingId != null">
+        #{unloadingId,jdbcType=DECIMAL},
+      </if>
+      <if test="resultTotalStayDuration != null">
+        #{resultTotalStayDuration,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.TmstrainTotalResult">
+    update TMSTRAIN_TOTAL_RESULT
+    set LOADING_ID = #{loadingId,jdbcType=DECIMAL},
+        UNLOADING_ID = #{unloadingId,jdbcType=DECIMAL},
+        RESULT_TOTAL_STAY_DURATION = #{resultTotalStayDuration,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 TOTAL_RESULT_ID = #{totalResultId,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstrainTotalResult">
+    update TMSTRAIN_TOTAL_RESULT
+    <set>
+      <if test="loadingId != null">
+        LOADING_ID = #{loadingId,jdbcType=DECIMAL},
+      </if>
+      <if test="unloadingId != null">
+        UNLOADING_ID = #{unloadingId,jdbcType=DECIMAL},
+      </if>
+      <if test="resultTotalStayDuration != null">
+        RESULT_TOTAL_STAY_DURATION = #{resultTotalStayDuration,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 TOTAL_RESULT_ID = #{totalResultId,jdbcType=DECIMAL}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
+    <include refid="select" />
+    where TOTAL_RESULT_ID = #{totalResultId,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 TMSTRAIN_TOTAL_RESULT
+    (TOTAL_RESULT_ID,
+    LOADING_ID, UNLOADING_ID, RESULT_TOTAL_STAY_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.totalResultId,jdbcType=DECIMAL},
+    #{item.loadingId,jdbcType=DECIMAL}, #{item.unloadingId,jdbcType=DECIMAL}, #{item.resultTotalStayDuration,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 TMSTRAIN_TOTAL_RESULT
+    set
+    TOTAL_RESULT_ID=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.totalResultId,jdbcType=DECIMAL}
+    </foreach>
+    ,LOADING_ID=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.loadingId,jdbcType=DECIMAL}
+    </foreach>
+    ,UNLOADING_ID=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.unloadingId,jdbcType=DECIMAL}
+    </foreach>
+    ,RESULT_TOTAL_STAY_DURATION=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.resultTotalStayDuration,jdbcType=DECIMAL}
+    </foreach>
+    ,STANDARD_DATA_ID=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.standardDataId,jdbcType=DECIMAL}
+    </foreach>
+    ,RESULT_OUTLIER=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.resultOutlier,jdbcType=DECIMAL}
+    </foreach>
+    ,INSERT_USERNAME=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
+    </foreach>
+    ,INSERT_TIME=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
+    </foreach>
+    ,UPDATE_USERNAME=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
+    </foreach>
+    ,UPDATE_TIME=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
+    </foreach>
+    ,INSERT_UPDATE_REMARK=
+    <foreach close="end" collection="list" index="index" item="item" open="case TOTAL_RESULT_ID" separator=" ">
+      when #{item.totalResultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
+    </foreach>
+    where TOTAL_RESULT_ID in
+    <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
+      #{item.totalResultId,jdbcType=DECIMAL}
+    </foreach>
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from TMSTRAIN_TOTAL_RESULT
+    where TOTAL_RESULT_ID in
+    <foreach close=")" collection="list" item="id" open="(" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
+<!-- 通过火运实绩Id -->
+  <select id="getTotalIdByLoadingId" parameterType="int" resultType="java.math.BigDecimal">
+     select
+            TTR.TOTAL_RESULT_ID
+     from TMSTRAIN_TOTAL_RESULT TTR
+     where TTR.LOADING_ID = #{loadingId}
+  </select>
+
+</mapper>

+ 356 - 0
src/main/resources/com/steerinfo/dil/mapper/TmstrainTruckTotalResultMapper.xml

@@ -0,0 +1,356 @@
+<?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.TmstrainTruckTotalResultMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstrainTruckTotalResult">
+    <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
+    <result column="TMSTRAIN_TOTAL_RESULT_ID" jdbcType="DECIMAL" property="tmstrainTotalResultId" />
+    <result column="TMSTRUCK_TOTAL_RESULT_ID" jdbcType="DECIMAL" property="tmstruckTotalResultId" />
+    <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
+    <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" />
+    <result column="LOAD_STATUS" jdbcType="DECIMAL" property="loadStatus" />
+  </resultMap>
+  <sql id="columns">
+    RESULT_ID, TMSTRAIN_TOTAL_RESULT_ID, TMSTRUCK_TOTAL_RESULT_ID, MATERIAL_ID, INSERT_USERNAME, 
+    INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, LOAD_STATUS
+  </sql>
+  <sql id="columns_alias">
+    t.RESULT_ID, t.TMSTRAIN_TOTAL_RESULT_ID, t.TMSTRUCK_TOTAL_RESULT_ID, t.MATERIAL_ID, 
+    t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, 
+    t.LOAD_STATUS
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns"/> FROM TMSTRAIN_TRUCK_TOTAL_RESULT
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias"/> FROM TMSTRAIN_TRUCK_TOTAL_RESULT t
+  </sql>
+  <sql id="where">
+    <where>
+      <if test="resultId != null">
+        and RESULT_ID = #{resultId}
+      </if>
+      <if test="tmstrainTotalResultId != null">
+        and TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId}
+      </if>
+      <if test="tmstruckTotalResultId != null">
+        and TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId}
+      </if>
+      <if test="materialId != null">
+        and MATERIAL_ID = #{materialId}
+      </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>
+      <if test="loadStatus != null">
+        and LOAD_STATUS = #{loadStatus}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where>
+      <if test="resultId != null">
+        and RESULT_ID = #{resultId}
+      </if>
+      <if test="tmstrainTotalResultId != null">
+        and TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId}
+      </if>
+      <if test="tmstruckTotalResultId != null">
+        and TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId}
+      </if>
+      <if test="materialId != null">
+        and MATERIAL_ID = #{materialId}
+      </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>
+      <if test="loadStatus != null">
+        and LOAD_STATUS = #{loadStatus}
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
+    delete from TMSTRAIN_TRUCK_TOTAL_RESULT
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from TMSTRAIN_TRUCK_TOTAL_RESULT
+    where 1!=1
+    <if test="tmstrainTotalResultId != null">
+      or TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId}
+    </if>
+    <if test="tmstruckTotalResultId != null">
+      or TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId}
+    </if>
+    <if test="materialId != null">
+      or MATERIAL_ID = #{materialId}
+    </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>
+    <if test="loadStatus != null">
+      or LOAD_STATUS = #{loadStatus}
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.dil.model.TmstrainTruckTotalResult">
+    insert into TMSTRAIN_TRUCK_TOTAL_RESULT (RESULT_ID, TMSTRAIN_TOTAL_RESULT_ID,
+                                             TMSTRUCK_TOTAL_RESULT_ID, MATERIAL_ID, INSERT_USERNAME,
+                                             INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
+                                             INSERT_UPDATE_REMARK, LOAD_STATUS)
+    values (#{resultId,jdbcType=DECIMAL}, #{tmstrainTotalResultId,jdbcType=DECIMAL},
+            #{tmstruckTotalResultId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR},
+            #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
+            #{insertUpdateRemark,jdbcType=VARCHAR}, #{loadStatus,jdbcType=DECIMAL})
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstrainTruckTotalResult">
+    insert into TMSTRAIN_TRUCK_TOTAL_RESULT
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="resultId != null">
+        RESULT_ID,
+      </if>
+      <if test="tmstrainTotalResultId != null">
+        TMSTRAIN_TOTAL_RESULT_ID,
+      </if>
+      <if test="tmstruckTotalResultId != null">
+        TMSTRUCK_TOTAL_RESULT_ID,
+      </if>
+      <if test="materialId != null">
+        MATERIAL_ID,
+      </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>
+      <if test="loadStatus != null">
+        LOAD_STATUS,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="resultId != null">
+        #{resultId,jdbcType=DECIMAL},
+      </if>
+      <if test="tmstrainTotalResultId != null">
+        #{tmstrainTotalResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="tmstruckTotalResultId != null">
+        #{tmstruckTotalResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="materialId != null">
+        #{materialId,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>
+      <if test="loadStatus != null">
+        #{loadStatus,jdbcType=DECIMAL},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstrainTruckTotalResult">
+    update TMSTRAIN_TRUCK_TOTAL_RESULT
+    set TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId,jdbcType=DECIMAL},
+        TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId,jdbcType=DECIMAL},
+        MATERIAL_ID = #{materialId,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},
+        LOAD_STATUS = #{loadStatus,jdbcType=DECIMAL}
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstrainTruckTotalResult">
+    update TMSTRAIN_TRUCK_TOTAL_RESULT
+    <set>
+      <if test="tmstrainTotalResultId != null">
+        TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="tmstruckTotalResultId != null">
+        TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="materialId != null">
+        MATERIAL_ID = #{materialId,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>
+      <if test="loadStatus != null">
+        LOAD_STATUS = #{loadStatus,jdbcType=DECIMAL},
+      </if>
+    </set>
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
+    <include refid="select"/>
+    where RESULT_ID = #{resultId,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 TMSTRAIN_TRUCK_TOTAL_RESULT
+    (RESULT_ID,
+    TMSTRAIN_TOTAL_RESULT_ID, TMSTRUCK_TOTAL_RESULT_ID,
+    MATERIAL_ID, INSERT_USERNAME, INSERT_TIME,
+    UPDATE_USERNAME, UPDATE_TIME,
+    INSERT_UPDATE_REMARK, LOAD_STATUS
+    )
+    ( <foreach collection="list" item="item" separator="union all">
+    select
+    #{item.resultId,jdbcType=DECIMAL},
+    #{item.tmstrainTotalResultId,jdbcType=DECIMAL}, #{item.tmstruckTotalResultId,jdbcType=DECIMAL},
+    #{item.materialId,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
+    #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
+    #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.loadStatus,jdbcType=DECIMAL}
+    from dual
+  </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+    update TMSTRAIN_TRUCK_TOTAL_RESULT
+    set
+    RESULT_ID=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
+    </foreach>
+    ,TMSTRAIN_TOTAL_RESULT_ID=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.tmstrainTotalResultId,jdbcType=DECIMAL}
+    </foreach>
+    ,TMSTRUCK_TOTAL_RESULT_ID=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.tmstruckTotalResultId,jdbcType=DECIMAL}
+    </foreach>
+    ,MATERIAL_ID=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
+    </foreach>
+    ,INSERT_USERNAME=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
+    </foreach>
+    ,INSERT_TIME=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
+    </foreach>
+    ,UPDATE_USERNAME=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
+    </foreach>
+    ,UPDATE_TIME=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
+    </foreach>
+    ,INSERT_UPDATE_REMARK=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
+    </foreach>
+    ,LOAD_STATUS=
+    <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+      when #{item.resultId,jdbcType=DECIMAL} then #{item.loadStatus,jdbcType=DECIMAL}
+    </foreach>
+    where RESULT_ID in
+    <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+      #{item.resultId,jdbcType=DECIMAL}
+    </foreach>
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from TMSTRAIN_TRUCK_TOTAL_RESULT
+    where RESULT_ID in
+    <foreach collection="list" item="id" open="(" close=")" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
+<!-- 通过物资ID和物资汽车总实绩ID和火运总实绩ID查找物资中间表ID -->
+  <select id="getIdByMateAndTruckAndTrainTotalId" resultType="java.lang.Integer">
+        select
+               TTTR.RESULT_ID
+        from TMSTRAIN_TRUCK_TOTAL_RESULT TTTR
+        where TTTR.TMSTRUCK_TOTAL_RESULT_ID = #{truckTotalId}
+              and TTTR.TMSTRAIN_TOTAL_RESULT_ID = #{trainTotalId}
+              and TTTR.MATERIAL_ID = #{materialId}
+  </select>
+
+
+</mapper>

+ 142 - 117
src/main/resources/com/steerinfo/dil/mapper/TmstrainWagonUnloadResultMapper.xml

@@ -772,131 +772,123 @@
     where t_unload.UNLOADING_ID = #{unloadingId}
   </select>
 
-  <select id="selectWagonUnLoadResult" resultType="java.util.Map">
-    select *
-    from (
-    SELECT AROD.DAYPLAN_NO "dayPlanNo",
-    TWUR.RESULT_WAGON_NO "wagonNo",
-    TWUR.RESULT_UNLOAD_TIME "unLoadTime",
-    RAS.ARRIVAL_NAME "arrivelName",
-    RS.SHIPPER_NAME "shipperName",
-    RC.CONSIGNEE_COMPANY_NAME "address",
-    AROD.DAYPLAN_DELIVERY_DATE "deliveryDate",
-    AROD.DAYPLAN_CONSIGNEE_NAME "consigneeName",
-    AROD.DAYPLAN_CONSIGNEE_TEL "tel",
-    RAS.DAYPLAN_DEDICATED_LINE "line",
-    RM.MATERIAL_NAME "materialName",
-    AROM.OFFSET_MATERIAL_WEIGHT "weight",
-    AROM.OFFSET_MATERIAL_NUMBER "number",
-    TWUR.RESULT_ARRIVAL_DATE "arrivaldate",
-    TWUR.INSERT_TIME "insertTime",
-    RW.WAREHOUSE_NAME "warehouseName",
-    TWUR.INSERT_UPDATE_REMARK "remark"
+
+  <select id="selectWagonUnLoadResultForNZ" parameterType="java.util.Map" resultType="java.util.Map">
+    select
+    *
+    from
+    (
+    SELECT  TWUR.UNLOADING_ID            "unloadingId",
+            AROD.DAYPLAN_NO              "dayPlanNo",
+            TWUR.RESULT_WAGON_NO         "resultWagonNo",
+            TO_CHAR(TWUR.RESULT_UNLOAD_TIME, 'yyyy-mm-dd') "resultUnloadTime",
+            RS.SHIPPER_NAME              "shipperName",
+            RC.CONSIGNEE_COMPANY_NAME    "consigneeCompanyName",
+            RAS.ARRIVAL_NAME             "dayplanSendStationName",
+            RAS2.ARRIVAL_NAME            "dayplanToTheStationName",
+            AROD.DAYPLAN_CONSIGNEE_TEL  "dayplanConsigneeTel",
+            AROD.DAYPLAN_CONSIGNEE_NAME "dayplanConsigneeName",
+            AROD.DAYPLAN_DELIVERY_DATE   "dayplanDeliveryDate",
+            RAS2.DAYPLAN_DEDICATED_LINE "dayplanDedicatedLine",
+            TWUR.RESULT_ARRIVAL_DATE     "resultArrivalDate",
+            TWUR.INSERT_TIME             "insertTime",
+            RW.WAREHOUSE_NAME            "warehouseName",
+            TWUR.INSERT_UPDATE_REMARK    "insertUpdateRemark"
     FROM TMSTRAIN_WAGON_UNLOAD_RESULT TWUR
     LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
-    ON AROD.DAYPLAN_ID=TWUR.PURCHASE_ORDER_RAIL_PLAN_ID
+        ON AROD.DAYPLAN_ID = TWUR.PURCHASE_ORDER_RAIL_PLAN_ID
     LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
-    ON RAS.ARRIVAL_ID=AROD.DAYPLAN_TO_THE_STATION_ID
+        ON RAS.ARRIVAL_ID = AROD.DAYPLAN_SEND_STATION_ID
+    LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS2
+        ON RAS2.ARRIVAL_ID = AROD.DAYPLAN_TO_THE_STATION_ID
     LEFT JOIN RMS_SHIPPER RS
-    ON RS.SHIPPER_ID=AROD.SHIPPER_ID
+        ON RS.SHIPPER_ID = AROD.SHIPPER_ID
     LEFT JOIN RMS_CONSIGNEE RC
-    ON RC.CONSIGNEE_ID=AROD.RECEIVING_UNIT_ID
-    LEFT JOIN AMS_RAIL_OFFSET_MATERIAL AROM
-    ON AROM.DAYPLAN_ID=AROD.DAYPLAN_ID
-    LEFT JOIN RMS_MATERIAL RM
-    ON RM.MATERIAL_ID=AROM.MATERIAL_ID
+        ON RC.CONSIGNEE_ID = AROD.RECEIVING_UNIT_ID
     LEFT JOIN RMS_WAREHOUSE RW
-    ON TWUR.UNLOADING_POINT_ID=RW.WAREHOUSE_ID
-    LEFT JOIN RMS_WAREHOUSE_TYPE RWT
-    ON RW.WAREHOUSE_TYPE_ID=RWT.WAREHOUSE_TYPE_ID
-    WHERE RWT.WAREHOUSE_TYPE_ID=2
+        ON TWUR.UNLOADING_POINT_ID = RW.WAREHOUSE_ID
+
+    WHERE TWUR.DELETED = 0 AND TWUR.RESULT_TYPE = 4
     )
     <where>
-  <if test="dayPlanNo!= null">
-    and
-    <foreach collection="dayPlanNo" item="item" open="(" separator="or" close=")">
-      "dayPlanNo" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="wagonNo!= null">
-    and
-    <foreach collection="wagonNo" item="item" open="(" separator="or" close=")">
-      "wagonNo" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="unLoadTime!= null">
-    and
-    <foreach collection="unLoadTime" item="item" open="(" separator="or" close=")">
-      "unLoadTime" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="arrivelName!= null">
-    and
-    <foreach collection="arrivelName" item="item" open="(" separator="or" close=")">
-      "arrivelName" 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="address!= null">
-  and
-  <foreach collection="address" item="item" open="(" separator="or" close=")">
-    "address" like '%${item}%'
-  </foreach>
-  </if>
-  <if test="deliveryDate!= null">
-    and
-    <foreach collection="deliveryDate" item="item" open="(" separator="or" close=")">
-      "deliveryDate" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="consigneeName!= null">
-    and
-    <foreach collection="consigneeName" item="item" open="(" separator="or" close=")">
-      "consigneeName" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="tel!= null">
-    and
-    <foreach collection="tel" item="item" open="(" separator="or" close=")">
-      "tel" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="line!= null">
-    and
-    <foreach collection="line" item="item" open="(" separator="or" close=")">
-      "line" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="materialName!= null">
-    and
-    <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-      "materialName" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="weight!= null">
-    and
-    <foreach collection="weight" item="item" open="(" separator="or" close=")">
-      "weight" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="number!= null">
-    and
-    <foreach collection="number" item="item" open="(" separator="or" close=")">
-      "number" like '%${item}%'
-    </foreach>
-  </if>
-  <if test="arrivaldate!= null">
-    and
-    <foreach collection="arrivaldate" item="item" open="(" separator="or" close=")">
-      "arrivaldate" like '%${item}%'
-    </foreach>
-  </if>
-</where>
+      <if test="dayPlanNo!= null">
+        <foreach collection="dayPlanNo" item="item" open="(" separator="or" close=")">
+          "dayPlanNo" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultWagonNo!= null">
+        and
+        <foreach collection="resultWagonNo" item="item" open="(" separator="or" close=")">
+          "resultWagonNo" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultUnloadTime!= null">
+        and
+        <foreach collection="resultUnloadTime" item="item" open="(" separator="or" close=")">
+          "resultUnloadTime" 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="consigneeCompanyName!= null">
+        and
+        <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
+          "consigneeCompanyName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="dayplanSendStationName!= null">
+      and
+      <foreach collection="dayplanSendStationName" item="item" open="(" separator="or" close=")">
+        "dayplanSendStationName" like '%${item}%'
+      </foreach>
+      </if>
+      <if test="dayplanToTheStationName!= null">
+        and
+        <foreach collection="dayplanToTheStationName" item="item" open="(" separator="or" close=")">
+          "dayplanToTheStationName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="dayplanConsigneeTel!= null">
+        and
+        <foreach collection="dayplanConsigneeTel" item="item" open="(" separator="or" close=")">
+          "dayplanConsigneeTel" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="dayplanConsigneeName!= null">
+        and
+        <foreach collection="dayplanConsigneeName" item="item" open="(" separator="or" close=")">
+          "dayplanConsigneeName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="dayplanDedicatedLine!= null">
+        and
+        <foreach collection="dayplanDedicatedLine" item="item" open="(" separator="or" close=")">
+          "dayplanDedicatedLine" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultArrivalDate!= null">
+        and
+        <foreach collection="resultArrivalDate" item="item" open="(" separator="or" close=")">
+          "resultArrivalDate" 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="insertUpdateRemark!= null">
+        and
+        <foreach collection="insertUpdateRemark" item="item" open="(" separator="or" close=")">
+          "insertUpdateRemark" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
     <include refid="orderBy"></include>
     <if test="orderField == null  ">
       order by "insertTime" desc
@@ -931,4 +923,37 @@
   where t_load.DELETED = 0
   )
   </select>
+
+<!-- 通过运输订单ID查询关联的火运总实绩ID -->
+  <select id="getTotalIdByOrderId" parameterType="java.math.BigDecimal" resultType="java.util.Map">
+    select DISTINCT
+        TTTR.TMSTRAIN_TOTAL_RESULT_ID "trainTotalId",
+        TTTR.TMSTRUCK_TOTAL_RESULT_ID     "truckTotalId"
+    from TMSTRUCK_TOTAL_RESULT TTR
+    LEFT JOIN TMSTRAIN_TRUCK_TOTAL_RESULT TTTR
+    ON TTR.RESULT_TOTAL_ID = TTTR.TMSTRUCK_TOTAL_RESULT_ID
+    WHERE TTR.ORDER_ID = #{orderId}
+  </select>
+
+<!--  通过火运总实绩ID查询火运装车实绩ID-->
+  <select id="getLoadingIdByTrainTotalId"  parameterType="java.math.BigDecimal" resultType="java.lang.Integer">
+        SELECT TTR.LOADING_ID
+        FROM TMSTRAIN_TOTAL_RESULT TTR
+        WHERE TTR.TOTAL_RESULT_ID = #{trainTotalId}
+  </select>
+
+<!--  通过装车实绩ID查询车皮号与发运计划ID -->
+  <select id="getWagonNoAndRailPlanByLoadingId" parameterType="int" resultType="java.util.Map">
+        SELECT TLR.RESULT_WAGON_NO "resultWagonNo",
+               TLR.PURCHASE_ORDER_RAIL_PLAN_ID "railPlanId"
+        FROM TMSTRAIN_LOADING_RESULT TLR
+        WHERE TLR.RESULT_ID = #{loadingId}
+  </select>
+
+<!--  通过车皮号与发运计划ID匹配卸车实绩  -->
+  <select id="getUnloadIdByWagonNoAndRailPlanId" resultType="java.lang.Integer">
+        SELECT TWUR.UNLOADING_ID
+        FROM TMSTRAIN_WAGON_UNLOAD_RESULT TWUR
+        WHERE TWUR.RESULT_WAGON_NO = #{resultWagonNo} AND TWUR.PURCHASE_ORDER_RAIL_PLAN_ID = #{railPlanId}
+  </select>
 </mapper>