123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package models
- import (
- "eta_gn/eta_api/global"
- "eta_gn/eta_api/utils"
- "time"
- )
- // ClassifyMenu 报告分类-子目录表
- type ClassifyMenu struct {
- MenuId int `gorm:"column:menu_id;primaryKey"` // `orm:"column(menu_id);pk" gorm:"primaryKey" `
- MenuName string `gorm:"column:mobile"` //`description:"子目录名称"`
- ClassifyId int `gorm:"column:classify_id"` //`description:"一级分类ID"`
- Sort int `gorm:"column:sort"` //`description:"排序"`
- CreateTime time.Time `gorm:"column:create_time"` //`description:"创建时间"`
- ModifyTime time.Time `gorm:"column:modify_time"` //`description:"更新时间"`
- }
- func (item *ClassifyMenu) TableName() string {
- return "classify_menu"
- }
- func (item *ClassifyMenu) Create() (err error) {
- err = global.DmSQL["rddp"].Create(item).Error
- return
- }
- func (item *ClassifyMenu) Update(cols []string) (err error) {
- err = global.DmSQL["rddp"].Select(cols).Updates(item).Error
- return
- }
- func (item *ClassifyMenu) InsertMulti(items []*ClassifyMenu) (err error) {
- err = global.DmSQL["rddp"].CreateInBatches(items, utils.MultiAddNum).Error
- return
- }
- // GetClassifyMenuList 获取子目录列表
- func GetClassifyMenuList(condition string, pars []interface{}) (list []*ClassifyMenu, err error) {
- sql := `SELECT * FROM classify_menu WHERE 1 = 1 `
- sql += condition
- sql += ` ORDER BY sort ASC, create_time ASC`
- err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&list).Error
- return
- }
- // ClassifyMenuSaveReq 保存分类子目录请求体
- type ClassifyMenuSaveReq struct {
- MenuId int `description:"子目录ID, 0为新增, 大于0为编辑"`
- MenuName string `description:"子目录名称"`
- }
|