1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- package com.keao.edu.user.controller;
- import com.keao.edu.common.controller.BaseController;
- import com.keao.edu.common.entity.HttpResponseResult;
- import com.keao.edu.common.page.PageInfo;
- import com.keao.edu.common.tenant.TenantContextHolder;
- import com.keao.edu.user.entity.Subject;
- import com.keao.edu.user.page.SubjectQueryInfo;
- import com.keao.edu.user.service.SubjectService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- @RequestMapping("subject")
- @Api(tags = "科目服务")
- @RestController
- public class SubjectController extends BaseController {
- @Autowired
- private SubjectService subjectService;
- @ApiOperation(value = "修改、新增科目")
- @PostMapping("/upset")
- @PreAuthorize("@pcs.hasPermissions('subject/upset')")
- public HttpResponseResult update(@RequestBody Subject subject){
- subject.setTenantId(TenantContextHolder.getTenantId());
- subjectService.upSetSubject(subject);
- return succeed();
- }
- @ApiOperation(value = "删除科目")
- @PostMapping("/del")
- @PreAuthorize("@pcs.hasPermissions('subject/del')")
- public HttpResponseResult del(@RequestBody Subject subject){
- subject.setTenantId(TenantContextHolder.getTenantId());
- subject.setDelFlag(true);
- subjectService.upSetSubject(subject);
- return succeed();
- }
- @ApiOperation(value = "根据科目编号查询科目")
- @GetMapping("/get/{id}")
- @PreAuthorize("@pcs.hasPermissions('subject/get')")
- public HttpResponseResult<Subject> get(@ApiParam(value = "科目编号", required = true) @PathVariable("id") Integer id){
- return succeed(subjectService.get(id));
- }
- @ApiOperation(value = "分页查询科目列表")
- @GetMapping("/queryPage")
- @PreAuthorize("@pcs.hasPermissions('subject/queryPage')")
- public HttpResponseResult<PageInfo<Subject>> queryPage(SubjectQueryInfo queryInfo){
- return succeed(subjectService.queryPage(queryInfo));
- }
- @ApiOperation(value = "学生端分页查询科目列表")
- @GetMapping("/studentQueryPage")
- public HttpResponseResult<PageInfo<Subject>> studentQueryPage(SubjectQueryInfo queryInfo){
- return succeed(subjectService.queryPage(queryInfo));
- }
- @ApiOperation(value = "分页查询科目树状列表")
- @GetMapping("/queryPageTree")
- @PreAuthorize("@pcs.hasPermissions('subject/queryPageTree')")
- public HttpResponseResult<PageInfo<Subject>> queryPageTree(SubjectQueryInfo queryInfo){
- return succeed(subjectService.queryPageTree(queryInfo));
- }
- @ApiOperation(value = "获取子集科目列表")
- @GetMapping("/findSubSubjects")
- @PreAuthorize("@pcs.hasPermissions('subject/findSubSubjects')")
- public HttpResponseResult<List<Subject>> findSubSubjects(){
- return succeed(subjectService.findSubSubjects(Integer.parseInt(TenantContextHolder.getTenantId())));
- }
- }
|