68 lines
2.2 KiB
Java
68 lines
2.2 KiB
Java
package com.gunshi.project.xyt.controller;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.gunshi.core.result.R;
|
|
import com.gunshi.project.xyt.entity.so.WarnPageSo;
|
|
import com.gunshi.project.xyt.entity.so.WarnSo;
|
|
import com.gunshi.project.xyt.entity.vo.OsmoticWarnVo;
|
|
import com.gunshi.project.xyt.model.OsmoticWarnR;
|
|
import com.gunshi.project.xyt.service.OsmoticWarnRService;
|
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
|
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;
|
|
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.Map;
|
|
|
|
/**
|
|
* 描述: 隐患预警记录表
|
|
* author: xusan
|
|
* date: 2024-07-08 17:40:37
|
|
*/
|
|
@Tag(name = "隐患预警记录表")
|
|
@RestController
|
|
@RequestMapping(value="/osmoticWarnR")
|
|
public class OsmoticWarnRController {
|
|
|
|
@Autowired
|
|
private OsmoticWarnRService service;
|
|
|
|
|
|
@Operation(summary = "新增")
|
|
@PostMapping("/insert")
|
|
public R<OsmoticWarnR> insert(@Validated(Insert.class) @RequestBody OsmoticWarnR dto) {
|
|
boolean result = service.save(dto);
|
|
return R.ok(result ? dto : null);
|
|
}
|
|
|
|
@Operation(summary = "修改")
|
|
@PostMapping("/update")
|
|
public R<OsmoticWarnR> update(@Validated(Update.class) @RequestBody OsmoticWarnR 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("/stat")
|
|
public R<Map<Integer,Long>> stat(@RequestBody WarnSo warnSo) {
|
|
return R.ok(service.stat(warnSo));
|
|
}
|
|
|
|
@Operation(summary = "分页")
|
|
@PostMapping("/page")
|
|
public R<Page<OsmoticWarnVo>> page(@RequestBody WarnPageSo warnPageSo) {
|
|
return R.ok(service.queryPage(warnPageSo));
|
|
}
|
|
|
|
} |