Param
This commit is contained in:
32
src/main/java/org/redkale/annotation/Param.java
Normal file
32
src/main/java/org/redkale/annotation/Param.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.redkale.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import static java.lang.annotation.ElementType.PARAMETER;
|
||||||
|
import java.lang.annotation.Inherited;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数名注解,编译时加上 <b>-parameters</b> 参数可以不用此注解
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* 详情见: https://redkale.org
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*
|
||||||
|
* @since 2.8.0
|
||||||
|
*/
|
||||||
|
@Inherited
|
||||||
|
@Documented
|
||||||
|
@Target({PARAMETER})
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
public @interface Param {
|
||||||
|
|
||||||
|
String value();
|
||||||
|
|
||||||
|
String comment() default "";
|
||||||
|
}
|
||||||
@@ -11,10 +11,10 @@ import org.redkale.util.RedkaleClassLoader;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 原生的sql解析器 <br>
|
* 原生的sql解析器 <br>
|
||||||
* 参数变量有三种方式: <br>
|
* 参数变量有三种方式(与Mybatis的占位符类似): <br>
|
||||||
* #{xx.xx}: 用于拼接sql的变量, 变量值必需的
|
* ${xx.xx}: 用于直接拼接sql的变量,不做任何转义, 变量值必需的
|
||||||
* ${xx.xx}: 用于预编译的sql的参数变量
|
* #{xx.xx}: 用于预编译的sql的参数变量
|
||||||
* $${xx.xx}: 用于预编译的sql的参数变量, 变量值必需的
|
* ##{xx.xx}: 用于预编译的sql的参数变量, 变量值必需的
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 详情见: https://redkale.org
|
* 详情见: https://redkale.org
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class DataNativeSqlStatement {
|
|||||||
//根据参数值集合重新生成的带?参数可执行的计算总数sql,用于返回Sheet对象
|
//根据参数值集合重新生成的带?参数可执行的计算总数sql,用于返回Sheet对象
|
||||||
protected String nativeCountSql;
|
protected String nativeCountSql;
|
||||||
|
|
||||||
//需要预编译的$${xxx}、${xxx}参数名, 数量与sql中的?数量一致
|
//需要预编译的##{xxx}、#{xxx}参数名, 数量与sql中的?数量一致
|
||||||
protected List<String> paramNames;
|
protected List<String> paramNames;
|
||||||
|
|
||||||
//需要预编译的jdbc参数名, 数量与sql中的?数量一致
|
//需要预编译的jdbc参数名, 数量与sql中的?数量一致
|
||||||
|
|||||||
@@ -16,28 +16,28 @@ public interface ForumInfoMapper extends BaseMapper<ForumInfo> {
|
|||||||
@Sql("SELECT f.forum_groupid, s.forum_section_color "
|
@Sql("SELECT f.forum_groupid, s.forum_section_color "
|
||||||
+ "FROM forum_info f, forum_section s "
|
+ "FROM forum_info f, forum_section s "
|
||||||
+ " WHERE f.forumid = s.forumid AND "
|
+ " WHERE f.forumid = s.forumid AND "
|
||||||
+ "s.forum_sectionid = ${bean.forumSectionid} AND "
|
+ "s.forum_sectionid = #{bean.forumSectionid} AND "
|
||||||
+ "f.forumid = ${bean.forumid} AND s.forum_section_color = ${bean.forumSectionColor}")
|
+ "f.forumid = #{bean.forumid} AND s.forum_section_color = #{bean.forumSectionColor}")
|
||||||
public ForumResult findForumResult(ForumBean bean);
|
public ForumResult findForumResult(ForumBean bean);
|
||||||
|
|
||||||
@Sql("SELECT f.forum_groupid, s.forum_section_color "
|
@Sql("SELECT f.forum_groupid, s.forum_section_color "
|
||||||
+ "FROM forum_info f, forum_section s "
|
+ "FROM forum_info f, forum_section s "
|
||||||
+ " WHERE f.forumid = s.forumid AND "
|
+ " WHERE f.forumid = s.forumid AND "
|
||||||
+ "s.forum_sectionid = ${bean.forumSectionid} AND "
|
+ "s.forum_sectionid = #{bean.forumSectionid} AND "
|
||||||
+ "f.forumid = ${bean.forumid} AND s.forum_section_color = ${bean.forumSectionColor}")
|
+ "f.forumid = #{bean.forumid} AND s.forum_section_color = #{bean.forumSectionColor}")
|
||||||
public CompletableFuture<ForumResult> findForumResultAsync(ForumBean bean);
|
public CompletableFuture<ForumResult> findForumResultAsync(ForumBean bean);
|
||||||
|
|
||||||
@Sql("SELECT f.forum_groupid, s.forum_section_color "
|
@Sql("SELECT f.forum_groupid, s.forum_section_color "
|
||||||
+ "FROM forum_info f, forum_section s "
|
+ "FROM forum_info f, forum_section s "
|
||||||
+ " WHERE f.forumid = s.forumid AND "
|
+ " WHERE f.forumid = s.forumid AND "
|
||||||
+ "s.forum_sectionid = ${bean.forumSectionid} AND "
|
+ "s.forum_sectionid = #{bean.forumSectionid} AND "
|
||||||
+ "f.forumid = ${bean.forumid} AND s.forum_section_color = ${bean.forumSectionColor}")
|
+ "f.forumid = #{bean.forumid} AND s.forum_section_color = #{bean.forumSectionColor}")
|
||||||
public List<ForumResult> queryForumResult(ForumBean bean);
|
public List<ForumResult> queryForumResult(ForumBean bean);
|
||||||
|
|
||||||
@Sql("SELECT f.forum_groupid, s.forum_section_color "
|
@Sql("SELECT f.forum_groupid, s.forum_section_color "
|
||||||
+ "FROM forum_info f, forum_section s "
|
+ "FROM forum_info f, forum_section s "
|
||||||
+ " WHERE f.forumid = s.forumid AND "
|
+ " WHERE f.forumid = s.forumid AND "
|
||||||
+ "s.forum_sectionid = ${bean.forumSectionid} AND "
|
+ "s.forum_sectionid = #{bean.forumSectionid} AND "
|
||||||
+ "f.forumid = ${bean.forumid} AND s.forum_section_color = ${bean.forumSectionColor}")
|
+ "f.forumid = #{bean.forumid} AND s.forum_section_color = #{bean.forumSectionColor}")
|
||||||
public CompletableFuture<List<ForumResult>> queryForumResultAsync(ForumBean bean);
|
public CompletableFuture<List<ForumResult>> queryForumResultAsync(ForumBean bean);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user