原文网址:MyBatis-Plus--在xml中应用wrapper的办法_IT利刃出鞘的博客-CSDN博客

简介

本文介绍MyBatis-Plus如何在xml中应用wrapper。

分享Java技术星球(自学精灵):https://learn.skyofit.com

Service

QueryWrapper<T> wrapper = new QueryWrapper<T>();wrapper.eq("r.room_id", vo.getRoomId());wrapper.in("r.meet_date", dates);List<ReserveRoom> list = reserveRoomService.query(wrapper);

Mapper

IPage<ReserveRoom> query(Page page, @Param("ew) Wrapper<T> wrapper);

XML

<select id="query" resultType="com.abc.purchase.entity.ReserveRoom">    SELECT r.*         FROM reserve_room r            LEFT JOIN person_info p                ON r.person_id = p.id    <if test="ew != null">        ${ew.customSqlSegment}    </if></select>