package co.yixiang.yshop.module.product.dal.mysql.shippingtemplates;

import java.util.*;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
import co.yixiang.yshop.module.product.dal.dataobject.shippingtemplates.ShippingTemplatesDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.product.controller.admin.shippingtemplates.vo.*;

/**
 * 运费模板 Mapper
 *
 * @author yshop
 */
@Mapper
public interface ShippingTemplatesMapper extends BaseMapperX<ShippingTemplatesDO> {

    default PageResult<ShippingTemplatesDO> selectPage(ShippingTemplatesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShippingTemplatesDO>()
                .likeIfPresent(ShippingTemplatesDO::getName, reqVO.getName())
                .orderByDesc(ShippingTemplatesDO::getId));
    }

    default List<ShippingTemplatesDO> selectList(ShippingTemplatesExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShippingTemplatesDO>()
                .likeIfPresent(ShippingTemplatesDO::getName, reqVO.getName())
                .orderByDesc(ShippingTemplatesDO::getId));
    }

}
