查询任务类型4.0

dev
chengyufei 1 year ago
parent 262a124a49
commit a7e9adf02a
  1. 17
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/taskType/controller/TaskTypeController.java

@ -5,6 +5,8 @@ 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 com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
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 javafx.util.Pair;
@ -42,6 +44,9 @@ public class TaskTypeController extends JeecgController<TaskType, ITaskTypeServi
@Autowired @Autowired
private ITaskTypeService taskTypeService; private ITaskTypeService taskTypeService;
@Autowired
private ObjectMapper objectMapper;
private static final String ADMIN_COLUMN_KEY = "99"; private static final String ADMIN_COLUMN_KEY = "99";
/** /**
@ -50,7 +55,7 @@ public class TaskTypeController extends JeecgController<TaskType, ITaskTypeServi
*/ */
@GetMapping("/getTypeMap") @GetMapping("/getTypeMap")
public Result<?> getMapType(){ public Result<?> getMapType(){
Map<TypeDto, List<TypeDto>> listMap = new HashMap<>(); Map<String, 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)
@ -68,7 +73,15 @@ public class TaskTypeController extends JeecgController<TaskType, ITaskTypeServi
for (TaskType type : list) for (TaskType type : list)
typeDtoList.add(new TypeDto(type.getId(), type.getTypeName())); typeDtoList.add(new TypeDto(type.getId(), type.getTypeName()));
//放入数据到map //放入数据到map
listMap.put(typeDto, typeDtoList);
String key = null;
try {
key = objectMapper.writeValueAsString(typeDto);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
listMap.put(key, typeDtoList);
} }
return Result.OK(listMap); return Result.OK(listMap);
} }

Loading…
Cancel
Save