Browse Source

增加BOM资料接口

chenw 7 years ago
parent
commit
a9a29d3787
14 changed files with 1226 additions and 15 deletions
  1. 2 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  2. 148 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Bom.java
  3. 136 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomDetail.java
  4. 26 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomList.java
  5. 1 12
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java
  6. 41 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/BomController.java
  7. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/FundinouttypeController.java
  8. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java
  9. 26 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BomDetailMapper.java
  10. 25 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BomMapper.java
  11. 48 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/BomService.java
  12. 124 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BomServiceImpl.java
  13. 396 0
      applications/document/document-server/src/main/resources/mapper/BomDetailMapper.xml
  14. 251 0
      applications/document/document-server/src/main/resources/mapper/BomMapper.xml

+ 2 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -21,7 +21,8 @@ public enum BizExceptionCode implements BaseExceptionCode {
     NULL_CODERULE(79100, "单据规则不存在,请先确定单据生成规则"),
     CODE_EXISTS(79200, "单据编号已存在"),
     BIZ_CLOSE(79301, "只能关闭已审核的单据"),
-    BIZ_OPEN(79002, "只能打开已关闭的单据"),
+    BIZ_OPEN(79302, "只能打开已关闭的单据"),
+    BOM_SAVE(79401, "产品编号+版本号已存在"),
     NO_DATA(79998, "未找到数据"),
     ILLEGAL_ID(79999, "id不正确"),
 

+ 148 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Bom.java

@@ -0,0 +1,148 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class Bom extends CommonBaseEntity implements Serializable {
+    private Integer bo_motherid;
+
+    private String bo_mothercode;
+
+    private String bo_mothername;
+
+    private String bo_version;
+
+    private String bo_status;
+
+    private String bo_statuscode;
+
+    private Integer bo_recorderid;
+
+    private String bo_recorder;
+
+    private Date bo_recorddate;
+
+    private String bo_text1;
+
+    private String bo_text2;
+
+    private String bo_text3;
+
+    private String bo_text4;
+
+    private String bo_text5;
+
+    public Integer getBo_motherid() {
+        return bo_motherid;
+    }
+
+    public void setBo_motherid(Integer bo_motherid) {
+        this.bo_motherid = bo_motherid;
+    }
+
+    public String getBo_mothercode() {
+        return bo_mothercode;
+    }
+
+    public void setBo_mothercode(String bo_mothercode) {
+        this.bo_mothercode = bo_mothercode == null ? null : bo_mothercode.trim();
+    }
+
+    public String getBo_mothername() {
+        return bo_mothername;
+    }
+
+    public void setBo_mothername(String bo_mothername) {
+        this.bo_mothername = bo_mothername == null ? null : bo_mothername.trim();
+    }
+
+    public String getBo_version() {
+        return bo_version;
+    }
+
+    public void setBo_version(String bo_version) {
+        this.bo_version = bo_version == null ? null : bo_version.trim();
+    }
+
+    public String getBo_status() {
+        return bo_status;
+    }
+
+    public void setBo_status(String bo_status) {
+        this.bo_status = bo_status == null ? null : bo_status.trim();
+    }
+
+    public String getBo_statuscode() {
+        return bo_statuscode;
+    }
+
+    public void setBo_statuscode(String bo_statuscode) {
+        this.bo_statuscode = bo_statuscode == null ? null : bo_statuscode.trim();
+    }
+
+    public Integer getBo_recorderid() {
+        return bo_recorderid;
+    }
+
+    public void setBo_recorderid(Integer bo_recorderid) {
+        this.bo_recorderid = bo_recorderid;
+    }
+
+    public String getBo_recorder() {
+        return bo_recorder;
+    }
+
+    public void setBo_recorder(String bo_recorder) {
+        this.bo_recorder = bo_recorder == null ? null : bo_recorder.trim();
+    }
+
+    public Date getBo_recorddate() {
+        return bo_recorddate;
+    }
+
+    public void setBo_recorddate(Date bo_recorddate) {
+        this.bo_recorddate = bo_recorddate;
+    }
+
+    public String getBo_text1() {
+        return bo_text1;
+    }
+
+    public void setBo_text1(String bo_text1) {
+        this.bo_text1 = bo_text1 == null ? null : bo_text1.trim();
+    }
+
+    public String getBo_text2() {
+        return bo_text2;
+    }
+
+    public void setBo_text2(String bo_text2) {
+        this.bo_text2 = bo_text2 == null ? null : bo_text2.trim();
+    }
+
+    public String getBo_text3() {
+        return bo_text3;
+    }
+
+    public void setBo_text3(String bo_text3) {
+        this.bo_text3 = bo_text3 == null ? null : bo_text3.trim();
+    }
+
+    public String getBo_text4() {
+        return bo_text4;
+    }
+
+    public void setBo_text4(String bo_text4) {
+        this.bo_text4 = bo_text4 == null ? null : bo_text4.trim();
+    }
+
+    public String getBo_text5() {
+        return bo_text5;
+    }
+
+    public void setBo_text5(String bo_text5) {
+        this.bo_text5 = bo_text5 == null ? null : bo_text5.trim();
+    }
+}

+ 136 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomDetail.java

@@ -0,0 +1,136 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import java.io.Serializable;
+
+public class BomDetail extends CommonBaseEntity implements Serializable {
+    private Long bd_bomid;
+
+    private Integer bd_detno;
+
+    private Integer bd_sonid;
+
+    private String bd_soncode;
+
+    private String bd_unit;
+
+    private Integer bd_baseqty;
+
+    private String bd_replace;
+
+    private String bd_remark;
+
+    private String bd_text1;
+
+    private String bd_text2;
+
+    private String bd_text3;
+
+    private String bd_text4;
+
+    private String bd_text5;
+
+    public Long getBd_bomid() {
+        return bd_bomid;
+    }
+
+    public void setBd_bomid(Long bd_bomid) {
+        this.bd_bomid = bd_bomid;
+    }
+
+    public Integer getBd_detno() {
+        return bd_detno;
+    }
+
+    public void setBd_detno(Integer bd_detno) {
+        this.bd_detno = bd_detno;
+    }
+
+    public Integer getBd_sonid() {
+        return bd_sonid;
+    }
+
+    public void setBd_sonid(Integer bd_sonid) {
+        this.bd_sonid = bd_sonid;
+    }
+
+    public String getBd_soncode() {
+        return bd_soncode;
+    }
+
+    public void setBd_soncode(String bd_soncode) {
+        this.bd_soncode = bd_soncode == null ? null : bd_soncode.trim();
+    }
+
+    public String getBd_unit() {
+        return bd_unit;
+    }
+
+    public void setBd_unit(String bd_unit) {
+        this.bd_unit = bd_unit == null ? null : bd_unit.trim();
+    }
+
+    public Integer getBd_baseqty() {
+        return bd_baseqty;
+    }
+
+    public void setBd_baseqty(Integer bd_baseqty) {
+        this.bd_baseqty = bd_baseqty;
+    }
+
+    public String getBd_text1() {
+        return bd_text1;
+    }
+
+    public void setBd_text1(String bd_text1) {
+        this.bd_text1 = bd_text1 == null ? null : bd_text1.trim();
+    }
+
+    public String getBd_text2() {
+        return bd_text2;
+    }
+
+    public void setBd_text2(String bd_text2) {
+        this.bd_text2 = bd_text2 == null ? null : bd_text2.trim();
+    }
+
+    public String getBd_text3() {
+        return bd_text3;
+    }
+
+    public void setBd_text3(String bd_text3) {
+        this.bd_text3 = bd_text3 == null ? null : bd_text3.trim();
+    }
+
+    public String getBd_text4() {
+        return bd_text4;
+    }
+
+    public void setBd_text4(String bd_text4) {
+        this.bd_text4 = bd_text4 == null ? null : bd_text4.trim();
+    }
+
+    public String getBd_text5() {
+        return bd_text5;
+    }
+
+    public void setBd_text5(String bd_text5) {
+        this.bd_text5 = bd_text5 == null ? null : bd_text5.trim();
+    }
+
+    public String getBd_replace() {
+        return bd_replace;
+    }
+
+    public void setBd_replace(String bd_replace) {
+        this.bd_replace = bd_replace;
+    }
+
+    public String getBd_remark() {
+        return bd_remark;
+    }
+
+    public void setBd_remark(String bd_remark) {
+        this.bd_remark = bd_remark;
+    }
+}

+ 26 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomList.java

@@ -0,0 +1,26 @@
+package com.usoftchina.saas.document.entities;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class BomList implements Serializable {
+
+    private Bom main;
+    private List<BomDetail> items;
+
+    public Bom getMain() {
+        return main;
+    }
+
+    public void setMain(Bom main) {
+        this.main = main;
+    }
+
+    public List<BomDetail> getItems() {
+        return items;
+    }
+
+    public void setItems(List<BomDetail> items) {
+        this.items = items;
+    }
+}

+ 1 - 12
applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java

@@ -6,8 +6,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
-import org.springframework.web.servlet.config.annotation.CorsRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 
 @SpringBootApplication
 @EnableEurekaClient
@@ -15,19 +13,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
 @EnableTransactionManagement
 @EnableFeignClients("com.usoftchina.saas")
 @MapperScan("com.usoftchina.saas.document.mapper")
-public class DocumentApplication extends WebMvcConfigurerAdapter {
+public class DocumentApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(DocumentApplication.class);
     }
 
-    @Override
-    public void addCorsMappings(CorsRegistry registry) {
-        registry.addMapping("/**")
-                .allowCredentials(true)
-                .allowedHeaders("*")
-                .allowedOrigins("*")
-                .allowedMethods("*");
-    }
-
 }

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

