在mybatis通过名字查询数量
<select id="findUserCountByBack1" resultType="int" parameterType="User" >
select count(*) from onlinemall_user where username like #{username} and userstatus=1;
</select>
在controller层user.setUsername("%"+username+"%");
username已经注入进去,通过查询user.getUsername()能查到name
但是int total=userBiz.findUserCount1(user);
查询出的total一直是0;
dubug提示为:
DEBUG [main] - ==> Preparing: select count(*) from onlinemall_user where username like ? and userstatus=1;
DEBUG [main] - ==> Parameters: null
TRACE [main] - <== Columns: count(*)
TRACE [main] - <== Row: 0
DEBUG [main] - <== Total: 1
0
username没成功注入进去,不知道哪儿原因,求解决!
慕粉4075985