查询任务类型

dev
chengyufei 1 year ago
parent 375329445b
commit 159a579b45
  1. 34
      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; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import javafx.util.Pair;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
@ -25,8 +27,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.*;
import java.util.List;
/** /**
* @Description: 任务类型管理 * @Description: 任务类型管理
@ -44,6 +45,35 @@ public class TaskTypeController extends JeecgController<TaskType, ITaskTypeServi
private static final String ADMIN_COLUMN_KEY = "99"; private static final String ADMIN_COLUMN_KEY = "99";
/**
* 查询所有项目类型并根据pid分类
* @return
*/
@GetMapping("/getTypeMap")
public Result<?> getMapType(){
Map<Pair<String, String>, List<Pair<String, String>>> map = new HashMap<>();
List<TaskType> 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<String, String> pair = new Pair<>(typeName, id);
//准备map的value
List<TaskType> list = taskTypeService.query().eq("id", id).list();
List<Pair<String, String>> 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 = "文章栏目-分页列表查询") @ApiOperation(value = "文章栏目-分页列表查询", notes = "文章栏目-分页列表查询")
@GetMapping(value = "/rootList") @GetMapping(value = "/rootList")
public Result<?> rootList(TaskType taskType, public Result<?> rootList(TaskType taskType,

Loading…
Cancel
Save