代码
Page<ScoreRecordListVO> getScoreRecordPages( @Param(Constants.WRAPPER) QueryWrapper<ScoreRecord> qw,@Param("pages") Page<ScoreRecordListVO> pages);
问题
当使用
@Param("page")
或其他时,会失效…
经过多方尝试,只能使用@Param("pages")
完整代码
Mapper文件
package evan.lijun.xscj.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Repository
public interface ScoreRecordMapper extends BaseMapper<ScoreRecord> {
Page<ScoreRecordListVO> getScoreRecordPages( @Param(Constants.WRAPPER) QueryWrapper<ScoreRecord> qw,@Param("pages") Page<ScoreRecordListVO> pages);
}
自定义SQL
<select id="getScoreRecordPages" resultType="evan.lijun.xscj.pojo.vo.ScoreRecordListVO">
SELECT <include refid="getScoreRecordPagesSelect"></include> FROM score_record record
LEFT JOIN student ON record.student_id = student.id -- 关联student表
LEFT JOIN class_and_grade teams ON record.team_id = teams.id -- 关联class_and_grade表
LEFT JOIN course ON record.course_id = course.id -- 关联course表
${ew.customSqlSegment}
</select>