package com.dhcc.finance.main.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dhcc.common.constant.SysConstants;
import com.dhcc.common.constant.SysStatusCode;
import com.dhcc.common.model.CurrencyMeta;
import com.dhcc.common.model.response.RestfulResponse;
import com.dhcc.finance.main.dao.PmProjectChildMapper;
import com.dhcc.finance.main.domain.PmProjectChild;
import com.dhcc.finance.main.service.PmProjectChildService;
import com.dhcc.finance.util.MetaDataUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import brave.Tracer;

/**  
 * Title: PmProjectChildServiceImpl <br/>  
 * Description: TODO 信托项目信息表信息操作接口<br/> 
 * @author lipeng 
 * @date 2019年7月10日 下午2:33:28
 */
@Service
public class PmProjectChildServiceImpl implements PmProjectChildService {

	@Autowired
	private Tracer tracer;
	
	@Autowired
	PmProjectChildMapper    pmProjectChildMapper;
	/* (non-Javadoc) <br/> 
	 * Title: searchPmProjectChildinfoByCclxAndDyjhbz <br/>  
	 * Description: TODO按照信托产品类型和单一集合标志查询信托项目信息表信息 <br/>  
	 * @param pmProjectChild
	 * @return  
	 * @see com.dhcc.finance.main.service.PmProjectChildService#searchPmProjectChildinfoByCclxAndDyjhbz(com.dhcc.finance.main.domain.PmProjectChild)  
	 */
	@Override
	public RestfulResponse<PageInfo<PmProjectChild>, CurrencyMeta> searchPmProjectChildinfoByCclxAndDyjhbz(
			PmProjectChild pmProjectChild, int pageNum, int pageSize, int navigatePages) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageNum, pageSize);
		List<PmProjectChild> selectByCclxAndDyjhbz = pmProjectChildMapper.selectByCclxAndDyjhbz(pmProjectChild);
		PageInfo<PmProjectChild> pageInfo = new PageInfo<>(selectByCclxAndDyjhbz, navigatePages);
		return new RestfulResponse<PageInfo<PmProjectChild>, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,pageInfo,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}
	/* (non-Javadoc) <br/> 
	 * Title: searchAllProjectName <br/>  
	 * Description: TODO查询所有信托子项目的全称 <br/>  
	 * @return  
	 * @see com.dhcc.finance.main.service.PmProjectChildService#searchAllProjectName()  
	 */
	@Override
	public RestfulResponse<List<String>, CurrencyMeta> searchAllProjectName() {
		List<String> selectAllProjectName = pmProjectChildMapper.selectAllProjectName();
		return new RestfulResponse<List<String>, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,selectAllProjectName,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}

}
