作者 陈志颖

fix:修改删除栏目设置

... ... @@ -67,14 +67,17 @@ func (repository *ColumnSettingRepository) Save(columnSetting *domain.ColumnSett
func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSetting, columnSettings []*domain.ColumnSetting) (*domain.ColumnSetting, []*domain.ColumnSetting, error) {
tx := repository.transactionContext.PgTx
if columnSetting != nil {
// 单个删除
columnSettingModel := new(models.ColumnSetting)
columnSettingModel.Id = columnSetting.Identify().(int64)
if _, err := tx.Model(columnSettingModel).WherePK().Delete(); err != nil {
return columnSetting, nil, err
}
}
// 批量删除
if len(columnSettings) > 0 {
var columnSettingModels []*models.ColumnSetting
for _, setting := range columnSettings {
columnSettingModels = append(columnSettingModels, &models.ColumnSetting{
... ... @@ -84,6 +87,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe
if _, err := tx.Model(columnSettingModels).WherePK().Delete(); err != nil {
return nil, columnSettings, err
}
}
return columnSetting, columnSettings, nil
}
... ...