spring-boot - 我可以将 Spring Boot 组件“自动装配”到 MyBatis 查询吗?
问题描述
例如,这是一个示例查询:
<select id="selectCouponCodes" resultType="SomeDao">
select *
from temp_table
where code = #{code}
</select>
通常,我会将code
参数传递给 Mybatis 映射器。但是有很多查询使用相同的code
,所以我正在寻找一个不使用参数的快捷方式。像这样的东西:
<select id="selectCouponCodes" resultType="SomeDao">
select *
from temp_table
where code = #{$SomeComponent.code}
</select>
$SomeComponent
不是从参数传递的。相反,它是“自动装配”到查询的。有没有办法让这成为可能?如果这是不可能的,任何替代方案将不胜感激。
解决方案
推荐阅读
- javascript - javascript - 算法练习中的循环问题
- selenium - 如何从控制台获取 TestNG Eclipse 测试运行状态信息以在需要时使用它?
- c# - C# 正则表达式无法通过管道分隔符拆分字符串
- java - Oracle SQL 中的 java.sql.Timestamp 到日期转换
- proxy - 将 rethinkdb webUI 绑定到“localhost”和代理:拒绝连接或暴露给整个网络
- ruby-on-rails - 如何获取存储在 Rails 控制器的活动存储中的附件的 url
- javascript - 如何使用自定义外观列表隐藏列表下拉列表中的选择占位符
- android - 在 Android Kotlin 中的 Fragment 之间传递数据时出错
- android - 使用 setUserVisibleHint() 方法
- android - 如何打开文件管理器导航到android中的特定目录?