作者 陈志颖

feat:增减素币流姓名查询

... ... @@ -20,6 +20,8 @@ type SearchSuMoneyTransactionRecordCommand struct {
TransactionEndTime time.Time `json:"transactionEndTime,omitempty"`
// 操作人UID
Operator int64 `json:"operator,omitempty"`
// 关联人员
EmployeeMatchName string `json:"employeeMatchName"`
// 查询偏离量
Offset int `json:"offset,omitempty"`
// 查询限制
... ...
... ... @@ -69,7 +69,7 @@ func (repository *ExchangeCashPersonListRepository) Find(queryOptions map[string
}
// 根据兑换现金人员名称搜索人员清单
if personNameMatch, ok := queryOptions["personNameMatch"]; ok && (personNameMatch != ""){
query = query.Where("exchange_cash_list.exchange_cash_person LIKE ", fmt.Sprintf("%%%s%%", personNameMatch.(string)))
query = query.Where("exchange_cash_list.exchange_cash_person LIKE ?", fmt.Sprintf("%%%s%%", personNameMatch.(string)))
}
if offset, ok := queryOptions["offset"]; ok {
offset := offset.(int)
... ...
... ... @@ -73,6 +73,10 @@ func (repository *SuMoneyTransactionRecordRepository) Find(queryOptions map[stri
if uid, ok := queryOptions["uid"]; ok && (uid != int64(0)) {
query = query.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid)
}
// TODO 姓名模糊查询
if employeeMatchName, ok := queryOptions["employeeMatchName"]; ok && (employeeMatchName != "") {
query = query.Where(`su_money_transaction_record.employee @> '{"employeeName":LIKE ?}'`, fmt.Sprintf("%%%s%%", employeeMatchName.(string)))
}
if recordType, ok := queryOptions["recordType"]; ok && (recordType != 0) {
query = query.Where(`su_money_transaction_record.record_type = ?`, recordType)
}
... ...
... ... @@ -75,10 +75,20 @@ func (controller *SuMoneyController) ExchangeSuMoney() {
controller.ServeJSON()
}
// TODO 增加搜索姓名
func (controller *SuMoneyController) SearchSuMoneyTransactionRecord() {
suMoneyService := service.NewSuMoneyService(nil)
searchSuMoneyTransactionRecordCommand := &command.SearchSuMoneyTransactionRecordCommand{}
employeeMatchName := controller.GetString("employeeMatchName")
searchSuMoneyTransactionRecordCommand.EmployeeMatchName = employeeMatchName
offset, _ := controller.GetInt("offset")
searchSuMoneyTransactionRecordCommand.Offset = offset
limit, _ := controller.GetInt("limit")
searchSuMoneyTransactionRecordCommand.Limit = limit
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), searchSuMoneyTransactionRecordCommand)
data, err := suMoneyService.SearchSuMoneyTransactionRecord(searchSuMoneyTransactionRecordCommand)
... ... @@ -399,5 +409,5 @@ func (controller *SuMoneyController) GetExchangeCashPerson () {
// TODO 导入素币兑换清单
func (controller *SuMoneyController) ImportExchangeList () {
}
\ No newline at end of file
... ...