同步历史版本代码
This commit is contained in:
@@ -56,6 +56,18 @@ func (m *customUserModel) QueryDeviceList(ctx context.Context, userId int64) ([]
|
||||
return list, total, err
|
||||
}
|
||||
|
||||
func (m *customUserModel) QueryDeviceListByUserIds(ctx context.Context, userIds []int64) ([]*Device, int64, error) {
|
||||
var list []*Device
|
||||
var total int64
|
||||
if len(userIds) == 0 {
|
||||
return list, total, nil
|
||||
}
|
||||
err := m.QueryNoCacheCtx(ctx, &list, func(conn *gorm.DB, v interface{}) error {
|
||||
return conn.Model(&Device{}).Where("`user_id` IN ?", userIds).Count(&total).Find(&list).Error
|
||||
})
|
||||
return list, total, err
|
||||
}
|
||||
|
||||
func (m *customUserModel) UpdateDevice(ctx context.Context, data *Device, tx ...*gorm.DB) error {
|
||||
old, err := m.FindOneDevice(ctx, data.Id)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user