liyg 2 anos atrás
pai
commit
dc267dc6b8

+ 3 - 0
src/main/java/com/steerinfo/dil/mapper/QmsQueueListMapper.java

@@ -67,6 +67,9 @@ public interface QmsQueueListMapper extends IBaseMapper<QmsQueueList, BigDecimal
 
     Integer getOrderId(String resultTotalId);
 
+    //根据排队实绩查询订单ID
+    BigDecimal getOrderIdByResultId(BigDecimal resultId);
+
     Integer getSpellingSequenceNumber(Map<String, Object> map);
 
     Integer getListGridNumber(Map<String, Object> map);

+ 22 - 0
src/main/java/com/steerinfo/dil/mapper/SaleLogMapper.java

@@ -0,0 +1,22 @@
+package com.steerinfo.dil.mapper;
+
+import com.steerinfo.dil.model.SaleLog;
+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 SaleLogMapper extends IBaseMapper<SaleLog, BigDecimal> {
+    @Select("select SEQ_SALE_LOG.nextval from dual")
+    BigDecimal selectMaxId();
+
+    //查询所有日志
+    List<Map<String,Object>> selectAllLog(Map<String,Object> map);
+
+    //查询用户名
+    String getUserNameById(Map<String,Object> map);
+}

+ 151 - 0
src/main/java/com/steerinfo/dil/model/SaleLog.java

