Mybatis3 insert 和 SqlBuilder

	/**
	 * 插入	且返回影响行数
	 * 		且实体保存新增编号
	 * @param entity
	 * @return
	 */
	@InsertProvider(method = "insert", type = UserTypeSqlBuilder.class)
	Integer insert(UserType entity);
 
import static org.apache.ibatis.jdbc.SelectBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.*;

public class UserTypeSqlBuilder{

       public String insert(){
		BEGIN();
		INSERT_INTO(TABLE);
		VALUES("typeName",	"#{typeName}");
		VALUES("remark",	"#{remark}");
		VALUES("addDate",	"#{addDate}");
		VALUES("editDate",	"#{editDate}");
		return SQL();
	}
}
 

你可能感兴趣的:(Mybatis3)