# RevenueDailySummaryTaFilterConfigServiceImpl.java

    package cloud.wconnect.rateshop.service.revenue.impl;

    import cloud.wconnect.commonlib.cons.BaseErrorCodeEnum;
    import cloud.wconnect.commonlib.cons.CommonErrorI18nConstant;
    import cloud.wconnect.commonlib.exception.BadRequestException;
    import cloud.wconnect.rateshop.entity.revenue.RevenueDailySummaryTaFilterConfig;
    import cloud.wconnect.rateshop.mapper.revenue.RevenueDailySummaryTaFilterConfigMapper;
    import cloud.wconnect.rateshop.service.revenue.IRevenueDailySummaryTaFilterConfigService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.springframework.stereotype.Service;

    import java.util.List;
    import java.util.Objects;

    /**
     * <p>
     * 服务实现类
     * </p>
     *
     * @author lichen
     * @since 2024-03-23
     */
    @Service
    @DS("rate_shop")
    public class RevenueDailySummaryTaFilterConfigServiceImpl extends ServiceImpl<RevenueDailySummaryTaFilterConfigMapper, RevenueDailySummaryTaFilterConfig> implements IRevenueDailySummaryTaFilterConfigService {

        /**
         * 校验是否存在
         *
         * @param id 配置ID
         * @return cloud.wconnect.rateshop.entity.revenue.RevenueDailySummaryTaFilterConfig
         * @author lichen
         * @date 2024/3/27
         */
        @Override
        public RevenueDailySummaryTaFilterConfig checkExist(Integer id) {
            RevenueDailySummaryTaFilterConfig revenueDailySummaryTaFilterConfig = getById(id);
            if (Objects.isNull(revenueDailySummaryTaFilterConfig)) {
                throw new BadRequestException(CommonErrorI18nConstant.DATA_NOT_FOUND,
                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                        "The Daily Summary Ta Filter config not find, id=" + id);
            }
            return revenueDailySummaryTaFilterConfig;
        }

        /**
         * 校验market code是否唯一
         *
         * @param propertyId 资产ID
         * @param marketCode
         * @param ignoreId   忽略的ID
         * @return void
         * @author lichen
         * @date 2024/3/27
         */
        @Override
        public void checkSole(Integer propertyId, String marketCode, Integer ignoreId) {
            long count = count(new LambdaQueryWrapper<RevenueDailySummaryTaFilterConfig>()
                    .eq(RevenueDailySummaryTaFilterConfig::getPropertyId, propertyId)
                    .eq(RevenueDailySummaryTaFilterConfig::getMarketCode, marketCode)
                    .ne(Objects.nonNull(ignoreId), RevenueDailySummaryTaFilterConfig::getId, ignoreId));
            if (count > 0) {
                throw new BadRequestException(CommonErrorI18nConstant.DATA_EXISTED,
                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                        "The Daily Summary market code already exist, propertyId= " + propertyId + ", marketCode=" + marketCode);
            }
        }

        /**
         * 查询资产配置的Market Code
         *
         * @param propertyId 资产ID
         * @return java.util.List<cloud.wconnect.rateshop.entity.revenue.RevenueDailySummaryTaFilterConfig>
         * @author lichen
         * @date 2024/3/27
         */
        @Override
        public List<RevenueDailySummaryTaFilterConfig> listByPropertyId(Integer propertyId) {
            return list(new LambdaQueryWrapper<RevenueDailySummaryTaFilterConfig>()
                    .eq(RevenueDailySummaryTaFilterConfig::getPropertyId, propertyId));

        }
    }