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.common.util.StringUtil;
import com.dhcc.finance.main.dao.CwBdRecordGlorgbookMapper;
import com.dhcc.finance.main.domain.CwBdGlorgbook;
import com.dhcc.finance.main.domain.CwBdRecordGlorgbook;
import com.dhcc.finance.main.service.CwBdRecordGlorgbookService;
import com.dhcc.finance.util.MetaDataUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import brave.Tracer;

/**  
 * Title: CwBdRecordGlorgbookServiceImpl <br/>  
 * Description: TODO <br/> 
 * @author lipeng 
 * @date 2019年7月16日 上午9:42:12
 */
@Service
public class CwBdRecordGlorgbookServiceImpl implements CwBdRecordGlorgbookService {
	@Autowired
	CwBdRecordGlorgbookMapper  cwBdRecordGlorgbookMapper;
	@Autowired
	private Tracer tracer;
	/* (non-Javadoc) <br/> 
	 * Title: selectcwBdRecordGlorgbookinfo <br/>  
	 * Description: TODO <br/>  
	 * @param xtzxmbh
	 * @return  
	 * @see com.dhcc.finance.main.service.CwBdRecordGlorgbookService#selectcwBdRecordGlorgbookinfo(java.lang.String)  
	 */
	@Override
	public RestfulResponse<PageInfo<CwBdRecordGlorgbook>, CurrencyMeta> selectcwBdRecordGlorgbookinfo(int pageNum,
			int pageSize, int navigatePages, String xtzxmbh) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageNum, pageSize);
		List<CwBdRecordGlorgbook> list = cwBdRecordGlorgbookMapper.selectByPrjectcode(StringUtil.isBlank(xtzxmbh)? null : xtzxmbh);
		PageInfo<CwBdRecordGlorgbook> pageInfo = new PageInfo<>(list, navigatePages);
		return new RestfulResponse<PageInfo<CwBdRecordGlorgbook>, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,pageInfo,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));

	}
	/* (non-Javadoc) <br/> 
	 * Title: selectGlorgbookAllInfo <br/>  
	 * Description: TODO <br/>  
	 * @return  
	 * @see com.dhcc.finance.main.service.CwBdRecordGlorgbookService#selectGlorgbookAllInfo()  
	 */
	@Override
	public RestfulResponse<List<CwBdGlorgbook>, CurrencyMeta> selectGlorgbookAllInfo() {
		// TODO Auto-generated method stub
		List<CwBdGlorgbook> list = cwBdRecordGlorgbookMapper.selectGlorgbookAllInfo();
		return new RestfulResponse<List<CwBdGlorgbook>, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,list,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}
}
