Explorar o código

材料缴交bug修复

dzx hai 2 meses
pai
achega
10238460ae

+ 14 - 4
src/main/java/com/xjrsoft/module/material/controller/MaterialTaskController.java

@@ -49,8 +49,6 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.validation.Valid;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
 import java.util.List;
 
 /**
@@ -184,8 +182,20 @@ public class MaterialTaskController {
 
     @PostMapping("/export-query")
     @ApiOperation(value = "导出")
-    public ResponseEntity<byte[]> exportData(@Valid @RequestBody MaterialTaskPageDto dto) {
-        List<MaterialTaskPageVo> customerList = ((PageOutput<MaterialTaskPageVo>) page(dto).getData()).getList();
+    public ResponseEntity<byte[]> exportData(@Valid @RequestBody MaterialTaskAssignListDto dto) {
+        MPJLambdaWrapper<MaterialTask> queryWrapper = new MPJLambdaWrapper<>();
+        queryWrapper
+                .orderByDesc(MaterialTask::getId)
+                .eq(MaterialTask::getCreateUserId, StpUtil.getLoginIdAsLong())
+                .like(StrUtil.isNotBlank(dto.getName()), MaterialTask::getName, dto.getName())
+                .select(MaterialTask::getId)
+                .selectAs(MaterialType::getName, MaterialTaskPageVo::getMaterialTypeIdCn)
+                .selectAs(MaterialType::getCreateDate, MaterialTaskPageVo::getCreateDate)
+                .select(MaterialTask.class, x -> VoToColumnUtil.fieldsToColumns(MaterialTaskPageVo.class).contains(x.getProperty()))
+                .leftJoin(MaterialType.class, MaterialType::getId, MaterialTask::getMaterialTypeId);
+
+
+        List<MaterialTaskPageVo> customerList = materialTaskService.selectJoinList(MaterialTaskPageVo.class, queryWrapper);
         ByteArrayOutputStream bot = new ByteArrayOutputStream();
         EasyExcel.write(bot, MaterialTaskPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);