@@ -0,0 +1,151 @@
+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 SaleLog implements IBasePO<BigDecimal> {
+    @ApiModelProperty(value="",required=true)
+    private BigDecimal resultId;
+
+    /**
+     * 运单ID(ORDER_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="运单ID",required=false)
+    private BigDecimal orderId;
+
+    /**
+     * 销售订单ID(SALE_ORDER_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="销售订单ID",required=false)
+    private BigDecimal saleOrderId;
+
+    /**
+     * 日志描述(DESCRIPTION,VARCHAR,255)
+     */
+    @ApiModelProperty(value="日志描述",required=false)
+    private String description;
+
+    /**
+     * 操作类型(OPRATION_TYPE,VARCHAR,20)
+     */
+    @ApiModelProperty(value="操作类型",required=false)
+    private String oprationType;
+
+    /**
+     * 可能存在的JSON数据(JSON_DATA,VARCHAR,255)
+     */
+    @ApiModelProperty(value="可能存在的JSON数据",required=false)
+    private String jsonData;
+
+    /**
+     * 记录创建时间(INSERT_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="记录创建时间",required=false)
+    private Date insertTime;
+
+    /**
+     * 记录创建人(INSERT_USERNAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="记录创建人",required=false)
+    private String insertUsername;
+
+    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 getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(BigDecimal orderId) {
+        this.orderId = orderId;
+    }
+
+    public BigDecimal getSaleOrderId() {
+        return saleOrderId;
+    }
+
+    public void setSaleOrderId(BigDecimal saleOrderId) {
+        this.saleOrderId = saleOrderId;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description == null ? null : description.trim();
+    }
+
+    public String getOprationType() {
+        return oprationType;
+    }
+
+    public void setOprationType(String oprationType) {
+        this.oprationType = oprationType == null ? null : oprationType.trim();
+    }
+
+    public String getJsonData() {
+        return jsonData;
+    }
+
+    public void setJsonData(String jsonData) {
+        this.jsonData = jsonData == null ? null : jsonData.trim();
+    }
+
+    public Date getInsertTime() {
+        return insertTime;
+    }
+
+    public void setInsertTime(Date insertTime) {
+        this.insertTime = insertTime;
+    }
+
+    public String getInsertUsername() {
+        return insertUsername;
+    }
+
+    public void setInsertUsername(String insertUsername) {
+        this.insertUsername = insertUsername == null ? null : insertUsername.trim();
+    }
+
+    @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(", orderId=").append(orderId);
+        sb.append(", saleOrderId=").append(saleOrderId);
+        sb.append(", description=").append(description);
+        sb.append(", oprationType=").append(oprationType);
+        sb.append(", jsonData=").append(jsonData);
+        sb.append(", insertTime=").append(insertTime);
+        sb.append(", insertUsername=").append(insertUsername);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 18 - 0
src/main/java/com/steerinfo/dil/service/impl/QmsQueueListServiceImpl.java

@@ -9,6 +9,7 @@ import com.steerinfo.dil.model.WebSocketCapacity;
 import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.dil.model.QmsQueueList;
 import com.steerinfo.dil.service.IQmsQueueListService;
+import com.steerinfo.dil.util.SaleLogUtil;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.sun.org.apache.bcel.internal.generic.RETURN;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -65,6 +66,9 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
     @Autowired
     private QmsModelUnrooledMapper qmsModelUnrooledMapper;
 
+    @Autowired
+    private SaleLogUtil saleLogUtil;
+
 
     private final SimpleDateFormat gatepostTimeSdf = new SimpleDateFormat("HHmmss");
 
@@ -117,6 +121,14 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
     public int addQueueList(BigDecimal resultId){
         //通过订单查询有几种物资
         Map<String, Object> mesMap = qmsQueueListMapper.getMaterialNumByOrderId(resultId);
+        try{
+            //记录日志
+            if(mesMap!=null && mesMap.get("orderId")!=null){
+                saleLogUtil.logOrder(DataChange.dataToBigDecimal(mesMap.get("orderId")),"向钢材科申请",null, SaleLogUtil.UPDATE);
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
         int materialNum = DataChange.dataToBigDecimal(mesMap.get("materialNum")).intValue();
         if(materialNum == 1){
             //单拼进入链表
@@ -253,6 +265,12 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
      */
     public int queueCancelSon(Map<String, Object> map){
         BigDecimal resultId = DataChange.dataToBigDecimal(map.get("resultId"));
+        try{
+            //记录日志
+            saleLogUtil.logOrder(DataChange.dataToBigDecimal(qmsQueueListMapper.getOrderIdByResultId(resultId)),"撤销排队,理由:"+map.get("resultCancelReason"),null, SaleLogUtil.UPDATE);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
         //移出队列
         qmsQueueListMapper.deleteByQueueResultId(resultId);
         qmsQueueSpellingListMapper.deleteByQueueResultId(resultId);

+ 11 - 0
src/main/java/com/steerinfo/dil/service/impl/QmsQueueResultServiceImpl.java

@@ -13,6 +13,7 @@ import com.steerinfo.dil.model.QmsQueueResult;
 import com.steerinfo.dil.mapper.QmsQueueResultMapper;
 import com.steerinfo.dil.service.IQmsQueueResultService;
 import com.steerinfo.dil.util.ElectronicFenceUtils;
+import com.steerinfo.dil.util.SaleLogUtil;
 import com.steerinfo.framework.controller.RESTfulResult;
 import oracle.sql.DATE;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -66,6 +67,9 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
     @Autowired
     private QueueInterfaceMapper queueInterfaceMapper;
 
+    @Autowired
+    private SaleLogUtil saleLogUtil;
+
     private String lonlat = "107.4628199,31.1925279"; //中心点坐标
     private String radius = "15000"; //半径
     private String lat1 = "31.1925279";
@@ -109,6 +113,13 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
         //获取传入的车牌号查找最近的运输订单号
         String capacityNo = capacityNumber.substring(0,7);
         Map<String, Object> mesMap = queuingRulesMapper.getOrderNumberByCapacityNumber(capacityNo);
+        try{
+            if(mesMap!=null && mesMap.get("orderId")!=null){
+                saleLogUtil.logOrder(DataChange.dataToBigDecimal(mesMap.get("orderId")),capacityNumber+"触发排队,尚未向钢材科申请",null,SaleLogUtil.UPDATE);
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
         if(mesMap == null){
             judgeCancelSub(capacityNumber); //判断是否需要取消订阅
             return -1;

+ 91 - 0
src/main/java/com/steerinfo/dil/util/SaleLogUtil.java

@@ -0,0 +1,91 @@
+package com.steerinfo.dil.util;
+
+import com.steerinfo.dil.mapper.SaleLogMapper;
+import com.steerinfo.dil.model.SaleLog;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Map;
+
+@Component
+public class SaleLogUtil {
+    @Autowired
+    private SaleLogMapper saleLogMapper;
+
+    public final static int INSERT = 1;
+
+    public final static int UPDATE = 2;
+
+    public final static int DELETE = 3;
+
+    public final static int OPEN = 4;
+
+    public final static int CLOSE = 5;
+
+    /**
+     * 插入运输订单的操作日志
+     * @param orderId
+     * @param descriptoin
+     * @param oprationType 操作类型
+     * @param map 可以传null
+     * @return
+     */
+    public int logOrder(BigDecimal orderId,String descriptoin,Map<String,Object> map,int oprationType){
+        try{
+            SaleLog saleLog=new SaleLog();
+            saleLog.setResultId(saleLogMapper.selectMaxId());
+            saleLog.setOrderId(orderId);
+            saleLog.setDescription(descriptoin);
+            //saleLog.setJsonData(""+map);
+            saleLog.setInsertTime(new Date());
+            saleLog.setInsertUsername(getUserName(map));
+            switch (oprationType){
+                case INSERT:
+                    saleLog.setOprationType("新增");
+                    break;
+                case UPDATE:
+                    saleLog.setOprationType("修改");
+                    break;
+                case DELETE:
+                    saleLog.setOprationType("删除");
+                    break;
+                case OPEN:
+                    saleLog.setOprationType("启用");
+                    break;
+                case CLOSE:
+                    saleLog.setOprationType("关闭");
+                    break;
+                default:
+                    saleLog.setOprationType("未知操作");
+            }
+            return saleLogMapper.insertSelective(saleLog);
+        }catch (Exception e){
+            e.printStackTrace();
+            return -1;
+        }
+    }
+
+    /**
+     * 处理插入用户名
+     * @param map
+     * @return
+     */
+    private String getUserName(Map<String,Object> map){
+        try{
+            if(map==null){
+                return "system";
+            }else if(map.get("userName")!=null){
+                return ""+map.get("userName");
+            }else if(map.get("userId")!=null){
+                return saleLogMapper.getUserNameById(map);
+            }else{
+                return "未知用户";
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+            return "未知用户";
+        }
+    }
+}

+ 10 - 0
src/main/resources/com/steerinfo/dil/mapper/QmsQueueListMapper.xml

@@ -620,6 +620,7 @@
     <select id="getMaterialNumByOrderId" parameterType="java.math.BigDecimal" resultType="map">
 
       select
+             OO.ORDER_ID        "orderId",
              OO.CAPACITY_ID     "capacityId",
              QQR.GRID_ID        "gridId",
              QQR.RESULT_ID      "resultId",
@@ -771,4 +772,13 @@
   <delete id="deleteListByCapacityId" parameterType="java.math.BigDecimal">
     DELETE FROM QMS_QUEUE_LIST QQL WHERE QQL.CAPACITY_ID = #{capacityId}
   </delete>
+  <select id="getOrderIdByResultId" resultType="java.math.BigDecimal">
+    select  OO.ORDER_ID
+    from OMSTRUCK_ORDER OO
+    left join TMSTRUCK_TOTAL_RESULT TTR
+    on OO.ORDER_ID = TTR.ORDER_ID
+    LEFT JOIN QMS_QUEUE_RESULT QQR
+    ON QQR .RESULT_TOTAL_ID = TTR .RESULT_TOTAL_ID
+    WHERE QQR .RESULT_ID = #{resultId}
+  </select>
 </mapper>

+ 332 - 0
src/main/resources/com/steerinfo/dil/mapper/SaleLogMapper.xml

@@ -0,0 +1,332 @@
+<?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.SaleLogMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.SaleLog">
+    <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
+    <result column="ORDER_ID" jdbcType="DECIMAL" property="orderId" />
+    <result column="SALE_ORDER_ID" jdbcType="DECIMAL" property="saleOrderId" />
+    <result column="DESCRIPTION" jdbcType="VARCHAR" property="description" />
+    <result column="OPRATION_TYPE" jdbcType="VARCHAR" property="oprationType" />
+    <result column="JSON_DATA" jdbcType="VARCHAR" property="jsonData" />
+    <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
+    <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
+  </resultMap>
+  <sql id="columns">
+    RESULT_ID, ORDER_ID, SALE_ORDER_ID, DESCRIPTION, OPRATION_TYPE, JSON_DATA, INSERT_TIME, 
+    INSERT_USERNAME
+  </sql>
+  <sql id="columns_alias">
+    t.RESULT_ID, t.ORDER_ID, t.SALE_ORDER_ID, t.DESCRIPTION, t.OPRATION_TYPE, t.JSON_DATA, 
+    t.INSERT_TIME, t.INSERT_USERNAME
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns"/> FROM SALE_LOG
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias"/> FROM SALE_LOG t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="resultId != null">
+        and RESULT_ID = #{resultId}
+      </if>
+      <if test="orderId != null">
+        and ORDER_ID = #{orderId}
+      </if>
+      <if test="saleOrderId != null">
+        and SALE_ORDER_ID = #{saleOrderId}
+      </if>
+      <if test="description != null and description != ''">
+        and DESCRIPTION = #{description}
+      </if>
+      <if test="oprationType != null and oprationType != ''">
+        and OPRATION_TYPE = #{oprationType}
+      </if>
+      <if test="jsonData != null and jsonData != ''">
+        and JSON_DATA = #{jsonData}
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME = #{insertUsername}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="resultId != null">
+        and RESULT_ID = #{resultId}
+      </if>
+      <if test="orderId != null">
+        and ORDER_ID = #{orderId}
+      </if>
+      <if test="saleOrderId != null">
+        and SALE_ORDER_ID = #{saleOrderId}
+      </if>
+      <if test="description != null and description != ''">
+        and DESCRIPTION LIKE '%${description}%'
+      </if>
+      <if test="oprationType != null and oprationType != ''">
+        and OPRATION_TYPE LIKE '%${oprationType}%'
+      </if>
+      <if test="jsonData != null and jsonData != ''">
+        and JSON_DATA LIKE '%${jsonData}%'
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME LIKE '%${insertUsername}%'
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
+    delete from SALE_LOG
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from SALE_LOG
+    where 1!=1 
+      <if test="orderId != null">
+        or ORDER_ID = #{orderId}
+      </if>
+      <if test="saleOrderId != null">
+        or SALE_ORDER_ID = #{saleOrderId}
+      </if>
+      <if test="description != null and description != ''">
+        or DESCRIPTION = #{description}
+      </if>
+      <if test="oprationType != null and oprationType != ''">
+        or OPRATION_TYPE = #{oprationType}
+      </if>
+      <if test="jsonData != null and jsonData != ''">
+        or JSON_DATA = #{jsonData}
+      </if>
+      <if test="insertTime != null">
+        or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        or INSERT_USERNAME = #{insertUsername}
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.dil.model.SaleLog">
+    insert into SALE_LOG (RESULT_ID, ORDER_ID, SALE_ORDER_ID, 
+      DESCRIPTION, OPRATION_TYPE, JSON_DATA, 
+      INSERT_TIME, INSERT_USERNAME)
+    values (#{resultId,jdbcType=DECIMAL}, #{orderId,jdbcType=DECIMAL}, #{saleOrderId,jdbcType=DECIMAL}, 
+      #{description,jdbcType=VARCHAR}, #{oprationType,jdbcType=VARCHAR}, #{jsonData,jdbcType=VARCHAR}, 
+      #{insertTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.dil.model.SaleLog">
+    insert into SALE_LOG
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="resultId != null">
+        RESULT_ID,
+      </if>
+      <if test="orderId != null">
+        ORDER_ID,
+      </if>
+      <if test="saleOrderId != null">
+        SALE_ORDER_ID,
+      </if>
+      <if test="description != null">
+        DESCRIPTION,
+      </if>
+      <if test="oprationType != null">
+        OPRATION_TYPE,
+      </if>
+      <if test="jsonData != null">
+        JSON_DATA,
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME,
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="resultId != null">
+        #{resultId,jdbcType=DECIMAL},
+      </if>
+      <if test="orderId != null">
+        #{orderId,jdbcType=DECIMAL},
+      </if>
+      <if test="saleOrderId != null">
+        #{saleOrderId,jdbcType=DECIMAL},
+      </if>
+      <if test="description != null">
+        #{description,jdbcType=VARCHAR},
+      </if>
+      <if test="oprationType != null">
+        #{oprationType,jdbcType=VARCHAR},
+      </if>
+      <if test="jsonData != null">
+        #{jsonData,jdbcType=VARCHAR},
+      </if>
+      <if test="insertTime != null">
+        #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUsername != null">
+        #{insertUsername,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.SaleLog">
+    update SALE_LOG
+    set ORDER_ID = #{orderId,jdbcType=DECIMAL},
+      SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL},
+      DESCRIPTION = #{description,jdbcType=VARCHAR},
+      OPRATION_TYPE = #{oprationType,jdbcType=VARCHAR},
+      JSON_DATA = #{jsonData,jdbcType=VARCHAR},
+      INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+      INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR}
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.SaleLog">
+    update SALE_LOG
+    <set>
+      <if test="orderId != null">
+        ORDER_ID = #{orderId,jdbcType=DECIMAL},
+      </if>
+      <if test="saleOrderId != null">
+        SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL},
+      </if>
+      <if test="description != null">
+        DESCRIPTION = #{description,jdbcType=VARCHAR},
+      </if>
+      <if test="oprationType != null">
+        OPRATION_TYPE = #{oprationType,jdbcType=VARCHAR},
+      </if>
+      <if test="jsonData != null">
+        JSON_DATA = #{jsonData,jdbcType=VARCHAR},
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+      </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 SALE_LOG 
+      (RESULT_ID, 
+      ORDER_ID, SALE_ORDER_ID, DESCRIPTION, 
+      OPRATION_TYPE, JSON_DATA, INSERT_TIME, 
+      INSERT_USERNAME)
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.resultId,jdbcType=DECIMAL}, 
+      #{item.orderId,jdbcType=DECIMAL}, #{item.saleOrderId,jdbcType=DECIMAL}, #{item.description,jdbcType=VARCHAR}, 
+      #{item.oprationType,jdbcType=VARCHAR}, #{item.jsonData,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP}, 
+      #{item.insertUsername,jdbcType=VARCHAR} from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update SALE_LOG
+     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>
+       ,ORDER_ID=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.orderId,jdbcType=DECIMAL}
+       </foreach>
+       ,SALE_ORDER_ID=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.saleOrderId,jdbcType=DECIMAL}
+       </foreach>
+       ,DESCRIPTION=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.description,jdbcType=VARCHAR}
+       </foreach>
+       ,OPRATION_TYPE=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.oprationType,jdbcType=VARCHAR}
+       </foreach>
+       ,JSON_DATA=
+       <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.jsonData,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>
+       ,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>
+     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 SALE_LOG
+    where RESULT_ID in 
+    <foreach collection="list" item="id" open="(" close=")" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+  <select id="selectAllLog" resultType="java.util.Map">
+    SELECT
+      OO .ORDER_NUMBER "orderNumber",
+      ASO .SALE_NUMBER "saleNumber",
+      RC .CAPACITY_NUMBER "capacityNumber",
+      SL .DESCRIPTION "description",
+      SL .OPRATION_TYPE "operationType",
+      SL .INSERT_USERNAME "insertUserName",
+      SL .INSERT_TIME "insertTime"
+    FROM SALE_LOG SL
+           LEFT JOIN OMSTRUCK_ORDER OO ON OO .ORDER_ID =SL .ORDER_ID
+           LEFT JOIN AMS_SALE_ORDER ASO ON ASO .SALE_ORDER_ID = SL .SALE_ORDER_ID
+           LEFT JOIN RMS_CAPACITY RC ON RC .CAPACITY_ID=OO .CAPACITY_ID
+    <where>
+    <if test="con!=null and con!=''.toString()">
+        OO .ORDER_NUMBER || ASO .SALE_NUMBER || RC .CAPACITY_NUMBER || SL .DESCRIPTION
+        LIKE CONCAT('%',CONCAT(#{con},'%'))
+    </if>
+    <if test="orderId!=null ">
+      AND SL .ORDER_ID = #{orderId}
+    </if>
+    <if test="saleOrderId!=null ">
+      AND SL .SALE_ORDER_ID = #{saleOrderId}
+    </if>
+    <if test="operationType!=null">
+      AND SL .OPRATION_TYPE in
+      <foreach collection="operationType" item="item" open="(" separator="," close=")" >
+          #{item}
+      </foreach>
+    </if>
+    <if test="capacityNumber!=null">
+      AND RC .CAPACITY_NUMBER in
+      <foreach collection="capacityNumber" item="item" open="(" separator="," close=")" >
+        #{item}
+      </foreach>
+    </if>
+    </where>
+  </select>
+    <select id="getUserNameById" resultType="java.lang.String">
+      SELECT USER_NAME FROM SSO.SYS_USER
+      WHERE USER_ID = #{userId}
+      FETCH NEXT 1 ROWS ONLY
+    </select>
+</mapper>