|
|
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.printconfig.vo.PrinterConfig
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.printconfig.vo.PrinterConfigSaveReqVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.printconfig.vo.PrinterConfigSaveReqVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.printconfig.PrinterConfigDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.printconfig.PrinterConfigDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.printconfig.PrinterConfigMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.printconfig.PrinterConfigMapper;
|
|
|
|
|
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
@ -14,8 +15,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.CONFIG_NOT_EXISTS;
|
|
|
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.CONFIG_NOT_EXISTS;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.CONFIG_EXISTS;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 打印机配置 Service 实现类
|
|
|
|
* 打印机配置 Service 实现类
|
|
|
|
@ -30,10 +33,16 @@ public class PrinterConfigServiceImpl implements PrinterConfigService {
|
|
|
|
private PrinterConfigMapper printerConfigMapper;
|
|
|
|
private PrinterConfigMapper printerConfigMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Integer createConfig(PrinterConfigSaveReqVO createReqVO) {
|
|
|
|
public Integer createConfig(PrinterConfigSaveReqVO createReqVO) {
|
|
|
|
// 插入
|
|
|
|
// 插入
|
|
|
|
PrinterConfigDO config = BeanUtils.toBean(createReqVO, PrinterConfigDO.class);
|
|
|
|
PrinterConfigDO config = BeanUtils.toBean(createReqVO, PrinterConfigDO.class);
|
|
|
|
printerConfigMapper.insert(config);
|
|
|
|
try {
|
|
|
|
|
|
|
|
printerConfigMapper.insert(config);
|
|
|
|
|
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
|
|
|
|
|
// 唯一索引冲突
|
|
|
|
|
|
|
|
throw exception(CONFIG_EXISTS);
|
|
|
|
|
|
|
|
}
|
|
|
|
// 返回
|
|
|
|
// 返回
|
|
|
|
return config.getId();
|
|
|
|
return config.getId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|