mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
af4959cee7
@ -424,16 +424,34 @@ export const querySchema: ISchema = {
|
|||||||
order: {
|
order: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component': 'Radio.Group',
|
'x-component': 'Select',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
defaultValue: 'ASC',
|
defaultValue: 'ASC',
|
||||||
optionType: 'button',
|
|
||||||
style: {
|
|
||||||
width: '128px',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
enum: ['ASC', 'DESC'],
|
enum: ['ASC', 'DESC'],
|
||||||
},
|
},
|
||||||
|
nulls: {
|
||||||
|
type: 'string',
|
||||||
|
'x-decorator': 'FormItem',
|
||||||
|
'x-component': 'Select',
|
||||||
|
'x-component-props': {
|
||||||
|
defaultValue: 'default',
|
||||||
|
},
|
||||||
|
enum: [
|
||||||
|
{
|
||||||
|
label: lang('Default'),
|
||||||
|
value: 'default',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: lang('NULLS first'),
|
||||||
|
value: 'first',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: lang('NULLS last'),
|
||||||
|
value: 'last',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'x-reactions': '{{ useOrderReaction }}',
|
'x-reactions': '{{ useOrderReaction }}',
|
||||||
|
@ -84,7 +84,14 @@ export class QueryParser {
|
|||||||
orders.forEach((item: OrderProps) => {
|
orders.forEach((item: OrderProps) => {
|
||||||
const alias = sequelize.getQueryInterface().quoteIdentifier(item.alias);
|
const alias = sequelize.getQueryInterface().quoteIdentifier(item.alias);
|
||||||
const name = hasAgg ? sequelize.literal(alias) : sequelize.col(item.field as string);
|
const name = hasAgg ? sequelize.literal(alias) : sequelize.col(item.field as string);
|
||||||
order.push([name, item.order || 'ASC']);
|
let sort = item.order || 'ASC';
|
||||||
|
if (item.nulls === 'first') {
|
||||||
|
sort += ' NULLS FIRST';
|
||||||
|
}
|
||||||
|
if (item.nulls === 'last') {
|
||||||
|
sort += ' NULLS LAST';
|
||||||
|
}
|
||||||
|
order.push([name, sort]);
|
||||||
});
|
});
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ export type OrderProps = {
|
|||||||
field: string | string[];
|
field: string | string[];
|
||||||
alias?: string;
|
alias?: string;
|
||||||
order?: 'asc' | 'desc';
|
order?: 'asc' | 'desc';
|
||||||
|
nulls?: 'default' | 'first' | 'last';
|
||||||
};
|
};
|
||||||
|
|
||||||
export type QueryParams = Partial<{
|
export type QueryParams = Partial<{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user