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

import java.util.*;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yc.ship.framework.common.enums.CommonStatusEnum;
import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.module.resource.dal.dataobject.scenic.ResourceScenicDO;
import org.apache.ibatis.annotations.Mapper;
import com.yc.ship.module.resource.controller.admin.scenic.vo.*;

/**
 * 景区管理 Mapper
 *
 * @author lfy
 */
@Mapper
public interface ResourceScenicMapper extends BaseMapperX<ResourceScenicDO> {

    default PageResult<ResourceScenicDO> selectPage(ResourceScenicPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ResourceScenicDO>()
                .likeIfPresent(ResourceScenicDO::getName, reqVO.getName())
                .eqIfPresent(ResourceScenicDO::getSupplierId, reqVO.getSupplierId())
                .eqIfPresent(ResourceScenicDO::getDockId, reqVO.getDockId())
                .eqIfPresent(ResourceScenicDO::getStatus, reqVO.getStatus())
                .orderByDesc(ResourceScenicDO::getId));
    }

    default List<ResourceScenicDO> selectEnableList() {
        return selectList(new LambdaQueryWrapper<ResourceScenicDO>()
                .eq(ResourceScenicDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
    }
}