Browse Source

后台题目查询,更新,修改,删除接口

wangguixi/feature-20251107144650-股票知识测评
wangguixi 2 months ago
parent
commit
7a22dd79e2
  1. 27
      Knowledge_Test_Go/internal/dao/course_recommend.go
  2. 75
      Knowledge_Test_Go/internal/dao/internal/course_recommend.go
  3. 99
      Knowledge_Test_Go/internal/dao/internal/question_bank.go
  4. 83
      Knowledge_Test_Go/internal/dao/internal/question_record.go
  5. 75
      Knowledge_Test_Go/internal/dao/internal/question_type.go
  6. 79
      Knowledge_Test_Go/internal/dao/internal/total_score.go
  7. 81
      Knowledge_Test_Go/internal/dao/internal/user.go
  8. 27
      Knowledge_Test_Go/internal/dao/question_bank.go
  9. 27
      Knowledge_Test_Go/internal/dao/question_record.go
  10. 27
      Knowledge_Test_Go/internal/dao/question_type.go
  11. 27
      Knowledge_Test_Go/internal/dao/total_score.go
  12. 27
      Knowledge_Test_Go/internal/dao/user.go
  13. 10
      Knowledge_Test_Go/internal/logic/logic.go
  14. 16
      Knowledge_Test_Go/internal/model/do/course_recommend.go
  15. 29
      Knowledge_Test_Go/internal/model/do/question_bank.go
  16. 21
      Knowledge_Test_Go/internal/model/do/question_record.go
  17. 16
      Knowledge_Test_Go/internal/model/do/question_type.go
  18. 19
      Knowledge_Test_Go/internal/model/do/total_score.go
  19. 20
      Knowledge_Test_Go/internal/model/do/user.go
  20. 11
      Knowledge_Test_Go/internal/model/entity/course_recommend.go
  21. 27
      Knowledge_Test_Go/internal/model/entity/question_bank.go
  22. 19
      Knowledge_Test_Go/internal/model/entity/question_record.go
  23. 11
      Knowledge_Test_Go/internal/model/entity/question_type.go
  24. 17
      Knowledge_Test_Go/internal/model/entity/total_score.go
  25. 18
      Knowledge_Test_Go/internal/model/entity/user.go
  26. 40
      Knowledge_Test_Go/internal/service/knowledge.go
  27. 37
      Knowledge_Test_Go/internal/service/question_bank.go

27
Knowledge_Test_Go/internal/dao/course_recommend.go

@ -0,0 +1,27 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"Knowledge_Test_Go/internal/dao/internal"
)
// internalCourseRecommendDao is internal type for wrapping internal DAO implements.
type internalCourseRecommendDao = *internal.CourseRecommendDao
// courseRecommendDao is the data access object for table course_recommend.
// You can define custom methods on it to extend its functionality as you wish.
type courseRecommendDao struct {
internalCourseRecommendDao
}
var (
// CourseRecommend is globally public accessible object for table course_recommend operations.
CourseRecommend = courseRecommendDao{
internal.NewCourseRecommendDao(),
}
)
// Fill with you ideas below.

75
Knowledge_Test_Go/internal/dao/internal/course_recommend.go

