package com.yc.ship.module.resource.dal.mysql.channel;

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.resource.controller.admin.channel.vo.ScenicChannelPageReqVO;
import com.yc.ship.module.resource.controller.admin.vo.TreeNodeVO;
import com.yc.ship.module.resource.dal.dataobject.channel.ScenicChannelDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 通道 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ScenicChannelMapper extends BaseMapperX<ScenicChannelDO> {

    default PageResult<ScenicChannelDO> selectPage(ScenicChannelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ScenicChannelDO>()
                .eqIfPresent(ScenicChannelDO::getSiteId, reqVO.getSiteId())
                .likeIfPresent(ScenicChannelDO::getName, reqVO.getName())
                .eqIfPresent(ScenicChannelDO::getDoorwayType, reqVO.getDoorwayType())
                .eqIfPresent(ScenicChannelDO::getIsUse, reqVO.getIsUse())
                .eqIfPresent(ScenicChannelDO::getSortNum, reqVO.getSortNum())
                .betweenIfPresent(ScenicChannelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ScenicChannelDO::getId));
    }

    List<TreeNodeVO> queryCheckChannelList();

}
