Browse Source

feat(server): 后台框架完成

Go 6 years ago
parent
commit
4e267b7c64
100 changed files with 2816 additions and 712 deletions
  1. 5 1
      server/data/src/main/java/com/qxgmat/data/constants/enums/ServiceKey.java
  2. 1 1
      server/data/src/main/java/com/qxgmat/data/constants/enums/SettingKey.java
  3. 1 1
      server/data/src/main/java/com/qxgmat/data/constants/enums/module/PaperModule.java
  4. 1 1
      server/data/src/main/java/com/qxgmat/data/constants/enums/module/QuestionModule.java
  5. 1 1
      server/data/src/main/java/com/qxgmat/data/constants/enums/module/ReportModule.java
  6. 2 1
      server/data/src/main/java/com/qxgmat/data/constants/enums/status/HomeworkPreviewStatus.java
  7. 1 1
      server/data/src/main/java/com/qxgmat/data/constants/enums/user/AskTarget.java
  8. 7 0
      server/data/src/main/java/com/qxgmat/data/dao/ExaminationPaperMapper.java
  9. 7 0
      server/data/src/main/java/com/qxgmat/data/dao/ExaminationPaperQuestionMapper.java
  10. 7 0
      server/data/src/main/java/com/qxgmat/data/dao/ExercisePaperMapper.java
  11. 7 0
      server/data/src/main/java/com/qxgmat/data/dao/ExercisePaperQuestionMapper.java
  12. 7 0
      server/data/src/main/java/com/qxgmat/data/dao/QuestionNoMapper.java
  13. 7 0
      server/data/src/main/java/com/qxgmat/data/dao/TextbookPaperMapper.java
  14. 63 0
      server/data/src/main/java/com/qxgmat/data/dao/entity/ExaminationPaper.java
  15. 115 0
      server/data/src/main/java/com/qxgmat/data/dao/entity/ExaminationPaperQuestion.java
  16. 35 0
      server/data/src/main/java/com/qxgmat/data/dao/entity/ExaminationStruct.java
  17. 343 0
      server/data/src/main/java/com/qxgmat/data/dao/entity/ExercisePaper.java
  18. 133 0
      server/data/src/main/java/com/qxgmat/data/dao/entity/ExercisePaperQuestion.java
  19. 35 0
      server/data/src/main/java/com/qxgmat/data/dao/entity/ExerciseStruct.java
  20. 7 7
      server/data/src/main/java/com/qxgmat/data/dao/entity/HomeworkPreview.java
  21. 163 40
      server/data/src/main/java/com/qxgmat/data/dao/entity/Question.java
  22. 203 0
      server/data/src/main/java/com/qxgmat/data/dao/entity/QuestionNo.java
  23. 35 0
      server/data/src/main/java/com/qxgmat/data/dao/entity/SentencePaper.java
  24. 77 42
      server/data/src/main/java/com/qxgmat/data/dao/entity/SentenceQuestion.java
  25. 63 0
      server/data/src/main/java/com/qxgmat/data/dao/entity/TextbookPaper.java
  26. 12 12
      server/data/src/main/java/com/qxgmat/data/dao/entity/User.java
  27. 90 10
      server/data/src/main/java/com/qxgmat/data/dao/entity/UserMessage.java
  28. 44 43
      server/data/src/main/java/com/qxgmat/data/dao/entity/UserQuestion.java
  29. 52 16
      server/data/src/main/java/com/qxgmat/data/dao/entity/UserReport.java
  30. 10 0
      server/data/src/main/java/com/qxgmat/data/dao/mapping/ExaminationPaperMapper.xml
  31. 18 0
      server/data/src/main/java/com/qxgmat/data/dao/mapping/ExaminationPaperQuestionMapper.xml
  32. 12 0
      server/data/src/main/java/com/qxgmat/data/dao/mapping/ExaminationStructMapper.xml
  33. 25 0
      server/data/src/main/java/com/qxgmat/data/dao/mapping/ExercisePaperMapper.xml
  34. 18 0
      server/data/src/main/java/com/qxgmat/data/dao/mapping/ExercisePaperQuestionMapper.xml
  35. 12 0
      server/data/src/main/java/com/qxgmat/data/dao/mapping/ExerciseStructMapper.xml
  36. 2 2
      server/data/src/main/java/com/qxgmat/data/dao/mapping/HomeworkPreviewMapper.xml
  37. 1 1
      server/data/src/main/java/com/qxgmat/data/dao/mapping/ManagerRoleMapper.xml
  38. 11 6
      server/data/src/main/java/com/qxgmat/data/dao/mapping/QuestionMapper.xml
  39. 20 0
      server/data/src/main/java/com/qxgmat/data/dao/mapping/QuestionNoMapper.xml
  40. 7 0
      server/data/src/main/java/com/qxgmat/data/dao/mapping/SentencePaperMapper.xml
  41. 4 3
      server/data/src/main/java/com/qxgmat/data/dao/mapping/SentenceQuestionMapper.xml
  42. 10 0
      server/data/src/main/java/com/qxgmat/data/dao/mapping/TextbookPaperMapper.xml
  43. 2 2
      server/data/src/main/java/com/qxgmat/data/dao/mapping/UserMapper.xml
  44. 4 2
      server/data/src/main/java/com/qxgmat/data/dao/mapping/UserMessageMapper.xml
  45. 1 1
      server/data/src/main/java/com/qxgmat/data/dao/mapping/UserPaperMapper.xml
  46. 3 14
      server/data/src/main/java/com/qxgmat/data/dao/mapping/UserQuestionMapper.xml
  47. 3 13
      server/data/src/main/java/com/qxgmat/data/dao/mapping/UserReportMapper.xml
  48. 16 2
      server/data/src/main/java/com/qxgmat/data/relation/QuestionRelationMapper.java
  49. 18 2
      server/data/src/main/java/com/qxgmat/data/relation/UserAskRelationMapper.java
  50. 7 1
      server/data/src/main/java/com/qxgmat/data/relation/UserPaperRelationMapper.java
  51. 7 1
      server/data/src/main/java/com/qxgmat/data/relation/UserReportRelationMapper.java
  52. 35 40
      server/data/src/main/java/com/qxgmat/data/relation/mapping/QuestionRelationMapper.xml
  53. 3 3
      server/data/src/main/java/com/qxgmat/data/relation/mapping/UserAskRelationMapper.xml
  54. 5 5
      server/data/src/main/java/com/qxgmat/data/relation/mapping/UserPaperRelationMapper.xml
  55. 3 3
      server/data/src/main/java/com/qxgmat/data/relation/mapping/UserReportRelationMapper.xml
  56. 35 4
      server/data/src/main/resources/mybatis-generator.xml
  57. 2 2
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/ClassController.java
  58. 3 2
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/CommonController.java
  59. 59 0
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/ExaminationController.java
  60. 113 7
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/ExerciseController.java
  61. 2 2
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/ManagerController.java
  62. 4 2
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/PreviewController.java
  63. 51 0
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/QuestionController.java
  64. 10 7
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/SentenceController.java
  65. 7 0
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/ServiceController.java
  66. 10 10
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/UserAskController.java
  67. 4 3
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/UserController.java
  68. 7 7
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/UserPreviewController.java
  69. 24 32
      server/gateway-api/src/main/java/com/qxgmat/controller/api/AuthController.java
  70. 32 0
      server/gateway-api/src/main/java/com/qxgmat/controller/api/CommonController.java
  71. 76 85
      server/gateway-api/src/main/java/com/qxgmat/controller/api/MyController.java
  72. 1 0
      server/gateway-api/src/main/java/com/qxgmat/controller/api/WechatController.java
  73. 10 7
      server/gateway-api/src/main/java/com/qxgmat/controller/gateway/OauthController.java
  74. 2 3
      server/gateway-api/src/main/java/com/qxgmat/controller/gateway/PayController.java
  75. 3 3
      server/gateway-api/src/main/java/com/qxgmat/dto/admin/extend/QuestionNoExtendDto.java
  76. 57 1
      server/gateway-api/src/main/java/com/qxgmat/dto/admin/request/ExaminationStructDto.java
  77. 69 0
      server/gateway-api/src/main/java/com/qxgmat/dto/admin/request/ExerciseStructDto.java
  78. 97 14
      server/gateway-api/src/main/java/com/qxgmat/dto/admin/request/QuestionDto.java
  79. 7 58
      server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/ExercisePaperListDto.java
  80. 24 12
      server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/ExerciseQuestionListDto.java
  81. 9 9
      server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/LoginUserDto.java
  82. 2 1
      server/gateway-api/src/main/java/com/qxgmat/dto/request/SmsSendDto.java
  83. 8 37
      server/gateway-api/src/main/java/com/qxgmat/dto/request/UserEmailDto.java
  84. 23 8
      server/gateway-api/src/main/java/com/qxgmat/dto/request/UserInfoDto.java
  85. 1 0
      server/gateway-api/src/main/java/com/qxgmat/dto/request/UserValidMobileDto.java
  86. 8 8
      server/gateway-api/src/main/java/com/qxgmat/dto/response/UserDto.java
  87. 37 12
      server/gateway-api/src/main/java/com/qxgmat/dto/response/UserRealDto.java
  88. 14 12
      server/gateway-api/src/main/java/com/qxgmat/service/ExaminationPaperService.java
  89. 28 3
      server/gateway-api/src/main/java/com/qxgmat/service/ExercisePaperService.java
  90. 4 4
      server/gateway-api/src/main/java/com/qxgmat/service/ManagerService.java
  91. 32 2
      server/gateway-api/src/main/java/com/qxgmat/service/SentencePaperService.java
  92. 83 16
      server/gateway-api/src/main/java/com/qxgmat/service/UsersService.java
  93. 7 1
      server/gateway-api/src/main/java/com/qxgmat/service/inline/ExaminationStructService.java
  94. 20 18
      server/gateway-api/src/main/java/com/qxgmat/service/inline/ExercisePaperQuestionService.java
  95. 6 1
      server/gateway-api/src/main/java/com/qxgmat/service/inline/ExerciseStructService.java
  96. 2 2
      server/gateway-api/src/main/java/com/qxgmat/service/inline/HomeworkPreviewService.java
  97. 18 17
      server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionNoService.java
  98. 23 0
      server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionService.java
  99. 1 22
      server/gateway-api/src/main/java/com/qxgmat/service/inline/SentenceQuestionService.java
  100. 0 0
      server/gateway-api/src/main/java/com/qxgmat/service/inline/UserAskService.java

+ 5 - 1
server/data/src/main/java/com/qxgmat/data/constants/enums/ServiceKey.java

@@ -1,9 +1,13 @@
 package com.qxgmat.data.constants.enums;
 
 public enum ServiceKey {
-    VIP("vip");
+    VIP("vip"), TEXTBOOK("textbook"), QX_CAT("qx_cat");
     public String key;
     private ServiceKey(String key){
         this.key = key;
     }
+
+    public static ServiceKey ValueOf(String name){
+        return ServiceKey.valueOf(name.toUpperCase());
+    }
 }

+ 1 - 1
server/data/src/main/java/com/qxgmat/data/constants/enums/SettingKey.java

