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.PropertyBuildings;
import com.yuchen.saas.park.api.vo.property.PropertyBuildingsListVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PropertyBuildingsMapper extends BaseMapper<PropertyBuildings> {

    @Select("select * from property_buildings ${ew.customSqlSegment} order by sort ASC")
    Page<PropertyBuildingsListVo> propertyBuildingsPage(Page<PropertyBuildingsListVo> page, @Param(Constants.WRAPPER) Wrapper<PropertyBuildings> wrapper);


    @Select(" select a.*" +
            " from property_buildings a" +
            " where a.park_id=${parkId}")
    List<PropertyBuildings> getAll(@Param("parkId")Long parkId);

    @Select(" select a.* from property_buildings a")
    List<PropertyBuildings> getAllBuildings();
}
