MyBatis provides several annotations such as: @InsertProvider, @UpdateProvider, @DeleteProvider and @selectprovider, These are the ways to build dynamic languages and let MyBatis perform these languages using annotation-based mybatis, or better.
First is to define Mapper, @ Selectprovider to declare class (Citysqlprovide) and method name (findbystate),
Public Interface Citymapper { = citysqlprovide. Class"findbystate") List<City> findbystate (@Param (" State"), String State);
Second, it is difficult and error-prone to construct query statements with string. So MyBatis provides a method of constructing SQL common methods without having to write out a complete string statement . Let's look at the common methods of how to use Org.apache.ibatis.jdbc.SQL.
import Org.apache.ibatis.jdbc.SQL; Public class citysqlprovide { public string findbystate (string state) { return New SQL () { this. Select ("*"). From ("City"). WHERE ("state= #{state}");} . ToString (); }}
Spring Boot Learning six spring inherits MyBatis (note-based)