From 085fa628c0c771c0525ec11cf5bb96a09c00ed48 Mon Sep 17 00:00:00 2001
From: A0010407 <KHD@202303>
Date: Fri, 4 Aug 2023 16:52:11 +0800
Subject: [PATCH] =?UTF-8?q?MES=20=E5=A4=87=E6=96=99=E5=8D=95=E6=98=8E?=
 =?UTF-8?q?=E7=BB=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../MesPrepareDetailController.java           |  97 ++++++++
 .../com/op/wms/domain/MesPrepareDetail.java   | 222 ++++++++++++++++++
 .../op/wms/mapper/MesPrepareDetailMapper.java |  61 +++++
 .../wms/service/IMesPrepareDetailService.java |  60 +++++
 .../impl/MesPrepareDetailServiceImpl.java     |  89 +++++++
 .../mapper/wms/MesPrepareDetailMapper.xml     | 148 ++++++++++++
 6 files changed, 677 insertions(+)
 create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/controller/MesPrepareDetailController.java
 create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/domain/MesPrepareDetail.java
 create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/mapper/MesPrepareDetailMapper.java
 create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/service/IMesPrepareDetailService.java
 create mode 100644 op-modules/op-wms/src/main/java/com/op/wms/service/impl/MesPrepareDetailServiceImpl.java
 create mode 100644 op-modules/op-wms/src/main/resources/mapper/wms/MesPrepareDetailMapper.xml

diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/MesPrepareDetailController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/MesPrepareDetailController.java
new file mode 100644
index 00000000..5d5c634e
--- /dev/null
+++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/MesPrepareDetailController.java
@@ -0,0 +1,97 @@
+package com.op.mes.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+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.op.common.log.annotation.Log;
+import com.op.common.log.enums.BusinessType;
+import com.op.common.security.annotation.RequiresPermissions;
+import com.op.mes.domain.MesPrepareDetail;
+import com.op.mes.service.IMesPrepareDetailService;
+import com.op.common.core.web.controller.BaseController;
+import com.op.common.core.web.domain.AjaxResult;
+import com.op.common.core.utils.poi.ExcelUtil;
+import com.op.common.core.web.page.TableDataInfo;
+
+/**
+ * mes备料单明细Controller
+ * 
+ * @author Open Platform
+ * @date 2023-08-04
+ */
+@RestController
+@RequestMapping("/prepareDetail")
+public class MesPrepareDetailController extends BaseController {
+	@Autowired
+	private IMesPrepareDetailService mesPrepareDetailService;
+
+	/**
+	 * 查询mes备料单明细列表
+	 */
+	@RequiresPermissions("mes:prepareDetail:list")
+	@GetMapping("/list")
+	public TableDataInfo list(MesPrepareDetail mesPrepareDetail) {
+		startPage();
+		List<MesPrepareDetail> list = mesPrepareDetailService.selectMesPrepareDetailList(mesPrepareDetail);
+		return getDataTable(list);
+	}
+
+	/**
+	 * 导出mes备料单明细列表
+	 */
+	@RequiresPermissions("mes:prepareDetail:export")
+	@Log(title = "mes备料单明细", businessType = BusinessType.EXPORT)
+	@PostMapping("/export")
+	public void export(HttpServletResponse response, MesPrepareDetail mesPrepareDetail) {
+		List<MesPrepareDetail> list = mesPrepareDetailService.selectMesPrepareDetailList(mesPrepareDetail);
+		ExcelUtil<MesPrepareDetail> util = new ExcelUtil<MesPrepareDetail>(MesPrepareDetail.class);
+		util.exportExcel(response, list, "mes备料单明细数据");
+	}
+
+	/**
+	 * 获取mes备料单明细详细信息
+	 */
+	@RequiresPermissions("mes:prepareDetail:query")
+	@GetMapping(value = "/{recordId}")
+	public AjaxResult getInfo(@PathVariable("recordId") String recordId) {
+		return success(mesPrepareDetailService.selectMesPrepareDetailByRecordId(recordId));
+	}
+
+	/**
+	 * 新增mes备料单明细
+	 */
+	@RequiresPermissions("mes:prepareDetail:add")
+	@Log(title = "mes备料单明细", businessType = BusinessType.INSERT)
+	@PostMapping
+	public AjaxResult add(@RequestBody MesPrepareDetail mesPrepareDetail) {
+		return toAjax(mesPrepareDetailService.insertMesPrepareDetail(mesPrepareDetail));
+	}
+
+	/**
+	 * 修改mes备料单明细
+	 */
+	@RequiresPermissions("mes:prepareDetail:edit")
+	@Log(title = "mes备料单明细", businessType = BusinessType.UPDATE)
+	@PutMapping
+	public AjaxResult edit(@RequestBody MesPrepareDetail mesPrepareDetail) {
+		return toAjax(mesPrepareDetailService.updateMesPrepareDetail(mesPrepareDetail));
+	}
+
+	/**
+	 * 删除mes备料单明细
+	 */
+	@RequiresPermissions("mes:prepareDetail:remove")
+	@Log(title = "mes备料单明细", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{recordIds}")
+	public AjaxResult remove(@PathVariable String[] recordIds) {
+		return toAjax(mesPrepareDetailService.deleteMesPrepareDetailByRecordIds(recordIds));
+	}
+}
diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/MesPrepareDetail.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/MesPrepareDetail.java
new file mode 100644
index 00000000..6aa48196
--- /dev/null
+++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/MesPrepareDetail.java
@@ -0,0 +1,222 @@
+package com.op.mes.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.op.common.core.annotation.Excel;
+import com.op.common.core.web.domain.BaseEntity;
+
+/**
+ * mes备料单明细对象 mes_prepare_detail
+ * 
+ * @author Open Platform
+ * @date 2023-08-04
+ */
+public class MesPrepareDetail extends BaseEntity {
+	private static final long serialVersionUID = 1L;
+
+	/** ID */
+	private String recordId;
+
+	/** 备料主ID */
+	@Excel(name = "备料主ID")
+	private String prepareId;
+
+	/** 物料编号 */
+	@Excel(name = "物料编号")
+	private String materialCode;
+
+	/** 物料名称 */
+	@Excel(name = "物料名称")
+	private String materailName;
+
+	/** 规格型号 */
+	@Excel(name = "规格型号")
+	private String materailSpc;
+
+	/** 单位 */
+	@Excel(name = "单位")
+	private String unit;
+
+	/** 生产数量 */
+	@Excel(name = "生产数量")
+	private Long quantity;
+
+	/** 工单生产日期 */
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	@Excel(name = "工单生产日期", width = 30, dateFormat = "yyyy-MM-dd")
+	private Date productDate;
+
+	/** 班次 */
+	@Excel(name = "班次")
+	private String shiftId;
+
+	/** 单据状态 */
+	@Excel(name = "单据状态")
+	private String status;
+
+	/** 预留字段1 */
+	@Excel(name = "预留字段1")
+	private String attr1;
+
+	/** 预留字段2 */
+	@Excel(name = "预留字段2")
+	private String attr2;
+
+	/** 预留字段3 */
+	@Excel(name = "预留字段3")
+	private String attr3;
+
+	/** 预留字段4 */
+	@Excel(name = "预留字段4")
+	private String attr4;
+
+	/** 产品类型 */
+	@Excel(name = "产品类型")
+	private String prodType;
+
+	/** $column.columnComment */
+	@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+	private String factoryCode;
+
+	public void setRecordId(String recordId) {
+		this.recordId = recordId;
+	}
+
+	public String getRecordId() {
+		return recordId;
+	}
+	public void setPrepareId(String prepareId) {
+		this.prepareId = prepareId;
+	}
+
+	public String getPrepareId() {
+		return prepareId;
+	}
+	public void setMaterialCode(String materialCode) {
+		this.materialCode = materialCode;
+	}
+
+	public String getMaterialCode() {
+		return materialCode;
+	}
+	public void setMaterailName(String materailName) {
+		this.materailName = materailName;
+	}
+
+	public String getMaterailName() {
+		return materailName;
+	}
+	public void setMaterailSpc(String materailSpc) {
+		this.materailSpc = materailSpc;
+	}
+
+	public String getMaterailSpc() {
+		return materailSpc;
+	}
+	public void setUnit(String unit) {
+		this.unit = unit;
+	}
+
+	public String getUnit() {
+		return unit;
+	}
+	public void setQuantity(Long quantity) {
+		this.quantity = quantity;
+	}
+
+	public Long getQuantity() {
+		return quantity;
+	}
+	public void setProductDate(Date productDate) {
+		this.productDate = productDate;
+	}
+
+	public Date getProductDate() {
+		return productDate;
+	}
+	public void setShiftId(String shiftId) {
+		this.shiftId = shiftId;
+	}
+
+	public String getShiftId() {
+		return shiftId;
+	}
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public String getStatus() {
+		return status;
+	}
+	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 void setProdType(String prodType) {
+		this.prodType = prodType;
+	}
+
+	public String getProdType() {
+		return prodType;
+	}
+	public void setFactoryCode(String factoryCode) {
+		this.factoryCode = factoryCode;
+	}
+
+	public String getFactoryCode() {
+		return factoryCode;
+	}
+
+	@Override
+	public String toString() {
+		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+			.append("recordId", getRecordId())
+			.append("prepareId", getPrepareId())
+			.append("materialCode", getMaterialCode())
+			.append("materailName", getMaterailName())
+			.append("materailSpc", getMaterailSpc())
+			.append("unit", getUnit())
+			.append("quantity", getQuantity())
+			.append("productDate", getProductDate())
+			.append("shiftId", getShiftId())
+			.append("status", getStatus())
+			.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("prodType", getProdType())
+			.append("factoryCode", getFactoryCode())
+			.toString();
+	}
+}
diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/MesPrepareDetailMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/MesPrepareDetailMapper.java
new file mode 100644
index 00000000..0c00dd2d
--- /dev/null
+++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/MesPrepareDetailMapper.java
@@ -0,0 +1,61 @@
+package com.op.mes.mapper;
+
+import java.util.List;
+
+import com.op.mes.domain.MesPrepareDetail;
+
+/**
+ * mes备料单明细Mapper接口
+ * 
+ * @author Open Platform
+ * @date 2023-08-04
+ */
+public interface MesPrepareDetailMapper {
+	/**
+	 * 查询mes备料单明细
+	 * 
+	 * @param recordId mes备料单明细主键
+	 * @return mes备料单明细
+	 */
+	public MesPrepareDetail selectMesPrepareDetailByRecordId(String recordId);
+
+	/**
+	 * 查询mes备料单明细列表
+	 * 
+	 * @param mesPrepareDetail mes备料单明细
+	 * @return mes备料单明细集合
+	 */
+	public List<MesPrepareDetail> selectMesPrepareDetailList(MesPrepareDetail mesPrepareDetail);
+
+	/**
+	 * 新增mes备料单明细
+	 * 
+	 * @param mesPrepareDetail mes备料单明细
+	 * @return 结果
+	 */
+	public int insertMesPrepareDetail(MesPrepareDetail mesPrepareDetail);
+
+	/**
+	 * 修改mes备料单明细
+	 * 
+	 * @param mesPrepareDetail mes备料单明细
+	 * @return 结果
+	 */
+	public int updateMesPrepareDetail(MesPrepareDetail mesPrepareDetail);
+
+	/**
+	 * 删除mes备料单明细
+	 * 
+	 * @param recordId mes备料单明细主键
+	 * @return 结果
+	 */
+	public int deleteMesPrepareDetailByRecordId(String recordId);
+
+	/**
+	 * 批量删除mes备料单明细
+	 * 
+	 * @param recordIds 需要删除的数据主键集合
+	 * @return 结果
+	 */
+	public int deleteMesPrepareDetailByRecordIds(String[] recordIds);
+}
diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IMesPrepareDetailService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IMesPrepareDetailService.java
new file mode 100644
index 00000000..75b0c857
--- /dev/null
+++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IMesPrepareDetailService.java
@@ -0,0 +1,60 @@
+package com.op.mes.service;
+
+import java.util.List;
+import com.op.mes.domain.MesPrepareDetail;
+
+/**
+ * mes备料单明细Service接口
+ * 
+ * @author Open Platform
+ * @date 2023-08-04
+ */
+public interface IMesPrepareDetailService {
+	/**
+	 * 查询mes备料单明细
+	 * 
+	 * @param recordId mes备料单明细主键
+	 * @return mes备料单明细
+	 */
+	public MesPrepareDetail selectMesPrepareDetailByRecordId(String recordId);
+
+	/**
+	 * 查询mes备料单明细列表
+	 * 
+	 * @param mesPrepareDetail mes备料单明细
+	 * @return mes备料单明细集合
+	 */
+	public List<MesPrepareDetail> selectMesPrepareDetailList(MesPrepareDetail mesPrepareDetail);
+
+	/**
+	 * 新增mes备料单明细
+	 * 
+	 * @param mesPrepareDetail mes备料单明细
+	 * @return 结果
+	 */
+	public int insertMesPrepareDetail(MesPrepareDetail mesPrepareDetail);
+
+	/**
+	 * 修改mes备料单明细
+	 * 
+	 * @param mesPrepareDetail mes备料单明细
+	 * @return 结果
+	 */
+	public int updateMesPrepareDetail(MesPrepareDetail mesPrepareDetail);
+
+	/**
+	 * 批量删除mes备料单明细
+	 * 
+	 * @param recordIds 需要删除的mes备料单明细主键集合
+	 * @return 结果
+	 */
+	public int deleteMesPrepareDetailByRecordIds(String[] recordIds);
+
+	/**
+	 * 删除mes备料单明细信息
+	 * 
+	 * @param recordId mes备料单明细主键
+	 * @return 结果
+	 */
+	public int deleteMesPrepareDetailByRecordId(String recordId);
+}
diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/MesPrepareDetailServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/MesPrepareDetailServiceImpl.java
new file mode 100644
index 00000000..bda7f3fc
--- /dev/null
+++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/MesPrepareDetailServiceImpl.java
@@ -0,0 +1,89 @@
+package com.op.mes.service.impl;
+
+import java.util.List;
+import com.op.common.core.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.op.mes.mapper.MesPrepareDetailMapper;
+import com.op.mes.domain.MesPrepareDetail;
+import com.op.mes.service.IMesPrepareDetailService;
+
+/**
+ * mes备料单明细Service业务层处理
+ * 
+ * @author Open Platform
+ * @date 2023-08-04
+ */
+@Service
+public class MesPrepareDetailServiceImpl implements IMesPrepareDetailService {
+	@Autowired
+	private MesPrepareDetailMapper mesPrepareDetailMapper;
+
+	/**
+	 * 查询mes备料单明细
+	 * 
+	 * @param recordId mes备料单明细主键
+	 * @return mes备料单明细
+	 */
+	@Override
+	public MesPrepareDetail selectMesPrepareDetailByRecordId(String recordId) {
+		return mesPrepareDetailMapper.selectMesPrepareDetailByRecordId(recordId);
+	}
+
+	/**
+	 * 查询mes备料单明细列表
+	 * 
+	 * @param mesPrepareDetail mes备料单明细
+	 * @return mes备料单明细
+	 */
+	@Override
+	public List<MesPrepareDetail> selectMesPrepareDetailList(MesPrepareDetail mesPrepareDetail) {
+		return mesPrepareDetailMapper.selectMesPrepareDetailList(mesPrepareDetail);
+	}
+
+	/**
+	 * 新增mes备料单明细
+	 * 
+	 * @param mesPrepareDetail mes备料单明细
+	 * @return 结果
+	 */
+	@Override
+	public int insertMesPrepareDetail(MesPrepareDetail mesPrepareDetail) {
+		mesPrepareDetail.setCreateTime(DateUtils.getNowDate());
+		return mesPrepareDetailMapper.insertMesPrepareDetail(mesPrepareDetail);
+	}
+
+	/**
+	 * 修改mes备料单明细
+	 * 
+	 * @param mesPrepareDetail mes备料单明细
+	 * @return 结果
+	 */
+	@Override
+	public int updateMesPrepareDetail(MesPrepareDetail mesPrepareDetail) {
+		mesPrepareDetail.setUpdateTime(DateUtils.getNowDate());
+		return mesPrepareDetailMapper.updateMesPrepareDetail(mesPrepareDetail);
+	}
+
+	/**
+	 * 批量删除mes备料单明细
+	 * 
+	 * @param recordIds 需要删除的mes备料单明细主键
+	 * @return 结果
+	 */
+	@Override
+	public int deleteMesPrepareDetailByRecordIds(String[] recordIds) {
+		return mesPrepareDetailMapper.deleteMesPrepareDetailByRecordIds(recordIds);
+	}
+
+	/**
+	 * 删除mes备料单明细信息
+	 * 
+	 * @param recordId mes备料单明细主键
+	 * @return 结果
+	 */
+	@Override
+	public int deleteMesPrepareDetailByRecordId(String recordId) {
+		return mesPrepareDetailMapper.deleteMesPrepareDetailByRecordId(recordId);
+	}
+}
diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/MesPrepareDetailMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/MesPrepareDetailMapper.xml
new file mode 100644
index 00000000..b9934f24
--- /dev/null
+++ b/op-modules/op-wms/src/main/resources/mapper/wms/MesPrepareDetailMapper.xml
@@ -0,0 +1,148 @@
+<?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.op.mes.mapper.MesPrepareDetailMapper">
+	
+	<resultMap type="MesPrepareDetail" id="MesPrepareDetailResult">
+		<result property="recordId"	column="record_id"	/>
+		<result property="prepareId"	column="prepare_id"	/>
+		<result property="materialCode"	column="material_code"	/>
+		<result property="materailName"	column="materail_name"	/>
+		<result property="materailSpc"	column="materail_spc"	/>
+		<result property="unit"	column="unit"	/>
+		<result property="quantity"	column="quantity"	/>
+		<result property="productDate"	column="product_date"	/>
+		<result property="shiftId"	column="shift_id"	/>
+		<result property="status"	column="status"	/>
+		<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"	/>
+		<result property="prodType"	column="prod_type"	/>
+		<result property="factoryCode"	column="factory_code"	/>
+	</resultMap>
+
+	<sql id="selectMesPrepareDetailVo">
+		select record_id, prepare_id, material_code, materail_name, materail_spc, unit, quantity, product_date, shift_id, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, prod_type, factory_code from mes_prepare_detail
+	</sql>
+
+	<select id="selectMesPrepareDetailList" parameterType="MesPrepareDetail" resultMap="MesPrepareDetailResult">
+		<include refid="selectMesPrepareDetailVo"/>
+		<where>  
+			<if test="prepareId != null  and prepareId != ''"> and prepare_id = #{prepareId}</if>
+			<if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
+			<if test="materailName != null  and materailName != ''"> and materail_name like concat('%', #{materailName}, '%')</if>
+			<if test="materailSpc != null  and materailSpc != ''"> and materail_spc = #{materailSpc}</if>
+			<if test="unit != null  and unit != ''"> and unit = #{unit}</if>
+			<if test="quantity != null "> and quantity = #{quantity}</if>
+			<if test="productDate != null "> and product_date = #{productDate}</if>
+			<if test="shiftId != null  and shiftId != ''"> and shift_id = #{shiftId}</if>
+			<if test="status != null  and status != ''"> and status = #{status}</if>
+			<if test="attr1 != null  and attr1 != ''"> and attr1 = #{attr1}</if>
+			<if test="attr2 != null  and attr2 != ''"> and attr2 = #{attr2}</if>
+			<if test="attr3 != null  and attr3 != ''"> and attr3 = #{attr3}</if>
+			<if test="attr4 != null  and attr4 != ''"> and attr4 = #{attr4}</if>
+			<if test="prodType != null  and prodType != ''"> and prod_type = #{prodType}</if>
+			<if test="factoryCode != null  and factoryCode != ''"> and factory_code = #{factoryCode}</if>
+		</where>
+	</select>
+	
+	<select id="selectMesPrepareDetailByRecordId" parameterType="String" resultMap="MesPrepareDetailResult">
+		<include refid="selectMesPrepareDetailVo"/>
+		where record_id = #{recordId}
+	</select>
+		
+	<insert id="insertMesPrepareDetail" parameterType="MesPrepareDetail">
+		insert into mes_prepare_detail
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="recordId != null">record_id,</if>
+			<if test="prepareId != null and prepareId != ''">prepare_id,</if>
+			<if test="materialCode != null and materialCode != ''">material_code,</if>
+			<if test="materailName != null and materailName != ''">materail_name,</if>
+			<if test="materailSpc != null">materail_spc,</if>
+			<if test="unit != null and unit != ''">unit,</if>
+			<if test="quantity != null">quantity,</if>
+			<if test="productDate != null">product_date,</if>
+			<if test="shiftId != null">shift_id,</if>
+			<if test="status != null">status,</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>
+			<if test="prodType != null">prod_type,</if>
+			<if test="factoryCode != null">factory_code,</if>
+		 </trim>
+		<trim prefix="values (" suffix=")" suffixOverrides=",">
+			<if test="recordId != null">#{recordId},</if>
+			<if test="prepareId != null and prepareId != ''">#{prepareId},</if>
+			<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
+			<if test="materailName != null and materailName != ''">#{materailName},</if>
+			<if test="materailSpc != null">#{materailSpc},</if>
+			<if test="unit != null and unit != ''">#{unit},</if>
+			<if test="quantity != null">#{quantity},</if>
+			<if test="productDate != null">#{productDate},</if>
+			<if test="shiftId != null">#{shiftId},</if>
+			<if test="status != null">#{status},</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>
+			<if test="prodType != null">#{prodType},</if>
+			<if test="factoryCode != null">#{factoryCode},</if>
+		 </trim>
+	</insert>
+
+	<update id="updateMesPrepareDetail" parameterType="MesPrepareDetail">
+		update mes_prepare_detail
+		<trim prefix="SET" suffixOverrides=",">
+			<if test="prepareId != null and prepareId != ''">prepare_id = #{prepareId},</if>
+			<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
+			<if test="materailName != null and materailName != ''">materail_name = #{materailName},</if>
+			<if test="materailSpc != null">materail_spc = #{materailSpc},</if>
+			<if test="unit != null and unit != ''">unit = #{unit},</if>
+			<if test="quantity != null">quantity = #{quantity},</if>
+			<if test="productDate != null">product_date = #{productDate},</if>
+			<if test="shiftId != null">shift_id = #{shiftId},</if>
+			<if test="status != null">status = #{status},</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>
+			<if test="prodType != null">prod_type = #{prodType},</if>
+			<if test="factoryCode != null">factory_code = #{factoryCode},</if>
+		</trim>
+		where record_id = #{recordId}
+	</update>
+
+	<delete id="deleteMesPrepareDetailByRecordId" parameterType="String">
+		delete from mes_prepare_detail where record_id = #{recordId}
+	</delete>
+
+	<delete id="deleteMesPrepareDetailByRecordIds" parameterType="String">
+		delete from mes_prepare_detail where record_id in 
+		<foreach item="recordId" collection="array" open="(" separator="," close=")">
+			#{recordId}
+		</foreach>
+	</delete>
+</mapper>
\ No newline at end of file