package com.xjrsoft.module.internship.controller; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.xjrsoft.common.annotation.XjrLog; import com.xjrsoft.common.model.result.RT; import com.xjrsoft.common.page.ConventPage; import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.common.utils.VoToColumnUtil; import com.xjrsoft.module.internship.dto.AddInternshipPlanManageParticipantDto; import com.xjrsoft.module.internship.dto.InternshipPlanManageParticipantPageDto; import com.xjrsoft.module.internship.dto.UpdateInternshipPlanManageParticipantDto; import com.xjrsoft.module.internship.entity.InternshipPlanManageParticipant; import com.xjrsoft.module.internship.service.IInternshipPlanManageParticipantService; import com.xjrsoft.module.internship.vo.InternshipPlanManageParticipantPageVo; import com.xjrsoft.module.internship.vo.InternshipPlanManageParticipantVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; /** * @title: 实习计划参与人表 * @Author dzx * @Date: 2025-06-26 * @Version 1.0 */ @RestController @RequestMapping("/internship" + "/internshipPlanManageParticipant") @Api(value = "/internship" + "/internshipPlanManageParticipant",tags = "实习计划参与人表代码") @AllArgsConstructor public class InternshipPlanManageParticipantController { private final IInternshipPlanManageParticipantService internshipPlanManageParticipantService; @GetMapping(value = "/page") @ApiOperation(value="实习计划参与人表列表(分页)") @SaCheckPermission("internshipplanmanageparticipant:detail") @XjrLog(value = "实习计划参与人表列表(分页)") public RT> page(@Valid InternshipPlanManageParticipantPageDto dto){ MPJLambdaWrapper queryWrapper = new MPJLambdaWrapper<>(); queryWrapper .orderByDesc(InternshipPlanManageParticipant::getId) .select(InternshipPlanManageParticipant.class,x -> VoToColumnUtil.fieldsToColumns(InternshipPlanManageParticipantPageVo.class).contains(x.getProperty())); IPage page = internshipPlanManageParticipantService.page(ConventPage.getPage(dto), queryWrapper); PageOutput pageOutput = ConventPage.getPageOutput(page, InternshipPlanManageParticipantPageVo.class); return RT.ok(pageOutput); } @GetMapping(value = "/student-page") @ApiOperation(value="实习学生选择列表(分页)") @SaCheckPermission("internshipplanmanageparticipant:detail") @XjrLog(value = "实习学生选择列表(分页)") public RT> studentPage(@Valid InternshipPlanManageParticipantPageDto dto){ MPJLambdaWrapper queryWrapper = new MPJLambdaWrapper<>(); queryWrapper .orderByDesc(InternshipPlanManageParticipant::getId) .select(InternshipPlanManageParticipant.class,x -> VoToColumnUtil.fieldsToColumns(InternshipPlanManageParticipantPageVo.class).contains(x.getProperty())); IPage page = internshipPlanManageParticipantService.page(ConventPage.getPage(dto), queryWrapper); PageOutput pageOutput = ConventPage.getPageOutput(page, InternshipPlanManageParticipantPageVo.class); return RT.ok(pageOutput); } @GetMapping(value = "/info") @ApiOperation(value="根据id查询实习计划参与人表信息") @SaCheckPermission("internshipplanmanageparticipant:detail") @XjrLog(value = "根据id查询实习计划参与人表信息") public RT info(@RequestParam Long id){ InternshipPlanManageParticipant internshipPlanManageParticipant = internshipPlanManageParticipantService.getById(id); if (internshipPlanManageParticipant == null) { return RT.error("找不到此数据!"); } return RT.ok(BeanUtil.toBean(internshipPlanManageParticipant, InternshipPlanManageParticipantVo.class)); } @PostMapping @ApiOperation(value = "新增实习计划参与人表") @SaCheckPermission("internshipplanmanageparticipant:add") @XjrLog(value = "新增实习计划参与人表") public RT add(@Valid @RequestBody AddInternshipPlanManageParticipantDto dto){ InternshipPlanManageParticipant internshipPlanManageParticipant = BeanUtil.toBean(dto, InternshipPlanManageParticipant.class); boolean isSuccess = internshipPlanManageParticipantService.save(internshipPlanManageParticipant); return RT.ok(isSuccess); } @PutMapping @ApiOperation(value = "修改实习计划参与人表") @SaCheckPermission("internshipplanmanageparticipant:edit") @XjrLog(value = "修改实习计划参与人表") public RT update(@Valid @RequestBody UpdateInternshipPlanManageParticipantDto dto){ InternshipPlanManageParticipant internshipPlanManageParticipant = BeanUtil.toBean(dto, InternshipPlanManageParticipant.class); return RT.ok(internshipPlanManageParticipantService.updateById(internshipPlanManageParticipant)); } @DeleteMapping @ApiOperation(value = "删除实习计划参与人表") @SaCheckPermission("internshipplanmanageparticipant:delete") @XjrLog(value = "删除实习计划参与人表") public RT delete(@Valid @RequestBody List ids){ return RT.ok(internshipPlanManageParticipantService.removeBatchByIds(ids)); } }