feat: 🎸 课程章节管理

This commit is contained in:
GoCo 2025-07-25 16:52:32 +08:00
parent f574831f15
commit 903e7ba861
15 changed files with 686 additions and 7 deletions

View File

@ -0,0 +1,59 @@
// Package lessonsection
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.17.8
package lessonsection
import (
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"github.com/gogf/gf/v2/frame/g"
)
// ListReq 查询课程章节列表
type ListReq struct {
g.Meta `path:"/lessonSection/list" method:"get" tags:"课程章节" summary:"获取课程章节列表"`
sysin.LessonSectionListInp
}
type ListRes struct {
form.PageRes
List []*sysin.LessonSectionListModel `json:"list" dc:"数据列表"`
}
// ExportReq 导出课程章节列表
type ExportReq struct {
g.Meta `path:"/lessonSection/export" method:"get" tags:"课程章节" summary:"导出课程章节列表"`
sysin.LessonSectionListInp
}
type ExportRes struct{}
// ViewReq 获取课程章节指定信息
type ViewReq struct {
g.Meta `path:"/lessonSection/view" method:"get" tags:"课程章节" summary:"获取课程章节指定信息"`
sysin.LessonSectionViewInp
}
type ViewRes struct {
*sysin.LessonSectionViewModel
}
// EditReq 修改/新增课程章节
type EditReq struct {
g.Meta `path:"/lessonSection/edit" method:"post" tags:"课程章节" summary:"修改/新增课程章节"`
sysin.LessonSectionEditInp
}
type EditRes struct{}
// DeleteReq 删除课程章节
type DeleteReq struct {
g.Meta `path:"/lessonSection/delete" method:"post" tags:"课程章节" summary:"删除课程章节"`
sysin.LessonSectionDeleteInp
}
type DeleteRes struct{}

View File

@ -0,0 +1,67 @@
// Package sys
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.17.8
package sys
import (
"context"
"hotgo/api/admin/lessonsection"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
var (
LessonSection = cLessonSection{}
)
type cLessonSection struct{}
// List 查看课程章节列表
func (c *cLessonSection) List(ctx context.Context, req *lessonsection.ListReq) (res *lessonsection.ListRes, err error) {
list, totalCount, err := service.SysLessonSection().List(ctx, &req.LessonSectionListInp)
if err != nil {
return
}
if list == nil {
list = []*sysin.LessonSectionListModel{}
}
res = new(lessonsection.ListRes)
res.List = list
res.PageRes.Pack(req, totalCount)
return
}
// Export 导出课程章节列表
func (c *cLessonSection) Export(ctx context.Context, req *lessonsection.ExportReq) (res *lessonsection.ExportRes, err error) {
err = service.SysLessonSection().Export(ctx, &req.LessonSectionListInp)
return
}
// Edit 更新课程章节
func (c *cLessonSection) Edit(ctx context.Context, req *lessonsection.EditReq) (res *lessonsection.EditRes, err error) {
err = service.SysLessonSection().Edit(ctx, &req.LessonSectionEditInp)
return
}
// View 获取指定课程章节信息
func (c *cLessonSection) View(ctx context.Context, req *lessonsection.ViewReq) (res *lessonsection.ViewRes, err error) {
data, err := service.SysLessonSection().View(ctx, &req.LessonSectionViewInp)
if err != nil {
return
}
res = new(lessonsection.ViewRes)
res.LessonSectionViewModel = data
return
}
// Delete 删除课程章节
func (c *cLessonSection) Delete(ctx context.Context, req *lessonsection.DeleteReq) (res *lessonsection.DeleteRes, err error) {
err = service.SysLessonSection().Delete(ctx, &req.LessonSectionDeleteInp)
return
}

View File

@ -0,0 +1,101 @@
// ==========================================================================
// 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"
)
// LessonSectionDao is the data access object for the table hg_lesson_section.
type LessonSectionDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns LessonSectionColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// LessonSectionColumns defines and stores column names for the table hg_lesson_section.
type LessonSectionColumns struct {
Id string // id
LessonId string // 课程id
VideoUrl string // 视频url
Name string // 章节名
SortOrder string // 排序号
ParentId string // 父章节id
Level string // 章节层级;1=章2=节
Revision string // 乐观锁
CreatedBy string // 创建人
CreatedTime string // 创建时间
UpdatedBy string // 更新人
UpdatedTime string // 更新时间
}
// lessonSectionColumns holds the columns for the table hg_lesson_section.
var lessonSectionColumns = LessonSectionColumns{
Id: "id",
LessonId: "lesson_id",
VideoUrl: "video_url",
Name: "name",
SortOrder: "sort_order",
ParentId: "parent_id",
Level: "level",
Revision: "revision",
CreatedBy: "created_by",
CreatedTime: "created_time",
UpdatedBy: "updated_by",
UpdatedTime: "updated_time",
}
// NewLessonSectionDao creates and returns a new DAO object for table data access.
func NewLessonSectionDao(handlers ...gdb.ModelHandler) *LessonSectionDao {
return &LessonSectionDao{
group: "default",
table: "hg_lesson_section",
columns: lessonSectionColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *LessonSectionDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *LessonSectionDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *LessonSectionDao) Columns() LessonSectionColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *LessonSectionDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *LessonSectionDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *LessonSectionDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -0,0 +1,22 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"hotgo/internal/dao/internal"
)
// lessonSectionDao is the data access object for the table hg_lesson_section.
// You can define custom methods on it to extend its functionality as needed.
type lessonSectionDao struct {
*internal.LessonSectionDao
}
var (
// LessonSection is a globally accessible object for table hg_lesson_section operations.
LessonSection = lessonSectionDao{internal.NewLessonSectionDao()}
)
// Add your custom methods and functionality below.

