物料附属信息导入

master
陈恒杰 10 months ago
parent 6a4bafb889
commit 5bee31b7e5

@ -1,8 +1,13 @@
package com.op.mes.controller; package com.op.mes.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.op.common.core.domain.ExcelCol;
import com.op.common.core.utils.poi.ExcelMapUtil;
import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
@ -12,6 +17,7 @@ import com.op.common.security.annotation.RequiresPermissions;
import com.op.mes.domain.BaseProductAttached; import com.op.mes.domain.BaseProductAttached;
import com.op.mes.service.IBaseProductAttachedService; import com.op.mes.service.IBaseProductAttachedService;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -22,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.op.common.log.annotation.Log; import com.op.common.log.annotation.Log;
import org.springframework.web.multipart.MultipartFile;
/** /**
* Controller * Controller
@ -83,8 +90,13 @@ public class BaseProductAttachedController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody BaseProductAttached baseProductAttached) public AjaxResult add(@RequestBody BaseProductAttached baseProductAttached)
{ {
if (baseProductAttachedService.checkSpareCodeUnique(baseProductAttached)) {
return AjaxResult.error("备品备件编码已存在!");
} else {
return toAjax(baseProductAttachedService.insertBaseProductAttached(baseProductAttached)); return toAjax(baseProductAttachedService.insertBaseProductAttached(baseProductAttached));
} }
}
/** /**
* *
@ -109,4 +121,82 @@ public class BaseProductAttachedController extends BaseController
{ {
return toAjax(baseProductAttachedService.deleteBaseProductAttachedByIds(ids)); return toAjax(baseProductAttachedService.deleteBaseProductAttachedByIds(ids));
} }
/**
*
*
* @param response
* @throws IOException
*/
@PostMapping("/importTemplate")
@Log(title = "生成备品备件信息模板", businessType = BusinessType.EXPORT)
public void importTemplate(HttpServletResponse response) throws IOException {
ArrayList<ExcelCol> excelCols = new ArrayList<>();
excelCols.add(new ExcelCol("产品编号", "productCode", 20));
excelCols.add(new ExcelCol("品类", "category", 20));
excelCols.add(new ExcelCol("每PC单圈", "pc", 20));
excelCols.add(new ExcelCol("标准效率", "iei", 20));
excelCols.add(new ExcelCol("标准用人", "manStandar", 20));
excelCols.add(new ExcelCol("喷药方式", "sprayWay", 20));
excelCols.add(new ExcelCol("白坯直径", "blankDiameter", 20));
excelCols.add(new ExcelCol("白坯物料号", "blankNo", 20));
excelCols.add(new ExcelCol("标准喷药量", "sprayVolume", 20));
excelCols.add(new ExcelCol("药液料号", "liquidNo", 20));
excelCols.add(new ExcelCol("标准内膜用量", "endometrialDosage", 20));
excelCols.add(new ExcelCol("标准外模用量(KG/PC)", "outerFilmDosage", 20));
excelCols.add(new ExcelCol("支架", "support", 20));
excelCols.add(new ExcelCol("支架物料号", "supportNo", 20));
excelCols.add(new ExcelCol("吸塑", "pvc", 20));
excelCols.add(new ExcelCol("支架盘", "supportPlate", 20));
excelCols.add(new ExcelCol("创建人", "createBy", 20));
excelCols.add(new ExcelCol("库检周期", "warehouseCycle", 20));
excelCols.add(new ExcelCol("托盘上箱数", "palletNum", 20));
excelCols.add(new ExcelCol("垛形", "packType", 20));
String titleName = "物料附属信息导入";
SXSSFWorkbook workbook = null;
try {
//设置响应头
response.setHeader("Content-disposition",
"attachment; filename=" + titleName);
response.setContentType("application/octet-stream;charset=UTF-8");
ServletOutputStream outputStream = response.getOutputStream();
//调用工具类
workbook = ExcelMapUtil.initWorkbook(titleName, null, excelCols, null);
workbook.write(outputStream);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (workbook != null) {
workbook.dispose();
}
}
}
/**
*
*
* @param file
* @return
* @throws Exception
*/
@Log(title = "导入物料基本信息", businessType = BusinessType.IMPORT)
@PostMapping("/importFile")
@RequiresPermissions("mes:attached:import")
public AjaxResult importFile(MultipartFile file) throws Exception {
// 创建接收对象
ExcelUtil<BaseProductAttached> util = new ExcelUtil<>(BaseProductAttached.class);
// 接收表格信息
List<BaseProductAttached> orderList = util.importExcel(file.getInputStream());
return baseProductAttachedService.importFile(orderList);
}
} }

