All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.chengyuxing.sql.annotation.XQLMapper Maven / Gradle / Ivy

Go to download

Light wrapper of JDBC, support ddl, dml, query, plsql/procedure/function, transaction and manage sql file.

There is a newer version: 9.0.2
Show newest version
package com.github.chengyuxing.sql.annotation;

import java.lang.annotation.*;

/**
 * Mark an interface as a registered xql file mapper.
 * 

Method behaviors priority:

*
    *
  1. Annotated with {@link Insert @Insert} * {@link Update @Update} * {@link Delete @Delete} * {@link Procedure @Procedure} * {@link Function @Function} *
  2. *
  3. Annotated with {@link XQL @XQL}(type = {@link Type ...})
  4. *
  5. 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}
    • *
    *
  6. *
* *

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(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy