123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package models
- import (
- "eta_gn/eta_api/global"
- "eta_gn/eta_api/utils"
- "time"
- )
- type ClassifyMenu struct {
- MenuId int `gorm:"column:menu_id;primaryKey"`
- MenuName string `gorm:"column:mobile"`
- ClassifyId int `gorm:"column:classify_id"`
- Sort int `gorm:"column:sort"`
- CreateTime time.Time `gorm:"column:create_time"`
- ModifyTime time.Time `gorm:"column:modify_time"`
- }
- 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
- }
- 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
- }
- type ClassifyMenuSaveReq struct {
- MenuId int `description:"子目录ID, 0为新增, 大于0为编辑"`
- MenuName string `description:"子目录名称"`
- }
|