TODO: backend
This commit is contained in:
parent
8fae3400d3
commit
150ae1df77
|
@ -11,6 +11,7 @@ func (c *FsCanteenProductModel) GetAllByCanteenTypeId(ctx context.Context, typeI
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FsCanteenProductModel) UpdateById(ctx context.Context, id int64, data *FsCanteenProduct) error {
|
func (c *FsCanteenProductModel) UpdateById(ctx context.Context, id int64, data *FsCanteenProduct) error {
|
||||||
return c.db.WithContext(ctx).Model(&FsCanteenProduct{}).Where("`id` = ? ", id).Updates(&data).Error
|
return c.db.WithContext(ctx).Model(&FsCanteenProduct{}).Where("`id` = ? ", id).Updates(&data).Error
|
||||||
}
|
}
|
||||||
|
@ -23,3 +24,11 @@ func (c *FsCanteenProductModel) UpdateByIdArr(ctx context.Context, ids []int64,
|
||||||
func (c *FsCanteenProductModel) Create(ctx context.Context, data *FsCanteenProduct) error {
|
func (c *FsCanteenProductModel) Create(ctx context.Context, data *FsCanteenProduct) error {
|
||||||
return c.db.WithContext(ctx).Model(&FsCanteenProduct{}).Create(data).Error
|
return c.db.WithContext(ctx).Model(&FsCanteenProduct{}).Create(data).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *FsCanteenProductModel) GetAllByCanteenTypeIdOrderAsc(ctx context.Context, typeId int64) (resp []FsCanteenProduct, err error) {
|
||||||
|
err = c.db.WithContext(ctx).Model(&FsCanteenProduct{}).Where("`canteen_type` = ? and `status` = ?", typeId, 1).Order("sort asc").Find(&resp).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user