const getOrderBy = (field: string, order: string, primaryKey: PrimaryKey) => {
console.log(field, order,primaryKey,"test")
if (field == 'id') {
console.log(primaryKey.map(key => (`${key}.${order.toLowerCase()}`)).join(','))
return primaryKey.map(key => (`${key}.${order.toLowerCase()}`)).join(',');
} else {
console.log(`${field}.${order.toLowerCase()}`, "11")
return `${field}.${order.toLowerCase()}`;
}
};
输入
id desc ["id"]
如果其中含有id desc得值 且是id得话 进行数据得拼接
输出
id.desc