如何实现MyBatis-Plus中的自定义分页查询功能?
- 内容介绍
- 文章标签
- 相关推荐
本文共计76个文字,预计阅读时间需要1分钟。
plaintextMapper中调用自定义查询:mapper.User.selectNickNameAndUserId(@Param(Constants.WRAPPER) LambdaQueryWrapperUser queryWrapper);
XML映射:
mapper
User selectNickNameAndUserId(@Param(Constants.WRAPPER) LambdaQueryWrapper<User> queryWrapper);mapper.xml
<select id="selectNickNameAndUserId" resultType="com.example.demo.entity.User"> select <if test="ew != null and ew.SqlSelect != null and ew.SqlSelect != ''"> ${ew.SqlSelect} </if> from user ${ew.customSqlSegment} </select>本文共计76个文字,预计阅读时间需要1分钟。
plaintextMapper中调用自定义查询:mapper.User.selectNickNameAndUserId(@Param(Constants.WRAPPER) LambdaQueryWrapperUser queryWrapper);
XML映射:
mapper
User selectNickNameAndUserId(@Param(Constants.WRAPPER) LambdaQueryWrapper<User> queryWrapper);mapper.xml
<select id="selectNickNameAndUserId" resultType="com.example.demo.entity.User"> select <if test="ew != null and ew.SqlSelect != null and ew.SqlSelect != ''"> ${ew.SqlSelect} </if> from user ${ew.customSqlSegment} </select>
