完成BOM后端

This commit is contained in:
刘名喜 2024-10-31 19:48:21 +08:00
parent 289f9d6e72
commit 13ee588b12
7 changed files with 906 additions and 0 deletions

View File

@ -0,0 +1,106 @@
package com.ktg.mes.md.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.md.domain.BomRoute;
import com.ktg.mes.md.service.IBomRouteService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* BOM头Controller
*
* @author yinjinlu
* @date 2024-10-31
*/
@RestController
@RequestMapping("/md/ROUTE")
public class BomRouteController extends BaseController
{
@Autowired
private IBomRouteService bomRouteService;
/**
* 查询BOM头列表
*/
@PreAuthorize("@ss.hasPermi('md:ROUTE:list')")
@GetMapping("/list")
public TableDataInfo list(BomRoute bomRoute)
{
startPage();
List<BomRoute> list = bomRouteService.selectBomRouteList(bomRoute);
return getDataTable(list);
}
/**
* 导出BOM头列表
*/
@PreAuthorize("@ss.hasPermi('md:ROUTE:export')")
@Log(title = "BOM头", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BomRoute bomRoute)
{
List<BomRoute> list = bomRouteService.selectBomRouteList(bomRoute);
ExcelUtil<BomRoute> util = new ExcelUtil<BomRoute>(BomRoute.class);
util.exportExcel(response, list, "BOM头数据");
}
/**
* 获取BOM头详细信息
*/
@PreAuthorize("@ss.hasPermi('md:ROUTE:query')")
@GetMapping(value = "/{bomRouteId}")
public AjaxResult getInfo(@PathVariable("bomRouteId") Long bomRouteId)
{
return AjaxResult.success(bomRouteService.selectBomRouteByBomRouteId(bomRouteId));
}
/**
* 新增BOM头
*/
@PreAuthorize("@ss.hasPermi('md:ROUTE:add')")
@Log(title = "BOM头", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BomRoute bomRoute)
{
bomRoute.setCreateBy(getUsername());
return toAjax(bomRouteService.insertBomRoute(bomRoute));
}
/**
* 修改BOM头
*/
@PreAuthorize("@ss.hasPermi('md:ROUTE:edit')")
@Log(title = "BOM头", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BomRoute bomRoute)
{
bomRoute.setUpdateBy(getUsername());
return toAjax(bomRouteService.updateBomRoute(bomRoute));
}
/**
* 删除BOM头
*/
@PreAuthorize("@ss.hasPermi('md:ROUTE:remove')")
@Log(title = "BOM头", businessType = BusinessType.DELETE)
@DeleteMapping("/{bomRouteIds}")
public AjaxResult remove(@PathVariable Long[] bomRouteIds)
{
return toAjax(bomRouteService.deleteBomRouteByBomRouteIds(bomRouteIds));
}
}

View File

