All Projects → mybatis → Mybatis Dynamic Sql

mybatis / Mybatis Dynamic Sql

Licence: other
SQL DSL (Domain Specific Language) for Kotlin and Java. Supports rendering for MyBatis or Spring JDBC Templates

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Mybatis Dynamic Sql

Moses
Utility library for functional programming in Lua
Stars: ✭ 541 (-11.89%)
Mutual labels:  functional-programming
Mybatis Generator Gui Extension
图形化MBG,内置丰富插件,可生成Service、Controller、View,配置简单。 A powerful GUI tool for MyBatisGenerator(MBG)
Stars: ✭ 583 (-5.05%)
Mutual labels:  mybatis
Funfix
Functional Programming Library for JavaScript, TypeScript and Flow ✨⚡️
Stars: ✭ 596 (-2.93%)
Mutual labels:  functional-programming
Learn Fp
learn-by-doing course/tutorial for functional programming on scala
Stars: ✭ 548 (-10.75%)
Mutual labels:  functional-programming
Mogu blog v2
蘑菇博客(MoguBlog),一个基于微服务架构的前后端分离博客系统。Web端使用Vue + Element , 移动端使用uniapp和ColorUI。后端使用Spring cloud + Spring boot + mybatis-plus进行开发,使用 Jwt + Spring Security做登录验证和权限校验,使用ElasticSearch和Solr作为全文检索服务,使用Github Actions完成博客的持续集成,使用ELK收集博客日志,文件支持上传七牛云和Minio,支持Docker Compose脚本一键部署。
Stars: ✭ 561 (-8.63%)
Mutual labels:  mybatis
Functional Programming Learning Path
A Learning Path for Functional Programming
Stars: ✭ 582 (-5.21%)
Mutual labels:  functional-programming
Macroid
A modular functional UI language for Android
Stars: ✭ 537 (-12.54%)
Mutual labels:  functional-programming
Felix
The Felix Programming Language
Stars: ✭ 609 (-0.81%)
Mutual labels:  functional-programming
React Best Practices
A comprehensive reference guide to kickstart your React architecting career!
Stars: ✭ 566 (-7.82%)
Mutual labels:  functional-programming
Fkit
A functional programming toolkit for JavaScript.
Stars: ✭ 588 (-4.23%)
Mutual labels:  functional-programming
Carina
Carina automation framework: Web, Mobile, API, DB
Stars: ✭ 549 (-10.59%)
Mutual labels:  mybatis
Fastcore
Python supercharged for the fastai library
Stars: ✭ 565 (-7.98%)
Mutual labels:  functional-programming
Jeesuite Libs
分布式架构开发套件。包括缓存(一二级缓存、自动缓存管理)、队列、分布式定时任务、文件服务(七牛、阿里云OSS、fastDFS)、日志、搜索、分布式锁、分布式事务、集成dubbo、spring boot支持以及常用的工具包等。
Stars: ✭ 584 (-4.89%)
Mutual labels:  mybatis
Pampy.js
Pampy.js: Pattern Matching for JavaScript
Stars: ✭ 544 (-11.4%)
Mutual labels:  functional-programming
Ruoyi Vue
(RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue & Element 的前后端分离权限管理系统
Stars: ✭ 596 (-2.93%)
Mutual labels:  mybatis
Bow
🏹 Bow is a cross-platform library for Typed Functional Programming in Swift
Stars: ✭ 538 (-12.38%)
Mutual labels:  functional-programming
Caliban
Functional GraphQL library for Scala
Stars: ✭ 581 (-5.37%)
Mutual labels:  functional-programming
Ssm
手把手教你整合最优雅SSM框架:SpringMVC + Spring + MyBatis
Stars: ✭ 5,556 (+804.89%)
Mutual labels:  mybatis
Perfect Ssm
🍇更完善的Spring+SpringMVC+Mybatis+easyUI后台管理系统(RESTful API+redis)
Stars: ✭ 606 (-1.3%)
Mutual labels:  mybatis
Bash Oo Framework
Bash Infinity is a modern standard library / framework / boilerplate for Bash
Stars: ✭ 5,247 (+754.56%)
Mutual labels:  functional-programming

MyBatis Dynamic SQL

Build Status Coverage Status Maven central Sonatype Nexus (Snapshots) License Quality Gate Status Security Rating

What Is This?

This library is a general purpose SQL generator. Think of it as a typesafe and expressive SQL DSL (domain specific language), with support for rendering SQL formatted properly for MyBatis3 and Spring's NamedParameterJDBCTemplate.

The library also contains extensions for Kotlin that enable an idiomatic Kotlin DSL for SQL.

The library will generate full DELETE, INSERT, SELECT, and UPDATE statements. The DSL implemented by the library is very similar to native SQL but it includes many functions that allow for very dynamic SQL statements. For example, a typical search can be coded with a query like this (the following code is Kotlin, but Java code is very similar):

   fun search(id: String?, firstName: String?, lastName: String?) =
        select(Customer.id, Customer.firstName, Customer.lastName) {
            from(Customer)
            where(Customer.active, isEqualTo(true))
            and(Customer.id, isEqualToWhenPresent(id).map{ it?.padStart(5, '0') })
            and(Customer.firstName, isLikeCaseInsensitiveWhenPresent(firstName)
                .map{ "%" + it.trim() + "%" })
            and(Customer.lastName, isLikeCaseInsensitiveWhenPresent(lastName)
                .map{ "%" + it.trim() + "%" })
            orderBy(Customer.lastName, Customer.firstName)
            limit(500)
        }

This query does quite a lot...

  1. It is a search with three search criteria - any combination of search criteria can be used
  2. Only records with an active status will be returned
  3. If id is specified, it will be padded to length 5 with '0' at the beginning of the string
  4. If firstName is specified, it will be used in a case-insensitive search and SQL wildcards will be appended
  5. If lastName is specified, it will be used in a case-insensitive search and SQL wildcards will be appended
  6. The query results are limited to 500 rows

Using the dynamic SQL features of the library eliminates a lot of code that would be required for checking nulls, adding wild cards, etc. This query clearly expresses the intent of the search in just a few lines.

See the following pages for detailed information:

Page Comments
Quick Start Shows a complete example of building code for this library
MyBatis3 Support Information about specialized support for MyBatis3. The examples on this page are similar to the code generated by MyBatis Generator
Kotlin Support with MyBatis3 Information about the Kotlin extensions and Kotlin DSL when using MyBatis3 as the runtime
Spring Support Information about specialized support for Spring JDBC Templates
Kotlin Support with Spring Information about the Kotlin extensions and Kotlin DSL when using Spring JDBC Template as the runtime
Spring Batch Support Information about specialized support for Spring Batch using the MyBatis Spring Integration

The library test cases provide several complete examples of using the library in various different styles:

Language Runtime Comments Code Directory
Java MyBatis3 Example using Java utility classes for MyBatis in the style of MyBatis Generator src/test/java/examples/simple
Java MyBatis3 Example using Java utility classes for the MyBatis integration with Spring Batch src/test/java/examples/springbatch
Java Spring JDBC Example using Java utility classes for Spring JDBC Template src/test/java/examples/spring
Kotlin MyBatis3 Example using Kotlin utility classes for MyBatis in the style of MyBatis Generator src/test/kotlin/examples/kotlin/mybatis3/canonical
Kotlin Spring JDBC Example using Kotlin utility classes for Spring JDBC Template src/test/kotlin/examples/kotlin/spring/canonical

Requirements

The library has no dependencies. Java 8 or higher is required.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].