Browse Source

fix(培训考试): 学习记录接口更新

liuyaqi 3 years ago
parent
commit
65211d2d6a

+ 7 - 5
model/learning/learning_learning_record.go

@@ -14,11 +14,12 @@ type LearningLearningRecord internal.LearningLearningRecord
 
 // Fill with you ideas below.
 type LearningLearningRecordListReq struct {
-	Page       *model.Page    `json:"page"`
-	OrderBy    *model.OrderBy `json:"orderBy"`
-	UserId     int            `json:"userId"`     // 用户 Id
-	MaterialId int            `json:"materialId"` // 资料 Id
-	Status     int            `json:"status"`     // 状态 1 已学习
+	Page         *model.Page    `json:"page"`
+	OrderBy      *model.OrderBy `json:"orderBy"`
+	UserId       int            `json:"userId"`       // 用户 Id
+	MaterialId   int            `json:"materialId"`   // 资料 Id
+	Status       int            `json:"status"`       // 状态 1 已学习
+	MaterialType int            `json:"materialType"` // 资料类型 1 资料 2 视频
 }
 
 type LearningLearningRecordGetRsp struct {
@@ -26,6 +27,7 @@ type LearningLearningRecordGetRsp struct {
 	UserName     string `json:"userName"`     // 用户名称
 	SkillName    string `json:"skillName"`    // 技能名称
 	MaterialName string `json:"materialName"` // 资料名称
+	MaterialType int    `json:"materialType"` // 资料类型 1 资料 2 视频
 }
 
 type LearningLearningRecordAddReq struct {

+ 4 - 0
service/learning/learning_record.go

@@ -49,6 +49,9 @@ func (s LearningLearningRecordService) List(ctx context.Context, req *learning.L
 	if req.MaterialId != 0 {
 		m = m.Where("a.MaterialId = ?", req.MaterialId)
 	}
+	if req.MaterialType != 0 {
+		m = m.Where("b.Type = ?", req.MaterialType)
+	}
 	if req.Status != 0 {
 		m = m.Where("a.Status = ?", req.Status)
 	}
@@ -78,6 +81,7 @@ func (s LearningLearningRecordService) List(ctx context.Context, req *learning.L
 	err = m.Fields(
 		"a.*",
 		"b.Name as MaterialName",
+		"b.Type as MaterialType",
 		"c.Name as SkillName",
 		"d.Realname as UserName").
 		Structs(&records)

+ 6 - 0
swaggerui/swagger.yml

@@ -1329,6 +1329,9 @@ components:
         materialId:
           type: integer
           description: 资料 Id
+        materialType:
+          type: integer
+          description: 资料类型 1 资料 2 视频
         status:
           type: integer
           description: 状态 1 已学习
@@ -1367,6 +1370,9 @@ components:
         userId:
           type: integer
           description: 用户 Id
+        materialType:
+          type: integer
+          description: 资料类型 1 资料 2 视频
     LearningTestpaperList:
       type: object
       properties: