正在显示
3 个修改的文件
包含
30 行增加
和
4 行删除
@@ -15,7 +15,7 @@ type SearchCreditAccountQuery struct { | @@ -15,7 +15,7 @@ type SearchCreditAccountQuery struct { | ||
15 | // 页面大小 | 15 | // 页面大小 |
16 | PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` | 16 | PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` |
17 | // 账期结算单号 | 17 | // 账期结算单号 |
18 | - CreditAccountOrderNum string `cname:"账期结算单号" json:"creditAccountOrderNum"` | 18 | + CreditAccountOrderNum string `cname:"账期结算单号" json:"creditAccountOrderNum,omitempty"` |
19 | // 参与人姓名 | 19 | // 参与人姓名 |
20 | ParticipatorName string `cname:"参与人姓名" json:"participatorName,omitempty"` | 20 | ParticipatorName string `cname:"参与人姓名" json:"participatorName,omitempty"` |
21 | // 公司ID,通过集成REST上下文获取 | 21 | // 公司ID,通过集成REST上下文获取 |
@@ -290,10 +290,27 @@ func (creditAccountService *CreditAccountService) SearchCreditAccount(searchCred | @@ -290,10 +290,27 @@ func (creditAccountService *CreditAccountService) SearchCreditAccount(searchCred | ||
290 | defer func() { | 290 | defer func() { |
291 | _ = transactionContext.RollbackTransaction() | 291 | _ = transactionContext.RollbackTransaction() |
292 | }() | 292 | }() |
293 | - if err := transactionContext.CommitTransaction(); err != nil { | ||
294 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 293 | + var creditAccountRepository domain.CreditAccountRepository |
294 | + if value, err := factory.CreateCreditAccountRepository(map[string]interface{}{ | ||
295 | + "transactionContext": transactionContext, | ||
296 | + }); err != nil { | ||
297 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
298 | + } else { | ||
299 | + creditAccountRepository = value | ||
300 | + } | ||
301 | + if count, creditAccounts, err := creditAccountRepository.Find(tool_funs.SimpleStructToMap(searchCreditAccountQuery)); err != nil { | ||
302 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
303 | + } else { | ||
304 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
305 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
306 | + } | ||
307 | + return map[string]interface{}{ | ||
308 | + "grid": map[string]interface{}{ | ||
309 | + "total": count, | ||
310 | + "list": creditAccounts, | ||
311 | + }, | ||
312 | + }, nil | ||
295 | } | 313 | } |
296 | - return nil, nil | ||
297 | } | 314 | } |
298 | 315 | ||
299 | // UpdateCreditAccount 更新账期结算单服务 | 316 | // UpdateCreditAccount 更新账期结算单服务 |
@@ -190,6 +190,15 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac | @@ -190,6 +190,15 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac | ||
190 | var creditAccountModels []*models.CreditAccount | 190 | var creditAccountModels []*models.CreditAccount |
191 | creditAccounts := make([]*domain.CreditAccount, 0) | 191 | creditAccounts := make([]*domain.CreditAccount, 0) |
192 | query := sqlbuilder.BuildQuery(tx.Model(&creditAccountModels), queryOptions) | 192 | query := sqlbuilder.BuildQuery(tx.Model(&creditAccountModels), queryOptions) |
193 | + if creditAccountOrderNum, ok := queryOptions["creditAccountOrderNum"]; ok && creditAccountOrderNum != "" { | ||
194 | + query.Where("credit_account_order_num ilike ?", fmt.Sprintf("%%%s%%", creditAccountOrderNum)) | ||
195 | + } | ||
196 | + if participatorName, ok := queryOptions["participatorName"]; ok && participatorName != "" { | ||
197 | + query.Where(`(credit_account.participator->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", participatorName)) | ||
198 | + } | ||
199 | + if paymentStatus, ok := queryOptions["paymentStatus"]; ok && paymentStatus.(int32) != 0 { | ||
200 | + query.Where("payment_status = ?", paymentStatus) | ||
201 | + } | ||
193 | offsetLimitFlag := true | 202 | offsetLimitFlag := true |
194 | if offsetLimit, ok := queryOptions["offsetLimit"]; ok { | 203 | if offsetLimit, ok := queryOptions["offsetLimit"]; ok { |
195 | offsetLimitFlag = offsetLimit.(bool) | 204 | offsetLimitFlag = offsetLimit.(bool) |
-
请 注册 或 登录 后发表评论