@ -0,0 +1,179 @@
package com.ktg.mes.md.domain;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
/**
* BOM头对象 BOM_ROUTE
*
* @author yinjinlu
* @date 2024-10-31
*/
public class BomRoute extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** BOM头表 */
private Long bomRouteId;
/** BOM编码 */
@Excel(name = "BOM编码")
private String bomCode;
/** BOM名称 */
@Excel(name = "BOM名称")
private String bomName;
/** BOM版本 */
@Excel(name = "BOM版本")
private String bomVersion;
/** 所属物料 */
@Excel(name = "所属物料")
private Long mdItemId;
/** 是否默认 */
@Excel(name = "是否默认")
private String isDefault;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private String attr3;
/** 预留字段4 */
private String attr4;
/** BOM物料信息 */
private List<MbbProduBom> mbbProduBomList;
public void setBomRouteId(Long bomRouteId)
{
this.bomRouteId = bomRouteId;
}
public Long getBomRouteId()
{
return bomRouteId;
}
public void setBomCode(String bomCode)
{
this.bomCode = bomCode;
}
public String getBomCode()
{
return bomCode;
}
public void setBomName(String bomName)
{
this.bomName = bomName;
}
public String getBomName()
{
return bomName;
}
public void setBomVersion(String bomVersion)
{
this.bomVersion = bomVersion;
}
public String getBomVersion()
{
return bomVersion;
}
public void setMdItemId(Long mdItemId)
{
this.mdItemId = mdItemId;
}
public Long getMdItemId()
{
return mdItemId;
}
public void setIsDefault(String isDefault)
{
this.isDefault = isDefault;
}
public String getIsDefault()
{
return isDefault;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(String attr3)
{
this.attr3 = attr3;
}
public String getAttr3()
{
return attr3;
}
public void setAttr4(String attr4)
{
this.attr4 = attr4;
}
public String getAttr4()
{
return attr4;
}
public List<MbbProduBom> getMbbProduBomList()
{
return mbbProduBomList;
}
public void setMbbProduBomList(List<MbbProduBom> mbbProduBomList)
{
this.mbbProduBomList = mbbProduBomList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("bomRouteId", getBomRouteId())
.append("bomCode", getBomCode())
.append("bomName", getBomName())
.append("bomVersion", getBomVersion())
.append("mdItemId", getMdItemId())
.append("isDefault", getIsDefault())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("mbbProduBomList", getMbbProduBomList())
.toString();
}
}

View File

