package com.hotent.project.manager.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hotent.project.model.CostProjectConclusion;
import com.hotent.project.dao.CostProjectConclusionDao;
import com.hotent.project.manager.CostProjectConclusionManager;
import com.hotent.base.manager.impl.BaseManagerImpl;
import com.hotent.project.model.CostProjectDeliberate;
import com.hotent.project.req.CostProjectBasePageReq;
import com.hotent.uc.exception.BaseException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;
import javax.annotation.Resource;
import com.hotent.base.util.BeanUtils;


/**
 * 监审项目结论表 服务实现类
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-09-27
 */
@Service
public class CostProjectConclusionManagerImpl extends BaseManagerImpl<CostProjectConclusionDao, CostProjectConclusion> implements CostProjectConclusionManager {

	@Override
	public CostProjectConclusion getDetail(String projectId) {
		if(ObjectUtil.isEmpty(projectId)){
			throw new BaseException("项目id不能为空");
		}
		LambdaQueryWrapper<CostProjectConclusion> qw=new LambdaQueryWrapper<>();
		qw.eq(CostProjectConclusion::getProjectId,projectId);
        return this.getOne(qw,false);
	}
	@Override
	@Transactional
	public void createOrUpdate(CostProjectConclusion costProjectConclusion) {
		//新建或更新
		this.saveOrUpdate(costProjectConclusion);
	}

    @Override
    public IPage<CostProjectConclusion> pageList(CostProjectBasePageReq req) {
		LambdaQueryWrapper<CostProjectConclusion> qw=new LambdaQueryWrapper<>();
		qw.eq(CostProjectConclusion::getTaskId,req.getTaskId());
		IPage<CostProjectConclusion> page=new Page<>(req.getPageNum(), req.getPageSize());
		return this.page(page,qw);
    }
}
