Comments (4)
xml里面有order by的话,你再使用动态拼order by肯定有问题,sqlserver那种情况是同一份代码吗?如果是的话应该是jsqlparser拿到sql把order by截掉了
from choerodon-starters.
关于mysql和oracle的情况,后面会加上sql校验的,如果你xml里面写的有默认order by再用doPageAndSort方法抛异常,而不是直接放到数据库里面跑sql错误
from choerodon-starters.
是同一份代码,jsqlparser没有截掉,保留了这个排序。我说一下我这边的问题吧。。。
-
首先是一个SQL,简单的SELECT ... FROM ... JOIN ... WHERE,并且指定了默认排序是一个ID字段,在MySQL中没有问题。迁移到SqlServer中之后,报错:
Ambiguous column name 'xxx'.
。我查看原因的时候发现是SqlServerParser中默认的这个排序字段没有带上表别名,但是查询列中的字段是带表别名的,所以他认为这两个列不同,将这个不带表别名的列自动添加到了查询列中,也就是issue #7。 -
解决上一个问题的时候,我发现如果我在自己的SQL中指定一个ORDER BY字段,这个字段是带表别名的(也是默认排序字段,我没有尝试其他字段),那么最终就能够正常执行。默认的不带表别名的排序字段并没有生效。
-
当我添加排序之后,又切换回到MySQL中的时候,又出现issue #9所说的问题,所以我希望能够实现的效果应该和SQL Server中一样,解析到又ORDER BY字段的时候,不要添加默认的排序列。
from choerodon-starters.
首先,如果你xml里面自定义的sql有order by了,就不能用doPageAndSort方法了。如果你要自己做动态order by ,在xml里写${column}然后传参传过去就行,然后你只用分页doPage方法就行了。你用doPageAndSort,这个方法会拿你xml的sql先拼order by然后在拼分页参数。你原始sql有order by肯定是报错的,目前没做处理就报sql错误,如果我这边加上判断,也是抛个exception,不让这么用的
from choerodon-starters.
Related Issues (13)
- Is there relationship between choerodon framework version and choerodon starters version? HOT 2
- [0.8.1.RELEASE] TiDB数据库环境下choerodon-tool-liquibase 执行groovy脚本连接断开 HOT 5
- starter-config-client 路由定位器解析路由BUG HOT 1
- Why can not user PageHelper.doPageAndSort to sort field which not in DO/Entity HOT 4
- 这个依赖在没上传?? HOT 2
- 没有正确处理心跳,websocket保活并不启作用. HOT 1
- 0.16.0的tag怎么没有?
- choerodon-framework-parent 0.17找不到啊
- 依赖找不到,是你们的Maven仓库有问题吗? HOT 1
- jsqlparser升级后SqlServerParser报错 HOT 1
- [master] SqlServerParser排序列自动拼接到SQL查询列中的问题 HOT 6
- choerodon-starter-mybatis-mapper简介
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from choerodon-starters.