@ -0,0 +1,75 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// CourseRecommendDao is the data access object for table course_recommend.
type CourseRecommendDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns CourseRecommendColumns // columns contains all the column names of Table for convenient usage.
}
// CourseRecommendColumns defines and stores column names for table course_recommend.
type CourseRecommendColumns struct {
Id string // 课程推荐主键
CrName string // 课程推荐名称
}
// courseRecommendColumns holds the columns for table course_recommend.
var courseRecommendColumns = CourseRecommendColumns{
Id: "id",
CrName: "cr_name",
}
// NewCourseRecommendDao creates and returns a new DAO object for table data access.
func NewCourseRecommendDao() *CourseRecommendDao {
return &CourseRecommendDao{
group: "default",
table: "course_recommend",
columns: courseRecommendColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *CourseRecommendDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *CourseRecommendDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *CourseRecommendDao) Columns() CourseRecommendColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *CourseRecommendDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *CourseRecommendDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *CourseRecommendDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

99
Knowledge_Test_Go/internal/dao/internal/question_bank.go

@ -0,0 +1,99 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// QuestionBankDao is the data access object for table question_bank.
type QuestionBankDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns QuestionBankColumns // columns contains all the column names of Table for convenient usage.
}
// QuestionBankColumns defines and stores column names for table question_bank.
type QuestionBankColumns struct {
Id string // 题库主键
Stem string // 题干
A string // A选项
B string // B选项
C string // C选项
D string // D选项
CorrectAnswer string // 正确答案
QuestionTypeId string // 题目类型
CourseRecommendationId string // 课程推荐
CitationCount string // 引用次数
ErrorCount string // 错误次数
CreatedAt string // 创建时间
UpdatedAt string // 修改时间
Isdel string // 逻辑删(1为删除)
}
// questionBankColumns holds the columns for table question_bank.
var questionBankColumns = QuestionBankColumns{
Id: "id",
Stem: "stem",
A: "A",
B: "B",
C: "C",
D: "D",
CorrectAnswer: "correct_answer",
QuestionTypeId: "question_type_id",
CourseRecommendationId: "course_recommendation_id",
CitationCount: "citation_count",
ErrorCount: "error_count",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
Isdel: "isdel",
}
// NewQuestionBankDao creates and returns a new DAO object for table data access.
func NewQuestionBankDao() *QuestionBankDao {
return &QuestionBankDao{
group: "default",
table: "question_bank",
columns: questionBankColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *QuestionBankDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *QuestionBankDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *QuestionBankDao) Columns() QuestionBankColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *QuestionBankDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *QuestionBankDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *QuestionBankDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

83
Knowledge_Test_Go/internal/dao/internal/question_record.go

@ -0,0 +1,83 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// QuestionRecordDao is the data access object for table question_record.
type QuestionRecordDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns QuestionRecordColumns // columns contains all the column names of Table for convenient usage.
}
// QuestionRecordColumns defines and stores column names for table question_record.
type QuestionRecordColumns struct {
Id string // 题目记录主键
Jwcode string // 精网号
QuestionBankId string // 题目id
UserAnswer string // 用户答案
IsCorrect string // 是否正确(0为正确)
CreatedAt string // 提交时间
}
// questionRecordColumns holds the columns for table question_record.
var questionRecordColumns = QuestionRecordColumns{
Id: "id",
Jwcode: "jwcode",
QuestionBankId: "question_bank_id",
UserAnswer: "user_answer",
IsCorrect: "is_correct",
CreatedAt: "created_at",
}
// NewQuestionRecordDao creates and returns a new DAO object for table data access.
func NewQuestionRecordDao() *QuestionRecordDao {
return &QuestionRecordDao{
group: "default",
table: "question_record",
columns: questionRecordColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *QuestionRecordDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *QuestionRecordDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *QuestionRecordDao) Columns() QuestionRecordColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *QuestionRecordDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *QuestionRecordDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *QuestionRecordDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

75
Knowledge_Test_Go/internal/dao/internal/question_type.go

@ -0,0 +1,75 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// QuestionTypeDao is the data access object for table question_type.
type QuestionTypeDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns QuestionTypeColumns // columns contains all the column names of Table for convenient usage.
}
// QuestionTypeColumns defines and stores column names for table question_type.
type QuestionTypeColumns struct {
Id string // 题库类型主键
QuestionTypeName string // 题目类型名称
}
// questionTypeColumns holds the columns for table question_type.
var questionTypeColumns = QuestionTypeColumns{
Id: "id",
QuestionTypeName: "question_type_name",
}
// NewQuestionTypeDao creates and returns a new DAO object for table data access.
func NewQuestionTypeDao() *QuestionTypeDao {
return &QuestionTypeDao{
group: "default",
table: "question_type",
columns: questionTypeColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *QuestionTypeDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *QuestionTypeDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *QuestionTypeDao) Columns() QuestionTypeColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *QuestionTypeDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *QuestionTypeDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *QuestionTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

79
Knowledge_Test_Go/internal/dao/internal/total_score.go

@ -0,0 +1,79 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// TotalScoreDao is the data access object for table total_score.
type TotalScoreDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns TotalScoreColumns // columns contains all the column names of Table for convenient usage.
}
// TotalScoreColumns defines and stores column names for table total_score.
type TotalScoreColumns struct {
Id string // 总成绩主键
Jwcode string // 精网号
Score string // 成绩
CreatedAt string // 提交时间
}
// totalScoreColumns holds the columns for table total_score.
var totalScoreColumns = TotalScoreColumns{
Id: "id",
Jwcode: "jwcode",
Score: "score",
CreatedAt: "created_at",
}
// NewTotalScoreDao creates and returns a new DAO object for table data access.
func NewTotalScoreDao() *TotalScoreDao {
return &TotalScoreDao{
group: "default",
table: "total_score",
columns: totalScoreColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *TotalScoreDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *TotalScoreDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *TotalScoreDao) Columns() TotalScoreColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *TotalScoreDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *TotalScoreDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *TotalScoreDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

81
Knowledge_Test_Go/internal/dao/internal/user.go

@ -0,0 +1,81 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// UserDao is the data access object for table user.
type UserDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns UserColumns // columns contains all the column names of Table for convenient usage.
}
// UserColumns defines and stores column names for table user.
type UserColumns struct {
Id string // 用户主键
UserName string // 用户名称
Jwcode string // 精网号
UserIdentity string // 用户身份
CreatedAt string // 创建时间
}
// userColumns holds the columns for table user.
var userColumns = UserColumns{
Id: "id",
UserName: "user_name",
Jwcode: "jwcode",
UserIdentity: "user_identity",
CreatedAt: "created_at",
}
// NewUserDao creates and returns a new DAO object for table data access.
func NewUserDao() *UserDao {
return &UserDao{
group: "default",
table: "user",
columns: userColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *UserDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *UserDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *UserDao) Columns() UserColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *UserDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *UserDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *UserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

27
Knowledge_Test_Go/internal/dao/question_bank.go

@ -0,0 +1,27 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"Knowledge_Test_Go/internal/dao/internal"
)
// internalQuestionBankDao is internal type for wrapping internal DAO implements.
type internalQuestionBankDao = *internal.QuestionBankDao
// questionBankDao is the data access object for table question_bank.
// You can define custom methods on it to extend its functionality as you wish.
type questionBankDao struct {
internalQuestionBankDao
}
var (
// QuestionBank is globally public accessible object for table question_bank operations.
QuestionBank = questionBankDao{
internal.NewQuestionBankDao(),
}
)
// Fill with you ideas below.