@ -54,7 +54,7 @@ public class BaseProductAttached extends BaseEntity
private String blankNo; private String blankNo;
/** 标准喷药量KG/PC */ /** 标准喷药量KG/PC */
@Excel(name = "标准喷药量", readConverterExp = "K=G/PC") @Excel(name = "标准喷药量")
private BigDecimal sprayVolume; private BigDecimal sprayVolume;
/** 药液料号 */ /** 药液料号 */
@ -62,7 +62,7 @@ public class BaseProductAttached extends BaseEntity
private String liquidNo; private String liquidNo;
/** 标准内膜用量KG/PC */ /** 标准内膜用量KG/PC */
@Excel(name = "标准内膜用量", readConverterExp = "K=G/PC") @Excel(name = "标准内膜用量")
private BigDecimal endometrialDosage; private BigDecimal endometrialDosage;
/** 标准外模用量(KG/PC) */ /** 标准外模用量(KG/PC) */
@ -89,191 +89,225 @@ public class BaseProductAttached extends BaseEntity
@Excel(name = "其它") @Excel(name = "其它")
private String other; private String other;
public void setId(String id) /** 创建人 */
{ @Excel(name = "创建人")
private String createBy;
/** 库检周期 */
@Excel(name = "库检周期")
private String warehouseCycle;
/** 托盘上箱数 */
@Excel(name = "托盘上箱数")
private BigDecimal palletNum;
/** 垛形 */
@Excel(name = "垛形")
private String packType;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id; this.id = id;
} }
public String getId() public String getProductCode() {
{ return productCode;
return id;
} }
public void setProductCode(String productCode)
{ public void setProductCode(String productCode) {
this.productCode = productCode; this.productCode = productCode;
} }
public String getProductCode() public String getCategory() {
{ return category;
return productCode;
} }
public void setCategory(String category)
{ public void setCategory(String category) {
this.category = category; this.category = category;
} }
public String getCategory() public String getPc() {
{ return pc;
return category;
} }
public void setPc(String pc)
{ public void setPc(String pc) {
this.pc = pc; this.pc = pc;
} }
public String getPc() public BigDecimal getIei() {
{ return iei;
return pc;
} }
public void setIei(BigDecimal iei)
{ public void setIei(BigDecimal iei) {
this.iei = iei; this.iei = iei;
} }
public BigDecimal getIei() public BigDecimal getManStandar() {
{ return manStandar;
return iei;
} }
public void setManStandar(BigDecimal manStandar)
{ public void setManStandar(BigDecimal manStandar) {
this.manStandar = manStandar; this.manStandar = manStandar;
} }
public BigDecimal getManStandar() public String getSprayWay() {
{ return sprayWay;
return manStandar;
} }
public void setSprayWay(String sprayWay)
{ public void setSprayWay(String sprayWay) {
this.sprayWay = sprayWay; this.sprayWay = sprayWay;
} }
public String getSprayWay() public BigDecimal getBlankDiameter() {
{ return blankDiameter;
return sprayWay;
} }
public void setBlankDiameter(BigDecimal blankDiameter)
{ public void setBlankDiameter(BigDecimal blankDiameter) {
this.blankDiameter = blankDiameter; this.blankDiameter = blankDiameter;
} }
public BigDecimal getBlankDiameter() public String getBlankNo() {
{ return blankNo;
return blankDiameter;
} }
public void setBlankNo(String blankNo)
{ public void setBlankNo(String blankNo) {
this.blankNo = blankNo; this.blankNo = blankNo;
} }
public String getBlankNo() public BigDecimal getSprayVolume() {
{ return sprayVolume;
return blankNo;
} }
public void setSprayVolume(BigDecimal sprayVolume)
{ public void setSprayVolume(BigDecimal sprayVolume) {
this.sprayVolume = sprayVolume; this.sprayVolume = sprayVolume;
} }
public BigDecimal getSprayVolume() public String getLiquidNo() {
{ return liquidNo;
return sprayVolume;
} }
public void setLiquidNo(String liquidNo)
{ public void setLiquidNo(String liquidNo) {
this.liquidNo = liquidNo; this.liquidNo = liquidNo;
} }
public String getLiquidNo() public BigDecimal getEndometrialDosage() {
{ return endometrialDosage;
return liquidNo;
} }
public void setEndometrialDosage(BigDecimal endometrialDosage)
{ public void setEndometrialDosage(BigDecimal endometrialDosage) {
this.endometrialDosage = endometrialDosage; this.endometrialDosage = endometrialDosage;
} }
public BigDecimal getEndometrialDosage() public BigDecimal getOuterFilmDosage() {
{ return outerFilmDosage;
return endometrialDosage;
} }
public void setOuterFilmDosage(BigDecimal outerFilmDosage)
{ public void setOuterFilmDosage(BigDecimal outerFilmDosage) {
this.outerFilmDosage = outerFilmDosage; this.outerFilmDosage = outerFilmDosage;
} }
public BigDecimal getOuterFilmDosage() public Long getSupport() {
{ return support;
return outerFilmDosage;
} }
public void setSupport(Long support)
{ public void setSupport(Long support) {
this.support = support; this.support = support;
} }
public Long getSupport() public String getSupportNo() {
{ return supportNo;
return support;
} }
public void setSupportNo(String supportNo)
{ public void setSupportNo(String supportNo) {
this.supportNo = supportNo; this.supportNo = supportNo;
} }
public String getSupportNo() public Long getPvc() {
{ return pvc;
return supportNo;
} }
public void setPvc(Long pvc)
{ public void setPvc(Long pvc) {
this.pvc = pvc; this.pvc = pvc;
} }
public Long getPvc() public Long getSupportPlate() {
{ return supportPlate;
return pvc;
} }
public void setSupportPlate(Long supportPlate)
{ public void setSupportPlate(Long supportPlate) {
this.supportPlate = supportPlate; this.supportPlate = supportPlate;
} }
public Long getSupportPlate() public String getOther() {
{ return other;
return supportPlate;
} }
public void setOther(String other)
{ public void setOther(String other) {
this.other = other; this.other = other;
} }
public String getOther() @Override
{ public String getCreateBy() {
return other; return createBy;
}
@Override
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getWarehouseCycle() {
return warehouseCycle;
}
public void setWarehouseCycle(String warehouseCycle) {
this.warehouseCycle = warehouseCycle;
}
public BigDecimal getPalletNum() {
return palletNum;
}
public void setPalletNum(BigDecimal palletNum) {
this.palletNum = palletNum;
}
public String getPackType() {
return packType;
}
public void setPackType(String packType) {
this.packType = packType;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return "BaseProductAttached{" +
.append("id", getId()) "id='" + id + '\'' +
.append("productCode", getProductCode()) ", productCode='" + productCode + '\'' +
.append("category", getCategory()) ", category='" + category + '\'' +
.append("pc", getPc()) ", pc='" + pc + '\'' +
.append("iei", getIei()) ", iei=" + iei +
.append("manStandar", getManStandar()) ", manStandar=" + manStandar +
.append("sprayWay", getSprayWay()) ", sprayWay='" + sprayWay + '\'' +
.append("blankDiameter", getBlankDiameter()) ", blankDiameter=" + blankDiameter +
.append("blankNo", getBlankNo()) ", blankNo='" + blankNo + '\'' +
.append("sprayVolume", getSprayVolume()) ", sprayVolume=" + sprayVolume +
.append("liquidNo", getLiquidNo()) ", liquidNo='" + liquidNo + '\'' +
.append("endometrialDosage", getEndometrialDosage()) ", endometrialDosage=" + endometrialDosage +
.append("outerFilmDosage", getOuterFilmDosage()) ", outerFilmDosage=" + outerFilmDosage +
.append("support", getSupport()) ", support=" + support +
.append("supportNo", getSupportNo()) ", supportNo='" + supportNo + '\'' +
.append("pvc", getPvc()) ", pvc=" + pvc +
.append("supportPlate", getSupportPlate()) ", supportPlate=" + supportPlate +
.append("other", getOther()) ", other='" + other + '\'' +
.append("createBy", getCreateBy()) ", createBy='" + createBy + '\'' +
.toString(); ", warehouseCycle='" + warehouseCycle + '\'' +
", palletNum=" + palletNum +
", packType='" + packType + '\'' +
'}';
} }
} }

