feat: 增加解绑功能

dev
huangfeng 1 year ago
parent fbb4bb4d10
commit 6726a910a3

@ -54,6 +54,13 @@ public class ParamBindController extends BasicController {
return Response.success("OK");
}
@PostMapping("unbind")
@ApiOperation("解绑")
public Response<String> unbind(@Validated @NotNull(message = "eqmid不能为空!") @Param("eqmid") Integer eqmid) throws Exception {
bindService.unbind(eqmid);
return Response.success("OK");
}
@GetMapping("getBind")
@ApiOperation("查询绑定信息")
public Response<BindDetail> getBind(@Validated @NotNull(message = "eqmid不能为空!") @Param("eqmid") Integer eqmid) throws Exception {

@ -18,6 +18,8 @@ public interface ParamBindService {
void bind(BindingModel item) throws Exception;
void unbind(Integer eqmid) throws Exception;
BindDetail getBind(Integer eqmid) throws Exception;
void generateParamindex() throws Exception;

@ -163,6 +163,17 @@ public class ParamBindServiceImpl implements ParamBindService {
modevRepository.save(modev);
}
@Override
public void unbind(Integer eqmid) throws Exception {
Optional<Modev> optionalModev = modevRepository.findById(eqmid);
if (!optionalModev.isPresent()) {
throw new Exception("未找到该监测装置, eqmid=" + eqmid);
}
Modev modev = optionalModev.get();
modev.setIcdid(null);
modevRepository.save(modev);
}
@Override
public BindDetail getBind(Integer eqmid) throws Exception {
Optional<Modev> optionalModev = modevRepository.findById(eqmid);

Loading…
Cancel
Save