package com.hotent.baseInfo.manager.impl;

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.base.util.StringUtil;
import com.hotent.baseInfo.model.CostInformation;
import com.hotent.baseInfo.dao.CostInformationDao;
import com.hotent.baseInfo.manager.CostInformationManager;
import com.hotent.base.manager.impl.BaseManagerImpl;
import com.hotent.baseInfo.req.CostInformationPageReq;
import com.hotent.common.CrudService;
import com.hotent.config.EipConfig;
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-17
 */
@Service
public class CostInformationManagerImpl extends BaseManagerImpl<CostInformationDao, CostInformation> implements CostInformationManager {


	@Override
	public CostInformation getDetail(String id) {
    	CostInformation costInformation = this.get(id);
    	

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

	@Override
	public IPage<CostInformation> getInformationList(CostInformationPageReq req) {
		LambdaQueryWrapper<CostInformation> qw = new LambdaQueryWrapper<>();
		if(StringUtil.isNotEmpty(req.getTitle())){
			qw.like(CostInformation::getTitle, req.getTitle());
		}
		if(StringUtil.isNotEmpty(req.getDocumentNumber())){
			qw.like(CostInformation::getDocumentNumber, req.getDocumentNumber());
		}
		IPage<CostInformation> page = new Page<>(req.getPageNum(), req.getPageSize());
		IPage<CostInformation> respPage = this.page(page, qw);
		for (CostInformation record : respPage.getRecords()) {
			record.setUploadUrl(EipConfig.getImgUrl()+record.getUploadUrl());
		}
		return respPage;
	}
}
