Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

完全找不到CRUD的查询配置规则 #131

Closed
pangxiaolong opened this issue Aug 16, 2023 · 0 comments
Closed

完全找不到CRUD的查询配置规则 #131

pangxiaolong opened this issue Aug 16, 2023 · 0 comments

Comments

@pangxiaolong
Copy link

https://cool-js.com/admin/node/core/controller.html#%E5%AE%8C%E6%95%B4%E7%A4%BA%E4%BE%8B

这里面提供的例子里面
// 增加其他条件 where: async (ctx) => { // 获取body参数 const { a } = ctx.request.body; return [ // 价格大于90 ['a.price > :price', { price: 90.00 }], // 满足条件才会执行 ['a.price > :price', { price: 90.00 }, '条件'], // 多个条件一起 ['(a.price = :price or a.userId = :userId', { price: 90.00, userId: ctx.admin.userId }] ] },

上面表格里只标注where参数类型是Function说明是其他查询条件

首先按例子来看 参数是Function 必须要返回的一个二维数组?
而且数组元素还有具体规则要求?数组第一个元素是用来判断字段的字符串?字符串具体规则是什么啊?
其次 第二个元素是什么?价格大于90 返回 { price: 90.00 }?第三个字符串可传入的除了“条件”又有哪些?
最后const { a } = ctx.request.body里面的a结构出来用来干嘛了啊?

@cool-team-official

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants