package com.unis.base.server.domain;

import com.github.pagehelper.PageHelper;
import com.unis.base.common.vo.*;
import com.unis.base.server.dao.QyzgQyzgxxDao;
import com.unis.base.server.dao.TzQylxDao;
import com.unis.base.server.dao.TzSlqyDao;
import com.unis.base.server.dao.TzYjqyDao;
import com.unis.base.server.entity.*;
import com.unis.base.server.entity.BaseEntity;
import com.unis.common.utils.LsBeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.*;

/**
 * @author huangxing
 * @version 1.0
 * @Title TzSlqyDomain
 * @ProjectName 持久化
 * @Description
 * @date 2019/07/22 17点26分
 */
@Component
public class CompanyQualificationDomain extends BaseDomain {

	@Autowired
	private QyzgQyzgxxDao qyzgQyzgxxDao;

	/**
	 * 分页获取企业资格信息列表
	 * @author zoujieli
	 * @param companyQualQueryVO
	 */
	public List<CompanyQualificationInfoVO> getCompanyQualification(CompanyQualificationQueryVO companyQualQueryVO) {
		List<QyzgQyzgxxDO> qyzgQyzgxxDOList = qyzgQyzgxxDao.getCompanyQualification(companyQualQueryVO);
		List<CompanyQualificationInfoVO> companyQualInfoVO = new ArrayList<>();
		if (qyzgQyzgxxDOList != null && !qyzgQyzgxxDOList.isEmpty()){
			for (QyzgQyzgxxDO qyzgQyzgxxDO: qyzgQyzgxxDOList){
				CompanyQualificationInfoVO infoVO = new CompanyQualificationInfoVO();
				LsBeanUtils.copyAllProperties(qyzgQyzgxxDO,infoVO);
				companyQualInfoVO.add(infoVO);
			}
		}
		return companyQualInfoVO;
	}

	/**
	 * 获取企业资格信息详情
	 * @author zoujieli
	 * @param qyId
	 * @param zglxDm
	 * @return
	 */
	public CompanyQualificationInfoVO getCompanyQualificationInfo(Integer qyId, String zglxDm) {
		Map<String, Object> selectMap = new HashMap<>();
		selectMap.put("qyId",qyId);
		selectMap.put("zglxDm",zglxDm);
		QyzgQyzgxxDO qyzgQyzgxxDO = qyzgQyzgxxDao.getCompanyQualificationInfo(selectMap);
		CompanyQualificationInfoVO qualificationInfoVO = new CompanyQualificationInfoVO();
		if ( qyzgQyzgxxDO != null){
			LsBeanUtils.copyAllProperties(qyzgQyzgxxDO,qualificationInfoVO);
			return qualificationInfoVO;
		}else {
			return null;
		}

	}
}
