63 lines
1.9 KiB
Java
63 lines
1.9 KiB
Java
|
|
package com.gunshi.project.xyt.controller;
|
||
|
|
|
||
|
|
import com.gunshi.core.result.R;
|
||
|
|
import com.gunshi.project.xyt.model.AttWaterItem;
|
||
|
|
import com.gunshi.project.xyt.service.AttWaterItemService;
|
||
|
|
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.List;
|
||
|
|
/**
|
||
|
|
* 描述: 水质整编展示项目表
|
||
|
|
* author: xusan
|
||
|
|
* date: 2024-07-08 17:40:37
|
||
|
|
*/
|
||
|
|
@Tag(name = "水质整编展示项目表")
|
||
|
|
@RestController
|
||
|
|
@RequestMapping(value="/attWaterItem")
|
||
|
|
public class AttWaterItemController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private AttWaterItemService service;
|
||
|
|
|
||
|
|
|
||
|
|
@Operation(summary = "新增")
|
||
|
|
@PostMapping("/insert")
|
||
|
|
public R<AttWaterItem> insert(@Validated(Insert.class) @RequestBody AttWaterItem dto) {
|
||
|
|
boolean result = service.save(dto);
|
||
|
|
return R.ok(result ? dto : null);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Operation(summary = "修改")
|
||
|
|
@PostMapping("/update")
|
||
|
|
public R<AttWaterItem> update(@Validated(Update.class) @RequestBody AttWaterItem 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<AttWaterItem>> list() {
|
||
|
|
return R.ok(service.lambdaQuery().list());
|
||
|
|
}
|
||
|
|
|
||
|
|
@Operation(summary = "分页")
|
||
|
|
@PostMapping("/page")
|
||
|
|
public R<List<AttWaterItem>> page() {
|
||
|
|
return R.ok(service.page(null,null));
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|