...
|
...
|
@@ -37,9 +37,15 @@ func (repository *ExchangeCashPersonListRepository) FindOne(queryOptions map[str |
|
|
tx := repository.transactionContext.PgTx
|
|
|
exchangeCashListModel := new(models.ExchangeCashPersonList)
|
|
|
query := tx.Model(exchangeCashListModel)
|
|
|
if uid, ok := queryOptions["uid"]; ok {
|
|
|
query = query.Where("exchange_cash_person_list.uid = ?", uid)
|
|
|
}
|
|
|
if exchangeCashListId, ok := queryOptions["listId"]; ok {
|
|
|
query = query.Where("exchange_cash_person_list.id = ?", exchangeCashListId)
|
|
|
}
|
|
|
if activityId, ok := queryOptions["activityId"]; ok {
|
|
|
query = query.Where("exchange_cash_person_list.activity_id = ?", activityId)
|
|
|
}
|
|
|
if err := query.First(); err != nil {
|
|
|
if err.Error() == "pg: no rows in result set" {
|
|
|
return nil, fmt.Errorf("没有此资源")
|
...
|
...
|
@@ -131,6 +137,9 @@ func (repository *ExchangeCashPersonListRepository) Find(queryOptions map[string |
|
|
if personNameMatch, ok := queryOptions["exchangeCashPersonNameMatch"]; ok && (personNameMatch != ""){
|
|
|
query = query.Where("exchange_cash_person_list.employee_name LIKE ?", fmt.Sprintf("%%%s%%", personNameMatch.(string)))
|
|
|
}
|
|
|
if uid, ok := queryOptions["uid"]; ok {
|
|
|
query = query.Where("exchange_cash_person_list.uid = ?", uid)
|
|
|
}
|
|
|
if offset, ok := queryOptions["offset"]; ok {
|
|
|
offset := offset.(int)
|
|
|
if offset > -1 {
|
...
|
...
|
|