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

orderby nor working in v2 too #162

Closed
azhai2016 opened this issue Aug 7, 2019 · 7 comments
Closed

orderby nor working in v2 too #162

azhai2016 opened this issue Aug 7, 2019 · 7 comments
Labels
bug

Comments

@azhai2016
Copy link

@azhai2016 azhai2016 commented Aug 7, 2019

No description provided.

@ClickSimply

This comment has been minimized.

Copy link
Owner

@ClickSimply ClickSimply commented Aug 8, 2019

There's quite a few orderby commands that run in the tests before each release.

Could you provide some example code?

@azhai2016

This comment has been minimized.

Copy link
Author

@azhai2016 azhai2016 commented Aug 8, 2019

`export const selectStockList = (params,limit,offset) => {

return nSQL("stocks")
.query("select")
.where(params)
.join({
type: "left",
with: {table: "products"},
on: ["stocks.pid","=","products.商品条码"]
})
.orderBy(["stocks.num ASC","products.通用名 ASC"])
.limit(limit)
.offset(offset)
.exec()
/*.then(res => {
return res.sort((a, b) => {
return a['stocks.num'] > b['stocks.num'] ? 1 : -1;
})
})
.then(r => {
return nSQL().query("select").from(r)
.limit(limit)
.offset(offset)
.exec()

})*/
}’

@azhai2016

This comment has been minimized.

Copy link
Author

@azhai2016 azhai2016 commented Aug 8, 2019

`return nSQL().query("select").from(r)
.limit(limit)
.offset(offset)
.exec()‘
limit and offset in from not working?

@azhai2016

This comment has been minimized.

Copy link
Author

@azhai2016 azhai2016 commented Aug 8, 2019

`[{"stocks.id":"iF2yf6Xq","stocks.pid":"6928623038603","stocks.num":1,"products.id":"4078","products.分类编码":"011601","products.分类名称":"外用含激素类药","products.商品条码":"6928623038603","products.通用名":"丙酸氯倍他索软膏","products.处方":"","products.助记符":"BSLBTSRG","products.规格":"10g10支","products.产地":"安徽省宣城","products.生产厂家":"福元药业股份有限公司(安徽新和成皖南药业)","products.单位":"盒","products.剂型编码":"41","products.剂型名称":"乳膏剂","products.有效期":"","products.处方药":"是","products.是否中药":"否","products.最后进价":0.96,"products.批准文号":"国药准字H34023860","products.批发价":0,"products.配送价":0,"products.零售价":1.5,"products.存储条件":"常温","products.管理方式":"一般商品","products.功能主治":"","products.进口药品":"否","products.中包装":1,"products.大包装":1,"products.医保分类编码":"","products.进口药品注册证":"","products.医保分类名称":""},{"stocks.id":"vi6BDtgZ","stocks.pid":"6938256465646","stocks.num":8,"products.id":"3238","products.分类编码":"011102","products.分类名称":"利胆药、胆石溶解及排石药","products.商品条码":"6938256465646","products.通用名":"益胆片(晟康)(迪尔)","products.处方":"","products.助记符":"YDP(SK)(DE)","products.规格":"0.55g24片","products.产地":"安徽省合肥市","products.生产厂家":"合肥迪尔医药生物工程有限公司","products.单位":"盒","products.剂型编码":"38","products.剂型名称":"片剂","products.有效期":"720","products.处方药":"是","products.是否中药":"否","products.最后进价":33.15,"products.批准文号":"国药准字Z20093015","products.批发价":0,"products.配送价":0,"products.零售价":39,"products.存储条件":"常温","products.管理方式":"一般商品","products.功能主治":"","products.进口药品":"否","products.中包装":1,"products.大包装":1,"products.医保分类编码":"03","products.进口药品注册证":"","products.医保分类名称":"丙类"}]

@azhai2016

This comment has been minimized.

Copy link
Author

@azhai2016 azhai2016 commented Aug 8, 2019

Thinks a lot! please test "stocks.num ASC" or "stocks.num DESC "

@azhai2016

This comment has been minimized.

Copy link
Author

@azhai2016 azhai2016 commented Aug 8, 2019

And I need your help about '.. query('select',['products.通用名 AS tym' ]) ...' . #161

@ClickSimply ClickSimply added the bug label Aug 8, 2019
ClickSimply pushed a commit that referenced this issue Aug 12, 2019
ClickSimply pushed a commit that referenced this issue Aug 12, 2019
@ClickSimply

This comment has been minimized.

Copy link
Owner

@ClickSimply ClickSimply commented Aug 12, 2019

2.3.6 is now live. The limit/offset bug and orderby bug should be taken care of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.