# jfinal-sql-spec **Repository Path**: cjkdev/jfinal-sql-spec ## Basic Information - **Project Name**: jfinal-sql-spec - **Description**: No description available - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2019-03-31 - **Last Updated**: 2021-11-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Jfinal-sql-spec ##### 注意:为了命名统一,直接修改jfinal源代码添加功能,侵入性强,仅供参考。 #### 介绍 Jfinal-sql-spec 是对java极速web框架 jfinal spec查询的一个扩充,简化开发者的学习应用成本,为您节约更多时间,去陪恋人、家人和朋友。 ##### SELECT * FROM `blog` WHERE title='test 1' ``` List blogs = Blog.dao.findBy("title=?", "test 1"); ``` ##### SELECT * FROM `blog` WHERE title='test 1' OR title LIKE '%test%' GROUP BY title ORDER BY title DESC LIMIT 0, 100 ``` List blogs = Blog.dao.findBy( Spec.where("title=?", "test 1") .or("title", Cnd.__LIKE__, "test") .orderBy("title", "desc") .limit(100)); ``` ##### SELECT * FROM `blog` WHERE title='test 1' OR (title LIKE '%test') GROUP BY title ORDER BY title DESC LIMIT 0, 100 ``` List blogs = Blog.dao.findBy( Spec.where("title=?", "test 1") .or(Cnd.create("title", Cnd.__LIKE, "test")) .groupBy("title") .orderBy("title", "desc") .limit(100)); ``` ##### SELECT a.id,a.name,b.title FROM `user` a LEFT JOIN `blog` b ON a.blog_id=b.id WHERE a.id=1 LIMIT 0, 10 ``` SqlSelect sqlSelect =Sql.select("a.id,a.name,b.title") .from(User.table, "a") .leftJoin(Blog.table, "b", "a.blog_id=b.id") .where("a.id=?", 1); Page page = Db.paginate(sqlSelect); ``` ##### SELECT a.id,a.name,b.title FROM `user` a ##### LEFT JOIN `blog` b ON a.blog_id=b.id ##### WHERE a.name='AAA' OR (b.title LIKE '%test') ##### ORDER BY title ##### DESC LIMIT 0, 100 ``` Spec spec = Spec.where("a.name=?", "AAA") .or(Cnd.create("b.title", Cnd.__LIKE, "test")) .orderBy("title", "desc") .limit(100); SqlSelect sqlSelect = Sql.select("a.id,a.name,b.title") .from(User.table, "a") .leftJoin(Blog.table, "b", "a.blog_id=b.id") .where(spec); Page page = Db.paginate(sqlSelect); ```