package db import ( "xorm.io/xorm" "applet/app/db/model" "applet/app/utils/logx" ) func DbsPlanCommissionById(eg *xorm.Engine, id int) (*model.PlanCommission, error) { var m model.PlanCommission if isGet, err := eg.Where("id = ?", id).Get(&m); err != nil || !isGet { return nil, logx.Warn(err) } return &m, nil } func DbsPlanCommissionByIds(eg *xorm.Engine, ids ...int) []*model.PlanCommission { var m []*model.PlanCommission var err error if len(ids) > 0 { err = eg.In("id", ids).Find(&m) } else { err = eg.Find(&m) } if err != nil { return nil } return m }