作者 陈志颖

test:测试删除用户

@@ -71,7 +71,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe @@ -71,7 +71,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe
71 if columnSetting != nil { 71 if columnSetting != nil {
72 columnSettingModel := new(models.ColumnSetting) 72 columnSettingModel := new(models.ColumnSetting)
73 columnSettingModel.Id = columnSetting.Identify().(int64) 73 columnSettingModel.Id = columnSetting.Identify().(int64)
74 - if _, err := tx.Model(columnSettingModel).WherePK().Delete(); err != nil { 74 + if _, err := tx.Model(&columnSettingModel).WherePK().Delete(); err != nil {
75 return columnSetting, nil, err 75 return columnSetting, nil, err
76 } 76 }
77 } 77 }
@@ -84,7 +84,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe @@ -84,7 +84,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe
84 Id: setting.Identify().(int64), 84 Id: setting.Identify().(int64),
85 }) 85 })
86 } 86 }
87 - if _, err := tx.Model(columnSettingModels).WherePK().Delete(); err != nil { 87 + if _, err := tx.Model(&columnSettingModels).WherePK().Delete(); err != nil {
88 return nil, columnSettings, err 88 return nil, columnSettings, err
89 } 89 }
90 } 90 }
@@ -95,7 +95,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe @@ -95,7 +95,7 @@ func (repository *ColumnSettingRepository) Remove(columnSetting *domain.ColumnSe
95 func (repository *ColumnSettingRepository) FindOne(queryOptions map[string]interface{}) (*domain.ColumnSetting, error) { 95 func (repository *ColumnSettingRepository) FindOne(queryOptions map[string]interface{}) (*domain.ColumnSetting, error) {
96 tx := repository.transactionContext.PgTx 96 tx := repository.transactionContext.PgTx
97 columnSettingModel := new(models.ColumnSetting) 97 columnSettingModel := new(models.ColumnSetting)
98 - query := tx.Model(columnSettingModel) 98 + query := tx.Model(&columnSettingModel)
99 if columnSettingId, ok := queryOptions["column_settingId"]; ok { 99 if columnSettingId, ok := queryOptions["column_settingId"]; ok {
100 query = query.Where("column_setting.id = ?", columnSettingId) 100 query = query.Where("column_setting.id = ?", columnSettingId)
101 } 101 }
@@ -141,31 +141,6 @@ func (repository *ColumnSettingRepository) Find(queryOptions domain.ColumnSettin @@ -141,31 +141,6 @@ func (repository *ColumnSettingRepository) Find(queryOptions domain.ColumnSettin
141 } else { 141 } else {
142 query = query.Limit(20) 142 query = query.Limit(20)
143 } 143 }
144 - //if ids, ok := queryOptions["ids"]; ok && len(ids.([]int64)) != 0 {  
145 - // query = query.Where("column_setting.uid in(?)", ids)  
146 - //}  
147 - //if uid, ok := queryOptions["uid"]; ok {  
148 - // query = query.Where("column_setting.uid = ?", uid)  
149 - //}  
150 - //if companyId, ok := queryOptions["companyId"]; ok {  
151 - // query = query.Where("column_setting.company_id = ?", companyId)  
152 - //}  
153 - //if offset, ok := queryOptions["offset"]; ok {  
154 - // queryOffset := offset.(int)  
155 - // if queryOffset > -1 {  
156 - // query = query.Offset(queryOffset)  
157 - // }  
158 - //} else {  
159 - // query = query.Offset(0)  
160 - //}  
161 - //if limit, ok := queryOptions["limit"]; ok {  
162 - // queryLimit := limit.(int)  
163 - // if queryLimit > -1 {  
164 - // query = query.Limit(queryLimit)  
165 - // }  
166 - //} else {  
167 - // query = query.Limit(20)  
168 - //}  
169 if count, err := query.Order("id DESC").SelectAndCount(); err != nil { 144 if count, err := query.Order("id DESC").SelectAndCount(); err != nil {
170 return 0, columnSettings, err 145 return 0, columnSettings, err
171 } else { 146 } else {