用mybatis遇到了个问题。
首先上关键代码:
public interface ModuleMapper {
List<Module> queryByParentCode(String parentCode) throws Exception ;
}
<select id="queryByParentCode" parameterType="string" resultType="module">
select
m.moduleCode,m.moduleName,
m.moduleUrl,m.moduleDesc,
m.moduleIcon,m.isLeaf,
m.level,m.parent
from
module m
<where>
<choose>
<when test="parentCode != null">
m.parent = #{parentCode}
</when>
<otherwise>
m.parent is null
</otherwise>
</choose>
</where>
</select>
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'parentCode' in 'class java.lang.String'
试一下:
List queryByParentCode(@Param(value="parentCode") String parentCode) throws Exception ;
parameterType="string" ->换成Map
List queryByParentCode(String parentCode)
String parentCode) --> (Map qMap)
qMap.put("parentCode","xx");
再试试,这个是要用ongl来判断来的