Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up表自连接属性冲突 #125
表自连接属性冲突 #125
Comments
|
你说的 |
返回
需要改写 AbstractSQLConfig.getColumnString 737 行
当 column.size() == 1 时,可能里面包含一个 SQL 函数,需要改成
我暂时没时间,你可以改完后发个 Pull Request 贡献代码,感谢 |
|
不小心删了我之前的回答:
返回
|
这个的修改方式应该就是直接 return SQL.count("*") 吧,然后去掉上边 origin 的 isName验证,既然HEAD是查询总记录数,返回max(id),也没有意义,像其他非聚合函数(比如一些转换函数cast等)的话, 返回原函数也不对,所以这里直接返回SQL.count("*")就ok吧 |
对 |
环境信息
问题描述
1.有一张表如下:
CREATE TABLEidentity_certificate(idbigint(20) unsigned NOT NULL AUTO_INCREMENT,mobilevarchar(32) NOT NULL DEFAULT '' COMMENT '手机号',namevarchar(32) NOT NULL DEFAULT '' COMMENT '姓名',idcardvarchar(32) NOT NULL DEFAULT '' COMMENT '身份证号',idcard_positive_urlvarchar(500) NOT NULL DEFAULT '' COMMENT '身份证正面图片',idcard_negative_urlvarchar(500) NOT NULL DEFAULT '' COMMENT '身份证反面图片',statusint(4) NOT NULL DEFAULT '0' COMMENT '认证状态(0-待审核;1-审核通过;2-已拒绝;3-二级审核中;)', PRIMARY KEY (id) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='实名认证表';2.现在需要查询表中的最大值,sql形式如下:
select r1.* from identity_certificate r1,(select max(id) as id from identity_certificate
group by idcard) r2 where r1.id=r2.id
3.使用apijson请求
{ "[]": { 'query': 2, "page": 0, "count": 0, "identity_certificate": { "@schema": "auth", "@column": "max(id):abcid", "@group": 'idcard', }, "identity_certificate": { "@schema": "auth", "id@": "/identity_certificate/abcid", }, }, "total@": "/[]/total" }错误信息
请求变成了,第一个属性被覆盖,导致请求变成了无结果的请求。
{"[]":{"query":2,"page":0,"count":0,"identity_certificate":{"@schema":"auth","id@":"/identity_certificate/abcid"}},"total@":"/[]/total"}结果:
{code: 200, msg: "success"}有类似于sql改名机制解决这个问题么?如何解决?