查询任务类型3.0

dev
chengyufei 1 year ago
parent cf95dc4eff
commit 0140a30ff5
  1. 17
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/taskType/controller/TaskTypeController.java
  2. 24
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/taskType/entity/dto/TypeDto.java

@ -1,7 +1,6 @@
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;
@ -10,7 +9,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import javafx.util.Pair; import javafx.util.Pair;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
@ -20,6 +18,7 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.taskType.entity.TaskType; import org.jeecg.modules.taskType.entity.TaskType;
import org.jeecg.modules.taskType.entity.dto.TypeDto;
import org.jeecg.modules.taskType.service.ITaskTypeService; import org.jeecg.modules.taskType.service.ITaskTypeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -51,7 +50,8 @@ public class TaskTypeController extends JeecgController<TaskType, ITaskTypeServi
*/ */
@GetMapping("/getTypeMap") @GetMapping("/getTypeMap")
public Result<?> getMapType(){ public Result<?> getMapType(){
Map<Pair<String, String>, List<Pair<String, String>>> map = new HashMap<>(); Map<TypeDto, List<TypeDto>> listMap = new HashMap<>();
List<TaskType> hasChild = taskTypeService.query().eq("has_child", "1").list(); List<TaskType> hasChild = taskTypeService.query().eq("has_child", "1").list();
if (hasChild == null || hasChild.size() == 0) if (hasChild == null || hasChild.size() == 0)
return Result.error("查询任务类型失败"); return Result.error("查询任务类型失败");
@ -60,18 +60,17 @@ public class TaskTypeController extends JeecgController<TaskType, ITaskTypeServi
//准备map的key //准备map的key
String typeName = taskType.getTypeName(); String typeName = taskType.getTypeName();
String id = taskType.getId(); String id = taskType.getId();
Pair<String, String> pair = new Pair<>(id, typeName); TypeDto typeDto = new TypeDto(id, typeName);
//准备map的value //准备map的value
List<TaskType> list = taskTypeService.query().eq("pid", id).list(); List<TaskType> list = taskTypeService.query().eq("pid", id).list();
List<Pair<String, String>> pairList = new ArrayList<>(); List<TypeDto> typeDtoList = new ArrayList<>(list.size());
for (TaskType type : list) for (TaskType type : list)
pairList.add(new Pair<>(type.getId(), type.getTypeName())); typeDtoList.add(new TypeDto(type.getId(), type.getTypeName()));
//放入数据到map //放入数据到map
map.put(pair, pairList); listMap.put(typeDto, typeDtoList);
} }
return Result.OK(map); return Result.OK(listMap);
} }
@ApiOperation(value = "文章栏目-分页列表查询", notes = "文章栏目-分页列表查询") @ApiOperation(value = "文章栏目-分页列表查询", notes = "文章栏目-分页列表查询")

@ -0,0 +1,24 @@
package org.jeecg.modules.taskType.entity.dto;
import lombok.Data;
/**
* @Author shkstart
* @create 2023-05-13-17:05
*/
@Data
public class TypeDto {
public TypeDto(){
}
public TypeDto(String id, String type_Name) {
this.id = id;
this.type_Name = type_Name;
}
private String id;
private String type_Name;
}
Loading…
Cancel
Save