# OvertimeSumServiceImpl.java

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

    import cloud.wconnect.workperformance.entity.mor.OvertimeSum;
    import cloud.wconnect.workperformance.mapper.mor.OvertimeSumMapper;
    import cloud.wconnect.workperformance.pojo.query.mor.overtime.OvertimeSumQuery;
    import cloud.wconnect.workperformance.service.mor.IOvertimeSumService;
    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 java.util.List;

    /**
     * <p>
     * 每月加班金额汇总 服务实现类
     * </p>
     *
     * @author zc
     * @since 2023-04-01
     */
    @Service
    @DS("work_performance")
    public class OvertimeSumServiceImpl extends ServiceImpl<OvertimeSumMapper, OvertimeSum> implements IOvertimeSumService {

        /**
         * 获取加班金额汇总数据
         *
         * @param overtimeSumQuery 查询条件
         * @return OvertimeSum
         * @author zc
         * @date 2023/4/1
         */
        @Override
        public List<OvertimeSum> list(OvertimeSumQuery overtimeSumQuery) {
            return list(new QueryWrapper<OvertimeSum>().lambda()
                    .eq(OvertimeSum::getType, overtimeSumQuery.getType())
                    .in(OvertimeSum::getPropertyId, overtimeSumQuery.getPropertyIds())
                    .in(CollectionUtils.isNotEmpty(overtimeSumQuery.getYears()), OvertimeSum::getTheYear, overtimeSumQuery.getYears()));
        }

        /**
         * 删除指定日期范围的数据
         *
         * @param propertyId 资产 id
         * @param startYear  开始年份
         * @param endYear    结束年份
         * @author zc
         * @date 2025/3/17
         */
        @Override
        public void deleteByDateRange(int propertyId, int startYear, int endYear) {
            remove(new QueryWrapper<OvertimeSum>().lambda()
                    .eq(OvertimeSum::getPropertyId, propertyId)
                    .between(OvertimeSum::getTheYear, startYear, endYear));
        }
    }