关于java:MyBatisPlus在xml中使用wrapper的方法

原文网址:​​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>

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理