View File

@ -12,6 +12,7 @@ import (
"hotgo/internal/dao"
"hotgo/internal/library/contexts"
"hotgo/internal/library/hgorm/handler"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
@ -23,6 +24,9 @@ import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/library/dict"
"hotgo/internal/model"
)
type sSysLesson struct{}
@ -33,6 +37,7 @@ func NewSysLesson() *sSysLesson {
func init() {
service.RegisterSysLesson(NewSysLesson())
dict.RegisterFunc("lessonOption", "课程管理选项", service.SysLesson().Option)
}
// Model 课程管理ORM模型
@ -141,4 +146,20 @@ func (s *sSysLesson) View(ctx context.Context, in *sysin.LessonViewInp) (res *sy
return
}
return
}
// Option 获取课程管理选项
func (s *sSysLesson) Option(ctx context.Context) (opts []*model.Option, err error) {
var models []*entity.Lesson
if err = s.Model(ctx).Fields(dao.Lesson.Columns().Id, dao.Lesson.Columns().Name).
OrderDesc(dao.Lesson.Columns().Id).Scan(&models); err != nil {
err = gerror.Wrap(err, "获取课程管理选项失败!")
return
}
opts = make([]*model.Option, len(models))
for k, v := range models {
opts[k] = dict.GenHashOption(v.Id, gconv.String(v.Name))
}
return
}

View File

@ -0,0 +1,143 @@
// Package sys
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.17.8
package sys
import (
"context"
"fmt"
"hotgo/internal/dao"
"hotgo/internal/library/contexts"
"hotgo/internal/library/hgorm/handler"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
"hotgo/utility/convert"
"hotgo/utility/excel"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/util/gconv"
)
type sSysLessonSection struct{}
func NewSysLessonSection() *sSysLessonSection {
return &sSysLessonSection{}
}
func init() {
service.RegisterSysLessonSection(NewSysLessonSection())
}
// Model 课程章节ORM模型
func (s *sSysLessonSection) Model(ctx context.Context, option ...*handler.Option) *gdb.Model {
return handler.Model(dao.LessonSection.Ctx(ctx), option...)
}
// List 获取课程章节列表
func (s *sSysLessonSection) List(ctx context.Context, in *sysin.LessonSectionListInp) (list []*sysin.LessonSectionListModel, totalCount int, err error) {
mod := s.Model(ctx)
// 字段过滤
mod = mod.Fields(sysin.LessonSectionListModel{})
// 查询id
if in.Id > 0 {
mod = mod.Where(dao.LessonSection.Columns().Id, in.Id)
}
// 分页
mod = mod.Page(in.Page, in.PerPage)
// 排序
mod = mod.OrderDesc(dao.LessonSection.Columns().Id)
// 操作人摘要信息
mod = mod.Hook(hook.MemberSummary)
// 查询数据
if err = mod.ScanAndCount(&list, &totalCount, false); err != nil {
err = gerror.Wrap(err, "获取课程章节列表失败,请稍后重试!")
return
}
return
}
// Export 导出课程章节
func (s *sSysLessonSection) Export(ctx context.Context, in *sysin.LessonSectionListInp) (err error) {
list, totalCount, err := s.List(ctx, in)
if err != nil {
return
}
// 字段的排序是依据tags的字段顺序如果你不想使用默认的排序方式可以直接定义 tags = []string{"字段名称", "字段名称2", ...}
tags, err := convert.GetEntityDescTags(sysin.LessonSectionExportModel{})
if err != nil {
return
}
var (
fileName = "导出课程章节-" + gctx.CtxId(ctx)
sheetName = fmt.Sprintf("索引条件共%v行,共%v页,当前导出是第%v页,本页共%v行", totalCount, form.CalPageCount(totalCount, in.PerPage), in.Page, len(list))
exports []sysin.LessonSectionExportModel
)
if err = gconv.Scan(list, &exports); err != nil {
return
}
err = excel.ExportByStructs(ctx, tags, exports, fileName, sheetName)
return
}
// Edit 修改/新增课程章节
func (s *sSysLessonSection) Edit(ctx context.Context, in *sysin.LessonSectionEditInp) (err error) {
return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
// 修改
if in.Id > 0 {
in.UpdatedBy = contexts.GetUserId(ctx)
if _, err = s.Model(ctx).
Fields(sysin.LessonSectionUpdateFields{}).
WherePri(in.Id).Data(in).Update(); err != nil {
err = gerror.Wrap(err, "修改课程章节失败,请稍后重试!")
}
return
}
// 新增
in.CreatedBy = contexts.GetUserId(ctx)
if _, err = s.Model(ctx, &handler.Option{FilterAuth: false}).
Fields(sysin.LessonSectionInsertFields{}).
Data(in).OmitEmptyData().Insert(); err != nil {
err = gerror.Wrap(err, "新增课程章节失败,请稍后重试!")
}
return
})
}
// Delete 删除课程章节
func (s *sSysLessonSection) Delete(ctx context.Context, in *sysin.LessonSectionDeleteInp) (err error) {
if _, err = s.Model(ctx).WherePri(in.Id).Unscoped().Delete(); err != nil {
err = gerror.Wrap(err, "删除课程章节失败,请稍后重试!")
return
}
return
}
// View 获取课程章节指定信息
func (s *sSysLessonSection) View(ctx context.Context, in *sysin.LessonSectionViewInp) (res *sysin.LessonSectionViewModel, err error) {
if err = s.Model(ctx).WherePri(in.Id).Hook(hook.MemberSummary).Scan(&res); err != nil {
err = gerror.Wrap(err, "获取课程章节信息,请稍后重试!")
return
}
return
}

View File

@ -0,0 +1,27 @@
// =================================================================================
// 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"
)
// LessonSection is the golang structure of table hg_lesson_section for DAO operations like Where/Data.
type LessonSection struct {
g.Meta `orm:"table:hg_lesson_section, do:true"`
Id interface{} // id
LessonId interface{} // 课程id
VideoUrl interface{} // 视频url
Name interface{} // 章节名
SortOrder interface{} // 排序号
ParentId interface{} // 父章节id
Level interface{} // 章节层级;1=章2=节
Revision interface{} // 乐观锁
CreatedBy interface{} // 创建人
CreatedTime *gtime.Time // 创建时间
UpdatedBy interface{} // 更新人
UpdatedTime *gtime.Time // 更新时间
}

View File

