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

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuchen.saas.park.api.entity.property.PropertyFeeStandard;
import com.yuchen.saas.park.api.vo.property.PropertyFeeParentInfoVo;
import com.yuchen.saas.park.api.vo.property.PropertyFeeStandardListVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PropertyFeeStandardMapper extends BaseMapper<PropertyFeeStandard> {

    @Select("SELECT p.park_name,fi.fee_item_name,fs.* from property_fee_standard fs" +
            " LEFT JOIN pmg_bat_park_info p on fs.park_id = p.id" +
            " LEFT JOIN property_fee_item fi on fs.fee_item_id = fi.id" +
            " ${ew.customSqlSegment} order by fs.create_time desc")
    Page<PropertyFeeStandardListVo> feeStandardPage(Page<PropertyFeeStandardListVo> page, @Param(Constants.WRAPPER) Wrapper<String> wrapper);


    @Select("SELECT fs.id as fee_id,fs.fee_name,fi.id as fee_item_id,fi.fee_item_name " +
            " from property_fee_standard fs " +
            " LEFT JOIN property_fee_item fi on fs.fee_item_id = fi.id where fs.id in (${feeIds})")
    List<PropertyFeeParentInfoVo> listFeeParentInfoList(@Param("feeIds") String feeIds);

}
