|
@@ -1,6 +1,8 @@
|
|
|
package cn.iocoder.yudao.module.system.controller.admin.dictTenant;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|
|
+import cn.iocoder.yudao.framework.common.enums.TenantDataTypeEnum;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dictTenant.vo.data.DictDataTenantPageReqVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dictTenant.vo.data.DictDataTenantRespVO;
|
|
@@ -23,6 +25,7 @@ import javax.validation.*;
|
|
|
import javax.servlet.http.*;
|
|
|
import java.util.*;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
@@ -89,7 +92,21 @@ public class DictDataTenantController {
|
|
|
// @PreAuthorize("@ss.hasPermission('tenant:dict-data:query')")
|
|
|
public CommonResult<PageResult<DictDataTenantRespVO>> getDictDataPage(@Valid @ParameterObject DictDataTenantPageReqVO pageReqVO) {
|
|
|
PageResult<DictDataTenantDO> pageResult = dictDataTenantService.getDictDataPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, DictDataTenantRespVO.class));
|
|
|
+ PageResult<DictDataTenantRespVO> voPageResult = BeanUtils.toBean(pageResult, DictDataTenantRespVO.class);
|
|
|
+ List<DictDataTenantRespVO> list = voPageResult.getList();
|
|
|
+ if (CollUtil.isNotEmpty(list)) {
|
|
|
+ Map<Integer, String> statusMap = Arrays.stream(CommonStatusEnum.values())
|
|
|
+ .collect(Collectors.toMap(CommonStatusEnum::getStatus, CommonStatusEnum::getName));
|
|
|
+
|
|
|
+ Map<Integer, String> dataTypeMap = Arrays.stream(TenantDataTypeEnum.values())
|
|
|
+ .collect(Collectors.toMap(TenantDataTypeEnum::getType, TenantDataTypeEnum::getName));
|
|
|
+
|
|
|
+ for (DictDataTenantRespVO dictData : list) {
|
|
|
+ dictData.setStatusDesc(statusMap.get(dictData.getStatus()));
|
|
|
+ dictData.setDataTypeDesc(dataTypeMap.get(dictData.getDataType()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return success(voPageResult);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/export-excel")
|
|
@@ -101,9 +118,23 @@ public class DictDataTenantController {
|
|
|
HttpServletResponse response) throws IOException {
|
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
List<DictDataTenantDO> list = dictDataTenantService.getDictDataPage(pageReqVO).getList();
|
|
|
+ List<DictDataTenantRespVO> voList = BeanUtils.toBean(list, DictDataTenantRespVO.class);
|
|
|
+ if (CollUtil.isNotEmpty(voList)) {
|
|
|
+ Map<Integer, String> statusMap = Arrays.stream(CommonStatusEnum.values())
|
|
|
+ .collect(Collectors.toMap(CommonStatusEnum::getStatus, CommonStatusEnum::getName));
|
|
|
+
|
|
|
+ Map<Integer, String> dataTypeMap = Arrays.stream(TenantDataTypeEnum.values())
|
|
|
+ .collect(Collectors.toMap(TenantDataTypeEnum::getType, TenantDataTypeEnum::getName));
|
|
|
+
|
|
|
+ for (DictDataTenantRespVO dictData : voList) {
|
|
|
+ dictData.setStatusDesc(statusMap.get(dictData.getStatus()));
|
|
|
+ dictData.setDataTypeDesc(dataTypeMap.get(dictData.getDataType()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 导出 Excel
|
|
|
ExcelUtils.write(response, "租户字典数据.xls", "数据", DictDataTenantRespVO.class,
|
|
|
- BeanUtils.toBean(list, DictDataTenantRespVO.class));
|
|
|
+ voList);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = {"/list-all-simple"})
|