package jnpf.dmsService.impl; import jnpf.dmsMapper.DmsWenjianBianhaoGuizeMapper; import jnpf.dmsService.DmsWenjianBianhaoGuizeShengbanCheckService; import jnpf.exception.DataException; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor public class DmsWenjianBianhaoGuizeShengbanCheckServiceImpl implements DmsWenjianBianhaoGuizeShengbanCheckService { private final DmsWenjianBianhaoGuizeMapper guizeMapper; @Override public void check(String fId, String guizeLiushuihao, String banbenhao) throws DataException { String resolvedLiushuihao = trimToEmpty(guizeLiushuihao); if (resolvedLiushuihao.isEmpty()) { return; } String resolvedId = trimToEmpty(fId); String resolvedBanbenhao = trimToEmpty(banbenhao); if (guizeMapper.countByLiushuihaoAndBanbenhao( resolvedLiushuihao, resolvedBanbenhao, resolvedId) > 0) { throw new DataException("版本号已存在,请升级版本号"); } } private String trimToEmpty(String value) { return value == null ? "" : value.trim(); } }