package com.huiju.estateagents.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huiju.estateagents.base.ResponseBean;
import com.huiju.estateagents.bo.request.HousingRaiseRequestBO;
import com.huiju.estateagents.bo.request.RaiseOrderRequestBO;
import com.huiju.estateagents.bo.request.RaiseRecordRequestBO;
import com.huiju.estateagents.entity.TaRaiseRecord;
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-26
 */
@Mapper
@Component
public interface TaRaiseRecordMapper extends BaseMapper<TaRaiseRecord> {

    /**
     * 条件查询认筹单
     *
     * @param page
     * @param bo
     * @return
     */
    IPage<TaRaiseRecord> listHousingRaiseByCondition(IPage<TaRaiseRecord> page,
                                                     @Param("bo") HousingRaiseRequestBO bo);

    /**
     * 条件查询认筹单
     *
     * @param page
     * @param bo
     * @return
     */
    IPage<TaRaiseRecord> listRaiseRecordByCondition(IPage<TaRaiseRecord> page,
                                                    @Param("bo") RaiseRecordRequestBO bo);

    /**
     * 条件查询缴费单
     *
     * @param page
     * @param bo
     * @return
     */
    IPage<TaRaiseRecord> listRaiseOrderByCondition(IPage<TaRaiseRecord> page,
                                                   @Param("bo") RaiseOrderRequestBO bo);

    /**
     * 批量更新
     *
     * @param recordList
     * @param orgId
     * @param payType
     * @return
     */
    Boolean batchUpdateById(@Param("recordList") List<TaRaiseRecord> recordList,
                            @Param("orgId") Integer orgId,
                            @Param("payType") String payType);

    TaRaiseRecord getUserInfo(@Param("raiseRecordId") Integer raiseRecordId, @Param("orgId") Integer orgId);

    /**
     * 认筹单房源数+1
     *
     * @param raiseRecordId
     * @param orgId
     * @param updateUserName
     * @return
     */
    Boolean addHouseNum(@Param("raiseRecordId") Integer raiseRecordId,
                        @Param("orgId") Integer orgId,
                        @Param("updateUserName") String updateUserName);
}
