package com.yunzhi.marketing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunzhi.marketing.bo.request.PresecretRecordRequestBO;
import com.yunzhi.marketing.entity.TaPreselectionRecord;
import com.yunzhi.marketing.po.TaPreselectionRecordPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 * 预选记录表  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2020-02-10
 */
@Mapper
@Component
public interface TaPreselectionRecordMapper extends BaseMapper<TaPreselectionRecord> {

    /**
     * 分页获取当前用户预选记录
     *
     * @param iPage
     * @param personId
     * @return
     */
    IPage<TaPreselectionRecordPO> listPreselectionRecord(IPage<TaPreselectionRecordPO> iPage,
                                                         @Param("orgId") Integer orgId,
                                                         @Param("personId") String personId, @Param("buildingId") String buildingId, @Param("salesBatchId") Integer salesBatchId,
                                                         @Param("apartmentId") String apartmentId, @Param("houseLockingStatus") String houseLockingStatus,
                                                         @Param("customerLocked") String customerLocked, @Param("source") String source);

    /**
     * 根据房源ID和用户ID获取预选记录
     *
     * @param personId
     * @param houseId
     * @return
     */
    TaPreselectionRecord getRecordByPersonIdAndHouseId(@Param("personId") String personId,
                                                       @Param("houseId") Integer houseId);

    /**
     * 查询预选记录表
     *
     * @param page
     * @param bo
     * @return
     */
    List<TaPreselectionRecordPO> selectPreSelectRecordList(Page page, @Param("bo") PresecretRecordRequestBO bo);

    /**
     * 批量删除预选记录
     *
     * @param preselectionRecordList
     * @param orgId
     */
    void batchDeletePreselectRecord(@Param("preselectionRecordList") List<TaPreselectionRecord> preselectionRecordList,
                                    @Param("orgId") Integer orgId,
                                    @Param("userId") Integer userId);
}