@@ -4,7 +4,7 @@ package com.qxgmat.data.constants.enums;
  * Created by gaojie on 2017/11/19.
  */
 public enum SettingKey {
-    INDEX("index"), SENTENCE("sentence"), BUY_MESSAGE("buy_message"), PLACE("place"), TIME("time");
+    INDEX("index"), SENTENCE("sentence"), BUY_MESSAGE("buy_message"), PLACE("place"), TIME("time"), EXERCISE_PAPER("exercise_paper");
     final static public String message = "设置key";
 
     public String key;

+ 1 - 1
server/data/src/main/java/com/qxgmat/data/constants/enums/module/PaperModule.java

@@ -1,7 +1,7 @@
 package com.qxgmat.data.constants.enums.module;
 
 public enum PaperModule {
-    EXERCISE("exercise"), EXAMINATION("examination"), COLLECT("collect"), ERROR("error"), , HOMEWORK_PREVIEW("homework_preview");
+    EXERCISE("exercise"), EXAMINATION("examination"), COLLECT("collect"), ERROR("error"), HOMEWORK_PREVIEW("homework_preview");
     public String key;
     private PaperModule(String key){
         this.key = key;

+ 1 - 1
server/data/src/main/java/com/qxgmat/data/constants/enums/module/QuestionModule.java

@@ -1,7 +1,7 @@
 package com.qxgmat.data.constants.enums.module;
 
 public enum QuestionModule {
-    EXERCISE("exercise"), EXAMINATION("examination"), SENTENCE("sentence");
+    EXERCISE("exercise"), EXAMINATION("examination"), SENTENCE("sentence"), TEXTBOOK("textbook");
     public String key;
     private QuestionModule(String key){
         this.key = key;

+ 1 - 1
server/data/src/main/java/com/qxgmat/data/constants/enums/module/ReportModule.java

@@ -1,7 +1,7 @@
 package com.qxgmat.data.constants.enums.module;
 
 public enum ReportModule {
-    EXERCISE("exercise"), EXAMINATION("examination"), SENTENCE("sentence"), HOMEWORK_PREVIEW("homework_preview");
+    EXERCISE("exercise"), EXAMINATION("examination"), SENTENCE("sentence"), HOMEWORK_PREVIEW("homework_preview"), TEXTBOOK("textbook");
     public String key;
     private ReportModule(String key){
         this.key = key;

+ 2 - 1
server/data/src/main/java/com/qxgmat/data/constants/enums/status/HomeworkPreviewStatus.java

@@ -11,7 +11,8 @@ public enum HomeworkPreviewStatus {
     private HomeworkPreviewStatus(int index){
         this.index = index;
     }
-    public static HomeworkPreviewStatus ValueOf(int index){
+    public static HomeworkPreviewStatus ValueOf(Integer index){
+        if (index == null) return ALL;
         switch (index){
             case 1:
                 return NO_START;

+ 1 - 1
server/data/src/main/java/com/qxgmat/data/constants/enums/user/AskTarget.java

@@ -2,7 +2,7 @@ package com.qxgmat.data.constants.enums.user;
 
 
 public enum AskTarget {
-    QUESTION("question"), OFFICAL("offical"), QX("qx"), ASSOCIATION("association");
+    QUESTION("question"), OFFICIAL("official"), QX("qx"), ASSOCIATION("association");
     public String key;
     private AskTarget(String key){
         this.key = key;

+ 7 - 0
server/data/src/main/java/com/qxgmat/data/dao/ExaminationPaperMapper.java

@@ -0,0 +1,7 @@
+package com.qxgmat.data.dao;
+
+import com.nuliji.tools.mybatis.Mapper;
+import com.qxgmat.data.dao.entity.ExaminationPaper;
+
+public interface ExaminationPaperMapper extends Mapper<ExaminationPaper> {
+}

+ 7 - 0
server/data/src/main/java/com/qxgmat/data/dao/ExaminationPaperQuestionMapper.java

@@ -0,0 +1,7 @@
+package com.qxgmat.data.dao;
+
+import com.nuliji.tools.mybatis.Mapper;
+import com.qxgmat.data.dao.entity.ExaminationPaperQuestion;
+
+public interface ExaminationPaperQuestionMapper extends Mapper<ExaminationPaperQuestion> {
+}

+ 7 - 0
server/data/src/main/java/com/qxgmat/data/dao/ExercisePaperMapper.java

@@ -0,0 +1,7 @@
+package com.qxgmat.data.dao;
+
+import com.nuliji.tools.mybatis.Mapper;
+import com.qxgmat.data.dao.entity.ExercisePaper;
+
+public interface ExercisePaperMapper extends Mapper<ExercisePaper> {
+}

+ 7 - 0
server/data/src/main/java/com/qxgmat/data/dao/ExercisePaperQuestionMapper.java

@@ -0,0 +1,7 @@
+package com.qxgmat.data.dao;
+
+import com.nuliji.tools.mybatis.Mapper;
+import com.qxgmat.data.dao.entity.ExercisePaperQuestion;
+
+public interface ExercisePaperQuestionMapper extends Mapper<ExercisePaperQuestion> {
+}

+ 7 - 0
server/data/src/main/java/com/qxgmat/data/dao/QuestionNoMapper.java

@@ -0,0 +1,7 @@
+package com.qxgmat.data.dao;
+
+import com.nuliji.tools.mybatis.Mapper;
+import com.qxgmat.data.dao.entity.QuestionNo;
+
+public interface QuestionNoMapper extends Mapper<QuestionNo> {
+}

+ 7 - 0
server/data/src/main/java/com/qxgmat/data/dao/TextbookPaperMapper.java

@@ -0,0 +1,7 @@
+package com.qxgmat.data.dao;
+
+import com.nuliji.tools.mybatis.Mapper;
+import com.qxgmat.data.dao.entity.TextbookPaper;
+
+public interface TextbookPaperMapper extends Mapper<TextbookPaper> {
+}

+ 63 - 0
server/data/src/main/java/com/qxgmat/data/dao/entity/ExaminationPaper.java

@@ -0,0 +1,63 @@
+package com.qxgmat.data.dao.entity;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+@Table(name = "examination_paper")
+public class ExaminationPaper implements Serializable {
+    @Id
+    @Column(name = "`id`")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public static ExaminationPaper.Builder builder() {
+        return new ExaminationPaper.Builder();
+    }
+
+    public static class Builder {
+        private ExaminationPaper obj;
+
+        public Builder() {
+            this.obj = new ExaminationPaper();
+        }
+
+        /**
+         * @param id
+         */
+        public Builder id(Integer id) {
+            obj.setId(id);
+            return this;
+        }
+
+        public ExaminationPaper build() {
+            return this.obj;
+        }
+    }
+}

+ 115 - 0
server/data/src/main/java/com/qxgmat/data/dao/entity/ExaminationPaperQuestion.java

@@ -0,0 +1,115 @@
+package com.qxgmat.data.dao.entity;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+@Table(name = "examination_paper_question")
+public class ExaminationPaperQuestion implements Serializable {
+    @Id
+    @Column(name = "`id`")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    @Column(name = "`paper_id`")
+    private Integer paperId;
+
+    @Column(name = "`question_id`")
+    private Integer questionId;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * @return paper_id
+     */
+    public Integer getPaperId() {
+        return paperId;
+    }
+
+    /**
+     * @param paperId
+     */
+    public void setPaperId(Integer paperId) {
+        this.paperId = paperId;
+    }
+
+    /**
+     * @return question_id
+     */
+    public Integer getQuestionId() {
+        return questionId;
+    }
+
+    /**
+     * @param questionId
+     */
+    public void setQuestionId(Integer questionId) {
+        this.questionId = questionId;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", paperId=").append(paperId);
+        sb.append(", questionId=").append(questionId);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public static ExaminationPaperQuestion.Builder builder() {
+        return new ExaminationPaperQuestion.Builder();
+    }
+
+    public static class Builder {
+        private ExaminationPaperQuestion obj;
+
+        public Builder() {
+            this.obj = new ExaminationPaperQuestion();
+        }
+
+        /**
+         * @param id
+         */
+        public Builder id(Integer id) {
+            obj.setId(id);
+            return this;
+        }
+
+        /**
+         * @param paperId
+         */
+        public Builder paperId(Integer paperId) {
+            obj.setPaperId(paperId);
+            return this;
+        }
+
+        /**
+         * @param questionId
+         */
+        public Builder questionId(Integer questionId) {
+            obj.setQuestionId(questionId);
+            return this;
+        }
+
+        public ExaminationPaperQuestion build() {
+            return this.obj;
+        }
+    }
+}

+ 35 - 0
server/data/src/main/java/com/qxgmat/data/dao/entity/ExaminationStruct.java

@@ -34,6 +34,12 @@ public class ExaminationStruct implements Serializable {
     @Column(name = "`order`")
     private Integer order;
 
+    /**
+     * 说明
+     */
+    @Column(name = "`description`")
+    private String description;
+
     private static final long serialVersionUID = 1L;
 
     /**
@@ -122,6 +128,24 @@ public class ExaminationStruct implements Serializable {
         this.order = order;
     }
 
+    /**
+     * 获取说明
+     *
+     * @return description - 说明
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * 设置说明
+     *
+     * @param description 说明
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -133,6 +157,7 @@ public class ExaminationStruct implements Serializable {
         sb.append(", nameEn=").append(nameEn);
         sb.append(", parentId=").append(parentId);
         sb.append(", order=").append(order);
+        sb.append(", description=").append(description);
         sb.append("]");
         return sb.toString();
     }
@@ -196,6 +221,16 @@ public class ExaminationStruct implements Serializable {
             return this;
         }
 
+        /**
+         * 设置说明
+         *
+         * @param description 说明
+         */
+        public Builder description(String description) {
+            obj.setDescription(description);
+            return this;
+        }
+
         public ExaminationStruct build() {
             return this.obj;
         }

+ 343 - 0
server/data/src/main/java/com/qxgmat/data/dao/entity/ExercisePaper.java

@@ -0,0 +1,343 @@
+package com.qxgmat.data.dao.entity;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+@Table(name = "exercise_paper")
+public class ExercisePaper implements Serializable {
+    @Id
+    @Column(name = "`id`")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    /**
+     * 题型
+     */
+    @Column(name = "`type`")
+    private String type;
+
+    /**
+     * 组卷逻辑:order ,place,difficult,error
+     */
+    @Column(name = "`logic`")
+    private String logic;
+
+    /**
+     * 逻辑
+     */
+    @Column(name = "`logic_extend`")
+    private String logicExtend;
+
+    /**
+     * 分册
+     */
+    @Column(name = "`struct_id`")
+    private Integer structId;
+
+    /**
+     * 所有父级id,逗号分隔
+     */
+    @Column(name = "`struct_parent`")
+    private Integer[] structParent;
+
+    /**
+     * 组卷名称
+     */
+    @Column(name = "`title`")
+    private String title;
+
+    /**
+     * 题目数量
+     */
+    @Column(name = "`question_number`")
+    private Integer questionNumber;
+
+    /**
+     * 开放状态:0关闭,1开启
+     */
+    @Column(name = "`status`")
+    private Integer status;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取题型
+     *
+     * @return type - 题型
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * 设置题型
+     *
+     * @param type 题型
+     */
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    /**
+     * 获取组卷逻辑:order ,place,difficult,error
+     *
+     * @return logic - 组卷逻辑:order ,place,difficult,error
+     */
+    public String getLogic() {
+        return logic;
+    }
+
+    /**
+     * 设置组卷逻辑:order ,place,difficult,error
+     *
+     * @param logic 组卷逻辑:order ,place,difficult,error
+     */
+    public void setLogic(String logic) {
+        this.logic = logic;
+    }
+
+    /**
+     * 获取逻辑
+     *
+     * @return logic_extend - 逻辑
+     */
+    public String getLogicExtend() {
+        return logicExtend;
+    }
+
+    /**
+     * 设置逻辑
+     *
+     * @param logicExtend 逻辑
+     */
+    public void setLogicExtend(String logicExtend) {
+        this.logicExtend = logicExtend;
+    }
+
+    /**
+     * 获取分册
+     *
+     * @return struct_id - 分册
+     */
+    public Integer getStructId() {
+        return structId;
+    }
+
+    /**
+     * 设置分册
+     *
+     * @param structId 分册
+     */
+    public void setStructId(Integer structId) {
+        this.structId = structId;
+    }
+
+    /**
+     * 获取所有父级id,逗号分隔
+     *
+     * @return struct_parent - 所有父级id,逗号分隔
+     */
+    public Integer[] getStructParent() {
+        return structParent;
+    }
+
+    /**
+     * 设置所有父级id,逗号分隔
+     *
+     * @param structParent 所有父级id,逗号分隔
+     */
+    public void setStructParent(Integer[] structParent) {
+        this.structParent = structParent;
+    }
+
+    /**
+     * 获取组卷名称
+     *
+     * @return title - 组卷名称
+     */
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * 设置组卷名称
+     *
+     * @param title 组卷名称
+     */
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    /**
+     * 获取题目数量
+     *
+     * @return question_number - 题目数量
+     */
+    public Integer getQuestionNumber() {
+        return questionNumber;
+    }
+
+    /**
+     * 设置题目数量
+     *
+     * @param questionNumber 题目数量
+     */
+    public void setQuestionNumber(Integer questionNumber) {
+        this.questionNumber = questionNumber;
+    }
+
+    /**
+     * 获取开放状态:0关闭,1开启
+     *
+     * @return status - 开放状态:0关闭,1开启
+     */
+    public Integer getStatus() {
+        return status;
+    }
+
+    /**
+     * 设置开放状态:0关闭,1开启
+     *
+     * @param status 开放状态:0关闭,1开启
+     */
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", type=").append(type);
+        sb.append(", logic=").append(logic);
+        sb.append(", logicExtend=").append(logicExtend);
+        sb.append(", structId=").append(structId);
+        sb.append(", structParent=").append(structParent);
+        sb.append(", title=").append(title);
+        sb.append(", questionNumber=").append(questionNumber);
+        sb.append(", status=").append(status);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public static ExercisePaper.Builder builder() {
+        return new ExercisePaper.Builder();
+    }
+
+    public static class Builder {
+        private ExercisePaper obj;
+
+        public Builder() {
+            this.obj = new ExercisePaper();
+        }
+
+        /**
+         * @param id
+         */
+        public Builder id(Integer id) {
+            obj.setId(id);
+            return this;
+        }
+
+        /**
+         * 设置题型
+         *
+         * @param type 题型
+         */
+        public Builder type(String type) {
+            obj.setType(type);
+            return this;
+        }
+
+        /**
+         * 设置组卷逻辑:order ,place,difficult,error
+         *
+         * @param logic 组卷逻辑:order ,place,difficult,error
+         */
+        public Builder logic(String logic) {
+            obj.setLogic(logic);
+            return this;
+        }
+
+        /**
+         * 设置逻辑
+         *
+         * @param logicExtend 逻辑
+         */
+        public Builder logicExtend(String logicExtend) {
+            obj.setLogicExtend(logicExtend);
+            return this;
+        }
+
+        /**
+         * 设置分册
+         *
+         * @param structId 分册
+         */
+        public Builder structId(Integer structId) {
+            obj.setStructId(structId);
+            return this;
+        }
+
+        /**
+         * 设置所有父级id,逗号分隔
+         *
+         * @param structParent 所有父级id,逗号分隔
+         */
+        public Builder structParent(Integer[] structParent) {
+            obj.setStructParent(structParent);
+            return this;
+        }
+
+        /**
+         * 设置组卷名称
+         *
+         * @param title 组卷名称
+         */
+        public Builder title(String title) {
+            obj.setTitle(title);
+            return this;
+        }
+
+        /**
+         * 设置题目数量
+         *
+         * @param questionNumber 题目数量
+         */
+        public Builder questionNumber(Integer questionNumber) {
+            obj.setQuestionNumber(questionNumber);
+            return this;
+        }
+
+        /**
+         * 设置开放状态:0关闭,1开启
+         *
+         * @param status 开放状态:0关闭,1开启
+         */
+        public Builder status(Integer status) {
+            obj.setStatus(status);
+            return this;
+        }
+
+        public ExercisePaper build() {
+            return this.obj;
+        }
+    }
+}

+ 133 - 0
server/data/src/main/java/com/qxgmat/data/dao/entity/ExercisePaperQuestion.java

@@ -0,0 +1,133 @@
+package com.qxgmat.data.dao.entity;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+@Table(name = "exercise_paper_question")
+public class ExercisePaperQuestion implements Serializable {
+    @Id
+    @Column(name = "`id`")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    /**
+     * 组卷id
+     */
+    @Column(name = "`paper_id`")
+    private Integer paperId;
+
+    /**
+     * 题目id
+     */
+    @Column(name = "`question_id`")
+    private Integer questionId;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取组卷id
+     *
+     * @return paper_id - 组卷id
+     */
+    public Integer getPaperId() {
+        return paperId;
+    }
+
+    /**
+     * 设置组卷id
+     *
+     * @param paperId 组卷id
+     */
+    public void setPaperId(Integer paperId) {
+        this.paperId = paperId;
+    }
+
+    /**
+     * 获取题目id
+     *
+     * @return question_id - 题目id
+     */
+    public Integer getQuestionId() {
+        return questionId;
+    }
+
+    /**
+     * 设置题目id
+     *
+     * @param questionId 题目id
+     */
+    public void setQuestionId(Integer questionId) {
+        this.questionId = questionId;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", paperId=").append(paperId);
+        sb.append(", questionId=").append(questionId);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public static ExercisePaperQuestion.Builder builder() {
+        return new ExercisePaperQuestion.Builder();
+    }
+
+    public static class Builder {
+        private ExercisePaperQuestion obj;
+
+        public Builder() {
+            this.obj = new ExercisePaperQuestion();
+        }
+
+        /**
+         * @param id
+         */
+        public Builder id(Integer id) {
+            obj.setId(id);
+            return this;
+        }
+
+        /**
+         * 设置组卷id
+         *
+         * @param paperId 组卷id
+         */
+        public Builder paperId(Integer paperId) {
+            obj.setPaperId(paperId);
+            return this;
+        }
+
+        /**
+         * 设置题目id
+         *
+         * @param questionId 题目id
+         */
+        public Builder questionId(Integer questionId) {
+            obj.setQuestionId(questionId);
+            return this;
+        }
+
+        public ExercisePaperQuestion build() {
+            return this.obj;
+        }
+    }
+}

+ 35 - 0
server/data/src/main/java/com/qxgmat/data/dao/entity/ExerciseStruct.java

@@ -40,6 +40,12 @@ public class ExerciseStruct implements Serializable {
     @Column(name = "`question_status`")
     private Integer questionStatus;
 
+    /**
+     * 描述
+     */
+    @Column(name = "`description`")
+    private String description;
+
     private static final long serialVersionUID = 1L;
 
     /**
@@ -146,6 +152,24 @@ public class ExerciseStruct implements Serializable {
         this.questionStatus = questionStatus;
     }
 
+    /**
+     * 获取描述
+     *
+     * @return description - 描述
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * 设置描述
+     *
+     * @param description 描述
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -158,6 +182,7 @@ public class ExerciseStruct implements Serializable {
         sb.append(", parentId=").append(parentId);
         sb.append(", order=").append(order);
         sb.append(", questionStatus=").append(questionStatus);
+        sb.append(", description=").append(description);
         sb.append("]");
         return sb.toString();
     }
@@ -231,6 +256,16 @@ public class ExerciseStruct implements Serializable {
             return this;
         }
 
+        /**
+         * 设置描述
+         *
+         * @param description 描述
+         */
+        public Builder description(String description) {
+            obj.setDescription(description);
+            return this;
+        }
+
         public ExerciseStruct build() {
             return this.obj;
         }

+ 7 - 7
server/data/src/main/java/com/qxgmat/data/dao/entity/HomeworkPreview.java

@@ -18,7 +18,7 @@ public class HomeworkPreview implements Serializable {
     private String title;
 
     /**
-     * 科目id:读取struct
+     * 课程id:读取struct第二层
      */
     @Column(name = "`category`")
     private Integer category;
@@ -94,18 +94,18 @@ public class HomeworkPreview implements Serializable {
     }
 
     /**
-     * 获取科目id:读取struct
+     * 获取课程id:读取struct第二层
      *
-     * @return category - 科目id:读取struct
+     * @return category - 课程id:读取struct第二层
      */
     public Integer getCategory() {
         return category;
     }
 
     /**
-     * 设置科目id:读取struct
+     * 设置课程id:读取struct第二层
      *
-     * @param category 科目id:读取struct
+     * @param category 课程id:读取struct第二层
      */
     public void setCategory(Integer category) {
         this.category = category;
@@ -279,9 +279,9 @@ public class HomeworkPreview implements Serializable {
         }
 
         /**
-         * 设置科目id:读取struct
+         * 设置课程id:读取struct第二层
          *
-         * @param category 科目id:读取struct
+         * @param category 课程id:读取struct第二层
          */
         public Builder category(Integer category) {
             obj.setCategory(category);

+ 163 - 40
server/data/src/main/java/com/qxgmat/data/dao/entity/Question.java

@@ -1,5 +1,6 @@
 package com.qxgmat.data.dao.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import java.io.Serializable;
 import java.util.Date;
 import javax.persistence.*;
@@ -12,10 +13,10 @@ public class Question implements Serializable {
     private Integer id;
 
     /**
-     * 模块:examination, exercise,sentence
+     * 关键词,逗号分隔
      */
-    @Column(name = "`module`")
-    private Integer module;
+    @Column(name = "`keyword`")
+    private String[] keyword;
 
     /**
      * 题型
@@ -35,14 +36,20 @@ public class Question implements Serializable {
     @Column(name = "`difficult`")
     private String difficult;
 
+    /**
+     * 系统答案:json
+     */
+    @Column(name = "`answer`")
+    private JSONObject answer;
+
     @Column(name = "`question_time`")
     private Date questionTime;
 
     @Column(name = "`qx_time`")
     private Date qxTime;
 
-    @Column(name = "`offical_time`")
-    private Date officalTime;
+    @Column(name = "`official_time`")
+    private Date officialTime;
 
     @Column(name = "`association_time`")
     private Date associationTime;
@@ -65,11 +72,23 @@ public class Question implements Serializable {
     @Column(name = "`total_correct`")
     private Integer totalCorrect;
 
+    @Column(name = "`create_time`")
+    private Date createTime;
+
+    @Column(name = "`update_time`")
+    private Date updateTime;
+
+    /**
+     * 样式:json
+     */
+    @Column(name = "`style`")
+    private String style;
+
     @Column(name = "`qx_content`")
     private String qxContent;
 
-    @Column(name = "`offical_content`")
-    private String officalContent;
+    @Column(name = "`official_content`")
+    private String officialContent;
 
     @Column(name = "`association_content`")
     private String associationContent;
@@ -91,21 +110,21 @@ public class Question implements Serializable {
     }
 
     /**
-     * 获取模块:examination, exercise,sentence
+     * 获取关键词,逗号分隔
      *
-     * @return module - 模块:examination, exercise,sentence
+     * @return keyword - 关键词,逗号分隔
      */
-    public Integer getModule() {
-        return module;
+    public String[] getKeyword() {
+        return keyword;
     }
 
     /**
-     * 设置模块:examination, exercise,sentence
+     * 设置关键词,逗号分隔
      *
-     * @param module 模块:examination, exercise,sentence
+     * @param keyword 关键词,逗号分隔
      */
-    public void setModule(Integer module) {
-        this.module = module;
+    public void setKeyword(String[] keyword) {
+        this.keyword = keyword;
     }
 
     /**
@@ -163,6 +182,24 @@ public class Question implements Serializable {
     }
 
     /**
+     * 获取系统答案:json
+     *
+     * @return answer - 系统答案:json
+     */
+    public JSONObject getAnswer() {
+        return answer;
+    }
+
+    /**
+     * 设置系统答案:json
+     *
+     * @param answer 系统答案:json
+     */
+    public void setAnswer(JSONObject answer) {
+        this.answer = answer;
+    }
+
+    /**
      * @return question_time
      */
     public Date getQuestionTime() {
@@ -191,17 +228,17 @@ public class Question implements Serializable {
     }
 
     /**
-     * @return offical_time
+     * @return official_time
      */
-    public Date getOfficalTime() {
-        return officalTime;
+    public Date getOfficialTime() {
+        return officialTime;
     }
 
     /**
-     * @param officalTime
+     * @param officialTime
      */
-    public void setOfficalTime(Date officalTime) {
-        this.officalTime = officalTime;
+    public void setOfficialTime(Date officialTime) {
+        this.officialTime = officialTime;
     }
 
     /**
@@ -273,6 +310,52 @@ public class Question implements Serializable {
     }
 
     /**
+     * @return create_time
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * @param createTime
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * @return update_time
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * @param updateTime
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 获取样式:json
+     *
+     * @return style - 样式:json
+     */
+    public String getStyle() {
+        return style;
+    }
+
+    /**
+     * 设置样式:json
+     *
+     * @param style 样式:json
+     */
+    public void setStyle(String style) {
+        this.style = style;
+    }
+
+    /**
      * @return qx_content
      */
     public String getQxContent() {
@@ -287,17 +370,17 @@ public class Question implements Serializable {
     }
 
     /**
-     * @return offical_content
+     * @return official_content
      */
-    public String getOfficalContent() {
-        return officalContent;
+    public String getOfficialContent() {
+        return officialContent;
     }
 
     /**
-     * @param officalContent
+     * @param officialContent
      */
-    public void setOfficalContent(String officalContent) {
-        this.officalContent = officalContent;
+    public void setOfficialContent(String officialContent) {
+        this.officialContent = officialContent;
     }
 
     /**
@@ -321,19 +404,23 @@ public class Question implements Serializable {
         sb.append(" [");
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
-        sb.append(", module=").append(module);
+        sb.append(", keyword=").append(keyword);
         sb.append(", type=").append(type);
         sb.append(", place=").append(place);
         sb.append(", difficult=").append(difficult);
+        sb.append(", answer=").append(answer);
         sb.append(", questionTime=").append(questionTime);
         sb.append(", qxTime=").append(qxTime);
-        sb.append(", officalTime=").append(officalTime);
+        sb.append(", officialTime=").append(officialTime);
         sb.append(", associationTime=").append(associationTime);
         sb.append(", totalTime=").append(totalTime);
         sb.append(", totalNumber=").append(totalNumber);
         sb.append(", totalCorrect=").append(totalCorrect);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", style=").append(style);
         sb.append(", qxContent=").append(qxContent);
-        sb.append(", officalContent=").append(officalContent);
+        sb.append(", officialContent=").append(officialContent);
         sb.append(", associationContent=").append(associationContent);
         sb.append("]");
         return sb.toString();
@@ -359,12 +446,12 @@ public class Question implements Serializable {
         }
 
         /**
-         * 设置模块:examination, exercise,sentence
+         * 设置关键词,逗号分隔
          *
-         * @param module 模块:examination, exercise,sentence
+         * @param keyword 关键词,逗号分隔
          */
-        public Builder module(Integer module) {
-            obj.setModule(module);
+        public Builder keyword(String[] keyword) {
+            obj.setKeyword(keyword);
             return this;
         }
 
@@ -399,6 +486,16 @@ public class Question implements Serializable {
         }
 
         /**
+         * 设置系统答案:json
+         *
+         * @param answer 系统答案:json
+         */
+        public Builder answer(JSONObject answer) {
+            obj.setAnswer(answer);
+            return this;
+        }
+
+        /**
          * @param questionTime
          */
         public Builder questionTime(Date questionTime) {
@@ -415,10 +512,10 @@ public class Question implements Serializable {
         }
 
         /**
-         * @param officalTime
+         * @param officialTime
          */
-        public Builder officalTime(Date officalTime) {
-            obj.setOfficalTime(officalTime);
+        public Builder officialTime(Date officialTime) {
+            obj.setOfficialTime(officialTime);
             return this;
         }
 
@@ -461,6 +558,32 @@ public class Question implements Serializable {
         }
 
         /**
+         * @param createTime
+         */
+        public Builder createTime(Date createTime) {
+            obj.setCreateTime(createTime);
+            return this;
+        }
+
+        /**
+         * @param updateTime
+         */
+        public Builder updateTime(Date updateTime) {
+            obj.setUpdateTime(updateTime);
+            return this;
+        }
+
+        /**
+         * 设置样式:json
+         *
+         * @param style 样式:json
+         */
+        public Builder style(String style) {
+            obj.setStyle(style);
+            return this;
+        }
+
+        /**
          * @param qxContent
          */
         public Builder qxContent(String qxContent) {
@@ -469,10 +592,10 @@ public class Question implements Serializable {
         }
 
         /**
-         * @param officalContent
+         * @param officialContent
          */
-        public Builder officalContent(String officalContent) {
-            obj.setOfficalContent(officalContent);
+        public Builder officialContent(String officialContent) {
+            obj.setOfficialContent(officialContent);
             return this;
         }
 

+ 203 - 0
server/data/src/main/java/com/qxgmat/data/dao/entity/QuestionNo.java

@@ -0,0 +1,203 @@
+package com.qxgmat.data.dao.entity;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+@Table(name = "question_no")
+public class QuestionNo implements Serializable {
+    @Id
+    @Column(name = "`id`")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    /**
+     * 题目id
+     */
+    @Column(name = "`question_id`")
+    private Integer questionId;
+
+    /**
+     * 模块:examination, exercise,sentence
+     */
+    @Column(name = "`module`")
+    private String module;
+
+    /**
+     * 人工id
+     */
+    @Column(name = "`no`")
+    private String no;
+
+    /**
+     * 对应模块结构信息,逗号分隔
+     */
+    @Column(name = "`module_struct`")
+    private String moduleStruct;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取题目id
+     *
+     * @return question_id - 题目id
+     */
+    public Integer getQuestionId() {
+        return questionId;
+    }
+
+    /**
+     * 设置题目id
+     *
+     * @param questionId 题目id
+     */
+    public void setQuestionId(Integer questionId) {
+        this.questionId = questionId;
+    }
+
+    /**
+     * 获取模块:examination, exercise,sentence
+     *
+     * @return module - 模块:examination, exercise,sentence
+     */
+    public String getModule() {
+        return module;
+    }
+
+    /**
+     * 设置模块:examination, exercise,sentence
+     *
+     * @param module 模块:examination, exercise,sentence
+     */
+    public void setModule(String module) {
+        this.module = module;
+    }
+
+    /**
+     * 获取人工id
+     *
+     * @return no - 人工id
+     */
+    public String getNo() {
+        return no;
+    }
+
+    /**
+     * 设置人工id
+     *
+     * @param no 人工id
+     */
+    public void setNo(String no) {
+        this.no = no;
+    }
+
+    /**
+     * 获取对应模块结构信息,逗号分隔
+     *
+     * @return module_struct - 对应模块结构信息,逗号分隔
+     */
+    public String getModuleStruct() {
+        return moduleStruct;
+    }
+
+    /**
+     * 设置对应模块结构信息,逗号分隔
+     *
+     * @param moduleStruct 对应模块结构信息,逗号分隔
+     */
+    public void setModuleStruct(String moduleStruct) {
+        this.moduleStruct = moduleStruct;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", questionId=").append(questionId);
+        sb.append(", module=").append(module);
+        sb.append(", no=").append(no);
+        sb.append(", moduleStruct=").append(moduleStruct);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public static QuestionNo.Builder builder() {
+        return new QuestionNo.Builder();
+    }
+
+    public static class Builder {
+        private QuestionNo obj;
+
+        public Builder() {
+            this.obj = new QuestionNo();
+        }
+
+        /**
+         * @param id
+         */
+        public Builder id(Integer id) {
+            obj.setId(id);
+            return this;
+        }
+
+        /**
+         * 设置题目id
+         *
+         * @param questionId 题目id
+         */
+        public Builder questionId(Integer questionId) {
+            obj.setQuestionId(questionId);
+            return this;
+        }
+
+        /**
+         * 设置模块:examination, exercise,sentence
+         *
+         * @param module 模块:examination, exercise,sentence
+         */
+        public Builder module(String module) {
+            obj.setModule(module);
+            return this;
+        }
+
+        /**
+         * 设置对应模块结构信息,逗号分隔
+         *
+         * @param moduleStruct 对应模块结构信息,逗号分隔
+         */
+        public Builder moduleStruct(String moduleStruct) {
+            obj.setModuleStruct(moduleStruct);
+            return this;
+        }
+
+        /**
+         * 设置人工id
+         *
+         * @param no 人工id
+         */
+        public Builder no(String no) {
+            obj.setNo(no);
+            return this;
+        }
+
+        public QuestionNo build() {
+            return this.obj;
+        }
+    }
+}

+ 35 - 0
server/data/src/main/java/com/qxgmat/data/dao/entity/SentencePaper.java

@@ -10,6 +10,12 @@ public class SentencePaper implements Serializable {
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Integer id;
 
+    /**
+     * 标题
+     */
+    @Column(name = "`title`")
+    private String title;
+
     private static final long serialVersionUID = 1L;
 
     /**
@@ -26,6 +32,24 @@ public class SentencePaper implements Serializable {
         this.id = id;
     }
 
+    /**
+     * 获取标题
+     *
+     * @return title - 标题
+     */
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * 设置标题
+     *
+     * @param title 标题
+     */
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -33,6 +57,7 @@ public class SentencePaper implements Serializable {
         sb.append(" [");
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
+        sb.append(", title=").append(title);
         sb.append("]");
         return sb.toString();
     }
@@ -56,6 +81,16 @@ public class SentencePaper implements Serializable {
             return this;
         }
 
+        /**
+         * 设置标题
+         *
+         * @param title 标题
+         */
+        public Builder title(String title) {
+            obj.setTitle(title);
+            return this;
+        }
+
         public SentencePaper build() {
             return this.obj;
         }

+ 77 - 42
server/data/src/main/java/com/qxgmat/data/dao/entity/SentenceQuestion.java

@@ -17,7 +17,19 @@ public class SentenceQuestion implements Serializable {
     private Integer isTrail;
 
     /**
-     * 千行解析
+     * 组卷id
+     */
+    @Column(name = "`paper_id`")
+    private Integer paperId;
+
+    /**
+     * 序号:手工录入
+     */
+    @Column(name = "`no`")
+    private Integer no;
+
+    /**
+     * 题目id
      */
     @Column(name = "`question_id`")
     private Integer questionId;
@@ -40,12 +52,6 @@ public class SentenceQuestion implements Serializable {
     @Column(name = "`stem`")
     private String stem;
 
-    /**
-     * 回答:json
-     */
-    @Column(name = "`answer`")
-    private String answer;
-
     private static final long serialVersionUID = 1L;
 
     /**
@@ -81,18 +87,54 @@ public class SentenceQuestion implements Serializable {
     }
 
     /**
-     * 获取千行解析
+     * 获取组卷id
+     *
+     * @return paper_id - 组卷id
+     */
+    public Integer getPaperId() {
+        return paperId;
+    }
+
+    /**
+     * 设置组卷id
+     *
+     * @param paperId 组卷id
+     */
+    public void setPaperId(Integer paperId) {
+        this.paperId = paperId;
+    }
+
+    /**
+     * 获取序号:手工录入
+     *
+     * @return no - 序号:手工录入
+     */
+    public Integer getNo() {
+        return no;
+    }
+
+    /**
+     * 设置序号:手工录入
+     *
+     * @param no 序号:手工录入
+     */
+    public void setNo(Integer no) {
+        this.no = no;
+    }
+
+    /**
+     * 获取题目id
      *
-     * @return question_id - 千行解析
+     * @return question_id - 题目id
      */
     public Integer getQuestionId() {
         return questionId;
     }
 
     /**
-     * 设置千行解析
+     * 设置题目id
      *
-     * @param questionId 千行解析
+     * @param questionId 题目id
      */
     public void setQuestionId(Integer questionId) {
         this.questionId = questionId;
@@ -152,24 +194,6 @@ public class SentenceQuestion implements Serializable {
         this.stem = stem;
     }
 
-    /**
-     * 获取回答:json
-     *
-     * @return answer - 回答:json
-     */
-    public String getAnswer() {
-        return answer;
-    }
-
-    /**
-     * 设置回答:json
-     *
-     * @param answer 回答:json
-     */
-    public void setAnswer(String answer) {
-        this.answer = answer;
-    }
-
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -178,11 +202,12 @@ public class SentenceQuestion implements Serializable {
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
         sb.append(", isTrail=").append(isTrail);
+        sb.append(", paperId=").append(paperId);
+        sb.append(", no=").append(no);
         sb.append(", questionId=").append(questionId);
         sb.append(", sentenceId=").append(sentenceId);
         sb.append(", chinese=").append(chinese);
         sb.append(", stem=").append(stem);
-        sb.append(", answer=").append(answer);
         sb.append("]");
         return sb.toString();
     }
@@ -217,9 +242,29 @@ public class SentenceQuestion implements Serializable {
         }
 
         /**
-         * 设置千行解析
+         * 设置组卷id
+         *
+         * @param paperId 组卷id
+         */
+        public Builder paperId(Integer paperId) {
+            obj.setPaperId(paperId);
+            return this;
+        }
+
+        /**
+         * 设置序号:手工录入
+         *
+         * @param no 序号:手工录入
+         */
+        public Builder no(Integer no) {
+            obj.setNo(no);
+            return this;
+        }
+
+        /**
+         * 设置题目id
          *
-         * @param questionId 千行解析
+         * @param questionId 题目id
          */
         public Builder questionId(Integer questionId) {
             obj.setQuestionId(questionId);
@@ -256,16 +301,6 @@ public class SentenceQuestion implements Serializable {
             return this;
         }
 
-        /**
-         * 设置回答:json
-         *
-         * @param answer 回答:json
-         */
-        public Builder answer(String answer) {
-            obj.setAnswer(answer);
-            return this;
-        }
-
         public SentenceQuestion build() {
             return this.obj;
         }

+ 63 - 0
server/data/src/main/java/com/qxgmat/data/dao/entity/TextbookPaper.java

@@ -0,0 +1,63 @@
+package com.qxgmat.data.dao.entity;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+@Table(name = "textbook_paper")
+public class TextbookPaper implements Serializable {
+    @Id
+    @Column(name = "`id`")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public static TextbookPaper.Builder builder() {
+        return new TextbookPaper.Builder();
+    }
+
+    public static class Builder {
+        private TextbookPaper obj;
+
+        public Builder() {
+            this.obj = new TextbookPaper();
+        }
+
+        /**
+         * @param id
+         */
+        public Builder id(Integer id) {
+            obj.setId(id);
+            return this;
+        }
+
+        public TextbookPaper build() {
+            return this.obj;
+        }
+    }
+}

+ 12 - 12
server/data/src/main/java/com/qxgmat/data/dao/entity/User.java

@@ -60,8 +60,8 @@ public class User implements Serializable {
     /**
      * 微信关联id
      */
-    @Column(name = "`wechat_union_id`")
-    private String wechatUnionId;
+    @Column(name = "`wechat_unionid`")
+    private String wechatUnionid;
 
     /**
      * 微信公众号accessToken
@@ -321,19 +321,19 @@ public class User implements Serializable {
     /**
      * 获取微信关联id
      *
-     * @return wechat_union_id - 微信关联id
+     * @return wechat_unionid - 微信关联id
      */
-    public String getWechatUnionId() {
-        return wechatUnionId;
+    public String getWechatUnionid() {
+        return wechatUnionid;
     }
 
     /**
      * 设置微信关联id
      *
-     * @param wechatUnionId 微信关联id
+     * @param wechatUnionid 微信关联id
      */
-    public void setWechatUnionId(String wechatUnionId) {
-        this.wechatUnionId = wechatUnionId;
+    public void setWechatUnionid(String wechatUnionid) {
+        this.wechatUnionid = wechatUnionid;
     }
 
     /**
@@ -653,7 +653,7 @@ public class User implements Serializable {
         sb.append(", mobile=").append(mobile);
         sb.append(", wechatOpenidPc=").append(wechatOpenidPc);
         sb.append(", wechatOpenidWechat=").append(wechatOpenidWechat);
-        sb.append(", wechatUnionId=").append(wechatUnionId);
+        sb.append(", wechatUnionid=").append(wechatUnionid);
         sb.append(", wechatAccessToken=").append(wechatAccessToken);
         sb.append(", wechatRefreshToken=").append(wechatRefreshToken);
         sb.append(", wechatExpireTime=").append(wechatExpireTime);
@@ -775,10 +775,10 @@ public class User implements Serializable {
         /**
          * 设置微信关联id
          *
-         * @param wechatUnionId 微信关联id
+         * @param wechatUnionid 微信关联id
          */
-        public Builder wechatUnionId(String wechatUnionId) {
-            obj.setWechatUnionId(wechatUnionId);
+        public Builder wechatUnionid(String wechatUnionid) {
+            obj.setWechatUnionid(wechatUnionid);
             return this;
         }
 

+ 90 - 10
server/data/src/main/java/com/qxgmat/data/dao/entity/UserMessage.java

@@ -1,6 +1,7 @@
 package com.qxgmat.data.dao.entity;
 
 import java.io.Serializable;
+import java.util.Date;
 import javax.persistence.*;
 
 @Table(name = "user_message")
@@ -16,9 +17,24 @@ public class UserMessage implements Serializable {
     @Column(name = "`user_id`")
     private Integer userId;
 
+    /**
+     * 标题
+     */
     @Column(name = "`title`")
-    private Integer title;
+    private String title;
+
+    /**
+     * 链接
+     */
+    @Column(name = "`link`")
+    private String link;
+
+    @Column(name = "`create_time`")
+    private Date createTime;
 
+    /**
+     * 内容
+     */
     @Column(name = "`content`")
     private String content;
 
@@ -57,28 +73,68 @@ public class UserMessage implements Serializable {
     }
 
     /**
-     * @return title
+     * 获取标题
+     *
+     * @return title - 标题
      */
-    public Integer getTitle() {
+    public String getTitle() {
         return title;
     }
 
     /**
-     * @param title
+     * 设置标题
+     *
+     * @param title 标题
      */
-    public void setTitle(Integer title) {
+    public void setTitle(String title) {
         this.title = title;
     }
 
     /**
-     * @return content
+     * 获取链接
+     *
+     * @return link - 链接
+     */
+    public String getLink() {
+        return link;
+    }
+
+    /**
+     * 设置链接
+     *
+     * @param link 链接
+     */
+    public void setLink(String link) {
+        this.link = link;
+    }
+
+    /**
+     * @return create_time
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * @param createTime
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取内容
+     *
+     * @return content - 内容
      */
     public String getContent() {
         return content;
     }
 
     /**
-     * @param content
+     * 设置内容
+     *
+     * @param content 内容
      */
     public void setContent(String content) {
         this.content = content;
@@ -93,6 +149,8 @@ public class UserMessage implements Serializable {
         sb.append(", id=").append(id);
         sb.append(", userId=").append(userId);
         sb.append(", title=").append(title);
+        sb.append(", link=").append(link);
+        sb.append(", createTime=").append(createTime);
         sb.append(", content=").append(content);
         sb.append("]");
         return sb.toString();
@@ -128,15 +186,37 @@ public class UserMessage implements Serializable {
         }
 
         /**
-         * @param title
+         * 设置标题
+         *
+         * @param title 标题
          */
-        public Builder title(Integer title) {
+        public Builder title(String title) {
             obj.setTitle(title);
             return this;
         }
 
         /**
-         * @param content
+         * 设置链接
+         *
+         * @param link 链接
+         */
+        public Builder link(String link) {
+            obj.setLink(link);
+            return this;
+        }
+
+        /**
+         * @param createTime
+         */
+        public Builder createTime(Date createTime) {
+            obj.setCreateTime(createTime);
+            return this;
+        }
+
+        /**
+         * 设置内容
+         *
+         * @param content 内容
          */
         public Builder content(String content) {
             obj.setContent(content);

+ 44 - 43
server/data/src/main/java/com/qxgmat/data/dao/entity/UserQuestion.java

@@ -1,5 +1,6 @@
 package com.qxgmat.data.dao.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import java.io.Serializable;
 import java.util.Date;
 import javax.persistence.*;
@@ -45,22 +46,22 @@ public class UserQuestion implements Serializable {
     private Date createTime;
 
     /**
-     * 正确:0错误,1正确
-     */
-    @Column(name = "`is_correct`")
-    private Integer isCorrect;
-
-    /**
      * 系统答案:json
      */
     @Column(name = "`answer`")
-    private String answer;
+    private JSONObject answer;
 
     /**
      * 用户答案:json
      */
     @Column(name = "`user_answer`")
-    private String userAnswer;
+    private JSONObject userAnswer;
+
+    /**
+     * 正确:0错误,1正确
+     */
+    @Column(name = "`is_correct`")
+    private Integer isCorrect;
 
     private static final long serialVersionUID = 1L;
 
@@ -183,29 +184,11 @@ public class UserQuestion implements Serializable {
     }
 
     /**
-     * 获取正确:0错误,1正确
-     *
-     * @return is_correct - 正确:0错误,1正确
-     */
-    public Integer getIsCorrect() {
-        return isCorrect;
-    }
-
-    /**
-     * 设置正确:0错误,1正确
-     *
-     * @param isCorrect 正确:0错误,1正确
-     */
-    public void setIsCorrect(Integer isCorrect) {
-        this.isCorrect = isCorrect;
-    }
-
-    /**
      * 获取系统答案:json
      *
      * @return answer - 系统答案:json
      */
-    public String getAnswer() {
+    public JSONObject getAnswer() {
         return answer;
     }
 
@@ -214,7 +197,7 @@ public class UserQuestion implements Serializable {
      *
      * @param answer 系统答案:json
      */
-    public void setAnswer(String answer) {
+    public void setAnswer(JSONObject answer) {
         this.answer = answer;
     }
 
@@ -223,7 +206,7 @@ public class UserQuestion implements Serializable {
      *
      * @return user_answer - 用户答案:json
      */
-    public String getUserAnswer() {
+    public JSONObject getUserAnswer() {
         return userAnswer;
     }
 
@@ -232,10 +215,28 @@ public class UserQuestion implements Serializable {
      *
      * @param userAnswer 用户答案:json
      */
-    public void setUserAnswer(String userAnswer) {
+    public void setUserAnswer(JSONObject userAnswer) {
         this.userAnswer = userAnswer;
     }
 
+    /**
+     * 获取正确:0错误,1正确
+     *
+     * @return is_correct - 正确:0错误,1正确
+     */
+    public Integer getIsCorrect() {
+        return isCorrect;
+    }
+
+    /**
+     * 设置正确:0错误,1正确
+     *
+     * @param isCorrect 正确:0错误,1正确
+     */
+    public void setIsCorrect(Integer isCorrect) {
+        this.isCorrect = isCorrect;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -249,9 +250,9 @@ public class UserQuestion implements Serializable {
         sb.append(", time=").append(time);
         sb.append(", userTime=").append(userTime);
         sb.append(", createTime=").append(createTime);
-        sb.append(", isCorrect=").append(isCorrect);
         sb.append(", answer=").append(answer);
         sb.append(", userAnswer=").append(userAnswer);
+        sb.append(", isCorrect=").append(isCorrect);
         sb.append("]");
         return sb.toString();
     }
@@ -334,21 +335,11 @@ public class UserQuestion implements Serializable {
         }
 
         /**
-         * 设置正确:0错误,1正确
-         *
-         * @param isCorrect 正确:0错误,1正确
-         */
-        public Builder isCorrect(Integer isCorrect) {
-            obj.setIsCorrect(isCorrect);
-            return this;
-        }
-
-        /**
          * 设置系统答案:json
          *
          * @param answer 系统答案:json
          */
-        public Builder answer(String answer) {
+        public Builder answer(JSONObject answer) {
             obj.setAnswer(answer);
             return this;
         }
@@ -358,11 +349,21 @@ public class UserQuestion implements Serializable {
          *
          * @param userAnswer 用户答案:json
          */
-        public Builder userAnswer(String userAnswer) {
+        public Builder userAnswer(JSONObject userAnswer) {
             obj.setUserAnswer(userAnswer);
             return this;
         }
 
+        /**
+         * 设置正确:0错误,1正确
+         *
+         * @param isCorrect 正确:0错误,1正确
+         */
+        public Builder isCorrect(Integer isCorrect) {
+            obj.setIsCorrect(isCorrect);
+            return this;
+        }
+
         public UserQuestion build() {
             return this.obj;
         }

+ 52 - 16
server/data/src/main/java/com/qxgmat/data/dao/entity/UserReport.java

@@ -1,5 +1,6 @@
 package com.qxgmat.data.dao.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import java.io.Serializable;
 import java.util.Date;
 import javax.persistence.*;
@@ -54,6 +55,12 @@ public class UserReport implements Serializable {
     private Integer userTime;
 
     /**
+     * 题目id列表:json
+     */
+    @Column(name = "`question_ids`")
+    private Integer[] questionIds;
+
+    /**
      * 正确题目数
      */
     @Column(name = "`correct_number`")
@@ -66,10 +73,10 @@ public class UserReport implements Serializable {
     private Date finishTime;
 
     /**
-     * 题目id列表:json
+     * 详细信息
      */
-    @Column(name = "`question_ids`")
-    private String questionIds;
+    @Column(name = "`detail`")
+    private JSONObject detail;
 
     private static final long serialVersionUID = 1L;
 
@@ -224,6 +231,24 @@ public class UserReport implements Serializable {
     }
 
     /**
+     * 获取题目id列表:json
+     *
+     * @return question_ids - 题目id列表:json
+     */
+    public Integer[] getQuestionIds() {
+        return questionIds;
+    }
+
+    /**
+     * 设置题目id列表:json
+     *
+     * @param questionIds 题目id列表:json
+     */
+    public void setQuestionIds(Integer[] questionIds) {
+        this.questionIds = questionIds;
+    }
+
+    /**
      * 获取正确题目数
      *
      * @return correct_number - 正确题目数
@@ -260,21 +285,21 @@ public class UserReport implements Serializable {
     }
 
     /**
-     * 获取题目id列表:json
+     * 获取详细信息
      *
-     * @return question_ids - 题目id列表:json
+     * @return detail - 详细信息
      */
-    public String getQuestionIds() {
-        return questionIds;
+    public JSONObject getDetail() {
+        return detail;
     }
 
     /**
-     * 设置题目id列表:json
+     * 设置详细信息
      *
-     * @param questionIds 题目id列表:json
+     * @param detail 详细信息
      */
-    public void setQuestionIds(String questionIds) {
-        this.questionIds = questionIds;
+    public void setDetail(JSONObject detail) {
+        this.detail = detail;
     }
 
     @Override
@@ -292,9 +317,10 @@ public class UserReport implements Serializable {
         sb.append(", totalTime=").append(totalTime);
         sb.append(", userNumber=").append(userNumber);
         sb.append(", userTime=").append(userTime);
+        sb.append(", questionIds=").append(questionIds);
         sb.append(", correctNumber=").append(correctNumber);
         sb.append(", finishTime=").append(finishTime);
-        sb.append(", questionIds=").append(questionIds);
+        sb.append(", detail=").append(detail);
         sb.append("]");
         return sb.toString();
     }
@@ -395,6 +421,16 @@ public class UserReport implements Serializable {
         }
 
         /**
+         * 设置题目id列表:json
+         *
+         * @param questionIds 题目id列表:json
+         */
+        public Builder questionIds(Integer[] questionIds) {
+            obj.setQuestionIds(questionIds);
+            return this;
+        }
+
+        /**
          * 设置正确题目数
          *
          * @param correctNumber 正确题目数
@@ -415,12 +451,12 @@ public class UserReport implements Serializable {
         }
 
         /**
-         * 设置题目id列表:json
+         * 设置详细信息
          *
-         * @param questionIds 题目id列表:json
+         * @param detail 详细信息
          */
-        public Builder questionIds(String questionIds) {
-            obj.setQuestionIds(questionIds);
+        public Builder detail(JSONObject detail) {
+            obj.setDetail(detail);
             return this;
         }
 

+ 10 - 0
server/data/src/main/java/com/qxgmat/data/dao/mapping/ExaminationPaperMapper.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qxgmat.data.dao.ExaminationPaperMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.ExaminationPaper">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+  </resultMap>
+</mapper>

+ 18 - 0
server/data/src/main/java/com/qxgmat/data/dao/mapping/ExaminationPaperQuestionMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qxgmat.data.dao.ExaminationPaperQuestionMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.ExaminationPaperQuestion">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="paper_id" jdbcType="INTEGER" property="paperId" />
+    <result column="question_id" jdbcType="INTEGER" property="questionId" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    `id`, `paper_id`, `question_id`
+  </sql>
+</mapper>

+ 12 - 0
server/data/src/main/java/com/qxgmat/data/dao/mapping/ExaminationStructMapper.xml

@@ -11,10 +11,22 @@
     <result column="parent_id" jdbcType="INTEGER" property="parentId" />
     <result column="order" jdbcType="INTEGER" property="order" />
   </resultMap>
+  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.qxgmat.data.dao.entity.ExaminationStruct">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <result column="description" jdbcType="LONGVARCHAR" property="description" />
+  </resultMap>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
     `id`, `name_zh`, `name_en`, `parent_id`, `order`
   </sql>
+  <sql id="Blob_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    `description`
+  </sql>
 </mapper>

+ 25 - 0
server/data/src/main/java/com/qxgmat/data/dao/mapping/ExercisePaperMapper.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qxgmat.data.dao.ExercisePaperMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.ExercisePaper">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="type" jdbcType="VARCHAR" property="type" />
+    <result column="logic" jdbcType="VARCHAR" property="logic" />
+    <result column="logic_extend" jdbcType="VARCHAR" property="logicExtend" />
+    <result column="struct_id" jdbcType="INTEGER" property="structId" />
+    <result column="struct_parent" jdbcType="VARCHAR" property="structParent" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler" />
+    <result column="title" jdbcType="VARCHAR" property="title" />
+    <result column="question_number" jdbcType="INTEGER" property="questionNumber" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    `id`, `type`, `logic`, `logic_extend`, `struct_id`, `struct_parent`, `title`, `question_number`, 
+    `status`
+  </sql>
+</mapper>

+ 18 - 0
server/data/src/main/java/com/qxgmat/data/dao/mapping/ExercisePaperQuestionMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qxgmat.data.dao.ExercisePaperQuestionMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.ExercisePaperQuestion">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="paper_id" jdbcType="INTEGER" property="paperId" />
+    <result column="question_id" jdbcType="INTEGER" property="questionId" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    `id`, `paper_id`, `question_id`
+  </sql>
+</mapper>

+ 12 - 0
server/data/src/main/java/com/qxgmat/data/dao/mapping/ExerciseStructMapper.xml

@@ -12,10 +12,22 @@
     <result column="order" jdbcType="INTEGER" property="order" />
     <result column="question_status" jdbcType="INTEGER" property="questionStatus" />
   </resultMap>
+  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.qxgmat.data.dao.entity.ExerciseStruct">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <result column="description" jdbcType="LONGVARCHAR" property="description" />
+  </resultMap>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
     `id`, `name_zh`, `name_en`, `parent_id`, `order`, `question_status`
   </sql>
+  <sql id="Blob_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    `description`
+  </sql>
 </mapper>

+ 2 - 2
server/data/src/main/java/com/qxgmat/data/dao/mapping/HomeworkPreviewMapper.xml

@@ -8,8 +8,8 @@
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="title" jdbcType="VARCHAR" property="title" />
     <result column="category" jdbcType="INTEGER" property="category" />
-    <result column="question_ids" jdbcType="VARCHAR" property="questionIds" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler" />
-    <result column="user_ids" jdbcType="VARCHAR" property="userIds" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler" />
+    <result column="question_ids" jdbcType="VARCHAR" property="questionIds" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayWithJsonHandler" />
+    <result column="user_ids" jdbcType="VARCHAR" property="userIds" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayWithJsonHandler" />
     <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
     <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
     <result column="finish" jdbcType="INTEGER" property="finish" />

+ 1 - 1
server/data/src/main/java/com/qxgmat/data/dao/mapping/ManagerRoleMapper.xml

@@ -7,7 +7,7 @@
     -->
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="title" jdbcType="VARCHAR" property="title" />
-    <result column="permission_list" jdbcType="VARCHAR" property="permissionList" typeHandler="com.nuliji.tools.mybatis.handler.StringArrayHandler" />
+    <result column="permission_list" jdbcType="VARCHAR" property="permissionList" typeHandler="com.nuliji.tools.mybatis.handler.StringArrayWithJsonHandler" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
     <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
   </resultMap>

+ 11 - 6
server/data/src/main/java/com/qxgmat/data/dao/mapping/QuestionMapper.xml

@@ -6,37 +6,42 @@
       WARNING - @mbg.generated
     -->
     <id column="id" jdbcType="INTEGER" property="id" />
-    <result column="module" jdbcType="INTEGER" property="module" />
+    <result column="keyword" jdbcType="VARCHAR" property="keyword" typeHandler="com.nuliji.tools.mybatis.handler.StringArrayHandler" />
     <result column="type" jdbcType="VARCHAR" property="type" />
     <result column="place" jdbcType="VARCHAR" property="place" />
     <result column="difficult" jdbcType="VARCHAR" property="difficult" />
+    <result column="answer" jdbcType="VARCHAR" property="answer" typeHandler="com.nuliji.tools.mybatis.handler.JsonObjectHandler" />
     <result column="question_time" jdbcType="TIMESTAMP" property="questionTime" />
     <result column="qx_time" jdbcType="TIMESTAMP" property="qxTime" />
-    <result column="offical_time" jdbcType="TIMESTAMP" property="officalTime" />
+    <result column="official_time" jdbcType="TIMESTAMP" property="officialTime" />
     <result column="association_time" jdbcType="TIMESTAMP" property="associationTime" />
     <result column="total_time" jdbcType="INTEGER" property="totalTime" />
     <result column="total_number" jdbcType="INTEGER" property="totalNumber" />
     <result column="total_correct" jdbcType="INTEGER" property="totalCorrect" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.qxgmat.data.dao.entity.Question">
     <!--
       WARNING - @mbg.generated
     -->
+    <result column="style" jdbcType="LONGVARCHAR" property="style" />
     <result column="qx_content" jdbcType="LONGVARCHAR" property="qxContent" />
-    <result column="offical_content" jdbcType="LONGVARCHAR" property="officalContent" />
+    <result column="official_content" jdbcType="LONGVARCHAR" property="officialContent" />
     <result column="association_content" jdbcType="LONGVARCHAR" property="associationContent" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
-    `id`, `module`, `type`, `place`, `difficult`, `question_time`, `qx_time`, `offical_time`, 
-    `association_time`, `total_time`, `total_number`, `total_correct`
+    `id`, `keyword`, `type`, `place`, `difficult`, `answer`, `question_time`, `qx_time`, 
+    `official_time`, `association_time`, `total_time`, `total_number`, `total_correct`, 
+    `create_time`, `update_time`
   </sql>
   <sql id="Blob_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
-    `qx_content`, `offical_content`, `association_content`
+    `style`, `qx_content`, `official_content`, `association_content`
   </sql>
 </mapper>

+ 20 - 0
server/data/src/main/java/com/qxgmat/data/dao/mapping/QuestionNoMapper.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qxgmat.data.dao.QuestionNoMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.QuestionNo">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="question_id" jdbcType="INTEGER" property="questionId" />
+    <result column="module" jdbcType="VARCHAR" property="module" />
+    <result column="no" jdbcType="VARCHAR" property="no" />
+    <result column="module_struct" jdbcType="VARCHAR" property="moduleStruct" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    `id`, `question_id`, `module`, `no`, `module_struct`
+  </sql>
+</mapper>

+ 7 - 0
server/data/src/main/java/com/qxgmat/data/dao/mapping/SentencePaperMapper.xml

@@ -6,5 +6,12 @@
       WARNING - @mbg.generated
     -->
     <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="title" jdbcType="VARCHAR" property="title" />
   </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    `id`, `title`
+  </sql>
 </mapper>

+ 4 - 3
server/data/src/main/java/com/qxgmat/data/dao/mapping/SentenceQuestionMapper.xml

@@ -7,6 +7,8 @@
     -->
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="is_trail" jdbcType="INTEGER" property="isTrail" />
+    <result column="paper_id" jdbcType="INTEGER" property="paperId" />
+    <result column="no" jdbcType="INTEGER" property="no" />
     <result column="question_id" jdbcType="INTEGER" property="questionId" />
     <result column="sentence_id" jdbcType="INTEGER" property="sentenceId" />
   </resultMap>
@@ -16,18 +18,17 @@
     -->
     <result column="chinese" jdbcType="LONGVARCHAR" property="chinese" />
     <result column="stem" jdbcType="LONGVARCHAR" property="stem" />
-    <result column="answer" jdbcType="LONGVARCHAR" property="answer" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
-    `id`, `is_trail`, `question_id`, `sentence_id`
+    `id`, `is_trail`, `paper_id`, `no`, `question_id`, `sentence_id`
   </sql>
   <sql id="Blob_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
-    `chinese`, `stem`, `answer`
+    `chinese`, `stem`
   </sql>
 </mapper>

+ 10 - 0
server/data/src/main/java/com/qxgmat/data/dao/mapping/TextbookPaperMapper.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qxgmat.data.dao.TextbookPaperMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.TextbookPaper">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+  </resultMap>
+</mapper>

+ 2 - 2
server/data/src/main/java/com/qxgmat/data/dao/mapping/UserMapper.xml

@@ -14,7 +14,7 @@
     <result column="mobile" jdbcType="VARCHAR" property="mobile" />
     <result column="wechat_openid_pc" jdbcType="VARCHAR" property="wechatOpenidPc" />
     <result column="wechat_openid_wechat" jdbcType="VARCHAR" property="wechatOpenidWechat" />
-    <result column="wechat_union_id" jdbcType="VARCHAR" property="wechatUnionId" />
+    <result column="wechat_unionid" jdbcType="VARCHAR" property="wechatUnionid" />
     <result column="wechat_access_token" jdbcType="VARCHAR" property="wechatAccessToken" />
     <result column="wechat_refresh_token" jdbcType="VARCHAR" property="wechatRefreshToken" />
     <result column="wechat_expire_time" jdbcType="TIMESTAMP" property="wechatExpireTime" />
@@ -38,7 +38,7 @@
       WARNING - @mbg.generated
     -->
     `id`, `nickname`, `avatar`, `password`, `email`, `area`, `mobile`, `wechat_openid_pc`, 
-    `wechat_openid_wechat`, `wechat_union_id`, `wechat_access_token`, `wechat_refresh_token`, 
+    `wechat_openid_wechat`, `wechat_unionid`, `wechat_access_token`, `wechat_refresh_token`, 
     `wechat_expire_time`, `real_name`, `real_address`, `real_identity`, `real_photo`, 
     `real_status`, `prepare_status`, `prepare_goal`, `prepare_examination_time`, `prepare_score_time`, 
     `last_exercise`, `origin_id`, `invite_code`, `total_money`, `create_time`

+ 4 - 2
server/data/src/main/java/com/qxgmat/data/dao/mapping/UserMessageMapper.xml

@@ -7,7 +7,9 @@
     -->
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="user_id" jdbcType="INTEGER" property="userId" />
-    <result column="title" jdbcType="INTEGER" property="title" />
+    <result column="title" jdbcType="VARCHAR" property="title" />
+    <result column="link" jdbcType="VARCHAR" property="link" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.qxgmat.data.dao.entity.UserMessage">
     <!--
@@ -19,7 +21,7 @@
     <!--
       WARNING - @mbg.generated
     -->
-    `id`, `user_id`, `title`
+    `id`, `user_id`, `title`, `link`, `create_time`
   </sql>
   <sql id="Blob_Column_List">
     <!--

+ 1 - 1
server/data/src/main/java/com/qxgmat/data/dao/mapping/UserPaperMapper.xml

@@ -10,7 +10,7 @@
     <result column="title" jdbcType="VARCHAR" property="title" />
     <result column="module" jdbcType="VARCHAR" property="module" />
     <result column="module_id" jdbcType="INTEGER" property="moduleId" />
-    <result column="question_ids" jdbcType="VARCHAR" property="questionIds" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler" />
+    <result column="question_ids" jdbcType="VARCHAR" property="questionIds" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayWithJsonHandler" />
     <result column="number" jdbcType="INTEGER" property="number" />
     <result column="time" jdbcType="INTEGER" property="time" />
   </resultMap>

+ 3 - 14
server/data/src/main/java/com/qxgmat/data/dao/mapping/UserQuestionMapper.xml

@@ -12,26 +12,15 @@
     <result column="time" jdbcType="INTEGER" property="time" />
     <result column="user_time" jdbcType="INTEGER" property="userTime" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="answer" jdbcType="VARCHAR" property="answer" typeHandler="com.nuliji.tools.mybatis.handler.JsonObjectHandler" />
+    <result column="user_answer" jdbcType="VARCHAR" property="userAnswer" typeHandler="com.nuliji.tools.mybatis.handler.JsonObjectHandler" />
     <result column="is_correct" jdbcType="INTEGER" property="isCorrect" />
   </resultMap>
-  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.qxgmat.data.dao.entity.UserQuestion">
-    <!--
-      WARNING - @mbg.generated
-    -->
-    <result column="answer" jdbcType="LONGVARCHAR" property="answer" />
-    <result column="user_answer" jdbcType="LONGVARCHAR" property="userAnswer" />
-  </resultMap>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
     `id`, `user_id`, `report_id`, `question_id`, `time`, `user_time`, `create_time`, 
-    `is_correct`
-  </sql>
-  <sql id="Blob_Column_List">
-    <!--
-      WARNING - @mbg.generated
-    -->
-    `answer`, `user_answer`
+    `answer`, `user_answer`, `is_correct`
   </sql>
 </mapper>

+ 3 - 13
server/data/src/main/java/com/qxgmat/data/dao/mapping/UserReportMapper.xml

@@ -14,26 +14,16 @@
     <result column="total_time" jdbcType="INTEGER" property="totalTime" />
     <result column="user_number" jdbcType="INTEGER" property="userNumber" />
     <result column="user_time" jdbcType="INTEGER" property="userTime" />
+    <result column="question_ids" jdbcType="VARCHAR" property="questionIds" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayWithJsonHandler" />
     <result column="correct_number" jdbcType="INTEGER" property="correctNumber" />
     <result column="finish_time" jdbcType="TIMESTAMP" property="finishTime" />
-  </resultMap>
-  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.qxgmat.data.dao.entity.UserReport">
-    <!--
-      WARNING - @mbg.generated
-    -->
-    <result column="question_ids" jdbcType="LONGVARCHAR" property="questionIds" />
+    <result column="detail" jdbcType="VARCHAR" property="detail" typeHandler="com.nuliji.tools.mybatis.handler.JsonObjectHandler" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
     `id`, `user_id`, `module`, `module_id`, `create_time`, `total_number`, `total_time`, 
-    `user_number`, `user_time`, `correct_number`, `finish_time`
-  </sql>
-  <sql id="Blob_Column_List">
-    <!--
-      WARNING - @mbg.generated
-    -->
-    `question_ids`
+    `user_number`, `user_time`, `question_ids`, `correct_number`, `finish_time`, `detail`
   </sql>
 </mapper>

+ 16 - 2
server/data/src/main/java/com/qxgmat/data/relation/QuestionRelationMapper.java

@@ -1,6 +1,6 @@
 package com.qxgmat.data.relation;
 
-import com.qxgmat.data.dao.entity.UserReport;
+import com.qxgmat.data.dao.entity.Question;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -9,5 +9,19 @@ import java.util.List;
  * Created by gaojie on 2017/11/9.
  */
 public interface QuestionRelationMapper {
-    List<UserReport> homeworkPreviewAdmin(@Param("category") Number category, @Param("userId") Number userId, @Param("previewId") Number previewId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    List<Question> listExerciseAdmin(
+            @Param("structId") Number structId,
+            @Param("questionNo") Number questionNo,
+            @Param("paperId") Number paperId,
+            @Param("place") String place,
+            @Param("difficult") String difficult,
+            @Param("startTime") String startTime,
+            @Param("endTime") String endTime,
+            @Param("order") String order,
+            @Param("direction") String direction
+    );
+
+    List<Question> listExaminationAdmin(
+
+    );
 }

+ 18 - 2
server/data/src/main/java/com/qxgmat/data/relation/UserAskRelationMapper.java

@@ -9,7 +9,23 @@ import java.util.List;
  * Created by gaojie on 2017/11/9.
  */
 public interface UserAskRelationMapper {
-    List<UserAsk> listWithUser(@Param("category") Number category, @Param("userId") Number userId, @Param("questionId") Number questionId, @Param("target") String target, @Param("status") Integer status, @Param("showStatus") Integer showStatus, @Param("min") Integer min, @Param("max") Integer max, String order, String direction);
+    List<UserAsk> listWithUser(
+            @Param("category") Number category,
+            @Param("userId") Number userId,
+            @Param("questionId") Number questionId,
+            @Param("target") String target,
+            @Param("status") Integer status,
+            @Param("showStatus") Integer showStatus,
+            @Param("min") Integer min,
+            @Param("max") Integer max,
+            String order,
+            String direction
+    );
 
-    void adjust(@Param("questionId") Number questionId, @Param("order") Integer order, @Param("direction") String direction, @Param("flag") String flag);
+    void adjust(
+            @Param("questionId") Number questionId,
+            @Param("order") Integer order,
+            @Param("direction") String direction,
+            @Param("flag") String flag
+    );
 }

+ 7 - 1
server/data/src/main/java/com/qxgmat/data/relation/UserPaperRelationMapper.java

@@ -11,5 +11,11 @@ import java.util.List;
  * Created by gaojie on 2017/11/9.
  */
 public interface UserPaperRelationMapper {
-    List<UserPaper> homeworkPreview(@Param("category") Number category, @Param("userId") Number userId, @Param("previewId") Number previewId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    List<UserPaper> listHomeworkPreview(
+            @Param("category") Number category,
+            @Param("userId") Number userId,
+            @Param("previewId") Number previewId,
+            @Param("startTime") String startTime,
+            @Param("endTime") String endTime
+    );
 }

+ 7 - 1
server/data/src/main/java/com/qxgmat/data/relation/UserReportRelationMapper.java

@@ -9,5 +9,11 @@ import java.util.List;
  * Created by gaojie on 2017/11/9.
  */
 public interface UserReportRelationMapper {
-    List<UserReport> homeworkPreviewAdmin(@Param("category") Number category, @Param("userId") Number userId, @Param("previewId") Number previewId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    List<UserReport> listHomeworkPreviewAdmin(
+            @Param("category") Number category,
+            @Param("userId") Number userId,
+            @Param("previewId") Number previewId,
+            @Param("startTime") String startTime,
+            @Param("endTime") String endTime
+    );
 }

+ 35 - 40
server/data/src/main/java/com/qxgmat/data/relation/mapping/QuestionRelationMapper.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.qxgmat.relation.UserPaperRelationMapper">
-  <resultMap id="BaseResultMap" type="com.qxgmat.dao.entity.UserAsk">
+<mapper namespace="com.qxgmat.data.relation.QuestionRelationMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.Question">
     <!--
       WARNING - @mbg.generated
     -->
@@ -11,47 +11,42 @@
     <!--
       WARNING - @mbg.generated
     -->
-    ua.`id`
+    q.`id`
   </sql>
 
-  <!--修改问答排序-->
-  <update id="adjust">
-    UPDATE `user_ask`
-    <trim prefix="set" suffixOverrides=",">
-      `order`#{flag}1
-    </trim>
-    WHERE `question_id` = #{questionId,jdbcType=VARCHAR} and `order` #{direction} #{order,jdbcType=INT}
-  </update>
-
-  <!--用户预习作业列表-->
-  <select id="listWithUser" resultMap="BaseResultMap">
+  <!--练习题目列表列表-->
+  <select id="listExerciseAdmin" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
-    from `user_aks` ua
-    left join `user` u on u.`id` = ua.`user_id`
-      <if test="userId != null">
-        and ua.`user_id` = #{userId,jdbcType=VARCHAR}
-      </if>
-      <if test="max != null">
-        and u.`total_money` &lt; ${max}
-      </if>
-      <if test="min != null">
-        and u.`total_money` &gt; ${min}
-      </if>
-    where
-    u.`id` != null
-    <if test="questionId != null">
-      and ua.`question_id` = #{questionId,jdbcType=VARCHAR}
-    </if>
-    <if test="target != null">
-      and ua.`target` = #{target,jdbcType=VARCHAR}
-    </if>
-    <if test="status != null">
-      and ua.`status` = #{status,jdbcType=INT}
-    </if>
-    <if test="showStatus != null">
-      and ua.`show_status` = #{showStatus,jdbcType=INT}
-    </if>
-    order by ua.${order} ${direction}
+    from `question_no` qn
+    left join `question` q on q.`id` = qn.`question_id`
+    <if test="paperId != null">
+    left join `exercise_paper_question` epq on q.`id` = epg.`question_id`
+    left join `exercise_paper` ep on ep.`id` = epg.`paper_id`
+        and ep.`id` = #{paperId,jdbcType=VARCHAR}
+    </if>
+    where q.`module` = "exercise"
+    <if test="paperId != null">
+      and ep.`id` != null
+    </if>
+    <if test="structId != null">
+      and find_in_set(#{structId,jdbcType=VARCHAR}, q.`module_struct`)
+    </if>
+    <if test="questionNo != null">
+      and qn.`id` =#{questionNo,jdbcType=VARCHAR}
+    </if>
+    <if test="place != null">
+      and q.`place` =#{place,jdbcType=VARCHAR}
+    </if>
+    <if test="difficult != null">
+      and q.`difficult` =#{difficult,jdbcType=VARCHAR}
+    </if>
+    <if test="startTime != null">
+      and hp.`update_time` &gt; #{startTime,jdbcType=VARCHAR}
+    </if>
+    <if test="endTime != null">
+      and hp.`update_time` &lt; #{endTime,jdbcType=VARCHAR}
+    </if>
+    order by q.${order} ${direction}
   </select>
 </mapper>

+ 3 - 3
server/data/src/main/java/com/qxgmat/data/relation/mapping/UserAskRelationMapper.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.qxgmat.relation.UserPaperRelationMapper">
-  <resultMap id="BaseResultMap" type="com.qxgmat.dao.entity.UserAsk">
+<mapper namespace="com.qxgmat.data.relation.UserAskRelationMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.UserAsk">
     <!--
       WARNING - @mbg.generated
     -->
@@ -23,7 +23,7 @@
     WHERE `question_id` = #{questionId,jdbcType=VARCHAR} and `order` #{direction} #{order,jdbcType=INT}
   </update>
 
-  <!--用户预习作业列表-->
+  <!--用户提问列表-->
   <select id="listWithUser" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />

+ 5 - 5
server/data/src/main/java/com/qxgmat/data/relation/mapping/UserPaperRelationMapper.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.qxgmat.relation.UserPaperRelationMapper">
-  <resultMap id="BaseResultMap" type="com.qxgmat.dao.entity.UserPaper">
+<mapper namespace="com.qxgmat.data.relation.UserPaperRelationMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.UserPaper">
     <!--
       WARNING - @mbg.generated
     -->
@@ -15,7 +15,7 @@
   </sql>
 
   <!--用户预习作业列表-->
-  <select id="homeworkPreview" resultMap="BaseResultMap">
+  <select id="listHomeworkPreview" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
     from `user_paper` up
@@ -28,10 +28,10 @@
         and hp.`module_id` = #{previewId,jdbcType=VARCHAR}
       </if>
       <if test="startTime != null">
-        and hp.`startTime` &gt; #{startTime,jdbcType=VARCHAR}
+        and hp.`start_time` &gt; #{startTime,jdbcType=VARCHAR}
       </if>
       <if test="endTime != null">
-        and hp.`endTime` &lt; #{endTime,jdbcType=VARCHAR}
+        and hp.`end_time` &lt; #{endTime,jdbcType=VARCHAR}
       </if>
     where
     hp.`id` != null

+ 3 - 3
server/data/src/main/java/com/qxgmat/data/relation/mapping/UserReportRelationMapper.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.qxgmat.relation.UserPaperRelationMapper">
-  <resultMap id="BaseResultMap" type="com.qxgmat.dao.entity.UserReport">
+<mapper namespace="com.qxgmat.data.relation.UserReportRelationMapper">
+  <resultMap id="BaseResultMap" type="com.qxgmat.data.dao.entity.UserReport">
     <!--
       WARNING - @mbg.generated
     -->
@@ -18,7 +18,7 @@
     后台查询:用户完成度最高的最后一次
     https://blog.csdn.net/t_1007/article/details/52369261
   -->
-  <select id="homeworkPreviewAdmin" resultMap="BaseResultMap">
+  <select id="listHomeworkPreviewAdmin" resultMap="BaseResultMap">
     select
       SUBSTRING_INDEX(GROUP_CONCAT(ur.`id` ORDER BY ur.`user_number` desc, ur.`create_time` desc),',',1)
     from `user_report` ur

+ 35 - 4
server/data/src/main/resources/mybatis-generator.xml

@@ -96,20 +96,51 @@
         </table>
         <table schema="qianxing" tableName="manager_role" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
             <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
-            <columnOverride column="permission_list" javaType="String[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.StringArrayHandler"/>
+            <columnOverride column="permission_list" javaType="String[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.StringArrayWithJsonHandler"/>
         </table>
         <table schema="qianxing" tableName="homework_preview" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
             <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
-            <columnOverride column="question_ids" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler"/>
-            <columnOverride column="user_ids" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler"/>
+            <columnOverride column="question_ids" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayWithJsonHandler"/>
+            <columnOverride column="user_ids" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayWithJsonHandler"/>
         </table>
         <table schema="qianxing" tableName="user_paper" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
             <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
-            <columnOverride column="question_ids" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler"/>
+            <columnOverride column="question_ids" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayWithJsonHandler"/>
         </table>
         <table schema="qianxing" tableName="setting" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
             <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
             <columnOverride column="value" javaType="com.alibaba.fastjson.JSONObject" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.JsonObjectHandler"/>
         </table>
+        <table schema="qianxing" tableName="question" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
+            <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
+            <columnOverride column="keyword" javaType="String[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.StringArrayHandler"/>
+            <columnOverride column="answer" javaType="com.alibaba.fastjson.JSONObject" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.JsonObjectHandler"/>
+        </table>
+        <table schema="qianxing" tableName="question_id" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
+            <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
+            <columnOverride column="module_struct" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler"/>
+        </table>
+        <table schema="qianxing" tableName="user_question" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
+            <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
+            <columnOverride column="user_answer" javaType="com.alibaba.fastjson.JSONObject" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.JsonObjectHandler"/>
+            <columnOverride column="answer" javaType="com.alibaba.fastjson.JSONObject" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.JsonObjectHandler"/>
+        </table>
+        <table schema="qianxing" tableName="exercise_paper" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
+            <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
+            <columnOverride column="struct_parent" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler"/>
+        </table>
+        <table schema="qianxing" tableName="exercise_paper" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
+            <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
+            <columnOverride column="struct_parent" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayHandler"/>
+        </table>
+        <table schema="qianxing" tableName="user_paper" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
+            <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
+            <columnOverride column="question_ids" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayWithJsonHandler"/>
+        </table>
+        <table schema="qianxing" tableName="user_report" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" delimitAllColumns="true">
+            <generatedKey column="id" sqlStatement="Mysql" identity="true"/>
+            <columnOverride column="detail" javaType="com.alibaba.fastjson.JSONObject" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.JsonObjectHandler"/>
+            <columnOverride column="question_ids" javaType="Integer[]" jdbcType="VARCHAR" typeHandler="com.nuliji.tools.mybatis.handler.IntegerArrayWithJsonHandler"/>
+        </table>
     </context>
 </generatorConfiguration>

+ 2 - 2
server/gateway-api/src/main/java/com/qxgmat/controller/admin/ClassController.java

@@ -3,8 +3,8 @@ package com.qxgmat.controller.admin;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-@RestController("AdminServiceController")
-@RequestMapping("/admin/service")
+@RestController("AdminClassController")
+@RequestMapping("/admin/class")
 public class ClassController {
 
 

+ 3 - 2
server/gateway-api/src/main/java/com/qxgmat/controller/admin/CommonController.java

@@ -15,6 +15,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.UUID;
 
 @RestController("AdminCommonController")
 @RequestMapping("/admin/common")
@@ -37,7 +38,7 @@ public class CommonController {
             throw new ParameterException("文件类型错误");
         }
         // todo 随机文件名
-        String file = "";
+        String file = UUID.randomUUID().toString();
         try {
             File dest = new File(localPath + File.separator+file);
             multipartFile.transferTo(dest);
@@ -58,7 +59,7 @@ public class CommonController {
             throw new ParameterException("文件类型错误");
         }
         // todo 随机文件名
-        String file = "";
+        String file = UUID.randomUUID().toString();
         try {
             File dest = new File(localPath + File.separator+file);
             multipartFile.transferTo(dest);

+ 59 - 0
server/gateway-api/src/main/java/com/qxgmat/controller/admin/ExaminationController.java

@@ -1,4 +1,63 @@
 package com.qxgmat.controller.admin;
 
+
+import com.nuliji.tools.Response;
+import com.nuliji.tools.ResponseHelp;
+import com.nuliji.tools.Transform;
+import com.qxgmat.data.dao.entity.ExaminationStruct;
+import com.qxgmat.dto.admin.request.ExaminationStructDto;
+import com.qxgmat.service.inline.ExaminationStructService;
+import com.qxgmat.service.inline.ManagerLogService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.List;
+
+@RestController("AdminExaminationController")
+@RequestMapping("/admin/examination")
+@Api(tags = "模考接口", description = "模考相关", produces = MediaType.APPLICATION_JSON_VALUE)
 public class ExaminationController {
+    @Autowired
+    private ManagerLogService managerLogService;
+    @Autowired
+    private ExaminationStructService examinationStructService;
+
+    @RequestMapping(value = "/struct/add", method = RequestMethod.POST)
+    @ApiOperation(value = "添加模考层级", httpMethod = "POST")
+    public Response<ExaminationStruct> add(@RequestBody @Validated ExaminationStructDto dto, HttpServletRequest request) {
+        ExaminationStruct entity = Transform.dtoToEntity(dto);
+        entity = examinationStructService.edit(entity);
+        managerLogService.log(request);
+        return ResponseHelp.success(entity);
+    }
+    @RequestMapping(value = "/struct/edit", method = RequestMethod.PUT)
+    @ApiOperation(value = "编辑模考层级", httpMethod = "PUT")
+    public Response<Boolean> edit(@RequestBody @Validated ExaminationStructDto dto, HttpServletRequest request) {
+        ExaminationStruct entity = Transform.dtoToEntity(dto);
+        entity = examinationStructService.edit(entity);
+        managerLogService.log(request);
+        return ResponseHelp.success(true);
+    }
+
+    @RequestMapping(value = "/struct/delete", method = RequestMethod.DELETE)
+    @ApiOperation(value = "删除模考层级", httpMethod = "DELETE")
+    public Response<Boolean> delete(@RequestParam int id, HttpServletRequest request) {
+        managerLogService.log(request);
+        return ResponseHelp.success(examinationStructService.delete(id));
+    }
+
+    @RequestMapping(value = "/struct/all", method = RequestMethod.GET)
+    @ApiOperation(value = "所有模考层级", httpMethod = "GET")
+    public Response<List<ExaminationStruct>> all(HttpSession session) {
+        List<ExaminationStruct> p = examinationStructService.all();
+        return ResponseHelp.success(p);
+    }
+
+
 }

+ 113 - 7
server/gateway-api/src/main/java/com/qxgmat/controller/admin/ExerciseController.java

@@ -1,18 +1,124 @@
 package com.qxgmat.controller.admin;
 
 
-import com.qxgmat.service.inline.ExaminationStructService;
+import com.github.pagehelper.Page;
+import com.nuliji.tools.PageMessage;
+import com.nuliji.tools.Response;
+import com.nuliji.tools.ResponseHelp;
+import com.nuliji.tools.Transform;
+import com.qxgmat.data.constants.enums.module.QuestionModule;
+import com.qxgmat.data.constants.enums.status.DirectionStatus;
+import com.qxgmat.data.dao.entity.ExercisePaper;
+import com.qxgmat.data.dao.entity.ExerciseStruct;
+import com.qxgmat.data.dao.entity.Question;
+import com.qxgmat.dto.admin.request.ExerciseStructDto;
+import com.qxgmat.dto.admin.request.QuestionDto;
+import com.qxgmat.dto.admin.response.ExercisePaperListDto;
+import com.qxgmat.dto.admin.response.ExerciseQuestionListDto;
+import com.qxgmat.service.ExercisePaperService;
+import com.qxgmat.service.inline.ExercisePaperQuestionService;
+import com.qxgmat.service.inline.ExerciseStructService;
+import com.qxgmat.service.inline.ManagerLogService;
+import com.qxgmat.service.inline.QuestionService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 
-@RestController("AdminExaminationController")
-@RequestMapping("/admin/examination")
-@Api(tags = "模考接口", description = "模考相关", produces = MediaType.APPLICATION_JSON_VALUE)
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.Collection;
+import java.util.List;
+
+@RestController("AdminExerciseController")
+@RequestMapping("/admin/exercise")
+@Api(tags = "练习接口", description = "练习相关", produces = MediaType.APPLICATION_JSON_VALUE)
 public class ExerciseController {
     @Autowired
-    private ExaminationStructService examinationStructService;
+    private ManagerLogService managerLogService;
+
+    @Autowired
+    private ExerciseStructService exerciseStructService;
+
+    @Autowired
+    private ExercisePaperService exercisePaperService;
+
+    @Autowired
+    private ExercisePaperQuestionService exercisePaperQuestionService;
+
+    @Autowired
+    private QuestionService questionService;
+
+    @RequestMapping(value = "/struct/add", method = RequestMethod.POST)
+    @ApiOperation(value = "添加练习层级", httpMethod = "POST")
+    public Response<ExerciseStruct> add(@RequestBody @Validated ExerciseStructDto dto, HttpServletRequest request) {
+        ExerciseStruct entity = Transform.dtoToEntity(dto);
+        entity = exerciseStructService.edit(entity);
+        managerLogService.log(request);
+        return ResponseHelp.success(entity);
+    }
+    @RequestMapping(value = "/struct/edit", method = RequestMethod.PUT)
+    @ApiOperation(value = "编辑练习层级", httpMethod = "PUT")
+    public Response<Boolean> edit(@RequestBody @Validated ExerciseStructDto dto, HttpServletRequest request) {
+        ExerciseStruct entity = Transform.dtoToEntity(dto);
+        entity = exerciseStructService.edit(entity);
+        managerLogService.log(request);
+        return ResponseHelp.success(true);
+    }
+
+    @RequestMapping(value = "/struct/delete", method = RequestMethod.DELETE)
+    @ApiOperation(value = "删除练习层级", httpMethod = "DELETE")
+    public Response<Boolean> delete(@RequestParam int id, HttpServletRequest request) {
+        managerLogService.log(request);
+        return ResponseHelp.success(exerciseStructService.delete(id));
+    }
+
+
+    @RequestMapping(value = "/struct/all", method = RequestMethod.GET)
+    @ApiOperation(value = "所有练习层级", httpMethod = "GET")
+    public Response<List<ExerciseStruct>> all(HttpSession session) {
+        List<ExerciseStruct> p = exerciseStructService.all();
+        return ResponseHelp.success(p);
+    }
+
+
+    @RequestMapping(value = "/paper/list", method = RequestMethod.GET)
+    @ApiOperation(value = "练习册列表", httpMethod = "GET")
+    public Response<PageMessage<ExercisePaperListDto>> listPaper(
+            @RequestParam(required = false, defaultValue = "1") int page,
+            @RequestParam(required = false, defaultValue = "100") int size,
+            HttpSession session) {
+        Page<ExercisePaper> p = exercisePaperService.select(page, size);
+        List<ExercisePaperListDto> pr = Transform.convert(p, ExercisePaperListDto.class);
+
+        return ResponseHelp.success(pr, page, size, p.getTotal());
+    }
+
+    @RequestMapping(value = "/question/list", method = RequestMethod.GET)
+    @ApiOperation(value = "练习册试题列表", httpMethod = "GET")
+    public Response<PageMessage<ExerciseQuestionListDto>> listQuestion(
+            @RequestParam(required = false, defaultValue = "1") int page,
+            @RequestParam(required = false, defaultValue = "100") int size,
+            @RequestParam(required = false, name = "struct_id") Integer structId,
+            @RequestParam(required = false, name = "question_no_id") Integer questionNoId,
+            @RequestParam(required = false, name="paper_id") Integer paperId,
+            @RequestParam(required = false, name="place") String place,
+            @RequestParam(required = false, name="difficult") String difficult,
+            @RequestParam(required = false, name="start_time") String startTime,
+            @RequestParam(required = false, name="end_time") String endTime,
+            @RequestParam(required = false, defaultValue = "id") String order,
+            @RequestParam(required = false, defaultValue = "desc") String direction,
+            HttpSession session) {
+        Page<Question> p = questionService.listExerciseAdmin(page, size, structId, questionNoId, paperId, place, difficult, startTime, endTime, order, DirectionStatus.ValueOf(direction));
+        List<ExerciseQuestionListDto> pr = Transform.convert(p, ExerciseQuestionListDto.class);
+
+        // 绑定练习册
+//        Collection previewIds = Transform.getIds(p, Question.class, "moduleId");
+//        List<HomeworkPreview> homeworkPreviewList = homeworkPreviewService.select(previewIds);
+//        Transform.combine(pr, homeworkPreviewList, UserHomeworkPreviewListDto.class, "moduleId", "preview", HomeworkPreview.class, "id", HomeworkPreviewExtendDto.class);
 
+        return ResponseHelp.success(pr, page, size, p.getTotal());
+    }
 }

+ 2 - 2
server/gateway-api/src/main/java/com/qxgmat/controller/admin/ManagerController.java

@@ -74,7 +74,7 @@ public class ManagerController {
     public Response<PageMessage<ManagerRelation>> list(
             @RequestParam(required = false, defaultValue = "1") int page,
             @RequestParam(required = false, defaultValue = "100") int size,
-            @RequestParam(required = false, defaultValue = "") String order,
+            @RequestParam(required = false, defaultValue = "id") String order,
             @RequestParam(required = false, defaultValue = "desc") String direction,
             HttpSession session) {
         Page<Manager> p = managerService.select(page, size, order, DirectionStatus.ValueOf(direction));
@@ -123,7 +123,7 @@ public class ManagerController {
     public Response<PageMessage<ManagerRole>> listRole(
             @RequestParam(required = false, defaultValue = "1") int page,
             @RequestParam(required = false, defaultValue = "100") int size,
-            @RequestParam(required = false, defaultValue = "") String order,
+            @RequestParam(required = false, defaultValue = "id") String order,
             @RequestParam(required = false, defaultValue = "desc") String direction,
             HttpSession session) {
         Page<ManagerRole> p = managerRoleService.select(page, size, order, DirectionStatus.ValueOf(direction));

+ 4 - 2
server/gateway-api/src/main/java/com/qxgmat/controller/admin/PreviewController.java

@@ -40,6 +40,7 @@ public class PreviewController {
         managerLogService.log(request);
         return ResponseHelp.success(entity);
     }
+
     @RequestMapping(value = "/edit", method = RequestMethod.PUT)
     @ApiOperation(value = "编辑预习作业", httpMethod = "PUT")
     public Response<Boolean> edit(@RequestBody @Validated HomeworkPreviewDto dto, HttpServletRequest request) {
@@ -62,13 +63,14 @@ public class PreviewController {
         HomeworkPreview entity = homeworkPreviewService.selectOne(id);
         return ResponseHelp.success(entity);
     }
+
     @RequestMapping(value = "/list", method = RequestMethod.GET)
     @ApiOperation(value = "预习作业列表", httpMethod = "GET")
     public Response<PageMessage<HomeworkPreviewListDto>> list(
             @RequestParam(required = false, defaultValue = "1") int page,
             @RequestParam(required = false, defaultValue = "100") int size,
-            @RequestParam(required = false, defaultValue = "0") int category,
-            @RequestParam(required = false, defaultValue = "0") int status,
+            @RequestParam(required = false) Integer category,
+            @RequestParam(required = false) Integer status,
             HttpSession session) {
         Page<HomeworkPreview> p = homeworkPreviewService.select(page, size, category, HomeworkPreviewStatus.ValueOf(status));
         List<HomeworkPreviewListDto> pr = Transform.convert(p, HomeworkPreviewListDto.class);

+ 51 - 0
server/gateway-api/src/main/java/com/qxgmat/controller/admin/QuestionController.java

@@ -1,4 +1,55 @@
 package com.qxgmat.controller.admin;
 
+
+import com.nuliji.tools.Response;
+import com.nuliji.tools.ResponseHelp;
+import com.nuliji.tools.Transform;
+import com.qxgmat.data.dao.entity.Question;
+import com.qxgmat.dto.admin.request.QuestionDto;
+import com.qxgmat.service.ExercisePaperService;
+import com.qxgmat.service.inline.ManagerLogService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+@RestController("AdminQuestionController")
+@RequestMapping("/admin/question")
+@Api(tags = "题目接口", description = "题目相关", produces = MediaType.APPLICATION_JSON_VALUE)
 public class QuestionController {
+
+    @Autowired
+    private ManagerLogService managerLogService;
+
+    @Autowired
+    private ExercisePaperService exercisePaperService;
+
+    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @ApiOperation(value = "添加题目", httpMethod = "POST")
+    public Response<Question> add(@RequestBody @Validated QuestionDto dto, HttpServletRequest request) {
+        Question entity = Transform.dtoToEntity(dto);
+        // 添加
+//        entity.setModule(QuestionModule.EXERCISE.key);
+        entity = exercisePaperService.addQuestion(entity);
+        managerLogService.log(request);
+        return ResponseHelp.success(entity);
+    }
+
+    @RequestMapping(value = "/edit", method = RequestMethod.PUT)
+    @ApiOperation(value = "修改题目", httpMethod = "PUT")
+    public Response<Boolean> edit(@RequestBody @Validated QuestionDto dto, HttpServletRequest request) {
+        Question entity = Transform.dtoToEntity(dto);
+        // 添加
+//        entity.setModule(QuestionModule.EXERCISE.key);
+//        entity = exercisePaperService.editQuestion(entity);
+        managerLogService.log(request);
+        return ResponseHelp.success(true);
+    }
 }

+ 10 - 7
server/gateway-api/src/main/java/com/qxgmat/controller/admin/SentenceController.java

@@ -10,10 +10,11 @@ import com.qxgmat.data.dao.entity.SentenceArticle;
 import com.qxgmat.data.dao.entity.SentenceQuestion;
 import com.qxgmat.data.relation.entity.SentenceQuestionRelation;
 import com.qxgmat.dto.admin.request.ManagerDto;
+import com.qxgmat.service.SentencePaperService;
 import com.qxgmat.service.inline.ManagerLogService;
 import com.qxgmat.service.inline.QuestionService;
 import com.qxgmat.service.inline.SentenceArticleService;
-import com.qxgmat.service.SentenceQuestionService;
+import com.qxgmat.service.inline.SentenceQuestionService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -30,11 +31,13 @@ public class SentenceController {
 
     @Autowired
     private ManagerLogService managerLogService;
-
     @Autowired
     private SentenceQuestionService sentenceQuestionService;
 
     @Autowired
+    private SentencePaperService sentencePaperService;
+
+    @Autowired
     private SentenceArticleService sentenceArticleService;
 
     @Autowired
@@ -87,7 +90,7 @@ public class SentenceController {
     @ApiOperation(value = "添加长难句题目", httpMethod = "POST")
     public Response<SentenceQuestion> addQuestion(@RequestBody @Validated SentenceQuestionRelation dto, HttpServletRequest request) {
 //        SentenceQuestion entity = Transform.dtoToEntity(dto);
-        SentenceQuestion entity = sentenceQuestionService.addQuestion(dto);
+        SentenceQuestion entity = sentencePaperService.addQuestion(dto);
         managerLogService.log(request);
         return ResponseHelp.success(entity);
     }
@@ -95,7 +98,7 @@ public class SentenceController {
     @ApiOperation(value = "修改长难句题目", httpMethod = "PUT")
     public Response<Boolean> editQuestion(@RequestBody @Validated SentenceQuestionRelation dto, HttpServletRequest request) {
 //        SentenceQuestion entity = Transform.dtoToEntity(dto);
-        SentenceQuestion entity = sentenceQuestionService.editQuestion(dto);
+        SentenceQuestion entity = sentencePaperService.editQuestion(dto);
         managerLogService.log(request);
         return ResponseHelp.success(true);
     }
@@ -116,12 +119,12 @@ public class SentenceController {
         return ResponseHelp.success(relation);
     }
     @RequestMapping(value = "/question/list", method = RequestMethod.GET)
-    @ApiOperation(value = "难句题目列表", httpMethod = "GET")
+    @ApiOperation(value = "难句题目列表", httpMethod = "GET")
     public Response<PageMessage<SentenceQuestionRelation>> listQuestion(
             @RequestParam(required = false, defaultValue = "1") int page,
             @RequestParam(required = false, defaultValue = "100") int size,
-            @RequestParam(required = false, defaultValue = "") int chapter,
-            @RequestParam(required = false, defaultValue = "desc") int part,
+            @RequestParam(required = false, defaultValue = "0") int chapter,
+            @RequestParam(required = false, defaultValue = "0") int part,
             HttpSession session) {
         Page<SentenceQuestion> p = sentenceQuestionService.select(page, size, chapter, part);
         List<SentenceQuestionRelation> pr = Transform.convert(p, SentenceQuestionRelation.class);

+ 7 - 0
server/gateway-api/src/main/java/com/qxgmat/controller/admin/ServiceController.java

@@ -1,4 +1,11 @@
 package com.qxgmat.controller.admin;
 
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController("AdminServiceController")
+@RequestMapping("/admin/service")
 public class ServiceController {
+
+
 }

+ 10 - 10
server/gateway-api/src/main/java/com/qxgmat/controller/admin/UserAskController.java

@@ -35,8 +35,8 @@ import javax.servlet.http.HttpSession;
 import java.util.Collection;
 import java.util.List;
 
-@RestController("AdminAskController")
-@RequestMapping("/admin/ask")
+@RestController("AdminUserAskController")
+@RequestMapping("/admin/user_ask")
 @Api(tags = "用户提问接口", description = "用户提问相关", produces = MediaType.APPLICATION_JSON_VALUE)
 public class UserAskController {
     @Autowired
@@ -73,14 +73,14 @@ public class UserAskController {
     public Response<PageMessage<UserAskListDto>> list(
             @RequestParam(required = false, defaultValue = "1") int page,
             @RequestParam(required = false, defaultValue = "100") int size,
-            @RequestParam(required = false, defaultValue = "0") int category,
-            @RequestParam(required = false, defaultValue = "0", name = "user_id") int userId,
-            @RequestParam(required = false, defaultValue = "0", name = "question_id") int questionId,
-            @RequestParam(required = false, defaultValue = "", name="target") String target,
-            @RequestParam(required = false, defaultValue = "", name="status") Integer status,
-            @RequestParam(required = false, defaultValue = "", name="show_status") Integer showStatus,
-            @RequestParam(required = false, defaultValue = "", name="money_rang") Integer moneyRang,
-            @RequestParam(required = false, defaultValue = "") String order,
+            @RequestParam(required = false) int category,
+            @RequestParam(required = false, name = "user_id") int userId,
+            @RequestParam(required = false, name = "question_id") int questionId,
+            @RequestParam(required = false, name="target") String target,
+            @RequestParam(required = false, name="status") Integer status,
+            @RequestParam(required = false, name="show_status") Integer showStatus,
+            @RequestParam(required = false, name="money_rang") Integer moneyRang,
+            @RequestParam(required = false, defaultValue = "id") String order,
             @RequestParam(required = false, defaultValue = "desc") String direction,
             HttpSession session) {
         Page<UserAsk> p = userAskService.listWithUser(page, size, category, userId, questionId, AskTarget.ValueOf(target), status, showStatus, MoneyRange.ValueOf(moneyRang), order, DirectionStatus.ValueOf(direction));

+ 4 - 3
server/gateway-api/src/main/java/com/qxgmat/controller/admin/UserController.java

@@ -45,7 +45,7 @@ public class UserController {
 
 //    @RequestMapping(value = "/add", method = RequestMethod.POST)
 //    @ApiOperation(value = "添加用户信息", httpMethod = "POST")
-//    public Response<UserClassDto> add(@RequestBody @Validated UserDto dto, HttpServletRequest request) {
+//    public Response<User> add(@RequestBody @Validated UserDto dto, HttpServletRequest request) {
 //        User entity = Transform.dtoToEntity(dto);
 //        entity = userService.edit(entity);
 //        managerLogService.log(request);
@@ -71,6 +71,7 @@ public class UserController {
     @ApiOperation(value = "获取用户", httpMethod = "GET")
     public Response<User> detail(@RequestParam int id, HttpSession session) {
         User entity = usersService.selectOne(id);
+
         return ResponseHelp.success(Transform.convert(entity, User.class));
     }
     @RequestMapping(value = "/list", method = RequestMethod.GET)
@@ -89,11 +90,11 @@ public class UserController {
 
         Collection userIds = Transform.getIds(p, User.class, "id");
         // 绑定用户服务
-        Map<Object, Collection<UserService>> serviceByUser = userServiceService.getByUser(userIds);
+        Map<Object, Collection<UserService>> serviceByUser = userServiceService.mapByUser(userIds);
         Transform.combine(pr, serviceByUser, UserListDto.class, "id", "services", UserServiceExtendDto.class);
 
         // 绑定用户课程
-        Map<Object, Collection<UserClass>> classByUser = userClassService.getByUser(userIds);
+        Map<Object, Collection<UserClass>> classByUser = userClassService.mapByUser(userIds);
         Transform.combine(pr, classByUser, UserListDto.class, "id", "classes", UserClassExtendDto.class);
 
         return ResponseHelp.success(pr, page, size, p.getTotal());

+ 7 - 7
server/gateway-api/src/main/java/com/qxgmat/controller/admin/UserPreviewController.java

@@ -27,8 +27,8 @@ import javax.servlet.http.HttpSession;
 import java.util.Collection;
 import java.util.List;
 
-@RestController("AdminPreviewController")
-@RequestMapping("/admin/preview")
+@RestController("AdminUserPreviewController")
+@RequestMapping("/admin/user_preview")
 @Api(tags = "用户预习作业接口", description = "用户预习作业", produces = MediaType.APPLICATION_JSON_VALUE)
 public class UserPreviewController {
     @Autowired
@@ -51,12 +51,12 @@ public class UserPreviewController {
             @RequestParam(required = false, defaultValue = "1") int page,
             @RequestParam(required = false, defaultValue = "100") int size,
             @RequestParam(required = false, defaultValue = "0") int category,
-            @RequestParam(required = false, defaultValue = "0", name = "user_id") int userId,
-            @RequestParam(required = false, defaultValue = "0", name = "preview_id") int previewId,
-            @RequestParam(required = false, defaultValue = "", name="start_time") String startTime,
-            @RequestParam(required = false, defaultValue = "", name="end_time") String endTime,
+            @RequestParam(required = false, name = "user_id") Integer userId,
+            @RequestParam(required = false, name = "preview_id") Integer previewId,
+            @RequestParam(required = false, name="start_time") String startTime,
+            @RequestParam(required = false, name="end_time") String endTime,
             HttpSession session) {
-        Page<UserReport> p = userReportService.homeworkPreviewAdmin(page, size, category, userId, previewId, startTime, endTime);
+        Page<UserReport> p = userReportService.listHomeworkPreviewAdmin(page, size, category, userId, previewId, startTime, endTime);
         List<UserHomeworkPreviewListDto> pr = Transform.convert(p, UserHomeworkPreviewListDto.class);
 
         // 绑定用户

+ 24 - 32
server/gateway-api/src/main/java/com/qxgmat/controller/api/AuthController.java

@@ -52,15 +52,11 @@ public class AuthController {
         if (!smsHelp.verifyCode(userLoginDto.getMobile(), userLoginDto.getMobileVerifyCode(), session)) {
             throw new ParameterException("手机验证码错误!");
         }
-        User oldUser = usersService.getByMobile(userLoginDto.getMobile());
-        if(oldUser == null){
-            // 先注册,并且绑定邀请者
-            User user = Transform.convert(userLoginDto, User.class);
-            user = usersService.add(user);
-            if(user == null)
-                throw new SystemException("注册失败");
+        try {
+            User user = usersService.register(userLoginDto.getMobile(), userLoginDto.getInviteCode(), null);
+        }catch (ParameterException e){
+            // 忽略已注册信息
         }
-
         shiroHelp.getSession().login(shiroHelp.user(userLoginDto.getMobile(), ""));
         return ResponseHelp.success(Transform.convert(shiroHelp.getLoginUser(), MyDto.class));
     }
@@ -84,27 +80,21 @@ public class AuthController {
         if(openUser.getMobile().length() > 0)
             throw new SystemException("手机号已绑定");
 
-        User user = usersService.getByMobile(userValidMobileDto.getMobile());
-        boolean result = false;
-        if(user == null){
-            // 否则创建新的账号,设定手机号,绑定第三方登录
-            user = new User();
-            user.setWechatOpenidPc(openUser.getWechatOpenidPc());
-            user.setMobile(userValidMobileDto.getMobile());
-            user.setNickname(openUser.getNickname());
-            user = usersService.add(user);
-            result = user != null;
-        }else{
-            // 如果手机号已被使用,绑定第三方登录到该账号
-            throw new ParameterException("手机验证码错误!");
+        try{
+            // 创建新的账号,设定手机号,绑定第三方登录
+            User user = usersService.register(userValidMobileDto.getMobile(), userValidMobileDto.getInviteCode(), openUser);
+        }catch (ParameterException e){
+            throw new ParameterException("该手机号已注册,请通过手机号进行登录!");
         }
-        return ResponseHelp.success(result);
+        return ResponseHelp.success(true);
     }
 
-    @RequestMapping(value = "/valid/invite_code", method = RequestMethod.POST)
-    @ApiOperation(value = "验证邀请码", notes="查询邀请码对应账号", httpMethod = "POST")
-    public Response<String> ValidInviteCode(@RequestBody @Validated UserValidInviteCodeDto userValidInviteCodeDto){
-        User user = usersService.getByInviteCode(userValidInviteCodeDto.getInviteCode());
+    @RequestMapping(value = "/valid/invite_code", method = RequestMethod.GET)
+    @ApiOperation(value = "验证邀请码", notes="查询邀请码对应账号", httpMethod = "GET")
+    public Response<String> validInviteCode(
+            @RequestParam(required = true) String inviteCode
+    ){
+        User user = usersService.getByInviteCode(inviteCode);
         if(user == null){
             return ResponseHelp.success(null);
         }else{
@@ -112,14 +102,16 @@ public class AuthController {
         }
     }
 
-    @RequestMapping(value = "/valid/mobile", method = RequestMethod.POST)
-    @ApiOperation(value = "验证手机号", notes="查询邀请码对应账号", httpMethod = "POST")
-    public Response<String> ValidMobile(@RequestBody @Validated UserValidInviteCodeDto userValidInviteCodeDto){
-        User user = usersService.getByInviteCode(userValidInviteCodeDto.getInviteCode());
+    @RequestMapping(value = "/valid/mobile", method = RequestMethod.GET)
+    @ApiOperation(value = "验证手机号", notes="查询手机对应账号", httpMethod = "GET")
+    public Response<Boolean> validMobile(
+            @RequestParam(required = true) String mobile
+    ){
+        User user = usersService.getByMobile(mobile);
         if(user == null){
-            return ResponseHelp.success(null);
+            return ResponseHelp.success(false);
         }else{
-            return ResponseHelp.success(user.getNickname());
+            return ResponseHelp.success(true);
         }
     }
 }

+ 32 - 0
server/gateway-api/src/main/java/com/qxgmat/controller/api/CommonController.java

@@ -1,5 +1,7 @@
 package com.qxgmat.controller.api;
 
+import com.nuliji.tools.ResponseHelp;
+import com.nuliji.tools.exception.SystemException;
 import com.qxgmat.dto.request.SmsSendDto;
 import com.qxgmat.dto.response.UploadInfoDto;
 import com.qxgmat.help.CaptchaHelp;
@@ -13,14 +15,17 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.hibernate.validator.constraints.NotBlank;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import java.awt.image.BufferedImage;
+import java.io.File;
 import java.io.IOException;
 
 /**
@@ -32,6 +37,12 @@ import java.io.IOException;
 @Api(tags = "通用", description = "通用接口")
 public class CommonController {
 
+    @Value("${upload.local_path}")
+    private String localPath;
+
+    @Value("${upload.web_url}")
+    private String webUrl;
+
     @Autowired
     private SmsHelp smsHelp;
 
@@ -104,4 +115,25 @@ public class CommonController {
 //        return MessageHelp.success(uploadInfoDto);
 //    }
 
+    @RequestMapping(value = "/upload/image", produces = MediaType.IMAGE_JPEG_VALUE, method = RequestMethod.POST)
+    @ApiOperation(value = "上传文件", notes = "上传至本地服务器", httpMethod = "POST")
+    public Response<String> uploadImage(@RequestParam("file") MultipartFile multipartFile)  {
+        if (multipartFile.isEmpty()) {
+            throw new ParameterException("上传文件为空");
+        }
+        String contentType = multipartFile.getContentType();
+        if (!contentType.contains("")) {
+            throw new ParameterException("文件类型错误");
+        }
+        // todo 随机文件名
+        String file = "";
+        try {
+            File dest = new File(localPath + File.separator+file);
+            multipartFile.transferTo(dest);
+            return ResponseHelp.success(webUrl+file);
+        } catch (IOException e) {
+            e.printStackTrace();
+            return ResponseHelp.exception(new SystemException("图片上传失败"));
+        }
+    }
 }

+ 76 - 85
server/gateway-api/src/main/java/com/qxgmat/controller/api/MyController.java

@@ -1,49 +1,51 @@
 package com.qxgmat.controller.api;
 
+import com.github.pagehelper.Page;
+import com.nuliji.tools.PageMessage;
 import com.nuliji.tools.Response;
 import com.nuliji.tools.ResponseHelp;
-import com.nuliji.tools.Transform;
 import com.nuliji.tools.exception.ParameterException;
 import com.nuliji.tools.exception.SystemException;
 import com.qxgmat.data.dao.entity.User;
-import com.qxgmat.dto.request.UserLoginDto;
-import com.qxgmat.dto.request.UserValidInviteCodeDto;
-import com.qxgmat.dto.request.UserValidMobileDto;
-import com.qxgmat.dto.response.MyDto;
-import com.qxgmat.help.CaptchaHelp;
+import com.qxgmat.data.dao.entity.UserMessage;
+import com.qxgmat.dto.request.UserEmailDto;
+import com.qxgmat.dto.request.UserInfoDto;
+import com.qxgmat.dto.response.UserRealDto;
 import com.qxgmat.help.ShiroHelp;
-import com.qxgmat.help.SmsHelp;
 import com.qxgmat.service.UsersService;
+import com.qxgmat.service.inline.UserMessageService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 import javax.validation.Validator;
+import java.io.File;
+import java.io.IOException;
+import java.util.UUID;
 
 /**
  * Created by GaoJie on 2017/10/31.
  */
 @RestController
 @RequestMapping("/api/auth")
-@Api(tags = "用户验证", description = "登录注册找回密码", produces = MediaType.APPLICATION_JSON_VALUE)
+@Api(tags = "登录用户接口", description = "获取与操作当前用户信息", produces = MediaType.APPLICATION_JSON_VALUE)
 public class MyController {
 
-    @Autowired
-    private Validator validator;
+    @Value("${upload.local_path}")
+    private String localPath;
 
-    @Autowired
-    private CaptchaHelp captchaHelp;
+    @Value("${upload.web_url}")
+    private String webUrl;
 
     @Autowired
-    private SmsHelp smsHelp;
+    private Validator validator;
 
     @Autowired
     private ShiroHelp shiroHelp;
@@ -51,85 +53,74 @@ public class MyController {
     @Autowired
     private UsersService usersService;
 
-    @RequestMapping(value = "/login", method = RequestMethod.POST)
-    @ApiOperation(value = "登录/注册", httpMethod = "POST")
-    public Response<MyDto> login(@RequestBody @Validated UserLoginDto userLoginDto, HttpSession session, HttpServletRequest request) {
-        if (!smsHelp.verifyCode(userLoginDto.getMobile(), userLoginDto.getMobileVerifyCode(), session)) {
-            throw new ParameterException("手机验证码错误!");
-        }
-        User oldUser = usersService.getByMobile(userLoginDto.getMobile());
-        if(oldUser == null){
-            // 先注册,并且绑定邀请者
-            User user = Transform.convert(userLoginDto, User.class);
-            if (userLoginDto.getInviteCode() != null && !userLoginDto.getInviteCode().isEmpty()){
-                User origin = usersService.getByInviteCode(userLoginDto.getInviteCode());
-                user.setOriginId(origin.getId());
-                // todo 按逻辑进行奖励
-            }
-            user = usersService.add(user);
-            if(user == null)
-                throw new SystemException("注册失败");
-        }
+    @Autowired
+    private UserMessageService userMessageService;
 
-        shiroHelp.getSession().login(shiroHelp.user(userLoginDto.getMobile(), ""));
-        return ResponseHelp.success(Transform.convert(shiroHelp.getLoginUser(), MyDto.class));
+    @RequestMapping(value = "/email", method = RequestMethod.POST)
+    @ApiOperation(value = "绑定邮箱", httpMethod = "POST")
+    public Response<Boolean> email(@RequestBody @Validated UserEmailDto dto, HttpSession session, HttpServletRequest request) {
+        User user = (User) shiroHelp.getLoginUser();
+        usersService.edit(User.builder()
+                .id(user.getId())
+                .email(dto.getEmail())
+                .build());
+        return ResponseHelp.success(true);
     }
 
-    @RequestMapping(value = "/logout", method = RequestMethod.POST)
-    @ApiOperation(value = "登出", httpMethod = "POST")
-    public Response<Boolean> logout(HttpSession session, HttpServletRequest request) {
-        shiroHelp.logout();
+    @RequestMapping(value = "/info", method = RequestMethod.POST)
+    @ApiOperation(value = "修改用户信息", httpMethod = "POST")
+    public Response<Boolean> info(@RequestBody @Validated UserInfoDto dto){
+        User user = (User) shiroHelp.getLoginUser();
+        usersService.edit(User.builder()
+                .id(user.getId())
+                .nickname(dto.getNickname())
+                .avatar(dto.getAvatar())
+                .build());
         return ResponseHelp.success(true);
     }
 
-    @RequestMapping(value = "/bind", method = RequestMethod.POST)
-    @ApiOperation(value = "绑定手机号", notes="第三方登录后可执行", httpMethod = "POST")
-    public Response<Boolean> bind(@RequestBody @Validated UserValidMobileDto userValidMobileDto, HttpSession session) {
-        if (!smsHelp.verifyCode(userValidMobileDto.getMobile(), userValidMobileDto.getMobileVerifyCode(), session)) {
-            throw new ParameterException("手机验证码错误!");
+    @RequestMapping(value = "/real", produces = MediaType.IMAGE_JPEG_VALUE, method = RequestMethod.POST)
+    @ApiOperation(value = "实名认证", notes = "保存用户实名信息", httpMethod = "POST")
+    public Response<UserRealDto> real(@RequestParam("file") MultipartFile multipartFile)  {
+        if (multipartFile.isEmpty()) {
+            throw new ParameterException("上传文件为空");
         }
-        User openUser = (User) shiroHelp.getLoginUser();
-        if(openUser == null)
-            throw new SystemException("第三方登录错误");
-        if(openUser.getMobile().length() > 0)
-            throw new SystemException("手机号已绑定");
-
-        User user = usersService.getByMobile(userValidMobileDto.getMobile());
-        boolean result = false;
-        if(user == null){
-            // 否则创建新的账号,设定手机号,绑定第三方登录
-            user = new User();
-            user.setWechatOpenidPc(openUser.getWechatOpenidPc());
-            user.setMobile(userValidMobileDto.getMobile());
-            user.setNickname(openUser.getNickname());
-            user = usersService.add(user);
-            result = user != null;
-        }else{
-            // 如果手机号已被使用,绑定第三方登录到该账号
-            throw new ParameterException("该手机号已注册,请通过手机号进行登录!");
+        String contentType = multipartFile.getContentType();
+        if (!contentType.contains("")) {
+            throw new ParameterException("文件类型错误");
         }
-        return ResponseHelp.success(result);
-    }
+        User user = (User) shiroHelp.getLoginUser();
+        UserRealDto dto = new UserRealDto();
 
-    @RequestMapping(value = "/valid/invite_code", method = RequestMethod.POST)
-    @ApiOperation(value = "验证邀请码", notes="查询邀请码对应账号", httpMethod = "POST")
-    public Response<String> ValidInviteCode(@RequestBody @Validated UserValidInviteCodeDto userValidInviteCodeDto){
-        User user = usersService.getByInviteCode(userValidInviteCodeDto.getInviteCode());
-        if(user == null){
-            return ResponseHelp.success(null);
-        }else{
-            return ResponseHelp.success(user.getNickname());
+        // todo 随机文件名
+        String file = UUID.randomUUID().toString();
+        try {
+            File dest = new File(localPath + File.separator+file);
+            multipartFile.transferTo(dest);
+            dto.setPhoto(webUrl+file);
+            usersService.edit(User.builder()
+                    .id(user.getId())
+                    .realAddress(dto.getAddress())
+                    .realName(dto.getName())
+                    .realIdentity(dto.getIdentity())
+                    .realPhoto(dto.getPhoto())
+                    .build());
+            return ResponseHelp.success(dto);
+        } catch (IOException e) {
+            e.printStackTrace();
+            return ResponseHelp.exception(new SystemException("图片上传失败"));
         }
     }
 
-    @RequestMapping(value = "/valid/mobile", method = RequestMethod.POST)
-    @ApiOperation(value = "验证手机号", notes="查询邀请码对应账号", httpMethod = "POST")
-    public Response<String> ValidMobile(@RequestBody @Validated UserValidInviteCodeDto userValidInviteCodeDto){
-        User user = usersService.getByInviteCode(userValidInviteCodeDto.getInviteCode());
-        if(user == null){
-            return ResponseHelp.success(null);
-        }else{
-            return ResponseHelp.success(user.getNickname());
-        }
+    @RequestMapping(value = "/message", method = RequestMethod.GET)
+    @ApiOperation(value = "用户站内信", notes = "用户消息列表", httpMethod = "GET")
+    public Response<PageMessage<UserMessage>> message(
+            @RequestParam(required = false, defaultValue = "1") int page,
+            @RequestParam(required = false, defaultValue = "100") int size
+    )  {
+        User user = (User) shiroHelp.getLoginUser();
+        Page<UserMessage> p = userMessageService.select(page, size, user.getId());
+
+        return ResponseHelp.success(p, page, size, p.getTotal());
     }
 }

+ 1 - 0
server/gateway-api/src/main/java/com/qxgmat/controller/api/WechatController.java

@@ -1,4 +1,5 @@
 package com.qxgmat.controller.api;
 
 public class WechatController {
+
 }

+ 10 - 7
server/gateway-api/src/main/java/com/qxgmat/controller/gateway/OauthController.java

@@ -1,19 +1,14 @@
 package com.qxgmat.controller.gateway;
 
-import com.nuliji.tools.Response;
-import com.nuliji.tools.ResponseHelp;
-import com.qxgmat.dto.request.UserRegisterDto;
-import com.qxgmat.dto.response.MyDto;
+import com.qxgmat.data.dao.entity.User;
 import com.qxgmat.help.ShiroHelp;
 import com.qxgmat.help.WechatHelp;
+import com.qxgmat.service.UsersService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import java.io.IOException;
@@ -31,6 +26,9 @@ public class OauthController {
     @Autowired
     private ShiroHelp shiroHelp;
 
+    @Autowired
+    private UsersService usersService;
+
 
     @RequestMapping(value = "/wechat_pc", method = RequestMethod.GET)
     @ApiOperation(value = "微信二维码登录", httpMethod = "GET")
@@ -47,6 +45,11 @@ public class OauthController {
             @RequestParam(required = false, defaultValue = "") String code,
             @RequestParam(required = false, defaultValue = "") String state,
             HttpSession session, HttpServletResponse response) throws IOException {
+        User user = (User) shiroHelp.getLoginUser();
+        if (user!=null){
+            // 已登录用户,绑定
+            usersService.Oauth(user, code, "wechat_pc");
+        }
         shiroHelp.getSession().login(shiroHelp.oauth(code, "wechat_pc"));
         Object jump = session.getAttribute("jump");
         if (jump == null) {

+ 2 - 3
server/gateway-api/src/main/java/com/qxgmat/controller/gateway/PayController.java

@@ -2,7 +2,6 @@ package com.qxgmat.controller.gateway;
 
 import com.nuliji.tools.Response;
 import com.nuliji.tools.ResponseHelp;
-import com.qxgmat.dto.request.UserRegisterDto;
 import com.qxgmat.dto.response.MyDto;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.validation.annotation.Validated;
@@ -20,13 +19,13 @@ public class PayController {
 
     @RequestMapping(value = "/wechat_qr", method = RequestMethod.POST)
     @ApiOperation(value = "微信二维码支付", httpMethod = "POST")
-    public Response<MyDto> wechatQr(@RequestBody @Validated UserRegisterDto userRegisterDto, HttpSession session, HttpServletRequest request) {
+    public Response<MyDto> wechatQr(HttpSession session, HttpServletRequest request) {
         return ResponseHelp.success(null);
     }
 
     @RequestMapping(value = "/alipay_pc", method = RequestMethod.POST)
     @ApiOperation(value = "支付宝pc支付", httpMethod = "POST")
-    public Response alipayPc(@RequestBody @Validated UserRegisterDto userRegisterDto, HttpSession session, HttpServletRequest request) {
+    public Response alipayPc(HttpSession session, HttpServletRequest request) {
 
         return ResponseHelp.success(null);
     }

+ 3 - 3
server/gateway-api/src/main/java/com/qxgmat/dto/admin/extend/QuestionNoExtendDto.java

@@ -1,12 +1,12 @@
 package com.qxgmat.dto.admin.extend;
 
 import com.nuliji.tools.annotation.Dto;
-import com.qxgmat.data.dao.entity.QuestionId;
+import com.qxgmat.data.dao.entity.QuestionNo;
 
 import javax.validation.constraints.NotEmpty;
 
-@Dto(entity = QuestionId.class)
-public class QuestionIdExtendDto {
+@Dto(entity = QuestionNo.class)
+public class QuestionNoExtendDto {
     private Integer id;
 
     /**

+ 57 - 1
server/gateway-api/src/main/java/com/qxgmat/dto/admin/request/ExaminationStructDto.java

@@ -1,8 +1,64 @@
 package com.qxgmat.dto.admin.request;
 
 import com.nuliji.tools.annotation.Dto;
+import com.qxgmat.data.dao.entity.ExaminationStruct;
 import com.qxgmat.data.dao.entity.ExerciseStruct;
 
-@Dto(entity= ExerciseStruct.class)
+import javax.validation.constraints.NotEmpty;
+
+@Dto(entity= ExaminationStruct.class)
 public class ExaminationStructDto {
+    private Integer id;
+
+    @NotEmpty(message = "中文名称不能为空!")
+    private String nameZh;
+
+    @NotEmpty(message = "英文名称不能为空!")
+    private String nameEn;
+
+    @NotEmpty(message = "描述不能为空!")
+    private String description;
+
+    @NotEmpty(message = "父级不能为空!")
+    private Integer parentId;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getNameZh() {
+        return nameZh;
+    }
+
+    public void setNameZh(String nameZh) {
+        this.nameZh = nameZh;
+    }
+
+    public String getNameEn() {
+        return nameEn;
+    }
+
+    public void setNameEn(String nameEn) {
+        this.nameEn = nameEn;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
 }

+ 69 - 0
server/gateway-api/src/main/java/com/qxgmat/dto/admin/request/ExerciseStructDto.java

@@ -1,4 +1,73 @@
 package com.qxgmat.dto.admin.request;
 
+import com.nuliji.tools.annotation.Dto;
+import com.qxgmat.data.dao.entity.ExerciseStruct;
+
+import javax.validation.constraints.NotEmpty;
+
+@Dto(entity= ExerciseStruct.class)
 public class ExerciseStructDto {
+    private Integer id;
+
+    @NotEmpty(message = "中文名称不能为空!")
+    private String nameZh;
+
+    @NotEmpty(message = "英文名称不能为空!")
+    private String nameEn;
+
+    @NotEmpty(message = "描述不能为空!")
+    private String description;
+
+    @NotEmpty(message = "父级不能为空!")
+    private Integer parentId;
+
+    private Integer questionStatus;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getNameZh() {
+        return nameZh;
+    }
+
+    public void setNameZh(String nameZh) {
+        this.nameZh = nameZh;
+    }
+
+    public String getNameEn() {
+        return nameEn;
+    }
+
+    public void setNameEn(String nameEn) {
+        this.nameEn = nameEn;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public Integer getQuestionStatus() {
+        return questionStatus;
+    }
+
+    public void setQuestionStatus(Integer questionStatus) {
+        this.questionStatus = questionStatus;
+    }
 }

+ 97 - 14
server/gateway-api/src/main/java/com/qxgmat/dto/admin/request/QuestionDto.java

@@ -1,20 +1,39 @@
 package com.qxgmat.dto.admin.request;
 
 import com.nuliji.tools.annotation.Dto;
-import com.qxgmat.data.dao.entity.Manager;
+import com.qxgmat.data.dao.entity.Question;
+import com.qxgmat.dto.admin.extend.QuestionNoExtendDto;
+import org.json.JSONObject;
 
 import javax.validation.constraints.NotEmpty;
 
-@Dto(entity = Manager.class)
+@Dto(entity = Question.class)
 public class QuestionDto {
 
     private Integer id;
 
-    @NotEmpty(message = "用户名不能为空!")
-    private String username;
+    private String[] keyword;
 
-    @NotEmpty(message = "密码不能为空!")
-    private String password;
+    @NotEmpty(message = "题型不能为空!")
+    private String type;
+
+    @NotEmpty(message = "考点不能为空!")
+    private String place;
+
+    @NotEmpty(message = "难度不能为空!")
+    private String difficult;
+
+    private QuestionNoExtendDto questionIds;
+
+    private String qxContent;
+
+    private String officialContent;
+
+    private String associationContent;
+
+    private JSONObject answer;
+
+    private JSONObject style;
 
     public Integer getId() {
         return id;
@@ -24,19 +43,83 @@ public class QuestionDto {
         this.id = id;
     }
 
-    public String getUsername() {
-        return username;
+    public QuestionNoExtendDto getQuestionIds() {
+        return questionIds;
+    }
+
+    public void setQuestionIds(QuestionNoExtendDto questionIds) {
+        this.questionIds = questionIds;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getPlace() {
+        return place;
+    }
+
+    public void setPlace(String place) {
+        this.place = place;
+    }
+
+    public String getDifficult() {
+        return difficult;
+    }
+
+    public void setDifficult(String difficult) {
+        this.difficult = difficult;
+    }
+
+    public String[] getKeyword() {
+        return keyword;
+    }
+
+    public void setKeyword(String[] keyword) {
+        this.keyword = keyword;
+    }
+
+    public String getQxContent() {
+        return qxContent;
+    }
+
+    public void setQxContent(String qxContent) {
+        this.qxContent = qxContent;
+    }
+
+    public String getOfficialContent() {
+        return officialContent;
+    }
+
+    public void setOfficialContent(String officialContent) {
+        this.officialContent = officialContent;
+    }
+
+    public String getAssociationContent() {
+        return associationContent;
+    }
+
+    public void setAssociationContent(String associationContent) {
+        this.associationContent = associationContent;
+    }
+
+    public JSONObject getAnswer() {
+        return answer;
     }
 
-    public void setUsername(String username) {
-        this.username = username;
+    public void setAnswer(JSONObject answer) {
+        this.answer = answer;
     }
 
-    public String getPassword() {
-        return password;
+    public JSONObject getStyle() {
+        return style;
     }
 
-    public void setPassword(String password) {
-        this.password = password;
+    public void setStyle(JSONObject style) {
+        this.style = style;
     }
 }

+ 7 - 58
server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/ExercisePaperListDto.java

@@ -1,28 +1,17 @@
 package com.qxgmat.dto.admin.response;
 
 import com.nuliji.tools.annotation.Dto;
-import com.qxgmat.data.dao.entity.HomeworkPreview;
+import com.qxgmat.data.dao.entity.ExercisePaper;
 
-import java.util.Date;
 
-@Dto(entity = HomeworkPreview.class)
+@Dto(entity = ExercisePaper.class)
 public class ExercisePaperListDto {
 
     private Integer id;
 
     private String title;
 
-    private Integer category;
-
-    private Date startTime;
-
-    private Date endTime;
-
-    private Integer[] questionIds;
-
-    private Integer[] userIds;
-
-    private Integer finish;
+    private Integer structId;
 
     public Integer getId() {
         return id;
@@ -40,51 +29,11 @@ public class ExercisePaperListDto {
         this.title = title;
     }
 
-    public Date getStartTime() {
-        return startTime;
-    }
-
-    public void setStartTime(Date startTime) {
-        this.startTime = startTime;
-    }
-
-    public Date getEndTime() {
-        return endTime;
-    }
-
-    public void setEndTime(Date endTime) {
-        this.endTime = endTime;
-    }
-
-    public Integer getFinish() {
-        return finish;
-    }
-
-    public void setFinish(Integer finish) {
-        this.finish = finish;
-    }
-
-    public Integer[] getQuestionIds() {
-        return questionIds;
-    }
-
-    public void setQuestionIds(Integer[] questionIds) {
-        this.questionIds = questionIds;
-    }
-
-    public Integer[] getUserIds() {
-        return userIds;
-    }
-
-    public void setUserIds(Integer[] userIds) {
-        this.userIds = userIds;
-    }
-
-    public Integer getCategory() {
-        return category;
+    public Integer getStructId() {
+        return structId;
     }
 
-    public void setCategory(Integer category) {
-        this.category = category;
+    public void setStructId(Integer structId) {
+        this.structId = structId;
     }
 }

+ 24 - 12
server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/ExerciseQuestionListDto.java

@@ -1,17 +1,21 @@
 package com.qxgmat.dto.admin.response;
 
 import com.nuliji.tools.annotation.Dto;
-import com.qxgmat.data.dao.entity.ExercisePaper;
+import com.qxgmat.data.dao.entity.QuestionNo;
+import com.qxgmat.dto.admin.extend.ExercisePaperExtendDto;
+import com.qxgmat.dto.admin.extend.QuestionExtendDto;
 
 
-@Dto(entity = ExercisePaper.class)
+@Dto(entity = QuestionNo.class)
 public class ExerciseQuestionListDto {
 
     private Integer id;
 
-    private String title;
+    private String no;
 
-    private Integer structId;
+    private ExercisePaperExtendDto paper;
+
+    private QuestionExtendDto question;
 
     public Integer getId() {
         return id;
@@ -21,19 +25,27 @@ public class ExerciseQuestionListDto {
         this.id = id;
     }
 
-    public String getTitle() {
-        return title;
+    public ExercisePaperExtendDto getPaper() {
+        return paper;
+    }
+
+    public void setPaper(ExercisePaperExtendDto paper) {
+        this.paper = paper;
+    }
+
+    public String getNo() {
+        return no;
     }
 
-    public void setTitle(String title) {
-        this.title = title;
+    public void setNo(String no) {
+        this.no = no;
     }
 
-    public Integer getStructId() {
-        return structId;
+    public QuestionExtendDto getQuestion() {
+        return question;
     }
 
-    public void setStructId(Integer structId) {
-        this.structId = structId;
+    public void setQuestion(QuestionExtendDto question) {
+        this.question = question;
     }
 }

+ 9 - 9
server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/LoginUserDto.java

@@ -11,18 +11,10 @@ public class LoginUserDto {
     /**
      * 用户名
      */
-    private String userName;
+    private String username;
 
     private ManagerRoleExtendDto role;
 
-
-    public String getUserName() {
-        return userName;
-    }
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
     public ManagerRoleExtendDto getRole() {
         return role;
     }
@@ -30,4 +22,12 @@ public class LoginUserDto {
     public void setRole(ManagerRoleExtendDto role) {
         this.role = role;
     }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
 }

+ 2 - 1
server/gateway-api/src/main/java/com/qxgmat/dto/request/SmsSendDto.java

@@ -1,7 +1,8 @@
 package com.qxgmat.dto.request;
 
 import io.swagger.annotations.ApiModelProperty;
-import org.hibernate.validator.constraints.NotBlank;
+
+import javax.validation.constraints.NotBlank;
 
 /**
 Created by GaoJie on 2017/11/3.

+ 8 - 37
server/gateway-api/src/main/java/com/qxgmat/dto/request/UserEmailDto.java

@@ -13,46 +13,17 @@ import javax.validation.constraints.NotBlank;
 public class UserEmailDto {
 
     /**
-     * 手机号
+     * 邮箱
      */
-    @NotBlank(message = "手机号不能为空!")
-    @ApiModelProperty(value = "手机", required = true)
-    private String mobile;
+    @NotBlank(message = "邮箱不能为空!")
+    @ApiModelProperty(value = "邮箱", required = true)
+    private String email;
 
-    /**
-     * 手机验证码
-     */
-    @NotBlank(message = "手机验证码不能为空!")
-    @ApiModelProperty(value = "手机验证码", required = true)
-    private String mobileVerifyCode;
-
-    /**
-     * 邀请人手机/邀请码
-     */
-    @ApiModelProperty(value = "邀请人手机/邀请码", required = false)
-    private String inviteCode;
-
-    public String getMobile() {
-        return mobile;
-    }
-
-    public void setMobile(String mobile) {
-        this.mobile = mobile;
-    }
-
-    public String getMobileVerifyCode() {
-        return mobileVerifyCode;
-    }
-
-    public void setMobileVerifyCode(String mobileVerifyCode) {
-        this.mobileVerifyCode = mobileVerifyCode;
-    }
-
-    public String getInviteCode() {
-        return inviteCode;
+    public String getEmail() {
+        return email;
     }
 
-    public void setInviteCode(String inviteCode) {
-        this.inviteCode = inviteCode;
+    public void setEmail(String email) {
+        this.email = email;
     }
 }

+ 23 - 8
server/gateway-api/src/main/java/com/qxgmat/dto/request/UserInfoDto.java

@@ -13,17 +13,32 @@ import javax.validation.constraints.NotBlank;
 public class UserInfoDto {
 
     /**
-     * 手机号
+     * 昵称
      */
-    @NotBlank(message = "邮箱不能为空!")
-    @ApiModelProperty(value = "邮箱", required = true)
-    private String email;
+    @NotBlank(message = "昵称不能为空!")
+    @ApiModelProperty(value = "昵称", required = true)
+    private String nickname;
 
-    public String getEmail() {
-        return email;
+    /**
+     * 头像
+     */
+    @NotBlank(message = "头像不能为空!")
+    @ApiModelProperty(value = "头像", required = true)
+    private String avatar;
+
+    public String getNickname() {
+        return nickname;
+    }
+
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+
+    public String getAvatar() {
+        return avatar;
     }
 
-    public void setEmail(String email) {
-        this.email = email;
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
     }
 }

+ 1 - 0
server/gateway-api/src/main/java/com/qxgmat/dto/request/UserValidMobileDto.java

@@ -15,6 +15,7 @@ public class UserValidMobileDto {
     @NotBlank(message = "手机号不能为空!")
     @ApiModelProperty(value = "手机号", required = true)
     private String mobile;
+
     /**
      * 手机验证码
      */

+ 8 - 8
server/gateway-api/src/main/java/com/qxgmat/dto/response/UserDto.java

@@ -9,24 +9,24 @@ import java.util.List;
  */
 public class UserDto {
     @ApiModelProperty(value = "用户id", required = true)
-    private Long id;
+    private Number id;
 
     @ApiModelProperty(value = "昵称", required = true)
-    private String nickName = "";
+    private String nickname = "";
 
-    public Long getId() {
+    public Number getId() {
         return id;
     }
 
-    public void setId(Long id) {
+    public void setId(Number id) {
         this.id = id;
     }
 
-    public String getNickName() {
-        return nickName;
+    public String getNickname() {
+        return nickname;
     }
 
-    public void setNickName(String nickName) {
-        this.nickName = nickName;
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
     }
 }

+ 37 - 12
server/gateway-api/src/main/java/com/qxgmat/dto/response/UserRealDto.java

@@ -1,30 +1,55 @@
 package com.qxgmat.dto.response;
 
+import com.nuliji.tools.annotation.Dto;
+import com.qxgmat.data.dao.entity.User;
 import io.swagger.annotations.ApiModelProperty;
 
 /**
  * Created by GaoJie on 2017/11/1.
  */
+@Dto(entity = User.class)
 public class UserRealDto {
-    @ApiModelProperty(value = "用户id", required = true)
-    private Number id;
+    @ApiModelProperty(value = "身份证号", required = true)
+    private String identity;
 
-    @ApiModelProperty(value = "昵称", required = true)
-    private String nickname = "";
+    @ApiModelProperty(value = "真实姓名", required = true)
+    private String name = "";
 
-    public Number getId() {
-        return id;
+    @ApiModelProperty(value = "地址", required = true)
+    private String address = "";
+
+    @ApiModelProperty(value = "身份照片", required = true)
+    private String photo = "";
+
+    public String getIdentity() {
+        return identity;
+    }
+
+    public void setIdentity(String identity) {
+        this.identity = identity;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAddress() {
+        return address;
     }
 
-    public void setId(Number id) {
-        this.id = id;
+    public void setAddress(String address) {
+        this.address = address;
     }
 
-    public String getNickname() {
-        return nickname;
+    public String getPhoto() {
+        return photo;
     }
 
-    public void setNickname(String nickname) {
-        this.nickname = nickname;
+    public void setPhoto(String photo) {
+        this.photo = photo;
     }
 }

+ 14 - 12
server/gateway-api/src/main/java/com/qxgmat/service/ExaminationPaperService.java

@@ -1,4 +1,4 @@
-package com.qxgmat.service.inline;
+package com.qxgmat.service;
 
 import com.github.pagehelper.Page;
 import com.nuliji.tools.AbstractService;
@@ -6,10 +6,9 @@ import com.nuliji.tools.Transform;
 import com.nuliji.tools.exception.ParameterException;
 import com.nuliji.tools.exception.SystemException;
 import com.qxgmat.data.dao.ExaminationPaperMapper;
-import com.qxgmat.data.dao.ExercisePaperMapper;
 import com.qxgmat.data.dao.entity.ExaminationPaper;
-import com.qxgmat.data.dao.entity.ExercisePaper;
 import com.qxgmat.data.dao.entity.Question;
+import com.qxgmat.service.inline.QuestionService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -26,23 +25,26 @@ public class ExaminationPaperService extends AbstractService {
     @Resource
     private ExaminationPaperMapper examinationPaperMapper;
 
+    @Resource
+    private QuestionService questionService;
 
     @Transactional
-    public SentenceQuestion addQuestion(SentenceQuestionRelation relation){
-        Question question = relation.getQuestion();
+    public Question addQuestion(Question question){
         question = questionService.add(question);
-        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
-        entity.setQuestionId(question.getId());
-        return add(entity);
+//        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
+//        entity.setQuestionId(question.getId());
+//        return add(entity);
+        return question;
     }
 
     @Transactional
-    public SentenceQuestion editQuestion(SentenceQuestionRelation relation){
-        Question question = relation.getQuestion();
+    public Question editQuestion(Question question){
         question = questionService.edit(question);
-        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
-        return edit(entity);
+//        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
+//        return edit(entity);
+        return question;
     }
+
     public ExaminationPaper add(ExaminationPaper paper){
         int result = insert(examinationPaperMapper, paper);
         paper = one(examinationPaperMapper, paper.getId());

+ 28 - 3
server/gateway-api/src/main/java/com/qxgmat/service/ExercisePaperService.java

@@ -1,16 +1,18 @@
-package com.qxgmat.service.inline;
+package com.qxgmat.service;
 
 import com.github.pagehelper.Page;
 import com.nuliji.tools.AbstractService;
 import com.nuliji.tools.exception.ParameterException;
 import com.nuliji.tools.exception.SystemException;
 import com.qxgmat.data.dao.ExercisePaperMapper;
-import com.qxgmat.data.dao.ExerciseStructMapper;
 import com.qxgmat.data.dao.entity.ExercisePaper;
-import com.qxgmat.data.dao.entity.ExerciseStruct;
+import com.qxgmat.data.dao.entity.Question;
+import com.qxgmat.service.inline.ExercisePaperQuestionService;
+import com.qxgmat.service.inline.QuestionService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.Collection;
@@ -23,6 +25,29 @@ public class ExercisePaperService extends AbstractService {
     @Resource
     private ExercisePaperMapper exercisePaperMapper;
 
+    @Resource
+    private ExercisePaperQuestionService exercisePaperQuestionService;
+
+    @Resource
+    private QuestionService questionService;
+
+    @Transactional
+    public Question addQuestion(Question question){
+        question = questionService.add(question);
+        // 进行分组逻辑处理
+//        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
+//        entity.setQuestionId(question.getId());
+//        return add(entity);
+        return question;
+    }
+
+    @Transactional
+    public Question editQuestion(Question question){
+        question = questionService.edit(question);
+//        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
+//        return edit(entity);
+        return question;
+    }
     public ExercisePaper add(ExercisePaper paper){
         int result = insert(exercisePaperMapper, paper);
         paper = one(exercisePaperMapper, paper.getId());

+ 4 - 4
server/gateway-api/src/main/java/com/qxgmat/service/ManagerService.java

@@ -35,12 +35,12 @@ public class ManagerService extends AbstractService {
     }
 
     public boolean equalsPassword(Manager manager, String password){
-//        logger.info("{},{}", sysUser.getPassword(), Tools.stringMD5(password));
-        return Objects.equals(manager.getPassword(), Tools.stringMD5(password));
+        logger.info("{},{}", manager.getPassword(), Tools.stringMD5(Tools.stringMD5(password)));
+        return Objects.equals(manager.getPassword(), Tools.stringMD5(Tools.stringMD5(password)));
     }
 
     public Manager add(Manager manager){
-        if(manager.getPassword() != null) manager.setPassword(Tools.stringMD5(manager.getPassword()));
+        if(manager.getPassword() != null) manager.setPassword(Tools.stringMD5(Tools.stringMD5(manager.getPassword())));
         int result = insert(managerMapper, manager);
         manager = one(managerMapper, manager.getId());
         if(manager == null){
@@ -54,7 +54,7 @@ public class ManagerService extends AbstractService {
         if(in == null){
             throw new ParameterException("用户不存在");
         }
-        if(manager.getPassword() != null) manager.setPassword(Tools.stringMD5(manager.getPassword()));
+        if(manager.getPassword() != null) manager.setPassword(Tools.stringMD5(Tools.stringMD5(manager.getPassword())));
         int result = update(managerMapper, manager);
         return manager;
     }

+ 32 - 2
server/gateway-api/src/main/java/com/qxgmat/service/SentencePaperService.java

@@ -1,16 +1,21 @@
-package com.qxgmat.service.inline;
+package com.qxgmat.service;
 
 import com.github.pagehelper.Page;
 import com.nuliji.tools.AbstractService;
+import com.nuliji.tools.Transform;
 import com.nuliji.tools.exception.ParameterException;
 import com.nuliji.tools.exception.SystemException;
 import com.qxgmat.data.dao.SentencePaperMapper;
-import com.qxgmat.data.dao.SentenceQuestionMapper;
+import com.qxgmat.data.dao.entity.Question;
 import com.qxgmat.data.dao.entity.SentencePaper;
 import com.qxgmat.data.dao.entity.SentenceQuestion;
+import com.qxgmat.data.relation.entity.SentenceQuestionRelation;
+import com.qxgmat.service.inline.QuestionService;
+import com.qxgmat.service.inline.SentenceQuestionService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.Collection;
@@ -23,6 +28,31 @@ public class SentencePaperService extends AbstractService {
     @Resource
     private SentencePaperMapper sentencePaperMapper;
 
+    @Resource
+    private QuestionService questionService;
+
+    @Resource
+    private SentenceQuestionService sentenceQuestionService;
+
+    @Transactional
+    public SentenceQuestion addQuestion(SentenceQuestionRelation relation){
+        Question question = relation.getQuestion();
+        question = questionService.add(question);
+        // 根据序号创建
+        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
+        entity.setQuestionId(question.getId());
+        return sentenceQuestionService.add(entity);
+    }
+
+    @Transactional
+    public SentenceQuestion editQuestion(SentenceQuestionRelation relation){
+        Question question = relation.getQuestion();
+        question = questionService.edit(question);
+        // 根据序号调整分组
+        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
+        return sentenceQuestionService.edit(entity);
+    }
+
     public SentencePaper add(SentencePaper paper){
         int result = insert(sentencePaperMapper, paper);
         paper = one(sentencePaperMapper, paper.getId());

+ 83 - 16
server/gateway-api/src/main/java/com/qxgmat/service/UsersService.java

@@ -3,6 +3,7 @@ package com.qxgmat.service;
 import com.github.pagehelper.Page;
 import com.nuliji.tools.AbstractService;
 import com.nuliji.tools.Tools;
+import com.nuliji.tools.Transform;
 import com.nuliji.tools.exception.ParameterException;
 import com.nuliji.tools.exception.SystemException;
 import com.nuliji.tools.mybatis.Example;
@@ -12,8 +13,10 @@ import com.qxgmat.data.dao.UserMapper;
 import com.qxgmat.data.dao.entity.User;
 import com.qxgmat.help.WechatHelp;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.beans.Transient;
 import java.util.Collection;
 import java.util.List;
 import java.util.Objects;
@@ -25,6 +28,7 @@ import java.util.Objects;
 public class UsersService extends AbstractService {
     final public String PLATORM_WECHAT_NATIVE = "wechat_openid_wechat";
     final public String PLATORM_WECHAT_PC = "wechat_openid_pc";
+    final public String PLATORM_WECHAT = "wechat_unionid";
 
     @Resource
     private UserMapper userMapper;
@@ -32,7 +36,8 @@ public class UsersService extends AbstractService {
     @Resource
     private WechatHelp wechatHelp;
 
-    public User Oauth(String code, String platform){
+    @Transactional
+    public User Oauth(User user, String code, String platform){
         OauthData data;
         switch(platform){
             case "wechat_pc":
@@ -44,11 +49,72 @@ public class UsersService extends AbstractService {
             default:
                 throw new ParameterException("第三方平台"+platform+"不支持");
         }
-        // todo 登录已关联的用户账号
-        User user = getByOpen(data.getOpenId(), platform);
+        // 获取已关联的账号
+        if (user == null){
+            user = getByOpen(data.getOpenId(), data.getUnionId(), platform);
+        } else {
+            // 不需要校验是否已绑定,注册账号必定需要手机号
+//            User openUser = getByOpen(data.getOpenId(), data.getUnionId(), platform);
+//            if(openUser != null && openUser.getMobile().equals(user.getMobile())){
+//                throw new ParameterException("第三方平台"+platform+"不支持");
+//            }
+        }
         if (user == null){
             user = new User();
+            user.setAvatar(data.getAvatar());
+            user.setNickname(data.getNickName());
+        }
+        switch(platform){
+            case "wechat_pc":
+                user.setWechatOpenidPc(data.getOpenId());
+                user.setWechatUnionid(data.getUnionId());
+                break;
+            case "wechat_native":
+                user.setWechatOpenidWechat(data.getOpenId());
+                user.setWechatUnionid(data.getUnionId());
+                user.setWechatAccessToken(data.getAccessToken());
+                user.setWechatRefreshToken(data.getRefreshToken());
+                user.setWechatExpireTime(data.getExpiresTime());
+                break;
+        }
+        if (!user.getMobile().isEmpty()){
+            // 直接更新数据
+            edit(user);
+        }
+
+        return user;
+    }
+
+    @Transactional
+    public User register(String mobile, String inviteCode, User openUser){
+        User user = getByMobile(mobile);
+        if (user != null){
+            throw new ParameterException("手机号已注册");
+        }
+        // 注册,并且绑定邀请者
+        user = User.builder().mobile(mobile).build();
+        if (inviteCode != null && !inviteCode.isEmpty()){
+            User origin = getByInviteCode(inviteCode);
+            user.setOriginId(origin.getId());
+            // todo 按逻辑进行奖励
+        }
+        // 绑定第三方登录信息
+        if (openUser != null){
+            user.setWechatOpenidPc(openUser.getWechatOpenidPc());
+            user.setWechatOpenidWechat(openUser.getWechatOpenidWechat());
+            user.setWechatExpireTime(openUser.getWechatExpireTime());
+            user.setWechatUnionid(openUser.getWechatUnionid());
+            user.setWechatAccessToken(openUser.getWechatAccessToken());
+            user.setWechatRefreshToken(openUser.getWechatRefreshToken());
+            user.setNickname(openUser.getNickname());
+            user.setAvatar(openUser.getAvatar());
         }
+        // 生成邀请码: 10位字符串
+        user.setInviteCode(Tools.getRandomString(10));
+
+        user = add(user);
+        if(user == null)
+            throw new SystemException("注册失败");
         return user;
     }
 
@@ -57,32 +123,41 @@ public class UsersService extends AbstractService {
         return one(userMapper, user);
     }
 
-    public User getByOpen(String openId, String platform){
-        String platformField = "";
+    public User getByOpen(String openId, String unionId, String platform){
+        String platformField;
+        String unionField;
         switch(platform){
             case "wechat_pc":
                 platformField = PLATORM_WECHAT_PC;
+                unionField = PLATORM_WECHAT;
                 break;
             case "wechat_native":
                 platformField = PLATORM_WECHAT_NATIVE;
+                unionField = PLATORM_WECHAT;
                 break;
             default:
                 throw new ParameterException("第三方平台"+platform+"不支持");
         }
         Example example = new Example(User.class);
-        example.and(
+        example.or(
                 example.createCriteria()
                         .andEqualTo(platformField, openId)
         );
+        if (unionId != null && !unionId.isEmpty()){
+            example.or(
+                    example.createCriteria()
+                    .andEqualTo(unionField, unionId)
+            );
+        }
         return one(userMapper, example);
     }
 
     public boolean equalsPassword(User user, String password){
-        return Objects.equals(user.getPassword(), Tools.stringMD5(password));
+        return Objects.equals(user.getPassword(), Tools.stringMD5(Tools.stringMD5(password)));
     }
 
     public boolean changePassword(User user, String password){
-        User updateUser = User.builder().id(user.getId()).password(Tools.stringMD5(password)).build();
+        User updateUser = User.builder().id(user.getId()).password(Tools.stringMD5(Tools.stringMD5(password))).build();
         int result = update(userMapper, updateUser);
         return result > 0;
     }
@@ -99,14 +174,6 @@ public class UsersService extends AbstractService {
         return one(userMapper, example);
     }
 
-    public boolean bindOpen(User user, User otherUser){
-//        user.setTaobaoOpenid(otherUser.getTaobaoOpenid());
-//        user.setWechatOpenid(otherUser.getWechatOpenid());
-//        user.setRegisterType(otherUser.getRegisterType());
-        int result = update(userMapper, user);
-        return result > 0;
-    }
-
     public User add(User user){
         if(user.getPassword() != null) user.setPassword(Tools.stringMD5(user.getPassword()));
 

+ 7 - 1
server/gateway-api/src/main/java/com/qxgmat/service/inline/ExaminationStructService.java

@@ -10,6 +10,8 @@ import com.qxgmat.data.dao.entity.ExaminationStruct;
 import com.qxgmat.data.dao.entity.ExerciseStruct;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -23,10 +25,12 @@ public class ExaminationStructService extends AbstractService {
     @Resource
     private ExaminationStructMapper examinationStructMapper;
 
-    public Collection<ExerciseStruct> all(){
+    @Cacheable("examination_struct")
+    public List<ExaminationStruct> all(){
         return null;
     }
 
+    @CacheEvict("examination_struct")
     public ExaminationStruct add(ExaminationStruct struct){
         int result = insert(examinationStructMapper, struct);
         struct = one(examinationStructMapper, struct.getId());
@@ -36,6 +40,7 @@ public class ExaminationStructService extends AbstractService {
         return struct;
     }
 
+    @CacheEvict("examination_struct")
     public ExaminationStruct edit(ExaminationStruct struct){
         ExaminationStruct in = one(examinationStructMapper, struct.getId());
         if(in == null){
@@ -45,6 +50,7 @@ public class ExaminationStructService extends AbstractService {
         return struct;
     }
 
+    @CacheEvict("examination_struct")
     public boolean delete(Number id){
         ExaminationStruct in = one(examinationStructMapper, id);
         if(in == null){

+ 20 - 18
server/gateway-api/src/main/java/com/qxgmat/service/inline/ExercisePaperQuestionService.java

@@ -5,7 +5,9 @@ import com.nuliji.tools.AbstractService;
 import com.nuliji.tools.exception.ParameterException;
 import com.nuliji.tools.exception.SystemException;
 import com.qxgmat.data.dao.ExercisePaperMapper;
+import com.qxgmat.data.dao.ExercisePaperQuestionMapper;
 import com.qxgmat.data.dao.entity.ExercisePaper;
+import com.qxgmat.data.dao.entity.ExercisePaperQuestion;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -19,37 +21,37 @@ public class ExercisePaperQuestionService extends AbstractService {
     private static final Logger logger = LoggerFactory.getLogger(ExercisePaperQuestionService.class);
 
     @Resource
-    private ExercisePaperMapper exercisePaperMapper;
+    private ExercisePaperQuestionMapper exercisePaperQuestionMapper;
 
-    public ExercisePaper add(ExercisePaper paper){
-        int result = insert(exercisePaperMapper, paper);
-        paper = one(exercisePaperMapper, paper.getId());
-        if(paper == null){
+    public ExercisePaperQuestion add(ExercisePaperQuestion question){
+        int result = insert(exercisePaperQuestionMapper, question);
+        question = one(exercisePaperQuestionMapper, question.getId());
+        if(question == null){
             throw new SystemException("组卷添加失败");
         }
-        return paper;
+        return question;
     }
 
-    public ExercisePaper edit(ExercisePaper paper){
-        ExercisePaper in = one(exercisePaperMapper, paper.getId());
+    public ExercisePaperQuestion edit(ExercisePaperQuestion question){
+        ExercisePaperQuestion in = one(exercisePaperQuestionMapper, question.getId());
         if(in == null){
             throw new ParameterException("组卷不存在");
         }
-        int result = update(exercisePaperMapper, paper);
-        return paper;
+        int result = update(exercisePaperQuestionMapper, question);
+        return question;
     }
 
     public boolean delete(Number id){
-        ExercisePaper in = one(exercisePaperMapper, id);
+        ExercisePaperQuestion in = one(exercisePaperQuestionMapper, id);
         if(in == null){
             throw new ParameterException("组卷不存在");
         }
-        int result = delete(exercisePaperMapper, id);
+        int result = delete(exercisePaperQuestionMapper, id);
         return result > 0;
     }
 
-    public ExercisePaper selectOne(Number id){
-        ExercisePaper in = one(exercisePaperMapper, id);
+    public ExercisePaperQuestion selectOne(Number id){
+        ExercisePaperQuestion in = one(exercisePaperQuestionMapper, id);
 
         if(in == null){
             throw new ParameterException("组卷不存在");
@@ -57,12 +59,12 @@ public class ExercisePaperQuestionService extends AbstractService {
         return in;
     }
 
-    public Page<ExercisePaper> select(int page, int pageSize){
-        return select(exercisePaperMapper, page, pageSize);
+    public Page<ExercisePaperQuestion> select(int page, int pageSize){
+        return select(exercisePaperQuestionMapper, page, pageSize);
     }
 
-    public List<ExercisePaper> select(Collection ids){
-        return select(exercisePaperMapper, ids);
+    public List<ExercisePaperQuestion> select(Collection ids){
+        return select(exercisePaperQuestionMapper, ids);
     }
 
 }

+ 6 - 1
server/gateway-api/src/main/java/com/qxgmat/service/inline/ExerciseStructService.java

@@ -8,6 +8,8 @@ import com.qxgmat.data.dao.ExerciseStructMapper;
 import com.qxgmat.data.dao.entity.ExerciseStruct;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -21,10 +23,12 @@ public class ExerciseStructService extends AbstractService {
     @Resource
     private ExerciseStructMapper exerciseStructMapper;
 
-    public Collection<ExerciseStruct> all(){
+    @Cacheable("exercise_struct")
+    public List<ExerciseStruct> all(){
         return null;
     }
 
+    @CacheEvict("exercise_struct")
     public ExerciseStruct add(ExerciseStruct struct){
         int result = insert(exerciseStructMapper, struct);
         struct = one(exerciseStructMapper, struct.getId());
@@ -34,6 +38,7 @@ public class ExerciseStructService extends AbstractService {
         return struct;
     }
 
+    @CacheEvict("exercise_struct")
     public ExerciseStruct edit(ExerciseStruct struct){
         ExerciseStruct in = one(exerciseStructMapper, struct.getId());
         if(in == null){

+ 2 - 2
server/gateway-api/src/main/java/com/qxgmat/service/inline/HomeworkPreviewService.java

@@ -64,9 +64,9 @@ public class HomeworkPreviewService extends AbstractService {
         return select(homeworkPreviewMapper, page, pageSize);
     }
 
-    public Page<HomeworkPreview> select(int page, int pageSize, int category, HomeworkPreviewStatus status){
+    public Page<HomeworkPreview> select(int page, int pageSize, Integer category, HomeworkPreviewStatus status){
         Example example = new Example(HomeworkPreview.class);
-        if(category>0)
+        if(category != null && category>0)
             example.and(
                     example.createCriteria().andEqualTo("category", category)
             );

+ 18 - 17
server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionNoService.java

@@ -5,6 +5,7 @@ import com.nuliji.tools.AbstractService;
 import com.nuliji.tools.exception.ParameterException;
 import com.nuliji.tools.exception.SystemException;
 import com.qxgmat.data.dao.QuestionNoMapper;
+import com.qxgmat.data.dao.entity.QuestionNo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -14,41 +15,41 @@ import java.util.Collection;
 import java.util.List;
 
 @Service
-public class QuestionIdService extends AbstractService {
-    private static final Logger logger = LoggerFactory.getLogger(QuestionIdService.class);
+public class QuestionNoService extends AbstractService {
+    private static final Logger logger = LoggerFactory.getLogger(QuestionNoService.class);
 
     @Resource
-    private QuestionNoMapper questionIdMapper;
+    private QuestionNoMapper questionNoMapper;
 
-    public QuestionNo add(QuestionId question){
-        int result = insert(questionIdMapper, question);
-        question = one(questionIdMapper, question.getId());
+    public QuestionNo add(QuestionNo question){
+        int result = insert(questionNoMapper, question);
+        question = one(questionNoMapper, question.getId());
         if(question == null){
             throw new SystemException("题目添加失败");
         }
         return question;
     }
 
-    public QuestionId edit(QuestionId question){
-        QuestionId in = one(questionIdMapper, question.getId());
+    public QuestionNo edit(QuestionNo question){
+        QuestionNo in = one(questionNoMapper, question.getId());
         if(in == null){
             throw new ParameterException("题目不存在");
         }
-        int result = update(questionIdMapper, question);
+        int result = update(questionNoMapper, question);
         return question;
     }
 
     public boolean delete(Number id){
-        QuestionId in = one(questionIdMapper, id);
+        QuestionNo in = one(questionNoMapper, id);
         if(in == null){
             throw new ParameterException("题目不存在");
         }
-        int result = delete(questionIdMapper, id);
+        int result = delete(questionNoMapper, id);
         return result > 0;
     }
 
-    public QuestionId selectOne(Number id){
-        QuestionId in = one(questionIdMapper, id);
+    public QuestionNo selectOne(Number id){
+        QuestionNo in = one(questionNoMapper, id);
 
         if(in == null){
             throw new ParameterException("题目不存在");
@@ -56,12 +57,12 @@ public class QuestionIdService extends AbstractService {
         return in;
     }
 
-    public Page<QuestionId> select(int page, int pageSize){
-        return select(questionIdMapper, page, pageSize);
+    public Page<QuestionNo> select(int page, int pageSize){
+        return select(questionNoMapper, page, pageSize);
     }
 
-    public List<QuestionId> select(Collection ids){
-        return select(questionIdMapper, ids);
+    public List<QuestionNo> select(Collection ids){
+        return select(questionNoMapper, ids);
     }
 
 }

+ 23 - 0
server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionService.java

@@ -2,12 +2,15 @@ package com.qxgmat.service.inline;
 
 import com.github.pagehelper.Page;
 import com.nuliji.tools.AbstractService;
+import com.nuliji.tools.Transform;
 import com.nuliji.tools.exception.ParameterException;
 import com.nuliji.tools.exception.SystemException;
+import com.qxgmat.data.constants.enums.status.DirectionStatus;
 import com.qxgmat.data.dao.HomeworkPreviewMapper;
 import com.qxgmat.data.dao.QuestionMapper;
 import com.qxgmat.data.dao.entity.HomeworkPreview;
 import com.qxgmat.data.dao.entity.Question;
+import com.qxgmat.data.relation.QuestionRelationMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -23,6 +26,26 @@ public class QuestionService extends AbstractService {
     @Resource
     private QuestionMapper questionMapper;
 
+    @Resource
+    private QuestionRelationMapper questionRelationMapper;
+
+    public Page<Question> listExerciseAdmin(int page, int pageSize, Number structId, Number questionNo, Number paperId, String place, String difficult, String startTime, String endTime, String order, DirectionStatus direction){
+
+        if(order.isEmpty()) order = "id";
+        if (direction == null){
+            direction = DirectionStatus.DESC;
+        }
+        String finalOrder = order;
+        DirectionStatus finalDirection = direction;
+        Page<Question> p= page(() -> {
+            questionRelationMapper.listExerciseAdmin(structId, questionNo, paperId, place, difficult, startTime, endTime, finalOrder, finalDirection.key);
+        }, page, pageSize);
+
+        Collection ids = Transform.getIds(p, Question.class, "id");
+        Transform.replace(p, select(ids), Question.class, "id");
+        return p;
+    }
+
     public Question add(Question question){
         int result = insert(questionMapper, question);
         question = one(questionMapper, question.getId());

+ 1 - 22
server/gateway-api/src/main/java/com/qxgmat/service/inline/SentenceQuestionService.java

@@ -1,4 +1,4 @@
-package com.qxgmat.service;
+package com.qxgmat.service.inline;
 
 import com.github.pagehelper.Page;
 import com.nuliji.tools.AbstractService;
@@ -11,7 +11,6 @@ import com.qxgmat.data.dao.entity.Manager;
 import com.qxgmat.data.dao.entity.Question;
 import com.qxgmat.data.dao.entity.SentenceQuestion;
 import com.qxgmat.data.relation.entity.SentenceQuestionRelation;
-import com.qxgmat.service.inline.QuestionService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -28,26 +27,6 @@ public class SentenceQuestionService extends AbstractService {
     @Resource
     private SentenceQuestionMapper sentenceQuestionMapper;
 
-    @Resource
-    private QuestionService questionService;
-
-    @Transactional
-    public SentenceQuestion addQuestion(SentenceQuestionRelation relation){
-        Question question = relation.getQuestion();
-        question = questionService.add(question);
-        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
-        entity.setQuestionId(question.getId());
-        return add(entity);
-    }
-
-    @Transactional
-    public SentenceQuestion editQuestion(SentenceQuestionRelation relation){
-        Question question = relation.getQuestion();
-        question = questionService.edit(question);
-        SentenceQuestion entity = Transform.convert(relation, SentenceQuestion.class);
-        return edit(entity);
-    }
-
     public SentenceQuestion add(SentenceQuestion question){
         int result = insert(sentenceQuestionMapper, question);
         question = one(sentenceQuestionMapper, question.getId());

+ 0 - 0
server/gateway-api/src/main/java/com/qxgmat/service/inline/UserAskService.java


Some files were not shown because too many files changed in this diff