package com.yc.ship.module.ota.dal.mysql.distributortype;

import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.module.ota.controller.admin.distributortype.vo.DistributorTypePageReqVO;
import com.yc.ship.module.ota.dal.dataobject.distributortype.DistributorTypeDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

/**
 * 分销商类型 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface DistributorTypeMapper extends BaseMapperX<DistributorTypeDO> {

    default PageResult<DistributorTypeDO> selectPage(DistributorTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DistributorTypeDO>()
                .likeIfPresent(DistributorTypeDO::getTypeCode, reqVO.getTypeCode())
                .likeIfPresent(DistributorTypeDO::getName, reqVO.getName())
                .eqIfPresent(DistributorTypeDO::getIsUse, reqVO.getIsUse())
                .eqIfPresent(DistributorTypeDO::getSupportRefundExamine, reqVO.getSupportRefundExamine())
                .betweenIfPresent(DistributorTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DistributorTypeDO::getId));
    }

    List<Map> getSimpleList();
}