Mybatis的细节问题
1、
同一个变量 @RequestParam和@PathVariable不能同时使用
@PathVariable(参数名可以不匹配)
2、invalid comparison: java.util.Date and java.lang.String
因为modifyDate为Date类型不能使用 modifyDate!=’’,删掉就好了
3、Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found
在使用count(*) 时记得加上 resultType=“int”
4、org.apache.ibatis.exceptions.PersistenceException: Error querying database. Cause: org.apache.ibatis.binding.BindingException: Parameter ‘productName’ not found. Available parameters are [arg0, pageSize, param3, param1, currentPageNo, param2] Cause: org.apache.ibatis.binding.BindingException: Parameter ‘productName’ not found. Available parameters are [arg0, pageSize, param3, param1, currentPageNo, param2]
public List getBillList(Bill bill,@Param(“currentPageNo”) Integer currentPageNo,@Param(“pageSize”) Integer pageSize)throws Exception;这里不能同时使用除了基本类型的数据
正确: public List getBillList(@Param(“productName”) String productName,@Param(“providerId”) Integer providerId,@Param(“isPayment”)Integer isPayment,@Param(“currentPageNo”) Integer currentPageNo,@Param(“pageSize”) Integer pageSize)throws Exception
5、Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘currentPageNo’ in 'class cn.smbms.pojo.Bill’Cause:org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘currentPageNo’ in 'class cn.smbms.pojo.Bil`
要删掉 <if test="currentPageNo!=null and currentPageNo!=0 and pageSize!=null and pageSize!=0"> limit #{currentPageNo},#{pageSize} </if>
不然会找不到这两个参数报错