64 lines
1.9 KiB
Java
64 lines
1.9 KiB
Java
|
|
package com.whdc.controller;
|
||
|
|
|
||
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||
|
|
import com.whdc.model.entity.ShPeriod;
|
||
|
|
import com.whdc.model.group.Insert;
|
||
|
|
import com.whdc.model.group.Update;
|
||
|
|
import com.whdc.service.ShPeriodService;
|
||
|
|
import com.whdc.utils.ResultJson;
|
||
|
|
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-29 17:27:25
|
||
|
|
*/
|
||
|
|
@Tag(name = "防汛周期")
|
||
|
|
@RestController
|
||
|
|
@RequestMapping(value="/shPeriod")
|
||
|
|
public class ShPeriodController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private ShPeriodService service;
|
||
|
|
|
||
|
|
|
||
|
|
@Operation(summary = "新增")
|
||
|
|
@PostMapping("/insert")
|
||
|
|
public ResultJson<ShPeriod> insert(@Validated(Insert.class) @RequestBody ShPeriod dto) {
|
||
|
|
boolean result = service.save(dto);
|
||
|
|
return ResultJson.ok(result ? dto : null);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Operation(summary = "修改")
|
||
|
|
@PostMapping("/update")
|
||
|
|
public ResultJson<ShPeriod> update(@Validated(Update.class) @RequestBody ShPeriod dto) {
|
||
|
|
boolean result = service.updateById(dto);
|
||
|
|
return ResultJson.ok(result ? dto : null);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Operation(summary = "删除")
|
||
|
|
@GetMapping("/del/{id}")
|
||
|
|
public ResultJson<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||
|
|
return ResultJson.ok(service.removeById(id));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Operation(summary = "列表")
|
||
|
|
@PostMapping("/list")
|
||
|
|
public ResultJson<List<ShPeriod>> list() {
|
||
|
|
return ResultJson.ok(service.lambdaQuery().list());
|
||
|
|
}
|
||
|
|
|
||
|
|
// @Operation(summary = "分页")
|
||
|
|
// @PostMapping("/page")
|
||
|
|
public ResultJson<Page<ShPeriod>> page() {
|
||
|
|
return ResultJson.ok(service.page(null));
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|