这是一个创建于 2143 天前的主题,其中的信息可能已经有所发展或是发生改变。
let getjob = async (params) => {
let jobs = await Lagou.findAll({
where: {
city: params.city ,
education: params.education ,
keyword: params.keyword ,
}
});
for (let i of jobs) {
console.log(JSON.stringify(i));
}
};
let mobj = {
city: '深圳', keyword: 'java', education:'本科'
};
getjob(mobj);
假如用户有三个参数 city keyword education 可选,如何通过一个方法来实现,传 1-3 个参数得到相应的数据呢
2 条回复 • 2018-12-13 10:12:53 +08:00
|
|
1
ginozhu 2018-12-12 16:29:16 +08:00 1
蛤?直接 where: {...params}
|
|
|
2
yimity 2018-12-13 10:12:53 +08:00 via Android
其实这个主要是你写法的问题。 另一个方法试试 or。
|