package com.srs.diagnostic.service.impl;

import java.util.*;
import java.util.stream.Collectors;

import com.srs.common.utils.DateUtils;
import com.srs.diagnostic.domain.DiaReportItems;
import com.srs.diagnostic.domain.DiaReports;
import com.srs.diagnostic.mapper.DiaReportsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.srs.diagnostic.mapper.DiaReportReleaseMapper;
import com.srs.diagnostic.domain.DiaReportRelease;
import com.srs.diagnostic.service.IDiaReportReleaseService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 报表发布Service业务层处理
 *
 * @author srs
 * @date 2025-04-23
 */
@Service
public class DiaReportReleaseServiceImpl extends ServiceImpl<DiaReportReleaseMapper, DiaReportRelease> implements IDiaReportReleaseService {
    @Autowired
    private DiaReportReleaseMapper diaReportReleaseMapper;

    /**
     * 查询报表发布
     *
     * @param relId 报表发布主键
     * @return 报表发布
     */
    @Override
    public DiaReportRelease selectDiaReportReleaseByRelId(Long relId) {
        return diaReportReleaseMapper.selectDiaReportReleaseByRelId(relId);
    }

    /**
     * 查询报表发布列表
     *
     * @param diaReportRelease 报表发布
     * @return 报表发布
     */
    @Override
    public List<DiaReportRelease> selectDiaReportReleaseList(DiaReportRelease diaReportRelease) {
        return diaReportReleaseMapper.selectDiaReportReleaseList(diaReportRelease);
    }

    /**
     * 新增报表发布
     *
     * @param diaReportRelease 报表发布
     * @return 结果
     */
    @Override
    public int insertDiaReportRelease(DiaReportRelease diaReportRelease) {
        diaReportRelease.setCreateTime(DateUtils.getNowDate());
        return diaReportReleaseMapper.insertDiaReportRelease(diaReportRelease);
    }

    /**
     * 修改报表发布
     *
     * @param diaReportRelease 报表发布
     * @return 结果
     */
    @Override
    public int updateDiaReportRelease(DiaReportRelease diaReportRelease) {
        return diaReportReleaseMapper.updateDiaReportRelease(diaReportRelease);
    }

    /**
     * 批量删除报表发布
     *
     * @param relIds 需要删除的报表发布主键
     * @return 结果
     */
    @Override
    public int deleteDiaReportReleaseByRelIds(Long[] relIds) {
        return diaReportReleaseMapper.deleteDiaReportReleaseByRelIds(relIds);
    }

    /**
     * 删除报表发布信息
     *
     * @param relId 报表发布主键
     * @return 结果
     */
    @Override
    public int deleteDiaReportReleaseByRelId(Long relId) {
        return diaReportReleaseMapper.deleteDiaReportReleaseByRelId(relId);
    }

}
