package com.dsk.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.common.core.domain.entity.BusinessInfo;
import com.dsk.system.domain.business.dto.BusinessListDto;
import com.dsk.system.domain.business.dto.BusinessSearchDto;
import com.dsk.system.domain.business.vo.BusinessAnalyzeVo;
import com.dsk.system.domain.business.vo.BusinessLikeProjectNameListVo;
import com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto;
import com.dsk.system.domain.customer.vo.CustomerBusinessListVo;
import com.dsk.system.domain.business.vo.BusinessBrowseVo;
import com.dsk.system.domain.business.vo.BusinessListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 项目详情Mapper接口
 *
 * @author lxl
 * @date 2023-05-17
 */
@Mapper
public interface BusinessInfoMapper extends BaseMapper<BusinessInfo> {
    /**
     * 查询项目详情
     *
     * @param id 项目详情主键
     * @return 项目详情
     */
    public BusinessInfo selectBusinessInfoById(Integer id);

    /**
     * 查询项目建设内容
     *
     * @param id 项目详情主键
     * @return
     */
    BusinessInfo getConstruction(Integer id);

    /**
     * 查询所有项目名称(支持模糊查询)
     *
     * @return
     */
    List<BusinessLikeProjectNameListVo> selectProjectName(BusinessListDto dto);

    /**
     * 查询项目详情列表
     *
     * @param dto 项目详情
     * @return 项目详情集合
     */
    public List<BusinessListVo> selectBusinessInfoList(BusinessListDto dto);

    /**
     * 新增项目详情
     *
     * @param businessInfo 项目详情
     * @return 结果
     */
    public int insertBusinessInfo(BusinessInfo businessInfo);

    /**
     * 修改项目详情
     *
     * @param businessInfo 项目详情
     * @return 结果
     */
    public int updateBusinessInfo(BusinessInfo businessInfo);

    /**
     * 删除项目详情
     *
     * @param id 项目详情主键
     * @return 结果
     */
    public int deleteBusinessInfoById(Long id);

    /**
     * 批量删除项目
     * 项目关联的其他所有表数据一并删除
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBusinessInfoByIds(Long[] ids);

    /**
     * 根据项目统计
     *
     * @param business
     * @return
     */
    BusinessBrowseVo selectTotal(Integer business);

    /**
     * 查询项目名称是否存在
     *
     * @param projectName
     * @param userId
     * @return
     */
    int isRepetitionProjectName(@Param("projectName") String projectName,
                                @Param("userId") Long userId,
                                @Param("companyName") String companyName);

    int selectCountByStatusAndCustomerId(@Param("status") Integer status, @Param("customerId") String customerId);

    List<CustomerBusinessListVo> selectCustomerBusinessList(CustomerBusinessSearchDto dto);

    int selectCountByStatus(BusinessSearchDto dto);

    List<BusinessAnalyzeVo> selectAmountAnalyze(BusinessSearchDto dto);

    List<BusinessAnalyzeVo> selectTypeAnalyze(BusinessSearchDto dto);

    List<BusinessAnalyzeVo> selectCategoryAnalyze(BusinessSearchDto dto);
    
}
