作者 陈志颖

feat:增减素币流姓名查询

@@ -20,6 +20,8 @@ type SearchSuMoneyTransactionRecordCommand struct { @@ -20,6 +20,8 @@ type SearchSuMoneyTransactionRecordCommand struct {
20 TransactionEndTime time.Time `json:"transactionEndTime,omitempty"` 20 TransactionEndTime time.Time `json:"transactionEndTime,omitempty"`
21 // 操作人UID 21 // 操作人UID
22 Operator int64 `json:"operator,omitempty"` 22 Operator int64 `json:"operator,omitempty"`
  23 + // 关联人员
  24 + EmployeeMatchName string `json:"employeeMatchName"`
23 // 查询偏离量 25 // 查询偏离量
24 Offset int `json:"offset,omitempty"` 26 Offset int `json:"offset,omitempty"`
25 // 查询限制 27 // 查询限制
@@ -69,7 +69,7 @@ func (repository *ExchangeCashPersonListRepository) Find(queryOptions map[string @@ -69,7 +69,7 @@ func (repository *ExchangeCashPersonListRepository) Find(queryOptions map[string
69 } 69 }
70 // 根据兑换现金人员名称搜索人员清单 70 // 根据兑换现金人员名称搜索人员清单
71 if personNameMatch, ok := queryOptions["personNameMatch"]; ok && (personNameMatch != ""){ 71 if personNameMatch, ok := queryOptions["personNameMatch"]; ok && (personNameMatch != ""){
72 - query = query.Where("exchange_cash_list.exchange_cash_person LIKE ", fmt.Sprintf("%%%s%%", personNameMatch.(string))) 72 + query = query.Where("exchange_cash_list.exchange_cash_person LIKE ?", fmt.Sprintf("%%%s%%", personNameMatch.(string)))
73 } 73 }
74 if offset, ok := queryOptions["offset"]; ok { 74 if offset, ok := queryOptions["offset"]; ok {
75 offset := offset.(int) 75 offset := offset.(int)
@@ -73,6 +73,10 @@ func (repository *SuMoneyTransactionRecordRepository) Find(queryOptions map[stri @@ -73,6 +73,10 @@ func (repository *SuMoneyTransactionRecordRepository) Find(queryOptions map[stri
73 if uid, ok := queryOptions["uid"]; ok && (uid != int64(0)) { 73 if uid, ok := queryOptions["uid"]; ok && (uid != int64(0)) {
74 query = query.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid) 74 query = query.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid)
75 } 75 }
  76 + // TODO 姓名模糊查询
  77 + if employeeMatchName, ok := queryOptions["employeeMatchName"]; ok && (employeeMatchName != "") {
  78 + query = query.Where(`su_money_transaction_record.employee @> '{"employeeName":LIKE ?}'`, fmt.Sprintf("%%%s%%", employeeMatchName.(string)))
  79 + }
76 if recordType, ok := queryOptions["recordType"]; ok && (recordType != 0) { 80 if recordType, ok := queryOptions["recordType"]; ok && (recordType != 0) {
77 query = query.Where(`su_money_transaction_record.record_type = ?`, recordType) 81 query = query.Where(`su_money_transaction_record.record_type = ?`, recordType)
78 } 82 }
@@ -75,10 +75,20 @@ func (controller *SuMoneyController) ExchangeSuMoney() { @@ -75,10 +75,20 @@ func (controller *SuMoneyController) ExchangeSuMoney() {
75 controller.ServeJSON() 75 controller.ServeJSON()
76 } 76 }
77 77
  78 +// TODO 增加搜索姓名
78 func (controller *SuMoneyController) SearchSuMoneyTransactionRecord() { 79 func (controller *SuMoneyController) SearchSuMoneyTransactionRecord() {
79 suMoneyService := service.NewSuMoneyService(nil) 80 suMoneyService := service.NewSuMoneyService(nil)
80 searchSuMoneyTransactionRecordCommand := &command.SearchSuMoneyTransactionRecordCommand{} 81 searchSuMoneyTransactionRecordCommand := &command.SearchSuMoneyTransactionRecordCommand{}
81 82
  83 + employeeMatchName := controller.GetString("employeeMatchName")
  84 + searchSuMoneyTransactionRecordCommand.EmployeeMatchName = employeeMatchName
  85 +
  86 + offset, _ := controller.GetInt("offset")
  87 + searchSuMoneyTransactionRecordCommand.Offset = offset
  88 +
  89 + limit, _ := controller.GetInt("limit")
  90 + searchSuMoneyTransactionRecordCommand.Limit = limit
  91 +
82 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), searchSuMoneyTransactionRecordCommand) 92 json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), searchSuMoneyTransactionRecordCommand)
83 93
84 data, err := suMoneyService.SearchSuMoneyTransactionRecord(searchSuMoneyTransactionRecordCommand) 94 data, err := suMoneyService.SearchSuMoneyTransactionRecord(searchSuMoneyTransactionRecordCommand)
@@ -399,5 +409,5 @@ func (controller *SuMoneyController) GetExchangeCashPerson () { @@ -399,5 +409,5 @@ func (controller *SuMoneyController) GetExchangeCashPerson () {
399 409
400 // TODO 导入素币兑换清单 410 // TODO 导入素币兑换清单
401 func (controller *SuMoneyController) ImportExchangeList () { 411 func (controller *SuMoneyController) ImportExchangeList () {
402 - 412 +
403 } 413 }