feat: 生成rptparamindex表的相关绑定数据

dev
huangfeng 1 year ago
parent 4a8d3025a7
commit c2d74595b2

@ -61,4 +61,11 @@ public class ParamBindController extends BasicController {
return Response.success(result);
}
@PostMapping("generateParamindex")
@ApiOperation("生成rptparamindex表的相关绑定数据")
public Response<String> generateParamindex() throws Exception {
bindService.generateParamindex();
return Response.success("OK");
}
}

@ -16,4 +16,6 @@ public interface ModevRepository extends JpaRepository<Modev, Integer>, JpaSpeci
List<Modev> findByZsbidAndName(Integer zsbid, String name);
List<Modev> findByIcdidAndIdIsNot(Integer icdid, Integer id);
List<Modev> findByIcdidIsNotNull();
}

@ -19,4 +19,6 @@ public interface ParamBindService {
void bind(BindingModel item) throws Exception;
BindDetail getBind(Integer eqmid) throws Exception;
void generateParamindex() throws Exception;
}

@ -200,7 +200,17 @@ public class ParamBindServiceImpl implements ParamBindService {
return result;
}
private void bindOne(Integer eqmid, Integer icdid) throws Exception {
@Override
public void generateParamindex() throws Exception {
List<Modev> modevList = modevRepository.findByIcdidIsNotNull();
if (!CollectionUtils.isEmpty(modevList)) {
for (Modev item : modevList) {
generateOne(item.getId(), item.getIcdid());
}
}
}
private void generateOne(Integer eqmid, Integer icdid) throws Exception {
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(icdid);
if (!optionalInst.isPresent()) {
throw new Exception("未找到该ICD逻辑设备实例, eqmid=" + eqmid + ", icdid=" + icdid);

Loading…
Cancel
Save