12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package models
- import (
- "eta_gn/eta_api/global"
- "eta_gn/eta_api/utils"
- "time"
- )
- // ClassifyMenuRelation 报告分类-子目录关联表
- type ClassifyMenuRelation struct {
- Id int `gorm:"column:id;primaryKey"` //`orm:"column(id);pk" gorm:"primaryKey" `
- MenuId int `gorm:"column:menu_id"` //`description:"子目录ID"`
- ClassifyId int `gorm:"column:classify_id"` //`description:"二级分类ID"`
- CreateTime time.Time `gorm:"column:create_time"` //`description:"创建时间"`
- }
- func (item *ClassifyMenuRelation) TableName() string {
- return "classify_menu_relation"
- }
- func (item *ClassifyMenuRelation) Create() (err error) {
- err = global.DmSQL["rddp"].Create(item).Error
- return
- }
- func (item *ClassifyMenuRelation) Update(cols []string) (err error) {
- err = global.DmSQL["rddp"].Select(cols).Updates(item).Error
- return
- }
- func (item *ClassifyMenuRelation) InsertMulti(items []*ClassifyMenuRelation) (err error) {
- err = global.DmSQL["rddp"].CreateInBatches(items, utils.MultiAddNum).Error
- return
- }
- // GetClassifyMenuRelationList 获取子目录关联列表
- func GetClassifyMenuRelationList(condition string, pars []interface{}) (list []*ClassifyMenuRelation, err error) {
- sql := `SELECT * FROM classify_menu_relation WHERE 1 = 1 `
- sql += condition
- sql += ` ORDER BY create_time DESC`
- err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&list).Error
- return
- }
|