gunshi-project-ss/src/main/java/com/gunshi/project/xyt/controller/RescueTeamBController.java

63 lines
1.9 KiB
Java
Raw Normal View History

2024-07-08 13:18:54 +08:00
package com.gunshi.project.xyt.controller;
import com.gunshi.core.result.R;
import com.gunshi.project.xyt.model.RescueTeamB;
2024-07-08 17:47:02 +08:00
import com.gunshi.project.xyt.service.RescueTeamBService;
import com.gunshi.project.xyt.validate.markers.Insert;
import com.gunshi.project.xyt.validate.markers.Update;
import io.swagger.v3.oas.annotations.Operation;
2024-07-08 13:18:54 +08:00
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;
/**
2024-07-08 17:47:02 +08:00
* :
* author: xusan
* date: 2024-07-08 17:40:37
2024-07-08 13:18:54 +08:00
*/
@Tag(name = "抢险队伍")
@RestController
2024-07-08 17:47:02 +08:00
@RequestMapping(value="/rescueTeamB")
public class RescueTeamBController {
2024-07-08 13:18:54 +08:00
@Autowired
2024-07-08 17:47:02 +08:00
private RescueTeamBService service;
2024-07-08 13:18:54 +08:00
2024-07-08 17:47:02 +08:00
@Operation(summary = "新增")
@PostMapping("/insert")
public R<RescueTeamB> insert(@Validated(Insert.class) @RequestBody RescueTeamB dto) {
boolean result = service.save(dto);
return R.ok(result ? dto : null);
2024-07-08 13:18:54 +08:00
}
2024-07-08 17:47:02 +08:00
@Operation(summary = "修改")
@PostMapping("/update")
public R<RescueTeamB> update(@Validated(Update.class) @RequestBody RescueTeamB dto) {
boolean result = service.updateById(dto);
return R.ok(result ? dto : null);
2024-07-08 13:18:54 +08:00
}
2024-07-08 17:47:02 +08:00
@Operation(summary = "删除")
@GetMapping("/del/{id}")
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
return R.ok(service.removeById(id));
2024-07-08 13:18:54 +08:00
}
2024-07-08 17:47:02 +08:00
@Operation(summary = "列表")
@PostMapping("/list")
public R<List<RescueTeamB>> list() {
return R.ok(service.lambdaQuery().list());
2024-07-08 13:18:54 +08:00
}
2024-07-08 17:47:02 +08:00
@Operation(summary = "分页")
@PostMapping("/page")
public R<List<RescueTeamB>> page() {
return R.ok(service.page(null,null));
2024-07-08 13:18:54 +08:00
}
2024-07-08 17:47:02 +08:00
}