...
|
...
|
@@ -70,13 +70,13 @@ func (repository *SuMoneyTransactionRecordRepository) FindById(queryOptions map[ |
|
|
var suMoneyTransactionRecordModels []*models.SuMoneyTransactionRecord
|
|
|
suMoneyTransactionRecords := make([]*domain.SuMoneyTransactionRecord, 0)
|
|
|
query := tx.Model(&suMoneyTransactionRecordModels)
|
|
|
query = query.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
|
|
|
//query = query.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
|
|
|
if iDs, ok := queryOptions["ids"]; ok && len(iDs.([]int)) != 0 {
|
|
|
query = query.Where(`su_money_transaction_record.id IN (?)`, pg.In(iDs.([]int)))
|
|
|
}
|
|
|
if where, ok := queryOptions["where"]; ok && where.(map[string]interface{}) != nil {
|
|
|
if companyId, ok := where.(map[string]interface{})["companyId"]; ok && companyId.(float64) != 0 {
|
|
|
query = query.Where("e.company_id = ?", companyId)
|
|
|
if uid, ok := where.(map[string]interface{})["uid"]; ok && (uid != int64(0)) {
|
|
|
query = query.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid)
|
|
|
}
|
|
|
}
|
|
|
//query = query.Where(`e.status = ?`, 1)
|
...
|
...
|
|