想用 sequelize 实现下面这样的功能,不知道该咋写,根据查询参数动态组合 where 里的条件let { name, age, gender } = this.request.querylet sql = `SELECT * FROM myTable WHERE status = 'active'`if(name) { sql += ` AND name=${name}`}if(age) { sql += ` AND age=${age}`}if(gender) { sql += ` AND gender=${name}`}let data = await db.query(sql)
添加回答
举报
0/150
提交
取消