@ -0,0 +1,178 @@
package com.ktg.mes.md.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
/**
* BOM物料对象 MBB_PRODU_BOM
*
* @author yinjinlu
* @date 2024-10-31
*/
public class MbbProduBom extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long mbbProduBomId;
/** BOM头ID */
@Excel(name = "BOM头ID")
private Long bomRouteId;
/** 所属物料 */
@Excel(name = "所属物料")
private Long mdItemId;
/** 物料名称 */
@Excel(name = "物料名称")
private String mdItemName;
/** 物料编码 */
@Excel(name = "物料编码")
private String mdItemCode;
/** 计量单位 */
@Excel(name = "计量单位")
private String mdItemUnit;
/** 标准用量 */
@Excel(name = "标准用量")
private Integer standardDosage;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private String attr3;
/** 预留字段4 */
private String attr4;
public void setMbbProduBomId(Long mbbProduBomId)
{
this.mbbProduBomId = mbbProduBomId;
}
public Long getMbbProduBomId()
{
return mbbProduBomId;
}
public void setBomRouteId(Long bomRouteId)
{
this.bomRouteId = bomRouteId;
}
public Long getBomRouteId()
{
return bomRouteId;
}
public void setMdItemId(Long mdItemId)
{
this.mdItemId = mdItemId;
}
public Long getMdItemId()
{
return mdItemId;
}
public void setMdItemName(String mdItemName)
{
this.mdItemName = mdItemName;
}
public String getMdItemName()
{
return mdItemName;
}
public void setMdItemCode(String mdItemCode)
{
this.mdItemCode = mdItemCode;
}
public String getMdItemCode()
{
return mdItemCode;
}
public void setMdItemUnit(String mdItemUnit)
{
this.mdItemUnit = mdItemUnit;
}
public String getMdItemUnit()
{
return mdItemUnit;
}
public void setStandardDosage(Integer standardDosage)
{
this.standardDosage = standardDosage;
}
public Integer getStandardDosage()
{
return standardDosage;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(String attr3)
{
this.attr3 = attr3;
}
public String getAttr3()
{
return attr3;
}
public void setAttr4(String attr4)
{
this.attr4 = attr4;
}
public String getAttr4()
{
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("mbbProduBomId", getMbbProduBomId())
.append("bomRouteId", getBomRouteId())
.append("mdItemId", getMdItemId())
.append("mdItemName", getMdItemName())
.append("mdItemCode", getMdItemCode())
.append("mdItemUnit", getMdItemUnit())
.append("standardDosage", getStandardDosage())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,87 @@
package com.ktg.mes.md.mapper;
import java.util.List;
import com.ktg.mes.md.domain.BomRoute;
import com.ktg.mes.md.domain.MbbProduBom;
/**
* BOM头Mapper接口
*
* @author yinjinlu
* @date 2024-10-31
*/
public interface BomRouteMapper
{
/**
* 查询BOM头
*
* @param bomRouteId BOM头主键
* @return BOM头
*/
public BomRoute selectBomRouteByBomRouteId(Long bomRouteId);
/**
* 查询BOM头列表
*
* @param bomRoute BOM头
* @return BOM头集合
*/
public List<BomRoute> selectBomRouteList(BomRoute bomRoute);
/**
* 新增BOM头
*
* @param bomRoute BOM头
* @return 结果
*/
public int insertBomRoute(BomRoute bomRoute);
/**
* 修改BOM头
*
* @param bomRoute BOM头
* @return 结果
*/
public int updateBomRoute(BomRoute bomRoute);
/**
* 删除BOM头
*
* @param bomRouteId BOM头主键
* @return 结果
*/
public int deleteBomRouteByBomRouteId(Long bomRouteId);
/**
* 批量删除BOM头
*
* @param bomRouteIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBomRouteByBomRouteIds(Long[] bomRouteIds);
/**
* 批量删除BOM物料
*
* @param bomRouteIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMbbProduBomByBomRouteIds(Long[] bomRouteIds);
/**
* 批量新增BOM物料
*
* @param mbbProduBomList BOM物料列表
* @return 结果
*/
public int batchMbbProduBom(List<MbbProduBom> mbbProduBomList);
/**
* 通过BOM头主键删除BOM物料信息
*
* @param bomRouteId BOM头ID
* @return 结果
*/
public int deleteMbbProduBomByBomRouteId(Long bomRouteId);
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.md.service;
import java.util.List;
import com.ktg.mes.md.domain.BomRoute;
/**
* BOM头Service接口
*
* @author yinjinlu
* @date 2024-10-31
*/
public interface IBomRouteService
{
/**
* 查询BOM头
*
* @param bomRouteId BOM头主键
* @return BOM头
*/
public BomRoute selectBomRouteByBomRouteId(Long bomRouteId);
/**
* 查询BOM头列表
*
* @param bomRoute BOM头
* @return BOM头集合
*/
public List<BomRoute> selectBomRouteList(BomRoute bomRoute);
/**
* 新增BOM头
*
* @param bomRoute BOM头
* @return 结果
*/
public int insertBomRoute(BomRoute bomRoute);
/**
* 修改BOM头
*
* @param bomRoute BOM头
* @return 结果
*/
public int updateBomRoute(BomRoute bomRoute);
/**
* 批量删除BOM头
*
* @param bomRouteIds 需要删除的BOM头主键集合
* @return 结果
*/
public int deleteBomRouteByBomRouteIds(Long[] bomRouteIds);
/**
* 删除BOM头信息
*
* @param bomRouteId BOM头主键
* @return 结果
*/
public int deleteBomRouteByBomRouteId(Long bomRouteId);
}

View File

@ -0,0 +1,134 @@
package com.ktg.mes.md.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ktg.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ktg.mes.md.domain.MbbProduBom;
import com.ktg.mes.md.mapper.BomRouteMapper;
import com.ktg.mes.md.domain.BomRoute;
import com.ktg.mes.md.service.IBomRouteService;
/**
* BOM头Service业务层处理
*
* @author yinjinlu
* @date 2024-10-31
*/
@Service
public class BomRouteServiceImpl implements IBomRouteService
{
@Autowired
private BomRouteMapper bomRouteMapper;
/**
* 查询BOM头
*
* @param bomRouteId BOM头主键
* @return BOM头
*/
@Override
public BomRoute selectBomRouteByBomRouteId(Long bomRouteId)
{
return bomRouteMapper.selectBomRouteByBomRouteId(bomRouteId);
}
/**
* 查询BOM头列表
*
* @param bomRoute BOM头
* @return BOM头
*/
@Override
public List<BomRoute> selectBomRouteList(BomRoute bomRoute)
{
return bomRouteMapper.selectBomRouteList(bomRoute);
}
/**
* 新增BOM头
*
* @param bomRoute BOM头
* @return 结果
*/
@Transactional
@Override
public int insertBomRoute(BomRoute bomRoute)
{
bomRoute.setCreateTime(DateUtils.getNowDate());
int rows = bomRouteMapper.insertBomRoute(bomRoute);
insertMbbProduBom(bomRoute);
return rows;
}
/**
* 修改BOM头
*
* @param bomRoute BOM头
* @return 结果
*/
@Transactional
@Override
public int updateBomRoute(BomRoute bomRoute)
{
bomRoute.setUpdateTime(DateUtils.getNowDate());
bomRouteMapper.deleteMbbProduBomByBomRouteId(bomRoute.getBomRouteId());
insertMbbProduBom(bomRoute);
return bomRouteMapper.updateBomRoute(bomRoute);
}
/**
* 批量删除BOM头
*
* @param bomRouteIds 需要删除的BOM头主键
* @return 结果
*/
@Transactional
@Override
public int deleteBomRouteByBomRouteIds(Long[] bomRouteIds)
{
bomRouteMapper.deleteMbbProduBomByBomRouteIds(bomRouteIds);
return bomRouteMapper.deleteBomRouteByBomRouteIds(bomRouteIds);
}
/**
* 删除BOM头信息
*
* @param bomRouteId BOM头主键
* @return 结果
*/
@Transactional
@Override
public int deleteBomRouteByBomRouteId(Long bomRouteId)
{
bomRouteMapper.deleteMbbProduBomByBomRouteId(bomRouteId);
return bomRouteMapper.deleteBomRouteByBomRouteId(bomRouteId);
}
/**
* 新增BOM物料信息
*
* @param bomRoute BOM头对象
*/
public void insertMbbProduBom(BomRoute bomRoute)
{
List<MbbProduBom> mbbProduBomList = bomRoute.getMbbProduBomList();
Long bomRouteId = bomRoute.getBomRouteId();
if (StringUtils.isNotNull(mbbProduBomList))
{
List<MbbProduBom> list = new ArrayList<MbbProduBom>();
for (MbbProduBom mbbProduBom : mbbProduBomList)
{
mbbProduBom.setBomRouteId(bomRouteId);
list.add(mbbProduBom);
}
if (list.size() > 0)
{
bomRouteMapper.batchMbbProduBom(list);
}
}
}
}

View File

@ -0,0 +1,161 @@
<?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.ktg.mes.md.mapper.BomRouteMapper">
<resultMap type="BomRoute" id="BomRouteResult">
<result property="bomRouteId" column="BOM_ROUTE_ID" />
<result property="bomCode" column="BOM_CODE" />
<result property="bomName" column="BOM_NAME" />
<result property="bomVersion" column="BOM_VERSION" />
<result property="mdItemId" column="MD_ITEM_ID" />
<result property="isDefault" column="IS_DEFAULT" />
<result property="remark" column="REMARK" />
<result property="attr1" column="ATTR1" />
<result property="attr2" column="ATTR2" />
<result property="attr3" column="ATTR3" />
<result property="attr4" column="ATTR4" />
<result property="createBy" column="CREATE_BY" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateBy" column="UPDATE_BY" />
<result property="updateTime" column="UPDATE_TIME" />
</resultMap>
<resultMap id="BomRouteMbbProduBomResult" type="BomRoute" extends="BomRouteResult">
<collection property="mbbProduBomList" notNullColumn="sub_MBB_PRODU_BOM_ID" javaType="java.util.List" resultMap="MbbProduBomResult" />
</resultMap>
<resultMap type="MbbProduBom" id="MbbProduBomResult">
<result property="mbbProduBomId" column="sub_MBB_PRODU_BOM_ID" />
<result property="bomRouteId" column="sub_BOM_ROUTE_ID" />
<result property="mdItemId" column="sub_MD_ITEM_ID" />
<result property="mdItemName" column="sub_MD_ITEM_NAME" />
<result property="mdItemCode" column="sub_MD_ITEM_CODE" />
<result property="mdItemUnit" column="sub_MD_ITEM_UNIT" />
<result property="standardDosage" column="sub_STANDARD_DOSAGE" />
<result property="remark" column="sub_REMARK" />
<result property="attr1" column="sub_ATTR1" />
<result property="attr2" column="sub_ATTR2" />
<result property="attr3" column="sub_ATTR3" />
<result property="attr4" column="sub_ATTR4" />
<result property="createBy" column="sub_CREATE_BY" />
<result property="createTime" column="sub_CREATE_TIME" />
<result property="updateBy" column="sub_UPDATE_BY" />
<result property="updateTime" column="sub_UPDATE_TIME" />
</resultMap>
<sql id="selectBomRouteVo">
select BOM_ROUTE_ID, BOM_CODE, BOM_NAME, BOM_VERSION, MD_ITEM_ID, IS_DEFAULT, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME from BOM_ROUTE
</sql>
<select id="selectBomRouteList" parameterType="BomRoute" resultMap="BomRouteResult">
<include refid="selectBomRouteVo"/>
<where>
<if test="bomCode != null and bomCode != ''"> and BOM_CODE like concat('%', #{bomCode}, '%')</if>
<if test="bomName != null and bomName != ''"> and BOM_NAME like concat('%', #{bomName}, '%')</if>
<if test="bomVersion != null and bomVersion != ''"> and BOM_VERSION like concat('%', #{bomVersion}, '%')</if>
<if test="mdItemId != null "> and MD_ITEM_ID = #{mdItemId}</if>
<if test="isDefault != null and isDefault != ''"> and IS_DEFAULT = #{isDefault}</if>
<if test="remark != null and remark != ''"> and REMARK like concat('%', #{remark}, '%')</if>
<if test="createBy != null and createBy != ''"> and CREATE_BY = #{createBy}</if>
<if test="createTime != null "> and CREATE_TIME = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
<if test="updateTime != null "> and UPDATE_TIME = #{updateTime}</if>
</where>
</select>
<select id="selectBomRouteByBomRouteId" parameterType="Long" resultMap="BomRouteMbbProduBomResult">
select a.BOM_ROUTE_ID, a.BOM_CODE, a.BOM_NAME, a.BOM_VERSION, a.MD_ITEM_ID, a.IS_DEFAULT, a.REMARK, a.ATTR1, a.ATTR2, a.ATTR3, a.ATTR4, a.CREATE_BY, a.CREATE_TIME, a.UPDATE_BY, a.UPDATE_TIME,
b.MBB_PRODU_BOM_ID as sub_MBB_PRODU_BOM_ID, b.BOM_ROUTE_ID as sub_BOM_ROUTE_ID, b.MD_ITEM_ID as sub_MD_ITEM_ID, b.MD_ITEM_NAME as sub_MD_ITEM_NAME, b.MD_ITEM_CODE as sub_MD_ITEM_CODE, b.MD_ITEM_UNIT as sub_MD_ITEM_UNIT, b.STANDARD_DOSAGE as sub_STANDARD_DOSAGE, b.REMARK as sub_REMARK, b.ATTR1 as sub_ATTR1, b.ATTR2 as sub_ATTR2, b.ATTR3 as sub_ATTR3, b.ATTR4 as sub_ATTR4, b.CREATE_BY as sub_CREATE_BY, b.CREATE_TIME as sub_CREATE_TIME, b.UPDATE_BY as sub_UPDATE_BY, b.UPDATE_TIME as sub_UPDATE_TIME
from BOM_ROUTE a
left join MBB_PRODU_BOM b on b.BOM_ROUTE_ID = a.BOM_ROUTE_ID
where a.BOM_ROUTE_ID = #{bomRouteId}
</select>
<insert id="insertBomRoute" parameterType="BomRoute" useGeneratedKeys="true" keyProperty="bomRouteId">
insert into BOM_ROUTE
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bomCode != null and bomCode != ''">BOM_CODE,</if>
<if test="bomName != null and bomName != ''">BOM_NAME,</if>
<if test="bomVersion != null and bomVersion != ''">BOM_VERSION,</if>
<if test="mdItemId != null">MD_ITEM_ID,</if>
<if test="isDefault != null and isDefault != ''">IS_DEFAULT,</if>
<if test="remark != null">REMARK,</if>
<if test="attr1 != null">ATTR1,</if>
<if test="attr2 != null">ATTR2,</if>
<if test="attr3 != null">ATTR3,</if>
<if test="attr4 != null">ATTR4,</if>
<if test="createBy != null">CREATE_BY,</if>
<if test="createTime != null">CREATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if>
<if test="updateTime != null">UPDATE_TIME,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bomCode != null and bomCode != ''">#{bomCode},</if>
<if test="bomName != null and bomName != ''">#{bomName},</if>
<if test="bomVersion != null and bomVersion != ''">#{bomVersion},</if>
<if test="mdItemId != null">#{mdItemId},</if>
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateBomRoute" parameterType="BomRoute">
update BOM_ROUTE
<trim prefix="SET" suffixOverrides=",">
<if test="bomCode != null and bomCode != ''">BOM_CODE = #{bomCode},</if>
<if test="bomName != null and bomName != ''">BOM_NAME = #{bomName},</if>
<if test="bomVersion != null and bomVersion != ''">BOM_VERSION = #{bomVersion},</if>
<if test="mdItemId != null">MD_ITEM_ID = #{mdItemId},</if>
<if test="isDefault != null and isDefault != ''">IS_DEFAULT = #{isDefault},</if>
<if test="remark != null">REMARK = #{remark},</if>
<if test="attr1 != null">ATTR1 = #{attr1},</if>
<if test="attr2 != null">ATTR2 = #{attr2},</if>
<if test="attr3 != null">ATTR3 = #{attr3},</if>
<if test="attr4 != null">ATTR4 = #{attr4},</if>
<if test="createBy != null">CREATE_BY = #{createBy},</if>
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
</trim>
where BOM_ROUTE_ID = #{bomRouteId}
</update>
<delete id="deleteBomRouteByBomRouteId" parameterType="Long">
delete from BOM_ROUTE where BOM_ROUTE_ID = #{bomRouteId}
</delete>
<delete id="deleteBomRouteByBomRouteIds" parameterType="String">
delete from BOM_ROUTE where BOM_ROUTE_ID in
<foreach item="bomRouteId" collection="array" open="(" separator="," close=")">
#{bomRouteId}
</foreach>
</delete>
<delete id="deleteMbbProduBomByBomRouteIds" parameterType="String">
delete from MBB_PRODU_BOM where BOM_ROUTE_ID in
<foreach item="bomRouteId" collection="array" open="(" separator="," close=")">
#{bomRouteId}
</foreach>
</delete>
<delete id="deleteMbbProduBomByBomRouteId" parameterType="Long">
delete from MBB_PRODU_BOM where BOM_ROUTE_ID = #{bomRouteId}
</delete>
<insert id="batchMbbProduBom">
insert into MBB_PRODU_BOM( MBB_PRODU_BOM_ID, BOM_ROUTE_ID, MD_ITEM_ID, MD_ITEM_NAME, MD_ITEM_CODE, MD_ITEM_UNIT, STANDARD_DOSAGE, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.mbbProduBomId}, #{item.bomRouteId}, #{item.mdItemId}, #{item.mdItemName}, #{item.mdItemCode}, #{item.mdItemUnit}, #{item.standardDosage}, #{item.remark}, #{item.attr1}, #{item.attr2}, #{item.attr3}, #{item.attr4}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
</mapper>