mybatis mapper.xml sql 当parameterType为String时 任何参数都必须为_parameter(比如原先为参数为key),若果没有_parameter,提示错误There is no getter of ‘username‘ in java.lang.string
int pagingCount(String key);
<select id="pagingCount" resultType="int" parameterType="string"> SELECT count(1) FROM users WHERE 1=1 <if test="key != null and ‘‘ != key"> name = #{key} or username = #{key} </if> </select>
<select id="pagingCount" resultType="int" parameterType="string"> SELECT count(1) FROM users WHERE 1=1 <if test="_parameter != null and ‘‘ != _parameter"> and name = #{_parameter} or username = #{_parameter} </if> </select>