package com.ylx.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ylx.home.hot.domain.vo.ProjectSalesVO;
import com.ylx.home.search.domain.dto.SearchProjectDTO;
import com.ylx.massage.domain.dto.OptionDTO;
import com.ylx.massage.domain.dto.ServiceOptionDTO;
import com.ylx.massage.domain.vo.ProductOptionVO;
import com.ylx.massage.domain.vo.ProductServiceOptionVO;
import com.ylx.project.domain.Project;
import com.ylx.project.domain.bookMerchant.vo.ProjectInfoVO;
import com.ylx.project.domain.vo.ProjectDetailVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ProjectMapper extends BaseMapper<Project> {

    Page<ProductOptionVO> selectOptionUnionPage(Page<ProductOptionVO> page, @Param("dto") OptionDTO dto);


    Page<ProductServiceOptionVO> selectServiceOptionsPage(Page page, @Param("dto") ServiceOptionDTO dto);

    ProjectDetailVo selectProjectDetailById(@Param("id") Long id);

    default int deleteProjectById(Long id) {
        return deleteById(id);
    }

    List<Project> selectProjectPage(@Param("offset") long offset, @Param("size") long fetchCount);

    Long countValidProject();

    /**
     * 查询全部上架有效项目及实时完成订单销量
     */
    List<ProjectSalesVO> selectAllProjectSalesCount();

    void batchUpdateSales(@Param("list") List<ProjectSalesVO> list);

    Page<ProjectInfoVO> getProjectPage(Page<ProjectInfoVO> page, @Param("dto") SearchProjectDTO dto);
}
