|
1234567891011121314151617181920212223242526272829303132333435363738 |
- package db
-
- import (
- "xorm.io/xorm"
-
- "applet/app/db/model"
- "applet/app/utils/logx"
- )
-
- // 批量获取信息
- func DbsDealOrderUseFindByIds(eg *xorm.Engine, types string, ids []string) (*[]model.DealOrderUser, error) {
- var ord []model.DealOrderUser
- if err := eg.In("id", ids).
- Where("type = ?", types).
- Find(&ord); err != nil {
- return nil, logx.Error(err)
- }
- if len(ord) == 0 {
- return nil, nil
- }
- return &ord, nil
- }
-
- func DbsDealOrderUserUpdate(eg *xorm.Engine, id int, ord *model.DealOrderUser) error {
- if _, err := eg.Where(" `id` = ?", id).AllCols().Update(ord); err != nil {
- return logx.Warn(err)
- }
- return nil
- }
-
- func DbsDealOrderUserInsert(eg *xorm.Engine, ord *model.DealOrderUser) bool {
- _, err := eg.InsertOne(ord)
- if err != nil {
- logx.Warn(err)
- return false
- }
- return true
- }
|