2024-07-08 17:47:02 +08:00
|
|
|
package com.gunshi.project.xyt.controller;
|
|
|
|
|
|
2024-07-10 14:04:43 +08:00
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
2024-07-08 17:47:02 +08:00
|
|
|
import com.gunshi.core.result.R;
|
|
|
|
|
import com.gunshi.project.xyt.model.StWaterRReal;
|
|
|
|
|
import com.gunshi.project.xyt.service.StWaterRRealService;
|
|
|
|
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
2024-07-10 14:04:43 +08:00
|
|
|
import com.gunshi.project.xyt.validate.markers.Query;
|
2024-07-08 17:47:02 +08:00
|
|
|
import com.gunshi.project.xyt.validate.markers.Update;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
2024-07-10 14:04:43 +08:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
2024-07-08 17:47:02 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
/**
|
|
|
|
|
* 描述: 供水量实时表
|
|
|
|
|
* author: xusan
|
|
|
|
|
* date: 2024-07-08 17:40:37
|
|
|
|
|
*/
|
|
|
|
|
@Tag(name = "供水量实时表")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping(value="/stWaterRReal")
|
|
|
|
|
public class StWaterRRealController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StWaterRRealService service;
|
|
|
|
|
|
2024-07-10 14:04:43 +08:00
|
|
|
@Operation(summary = "根据测站编码查询实时供水量")
|
|
|
|
|
@PostMapping("/getByStcd/{stcd}")
|
|
|
|
|
public R<StWaterRReal> getById(@Schema(name = "stcd", description = "测站编码")@PathVariable("stcd") @NotNull String stcd) {
|
|
|
|
|
QueryWrapper<StWaterRReal> qw = new QueryWrapper<>();
|
|
|
|
|
qw.eq("stcd", stcd).orderBy(true, false, "tm");
|
|
|
|
|
StWaterRReal result = service.getOne(qw);
|
|
|
|
|
return R.ok(result);
|
|
|
|
|
}
|
2024-07-08 17:47:02 +08:00
|
|
|
|
|
|
|
|
@Operation(summary = "新增")
|
|
|
|
|
@PostMapping("/insert")
|
|
|
|
|
public R<StWaterRReal> insert(@Validated(Insert.class) @RequestBody StWaterRReal dto) {
|
|
|
|
|
boolean result = service.save(dto);
|
|
|
|
|
return R.ok(result ? dto : null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "修改")
|
|
|
|
|
@PostMapping("/update")
|
|
|
|
|
public R<StWaterRReal> update(@Validated(Update.class) @RequestBody StWaterRReal dto) {
|
|
|
|
|
boolean result = service.updateById(dto);
|
|
|
|
|
return R.ok(result ? dto : null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "删除")
|
|
|
|
|
@GetMapping("/del/{id}")
|
|
|
|
|
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
|
|
|
|
return R.ok(service.removeById(id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "列表")
|
|
|
|
|
@PostMapping("/list")
|
|
|
|
|
public R<List<StWaterRReal>> list() {
|
|
|
|
|
return R.ok(service.lambdaQuery().list());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "分页")
|
|
|
|
|
@PostMapping("/page")
|
|
|
|
|
public R<List<StWaterRReal>> page() {
|
|
|
|
|
return R.ok(service.page(null,null));
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-10 14:04:43 +08:00
|
|
|
}
|