问题描述:
xml文件中 使用parameterType 引入自定义类型报错 BindingException
nested exception is org.apache.ibatis.binding.BindingException: Parameter 'usedCompanyId' not found. Available parameters are [dto, param1]解决方案:
xml文件对应的接口类中 接口参数不要添加 @Param 注解
AssetDetailVo getAndLockAsset(@Param("assetId") Long assetId);
//<select id="getAndLockAsset" resultType="com.mlamp.core.model.asset.vo.AssetDetailVo"/>
List<AssetPrintVo> page(AssetPrintQueryDto dto);
//<select id="page" resultType="com.mlamp.core.model.asset.vo.AssetPrintVo" parameterType="com.mlamp.core.model.asset.dto.AssetPrintQueryDto">

本文解决了一个在使用MyBatis框架时遇到的问题:当XML文件中使用parameterType引入自定义类型时出现的BindingException错误。通过调整接口参数的注解使用方式,成功避免了该错误。
1262

被折叠的 条评论
为什么被折叠?