27
Knowledge_Test_Go/internal/dao/question_record.go

@ -0,0 +1,27 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"Knowledge_Test_Go/internal/dao/internal"
)
// internalQuestionRecordDao is internal type for wrapping internal DAO implements.
type internalQuestionRecordDao = *internal.QuestionRecordDao
// questionRecordDao is the data access object for table question_record.
// You can define custom methods on it to extend its functionality as you wish.
type questionRecordDao struct {
internalQuestionRecordDao
}
var (
// QuestionRecord is globally public accessible object for table question_record operations.
QuestionRecord = questionRecordDao{
internal.NewQuestionRecordDao(),
}
)
// Fill with you ideas below.

27
Knowledge_Test_Go/internal/dao/question_type.go

@ -0,0 +1,27 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"Knowledge_Test_Go/internal/dao/internal"
)
// internalQuestionTypeDao is internal type for wrapping internal DAO implements.
type internalQuestionTypeDao = *internal.QuestionTypeDao
// questionTypeDao is the data access object for table question_type.
// You can define custom methods on it to extend its functionality as you wish.
type questionTypeDao struct {
internalQuestionTypeDao
}
var (
// QuestionType is globally public accessible object for table question_type operations.
QuestionType = questionTypeDao{
internal.NewQuestionTypeDao(),
}
)
// Fill with you ideas below.

27
Knowledge_Test_Go/internal/dao/total_score.go

@ -0,0 +1,27 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"Knowledge_Test_Go/internal/dao/internal"
)
// internalTotalScoreDao is internal type for wrapping internal DAO implements.
type internalTotalScoreDao = *internal.TotalScoreDao
// totalScoreDao is the data access object for table total_score.
// You can define custom methods on it to extend its functionality as you wish.
type totalScoreDao struct {
internalTotalScoreDao
}
var (
// TotalScore is globally public accessible object for table total_score operations.
TotalScore = totalScoreDao{
internal.NewTotalScoreDao(),
}
)
// Fill with you ideas below.

27
Knowledge_Test_Go/internal/dao/user.go

@ -0,0 +1,27 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"Knowledge_Test_Go/internal/dao/internal"
)
// internalUserDao is internal type for wrapping internal DAO implements.
type internalUserDao = *internal.UserDao
// userDao is the data access object for table user.
// You can define custom methods on it to extend its functionality as you wish.
type userDao struct {
internalUserDao
}
var (
// User is globally public accessible object for table user operations.
User = userDao{
internal.NewUserDao(),
}
)
// Fill with you ideas below.

