Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 在myBatis mapper中首先解析哪些参数,或者$one?_Sql_Xml_Mybatis_Mybatis Sql - Fatal编程技术网

Sql 在myBatis mapper中首先解析哪些参数,或者$one?

Sql 在myBatis mapper中首先解析哪些参数,或者$one?,sql,xml,mybatis,mybatis-sql,Sql,Xml,Mybatis,Mybatis Sql,我在映射器中使用一个标记,其中的文本包含一些外部{}参数: <sql id="searchInInterval"> (r01.start between to_date(#{${what}Date}, 'MMYYYY') and to_date(#{thirdDate}, 'MMYYYY')) 稍后在XML映射器中,当我使用它时 <include refid="searchInInterval"> <property name="what" val

我在映射器中使用一个标记,其中的文本包含一些外部{}参数:

<sql id="searchInInterval">
    (r01.start between to_date(#{${what}Date}, 'MMYYYY') and to_date(#{thirdDate}, 'MMYYYY'))
稍后在XML映射器中,当我使用它时

<include refid="searchInInterval">
    <property name="what" value="first"/>
</include>
,将首先解析哪个参数?还是$one?

${}首先解决文本替换问题

如果${}位于类似您的示例的内部,MyBatis会在解析映射程序文件时(即在应用程序启动期间)尝试替换它。 如果在此阶段中找不到匹配的属性[1],MyBatis会在执行语句时通过查找运行时参数来替换它

[1] 除了嵌套的内部属性外,还可以在中声明属性