Giter VIP home page Giter VIP logo

jfinal-sqlinxml's Introduction

jfinal-sqlinxml

jfinal sqlinxml plugin,查看其他插件-> Maven

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

<dependency>
 <groupId>cn.dreampie</groupId>
 <artifactId>jfinal-sqlinxml</artifactId>
 <version>${jfinal-sqlinxml.version}</version>
</dependency>

启用插件

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

sql文件以 xx_sql.xml结尾

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<sqlRoot>

  <sqlGroup name="user">
    <sql id="findInfoBySelect">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
    </sql>
    <sql id="findInfoByFrom">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)
    </sql>
  </sqlGroup>

  <sqlGroup name="role">
    <sql id="findUserByFrom">FROM sec_role `role` WHERE `role`.id IN (SELECT `userRole`.role_id FROM
      sec_user_role `userRole` WHERE `userRole`.user_id=?)
    </sql>
  </sqlGroup>

  <sqlGroup name="userRole">

  </sqlGroup>

  <sqlGroup name="permission">
    <sql id="findRoleByFrom">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>
  </sqlGroup>

  <sqlGroup name="rolePermission">

  </sqlGroup>
</sqlRoot>

获取sql内容

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

jfinal-sqlinxml's People

Watchers

张伟 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.