InternshipPlanTeacherController.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package com.xjrsoft.module.internship.controller;
  2. import cn.dev33.satoken.annotation.SaCheckPermission;
  3. import cn.hutool.core.bean.BeanUtil;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import com.xjrsoft.common.annotation.XjrLog;
  6. import com.xjrsoft.common.model.result.RT;
  7. import com.xjrsoft.common.page.ConventPage;
  8. import com.xjrsoft.common.page.PageOutput;
  9. import com.xjrsoft.module.internship.dto.AddInternshipPlanTeacherDto;
  10. import com.xjrsoft.module.internship.dto.InternshipPlanTeacherPageDto;
  11. import com.xjrsoft.module.internship.dto.UpdateInternshipPlanTeacherDto;
  12. import com.xjrsoft.module.internship.entity.InternshipPlanTeacher;
  13. import com.xjrsoft.module.internship.service.IInternshipPlanTeacherService;
  14. import com.xjrsoft.module.internship.vo.InternshipPlanTeacherPageVo;
  15. import com.xjrsoft.module.internship.vo.InternshipPlanTeacherVo;
  16. import io.swagger.annotations.Api;
  17. import io.swagger.annotations.ApiOperation;
  18. import lombok.AllArgsConstructor;
  19. import org.springframework.web.bind.annotation.DeleteMapping;
  20. import org.springframework.web.bind.annotation.GetMapping;
  21. import org.springframework.web.bind.annotation.PostMapping;
  22. import org.springframework.web.bind.annotation.PutMapping;
  23. import org.springframework.web.bind.annotation.RequestBody;
  24. import org.springframework.web.bind.annotation.RequestMapping;
  25. import org.springframework.web.bind.annotation.RequestParam;
  26. import org.springframework.web.bind.annotation.RestController;
  27. import javax.validation.Valid;
  28. import java.util.List;
  29. /**
  30. * @title: 实习计划带队老师表
  31. * @Author dzx
  32. * @Date: 2025-06-24
  33. * @Version 1.0
  34. */
  35. @RestController
  36. @RequestMapping("/internship" + "/internshipPlanTeacher")
  37. @Api(value = "/internship" + "/internshipPlanTeacher",tags = "实习计划带队老师表代码")
  38. @AllArgsConstructor
  39. public class InternshipPlanTeacherController {
  40. private final IInternshipPlanTeacherService internshipPlanTeacherService;
  41. @GetMapping(value = "/page")
  42. @ApiOperation(value="实习计划带队老师表列表(分页)")
  43. @SaCheckPermission("internshipplanteacher:detail")
  44. @XjrLog(value = "实习计划带队老师表列表(分页)")
  45. public RT<PageOutput<InternshipPlanTeacherPageVo>> page(@Valid InternshipPlanTeacherPageDto dto){
  46. Page<InternshipPlanTeacherPageVo> page = internshipPlanTeacherService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
  47. PageOutput<InternshipPlanTeacherPageVo> pageOutput = ConventPage.getPageOutput(page, InternshipPlanTeacherPageVo.class);
  48. return RT.ok(pageOutput);
  49. }
  50. @GetMapping(value = "/info")
  51. @ApiOperation(value="根据id查询实习计划带队老师表信息")
  52. @SaCheckPermission("internshipplanteacher:detail")
  53. @XjrLog(value = "根据id查询实习计划带队老师表信息")
  54. public RT<InternshipPlanTeacherVo> info(@RequestParam Long id){
  55. InternshipPlanTeacher internshipPlanTeacher = internshipPlanTeacherService.getById(id);
  56. if (internshipPlanTeacher == null) {
  57. return RT.error("找不到此数据!");
  58. }
  59. return RT.ok(BeanUtil.toBean(internshipPlanTeacher, InternshipPlanTeacherVo.class));
  60. }
  61. @PostMapping
  62. @ApiOperation(value = "新增实习计划带队老师表")
  63. @SaCheckPermission("internshipplanteacher:add")
  64. @XjrLog(value = "新增实习计划带队老师表")
  65. public RT<Boolean> add(@Valid @RequestBody AddInternshipPlanTeacherDto dto){
  66. boolean isSuccess = internshipPlanTeacherService.add(dto);
  67. return RT.ok(isSuccess);
  68. }
  69. @PutMapping
  70. @ApiOperation(value = "修改实习计划带队老师表")
  71. @SaCheckPermission("internshipplanteacher:edit")
  72. @XjrLog(value = "修改实习计划带队老师表")
  73. public RT<Boolean> update(@Valid @RequestBody UpdateInternshipPlanTeacherDto dto){
  74. return RT.ok(internshipPlanTeacherService.update(dto));
  75. }
  76. @DeleteMapping
  77. @ApiOperation(value = "删除实习计划带队老师表")
  78. @SaCheckPermission("internshipplanteacher:delete")
  79. @XjrLog(value = "删除实习计划带队老师表")
  80. public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
  81. return RT.ok(internshipPlanTeacherService.removeBatchByIds(ids));
  82. }
  83. }