package com.hotent.project.manager.impl;

import com.hotent.base.manager.impl.BaseManagerImpl;
import com.hotent.base.util.StringUtil;
import com.hotent.project.dao.CostProjectTaskMaterialSummaryDetailDao;
import com.hotent.project.manager.CostProjectTaskMaterialSummaryDetailManager;
import com.hotent.project.model.CostProjectTaskMaterialSummaryDetail;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 资料归纳明细表 服务实现类
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-01-27
 */
@Service
public class CostProjectTaskMaterialSummaryDetailManagerImpl
        extends BaseManagerImpl<CostProjectTaskMaterialSummaryDetailDao, CostProjectTaskMaterialSummaryDetail> implements CostProjectTaskMaterialSummaryDetailManager {

    @Override
    public CostProjectTaskMaterialSummaryDetail getDetail(String id) {
        if (StringUtil.isEmpty(id)) {
            return null;
        }

        CostProjectTaskMaterialSummaryDetail detail = this.getById(id);
        if (detail == null) {
            return null;
        }

        return detail;
    }

    @Override
    @Transactional
    public void deleteById(String id) {
        if (StringUtil.isEmpty(id)) {
            return;
        }

        // 物理删除
        this.removeById(id);
    }

    @Override
    public void createOrUpdate(CostProjectTaskMaterialSummaryDetail detail) {
        if (detail == null) {
            return;
        }
        this.saveOrUpdate(detail);
    }
}

