package com.yuchen.saas.park.service.mapper.property;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yuchen.saas.park.api.entity.property.PropertyDeposit;
import com.yuchen.saas.park.api.vo.property.PropertyDepositHouseVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PropertyDepositMapper extends BaseMapper<PropertyDeposit> {

    /**
     * 根据房源id查询房源押金和退款
     * @param houseId
     * @return
     */
    @Select("SELECT dh.deposit_id,dh.house_id,d.is_refund,d.deposit_amt_fen,d.refund_amt_fen,d.deposit_status " +
            " from property_deposit_house dh" +
            " LEFT JOIN property_deposit d on dh.deposit_id = d.id" +
            " where dh.house_id = #{houseId} and d.deposit_status in (4,5)")
    List<PropertyDepositHouseVo> listHouseDeposit(@Param("houseId") Long houseId);

}
