瀏覽代碼

Merge branch 'lxs'

370774330@qq.com 5 年之前
父節點
當前提交
bd3acaf6ef

+ 3 - 3
query/src/main/java/cn/seecoder/query/Response.java

@@ -26,15 +26,15 @@ public class Response<T> implements Serializable {
 
 
     public static Response<Object> buildSuccess() {
-        return new Response<>(200, "", null);
+        return new Response<Object>(200, "", null);
     }
 
 
     public static <T> Response<T> buildSuccess(T result) {
-        return new Response<>(200, "", result);
+        return new Response<T>(200, "", result);
     }
 
     public static  Response<Object> buildFailure(Integer code, String message) {
-        return new Response<>(code,message, null);
+        return new Response<Object>(code,message, null);
     }
 }

+ 3 - 13
query/src/main/java/cn/seecoder/query/dao/QueryMapper.java

@@ -1,11 +1,10 @@
 package cn.seecoder.query.dao;
 
-import cn.seecoder.query.model.BugListDTO;
 import cn.seecoder.query.model.CommitDTO;
-import cn.seecoder.query.model.TreeDTO;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
+import java.sql.Timestamp;
 import java.util.List;
 
 /**
@@ -16,15 +15,6 @@ import java.util.List;
 @Repository
 public interface QueryMapper {
 
-    @Select("select * from commit")
-    List<CommitDTO> selectCommits();
-
-    @Select("select * from bug_list")
-    List<BugListDTO> selectBugLists();
-
-    /**
-     * 选择所有叶子节点
-     */
-    @Select("select * from tree_node where deep = 4")
-    List<TreeDTO> selectTreeLeaf();
+    @Select("select * from commit where timestamp>=start and timestamp<end")
+    List<CommitDTO> selectCommits(Timestamp start, Timestamp end);
 }

+ 9 - 13
query/src/main/java/cn/seecoder/query/facade/QueryController.java

@@ -2,14 +2,16 @@ package cn.seecoder.query.facade;
 
 import cn.seecoder.query.Response;
 import cn.seecoder.query.dao.QueryMapper;
-import cn.seecoder.query.model.BugListDTO;
 import cn.seecoder.query.model.CommitDTO;
-import cn.seecoder.query.model.TreeDTO;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.List;
 
 /**
@@ -29,17 +31,11 @@ public class QueryController {
     }
 
     @GetMapping("/commits")
-    public Response<List<CommitDTO>> queryCommits(){
-        return Response.buildSuccess(queryMapper.selectCommits());
+    public Response<List<CommitDTO>> queryCommits(@Param("startAt") String startAt,@Param("endAt") String endAt) throws ParseException {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Timestamp startTime=new Timestamp(simpleDateFormat.parse(startAt).getTime());
+        Timestamp endTime=new Timestamp(simpleDateFormat.parse(endAt).getTime());
+        return Response.buildSuccess(queryMapper.selectCommits(startTime,endTime));
     }
 
-    @GetMapping("/buglist")
-    public Response<List<BugListDTO>> queryBugList(){
-        return Response.buildSuccess(queryMapper.selectBugLists());
-    }
-
-    @GetMapping("/leaf")
-    public Response<List<TreeDTO>> queryLeaf(){
-        return Response.buildSuccess(queryMapper.selectTreeLeaf());
-    }
 }

+ 0 - 32
query/src/main/java/cn/seecoder/query/model/BugListDTO.java

@@ -1,32 +0,0 @@
-package cn.seecoder.query.model;
-
-import lombok.Data;
-
-import java.sql.Timestamp;
-
-/**
- * @author PuHong Weng
- * @date 2021/4/16
- * @description:
- */
-@Data
-public class BugListDTO {
-
-    private Integer id;
-
-    /**
-     * 预计需要时间
-     */
-    private Long timeToTake;
-
-    private Timestamp startTime;
-
-    private Timestamp endTime;
-
-    /**
-     * 关联的项目
-     */
-    private Integer projectId;
-
-    private Integer processorId;
-}

+ 2 - 2
query/src/main/java/cn/seecoder/query/model/CommitDTO.java

@@ -3,17 +3,17 @@ package cn.seecoder.query.model;
 import lombok.Data;
 
 /**
- * @author PuHong Weng
+ * @author LiXueSong
  * @date 2021/4/16
  * @description:
  */
 @Data
 public class CommitDTO {
-    private String userId;
     private String id;
     private String timestamp;
     private String gitlabUsername;
     private String relatedType;
     private Integer relatedId;
     private Integer projectId;
+    private String email;
 }

+ 0 - 24
query/src/main/java/cn/seecoder/query/model/TreeDTO.java

@@ -1,24 +0,0 @@
-package cn.seecoder.query.model;
-
-import lombok.Data;
-
-/**
- * @author PuHong Weng
- * @date 2021/4/16
- * @description:
- */
-@Data
-public class TreeDTO {
-    private Integer id;
-    /**
-     * 预计完成时间花销
-     */
-    private Long timeToTake;
-    private String startTime;
-    private String endTime;
-    private Integer projectId;
-    /**
-     * 负责人 id
-     */
-    private Integer processorId;
-}