|
@@ -1,12 +1,14 @@
|
|
|
package com.diagbot.service;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.diagbot.dto.GetQuestionInfoDTO;
|
|
|
+import com.diagbot.dto.QuestionPageDTO;
|
|
|
import com.diagbot.entity.QuestionInfo;
|
|
|
import com.diagbot.vo.GetQuestionInfoVO;
|
|
|
+import com.diagbot.vo.QuestionPageVO;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -21,7 +23,6 @@ import java.util.Map;
|
|
|
public interface QuestionInfoService extends IService<QuestionInfo> {
|
|
|
|
|
|
|
|
|
- public static int[] arr = {0, 0};
|
|
|
|
|
|
/**
|
|
|
* 根据id删除标签
|
|
@@ -33,6 +34,7 @@ public interface QuestionInfoService extends IService<QuestionInfo> {
|
|
|
|
|
|
/**
|
|
|
* 根据名称获取标签信息
|
|
|
+ *
|
|
|
* @param getQuestionInfoVO
|
|
|
* @return
|
|
|
*/
|
|
@@ -47,121 +49,14 @@ public interface QuestionInfoService extends IService<QuestionInfo> {
|
|
|
public List<QuestionInfo> index(Map map);
|
|
|
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- TreeNode tree = new TreeNode();
|
|
|
-// for(int i = 0; i < 10; i++) {
|
|
|
-// insert(tree, (int)(Math.random()*100));
|
|
|
-// }
|
|
|
- insert(tree, 80);
|
|
|
- insert(tree, 40);
|
|
|
- insert(tree, 20);
|
|
|
- insert(tree, 50);
|
|
|
- insert(tree, 60);
|
|
|
- insert(tree, 59);
|
|
|
- insert(tree, 100);
|
|
|
- insert(tree, 110);
|
|
|
- insert(tree, 120);
|
|
|
- insert(tree, 130);
|
|
|
- insert(tree, 140);
|
|
|
- insert(tree, 150);
|
|
|
-
|
|
|
- System.out.println(tree.toString());
|
|
|
- List<Integer> list = new ArrayList<>();
|
|
|
- sort(tree, list);
|
|
|
- System.out.println(list.toString());
|
|
|
- deep(tree, arr);
|
|
|
- System.out.println(Arrays.toString(arr));
|
|
|
- }
|
|
|
-
|
|
|
- public static void insert(TreeNode tree, int data) {
|
|
|
- if(tree == null) {
|
|
|
- tree = new TreeNode(data);
|
|
|
- return ;
|
|
|
- }
|
|
|
- if(tree.getData() == null) {
|
|
|
- tree.setData(data);
|
|
|
- return ;
|
|
|
- }
|
|
|
- if(tree.getData() > data) {
|
|
|
- if(tree.getLeft() == null) {
|
|
|
- tree.setLeft(new TreeNode(data));
|
|
|
- return ;
|
|
|
- }
|
|
|
- insert(tree.getLeft(), data);
|
|
|
- } else {
|
|
|
- if(tree.getRight() == null) {
|
|
|
- tree.setRight(new TreeNode(data));
|
|
|
- return ;
|
|
|
- }
|
|
|
- insert(tree.getRight(), data);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public static void sort(TreeNode tree, List<Integer> list) {
|
|
|
- if(tree != null) {
|
|
|
- sort(tree.getLeft(), list);
|
|
|
- list.add(tree.getData());
|
|
|
- sort(tree.getRight(), list);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static void deep(TreeNode tree, int[] arr) {
|
|
|
- ++arr[1];
|
|
|
- if(tree != null) {
|
|
|
- if(arr[1]> arr[0]) {
|
|
|
- ++arr[0];
|
|
|
- }
|
|
|
- deep(tree.getLeft(), arr);
|
|
|
- --arr[1];
|
|
|
- deep(tree.getRight(), arr);
|
|
|
- --arr[1];
|
|
|
- }
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 获取标签列表
|
|
|
+ *
|
|
|
+ * @param page
|
|
|
+ * @param questionPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ IPage<QuestionPageDTO> getList(Page page, QuestionPageVO questionPageVO);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-class TreeNode {
|
|
|
- private Integer data;
|
|
|
- private TreeNode left;
|
|
|
- private TreeNode right;
|
|
|
-
|
|
|
- public TreeNode() {
|
|
|
- }
|
|
|
-
|
|
|
- public TreeNode(Integer data) {
|
|
|
- this.data = data;
|
|
|
- }
|
|
|
-
|
|
|
- public Integer getData() {
|
|
|
- return data;
|
|
|
- }
|
|
|
-
|
|
|
- public void setData(Integer data) {
|
|
|
- this.data = data;
|
|
|
- }
|
|
|
-
|
|
|
- public TreeNode getLeft() {
|
|
|
- return left;
|
|
|
- }
|
|
|
-
|
|
|
- public void setLeft(TreeNode left) {
|
|
|
- this.left = left;
|
|
|
- }
|
|
|
-
|
|
|
- public TreeNode getRight() {
|
|
|
- return right;
|
|
|
- }
|
|
|
-
|
|
|
- public void setRight(TreeNode right) {
|
|
|
- this.right = right;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public String toString() {
|
|
|
- return "TreeNode{" +
|
|
|
- "data=" + data +
|
|
|
- '}';
|
|
|
- }
|
|
|
-}
|