Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dreampie/jfinal-sqlinxml

jfinal sql in xml plugin
https://github.com/dreampie/jfinal-sqlinxml

Last synced: about 2 months ago
JSON representation

jfinal sql in xml plugin

Awesome Lists containing this project

README

        

jfinal-sqlinxml
============

jfinal sqlinxml plugin,查看其他插件-> [Maven](http://search.maven.org/#search%7Cga%7C1%7Ccn.dreampie)

maven 引用 ${jfinal-sqlinxml.version}替换为相应的版本如:0.1

```xml

cn.dreampie
jfinal-sqlinxml
${jfinal-sqlinxml.version}

```

启用插件

```java

//sql语句plugin
plugins.add(new SqlInXmlPlugin());

```

sql文件以 xx_sql.xml结尾

```xml


SELECT `user`.*,`userInfo`.street street,`userInfo`.gender gender,
`userInfo`.zip_code zip_code,`province`.name province,`city`.name city,`county`.name
county,`userRole`.role_id role_id

FROM sec_user `user` LEFT JOIN sec_user_info `userInfo`
ON(`user`.id=`userInfo`.id)
LEFT JOIN sec_user_role `userRole` ON(`user`.id=`userRole`.user_id)
LEFT JOIN com_area `province` ON(`userInfo`.province_id=`province`.id) LEFT JOIN com_area `city`
ON(`userInfo`.city_id=`city`.id) LEFT JOIN com_area `county`
ON(`userInfo`.county_id=`county`.id) LEFT JOIN sec_user_role `userRole` ON
(`user`.id=`userRole`.user_id)


FROM sec_role `role` WHERE `role`.id IN (SELECT `userRole`.role_id FROM
sec_user_role `userRole` WHERE `userRole`.user_id=?)


FROM sec_permission `permission` WHERE `permission`.id IN (SELECT
`role_permission`.permission_id FROM sec_role_permission
`role_permission` WHERE `role_permission`.role_id=?)

```

获取sql内容

```java
//group+id
SqlKit.sql("user.findInfoBySelect")

```