|
@@ -185,7 +185,7 @@ func Update(tableName string, needLastUpdateUserID bool, callbacks *UpdateCallba
|
|
|
|
|
|
|
|
type ConditionFieldCallback func(conditions *sql.Conditions, fieldName string, columnName string, value any) (hasDeal bool, err error)
|
|
type ConditionFieldCallback func(conditions *sql.Conditions, fieldName string, columnName string, value any) (hasDeal bool, err error)
|
|
|
|
|
|
|
|
-func Query[O any](tableName string, callbacks *QueryCallbacks[O], conditionFieldCallback ConditionFieldCallback) binding.ServiceFunc[response.InfosData[O]] {
|
|
|
|
|
|
|
+func Query[O any](tableName string, orderBy string, callbacks *QueryCallbacks[O], conditionFieldCallback ConditionFieldCallback) binding.ServiceFunc[response.InfosData[O]] {
|
|
|
return func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (response.InfosData[O], error) {
|
|
return func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (response.InfosData[O], error) {
|
|
|
errResponse := response.InfosData[O]{
|
|
errResponse := response.InfosData[O]{
|
|
|
Infos: make([]O, 0),
|
|
Infos: make([]O, 0),
|
|
@@ -244,6 +244,7 @@ func Query[O any](tableName string, callbacks *QueryCallbacks[O], conditionField
|
|
|
results, totalCount, err := database.Query(dbExecutor, &sql.QueryExecuteParams{
|
|
results, totalCount, err := database.Query(dbExecutor, &sql.QueryExecuteParams{
|
|
|
TableName: tableName,
|
|
TableName: tableName,
|
|
|
Conditions: conditions,
|
|
Conditions: conditions,
|
|
|
|
|
+ OrderBy: orderBy,
|
|
|
PageNo: queryParams.GetPageNo(),
|
|
PageNo: queryParams.GetPageNo(),
|
|
|
PageSize: queryParams.GetPageSize(),
|
|
PageSize: queryParams.GetPageSize(),
|
|
|
})
|
|
})
|