122 lines
4.0 KiB
Java
122 lines
4.0 KiB
Java
package com.gxwebsoft.bszx.controller;
|
|
|
|
import com.gxwebsoft.common.core.web.BaseController;
|
|
import com.gxwebsoft.bszx.service.BszxEraService;
|
|
import com.gxwebsoft.bszx.entity.BszxEra;
|
|
import com.gxwebsoft.bszx.param.BszxEraParam;
|
|
import com.gxwebsoft.common.core.web.ApiResult;
|
|
import com.gxwebsoft.common.core.web.PageResult;
|
|
import com.gxwebsoft.common.core.web.PageParam;
|
|
import com.gxwebsoft.common.core.web.BatchParam;
|
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
|
import com.gxwebsoft.common.system.entity.User;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 百色中学-年代控制器
|
|
*
|
|
* @author 科技小王子
|
|
* @since 2025-03-06 22:50:25
|
|
*/
|
|
@Tag(name = "百色中学-年代管理")
|
|
@RestController
|
|
@RequestMapping("/api/bszx/bszx-era")
|
|
public class BszxEraController extends BaseController {
|
|
@Resource
|
|
private BszxEraService bszxEraService;
|
|
|
|
@Operation(summary = "分页查询百色中学-年代")
|
|
@GetMapping("/page")
|
|
public ApiResult<PageResult<BszxEra>> page(BszxEraParam param) {
|
|
// 使用关联查询
|
|
return success(bszxEraService.pageRel(param));
|
|
}
|
|
|
|
@Operation(summary = "查询全部百色中学-年代")
|
|
@GetMapping()
|
|
public ApiResult<List<BszxEra>> list(BszxEraParam param) {
|
|
// 使用关联查询
|
|
return success(bszxEraService.listRel(param));
|
|
}
|
|
|
|
@Operation(summary = "根据id查询百色中学-年代")
|
|
@GetMapping("/{id}")
|
|
public ApiResult<BszxEra> get(@PathVariable("id") Integer id) {
|
|
// 使用关联查询
|
|
return success(bszxEraService.getByIdRel(id));
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxEra:save')")
|
|
@OperationLog
|
|
@Operation(summary = "添加百色中学-年代")
|
|
@PostMapping()
|
|
public ApiResult<?> save(@RequestBody BszxEra bszxEra) {
|
|
if (bszxEraService.save(bszxEra)) {
|
|
return success("添加成功");
|
|
}
|
|
return fail("添加失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxEra:update')")
|
|
@OperationLog
|
|
@Operation(summary = "修改百色中学-年代")
|
|
@PutMapping()
|
|
public ApiResult<?> update(@RequestBody BszxEra bszxEra) {
|
|
if (bszxEraService.updateById(bszxEra)) {
|
|
return success("修改成功");
|
|
}
|
|
return fail("修改失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxEra:remove')")
|
|
@OperationLog
|
|
@Operation(summary = "删除百色中学-年代")
|
|
@DeleteMapping("/{id}")
|
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
|
if (bszxEraService.removeById(id)) {
|
|
return success("删除成功");
|
|
}
|
|
return fail("删除失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxEra:save')")
|
|
@OperationLog
|
|
@Operation(summary = "批量添加百色中学-年代")
|
|
@PostMapping("/batch")
|
|
public ApiResult<?> saveBatch(@RequestBody List<BszxEra> list) {
|
|
if (bszxEraService.saveBatch(list)) {
|
|
return success("添加成功");
|
|
}
|
|
return fail("添加失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxEra:update')")
|
|
@OperationLog
|
|
@Operation(summary = "批量修改百色中学-年代")
|
|
@PutMapping("/batch")
|
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxEra> batchParam) {
|
|
if (batchParam.update(bszxEraService, "id")) {
|
|
return success("修改成功");
|
|
}
|
|
return fail("修改失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxEra:remove')")
|
|
@OperationLog
|
|
@Operation(summary = "批量删除百色中学-年代")
|
|
@DeleteMapping("/batch")
|
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
|
if (bszxEraService.removeByIds(ids)) {
|
|
return success("删除成功");
|
|
}
|
|
return fail("删除失败");
|
|
}
|
|
|
|
}
|