10
Knowledge_Test_Go/internal/logic/logic.go

@ -0,0 +1,10 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package logic
import (
_ "Knowledge_Test_Go/internal/logic/knowledge"
_ "Knowledge_Test_Go/internal/logic/questionBank"
)

16
Knowledge_Test_Go/internal/model/do/course_recommend.go

@ -0,0 +1,16 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
)
// CourseRecommend is the golang structure of table course_recommend for DAO operations like Where/Data.
type CourseRecommend struct {
g.Meta `orm:"table:course_recommend, do:true"`
Id interface{} // 课程推荐主键
CrName interface{} // 课程推荐名称
}

29
Knowledge_Test_Go/internal/model/do/question_bank.go

@ -0,0 +1,29 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// QuestionBank is the golang structure of table question_bank for DAO operations like Where/Data.
type QuestionBank struct {
g.Meta `orm:"table:question_bank, do:true"`
Id interface{} // 题库主键
Stem interface{} // 题干
A interface{} // A选项
B interface{} // B选项
C interface{} // C选项
D interface{} // D选项
CorrectAnswer interface{} // 正确答案
QuestionTypeId interface{} // 题目类型
CourseRecommendationId interface{} // 课程推荐
CitationCount interface{} // 引用次数
ErrorCount interface{} // 错误次数
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 修改时间
Isdel interface{} // 逻辑删(1为删除)
}

21
Knowledge_Test_Go/internal/model/do/question_record.go

@ -0,0 +1,21 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// QuestionRecord is the golang structure of table question_record for DAO operations like Where/Data.
type QuestionRecord struct {
g.Meta `orm:"table:question_record, do:true"`
Id interface{} // 题目记录主键
Jwcode interface{} // 精网号
QuestionBankId interface{} // 题目id
UserAnswer interface{} // 用户答案
IsCorrect interface{} // 是否正确(0为正确)
CreatedAt *gtime.Time // 提交时间
}

16
Knowledge_Test_Go/internal/model/do/question_type.go

@ -0,0 +1,16 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
)
// QuestionType is the golang structure of table question_type for DAO operations like Where/Data.
type QuestionType struct {
g.Meta `orm:"table:question_type, do:true"`
Id interface{} // 题库类型主键
QuestionTypeName interface{} // 题目类型名称
}

19
Knowledge_Test_Go/internal/model/do/total_score.go

@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// TotalScore is the golang structure of table total_score for DAO operations like Where/Data.
type TotalScore struct {
g.Meta `orm:"table:total_score, do:true"`
Id interface{} // 总成绩主键
Jwcode interface{} // 精网号
Score interface{} // 成绩
CreatedAt *gtime.Time // 提交时间
}

20
Knowledge_Test_Go/internal/model/do/user.go

@ -0,0 +1,20 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// User is the golang structure of table user for DAO operations like Where/Data.
type User struct {
g.Meta `orm:"table:user, do:true"`
Id interface{} // 用户主键
UserName interface{} // 用户名称
Jwcode interface{} // 精网号
UserIdentity interface{} // 用户身份
CreatedAt *gtime.Time // 创建时间
}

11
Knowledge_Test_Go/internal/model/entity/course_recommend.go

@ -0,0 +1,11 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
// CourseRecommend is the golang structure for table course_recommend.
type CourseRecommend struct {
Id int `json:"id" orm:"id" ` // 课程推荐主键
CrName string `json:"crName" orm:"cr_name" ` // 课程推荐名称
}

27
Knowledge_Test_Go/internal/model/entity/question_bank.go

@ -0,0 +1,27 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// QuestionBank is the golang structure for table question_bank.
type QuestionBank struct {
Id int `json:"id" orm:"id" ` // 题库主键
Stem string `json:"stem" orm:"stem" ` // 题干
A string `json:"a" orm:"A" ` // A选项
B string `json:"b" orm:"B" ` // B选项
C string `json:"c" orm:"C" ` // C选项
D string `json:"d" orm:"D" ` // D选项
CorrectAnswer string `json:"correctAnswer" orm:"correct_answer" ` // 正确答案
QuestionTypeId int `json:"questionTypeId" orm:"question_type_id" ` // 题目类型
CourseRecommendationId int `json:"courseRecommendationId" orm:"course_recommendation_id" ` // 课程推荐
CitationCount int `json:"citationCount" orm:"citation_count" ` // 引用次数
ErrorCount int `json:"errorCount" orm:"error_count" ` // 错误次数
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" ` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" ` // 修改时间
Isdel int `json:"isdel" orm:"isdel" ` // 逻辑删(1为删除)
}

19
Knowledge_Test_Go/internal/model/entity/question_record.go

@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// QuestionRecord is the golang structure for table question_record.
type QuestionRecord struct {
Id int `json:"id" orm:"id" ` // 题目记录主键
Jwcode int `json:"jwcode" orm:"jwcode" ` // 精网号
QuestionBankId int `json:"questionBankId" orm:"question_bank_id" ` // 题目id
UserAnswer string `json:"userAnswer" orm:"user_answer" ` // 用户答案
IsCorrect int `json:"isCorrect" orm:"is_correct" ` // 是否正确(0为正确)
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" ` // 提交时间
}

