为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

慕盖茨2165817 2019-09-29 18:06:54
//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
查看完整描述

1 回答

?
pardon110

TA贡献1038条经验 获得超227个赞

目测试是你没有配置mybaits的别名配置文件,类似下面这段代码

<typeAliases>  
      
、<typeAlias alias="User" type="com.shiyanlou.mybatis.model.User"/>
</typeAliases>


查看完整回答
反对 回复 2019-09-29
  • 1 回答
  • 0 关注
  • 2969 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信