# HkEfficiencyReportFilterConfigServiceImpl.java

    package cloud.wconnect.workperformance.service.hkefficiency.impl;

    import cloud.wconnect.commonlib.util.DateTimeUtils;
    import cloud.wconnect.workperformance.entity.hkefficiency.HkEfficiencyReportFilterConfig;
    import cloud.wconnect.workperformance.mapper.hkefficiency.HkEfficiencyReportFilterConfigMapper;
    import cloud.wconnect.workperformance.service.hkefficiency.IHkEfficiencyReportFilterConfigService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.apache.commons.collections.CollectionUtils;
    import org.springframework.stereotype.Service;
    import org.springframework.transaction.annotation.Transactional;

    import java.util.List;

    /**
     * <p>
     * 服务实现类：SVA Housekeeping Efficiency 报告文件过滤配置
     * </p>
     *
     * @author zc
     * @since 2023-03-30
     */
    @Service
    @DS("work_performance")
    public class HkEfficiencyReportFilterConfigServiceImpl extends ServiceImpl<HkEfficiencyReportFilterConfigMapper, HkEfficiencyReportFilterConfig> implements IHkEfficiencyReportFilterConfigService {

        /**
         * 获取报告文件过滤配置
         *
         * @param propertyIds property id
         * @return 配置信息
         * @author zc
         * @date 2023/3/30
         */
        @Override
        public List<HkEfficiencyReportFilterConfig> list(List<Integer> propertyIds) {
            return list(new QueryWrapper<HkEfficiencyReportFilterConfig>().lambda()
                    .in(HkEfficiencyReportFilterConfig::getPropertyId, propertyIds));
        }

        /**
         * 保存报告文件过滤配置
         *
         * @param propertyId         资产 id
         * @param departmentCodeList department code list
         * @param operatorId         操作人 id
         * @author zc
         * @date 2025/5/16
         */
        @Override
        @Transactional(rollbackFor = Exception.class)
        public void save(int propertyId, List<String> departmentCodeList, int operatorId) {
            // 删除配置信息
            remove(new QueryWrapper<HkEfficiencyReportFilterConfig>().lambda()
                    .eq(HkEfficiencyReportFilterConfig::getPropertyId, propertyId));

            if (CollectionUtils.isEmpty(departmentCodeList)) {
                return;
            }
            long nowTimestamp = DateTimeUtils.nowTimestamp();
            List<HkEfficiencyReportFilterConfig> configList = departmentCodeList.stream()
                    .map(code -> HkEfficiencyReportFilterConfig.builder()
                            .departmentCode(code)
                            .propertyId(propertyId)
                            .createBy(operatorId)
                            .createTime(nowTimestamp)
                            .build()).toList();
            saveBatch(configList);
        }
    }