11
Knowledge_Test_Go/internal/model/entity/question_type.go

@ -0,0 +1,11 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
// QuestionType is the golang structure for table question_type.
type QuestionType struct {
Id int `json:"id" orm:"id" ` // 题库类型主键
QuestionTypeName string `json:"questionTypeName" orm:"question_type_name" ` // 题目类型名称
}

17
Knowledge_Test_Go/internal/model/entity/total_score.go

@ -0,0 +1,17 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// TotalScore is the golang structure for table total_score.
type TotalScore struct {
Id int `json:"id" orm:"id" ` // 总成绩主键
Jwcode int `json:"jwcode" orm:"jwcode" ` // 精网号
Score int `json:"score" orm:"score" ` // 成绩
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" ` // 提交时间
}

18
Knowledge_Test_Go/internal/model/entity/user.go

@ -0,0 +1,18 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// User is the golang structure for table user.
type User struct {
Id int `json:"id" orm:"id" ` // 用户主键
UserName string `json:"userName" orm:"user_name" ` // 用户名称
Jwcode string `json:"jwcode" orm:"jwcode" ` // 精网号
UserIdentity string `json:"userIdentity" orm:"user_identity" ` // 用户身份
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" ` // 创建时间
}

40
Knowledge_Test_Go/internal/service/knowledge.go

@ -0,0 +1,40 @@
// ================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
v1 "Knowledge_Test_Go/api/v1"
"context"
)
type (
IKnowledgeTest interface {
// GetQuestions 获取题目列表
GetQuestions(ctx context.Context, req *v1.GetQuestionsReq) (res []*v1.GetQuestionsRes, total int, err error)
//-----------------------------------------------------------------------------------------------------------------------------------------------
// GetUserScores 获取用户成绩
GetUserScores(ctx context.Context, req *v1.GetUserScoresReq) (res []*v1.GetUserScoresRes, err error)
// SubmitAnswers 提交答案并计算分数
SubmitAnswers(ctx context.Context, req *v1.SubmitAnswersReq) (*v1.SubmitAnswersRes, error)
// GetWrongQuestions 获取错题列表
GetWrongQuestions(ctx context.Context, req *v1.GetWrongQuestionsReq) (res []*v1.GetWrongQuestionsRes, total int, err error)
}
)
var (
localKnowledgeTest IKnowledgeTest
)
func KnowledgeTest() IKnowledgeTest {
if localKnowledgeTest == nil {
panic("implement not found for interface IKnowledgeTest, forgot register?")
}
return localKnowledgeTest
}
func RegisterKnowledgeTest(i IKnowledgeTest) {
localKnowledgeTest = i
}

37
Knowledge_Test_Go/internal/service/question_bank.go

@ -0,0 +1,37 @@
// ================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
v1 "Knowledge_Test_Go/api/v1"
"context"
)
type (
IQuestionBank interface {
// GetQuestions 获取题目列表
GetQuestions(ctx context.Context, req *v1.QuestionOutputReq) (res []*v1.QuestionOutputRes, total int, err error)
// QuestionUpdate 修改题目
QuestionUpdate(ctx context.Context, req *v1.QuestionUpdateReq) (res string, err error)
// QuestionDel 删除题目
QuestionDel(ctx context.Context, req *v1.QuestionDelReq) (res string, err error)
}
)
var (
localQuestionBank IQuestionBank
)
func QuestionBank() IQuestionBank {
if localQuestionBank == nil {
panic("implement not found for interface IQuestionBank, forgot register?")
}
return localQuestionBank
}
func RegisterQuestionBank(i IQuestionBank) {
localQuestionBank = i
}
Loading…
Cancel
Save