com.github.chengyuxing.sql.annotation.XQLMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rabbit-sql Show documentation
Show all versions of rabbit-sql Show documentation
Light wrapper of JDBC, support ddl, dml, query, plsql/procedure/function, transaction and manage sql
file.
package com.github.chengyuxing.sql.annotation;
import java.lang.annotation.*;
/**
* Mark an interface as a registered xql file mapper.
* Method behaviors priority:
*
* - Annotated with {@link Insert @Insert}
* {@link Update @Update}
* {@link Delete @Delete}
* {@link Procedure @Procedure}
* {@link Function @Function}
*
* - Annotated with {@link XQL @XQL}(type = {@link Type ...})
* - Method name pattern:
*
* - {@link com.github.chengyuxing.sql.XQLInvocationHandler#QUERY_PATTERN select}
* - {@link com.github.chengyuxing.sql.XQLInvocationHandler#INSERT_PATTERN insert}
* - {@link com.github.chengyuxing.sql.XQLInvocationHandler#UPDATE_PATTERN update}
* - {@link com.github.chengyuxing.sql.XQLInvocationHandler#DELETE_PATTERN delete}
* - {@link com.github.chengyuxing.sql.XQLInvocationHandler#CALL_PATTERN procedure/function}
*
*
*
*
* Method arguments support single argument object or multiple arguments which annotated with {@link Arg @Arg} .
*
* select * from table where id = :id or name = :name
*
* Single argument:
*
* // {id: 1, name: "name"}
* method(Map<String,Object> args) // Map
* method(Entity entity) // Java bean entity
*
* Multiple arguments:
*
* method(@Arg("id") int id, @Arg("name") String name)
*
* Method return type:
*
* - select: {@link java.util.stream.Stream Stream}
* {@link java.util.List List}
* {@link java.util.Optional Optional}
* {@link java.util.Map Map}
* {@link com.github.chengyuxing.common.DataRow DataRow}
* {@link com.github.chengyuxing.sql.page.IPageable Ipageable}
* {@link com.github.chengyuxing.sql.PagedResource PagedResource}
* {@link Integer}
* {@link Long}
* {@link Double}
* {@code
}
* - insert, update, delete: {@code int} {@link Integer}
* - procedure, function, ddl, plsql: {@link java.util.Map Map} {@link com.github.chengyuxing.common.DataRow DataRow}
*
*
* @see XQL @XQL
* @see CountQuery @CountQuery
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface XQLMapper {
/**
* XQL file Alias which defined in {@code xql-file-manager[-*].yml}.
*
* @return alias
*/
String value();
}