...
|
...
|
@@ -71,7 +71,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe |
|
|
if columnSetting != nil {
|
|
|
columnSettingModel := new(models.ColumnSetting)
|
|
|
columnSettingModel.Id = columnSetting.Identify().(int64)
|
|
|
if _, err := tx.Model(columnSettingModel).WherePK().Delete(); err != nil {
|
|
|
if _, err := tx.Model(&columnSettingModel).WherePK().Delete(); err != nil {
|
|
|
return columnSetting, nil, err
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -84,7 +84,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe |
|
|
Id: setting.Identify().(int64),
|
|
|
})
|
|
|
}
|
|
|
if _, err := tx.Model(columnSettingModels).WherePK().Delete(); err != nil {
|
|
|
if _, err := tx.Model(&columnSettingModels).WherePK().Delete(); err != nil {
|
|
|
return nil, columnSettings, err
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -95,7 +95,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe |
|
|
func (repository *ColumnSettingRepository) FindOne(queryOptions map[string]interface{}) (*domain.ColumnSetting, error) {
|
|
|
tx := repository.transactionContext.PgTx
|
|
|
columnSettingModel := new(models.ColumnSetting)
|
|
|
query := tx.Model(columnSettingModel)
|
|
|
query := tx.Model(&columnSettingModel)
|
|
|
if columnSettingId, ok := queryOptions["column_settingId"]; ok {
|
|
|
query = query.Where("column_setting.id = ?", columnSettingId)
|
|
|
}
|
...
|
...
|
@@ -141,31 +141,6 @@ func (repository *ColumnSettingRepository) Find(queryOptions domain.ColumnSettin |
|
|
} else {
|
|
|
query = query.Limit(20)
|
|
|
}
|
|
|
//if ids, ok := queryOptions["ids"]; ok && len(ids.([]int64)) != 0 {
|
|
|
// query = query.Where("column_setting.uid in(?)", ids)
|
|
|
//}
|
|
|
//if uid, ok := queryOptions["uid"]; ok {
|
|
|
// query = query.Where("column_setting.uid = ?", uid)
|
|
|
//}
|
|
|
//if companyId, ok := queryOptions["companyId"]; ok {
|
|
|
// query = query.Where("column_setting.company_id = ?", companyId)
|
|
|
//}
|
|
|
//if offset, ok := queryOptions["offset"]; ok {
|
|
|
// queryOffset := offset.(int)
|
|
|
// if queryOffset > -1 {
|
|
|
// query = query.Offset(queryOffset)
|
|
|
// }
|
|
|
//} else {
|
|
|
// query = query.Offset(0)
|
|
|
//}
|
|
|
//if limit, ok := queryOptions["limit"]; ok {
|
|
|
// queryLimit := limit.(int)
|
|
|
// if queryLimit > -1 {
|
|
|
// query = query.Limit(queryLimit)
|
|
|
// }
|
|
|
//} else {
|
|
|
// query = query.Limit(20)
|
|
|
//}
|
|
|
if count, err := query.Order("id DESC").SelectAndCount(); err != nil {
|
|
|
return 0, columnSettings, err
|
|
|
} else {
|
...
|
...
|
|