12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package models
- import (
- "eta_gn/eta_api/global"
- "eta_gn/eta_api/utils"
- "time"
- )
- type ClassifyMenuRelation struct {
- Id int `gorm:"column:id;primaryKey"`
- MenuId int `gorm:"column:menu_id"`
- ClassifyId int `gorm:"column:classify_id"`
- CreateTime time.Time `gorm:"column:create_time"`
- }
- 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
- }
- 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
- }
|