63 lines
2.9 KiB
Go
63 lines
2.9 KiB
Go
package dao
|
|
|
|
import "dd_fiber_api/internal/question"
|
|
|
|
// QuestionDAOInterface 题目DAO接口
|
|
type QuestionDAOInterface interface {
|
|
Create(question *question.Question) error
|
|
GetByID(id string) (*question.Question, error)
|
|
Search(query string, qType question.QuestionType, knowledgeTreeIds []string, page, pageSize int32) ([]*question.Question, int32, error)
|
|
Update(question *question.Question) error
|
|
Delete(id string) error
|
|
BatchDelete(ids []string) (int, []string, error)
|
|
}
|
|
|
|
// PaperDAOInterface 试卷DAO接口
|
|
type PaperDAOInterface interface {
|
|
Create(paper *question.Paper) error
|
|
GetByID(id string) (*question.Paper, error)
|
|
GetWithQuestions(id string) (*question.Paper, error)
|
|
Search(query string, page, pageSize int32) ([]*question.Paper, int32, error)
|
|
Update(paper *question.Paper) error
|
|
Delete(id string) error
|
|
BatchDelete(ids []string) (int, []string, error)
|
|
AddQuestions(paperID string, questionIDs []string) (int, []string, error)
|
|
RemoveQuestions(paperID string, questionIDs []string) (int, []string, error)
|
|
}
|
|
|
|
// AnswerRecordDAOInterface 答题记录DAO接口
|
|
type AnswerRecordDAOInterface interface {
|
|
Create(record *question.AnswerRecord) error
|
|
GetByID(id string) (*question.AnswerRecord, error)
|
|
GetByUserAndQuestion(userID, questionID string) (*question.AnswerRecord, error)
|
|
GetByUserQuestionAndPaper(userID, questionID, paperID, taskID string) (*question.AnswerRecord, error)
|
|
GetByConditionsWithPagination(userID, questionID, paperID, taskID string, page, pageSize int32) ([]*question.AnswerRecord, int32, error)
|
|
Update(record *question.AnswerRecord) error
|
|
DeleteByUserID(userID string) (int64, error)
|
|
DeleteByUserAndPaper(userID, paperID, taskID string) (int64, error)
|
|
DeleteByUserAndTaskIDs(userID string, taskIDs []string) (int64, error)
|
|
GetPaperStatistics(userID, paperID, taskID string) (*question.PaperStatistics, error)
|
|
CountByUserAndPaper(userID, paperID, taskID string) (int64, error)
|
|
CountByUserAndPaperWithNonEmptyAnswer(userID, paperID, taskID string) (int64, error)
|
|
}
|
|
|
|
// MaterialDAOInterface 材料DAO接口
|
|
type MaterialDAOInterface interface {
|
|
Create(material *question.Material) error
|
|
GetByID(id string) (*question.Material, error)
|
|
Search(query string, materialType question.MaterialType, page, pageSize int32) ([]*question.Material, int32, error)
|
|
Update(material *question.Material) error
|
|
Delete(id string) error
|
|
}
|
|
|
|
// KnowledgeTreeDAOInterface 知识树DAO接口
|
|
type KnowledgeTreeDAOInterface interface {
|
|
Create(node *question.KnowledgeTree) error
|
|
GetByID(id string) (*question.KnowledgeTree, error)
|
|
GetAll(treeType question.KnowledgeTreeType) ([]*question.KnowledgeTree, error)
|
|
GetByParentID(parentID string, treeType question.KnowledgeTreeType) ([]*question.KnowledgeTree, error)
|
|
Update(node *question.KnowledgeTree) error
|
|
Delete(id string) error
|
|
GetTree(treeType question.KnowledgeTreeType) ([]*question.KnowledgeTree, error) // 获取完整树形结构
|
|
}
|