package com.dsk.biz.mapper;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsk.biz.domain.BusinessFollowRecord;
import com.dsk.biz.domain.bo.BusinessIdDto;
import com.dsk.biz.domain.bo.BusinessListDto;
import com.dsk.biz.domain.vo.BusinessListVo;
import com.dsk.common.annotation.DataColumn;
import com.dsk.common.annotation.DataPermission;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 项目跟进记录Mapper接口
 *
 * @author lxl
 * @date 2023-05-17
 */
public interface BusinessFollowRecordMapper
{

    /**
     * 查询关联项目
     * @param userId
     * @return
     */
    List<BusinessListVo> selectRelateProject(Long userId);

    /**
     * 查询关联业主企业
     * @param userId
     * @return
     */
    List<String> selectRelateCompany(Long userId);

    /**
     * 查询项目跟进记录
     *
     * @param id 项目跟进记录主键
     * @return 项目跟进记录
     */
    public BusinessFollowRecord selectBusinessFollowRecordById(Long id);

    /**
     * 分页查询项目跟进记录列表
     *
     * @param businessFollowRecord 项目跟进记录
     * @return 项目跟进记录集合
     */
    public List<BusinessFollowRecord> businessFollowRecordPaging(BusinessFollowRecord businessFollowRecord);

    /**
     * 根据项目id查询项目跟进记录
     *
     * @param dto 项目id
     * @return 项目跟进记录集合
     */
    public Page<BusinessFollowRecord> selectBusinessFollowRecordList(IPage<BusinessIdDto> page,@Param("dto") BusinessIdDto dto);

    /**
     * 新增项目跟进记录
     *
     * @param businessFollowRecord 项目跟进记录
     * @return 结果
     */
    public int insertBusinessFollowRecord(BusinessFollowRecord businessFollowRecord);

    /**
     * 修改项目跟进记录
     *
     * @param businessFollowRecord 项目跟进记录
     * @return 结果
     */
    public int updateBusinessFollowRecord(BusinessFollowRecord businessFollowRecord);

    /**
     * 删除项目跟进记录
     *
     * @param id 项目跟进记录主键
     * @return 结果
     */
    public int deleteBusinessFollowRecordById(Long id);

    /**
     * 批量删除项目跟进记录
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBusinessFollowRecordByIds(Long[] ids);

    /**
     * 分页查询跟进动态
     *
     * @param dto
     * @return
     */
    @DataPermission({
            @DataColumn(key = "deptName", value = "d.dept_id"),
            @DataColumn(key = "userName", value = "u.user_id")
    })
    Page<BusinessFollowRecord> allFollow(IPage<BusinessListDto> page, @Param("dto") BusinessListDto dto);
}
