ibatis.binding.BindingException: Parameter '*' not found. Available parameters are [arg1, arg0, p...

背景:

springboot项目,使用mybatis-plus,实现模糊查询

public interface BedequipmentMapper extends BaseMapper {
    List getEquipmentFrontList(Page page,EquipmentQuery equipmentQuery);
}
            parameterType="cn.moonmark.equipmentservice.entity.vo.EquipmentQuery"
            resultType="cn.moonmark.equipmentservice.entity.Bedequipment">
        SELECT
            a.bedEquipmentId,
            a.wirelessMAC,
            a.bedBehaviorTime,
            a.bedBehaviorVersion,
            a.isBed,
            b.bedUpgradeTypeName
        FROM bedequipment a
            LEFT JOIN bedupgradetype b ON a.upgradeType = b.bedUpgradeTypeId
        
            
                and a.bedEquipmentId like concat('%',#{bedEquipmentId},'%')
            
            ...
        
        ORDER BY a.bedBehaviorTime DESC
    

报错点:

BindingException: Parameter 'bedEquipmentId ' not found. Available parameters are [arg1, arg0, param1, param2]

根据报错内容,可以大致知道是参数识别问题。

经过测试,单个参数不影响查询,多个参数会报错。

所以需要在List getEquipmentFrontList(Page page,EquipmentQuery equipmentQuery);的参数前添加注解 @param

@Component(value = "BedequipmentMapper")
public interface BedequipmentMapper extends BaseMapper {
    List getEquipmentFrontList(Page page, 
                                                   @Param("query") EquipmentQuery equipmentQuery);
}

即可。

你可能感兴趣的:(ibatis.binding.BindingException: Parameter '*' not found. Available parameters are [arg1, arg0, p...)