|
|
@@ -0,0 +1,105 @@
|
|
|
+package com.yc.ship.module.ota.controller.admin.trainingplan;
|
|
|
+
|
|
|
+import com.yc.ship.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import com.yc.ship.framework.common.pojo.CommonResult;
|
|
|
+import com.yc.ship.framework.common.pojo.PageParam;
|
|
|
+import com.yc.ship.framework.common.pojo.PageResult;
|
|
|
+import com.yc.ship.framework.common.util.object.BeanUtils;
|
|
|
+import com.yc.ship.framework.excel.core.util.ExcelUtils;
|
|
|
+import com.yc.ship.module.ota.controller.admin.trainingplan.vo.TrainingPlanPageReqVO;
|
|
|
+import com.yc.ship.module.ota.controller.admin.trainingplan.vo.TrainingPlanRespVO;
|
|
|
+import com.yc.ship.module.ota.controller.admin.trainingplan.vo.TrainingPlanSaveReqVO;
|
|
|
+import com.yc.ship.module.ota.dal.dataobject.trainingplan.TrainingPlanDO;
|
|
|
+import com.yc.ship.module.ota.dal.dataobject.trainingscore.TrainingScoreDO;
|
|
|
+import com.yc.ship.module.ota.service.trainingplan.TrainingPlanService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static com.yc.ship.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
+import static com.yc.ship.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 培训计划")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/buss/training-plan")
|
|
|
+@Validated
|
|
|
+public class TrainingPlanController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private TrainingPlanService trainingPlanService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建培训计划")
|
|
|
+ @PreAuthorize("@ss.hasPermission('buss:training-plan:create')")
|
|
|
+ public CommonResult<Long> createTrainingPlan(@Valid @RequestBody TrainingPlanSaveReqVO createReqVO) {
|
|
|
+ return success(trainingPlanService.createTrainingPlan(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新培训计划")
|
|
|
+ @PreAuthorize("@ss.hasPermission('buss:training-plan:update')")
|
|
|
+ public CommonResult<Boolean> updateTrainingPlan(@Valid @RequestBody TrainingPlanSaveReqVO updateReqVO) {
|
|
|
+ trainingPlanService.updateTrainingPlan(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除培训计划")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('buss:training-plan:delete')")
|
|
|
+ public CommonResult<Boolean> deleteTrainingPlan(@RequestParam("id") Long id) {
|
|
|
+ trainingPlanService.deleteTrainingPlan(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得培训计划")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('buss:training-plan:query')")
|
|
|
+ public CommonResult<TrainingPlanRespVO> getTrainingPlan(@RequestParam("id") Long id) {
|
|
|
+ TrainingPlanDO trainingPlan = trainingPlanService.getTrainingPlan(id);
|
|
|
+ return success(BeanUtils.toBean(trainingPlan, TrainingPlanRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得培训计划分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('buss:training-plan:query')")
|
|
|
+ public CommonResult<PageResult<TrainingPlanRespVO>> getTrainingPlanPage(@Valid TrainingPlanPageReqVO pageReqVO) {
|
|
|
+ PageResult<TrainingPlanDO> pageResult = trainingPlanService.getTrainingPlanPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, TrainingPlanRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出培训计划 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('buss:training-plan:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportTrainingPlanExcel(@Valid TrainingPlanPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<TrainingPlanDO> list = trainingPlanService.getTrainingPlanPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "培训计划.xls", "数据", TrainingPlanRespVO.class,
|
|
|
+ BeanUtils.toBean(list, TrainingPlanRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 子表(培训记录-人员关联表(成绩表)) ====================
|
|
|
+
|
|
|
+ @GetMapping("/training-score/list-by-plan-id")
|
|
|
+ @Operation(summary = "获得培训记录-人员关联表(成绩表)列表")
|
|
|
+ @Parameter(name = "planId", description = "关联计划ID,一起培训计划的人数")
|
|
|
+ @PreAuthorize("@ss.hasPermission('buss:training-plan:query')")
|
|
|
+ public CommonResult<List<TrainingScoreDO>> getTrainingScoreListByPlanId(@RequestParam("planId") Long planId) {
|
|
|
+ return success(trainingPlanService.getTrainingScoreListByPlanId(planId));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|