TODO: backend

This commit is contained in:
eson 2023-06-25 20:00:27 +08:00
parent 8fae3400d3
commit 150ae1df77

View File

@ -11,6 +11,7 @@ func (c *FsCanteenProductModel) GetAllByCanteenTypeId(ctx context.Context, typeI
}
return
}
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
}
@ -23,3 +24,11 @@ func (c *FsCanteenProductModel) UpdateByIdArr(ctx context.Context, ids []int64,
func (c *FsCanteenProductModel) Create(ctx context.Context, data *FsCanteenProduct) 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
}