天天看點

mybatisplus在xml中使用wrapper備忘

mapper:

IPage<PurchasePlan> listWithZj(Page page, @Param(Constants.WRAPPER) Wrapper<T> wrapper);      

xml:

<select id="listWithZj" resultType="org.jeecg.modules.gz.purchase.entity.PurchasePlan">
        select a.*,case when b.project_id is null then 0 else 1 end hasLz from gz_purchase_plan a
        left join projectlz b
        on a.id=b.plan_id
        ${ew.customSqlSegment}
    </select>      
select * from meet_reserve_room r
        left join meet_reserve_order o
        on r.order_id=o.id
        where o.`status` is null or o.`status`!=2
        <if test="ew != null">
            <if test="ew.nonEmptyOfWhere">
                AND
            </if>
            ${ew.sqlSegment}
        </if>      
QueryWrapper<T> wrapper = new QueryWrapper<T>();
        wrapper.eq("r.room_id",vo.getRoomId());
        wrapper.in("r.meet_date",dates);

        List<ReserveRoom> list = reserveRoomService.listNormal(wrapper);