package cn.newfeifan.mall.sale.dal.mysql.shop;

import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
import cn.newfeifan.mall.sale.dal.dataobject.shop.ShopDO;
import cn.newfeifan.mall.sale.controller.admin.shop.vo.ShopPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 店铺 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface ShopMapper extends BaseMapperX<ShopDO> {

    default PageResult<ShopDO> selectPage(ShopPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopDO>()
                .likeIfPresent(ShopDO::getName, reqVO.getName())
                .eqIfPresent(ShopDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ShopDO::getMerchantId, reqVO.getMerchantId())
                .betweenIfPresent(ShopDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ShopDO::getLogoUrl, reqVO.getLogoUrl())
                .orderByDesc(ShopDO::getId));
    }

}