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


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yuchen.saas.park.api.entity.property.PropertyPublicMeterShare;
import com.yuchen.saas.park.service.mapper.property.PropertyPublicMeterShareMapper;
import com.yuchen.saas.park.service.service.property.IPropertyPublicMeterShareService;
import org.nest.springwrap.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 公摊仪表分摊的房间表 服务实现类
 * </p>
 *
 * @author cxj
 * @since 2023-11-23
 */
@Service
public class PropertyPublicMeterShareServiceImpl extends BaseServiceImpl<PropertyPublicMeterShareMapper, PropertyPublicMeterShare> implements IPropertyPublicMeterShareService {

    @Override
    public Integer countByPublicMeterId(Long publicMeterId) {
        LambdaQueryWrapper<PropertyPublicMeterShare> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(PropertyPublicMeterShare::getPublicMeterId,publicMeterId);
        return count(queryWrapper);
    }

    @Override
    public Boolean removeByPublicMeterId(Long publicMeterId) {
        LambdaQueryWrapper<PropertyPublicMeterShare> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(PropertyPublicMeterShare::getPublicMeterId,publicMeterId);
        return remove(queryWrapper);
    }

    @Override
    public List<PropertyPublicMeterShare> listByPublicMeterId(Long publicMeterId) {
        LambdaQueryWrapper<PropertyPublicMeterShare> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(PropertyPublicMeterShare::getPublicMeterId,publicMeterId);
        return list(queryWrapper);
    }
}
