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.BszxGradeService;
|
|
import com.gxwebsoft.bszx.entity.BszxGrade;
|
|
import com.gxwebsoft.bszx.param.BszxGradeParam;
|
|
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-grade")
|
|
public class BszxGradeController extends BaseController {
|
|
@Resource
|
|
private BszxGradeService bszxGradeService;
|
|
|
|
@Operation(summary = "分页查询百色中学-年级")
|
|
@GetMapping("/page")
|
|
public ApiResult<PageResult<BszxGrade>> page(BszxGradeParam param) {
|
|
// 使用关联查询
|
|
return success(bszxGradeService.pageRel(param));
|
|
}
|
|
|
|
@Operation(summary = "查询全部百色中学-年级")
|
|
@GetMapping()
|
|
public ApiResult<List<BszxGrade>> list(BszxGradeParam param) {
|
|
// 使用关联查询
|
|
return success(bszxGradeService.listRel(param));
|
|
}
|
|
|
|
@Operation(summary = "根据id查询百色中学-年级")
|
|
@GetMapping("/{id}")
|
|
public ApiResult<BszxGrade> get(@PathVariable("id") Integer id) {
|
|
// 使用关联查询
|
|
return success(bszxGradeService.getByIdRel(id));
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxGrade:save')")
|
|
@OperationLog
|
|
@Operation(summary = "添加百色中学-年级")
|
|
@PostMapping()
|
|
public ApiResult<?> save(@RequestBody BszxGrade bszxGrade) {
|
|
if (bszxGradeService.save(bszxGrade)) {
|
|
return success("添加成功");
|
|
}
|
|
return fail("添加失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxGrade:update')")
|
|
@OperationLog
|
|
@Operation(summary = "修改百色中学-年级")
|
|
@PutMapping()
|
|
public ApiResult<?> update(@RequestBody BszxGrade bszxGrade) {
|
|
if (bszxGradeService.updateById(bszxGrade)) {
|
|
return success("修改成功");
|
|
}
|
|
return fail("修改失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxGrade:remove')")
|
|
@OperationLog
|
|
@Operation(summary = "删除百色中学-年级")
|
|
@DeleteMapping("/{id}")
|
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
|
if (bszxGradeService.removeById(id)) {
|
|
return success("删除成功");
|
|
}
|
|
return fail("删除失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxGrade:save')")
|
|
@OperationLog
|
|
@Operation(summary = "批量添加百色中学-年级")
|
|
@PostMapping("/batch")
|
|
public ApiResult<?> saveBatch(@RequestBody List<BszxGrade> list) {
|
|
if (bszxGradeService.saveBatch(list)) {
|
|
return success("添加成功");
|
|
}
|
|
return fail("添加失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxGrade:update')")
|
|
@OperationLog
|
|
@Operation(summary = "批量修改百色中学-年级")
|
|
@PutMapping("/batch")
|
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxGrade> batchParam) {
|
|
if (batchParam.update(bszxGradeService, "id")) {
|
|
return success("修改成功");
|
|
}
|
|
return fail("修改失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxGrade:remove')")
|
|
@OperationLog
|
|
@Operation(summary = "批量删除百色中学-年级")
|
|
@DeleteMapping("/batch")
|
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
|
if (bszxGradeService.removeByIds(ids)) {
|
|
return success("删除成功");
|
|
}
|
|
return fail("删除失败");
|
|
}
|
|
|
|
}
|