industrial_measurement/src/main/java/com/xkrs/service/impl/QcInspectionSpecServiceImpl.java
2022-02-28 19:53:50 +08:00

53 lines
2.0 KiB
Java

package com.xkrs.service.impl;
import com.xkrs.dao.QcInspectionItemDictDao;
import com.xkrs.dao.QcInspectionSpecDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.QcInspectionSpecEntity;
import com.xkrs.model.qo.QcInspectionSpecQo;
import com.xkrs.service.QcInspectionSpecService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Locale;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@Service
public class QcInspectionSpecServiceImpl implements QcInspectionSpecService {
@Resource
private QcInspectionSpecDao inspectionSpecDao;
@Resource
private QcInspectionItemDictDao inspectionItemDictDao;
/**
* 新增规格数据
*
* @param inspectionSpecQo
* @return
*/
@Override
public String insertSpec(QcInspectionSpecQo inspectionSpecQo) {
Locale locale = LocaleContextHolder.getLocale();
QcInspectionSpecEntity inspectionSpec = new QcInspectionSpecEntity();
if (inspectionSpecQo.getId() > 0) {
inspectionSpec.setId(inspectionSpecQo.getId());
}
inspectionSpec.setPartNo(inspectionSpecQo.getPartNo());
inspectionSpec.setInspectionItemCode(inspectionSpecQo.getInspectionItemCode());
inspectionSpec.setMax(inspectionSpecQo.getMax());
inspectionSpec.setMean(inspectionSpecQo.getMean());
inspectionSpec.setMin(inspectionSpecQo.getMin());
inspectionSpec.setUnit(inspectionSpecQo.getUnit());
inspectionSpec.setInspectionMethod(inspectionSpecQo.getInspectionMethod());
inspectionSpec.setInspectionStandard(inspectionSpecQo.getInspectionStandard());
inspectionSpec.setRemark(inspectionSpecQo.getRemark());
inspectionSpecDao.save(inspectionSpec);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
}