122 lines
4.1 KiB
Java
122 lines
4.1 KiB
Java
package com.gxwebsoft.bszx.controller;
|
|
|
|
import com.gxwebsoft.common.core.web.BaseController;
|
|
import com.gxwebsoft.bszx.service.BszxBranchService;
|
|
import com.gxwebsoft.bszx.entity.BszxBranch;
|
|
import com.gxwebsoft.bszx.param.BszxBranchParam;
|
|
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-17 17:18:22
|
|
*/
|
|
@Tag(name = "百色中学-分部管理")
|
|
@RestController
|
|
@RequestMapping("/api/bszx/bszx-branch")
|
|
public class BszxBranchController extends BaseController {
|
|
@Resource
|
|
private BszxBranchService bszxBranchService;
|
|
|
|
@Operation(summary = "分页查询百色中学-分部")
|
|
@GetMapping("/page")
|
|
public ApiResult<PageResult<BszxBranch>> page(BszxBranchParam param) {
|
|
// 使用关联查询
|
|
return success(bszxBranchService.pageRel(param));
|
|
}
|
|
|
|
@Operation(summary = "查询全部百色中学-分部")
|
|
@GetMapping()
|
|
public ApiResult<List<BszxBranch>> list(BszxBranchParam param) {
|
|
// 使用关联查询
|
|
return success(bszxBranchService.listRel(param));
|
|
}
|
|
|
|
@Operation(summary = "根据id查询百色中学-分部")
|
|
@GetMapping("/{id}")
|
|
public ApiResult<BszxBranch> get(@PathVariable("id") Integer id) {
|
|
// 使用关联查询
|
|
return success(bszxBranchService.getByIdRel(id));
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxBranch:save')")
|
|
@OperationLog
|
|
@Operation(summary = "添加百色中学-分部")
|
|
@PostMapping()
|
|
public ApiResult<?> save(@RequestBody BszxBranch bszxBranch) {
|
|
if (bszxBranchService.save(bszxBranch)) {
|
|
return success("添加成功");
|
|
}
|
|
return fail("添加失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxBranch:update')")
|
|
@OperationLog
|
|
@Operation(summary = "修改百色中学-分部")
|
|
@PutMapping()
|
|
public ApiResult<?> update(@RequestBody BszxBranch bszxBranch) {
|
|
if (bszxBranchService.updateById(bszxBranch)) {
|
|
return success("修改成功");
|
|
}
|
|
return fail("修改失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxBranch:remove')")
|
|
@OperationLog
|
|
@Operation(summary = "删除百色中学-分部")
|
|
@DeleteMapping("/{id}")
|
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
|
if (bszxBranchService.removeById(id)) {
|
|
return success("删除成功");
|
|
}
|
|
return fail("删除失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxBranch:save')")
|
|
@OperationLog
|
|
@Operation(summary = "批量添加百色中学-分部")
|
|
@PostMapping("/batch")
|
|
public ApiResult<?> saveBatch(@RequestBody List<BszxBranch> list) {
|
|
if (bszxBranchService.saveBatch(list)) {
|
|
return success("添加成功");
|
|
}
|
|
return fail("添加失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxBranch:update')")
|
|
@OperationLog
|
|
@Operation(summary = "批量修改百色中学-分部")
|
|
@PutMapping("/batch")
|
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<BszxBranch> batchParam) {
|
|
if (batchParam.update(bszxBranchService, "id")) {
|
|
return success("修改成功");
|
|
}
|
|
return fail("修改失败");
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('bszx:bszxBranch:remove')")
|
|
@OperationLog
|
|
@Operation(summary = "批量删除百色中学-分部")
|
|
@DeleteMapping("/batch")
|
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
|
if (bszxBranchService.removeByIds(ids)) {
|
|
return success("删除成功");
|
|
}
|
|
return fail("删除失败");
|
|
}
|
|
|
|
}
|