Просмотр исходного кода

fix(培训考试): 题库查询添加按题型查询字段

liuyaqi 3 лет назад
Родитель
Сommit
d4f5eea402
3 измененных файлов с 8 добавлено и 0 удалено
  1. 1 0
      model/learning/learning_question.go
  2. 3 0
      service/learning/question.go
  3. 4 0
      swaggerui/swagger.yml

+ 1 - 0
model/learning/learning_question.go

@@ -35,6 +35,7 @@ type LearningQuestionListReq struct {
 	OrderBy *model.OrderBy `json:"orderBy"`
 	SkillId int            `json:"skillId"`
 	Name    string         `json:"name"`
+	Type    int            `json:"type"` // 题型 1 单选 2 多选 3 判断
 }
 
 type LearningQuestionAddReq struct {

+ 3 - 0
service/learning/question.go

@@ -72,6 +72,9 @@ func (s LearningQuestionService) List(ctx context.Context, req *learning.Learnin
 	if req.SkillId != 0 {
 		dao = dao.Where("SkillId = ?", req.SkillId)
 	}
+	if req.Type != 0 {
+		dao = dao.Where("Type = ?", req.Type)
+	}
 	total, err := dao.Count()
 	if err != nil {
 		return 0, nil, err

+ 4 - 0
swaggerui/swagger.yml

@@ -1106,6 +1106,9 @@ components:
         name:
           type: string
           description: 按题目名称模糊查询
+        type:
+          type: integer
+          description: 题型 1 单选 2 多选 3 判断
     LearningQuestionAdd:
       type: object
       required:
@@ -1565,6 +1568,7 @@ components:
           value: id
         skillId: 2
         name: "测试"
+        type: 1
     LearningQuestionAdd:
       value:
         skillId: 2