|
|
@@ -3,6 +3,7 @@ package com.hr.controller;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
|
+import com.hr.dto.DemoExcelDto;
|
|
|
import com.hr.dto.MyDto;
|
|
|
import com.hr.dto.MyParmDto;
|
|
|
|
|
|
@@ -13,15 +14,23 @@ import com.hr.repository.service.DemoService;
|
|
|
import com.hr.repository.service.TransServer;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
|
+import com.hr.system.api.domain.SysDictData;
|
|
|
import com.yy.basedevelop.common.data.BasePageResult;
|
|
|
import com.yy.basedevelop.common.data.BaseReturnDto;
|
|
|
|
|
|
|
|
|
+import com.yy.basedevelop.common.util.DictUtil;
|
|
|
+import com.yy.basedevelop.common.util.ExcelUtil;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+
|
|
|
+import org.springframework.http.server.reactive.ServerHttpResponse;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.server.ServerWebExchange;
|
|
|
+import reactor.core.publisher.Mono;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.random.RandomGenerator;
|
|
|
@@ -42,7 +51,38 @@ public class DemoController {
|
|
|
@Autowired
|
|
|
private DemoService demoService;
|
|
|
|
|
|
+ @GetMapping("listname5")
|
|
|
+ public Mono<Void> export(ServerHttpResponse response) {
|
|
|
+
|
|
|
+ ExcelUtil<DemoExcelDto> util = new ExcelUtil<DemoExcelDto>(DemoExcelDto.class);
|
|
|
+ List<DemoExcelDto> list = new ArrayList<>();
|
|
|
+ DemoExcelDto d1 = new DemoExcelDto();
|
|
|
+ d1.setName("名字1");
|
|
|
+ d1.setTestCode("test1");
|
|
|
+ list.add(d1);
|
|
|
+ DemoExcelDto d2 = new DemoExcelDto();
|
|
|
+ d2.setName("名字2");
|
|
|
+ d2.setTestCode("test2");
|
|
|
+ list.add(d2);
|
|
|
+ DemoExcelDto d3 = new DemoExcelDto();
|
|
|
+ d3.setName("名字3");
|
|
|
+ d3.setTestCode("test3");
|
|
|
+ list.add(d3);
|
|
|
+
|
|
|
+ DemoExcelDto d4 = new DemoExcelDto();
|
|
|
+ d4.setName("名字4");
|
|
|
+ d4.setTestCode("test4");//没有值则导出来是空白
|
|
|
+ list.add(d4);
|
|
|
+
|
|
|
+ return util.exportExcel(response, list, "字典数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("listname3")
|
|
|
+ public BaseReturnDto list222(@RequestBody SysDictData sysDictData) {
|
|
|
|
|
|
+ List<SysDictData> list=DictUtil.getSysDictDataByKey(sysDictData.getDictType());
|
|
|
+ return BaseReturnDto.success(list);
|
|
|
+ }
|
|
|
|
|
|
@GetMapping("listname")
|
|
|
public BasePageResult<MyDemoDto> queryname(@RequestParam("name") String name) {
|