修改依赖管理默认排序

This commit is contained in:
whyour 2022-09-11 22:26:33 +08:00
parent e4ad8f512e
commit 144b543091
2 changed files with 9 additions and 3 deletions

View File

@ -125,8 +125,11 @@ export default class DependenceService {
return docs;
}
private async find(query: any, sort?: any): Promise<Dependence[]> {
const docs = await DependenceModel.findAll({ where: { ...query } });
private async find(query: any, sort: any = []): Promise<Dependence[]> {
const docs = await DependenceModel.findAll({
where: { ...query },
order: [...sort, ['createdAt', 'DESC']],
});
return docs;
}

View File

@ -112,7 +112,10 @@ export default class EnvService {
};
}
try {
const result = await this.find(condition, [['position', 'DESC']]);
const result = await this.find(condition, [
['position', 'DESC'],
['createdAt', 'DESC'],
]);
return result as any;
} catch (error) {
throw error;