...
|
...
|
@@ -38,23 +38,7 @@ func (repository *ColumnSettingRepository) Save(columnSetting *domain.ColumnSett |
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
//_, err := repository.nextIdentify()
|
|
|
//if err != nil {
|
|
|
// return columnSetting, err
|
|
|
//}
|
|
|
//if _, errInsert := tx.QueryOne(
|
|
|
// pg.Scan(&columnSetting.Id, &columnSetting.CompanyId, &columnSetting.CreatedAt, &columnSetting.Description, &columnSetting.Key, &columnSetting.Uid, &columnSetting.UpdatedAt, &columnSetting.UserName, pg.Array(&columnSetting.Value), pg.Array(&columnSetting.InvalidValue)),
|
|
|
// "INSERT INTO column_settings (company_id, created_at, description, key, uid, updated_at, user_name, value, invalid_value) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id, company_id, created_at, description, key, uid, updated_at, user_name, value, invalid_value",
|
|
|
// columnSetting.CompanyId, columnSetting.CreatedAt, columnSetting.Description, columnSetting.Key, columnSetting.Uid, columnSetting.UpdatedAt, columnSetting.UserName, pg.Array(columnSetting.Value), pg.Array(columnSetting.InvalidValue)); errInsert != nil {
|
|
|
// return columnSetting, errInsert
|
|
|
//}
|
|
|
} else {
|
|
|
//if _, errUpdate := tx.QueryOne(
|
|
|
// pg.Scan(&columnSetting.Id, &columnSetting.CompanyId, &columnSetting.CreatedAt, &columnSetting.Description, &columnSetting.Key, &columnSetting.Uid, &columnSetting.UpdatedAt, &columnSetting.UserName, pg.Array(&columnSetting.Value), pg.Array(&columnSetting.InvalidValue)),
|
|
|
// "UPDATE column_settings SET company_id=?, created_at=?, description=?, key=?, uid=?, updated_at=?, user_name=?, value=?, invalid_value=? WHERE id=? RETURNING id, company_id, created_at, description, key, uid, updated_at, user_name, value, invalid_value",
|
|
|
// columnSetting.CompanyId, columnSetting.CreatedAt, columnSetting.Description, columnSetting.Key, columnSetting.Uid, columnSetting.UpdatedAt, columnSetting.UserName, pg.Array(columnSetting.Value), pg.Array(columnSetting.InvalidValue), columnSetting.Identify()); errUpdate != nil {
|
|
|
// return columnSetting, errUpdate
|
|
|
//}
|
|
|
_, err := tx.Model(columnSettingModel).WherePK().
|
|
|
Column("company_id", "created_at", "description", "key", "uid", "updated_at", "user_name", "value", "invalid_value").Update()
|
|
|
if err != nil {
|
...
|
...
|
@@ -78,13 +62,9 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe |
|
|
|
|
|
// 批量删除
|
|
|
if len(columnSettings) > 0 {
|
|
|
//var columnSettingModels []models.ColumnSetting
|
|
|
var ids []int64
|
|
|
for _, setting := range columnSettings {
|
|
|
ids = append(ids, setting.Identify().(int64))
|
|
|
//columnSettingModels = append(columnSettingModels, models.ColumnSetting{
|
|
|
// Id: setting.Identify().(int64),
|
|
|
//})
|
|
|
}
|
|
|
if _, err := tx.Model((*models.ColumnSetting)(nil)).Where("id IN (?)", pg.In(ids)).Delete(); err != nil {
|
|
|
return nil, columnSettings, err
|
...
|
...
|
|