InternshipPlanManageParticipantController.java 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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.core.conditions.query.LambdaQueryWrapper;
  5. import com.baomidou.mybatisplus.core.metadata.IPage;
  6. import com.github.yulichang.wrapper.MPJLambdaWrapper;
  7. import com.xjrsoft.common.annotation.XjrLog;
  8. import com.xjrsoft.common.model.result.RT;
  9. import com.xjrsoft.common.page.ConventPage;
  10. import com.xjrsoft.common.page.PageOutput;
  11. import com.xjrsoft.common.utils.VoToColumnUtil;
  12. import com.xjrsoft.module.internship.dto.AddInternshipPlanManageParticipantDto;
  13. import com.xjrsoft.module.internship.dto.InternshipPlanManageParticipantPageDto;
  14. import com.xjrsoft.module.internship.dto.UpdateInternshipPlanManageParticipantDto;
  15. import com.xjrsoft.module.internship.entity.InternshipPlanManageParticipant;
  16. import com.xjrsoft.module.internship.service.IInternshipPlanManageParticipantService;
  17. import com.xjrsoft.module.internship.vo.InternshipPlanManageParticipantPageVo;
  18. import com.xjrsoft.module.internship.vo.InternshipPlanManageParticipantVo;
  19. import io.swagger.annotations.Api;
  20. import io.swagger.annotations.ApiOperation;
  21. import lombok.AllArgsConstructor;
  22. import org.springframework.web.bind.annotation.DeleteMapping;
  23. import org.springframework.web.bind.annotation.GetMapping;
  24. import org.springframework.web.bind.annotation.PostMapping;
  25. import org.springframework.web.bind.annotation.PutMapping;
  26. import org.springframework.web.bind.annotation.RequestBody;
  27. import org.springframework.web.bind.annotation.RequestMapping;
  28. import org.springframework.web.bind.annotation.RequestParam;
  29. import org.springframework.web.bind.annotation.RestController;
  30. import javax.validation.Valid;
  31. import java.util.List;
  32. /**
  33. * @title: 实习计划参与人表
  34. * @Author dzx
  35. * @Date: 2025-06-26
  36. * @Version 1.0
  37. */
  38. @RestController
  39. @RequestMapping("/internship" + "/internshipPlanManageParticipant")
  40. @Api(value = "/internship" + "/internshipPlanManageParticipant",tags = "实习计划参与人表代码")
  41. @AllArgsConstructor
  42. public class InternshipPlanManageParticipantController {
  43. private final IInternshipPlanManageParticipantService internshipPlanManageParticipantService;
  44. @GetMapping(value = "/page")
  45. @ApiOperation(value="实习计划参与人表列表(分页)")
  46. @SaCheckPermission("internshipplanmanageparticipant:detail")
  47. @XjrLog(value = "实习计划参与人表列表(分页)")
  48. public RT<PageOutput<InternshipPlanManageParticipantPageVo>> page(@Valid InternshipPlanManageParticipantPageDto dto){
  49. MPJLambdaWrapper<InternshipPlanManageParticipant> queryWrapper = new MPJLambdaWrapper<>();
  50. queryWrapper
  51. .orderByDesc(InternshipPlanManageParticipant::getId)
  52. .select(InternshipPlanManageParticipant.class,x -> VoToColumnUtil.fieldsToColumns(InternshipPlanManageParticipantPageVo.class).contains(x.getProperty()));
  53. IPage<InternshipPlanManageParticipant> page = internshipPlanManageParticipantService.page(ConventPage.getPage(dto), queryWrapper);
  54. PageOutput<InternshipPlanManageParticipantPageVo> pageOutput = ConventPage.getPageOutput(page, InternshipPlanManageParticipantPageVo.class);
  55. return RT.ok(pageOutput);
  56. }
  57. @GetMapping(value = "/student-page")
  58. @ApiOperation(value="实习学生选择列表(分页)")
  59. @SaCheckPermission("internshipplanmanageparticipant:detail")
  60. @XjrLog(value = "实习学生选择列表(分页)")
  61. public RT<PageOutput<InternshipPlanManageParticipantPageVo>> studentPage(@Valid InternshipPlanManageParticipantPageDto dto){
  62. MPJLambdaWrapper<InternshipPlanManageParticipant> queryWrapper = new MPJLambdaWrapper<>();
  63. queryWrapper
  64. .orderByDesc(InternshipPlanManageParticipant::getId)
  65. .select(InternshipPlanManageParticipant.class,x -> VoToColumnUtil.fieldsToColumns(InternshipPlanManageParticipantPageVo.class).contains(x.getProperty()));
  66. IPage<InternshipPlanManageParticipant> page = internshipPlanManageParticipantService.page(ConventPage.getPage(dto), queryWrapper);
  67. PageOutput<InternshipPlanManageParticipantPageVo> pageOutput = ConventPage.getPageOutput(page, InternshipPlanManageParticipantPageVo.class);
  68. return RT.ok(pageOutput);
  69. }
  70. @GetMapping(value = "/info")
  71. @ApiOperation(value="根据id查询实习计划参与人表信息")
  72. @SaCheckPermission("internshipplanmanageparticipant:detail")
  73. @XjrLog(value = "根据id查询实习计划参与人表信息")
  74. public RT<InternshipPlanManageParticipantVo> info(@RequestParam Long id){
  75. InternshipPlanManageParticipant internshipPlanManageParticipant = internshipPlanManageParticipantService.getById(id);
  76. if (internshipPlanManageParticipant == null) {
  77. return RT.error("找不到此数据!");
  78. }
  79. return RT.ok(BeanUtil.toBean(internshipPlanManageParticipant, InternshipPlanManageParticipantVo.class));
  80. }
  81. @PostMapping
  82. @ApiOperation(value = "新增实习计划参与人表")
  83. @SaCheckPermission("internshipplanmanageparticipant:add")
  84. @XjrLog(value = "新增实习计划参与人表")
  85. public RT<Boolean> add(@Valid @RequestBody AddInternshipPlanManageParticipantDto dto){
  86. InternshipPlanManageParticipant internshipPlanManageParticipant = BeanUtil.toBean(dto, InternshipPlanManageParticipant.class);
  87. boolean isSuccess = internshipPlanManageParticipantService.save(internshipPlanManageParticipant);
  88. return RT.ok(isSuccess);
  89. }
  90. @PutMapping
  91. @ApiOperation(value = "修改实习计划参与人表")
  92. @SaCheckPermission("internshipplanmanageparticipant:edit")
  93. @XjrLog(value = "修改实习计划参与人表")
  94. public RT<Boolean> update(@Valid @RequestBody UpdateInternshipPlanManageParticipantDto dto){
  95. InternshipPlanManageParticipant internshipPlanManageParticipant = BeanUtil.toBean(dto, InternshipPlanManageParticipant.class);
  96. return RT.ok(internshipPlanManageParticipantService.updateById(internshipPlanManageParticipant));
  97. }
  98. @DeleteMapping
  99. @ApiOperation(value = "删除实习计划参与人表")
  100. @SaCheckPermission("internshipplanmanageparticipant:delete")
  101. @XjrLog(value = "删除实习计划参与人表")
  102. public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
  103. return RT.ok(internshipPlanManageParticipantService.removeBatchByIds(ids));
  104. }
  105. }