|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package org.dromara.qms.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
@ -9,13 +10,23 @@ import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.qms.domain.QcInspectionItemCategory;
|
|
|
|
|
import org.dromara.qms.domain.QcInspectionType;
|
|
|
|
|
import org.dromara.qms.domain.QcTemplateItem;
|
|
|
|
|
import org.dromara.qms.domain.bo.QcTemplateItemBo;
|
|
|
|
|
import org.dromara.qms.domain.vo.QcTemplateItemVo;
|
|
|
|
|
import org.dromara.qms.mapper.QcTemplateItemMapper;
|
|
|
|
|
import org.dromara.qms.service.IQcTemplateItemService;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.dromara.qms.domain.bo.QcInspectionItemBo;
|
|
|
|
|
import org.dromara.qms.domain.vo.QcInspectionItemVo;
|
|
|
|
|
import org.dromara.qms.domain.QcInspectionItem;
|
|
|
|
|
import org.dromara.qms.mapper.QcInspectionItemMapper;
|
|
|
|
|
import org.dromara.qms.service.IQcInspectionItemService;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
@ -32,6 +43,9 @@ public class QcInspectionItemServiceImpl implements IQcInspectionItemService {
|
|
|
|
|
|
|
|
|
|
private final QcInspectionItemMapper baseMapper;
|
|
|
|
|
|
|
|
|
|
private final QcTemplateItemMapper qcTemplateItemMapper;
|
|
|
|
|
private final IQcTemplateItemService qcTemplateItemService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询检测项定义
|
|
|
|
|
*
|
|
|
|
|
@ -73,6 +87,14 @@ public class QcInspectionItemServiceImpl implements IQcInspectionItemService {
|
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
|
MPJLambdaWrapper<QcInspectionItem> lqw = JoinWrappers.lambda(QcInspectionItem.class)
|
|
|
|
|
.selectAll(QcInspectionItem.class)
|
|
|
|
|
|
|
|
|
|
//检测项类别名称
|
|
|
|
|
.select(QcInspectionItemCategory::getCategoryName)
|
|
|
|
|
.leftJoin(QcInspectionItemCategory.class,QcInspectionItemCategory::getCategoryId,QcInspectionItem::getCategoryId)
|
|
|
|
|
|
|
|
|
|
.select(QcInspectionType::getTypeName,QcInspectionType::getTypeCode)
|
|
|
|
|
.leftJoin(QcInspectionType.class,QcInspectionType::getTypeId,QcInspectionItem::getInspectionType)
|
|
|
|
|
|
|
|
|
|
.eq(bo.getItemId() != null, QcInspectionItem::getItemId, bo.getItemId())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getItemCode()), QcInspectionItem::getItemCode, bo.getItemCode())
|
|
|
|
|
.like(StringUtils.isNotBlank(bo.getItemName()), QcInspectionItem::getItemName, bo.getItemName())
|
|
|
|
|
@ -120,9 +142,35 @@ public class QcInspectionItemServiceImpl implements IQcInspectionItemService {
|
|
|
|
|
* @return 是否修改成功
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public Boolean updateByBo(QcInspectionItemBo bo) {
|
|
|
|
|
QcInspectionItem update = MapstructUtils.convert(bo, QcInspectionItem.class);
|
|
|
|
|
validEntityBeforeSave(update);
|
|
|
|
|
|
|
|
|
|
// 创建一个新的QcTemplateItemBo对象
|
|
|
|
|
QcTemplateItem qcTemplateItem = new QcTemplateItem();
|
|
|
|
|
QcTemplateItemVo newQcTemplateItem = qcTemplateItemMapper.selectQcTemplateItemByItemId(update.getItemId());
|
|
|
|
|
newQcTemplateItem.setItemCode(update.getItemCode());
|
|
|
|
|
newQcTemplateItem.setItemName(update.getItemName());
|
|
|
|
|
newQcTemplateItem.setInspectionItemCode(update.getItemCode());
|
|
|
|
|
newQcTemplateItem.setInspectionItemName(update.getItemName());
|
|
|
|
|
newQcTemplateItem.setInspectionPosition(update.getInspectionPosition());
|
|
|
|
|
newQcTemplateItem.setCategoryName(update.getCategoryName());
|
|
|
|
|
newQcTemplateItem.setInspectionType(update.getInspectionType());
|
|
|
|
|
newQcTemplateItem.setDetectType(update.getDetectType());
|
|
|
|
|
newQcTemplateItem.setControlType(update.getControlType());
|
|
|
|
|
newQcTemplateItem.setStandardValue(update.getStandardValue());
|
|
|
|
|
newQcTemplateItem.setUpperLimit(update.getUpperLimit());
|
|
|
|
|
newQcTemplateItem.setLowerLimit(update.getLowerLimit());
|
|
|
|
|
newQcTemplateItem.setSpecName(update.getSpecName());
|
|
|
|
|
newQcTemplateItem.setSpecUpper(update.getSpecUpper());
|
|
|
|
|
newQcTemplateItem.setSpecLower(update.getSpecLower());
|
|
|
|
|
newQcTemplateItem.setDescription(update.getDescription());
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(newQcTemplateItem, qcTemplateItem);
|
|
|
|
|
// qcTemplateItemService.updateByBo(qcTemplateItemBo);
|
|
|
|
|
qcTemplateItemMapper.updateById(qcTemplateItem);
|
|
|
|
|
|
|
|
|
|
return baseMapper.updateById(update) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|