Mybaits注解方式 There is no getter for property named 'name' in 'class java.lang.String'

接口层的代码:

@Select("select cid,rl.companyName `name`,(select IFNULL(companyLogo,'') from company cp where cp.cid = rl.cid) as companyLogo,merRealStatus "
			+ "from RealNameAuditingFromJDJR rl where 1=1 "
			+ ""
			+ "and rl.companyName like '${name}'  "
			+ ""
			+ "order by createTime desc")
	@Options(statementType=StatementType.CALLABLE)
	List> getAllCompanyList(String name);

 
  

解决办法:

加一个@Param("name")就好了:

@Select("select cid,rl.companyName `name`,(select IFNULL(companyLogo,'') from company cp where cp.cid = rl.cid) as companyLogo,merRealStatus "
			+ "from RealNameAuditingFromJDJR rl where 1=1 "
			+ ""
			+ "and rl.companyName like '${name}'  "
			+ ""
			+ "order by createTime desc")
	@Options(statementType=StatementType.CALLABLE)
	List> getAllCompanyList(@Param("name")String name);



关于参数是否参与过滤的写法:

1、if test中的参数名称不需要加${};

2、${}和#{}的区别

      #{}是占位符,比${}更安全

      如果是in查询,一定需要用${},注意构造参数的格式如单引号

你可能感兴趣的:(Mybatis)