From 159a579b453210d203d9e08e03b1d639fdb2b969 Mon Sep 17 00:00:00 2001 From: chengyufei <1932574737@qq.com> Date: Thu, 13 Jul 2023 15:25:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BB=BB=E5=8A=A1=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TaskTypeController.java | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/taskType/controller/TaskTypeController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/taskType/controller/TaskTypeController.java index 6207abe..8c57cfc 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/taskType/controller/TaskTypeController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/taskType/controller/TaskTypeController.java @@ -1,12 +1,14 @@ package org.jeecg.modules.taskType.controller; +import cn.hutool.core.map.MapWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import javafx.util.Pair; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; @@ -25,8 +27,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.List; +import java.util.*; /** * @Description: 任务类型管理 @@ -44,6 +45,35 @@ public class TaskTypeController extends JeecgController getMapType(){ + Map, List>> map = new HashMap<>(); + List hasChild = taskTypeService.query().eq("has_child", "1").list(); + if (hasChild == null || hasChild.size() == 0) + return Result.error("查询任务类型失败"); + + for (TaskType taskType : hasChild) { + //准备map的key + String typeName = taskType.getTypeName(); + String id = taskType.getId(); + Pair pair = new Pair<>(typeName, id); + + //准备map的value + List list = taskTypeService.query().eq("id", id).list(); + List> pairList = new ArrayList<>(); + for (TaskType type : list) + pairList.add(new Pair<>(type.getTypeName(), type.getId())); + + //放入数据到map + map.put(pair, pairList); + } + return Result.OK(map); + } + @ApiOperation(value = "文章栏目-分页列表查询", notes = "文章栏目-分页列表查询") @GetMapping(value = "/rootList") public Result rootList(TaskType taskType,