|
@@ -0,0 +1,68 @@
|
|
|
+package com.citu.module.menduner.system.controller.app.common.data;
|
|
|
+
|
|
|
+import com.citu.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import com.citu.framework.common.pojo.CommonResult;
|
|
|
+import com.citu.framework.common.pojo.PageParam;
|
|
|
+import com.citu.framework.common.pojo.PageResult;
|
|
|
+import com.citu.framework.common.util.object.BeanUtils;
|
|
|
+import com.citu.framework.excel.core.util.ExcelUtils;
|
|
|
+import com.citu.module.menduner.system.controller.base.appointment.NewAppointmentsPageReqVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.appointment.NewAppointmentsRespVO;
|
|
|
+import com.citu.module.menduner.system.dal.dataobject.appointment.NewAppointmentsDO;
|
|
|
+import com.citu.module.menduner.system.service.appointment.NewAppointmentsService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static com.citu.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
+import static com.citu.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+@Tag(name = "公共 - 新任命")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/menduner/system/new-appointments")
|
|
|
+@Validated
|
|
|
+public class NewAppointmentsController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private NewAppointmentsService newAppointmentsService;
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得新任命")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ public CommonResult<NewAppointmentsRespVO> get(@RequestParam("id") Long id) {
|
|
|
+ NewAppointmentsDO newAppointments = newAppointmentsService.getNewAppointments(id);
|
|
|
+ return success(BeanUtils.toBean(newAppointments, NewAppointmentsRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得新任命分页")
|
|
|
+ public CommonResult<PageResult<NewAppointmentsRespVO>> page(@Valid NewAppointmentsPageReqVO pageReqVO) {
|
|
|
+ PageResult<NewAppointmentsDO> pageResult = newAppointmentsService.getNewAppointmentsPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, NewAppointmentsRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出新任命 Excel")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void export(@Valid NewAppointmentsPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<NewAppointmentsDO> list = newAppointmentsService.getNewAppointmentsPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "新任命.xls", "数据", NewAppointmentsRespVO.class,
|
|
|
+ BeanUtils.toBean(list, NewAppointmentsRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|