提交 0a480190 authored 作者: ljj's avatar ljj

bug 配套设备库:修改序列号

上级 f8acd380
......@@ -646,6 +646,7 @@ public class MatchingDeviceController {
MatchingDeviceModel matchingDeviceModel1 = new MatchingDeviceModel();
matchingDeviceModel1.setModel(model);
matchingDeviceModel1.setName(createSeqVo.getName());
matchingDeviceModel1.setStyle(createSeqVo.getStyle());
MatchingDeviceModel addEntity = matchingDeviceModelService.addEntity(matchingDeviceModel1);
idString = addEntity.getId().toString();
}
......
......@@ -4,12 +4,16 @@ import com.tykj.dev.device.matching.subject.domin.MatchingDeviceModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zsp
*/
public interface MatchingDeviceModelDao extends JpaRepository<MatchingDeviceModel, Integer>, JpaSpecificationExecutor<MatchingDeviceModel> {
MatchingDeviceModel findByModel(String model);
MatchingDeviceModel findByModelAndName(String model,String name);
// MatchingDeviceModel findByModelAndName(String model,String name);
List<MatchingDeviceModel> findByModelAndName(String model, String name);
MatchingDeviceModel findByModelAndNameAndStyle(String model,String name,String style);
}
......@@ -6,6 +6,8 @@ import com.tykj.dev.device.matching.subject.domin.MatchingDeviceModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.stream.Collectors;
@Service
public class MatchingDeviceModelServiceImpl implements MatchingDeviceModelService {
......@@ -24,7 +26,9 @@ public class MatchingDeviceModelServiceImpl implements MatchingDeviceModelServic
@Override
public MatchingDeviceModel findByModelAndName(String model, String name) {
return matchingDeviceModelDao.findByModelAndName(model,name);
return matchingDeviceModelDao.findByModelAndName(model,name).stream().filter(matchingDeviceModel -> !"0".equals(matchingDeviceModel.getStyle()))
.collect(Collectors.toList()).get(0);
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论