mybatis在使用pagehelper处理结果时报错

//mapper.xml

<select id="queryWx1" resultMap="BaseResultMap" parameterType="com.run.rsis.specialsubject.entity.Wx1Entity">
        select * from wx1 t1
        <where>
            <if test="id !=null">and    t1.id    =#{id}</if>
            <if test="type !=null">and    t1.type =#{type}</if>
            <if test="value !=null">and    t1.value =#{value}</if>
        </where>
        order by id
</select>

//在Controller中

wx1EntityDao.queryWx1(wx1Entity);有结果

使用PageHelper.startPage(currentPage, pageSize);
PageInfo<Wx1Entity> pageInfo = new PageInfo<>(wx1EntityMapper.queryWx1(wx1Entity));时报错
### SQL: SELECT * FROM (  SELECT TMP_PAGE.*, ROWNUM ROW_ID FROM ( select * from wx1 t1          WHERE  t1.type =?             and t1.value =?          order by id ) TMP_PAGE) WHERE ROW_ID <= ? AND ROW_ID > ?
### Cause: java.sql.SQLSyntaxErrorException: Every derived table must have its own alias
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Every derived table must have its own alias] with root cause
java.sql.SQLSyntaxErrorException: Every derived table must have its own alias


慕盖茨2165817
浏览 2973回答 1
1回答

pardon110

目测试是你没有配置mybaits的别名配置文件,类似下面这段代码<typeAliases>          、<typeAlias alias="User" type="com.shiyanlou.mybatis.model.User"/> </typeAliases>
打开App,查看更多内容
随时随地看视频慕课网APP