@ -59,4 +59,9 @@ public interface BaseProductAttachedMapper
* @return * @return
*/ */
public int deleteBaseProductAttachedByIds(String[] ids); public int deleteBaseProductAttachedByIds(String[] ids);
BaseProductAttached selectBaseProductAttachedByProductCode(String productCode);
//检查productCode
String checkSpareCodeUnique(BaseProductAttached baseProductAttached);
} }

@ -3,6 +3,7 @@ package com.op.mes.service;
import java.util.List; import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.BaseProductAttached; import com.op.mes.domain.BaseProductAttached;
@ -61,4 +62,8 @@ public interface IBaseProductAttachedService
* @return * @return
*/ */
public int deleteBaseProductAttachedById(String id); public int deleteBaseProductAttachedById(String id);
AjaxResult importFile(List<BaseProductAttached> list);
boolean checkSpareCodeUnique(BaseProductAttached baseProductAttached);
} }

@ -4,12 +4,25 @@ import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.utils.SecurityUtils;
import com.op.mes.domain.BaseProductAttached; import com.op.mes.domain.BaseProductAttached;
import com.op.mes.mapper.BaseProductAttachedMapper; import com.op.mes.mapper.BaseProductAttachedMapper;
import com.op.mes.service.IBaseProductAttachedService; import com.op.mes.service.IBaseProductAttachedService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
@ -24,6 +37,8 @@ public class BaseProductAttachedServiceImpl implements IBaseProductAttachedServi
@Autowired @Autowired
private BaseProductAttachedMapper baseProductAttachedMapper; private BaseProductAttachedMapper baseProductAttachedMapper;
protected Logger logger = LoggerFactory.getLogger(getClass());
/** /**
* *
* *
@ -62,6 +77,7 @@ public class BaseProductAttachedServiceImpl implements IBaseProductAttachedServi
{ {
baseProductAttached.setId(IdUtils.fastSimpleUUID()); baseProductAttached.setId(IdUtils.fastSimpleUUID());
baseProductAttached.setCreateTime(DateUtils.getNowDate()); baseProductAttached.setCreateTime(DateUtils.getNowDate());
baseProductAttached.setCreateBy(SecurityUtils.getUsername());
return baseProductAttachedMapper.insertBaseProductAttached(baseProductAttached); return baseProductAttachedMapper.insertBaseProductAttached(baseProductAttached);
} }
@ -104,4 +120,171 @@ public class BaseProductAttachedServiceImpl implements IBaseProductAttachedServi
{ {
return baseProductAttachedMapper.deleteBaseProductAttachedById(id); return baseProductAttachedMapper.deleteBaseProductAttachedById(id);
} }
/**
*
* @param baseProductAttached
* @return
*/
@Override
@DS("#header.poolName")
@Transactional
public AjaxResult importFile(List<BaseProductAttached> baseProductAttached) {
BaseProductAttached example=null;
for (BaseProductAttached table : baseProductAttached) {
table.setId(IdUtils.fastSimpleUUID());
table.setCreateBy(SecurityUtils.getUsername());
}
//数据校验
// 数据校验
AjaxResult checkResult = checkImportFile(baseProductAttached);
// 如果数据校验成功
if (checkResult.isSuccess()) {
String info = syncImportFunc(baseProductAttached);
return success("信息导入完成。其中导入失败的信息:" + info);
}
// 校验失败
return checkResult;
}
private String syncImportFunc(List<BaseProductAttached> baseProductAttached) {
String failEquipment = "";
for (BaseProductAttached table : baseProductAttached) {
String msg = syncFunc(table);
if (StringUtils.isNotBlank(msg)) {
failEquipment += msg + ",";
}
}
return failEquipment;
}
@Transactional(rollbackFor = Exception.class)
public String syncFunc(BaseProductAttached table) {
String failSpareParts = "";
BaseProductAttached Exist = baseProductAttachedMapper.selectBaseProductAttachedByProductCode(table.getProductCode());
//不存在就插入
if (Exist == null) {
baseProductAttachedMapper.insertBaseProductAttached(table);
logger.info("=======物料附属信息" + table.getProductCode() + "=======导入成功");
//存在,不允许插入
} else {
failSpareParts = table.getProductCode();
logger.info("=======物料附属信息" + failSpareParts + "=======导入失败");
}
return failSpareParts;
}
/**
*
*/
public AjaxResult checkImportFile(List<BaseProductAttached> baseProductAttached){
// 传入对象不能为空
if (baseProductAttached.size() == 0 || StringUtils.isNull(baseProductAttached)) {
return error(500, "导入的信息不能为空!信息导入失败!");
}
for (BaseProductAttached productAttached : baseProductAttached) {
//产品编码
if (productAttached.getProductCode().isEmpty() || productAttached.getProductCode()==null){
return error(500, "产品编号不能为空!信息导入失败!");
}
//品类
if (productAttached.getCategory().isEmpty() || productAttached.getCategory()==null){
return error(500, "品类不能为空!信息导入失败!");
}
//每PC单圈
if (productAttached.getPc().isEmpty() || productAttached.getPc()==null){
return error(500, "每PC单圈不能为空信息导入失败");
}
//标准效率
if (productAttached.getIei().toString().isEmpty() || productAttached.getIei()==null){
return error(500, "标准效率不能为空!信息导入失败!");
}
//标准用人
if (productAttached.getManStandar().toString().isEmpty() || productAttached.getManStandar()==null){
return error(500, "标准用人不能为空!信息导入失败!");
}
//喷药方式
// if (productAttached.getSprayWay().isEmpty() || productAttached.getSprayWay()==null){
// return error(500, "喷药方式不能为空!信息导入失败!");
// }
//白坯直径
if (productAttached.getBlankDiameter().toString().isEmpty() || productAttached.getBlankDiameter()==null){
return error(500, "白坯直径不能为空!信息导入失败!");
}
//白坯物料号
if (productAttached.getBlankNo().isEmpty() || productAttached.getBlankNo()==null){
return error(500, "白坯物料号不能为空!信息导入失败!");
}
//标准喷药量
if (productAttached.getSprayVolume().toString().isEmpty() || productAttached.getSprayVolume()==null){
return error(500, "标准喷药量不能为空!信息导入失败!");
}
//药液料号
if (productAttached.getLiquidNo().isEmpty() || productAttached.getLiquidNo()==null){
return error(500, "药液料号不能为空!信息导入失败!");
}
//标准内膜用量
if (productAttached.getEndometrialDosage().toString().isEmpty() || productAttached.getEndometrialDosage()==null){
return error(500, "标准内膜用量不能为空!信息导入失败!");
}
//标准外膜用量
if (productAttached.getOuterFilmDosage().toString().isEmpty() || productAttached.getOuterFilmDosage()==null){
return error(500, "标准外膜用量不能为空!信息导入失败!");
}
//支架
if (productAttached.getSupport().toString().isEmpty() || productAttached.getSupport()==null){
return error(500, "支架不能为空!信息导入失败!");
}
//支架物料号
if (productAttached.getSupportNo().isEmpty() || productAttached.getSupportNo()==null){
return error(500, "支架物料号不能为空!信息导入失败!");
}
//吸塑
if (productAttached.getPvc().toString().isEmpty() || productAttached.getPvc()==null){
return error(500, "吸塑不能为空!信息导入失败!");
}
//支架盘
if (productAttached.getSupportPlate().toString().isEmpty() || productAttached.getSupportPlate()==null){
return error(500, "支架盘不能为空!信息导入失败!");
}
//库检周期
if (productAttached.getWarehouseCycle().isEmpty() || productAttached.getSupportPlate()==null){
return error(500, "库检周期不能为空!信息导入失败!");
}
//库检周期
if (productAttached.getWarehouseCycle().isEmpty() || productAttached.getWarehouseCycle()==null){
return error(500, "库检周期不能为空!信息导入失败!");
}
//托盘上箱数
if (productAttached.getPalletNum().toString().isEmpty() || productAttached.getPalletNum()==null){
return error(500, "托盘上箱数不能为空!信息导入失败!");
}
//垛形
if (productAttached.getPackType().isEmpty() || productAttached.getPackType()==null){
return error(500, "垛形不能为空!信息导入失败!");
}
}
return success();
}
@Override
@DS("#header.poolName")
public boolean checkSpareCodeUnique(BaseProductAttached baseProductAttached) {
String spareCode = baseProductAttachedMapper.checkSpareCodeUnique(baseProductAttached);
if (spareCode == null) {
return false;
} else {
return true;
}
}
} }

