yangaijun / multipleselect

java 结合mybatis-plus 实现非手写sql多表查询
101 stars 24 forks source link

表自连 #9

Open Er-Dong-Chen opened 4 years ago

Er-Dong-Chen commented 4 years ago

`select distinct meuproductcategory.serial_version_u_i_d serialVersionUID,meuproductcategory.id id,meuproductcategory.id parentId,meuproductcategory.name name,meuproductcategory.level level,meuproductcategory.product_count productCount,meuproductcategory.product_unit productUnit,meuproductcategory.nav_status navStatus,meuproductcategory.show_status showStatus,meuproductcategory.sort sort,meuproductcategory.icon icon,meuproductcategory.keywords keywords,meuproductcategory.description description,meuproductcategory.serial_version_u_i_d serialVersionUID,meuproductcategory.id id,meuproductcategory.id parentId,meuproductcategory.name name,meuproductcategory.level level,meuproductcategory.product_count productCount,meuproductcategory.product_unit productUnit,meuproductcategory.nav_status navStatus,meuproductcategory.show_status showStatus,meuproductcategory.sort sort,meuproductcategory.icon icon,meuproductcategory.keywords keywords,meuproductcategory.description description from meu_product_category as meuproductcategory left join meu_product_category as meuproductcategory on meuproductcategory.id = meuproductcategory.id

Cause: java.sql.SQLSyntaxErrorException: Not unique table/alias: 'meuproductcategory'

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Not unique table/alias: 'meuproductcategory' at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:93) ~[spring-jdbc-5.2.1.RELEASE.jar:5.2.1.RELEASE]`

想要查询的是这中的是不是不行啊 select * from meu_product_category as c1 left join meu_product_category as c2 on c1.id = c2.parent_id

yangaijun commented 4 years ago

实现的是简单的通用查询,些功能待扩展

Er-Dong-Chen commented 4 years ago

嗯嗯,期待着,那后期会往那种自定义连接方面扩展嘛

yangaijun commented 4 years ago

还有一些select 嵌套,还没想到比较优雅的使用方法,惭愧