@ -24,7 +24,7 @@ type Lesson struct {
Arrangement string `json:"arrangement" orm:"arrangement" description:"学时安排"`
StartTime *gtime.Time `json:"startTime" orm:"start_time" description:"开课时间"`
EndTime *gtime.Time `json:"endTime" orm:"end_time" description:"结课时间"`
Revision int64 `json:"revision" orm:"revision" description:"乐观锁"`
Revision int `json:"revision" orm:"revision" description:"乐观锁"`
Question string `json:"question" orm:"question" description:"常见问题"`
CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建人"`
CreatedTime *gtime.Time `json:"createdTime" orm:"created_time" description:"创建时间"`

View File

@ -12,8 +12,8 @@ import (
type LessonCategory struct {
Id int64 `json:"id" orm:"id" description:"id"`
Name string `json:"name" orm:"name" description:"分类名"`
SortOrder int64 `json:"sortOrder" orm:"sort_order" description:"排序"`
Revision int64 `json:"revision" orm:"revision" description:"乐观锁"`
SortOrder int `json:"sortOrder" orm:"sort_order" description:"排序"`
Revision int `json:"revision" orm:"revision" description:"乐观锁"`
CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建人"`
CreatedTime *gtime.Time `json:"createdTime" orm:"created_time" description:"创建时间"`
UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新人"`

View File

@ -0,0 +1,25 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// LessonSection is the golang structure for table lesson_section.
type LessonSection struct {
Id int64 `json:"id" orm:"id" description:"id"`
LessonId int64 `json:"lessonId" orm:"lesson_id" description:"课程id"`
VideoUrl string `json:"videoUrl" orm:"video_url" description:"视频url"`
Name string `json:"name" orm:"name" description:"章节名"`
SortOrder int `json:"sortOrder" orm:"sort_order" description:"排序号"`
ParentId int `json:"parentId" orm:"parent_id" description:"父章节id"`
Level int `json:"level" orm:"level" description:"章节层级;1=章2=节"`
Revision int `json:"revision" orm:"revision" description:"乐观锁"`
CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建人"`
CreatedTime *gtime.Time `json:"createdTime" orm:"created_time" description:"创建时间"`
UpdatedBy int64 `json:"updatedBy" orm:"updated_by" description:"更新人"`
UpdatedTime *gtime.Time `json:"updatedTime" orm:"updated_time" description:"更新时间"`
}

View File

@ -19,15 +19,15 @@ type Users struct {
Password string `json:"password" orm:"password" description:"密码"`
Salt string `json:"salt" orm:"salt" description:"密码盐"`
Realname string `json:"realname" orm:"realname" description:"真实姓名"`
Gender int64 `json:"gender" orm:"gender" description:"性别"`
Gender int `json:"gender" orm:"gender" description:"性别"`
Birthday string `json:"birthday" orm:"birthday" description:"生日"`
School string `json:"school" orm:"school" description:"学校"`
Grade string `json:"grade" orm:"grade" description:"学历"`
Major string `json:"major" orm:"major" description:"专业"`
Status int64 `json:"status" orm:"status" description:"用户状态"`
Status int `json:"status" orm:"status" description:"用户状态"`
VerificationToken string `json:"verificationToken" orm:"verification_token" description:"邮箱验证令牌"`
EmailVerified int64 `json:"emailVerified" orm:"email_verified" description:"邮箱验证状态"`
EmailVerified int `json:"emailVerified" orm:"email_verified" description:"邮箱验证状态"`
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"注册时间"`
LastLogin *gtime.Time `json:"lastLogin" orm:"last_login" description:"最后登录时间"`
LoginCount int64 `json:"loginCount" orm:"login_count" description:"累计登录次数"`
LoginCount int `json:"loginCount" orm:"login_count" description:"累计登录次数"`
}

View File

@ -0,0 +1,111 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.17.8
package sysin
import (
"context"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// LessonSectionUpdateFields 修改课程章节字段过滤
type LessonSectionUpdateFields struct {
LessonId int64 `json:"lessonId" dc:"课程id"`
VideoUrl string `json:"videoUrl" dc:"视频url"`
Name string `json:"name" dc:"章节名"`
SortOrder int `json:"sortOrder" dc:"排序号"`
ParentId int `json:"parentId" dc:"父章节id"`
Level int `json:"level" dc:"章节层级"`
UpdatedBy int64 `json:"updatedBy" dc:"更新人"`
}
// LessonSectionInsertFields 新增课程章节字段过滤
type LessonSectionInsertFields struct {
LessonId int64 `json:"lessonId" dc:"课程id"`
VideoUrl string `json:"videoUrl" dc:"视频url"`
Name string `json:"name" dc:"章节名"`
SortOrder int `json:"sortOrder" dc:"排序号"`
ParentId int `json:"parentId" dc:"父章节id"`
Level int `json:"level" dc:"章节层级"`
CreatedBy int64 `json:"createdBy" dc:"创建人"`
}
// LessonSectionEditInp 修改/新增课程章节
type LessonSectionEditInp struct {
entity.LessonSection
}
func (in *LessonSectionEditInp) Filter(ctx context.Context) (err error) {
return
}
type LessonSectionEditModel struct{}
// LessonSectionDeleteInp 删除课程章节
type LessonSectionDeleteInp struct {
Id interface{} `json:"id" v:"required#id不能为空" dc:"id"`
}
func (in *LessonSectionDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type LessonSectionDeleteModel struct{}
// LessonSectionViewInp 获取指定课程章节信息
type LessonSectionViewInp struct {
Id int64 `json:"id" v:"required#id不能为空" dc:"id"`
}
func (in *LessonSectionViewInp) Filter(ctx context.Context) (err error) {
return
}
type LessonSectionViewModel struct {
entity.LessonSection
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建人摘要信息"`
UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新人摘要信息"`
}
// LessonSectionListInp 获取课程章节列表
type LessonSectionListInp struct {
form.PageReq
Id int64 `json:"id" dc:"id"`
}
func (in *LessonSectionListInp) Filter(ctx context.Context) (err error) {
return
}
type LessonSectionListModel struct {
Id int64 `json:"id" dc:"id"`
LessonId int64 `json:"lessonId" dc:"课程id"`
VideoUrl string `json:"videoUrl" dc:"视频url"`
Name string `json:"name" dc:"章节名"`
SortOrder int `json:"sortOrder" dc:"排序号"`
ParentId int `json:"parentId" dc:"父章节id"`
Level int `json:"level" dc:"章节层级"`
CreatedBy int64 `json:"createdBy" dc:"创建人"`
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建人摘要信息"`
UpdatedBy int64 `json:"updatedBy" dc:"更新人"`
UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新人摘要信息"`
}
// LessonSectionExportModel 导出课程章节
type LessonSectionExportModel struct {
Id int64 `json:"id" dc:"id"`
LessonId int64 `json:"lessonId" dc:"课程id"`
VideoUrl string `json:"videoUrl" dc:"视频url"`
Name string `json:"name" dc:"章节名"`
SortOrder int `json:"sortOrder" dc:"排序号"`
ParentId int `json:"parentId" dc:"父章节id"`
Level int `json:"level" dc:"章节层级"`
CreatedBy int64 `json:"createdBy" dc:"创建人"`
UpdatedBy int64 `json:"updatedBy" dc:"更新人"`
}

View File

@ -0,0 +1,13 @@
// Package genrouter
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.17.8
package genrouter
import "hotgo/internal/controller/admin/sys"
func init() {
LoginRequiredRouter = append(LoginRequiredRouter, sys.LessonSection) // 课程章节
}

View File

@ -260,6 +260,8 @@ type (
Delete(ctx context.Context, in *sysin.LessonDeleteInp) (err error)
// View 获取课程管理指定信息
View(ctx context.Context, in *sysin.LessonViewInp) (res *sysin.LessonViewModel, err error)
// Option 获取课程管理选项
Option(ctx context.Context) (opts []*model.Option, err error)
}
ISysLessonCategory interface {
// Model 课程分类ORM模型
@ -277,6 +279,20 @@ type (
// Option 获取课程分类选项
Option(ctx context.Context) (opts []*model.Option, err error)
}
ISysLessonSection interface {
// Model 课程章节ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取课程章节列表
List(ctx context.Context, in *sysin.LessonSectionListInp) (list []*sysin.LessonSectionListModel, totalCount int, err error)
// Export 导出课程章节
Export(ctx context.Context, in *sysin.LessonSectionListInp) (err error)
// Edit 修改/新增课程章节
Edit(ctx context.Context, in *sysin.LessonSectionEditInp) (err error)
// Delete 删除课程章节
Delete(ctx context.Context, in *sysin.LessonSectionDeleteInp) (err error)
// View 获取课程章节指定信息
View(ctx context.Context, in *sysin.LessonSectionViewInp) (res *sysin.LessonSectionViewModel, err error)
}
ISysLog interface {
// Model 请求日志Orm模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
@ -466,6 +482,7 @@ var (
localSysGenCodes ISysGenCodes
localSysLesson ISysLesson
localSysLessonCategory ISysLessonCategory
localSysLessonSection ISysLessonSection
localSysLog ISysLog
localSysLoginLog ISysLoginLog
localSysNormalTreeDemo ISysNormalTreeDemo
@ -632,6 +649,17 @@ func RegisterSysLessonCategory(i ISysLessonCategory) {
localSysLessonCategory = i
}
func SysLessonSection() ISysLessonSection {
if localSysLessonSection == nil {
panic("implement not found for interface ISysLessonSection, forgot register?")
}
return localSysLessonSection
}
func RegisterSysLessonSection(i ISysLessonSection) {
localSysLessonSection = i
}
func SysLog() ISysLog {
if localSysLog == nil {
panic("implement not found for interface ISysLog, forgot register?")

View File

@ -0,0 +1,62 @@
-- hotgo自动生成菜单权限SQL 通常情况下只在首次生成代码时自动执行一次
-- 如需再次执行请先手动删除生成的菜单权限和SQL文件/Users/guochen/Documents/projects/g031/hotgo/server/storage/data/generate/lesson_section_menu.sql
-- Version: 2.17.8
-- Date: 2025-07-25 16:32:05
-- Link https://github.com/bufanyun/hotgo
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
--
-- 数据库 `hotgo`
--
-- --------------------------------------------------------
--
-- 插入表中的数据 `hg_admin_menu`
--
SET @now := now();
-- 菜单目录
INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, '0', '课程章节', 'lessonSection', '/lessonSection', 'MenuOutlined', '1', '/lessonSection/index', '', '', 'LAYOUT', '1', '', '0', '0', '', '0', '0', '0', '1', '', '0', '', '1', @now, @now);
SET @dirId = LAST_INSERT_ID();
-- 菜单页面
-- 列表
INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @dirId, '课程章节列表', 'lessonSectionIndex', 'index', '', '2', '', '/lessonSection/list', '', '/lessonSection/index', '1', 'lessonSection', '0', '0', '', '0', '1', '0', '2', CONCAT('tr_', @dirId,' '), '10', '', '1', @now, @now);
SET @listId = LAST_INSERT_ID();
-- 详情
INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '课程章节详情', 'lessonSectionView', '', '', '3', '', '/lessonSection/view', '', '', '1', '', '0', '0', '', '0', '1', '0', '3', CONCAT('tr_', @dirId, ' tr_', @listId,' '), '10', '', '1', @now, @now);
-- 菜单按钮
-- 编辑
INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '编辑/新增课程章节', 'lessonSectionEdit', '', '', '3', '', '/lessonSection/edit', '', '', '1', '', '0', '0', '', '0', '1', '0', '3', CONCAT('tr_', @dirId, ' tr_', @listId,' '), '20', '', '1', @now, @now);
SET @editId = LAST_INSERT_ID();
-- 删除
INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '删除课程章节', 'lessonSectionDelete', '', '', '3', '', '/lessonSection/delete', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', CONCAT('tr_', @dirId, ' tr_', @listId,' '), '40', '', '1', @now, @now);
-- 导出
INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '导出课程章节', 'lessonSectionExport', '', '', '3', '', '/lessonSection/export', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', CONCAT('tr_', @dirId, ' tr_', @listId,' '), '70', '', '1', @now, @now);
COMMIT;