package com.pusong.business.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pusong.business.domain.PsContractInfo;
import com.pusong.business.domain.PsCustomInfo;
import com.pusong.business.domain.PsSalaryContract;
import com.pusong.business.domain.vo.PsContractInfoVo;
import com.pusong.business.domain.vo.PsCustomInfoVo;
import com.pusong.business.domain.vo.PsSalaryContractVo;
import com.pusong.business.domain.vo.home.ChannelPayInfo;
import com.pusong.business.domain.vo.home.UserContractAmountInfo;
import com.pusong.common.mybatis.annotation.DataColumn;
import com.pusong.common.mybatis.annotation.DataPermission;
import com.pusong.common.mybatis.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * 合同基本信息Mapper接口
 *
 * @author wls
 * @date 2024-07-29
 */
public interface PsContractInfoMapper extends BaseMapperPlus<PsContractInfo, PsContractInfoVo> {


    @DataPermission({
            @DataColumn(key = "deptName", value = "info.create_dept"),
            @DataColumn(key = "userName", value = "info.create_by")
    })
    Page<PsContractInfoVo> selectPageContractList(@Param("page") Page<PsContractInfo> page, @Param(Constants.WRAPPER) Wrapper<PsContractInfo> queryWrapper);

    @DataPermission({
            @DataColumn(key = "deptName", value = "info.create_dept"),
            @DataColumn(key = "userName", value = "info.create_by")
    })
    Page<PsContractInfoVo> selectPageContractListByCustomId(@Param("page") Page<PsContractInfo> page, @Param("customId") Long customId);

    @DataPermission({
            @DataColumn(key = "deptName", value = "info.create_dept"),
            @DataColumn(key = "userName", value = "info.create_by")
    })
    List<PsContractInfoVo> selectContractList(@Param(Constants.WRAPPER) Wrapper<PsContractInfo> queryWrapper);


    List<PsSalaryContract> querySalaryListByCodes(@Param(Constants.WRAPPER) Wrapper<PsContractInfo> queryWrapper);

    List<Map<String,Object>> homePageReturnMoneyInfo(@Param("queryParam") Map<String, Object> queryParam);
    List<UserContractAmountInfo> getUserContractSourceAmountsByDeptId(@Param("queryParam") Map<String, Object> queryParam);
    List<UserContractAmountInfo> getUserContractTypeAmountsByDeptId(@Param("queryParam") Map<String, Object> queryParam);
    List<UserContractAmountInfo> getUserContractAndPayInfo(@Param("queryParam") Map<String, Object> queryParam);


    //首页查询各个渠道成交的合同
    List<ChannelPayInfo> byChannel(@Param(Constants.WRAPPER) Wrapper<PsContractInfo> queryWrapper);
    //首页查询各个渠道成交的合同
    @DataPermission({
            @DataColumn(key = "deptName", value = "info.create_dept"),
            @DataColumn(key = "userName", value = "info.custom_manager")
    })
    List<ChannelPayInfo> byChannelUser(@Param(Constants.WRAPPER) Wrapper<PsContractInfo> queryWrapper);
}