@@ -0,0 +1,41 @@
+package com.usoftchina.saas.document.controller;
+
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.document.entities.BomList;
+import com.usoftchina.saas.document.service.BomService;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.print.Doc;
+
+@RestController
+@RequestMapping("/bom")
+public class BomController {
+
+    @Autowired
+    private BomService bomService;
+
+    @PostMapping("/save")
+    public Result saveData(@RequestBody BomList bomList){
+        return Result.success(bomService.saveData(bomList));
+    }
+
+    @PostMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id){
+        bomService.delete(id);
+        return Result.success();
+    }
+
+    @GetMapping("/list")
+    public Result getListDataByCondition(PageRequest page, ListReqDTO listReqDTO){
+        return Result.success(bomService.getListDataByCondition(page, listReqDTO));
+    }
+
+    @GetMapping("/getDataById")
+    public Result getDataByCondition(@PathVariable("id") Long id){
+        return Result.success(bomService.getDataById(id));
+    }
+
+}

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

@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*;
 import java.util.List;
 
 @RestController
-@RequestMapping("/fundinoutType")
+@RequestMapping("/fundinouttype")
 public class FundinouttypeController {
 
     @Autowired

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

@@ -40,7 +40,7 @@ public class VendorController {
      * @param id
      * @return
      */
-    @GetMapping("/getListById/{id}")
+    @GetMapping("/getDataById/{id}")
     public Result<VendorListDTO> getDataById(@PathVariable("id") Long id){
         VendorListDTO vendorListDTO = vendorService.getListById(id);
         return Result.success(vendorListDTO);

+ 26 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BomDetailMapper.java

@@ -0,0 +1,26 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.document.entities.BomDetail;
+
+import java.util.List;
+
+public interface BomDetailMapper extends CommonBaseMapper<BomDetail> {
+    int deleteByPrimaryKey(Long bd_id);
+
+    int insert(BomDetail record);
+
+    int insertSelective(BomDetail record);
+
+    BomDetail selectByPrimaryKey(Long bd_id);
+
+    int updateByPrimaryKeySelective(BomDetail record);
+
+    int updateByPrimaryKey(BomDetail record);
+
+    void batchInsert(List<BomDetail> bomDetailList);
+
+    void batchUpdate(List<BomDetail> bomDetailList);
+
+    void deleteByFK(Long id);
+}

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

@@ -0,0 +1,25 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.document.entities.Bom;
+import org.apache.ibatis.annotations.Param;
+
+public interface BomMapper extends CommonBaseMapper<Bom> {
+    int deleteByPrimaryKey(Long bo_id);
+
+    int insert(Bom record);
+
+    int insertSelective(Bom record);
+
+    Bom selectByPrimaryKey(Long bo_id);
+
+    int updateByPrimaryKeySelective(Bom record);
+
+    int updateByPrimaryKey(Bom record);
+
+    int validCodeAndVersion(@Param("code") String code, @Param("version") String version, @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);
+}

+ 48 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/BomService.java

@@ -0,0 +1,48 @@
+package com.usoftchina.saas.document.service;
+
+import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.document.entities.Bom;
+import com.usoftchina.saas.document.entities.BomList;
+import com.usoftchina.saas.document.mapper.BomMapper;
+import com.usoftchina.saas.page.PageRequest;
+
+import java.util.List;
+
+public interface BomService extends CommonBaseService<BomMapper, Bom> {
+
+    /**
+     * 保存、更新BOM资料主从表数据
+     * @param bomList
+     * @return
+     */
+    DocBaseDTO saveData(BomList bomList);
+
+    /**
+     * 删除
+     * @param id
+     */
+    void delete(Long id);
+
+    /**
+     * BOM资料复制
+     * @param id
+     */
+    void copy(Long id);
+
+    /**
+     * 获取列表数据
+     * @param pageRequest   分页对象
+     * @param listReqDTO    条件对象
+     * @return
+     */
+    List<BomList> getListDataByCondition(PageRequest pageRequest, ListReqDTO listReqDTO);
+
+    /**
+     * 通过ID获取主从表数据
+     * @param id
+     * @return
+     */
+    BomList getDataById(Long id);
+}

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

@@ -0,0 +1,124 @@
+package com.usoftchina.saas.document.service.impl;
+
+import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MaxnumberService;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.BillCodeSeq;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.document.entities.Bom;
+import com.usoftchina.saas.document.entities.BomDetail;
+import com.usoftchina.saas.document.entities.BomList;
+import com.usoftchina.saas.document.mapper.BomDetailMapper;
+import com.usoftchina.saas.document.mapper.BomMapper;
+import com.usoftchina.saas.document.service.BomService;
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class BomServiceImpl extends CommonBaseServiceImpl<BomMapper, Bom> implements BomService {
+
+    @Autowired
+    private MaxnumberService maxnumberService;
+    @Autowired
+    private BomDetailMapper bomDetailMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+
+    @Override
+    public DocBaseDTO saveData(BomList bomList) {
+        Long id = bomList.getMain().getId();
+        Long companyId = BaseContextHolder.getCompanyId();
+        Bom bom = bomList.getMain();
+        List<BomDetail> bomDetailList = bomList.getItems();
+        DocBaseDTO docBaseDTO = null;
+        if(id == 0){
+            //校验编号和版本 是否已存在
+            int count = getMapper().validCodeAndVersion(bom.getBo_mothercode(), bom.getBo_version(), companyId);
+            if(count == 0){
+                String code = pushMaxnubmer(bom.getBo_mothercode(), bom.getId());
+                bom.setBo_mothercode(code);
+                bom.setCompanyId(companyId);
+                //保存BOM
+                getMapper().insertSelective(bom);
+                //赋值BD_BOMID
+                for (BomDetail bomDetail : bomDetailList){
+                    bomDetail.setBd_bomid(bom.getId());
+                    bomDetail.setCompanyId(companyId);
+                }
+                bomDetailMapper.batchInsert(bomDetailList);
+                docBaseDTO = generateMsgObj(bom.getId());
+                //记录LOG
+                messageLogService.save(docBaseDTO);
+            }else{
+                throw new BizException(BizExceptionCode.BOM_SAVE);
+            }
+        }else{
+            //校验编号和版本 是否已存在
+            int count = getMapper().validCodeAndVersion(bom.getBo_mothercode(), bom.getBo_version(), companyId);
+            //更新主表
+            getMapper().updateByPrimaryKeySelective(bom);
+            //更新从表
+            bomDetailMapper.batchUpdate(bomDetailList);
+            //记录LOG
+            messageLogService.update(generateMsgObj(bom.getId()));
+        }
+        return docBaseDTO;
+    }
+
+    @Override
+    public void delete(Long id) {
+        if(id == null || id <= 0){
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+        getMapper().deleteByPrimaryKey(id);
+        bomDetailMapper.deleteByFK(id);
+    }
+
+    @Override
+    public void copy(Long id) {
+
+    }
+
+    @Override
+    public List<BomList> getListDataByCondition(PageRequest pageRequest, ListReqDTO listReqDTO) {
+        return null;
+    }
+
+    @Override
+    public BomList getDataById(Long id) {
+        return null;
+    }
+
+    /**
+     * 构造日记记录对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Bom");
+    }
+
+    /**
+     * @Description: 检验获取并更新单号
+     * @Param: [code, id]
+     * @return: java.lang.String
+     * @Author: guq
+     * @Date: 2018/10/19
+     */
+    private String pushMaxnubmer(String code, Long id) {
+        if (null == code) {
+            throw new BizException(BizExceptionCode.NULL_CODE);
+        }
+        Long companyId = BaseContextHolder.getCompanyId();
+        Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
+                getMapper().validateCodeWhenUpdate(code, id, companyId);
+        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PURCHASE.getCaller()).getData();
+    }
+}

+ 396 - 0
applications/document/document-server/src/main/resources/mapper/BomDetailMapper.xml

@@ -0,0 +1,396 @@
+<?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.usoftchina.saas.document.mapper.BomDetailMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.BomDetail" >
+    <id column="bd_id" property="id" jdbcType="INTEGER" />
+    <result column="bd_bomid" property="bd_bomid" jdbcType="INTEGER" />
+    <result column="bd_detno" property="bd_detno" jdbcType="INTEGER" />
+    <result column="bd_sonid" property="bd_sonid" jdbcType="INTEGER" />
+    <result column="bd_soncode" property="bd_soncode" jdbcType="VARCHAR" />
+    <result column="bd_unit" property="bd_unit" jdbcType="VARCHAR" />
+    <result column="bd_baseqty" property="bd_baseqty" jdbcType="INTEGER" />
+    <result column="bd_replace" property="bd_replace" jdbcType="VARCHAR" />
+    <result column="bd_remark" property="bd_remark" jdbcType="VARCHAR" />
+    <result column="comapnyId" property="companyId" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="bd_text1" property="bd_text1" jdbcType="VARCHAR" />
+    <result column="bd_text2" property="bd_text2" jdbcType="VARCHAR" />
+    <result column="bd_text3" property="bd_text3" jdbcType="VARCHAR" />
+    <result column="bd_text4" property="bd_text4" jdbcType="VARCHAR" />
+    <result column="bd_text5" property="bd_text5" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    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_text5
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+    select 
+    <include refid="Base_Column_List" />
+    from bomdetail
+    where bd_id = #{id}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+    delete from bomdetail
+    where bd_id = #{id}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.document.entities.BomDetail" >
+    insert into bomdetail (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_text5)
+    values ( #{bd_bomid,jdbcType=INTEGER}, #{bd_detno,jdbcType=INTEGER},
+      #{bd_sonid,jdbcType=INTEGER}, #{bd_soncode,jdbcType=VARCHAR}, #{bd_unit,jdbcType=VARCHAR}, 
+      #{bd_baseqty,jdbcType=INTEGER}, #{bd_replace,jdbcType=VARCHAR}, #{bd_remark,jdbcType=VARCHAR}, 
+      #{comapnyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, 
+      #{bd_text1,jdbcType=VARCHAR}, #{bd_text2,jdbcType=VARCHAR}, #{bd_text3,jdbcType=VARCHAR}, 
+      #{bd_text4,jdbcType=VARCHAR}, #{bd_text5,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.BomDetail" >
+    insert into bomdetail
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="bd_bomid != null" >
+        bd_bomid,
+      </if>
+      <if test="bd_detno != null" >
+        bd_detno,
+      </if>
+      <if test="bd_sonid != null" >
+        bd_sonid,
+      </if>
+      <if test="bd_soncode != null" >
+        bd_soncode,
+      </if>
+      <if test="bd_unit != null" >
+        bd_unit,
+      </if>
+      <if test="bd_baseqty != null" >
+        bd_baseqty,
+      </if>
+      <if test="bd_replace != null" >
+        bd_replace,
+      </if>
+      <if test="bd_remark != null" >
+        bd_remark,
+      </if>
+      <if test="comapnyId != null" >
+        comapnyId,
+      </if>
+      <if test="updaterId != null" >
+        updaterId,
+      </if>
+      <if test="updateTime != null" >
+        updateTime,
+      </if>
+      <if test="bd_text1 != null" >
+        bd_text1,
+      </if>
+      <if test="bd_text2 != null" >
+        bd_text2,
+      </if>
+      <if test="bd_text3 != null" >
+        bd_text3,
+      </if>
+      <if test="bd_text4 != null" >
+        bd_text4,
+      </if>
+      <if test="bd_text5 != null" >
+        bd_text5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="bd_bomid != null" >
+        #{bd_bomid,jdbcType=INTEGER},
+      </if>
+      <if test="bd_detno != null" >
+        #{bd_detno,jdbcType=INTEGER},
+      </if>
+      <if test="bd_sonid != null" >
+        #{bd_sonid,jdbcType=INTEGER},
+      </if>
+      <if test="bd_soncode != null" >
+        #{bd_soncode,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_unit != null" >
+        #{bd_unit,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_baseqty != null" >
+        #{bd_baseqty,jdbcType=INTEGER},
+      </if>
+      <if test="bd_replace != null" >
+        #{bd_replace,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_remark != null" >
+        #{bd_remark,jdbcType=VARCHAR},
+      </if>
+      <if test="comapnyId != null" >
+        #{comapnyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bd_text1 != null" >
+        #{bd_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text2 != null" >
+        #{bd_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text3 != null" >
+        #{bd_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text4 != null" >
+        #{bd_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text5 != null" >
+        #{bd_text5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.BomDetail" >
+    update bomdetail
+    <set >
+      <if test="bd_bomid != null" >
+        bd_bomid = #{bd_bomid,jdbcType=INTEGER},
+      </if>
+      <if test="bd_detno != null" >
+        bd_detno = #{bd_detno,jdbcType=INTEGER},
+      </if>
+      <if test="bd_sonid != null" >
+        bd_sonid = #{bd_sonid,jdbcType=INTEGER},
+      </if>
+      <if test="bd_soncode != null" >
+        bd_soncode = #{bd_soncode,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_unit != null" >
+        bd_unit = #{bd_unit,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_baseqty != null" >
+        bd_baseqty = #{bd_baseqty,jdbcType=INTEGER},
+      </if>
+      <if test="bd_replace != null" >
+        bd_replace = #{bd_replace,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_remark != null" >
+        bd_remark = #{bd_remark,jdbcType=VARCHAR},
+      </if>
+      <if test="comapnyId != null" >
+        comapnyId = #{comapnyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        updaterId = #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bd_text1 != null" >
+        bd_text1 = #{bd_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text2 != null" >
+        bd_text2 = #{bd_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text3 != null" >
+        bd_text3 = #{bd_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text4 != null" >
+        bd_text4 = #{bd_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text5 != null" >
+        bd_text5 = #{bd_text5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where bd_id = #{id}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.BomDetail" >
+    update bomdetail
+    set bd_bomid = #{bd_bomid,jdbcType=INTEGER},
+      bd_detno = #{bd_detno,jdbcType=INTEGER},
+      bd_sonid = #{bd_sonid,jdbcType=INTEGER},
+      bd_soncode = #{bd_soncode,jdbcType=VARCHAR},
+      bd_unit = #{bd_unit,jdbcType=VARCHAR},
+      bd_baseqty = #{bd_baseqty,jdbcType=INTEGER},
+      bd_replace = #{bd_replace,jdbcType=VARCHAR},
+      bd_remark = #{bd_remark,jdbcType=VARCHAR},
+      comapnyId = #{comapnyId,jdbcType=INTEGER},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      bd_text1 = #{bd_text1,jdbcType=VARCHAR},
+      bd_text2 = #{bd_text2,jdbcType=VARCHAR},
+      bd_text3 = #{bd_text3,jdbcType=VARCHAR},
+      bd_text4 = #{bd_text4,jdbcType=VARCHAR},
+      bd_text5 = #{bd_text5,jdbcType=VARCHAR}
+    where bd_id = #{id}
+  </update>
+  <insert id="batchInsert" parameterType="java.util.List">
+    <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>
+    </foreach>
+  </insert>
+
+  <update id="batchUpdate" parameterType="com.usoftchina.saas.document.entities.BomDetail">
+    <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+      UPDATE BOMDETAIL
+      <set >
+        <if test="item.bd_bomid != null" >
+          bd_bomid = #{item.bd_bomid},
+        </if>
+        <if test="bd_detno != null" >
+          bd_detno = #{item.bd_detno,jdbcType=INTEGER},
+        </if>
+        <if test="bd_sonid != null" >
+          bd_sonid = #{item.bd_sonid,jdbcType=INTEGER},
+        </if>
+        <if test="bd_soncode != null" >
+          bd_soncode = #{item.bd_soncode,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_unit != null" >
+          bd_unit = #{item.bd_unit,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_baseqty != null" >
+          bd_baseqty = #{item.bd_baseqty,jdbcType=INTEGER},
+        </if>
+        <if test="bd_replace != null" >
+          bd_replace = #{item.bd_replace,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_remark != null" >
+          bd_remark = #{item.bd_remark,jdbcType=VARCHAR},
+        </if>
+        <if test="comapnyId != null" >
+          comapnyId = #{item.comapnyId,jdbcType=INTEGER},
+        </if>
+        <if test="updaterId != null" >
+          updaterId = #{item.updaterId,jdbcType=INTEGER},
+        </if>
+        <if test="updateTime != null" >
+          updateTime = #{item.updateTime,jdbcType=TIMESTAMP},
+        </if>
+        <if test="bd_text1 != null" >
+          bd_text1 = #{item.bd_text1,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text2 != null" >
+          bd_text2 = #{item.bd_text2,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text3 != null" >
+          bd_text3 = #{item.bd_text3,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text4 != null" >
+          bd_text4 = #{item.bd_text4,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text5 != null" >
+          bd_text5 = #{item.bd_text5,jdbcType=VARCHAR},
+        </if>
+      </set>
+      where bd_id = #{item.id}
+    </foreach>
+  </update>
+
+  <delete id="deleteByFK" parameterType="java.lang.Long">
+    DELETE FROM BOMDETAIL
+    WHERE BD_BOMID=#{id}
+  </delete>
+</mapper>

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

@@ -0,0 +1,251 @@
+<?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.usoftchina.saas.document.mapper.BomMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Bom" >
+    <id column="bo_id" property="id" jdbcType="INTEGER" />
+    <result column="bo_motherid" property="bo_motherid" jdbcType="INTEGER" />
+    <result column="bo_mothercode" property="bo_mothercode" jdbcType="VARCHAR" />
+    <result column="bo_mothername" property="bo_mothername" jdbcType="VARCHAR" />
+    <result column="bo_version" property="bo_version" jdbcType="VARCHAR" />
+    <result column="bo_status" property="bo_status" jdbcType="VARCHAR" />
+    <result column="bo_statuscode" property="bo_statuscode" jdbcType="VARCHAR" />
+    <result column="bo_recorderid" property="bo_recorderid" jdbcType="INTEGER" />
+    <result column="bo_recorder" property="bo_recorder" jdbcType="VARCHAR" />
+    <result column="bo_recorddate" property="bo_recorddate" jdbcType="TIMESTAMP" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="bo_text1" property="bo_text1" jdbcType="VARCHAR" />
+    <result column="bo_text2" property="bo_text2" jdbcType="VARCHAR" />
+    <result column="bo_text3" property="bo_text3" jdbcType="VARCHAR" />
+    <result column="bo_text4" property="bo_text4" jdbcType="VARCHAR" />
+    <result column="bo_text5" property="bo_text5" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    bo_id, bo_motherid, bo_mothercode, bo_mothername, bo_version, bo_status, bo_statuscode, 
+    bo_recorderid, bo_recorder, bo_recorddate, companyId, updaterId, updateTime, bo_text1, 
+    bo_text2, bo_text3, bo_text4, bo_text5
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+    select 
+    <include refid="Base_Column_List" />
+    from bom
+    where bo_id = #{id}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+    delete from bom
+    where bo_id = #{id}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    insert into bom (bo_motherid, bo_mothercode,
+      bo_mothername, bo_version, bo_status, 
+      bo_statuscode, bo_recorderid, bo_recorder, 
+      bo_recorddate, companyId, updaterId, 
+      updateTime, bo_text1, bo_text2, 
+      bo_text3, bo_text4, bo_text5
+      )
+    values (#{bo_motherid,jdbcType=INTEGER}, #{bo_mothercode,jdbcType=VARCHAR},
+      #{bo_mothername,jdbcType=VARCHAR}, #{bo_version,jdbcType=VARCHAR}, #{bo_status,jdbcType=VARCHAR}, 
+      #{bo_statuscode,jdbcType=VARCHAR}, #{bo_recorderid,jdbcType=INTEGER}, #{bo_recorder,jdbcType=VARCHAR}, 
+      #{bo_recorddate,jdbcType=TIMESTAMP}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, 
+      #{updateTime,jdbcType=TIMESTAMP}, #{bo_text1,jdbcType=VARCHAR}, #{bo_text2,jdbcType=VARCHAR}, 
+      #{bo_text3,jdbcType=VARCHAR}, #{bo_text4,jdbcType=VARCHAR}, #{bo_text5,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    insert into bom
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="bo_motherid != null" >
+        bo_motherid,
+      </if>
+      <if test="bo_mothercode != null" >
+        bo_mothercode,
+      </if>
+      <if test="bo_mothername != null" >
+        bo_mothername,
+      </if>
+      <if test="bo_version != null" >
+        bo_version,
+      </if>
+      <if test="bo_status != null" >
+        bo_status,
+      </if>
+      <if test="bo_statuscode != null" >
+        bo_statuscode,
+      </if>
+      <if test="bo_recorderid != null" >
+        bo_recorderid,
+      </if>
+      <if test="bo_recorder != null" >
+        bo_recorder,
+      </if>
+      <if test="bo_recorddate != null" >
+        bo_recorddate,
+      </if>
+      <if test="companyId != null" >
+        companyId,
+      </if>
+      <if test="updaterId != null" >
+        updaterId,
+      </if>
+      <if test="updateTime != null" >
+        updateTime,
+      </if>
+      <if test="bo_text1 != null" >
+        bo_text1,
+      </if>
+      <if test="bo_text2 != null" >
+        bo_text2,
+      </if>
+      <if test="bo_text3 != null" >
+        bo_text3,
+      </if>
+      <if test="bo_text4 != null" >
+        bo_text4,
+      </if>
+      <if test="bo_text5 != null" >
+        bo_text5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="bo_motherid != null" >
+        #{bo_motherid,jdbcType=INTEGER},
+      </if>
+      <if test="bo_mothercode != null" >
+        #{bo_mothercode,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_mothername != null" >
+        #{bo_mothername,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_version != null" >
+        #{bo_version,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_status != null" >
+        #{bo_status,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_statuscode != null" >
+        #{bo_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_recorderid != null" >
+        #{bo_recorderid,jdbcType=INTEGER},
+      </if>
+      <if test="bo_recorder != null" >
+        #{bo_recorder,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_recorddate != null" >
+        #{bo_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="companyId != null" >
+        #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bo_text1 != null" >
+        #{bo_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text2 != null" >
+        #{bo_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text3 != null" >
+        #{bo_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text4 != null" >
+        #{bo_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text5 != null" >
+        #{bo_text5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    update bom
+    <set >
+      <if test="bo_motherid != null" >
+        bo_motherid = #{bo_motherid,jdbcType=INTEGER},
+      </if>
+      <if test="bo_mothercode != null" >
+        bo_mothercode = #{bo_mothercode,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_mothername != null" >
+        bo_mothername = #{bo_mothername,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_version != null" >
+        bo_version = #{bo_version,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_status != null" >
+        bo_status = #{bo_status,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_statuscode != null" >
+        bo_statuscode = #{bo_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_recorderid != null" >
+        bo_recorderid = #{bo_recorderid,jdbcType=INTEGER},
+      </if>
+      <if test="bo_recorder != null" >
+        bo_recorder = #{bo_recorder,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_recorddate != null" >
+        bo_recorddate = #{bo_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="companyId != null" >
+        companyId = #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        updaterId = #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bo_text1 != null" >
+        bo_text1 = #{bo_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text2 != null" >
+        bo_text2 = #{bo_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text3 != null" >
+        bo_text3 = #{bo_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text4 != null" >
+        bo_text4 = #{bo_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text5 != null" >
+        bo_text5 = #{bo_text5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where bo_id = #{id}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    update bom
+    set bo_motherid = #{bo_motherid,jdbcType=INTEGER},
+      bo_mothercode = #{bo_mothercode,jdbcType=VARCHAR},
+      bo_mothername = #{bo_mothername,jdbcType=VARCHAR},
+      bo_version = #{bo_version,jdbcType=VARCHAR},
+      bo_status = #{bo_status,jdbcType=VARCHAR},
+      bo_statuscode = #{bo_statuscode,jdbcType=VARCHAR},
+      bo_recorderid = #{bo_recorderid,jdbcType=INTEGER},
+      bo_recorder = #{bo_recorder,jdbcType=VARCHAR},
+      bo_recorddate = #{bo_recorddate,jdbcType=TIMESTAMP},
+      companyId = #{companyId,jdbcType=INTEGER},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      bo_text1 = #{bo_text1,jdbcType=VARCHAR},
+      bo_text2 = #{bo_text2,jdbcType=VARCHAR},
+      bo_text3 = #{bo_text3,jdbcType=VARCHAR},
+      bo_text4 = #{bo_text4,jdbcType=VARCHAR},
+      bo_text5 = #{bo_text5,jdbcType=VARCHAR}
+    where bo_id = #{id}
+  </update>
+  <select id="validateCodeWhenInsert" resultType="int">
+    select count(*) from BOM where BO_MOTHERCODE = #{code} and companyId =#{companyId}
+  </select>
+  <select id="validateCodeWhenUpdate" resultType="int" >
+    select count(*) from BOM where BO_MOTHERCODE = #{code} and BO_ID != #{id} and companyId =#{companyId}
+  </select>
+  <select id="validCodeAndVersion" resultType="int">
+      SELECT COUNT(*) FROM BOM WHERE BO_MOTHERCODE = #{code} and BO_VERSION=#{version} and COMPANYID=#{companyId}
+  </select>
+</mapper>