@ -24,10 +24,15 @@
<result property="supportPlate" column="support_plate" /> <result property="supportPlate" column="support_plate" />
<result property="other" column="other" /> <result property="other" column="other" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="warehouseCycle" column="warehouse_cycle" />
<result property="palletNum" column="pallet_num" />
<result property="packType" column="pack_type" />
</resultMap> </resultMap>
<sql id="selectBaseProductAttachedVo"> <sql id="selectBaseProductAttachedVo">
select id, product_code, category, pc, iei, man_standar, spray_way, blank_diameter, blank_no, spray_volume, liquid_no, endometrial_dosage, outer_film_dosage, support, support_no, pvc, support_plate, other, create_by from base_product_attached select id, product_code, category, pc, iei, man_standar, spray_way, blank_diameter, blank_no, spray_volume, liquid_no, endometrial_dosage, outer_film_dosage, support, support_no, pvc,
support_plate,
other, create_by, warehouse_cycle,pallet_num,pack_type from base_product_attached
</sql> </sql>
<select id="selectBaseProductAttachedList" parameterType="BaseProductAttached" resultMap="BaseProductAttachedResult"> <select id="selectBaseProductAttachedList" parameterType="BaseProductAttached" resultMap="BaseProductAttachedResult">
@ -50,6 +55,11 @@
<if test="pvc != null "> and pvc = #{pvc}</if> <if test="pvc != null "> and pvc = #{pvc}</if>
<if test="supportPlate != null "> and support_plate = #{supportPlate}</if> <if test="supportPlate != null "> and support_plate = #{supportPlate}</if>
<if test="other != null and other != ''"> and other = #{other}</if> <if test="other != null and other != ''"> and other = #{other}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="warehouseCycle != null and warehouseCycle != ''"> and warehouse_cycle = #{warehouseCycle}</if>
<if test="palletNum != null and palletNum != ''"> and pallet_num = #{palletNum}</if>
<if test="packType != null and packType != ''"> and pack_type = #{packType}</if>
</where> </where>
</select> </select>
@ -58,6 +68,17 @@
where id = #{id} where id = #{id}
</select> </select>
<select id="selectBaseProductAttachedByProductCode" parameterType="String" resultMap="BaseProductAttachedResult">
<include refid="selectBaseProductAttachedVo"/>
where product_code = #{productCode}
</select>
<select id="checkSpareCodeUnique" parameterType="BaseProductAttached" resultType="java.lang.String">
select product_code
from base_product_attached
where product_code = #{productCode}
</select>
<insert id="insertBaseProductAttached" parameterType="BaseProductAttached"> <insert id="insertBaseProductAttached" parameterType="BaseProductAttached">
insert into base_product_attached insert into base_product_attached
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -80,6 +101,10 @@
<if test="supportPlate != null">support_plate,</if> <if test="supportPlate != null">support_plate,</if>
<if test="other != null">other,</if> <if test="other != null">other,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="warehouseCycle != null">warehouse_cycle,</if>
<if test="palletNum != null">pallet_num,</if>
<if test="packType != null">pack_type,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
@ -101,6 +126,9 @@
<if test="supportPlate != null">#{supportPlate},</if> <if test="supportPlate != null">#{supportPlate},</if>
<if test="other != null">#{other},</if> <if test="other != null">#{other},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="warehouseCycle != null">#{warehouseCycle},</if>
<if test="palletNum != null">#{palletNum},</if>
<if test="packType != null">#{packType},</if>
</trim> </trim>
</insert> </insert>
@ -125,6 +153,11 @@
<if test="supportPlate != null">support_plate = #{supportPlate},</if> <if test="supportPlate != null">support_plate = #{supportPlate},</if>
<if test="other != null">other = #{other},</if> <if test="other != null">other = #{other},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="warehouseCycle != null">warehouse_cycle = #{warehouseCycle},</if>
<if test="palletNum != null">pallet_num = #{palletNum},</if>
<if test="packType != null">pack_type = #{packType},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

Loading…
Cancel
Save