package com.hotent.surveyinfo.manager.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hotent.base.manager.impl.BaseManagerImpl;
import com.hotent.surveyinfo.dao.CostSurveyTemplateHeadersDao;
import com.hotent.surveyinfo.dao.CostVerifyTemplateHeadersDao;
import com.hotent.surveyinfo.manager.CostSurveyTemplateHeadersManager;
import com.hotent.surveyinfo.manager.CostVerifyTemplateHeadersManager;
import com.hotent.surveyinfo.model.CostSurveyTemplateHeaders;
import com.hotent.surveyinfo.model.CostVerifyTemplateHeaders;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.List;


/**
 * 成本核定表头子表 服务实现类
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-09-19
 */
@Service
public class CostVerifyTemplateHeadersManagerImpl extends BaseManagerImpl<CostVerifyTemplateHeadersDao, CostVerifyTemplateHeaders> implements CostVerifyTemplateHeadersManager {

	@Override
	public CostVerifyTemplateHeaders getDetail(String id) {
		CostVerifyTemplateHeaders costSurveyTemplateHeaders = this.get(id);
    	

		return costSurveyTemplateHeaders;
	}
	@Override
	@Transactional
	public void createOrUpdate(CostVerifyTemplateHeaders costSurveyTemplateHeaders) {
		//新建或更新
		this.saveOrUpdate(costSurveyTemplateHeaders);
	}

	@Override
	@Transactional
	public void batchCreate(List<CostVerifyTemplateHeaders> costSurveyTemplateHeadersList) {
		if (costSurveyTemplateHeadersList != null && !costSurveyTemplateHeadersList.isEmpty()) {
			// 批量保存
			this.saveBatch(costSurveyTemplateHeadersList);
		}
	}

	@Override
	public List<CostVerifyTemplateHeaders> listBySurveyTemplateId(String surveyTemplateId) {
		return this.listBySurveyTemplateId(surveyTemplateId);
	}

	@Override
	public List<CostVerifyTemplateHeaders> listVisibleBySurveyTemplateId(String surveyTemplateId) {
		QueryWrapper<CostVerifyTemplateHeaders> wrapper = new QueryWrapper<>();
		wrapper.eq("survey_template_id", surveyTemplateId);
		return this.list(wrapper);
	}
}
