Browse Source

BOM资料修改

chenw 7 years ago
parent
commit
93b13dbc63

+ 1 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/BomController.java

@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
 
 
 import javax.print.Doc;
 import javax.print.Doc;
 
 
+@CrossOrigin
 @RestController
 @RestController
 @RequestMapping("/bom")
 @RequestMapping("/bom")
 public class BomController {
 public class BomController {

+ 4 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BomMapper.java

@@ -4,6 +4,8 @@ import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Bom;
 import com.usoftchina.saas.document.entities.Bom;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
+import java.util.List;
+
 public interface BomMapper extends CommonBaseMapper<Bom> {
 public interface BomMapper extends CommonBaseMapper<Bom> {
     int deleteByPrimaryKey(Long bo_id);
     int deleteByPrimaryKey(Long bo_id);
 
 
@@ -22,4 +24,6 @@ public interface BomMapper extends CommonBaseMapper<Bom> {
     int validateCodeWhenInsert(@Param("code") String code, @Param("companyId") Long companyId);
     int validateCodeWhenInsert(@Param("code") String code, @Param("companyId") Long companyId);
 
 
     int validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long company);
     int validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long company);
+
+    List<Bom> getListData(@Param("condition") String condition, @Param("companyId") Long companyId);
 }
 }

+ 2 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/BomService.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.document.service;
 package com.usoftchina.saas.document.service;
 
 
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
@@ -38,7 +39,7 @@ public interface BomService extends CommonBaseService<BomMapper, Bom> {
      * @param listReqDTO    条件对象
      * @param listReqDTO    条件对象
      * @return
      * @return
      */
      */
-    List<BomList> getListDataByCondition(PageRequest pageRequest, ListReqDTO listReqDTO);
+    PageInfo<Bom> getListDataByCondition(PageRequest pageRequest, ListReqDTO listReqDTO);
 
 
     /**
     /**
      * 通过ID获取主从表数据
      * 通过ID获取主从表数据

+ 26 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BomServiceImpl.java

@@ -1,5 +1,7 @@
 package com.usoftchina.saas.document.service.impl;
 package com.usoftchina.saas.document.service.impl;
 
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -20,6 +22,7 @@ import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
@@ -36,6 +39,7 @@ public class BomServiceImpl extends CommonBaseServiceImpl<BomMapper, Bom> implem
     private MessageLogService messageLogService;
     private MessageLogService messageLogService;
 
 
     @Override
     @Override
+    @Transactional
     public DocBaseDTO saveData(BomList bomList) {
     public DocBaseDTO saveData(BomList bomList) {
         Long id = bomList.getMain().getId();
         Long id = bomList.getMain().getId();
         Long companyId = BaseContextHolder.getCompanyId();
         Long companyId = BaseContextHolder.getCompanyId();
@@ -117,8 +121,28 @@ public class BomServiceImpl extends CommonBaseServiceImpl<BomMapper, Bom> implem
     }
     }
 
 
     @Override
     @Override
-    public List<BomList> getListDataByCondition(PageRequest pageRequest, ListReqDTO listReqDTO) {
-        return null;
+    public PageInfo<Bom> getListDataByCondition(PageRequest page, ListReqDTO listReqDTO) {
+        //设置分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        List<Bom> bomList = getList(listReqDTO);
+        //取分页信息
+        PageInfo<Bom> pageInfo = new PageInfo<Bom>(bomList);
+        return pageInfo;
+    }
+
+    private List<Bom> getList(ListReqDTO listReqDTO) {
+        Long companyId = BaseContextHolder.getCompanyId();
+        String condition = listReqDTO.getFinalCondition();
+        if(condition == null){
+            condition = "1=1";
+        }
+        List<Bom> bomList = getMapper().getListData(condition, companyId);
+        return bomList;
     }
     }
 
 
     @Override
     @Override

+ 28 - 114
applications/document/document-server/src/main/resources/mapper/BomDetailMapper.xml

@@ -11,7 +11,7 @@
     <result column="bd_baseqty" property="bd_baseqty" jdbcType="INTEGER" />
     <result column="bd_baseqty" property="bd_baseqty" jdbcType="INTEGER" />
     <result column="bd_replace" property="bd_replace" jdbcType="VARCHAR" />
     <result column="bd_replace" property="bd_replace" jdbcType="VARCHAR" />
     <result column="bd_remark" property="bd_remark" jdbcType="VARCHAR" />
     <result column="bd_remark" property="bd_remark" jdbcType="VARCHAR" />
-    <result column="comapnyId" property="companyId" jdbcType="INTEGER" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
     <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
     <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
     <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
     <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
     <result column="bd_text1" property="bd_text1" jdbcType="VARCHAR" />
     <result column="bd_text1" property="bd_text1" jdbcType="VARCHAR" />
@@ -22,7 +22,7 @@
   </resultMap>
   </resultMap>
   <sql id="Base_Column_List" >
   <sql id="Base_Column_List" >
     bd_id, bd_bomid, bd_detno, bd_sonid, bd_soncode, bd_unit, bd_baseqty, bd_replace, 
     bd_id, bd_bomid, bd_detno, bd_sonid, bd_soncode, bd_unit, bd_baseqty, bd_replace, 
-    bd_remark, comapnyId, updaterId, updateTime, bd_text1, bd_text2, bd_text3, bd_text4, 
+    bd_remark, companyId, updaterId, updateTime, bd_text1, bd_text2, bd_text3, bd_text4, 
     bd_text5
     bd_text5
   </sql>
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
@@ -39,13 +39,13 @@
     insert into bomdetail (bd_bomid, bd_detno,
     insert into bomdetail (bd_bomid, bd_detno,
       bd_sonid, bd_soncode, bd_unit, 
       bd_sonid, bd_soncode, bd_unit, 
       bd_baseqty, bd_replace, bd_remark, 
       bd_baseqty, bd_replace, bd_remark, 
-      comapnyId, updaterId, updateTime, 
+      companyId, updaterId, updateTime, 
       bd_text1, bd_text2, bd_text3, 
       bd_text1, bd_text2, bd_text3, 
       bd_text4, bd_text5)
       bd_text4, bd_text5)
     values ( #{bd_bomid,jdbcType=INTEGER}, #{bd_detno,jdbcType=INTEGER},
     values ( #{bd_bomid,jdbcType=INTEGER}, #{bd_detno,jdbcType=INTEGER},
       #{bd_sonid,jdbcType=INTEGER}, #{bd_soncode,jdbcType=VARCHAR}, #{bd_unit,jdbcType=VARCHAR}, 
       #{bd_sonid,jdbcType=INTEGER}, #{bd_soncode,jdbcType=VARCHAR}, #{bd_unit,jdbcType=VARCHAR}, 
       #{bd_baseqty,jdbcType=INTEGER}, #{bd_replace,jdbcType=VARCHAR}, #{bd_remark,jdbcType=VARCHAR}, 
       #{bd_baseqty,jdbcType=INTEGER}, #{bd_replace,jdbcType=VARCHAR}, #{bd_remark,jdbcType=VARCHAR}, 
-      #{comapnyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, 
+      #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, 
       #{bd_text1,jdbcType=VARCHAR}, #{bd_text2,jdbcType=VARCHAR}, #{bd_text3,jdbcType=VARCHAR}, 
       #{bd_text1,jdbcType=VARCHAR}, #{bd_text2,jdbcType=VARCHAR}, #{bd_text3,jdbcType=VARCHAR}, 
       #{bd_text4,jdbcType=VARCHAR}, #{bd_text5,jdbcType=VARCHAR})
       #{bd_text4,jdbcType=VARCHAR}, #{bd_text5,jdbcType=VARCHAR})
   </insert>
   </insert>
@@ -76,8 +76,8 @@
       <if test="bd_remark != null" >
       <if test="bd_remark != null" >
         bd_remark,
         bd_remark,
       </if>
       </if>
-      <if test="comapnyId != null" >
-        comapnyId,
+      <if test="companyId != null" >
+        companyId,
       </if>
       </if>
       <if test="updaterId != null" >
       <if test="updaterId != null" >
         updaterId,
         updaterId,
@@ -126,8 +126,8 @@
       <if test="bd_remark != null" >
       <if test="bd_remark != null" >
         #{bd_remark,jdbcType=VARCHAR},
         #{bd_remark,jdbcType=VARCHAR},
       </if>
       </if>
-      <if test="comapnyId != null" >
-        #{comapnyId,jdbcType=INTEGER},
+      <if test="companyId != null" >
+        #{companyId,jdbcType=INTEGER},
       </if>
       </if>
       <if test="updaterId != null" >
       <if test="updaterId != null" >
         #{updaterId,jdbcType=INTEGER},
         #{updaterId,jdbcType=INTEGER},
@@ -179,8 +179,8 @@
       <if test="bd_remark != null" >
       <if test="bd_remark != null" >
         bd_remark = #{bd_remark,jdbcType=VARCHAR},
         bd_remark = #{bd_remark,jdbcType=VARCHAR},
       </if>
       </if>
-      <if test="comapnyId != null" >
-        comapnyId = #{comapnyId,jdbcType=INTEGER},
+      <if test="companyId != null" >
+        companyId = #{companyId,jdbcType=INTEGER},
       </if>
       </if>
       <if test="updaterId != null" >
       <if test="updaterId != null" >
         updaterId = #{updaterId,jdbcType=INTEGER},
         updaterId = #{updaterId,jdbcType=INTEGER},
@@ -216,7 +216,7 @@
       bd_baseqty = #{bd_baseqty,jdbcType=INTEGER},
       bd_baseqty = #{bd_baseqty,jdbcType=INTEGER},
       bd_replace = #{bd_replace,jdbcType=VARCHAR},
       bd_replace = #{bd_replace,jdbcType=VARCHAR},
       bd_remark = #{bd_remark,jdbcType=VARCHAR},
       bd_remark = #{bd_remark,jdbcType=VARCHAR},
-      comapnyId = #{comapnyId,jdbcType=INTEGER},
+      companyId = #{companyId,jdbcType=INTEGER},
       updaterId = #{updaterId,jdbcType=INTEGER},
       updaterId = #{updaterId,jdbcType=INTEGER},
       updateTime = #{updateTime,jdbcType=TIMESTAMP},
       updateTime = #{updateTime,jdbcType=TIMESTAMP},
       bd_text1 = #{bd_text1,jdbcType=VARCHAR},
       bd_text1 = #{bd_text1,jdbcType=VARCHAR},
@@ -227,108 +227,22 @@
     where bd_id = #{id}
     where bd_id = #{id}
   </update>
   </update>
   <insert id="batchInsert" parameterType="java.util.List">
   <insert id="batchInsert" parameterType="java.util.List">
+    INSERT INTO BOMDETAIL (bd_bomid, bd_detno,
+    bd_sonid, bd_soncode, bd_unit,
+    bd_baseqty, bd_replace, bd_remark,
+    companyId, updaterId, updateTime,
+    bd_text1, bd_text2, bd_text3,
+    bd_text4, bd_text5)
+    values
     <foreach collection="list" item="item" index="index" open="" close="" separator=",">
     <foreach collection="list" item="item" index="index" open="" close="" separator=",">
-      INSERT INTO BOMDETAIL
-      <trim prefix="(" suffix=")" suffixOverrides=",">
-        <if test="item.bd_bomid != null" >
-          bd_bomid,
-        </if>
-        <if test="item.bd_detno != null" >
-          bd_detno,
-        </if>
-        <if test="item.bd_sonid != null" >
-          bd_sonid,
-        </if>
-        <if test="item.bd_soncode != null" >
-          bd_soncode,
-        </if>
-        <if test="item.bd_unit != null" >
-          bd_unit,
-        </if>
-        <if test="item.bd_baseqty != null" >
-          bd_baseqty,
-        </if>
-        <if test="item.bd_replace != null" >
-          bd_replace,
-        </if>
-        <if test="item.bd_remark != null" >
-          bd_remark,
-        </if>
-        <if test="item.comapnyId != null" >
-          comapnyId,
-        </if>
-        <if test="item.updaterId != null" >
-          updaterId,
-        </if>
-        <if test="item.updateTime != null" >
-          updateTime,
-        </if>
-        <if test="item.bd_text1 != null" >
-          bd_text1,
-        </if>
-        <if test="item.bd_text2 != null" >
-          bd_text2,
-        </if>
-        <if test="item.bd_text3 != null" >
-          bd_text3,
-        </if>
-        <if test="item.bd_text4 != null" >
-          bd_text4,
-        </if>
-        <if test="item.bd_text5 != null" >
-          bd_text5,
-        </if>
-      </trim>
-      <trim prefix="values (" suffix=")" suffixOverrides="," >
-        <if test="item.bd_bomid != null" >
-          #{item.bd_bomid},
-        </if>
-        <if test="bd_detno != null" >
-          #{item.bd_detno,jdbcType=INTEGER},
-        </if>
-        <if test="bd_sonid != null" >
-          #{item.bd_sonid,jdbcType=INTEGER},
-        </if>
-        <if test="bd_soncode != null" >
-          #{item.bd_soncode,jdbcType=VARCHAR},
-        </if>
-        <if test="bd_unit != null" >
-          #{item.bd_unit,jdbcType=VARCHAR},
-        </if>
-        <if test="bd_baseqty != null" >
-          #{item.bd_baseqty,jdbcType=INTEGER},
-        </if>
-        <if test="bd_replace != null" >
-          #{item.bd_replace,jdbcType=VARCHAR},
-        </if>
-        <if test="bd_remark != null" >
-          #{item.bd_remark,jdbcType=VARCHAR},
-        </if>
-        <if test="comapnyId != null" >
-          #{item.comapnyId,jdbcType=INTEGER},
-        </if>
-        <if test="updaterId != null" >
-          #{item.updaterId,jdbcType=INTEGER},
-        </if>
-        <if test="updateTime != null" >
-          #{item.updateTime,jdbcType=TIMESTAMP},
-        </if>
-        <if test="bd_text1 != null" >
-          #{item.bd_text1,jdbcType=VARCHAR},
-        </if>
-        <if test="bd_text2 != null" >
-          #{item.bd_text2,jdbcType=VARCHAR},
-        </if>
-        <if test="bd_text3 != null" >
-          #{item.bd_text3,jdbcType=VARCHAR},
-        </if>
-        <if test="bd_text4 != null" >
-          #{item.bd_text4,jdbcType=VARCHAR},
-        </if>
-        <if test="bd_text5 != null" >
-          #{item.bd_text5,jdbcType=VARCHAR},
-        </if>
-      </trim>
+      (
+      #{item.bd_bomid,jdbcType=INTEGER}, #{item.bd_detno,jdbcType=INTEGER},
+      #{item.bd_sonid,jdbcType=INTEGER}, #{item.bd_soncode,jdbcType=VARCHAR}, #{item.bd_unit,jdbcType=VARCHAR},
+      #{item.bd_baseqty,jdbcType=INTEGER}, #{item.bd_replace,jdbcType=VARCHAR}, #{item.bd_remark,jdbcType=VARCHAR},
+      #{item.companyId,jdbcType=INTEGER}, #{item.updaterId,jdbcType=INTEGER}, #{item.updateTime,jdbcType=TIMESTAMP},
+      #{item.bd_text1,jdbcType=VARCHAR}, #{item.bd_text2,jdbcType=VARCHAR}, #{item.bd_text3,jdbcType=VARCHAR},
+      #{item.bd_text4,jdbcType=VARCHAR}, #{item.bd_text5,jdbcType=VARCHAR}
+      )
     </foreach>
     </foreach>
   </insert>
   </insert>
 
 
@@ -360,8 +274,8 @@
         <if test="bd_remark != null" >
         <if test="bd_remark != null" >
           bd_remark = #{item.bd_remark,jdbcType=VARCHAR},
           bd_remark = #{item.bd_remark,jdbcType=VARCHAR},
         </if>
         </if>
-        <if test="comapnyId != null" >
-          comapnyId = #{item.comapnyId,jdbcType=INTEGER},
+        <if test="companyId != null" >
+          companyId = #{item.companyId,jdbcType=INTEGER},
         </if>
         </if>
         <if test="updaterId != null" >
         <if test="updaterId != null" >
           updaterId = #{item.updaterId,jdbcType=INTEGER},
           updaterId = #{item.updaterId,jdbcType=INTEGER},

+ 18 - 0
applications/document/document-server/src/main/resources/mapper/BomMapper.xml

@@ -37,6 +37,9 @@
     where bo_id = #{id}
     where bo_id = #{id}
   </delete>
   </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Bom" >
   <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into bom (bo_motherid, bo_mothercode,
     insert into bom (bo_motherid, bo_mothercode,
       bo_mothername, bo_version, bo_status, 
       bo_mothername, bo_version, bo_status, 
       bo_statuscode, bo_recorderid, bo_recorder, 
       bo_statuscode, bo_recorderid, bo_recorder, 
@@ -53,6 +56,9 @@
       )
       )
   </insert>
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
   <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into bom
     insert into bom
     <trim prefix="(" suffix=")" suffixOverrides="," >
     <trim prefix="(" suffix=")" suffixOverrides="," >
       <if test="bo_motherid != null" >
       <if test="bo_motherid != null" >
@@ -251,4 +257,16 @@
   <select id="getCodeById" resultType="string">
   <select id="getCodeById" resultType="string">
       SELECT BO_MOTHERCODE FROM BOM WHERE BO_ID = #{id} and COMPANYID = #{companyId}
       SELECT BO_MOTHERCODE FROM BOM WHERE BO_ID = #{id} and COMPANYID = #{companyId}
   </select>
   </select>
+  <select id="getListData" resultMap="BaseResultMap">
+    SELECT * FROM BOM
+    <where>
+      <if test="condition!=null">
+        ${condition}
+      </if>
+      <if test="companyId!=null">
+        AND companyId = #{companyId}
+      </if>
+    </where>
+    ORDER BY BO_ID
+  </select>
 </mapper>
 </mapper>

+ 16 - 97
applications/document/document-server/src/main/resources/mapper/VendorcontactMapper.xml

@@ -226,103 +226,22 @@
     where vc_id = #{id}
     where vc_id = #{id}
   </update>
   </update>
   <insert id="batchInsert" parameterType="java.util.List">
   <insert id="batchInsert" parameterType="java.util.List">
-    <foreach collection="list" item="item" separator=",">
-      INSERT INTO VENDORCONTACT
-      <trim prefix="(" suffix=")" suffixOverrides=",">
-        <if test="item.vc_veid != null" >
-          vc_veid,
-        </if>
-        <if test="item.vc_detno != null" >
-          vc_detno,
-        </if>
-        <if test="item.vc_name != null" >
-          vc_name,
-        </if>
-        <if test="item.vc_tel != null" >
-          vc_tel,
-        </if>
-        <if test="item.vc_qq != null" >
-          vc_qq,
-        </if>
-        <if test="item.vc_email != null" >
-          vc_email,
-        </if>
-        <if test="item.companyId != null" >
-          companyId,
-        </if>
-        <if test="item.updaterId != null" >
-          updaterId,
-        </if>
-        <if test="item.updateTime != null" >
-          updateTime,
-        </if>
-        <if test="item.vc_text1 != null" >
-          vc_text1,
-        </if>
-        <if test="item.vc_text2 != null" >
-          vc_text2,
-        </if>
-        <if test="item.vc_text3 != null" >
-          vc_text3,
-        </if>
-        <if test="item.vc_text4 != null" >
-          vc_text4,
-        </if>
-        <if test="item.vc_text5 != null" >
-          vc_text5,
-        </if>
-        <if test="item.vc_default != null" >
-          vc_default,
-        </if>
-      </trim>
-
-      <trim prefix="values(" suffix=")" suffixOverrides=",">
-        <if test="item.vc_veid != null" >
-          #{item.vc_veid},
-        </if>
-        <if test="item.vc_detno != null" >
-          #{item.vc_detno,jdbcType=INTEGER},
-        </if>
-        <if test="item.vc_name != null" >
-          #{item.vc_name,jdbcType=VARCHAR},
-        </if>
-        <if test="item.vc_tel != null" >
-          #{item.vc_tel,jdbcType=INTEGER},
-        </if>
-        <if test="item.vc_qq != null" >
-          #{item.vc_qq,jdbcType=VARCHAR},
-        </if>
-        <if test="item.vc_email != null" >
-          #{item.vc_email,jdbcType=VARCHAR},
-        </if>
-        <if test="item.companyId != null" >
-          #{item.companyId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updaterId != null" >
-          #{item.updaterId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updateTime != null" >
-          #{item.updateTime,jdbcType=TIMESTAMP},
-        </if>
-        <if test="item.vc_text1 != null" >
-          #{item.vc_text1,jdbcType=VARCHAR},
-        </if>
-        <if test="item.vc_text2 != null" >
-          #{item.vc_text2,jdbcType=VARCHAR},
-        </if>
-        <if test="item.vc_text3 != null" >
-          #{item.vc_text3,jdbcType=VARCHAR},
-        </if>
-        <if test="item.vc_text4 != null" >
-          #{item.vc_text4,jdbcType=VARCHAR},
-        </if>
-        <if test="item.vc_text5 != null" >
-          #{item.vc_text5,jdbcType=VARCHAR},
-        </if>
-        <if test="item.vc_default != null" >
-          #{item.vc_default,jdbcType=VARCHAR},
-        </if>
-      </trim>
+      INSERT INTO VENDORCONTACT(vc_veid, vc_detno,
+        vc_name, vc_tel, vc_qq,
+        vc_email, companyId, updaterId,
+        updateTime, vc_text1, vc_text2,
+        vc_text3, vc_text4, vc_text5, vc_default
+        )
+        values
+    <foreach collection="list" item="item" index="index" open="" close="" separator=",">
+      (
+      #{item.vc_veid}, #{item.vc_detno,jdbcType=INTEGER},
+      #{item.vc_name,jdbcType=VARCHAR}, #{item.vc_tel,jdbcType=INTEGER}, #{item.vc_qq,jdbcType=VARCHAR},
+      #{item.vc_email,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER}, #{item.updaterId,jdbcType=INTEGER},
+      #{item.updateTime,jdbcType=TIMESTAMP}, #{item.vc_text1,jdbcType=VARCHAR}, #{item.vc_text2,jdbcType=VARCHAR},
+      #{item.vc_text3,jdbcType=VARCHAR}, #{item.vc_text4,jdbcType=VARCHAR}, #{item.vc_text5,jdbcType=VARCHAR},
+      #{item.vc_default,jdbcType=VARCHAR}
+      )
     </foreach>
     </foreach>
   </insert>
   </insert>
   <update id="batchUpdate" parameterType="com.usoftchina.saas.document.entities.Vendorcontact">
   <update id="batchUpdate" parameterType="com.usoftchina.saas.document.entities.Vendorcontact">

+ 26 - 22
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java

@@ -82,15 +82,17 @@ public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> imp
             make.setCreatorId(BaseContextHolder.getUserId());
             make.setCreatorId(BaseContextHolder.getUserId());
 
 
             getMapper().insertSelective(make);
             getMapper().insertSelective(make);
-            //保存明细
-            for (MakeMaterial makeMaterial : makeMaterialList){
-                makeMaterial.setMm_maid(make.getId());
-                makeMaterial.setCompanyId(BaseContextHolder.getCompanyId());
-                makeMaterial.setCreatorId(BaseContextHolder.getUserId());
-                makeMaterial.setCreateTime(new Date());
+            if (makeMaterialList.size() > 0) {
+                //保存明细
+                for (MakeMaterial makeMaterial : makeMaterialList) {
+                    makeMaterial.setMm_maid(make.getId());
+                    makeMaterial.setCompanyId(BaseContextHolder.getCompanyId());
+                    makeMaterial.setCreatorId(BaseContextHolder.getUserId());
+                    makeMaterial.setCreateTime(new Date());
 
 
+                }
+                makeMaterialMapper.batchInsert(makeMaterialList);
             }
             }
-            makeMaterialMapper.batchInsert(makeMaterialList);
             //记录LOG
             //记录LOG
             docBaseDTO = generateMsgObj(make.getId(), make.getMa_code());
             docBaseDTO = generateMsgObj(make.getId(), make.getMa_code());
             messageLogService.save(docBaseDTO);
             messageLogService.save(docBaseDTO);
@@ -103,23 +105,25 @@ public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> imp
 
 
             List<MakeMaterial> updateItems = new ArrayList<MakeMaterial>();
             List<MakeMaterial> updateItems = new ArrayList<MakeMaterial>();
             List<MakeMaterial> insertItems = new ArrayList<MakeMaterial>();
             List<MakeMaterial> insertItems = new ArrayList<MakeMaterial>();
-            //更新从表
-            for (MakeMaterial makeMaterial : makeMaterialList){
-                if(makeMaterial.getId() == 0){
-                    makeMaterial.setCreatorId(BaseContextHolder.getUserId());
-                    makeMaterial.setCreateTime(new Date());
-                    makeMaterial.setCompanyId(BaseContextHolder.getCompanyId());
-                    insertItems.add(makeMaterial);
-                }else{
-                    makeMaterial.setUpdaterId(BaseContextHolder.getUserId());
-                    makeMaterial.setUpdateTime(new Date());
-                    makeMaterial.setCompanyId(BaseContextHolder.getCompanyId());
-                    updateItems.add(makeMaterial);
+            if (makeMaterialList.size() > 0) {
+                //更新从表
+                for (MakeMaterial makeMaterial : makeMaterialList) {
+                    if (makeMaterial.getId() == 0) {
+                        makeMaterial.setCreatorId(BaseContextHolder.getUserId());
+                        makeMaterial.setCreateTime(new Date());
+                        makeMaterial.setCompanyId(BaseContextHolder.getCompanyId());
+                        insertItems.add(makeMaterial);
+                    } else {
+                        makeMaterial.setUpdaterId(BaseContextHolder.getUserId());
+                        makeMaterial.setUpdateTime(new Date());
+                        makeMaterial.setCompanyId(BaseContextHolder.getCompanyId());
+                        updateItems.add(makeMaterial);
+                    }
                 }
                 }
+                //执行插入、更新
+                makeMaterialMapper.batchInsert(insertItems);
+                makeMaterialMapper.batchUpdate(updateItems);
             }
             }
-            //执行插入、更新
-            makeMaterialMapper.batchInsert(insertItems);
-            makeMaterialMapper.batchUpdate(updateItems);
             //记录LOG
             //记录LOG
             docBaseDTO = generateMsgObj(make.getId(), make.getMa_code());
             docBaseDTO = generateMsgObj(make.getId(), make.getMa_code());
             messageLogService.update(docBaseDTO);
             messageLogService.update(docBaseDTO);

+ 16 - 96
applications/storage/storage-server/src/main/resources/mapper/MakematerialMapper.xml

@@ -221,102 +221,22 @@
     DELETE FROM MAKEMATERIAL WHERE MM_MAID=#{id} AND COMPANYID={companyId}
     DELETE FROM MAKEMATERIAL WHERE MM_MAID=#{id} AND COMPANYID={companyId}
   </delete>
   </delete>
   <insert id="batchInsert" parameterType="java.util.List">
   <insert id="batchInsert" parameterType="java.util.List">
-    <foreach collection="list" item="item" separator=",">
-      INSERT INTO MAKEMATERIAL
-      <trim prefix="(" suffix=")" suffixOverrides=",">
-        <if test="item.mm_maid != null" >
-          mm_maid,
-        </if>
-        <if test="item.mm_detno != null" >
-          mm_detno,
-        </if>
-        <if test="item.mm_prodid != null" >
-          mm_prodid,
-        </if>
-        <if test="item.mm_prodcode != null" >
-          mm_prodcode,
-        </if>
-        <if test="item.mm_whid != null" >
-          mm_whid,
-        </if>
-        <if test="item.mm_whcode != null" >
-          mm_whcode,
-        </if>
-        <if test="item.mm_price != null" >
-          mm_price,
-        </if>
-        <if test="item.mm_oneuseqty != null" >
-          mm_oneuseqty,
-        </if>
-        <if test="item.mm_qty != null" >
-          mm_qty,
-        </if>
-        <if test="item.mm_amount != null" >
-          mm_amount,
-        </if>
-        <if test="item.mm_repprodcode != null" >
-          mm_repprodcode,
-        </if>
-        <if test="item.mm_remark != null" >
-          mm_remark,
-        </if>
-        <if test="item.companyId != null" >
-          companyId,
-        </if>
-        <if test="item.updaterId != null" >
-          updaterId,
-        </if>
-        <if test="item.updateTime != null" >
-          updateTime,
-        </if>
-      </trim>
-      <trim prefix="values(" suffix=")" suffixOverrides=",">
-        <if test="item.mm_maid != null" >
-          #{item.mm_maid},
-        </if>
-        <if test="item.mm_detno != null" >
-          #{item.mm_detno,jdbcType=INTEGER},
-        </if>
-        <if test="item.mm_prodid != null" >
-          #{item.mm_prodid,jdbcType=INTEGER},
-        </if>
-        <if test="item.mm_prodcode != null" >
-          #{item.mm_prodcode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.mm_whid != null" >
-          #{item.mm_whid,jdbcType=INTEGER},
-        </if>
-        <if test="item.mm_whcode != null" >
-          #{item.mm_whcode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.mm_price != null" >
-          #{item.mm_price,jdbcType=DOUBLE},
-        </if>
-        <if test="item.mm_oneuseqty != null" >
-          #{item.mm_oneuseqty,jdbcType=DOUBLE},
-        </if>
-        <if test="item.mm_qty != null" >
-          #{item.mm_qty,jdbcType=DOUBLE},
-        </if>
-        <if test="item.mm_amount != null" >
-          #{item.mm_amount,jdbcType=DOUBLE},
-        </if>
-        <if test="item.mm_repprodcode != null" >
-          #{item.mm_repprodcode,jdbcType=VARCHAR},
-        </if>
-        <if test="item.mm_remark != null" >
-          #{item.mm_remark,jdbcType=VARCHAR},
-        </if>
-        <if test="item.companyId != null" >
-          #{item.companyId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updaterId != null" >
-          #{item.updaterId,jdbcType=INTEGER},
-        </if>
-        <if test="item.updateTime != null" >
-          #{item.updateTime,jdbcType=TIMESTAMP},
-        </if>
-      </trim>
+      INSERT INTO MAKEMATERIAL (mm_maid, mm_detno,
+      mm_prodid, mm_prodcode, mm_whid,
+      mm_whcode, mm_price, mm_oneuseqty,
+      mm_qty, mm_amount, mm_repprodcode,
+      mm_remark, companyId, updaterId,
+      updateTime)
+      VALUES
+    <foreach collection="list" item="item" index="index" open="" close="" separator=",">
+      (
+      #{item.mm_maid}, #{item.mm_detno,jdbcType=INTEGER},
+      #{item.mm_prodid,jdbcType=INTEGER}, #{item.mm_prodcode,jdbcType=VARCHAR}, #{item.mm_whid,jdbcType=INTEGER},
+      #{item.mm_whcode,jdbcType=VARCHAR}, #{item.mm_price,jdbcType=DOUBLE}, #{item.mm_oneuseqty,jdbcType=DOUBLE},
+      #{item.mm_qty,jdbcType=DOUBLE}, #{item.mm_amount,jdbcType=DOUBLE}, #{item.mm_repprodcode,jdbcType=VARCHAR},
+      #{item.mm_remark,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER}, #{item.updaterId,jdbcType=INTEGER},
+      #{item.updateTime,jdbcType=TIMESTAMP}
+      )
     </foreach>
     </foreach>
   </insert>
   </insert>
   <update id="batchUpdate" parameterType="com.usoftchina.saas.storage.po.MakeMaterial">
   <update id="batchUpdate" parameterType="com.usoftchina.saas.storage.po.MakeMaterial">