64 lines
2.0 KiB
Java
64 lines
2.0 KiB
Java
|
|
package com.whdc.controller;
|
||
|
|
|
||
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||
|
|
import com.whdc.model.entity.ShCallWord;
|
||
|
|
import com.whdc.model.group.Insert;
|
||
|
|
import com.whdc.model.group.Update;
|
||
|
|
import com.whdc.service.ShCallWordService;
|
||
|
|
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="/shCallWord")
|
||
|
|
public class ShCallWordController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private ShCallWordService service;
|
||
|
|
|
||
|
|
|
||
|
|
@Operation(summary = "新增")
|
||
|
|
@PostMapping("/insert")
|
||
|
|
public ResultJson<ShCallWord> insert(@Validated(Insert.class) @RequestBody ShCallWord dto) {
|
||
|
|
boolean result = service.save(dto);
|
||
|
|
return ResultJson.ok(result ? dto : null);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Operation(summary = "修改")
|
||
|
|
@PostMapping("/update")
|
||
|
|
public ResultJson<ShCallWord> update(@Validated(Update.class) @RequestBody ShCallWord 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<ShCallWord>> list() {
|
||
|
|
return ResultJson.ok(service.lambdaQuery().list());
|
||
|
|
}
|
||
|
|
|
||
|
|
// @Operation(summary = "分页")
|
||
|
|
// @PostMapping("/page")
|
||
|
|
public ResultJson<Page<ShCallWord>> page() {
|
||
|
|
return ResultJson.ok(service.page(null));
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|