//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>
添加回答
举报
0/150
提交
取消