作者 陈志颖

fix:修复导出素币流水问题

... ... @@ -6,7 +6,7 @@ import (
)
type ExportSuMoneyCommand struct {
IDs []int `json:"ids"`
Ids []int `json:"ids"` // 员工uid
Where map[string]interface{} `json:"where"`
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type ExportTransactionRecordCommand struct {
IDs []int `json:"ids"`
Ids []int `json:"ids"`
}
func (exportTransactionRecordCommand *ExportTransactionRecordCommand) ValidateCommand() error {
... ...
... ... @@ -2118,9 +2118,9 @@ func (cashPoolService *CashPoolService) ListExchangeCashPersonById(exportExchang
exchangeCashPersonListRepository = value
}
//if len(exportExchangeCashListCommand.IDs) == 0 {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未勾选需要导出的数据")
//}
if len(exportExchangeCashListCommand.Ids) == 0 && exportExchangeCashListCommand.Where == nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未勾选需要导出的数据")
}
// 获取兑换清单
if _, people, err := exchangeCashPersonListRepository.FindById(tool_funs.SimpleStructToMap(exportExchangeCashListCommand)); err != nil {
... ...
... ... @@ -277,7 +277,7 @@ func (suMoneyService *SuMoneyService) ListSuMoneyById(exportSuMoneyCommand *comm
transactionContext.RollbackTransaction()
}()
if len(exportSuMoneyCommand.IDs) == 0 {
if len(exportSuMoneyCommand.Ids) == 0 && exportSuMoneyCommand.Where == nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未勾选需要导出的数据")
}
... ... @@ -317,7 +317,7 @@ func (suMoneyService *SuMoneyService) ListSuMoneyTransactionRecordById(exportSuM
transactionContext.RollbackTransaction()
}()
if len(exportSuMoneyTransactionRecordCommand.IDs) == 0 {
if len(exportSuMoneyTransactionRecordCommand.Ids) == 0 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未勾选需要导出的数据")
}
... ...
... ... @@ -95,9 +95,17 @@ func (repository *EmployeeRepository) Find(queryOptions map[string]interface{})
if employeeNameMatch, ok := queryOptions["employeeNameMatch"]; ok && (employeeNameMatch != "") {
query = query.Where("employee.employee_name LIKE ?", fmt.Sprintf("%%%s%%", employeeNameMatch.(string)))
}
//if status, ok := queryOptions["status"]; ok && (status != 0) {
// query = query.Where(`employee.status = ?`, status)
//}
if ids, ok := queryOptions["ids"]; ok && len(ids.([]int)) != 0 {
query = query.Where("employee.uid IN (?)", pg.In(ids.([]int)) )
}
if where, ok := queryOptions["where"]; ok && where.(map[string]interface{}) != nil {
if personNameMatch, ok := where.(map[string]interface{})["personNameMatch"]; ok && (personNameMatch != "") {
query = query.Where("employee.employee_name LIKE ?", fmt.Sprintf("%%%s%%", personNameMatch.(string)))
}
if companyId, ok := where.(map[string]interface{})["companyId"]; ok && companyId.(float64) != 0 {
query = query.Where("employee.company_id = ?", companyId)
}
}
query = query.Where(`employee.status = ?`, 1)
if isPrincipal, ok := queryOptions["isPrincipal"]; ok && isPrincipal.(bool) != false {
query = query.Where("employee.is_principal = ? ", isPrincipal)
... ...