|
@@ -38,23 +38,7 @@ func (repository *ColumnSettingRepository) Save(columnSetting *domain.ColumnSett |
|
@@ -38,23 +38,7 @@ func (repository *ColumnSettingRepository) Save(columnSetting *domain.ColumnSett |
38
|
if err != nil {
|
38
|
if err != nil {
|
39
|
return nil, err
|
39
|
return nil, err
|
40
|
}
|
40
|
}
|
41
|
- //_, err := repository.nextIdentify()
|
|
|
42
|
- //if err != nil {
|
|
|
43
|
- // return columnSetting, err
|
|
|
44
|
- //}
|
|
|
45
|
- //if _, errInsert := tx.QueryOne(
|
|
|
46
|
- // 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)),
|
|
|
47
|
- // "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",
|
|
|
48
|
- // columnSetting.CompanyId, columnSetting.CreatedAt, columnSetting.Description, columnSetting.Key, columnSetting.Uid, columnSetting.UpdatedAt, columnSetting.UserName, pg.Array(columnSetting.Value), pg.Array(columnSetting.InvalidValue)); errInsert != nil {
|
|
|
49
|
- // return columnSetting, errInsert
|
|
|
50
|
- //}
|
|
|
51
|
} else {
|
41
|
} else {
|
52
|
- //if _, errUpdate := tx.QueryOne(
|
|
|
53
|
- // 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)),
|
|
|
54
|
- // "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",
|
|
|
55
|
- // 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 {
|
|
|
56
|
- // return columnSetting, errUpdate
|
|
|
57
|
- //}
|
|
|
58
|
_, err := tx.Model(columnSettingModel).WherePK().
|
42
|
_, err := tx.Model(columnSettingModel).WherePK().
|
59
|
Column("company_id", "created_at", "description", "key", "uid", "updated_at", "user_name", "value", "invalid_value").Update()
|
43
|
Column("company_id", "created_at", "description", "key", "uid", "updated_at", "user_name", "value", "invalid_value").Update()
|
60
|
if err != nil {
|
44
|
if err != nil {
|
|
@@ -78,13 +62,9 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe |
|
@@ -78,13 +62,9 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe |
78
|
|
62
|
|
79
|
// 批量删除
|
63
|
// 批量删除
|
80
|
if len(columnSettings) > 0 {
|
64
|
if len(columnSettings) > 0 {
|
81
|
- //var columnSettingModels []models.ColumnSetting
|
|
|
82
|
var ids []int64
|
65
|
var ids []int64
|
83
|
for _, setting := range columnSettings {
|
66
|
for _, setting := range columnSettings {
|
84
|
ids = append(ids, setting.Identify().(int64))
|
67
|
ids = append(ids, setting.Identify().(int64))
|
85
|
- //columnSettingModels = append(columnSettingModels, models.ColumnSetting{
|
|
|
86
|
- // Id: setting.Identify().(int64),
|
|
|
87
|
- //})
|
|
|
88
|
}
|
68
|
}
|
89
|
if _, err := tx.Model((*models.ColumnSetting)(nil)).Where("id IN (?)", pg.In(ids)).Delete(); err != nil {
|
69
|
if _, err := tx.Model((*models.ColumnSetting)(nil)).Where("id IN (?)", pg.In(ids)).Delete(); err != nil {
|
90
|
return nil, columnSettings, err
|
70
|
return nil, columnSettings, err
|