zss
3 天以前 9d42f647f5589e4a560d745d6b359ae6c273bd8d
src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationParamServiceImpl.java
@@ -41,21 +41,21 @@
    public boolean saveTechnologyOperationParam(TechnologyOperationParam technologyOperationParam) {
        if (technologyOperationParam.getTechnologyOperationId() == null
                || technologyOperationMapper.selectById(technologyOperationParam.getTechnologyOperationId()) == null) {
            throw new ServiceException("Operation not found");
            throw new ServiceException("工序不存在");
        }
        if (technologyOperationParam.getTechnologyParamId() == null) {
            throw new ServiceException("Param is required");
            throw new ServiceException("参数ID不能为空");
        }
        TechnologyParam technologyParam = technologyParamMapper.selectById(technologyOperationParam.getTechnologyParamId());
        if (technologyParam == null) {
            throw new ServiceException("Param not found");
            throw new ServiceException("参数不存在");
        }
        boolean duplicate = technologyOperationParamMapper.selectCount(Wrappers.<TechnologyOperationParam>lambdaQuery()
                .eq(TechnologyOperationParam::getTechnologyOperationId, technologyOperationParam.getTechnologyOperationId())
                .eq(TechnologyOperationParam::getTechnologyParamId, technologyOperationParam.getTechnologyParamId())
                .ne(technologyOperationParam.getId() != null, TechnologyOperationParam::getId, technologyOperationParam.getId())) > 0;
        if (duplicate) {
            throw new ServiceException("Duplicate param in operation");
            throw new ServiceException("工序参数重复");
        }
        return this.saveOrUpdate(technologyOperationParam);
    }