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.CwBdRecordSerialMapper;
import com.dhcc.finance.main.domain.CwBdRecordSerial;
import com.dhcc.finance.main.service.CwBdRecordSerialService;
import com.dhcc.finance.util.MetaDataUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import brave.Tracer;

@Service
public class CwBdRecordSerialServiceImpl implements CwBdRecordSerialService{
	@Autowired
	CwBdRecordSerialMapper cwBdRecordSerialMapper;
	@Autowired
	private Tracer tracer;

	/*
	 * (非 Javadoc)  
	 * <p>Title: searchCwBdRecordSerialAll</p>  
	 * <p>Description:查询所有批次流水信息 </p>
	 * @param batchNo
	 * @param pageNum
	 * @param pageSize
	 * @param navigatePages
	 * @return  
	 * @see com.dhcc.finance.main.service.CwBdRecordSerialService#searchCwBdRecordSerialAll(java.lang.String, int, int, int)    
	 * @author huangpeng
	 * @date 2019年7月16日 上午9:29:29
	 * @修改日志：
	 */
	@Override
	public RestfulResponse<PageInfo<CwBdRecordSerial>, CurrencyMeta> searchCwBdRecordSerialAll(String batchNo,String tradeCode,
			int pageNum, int pageSize, int navigatePages) {
		PageHelper.startPage(pageNum, pageSize,"CREATE_TIME");
//		if(code!=null) {
//			createCriteria.andParametricCodeLike("%"+code+"%");
//		}
		List<CwBdRecordSerial> list = cwBdRecordSerialMapper.selectCwBdRecordSerialList(batchNo,tradeCode);
		PageInfo<CwBdRecordSerial> pageInfo = new PageInfo<>(list, navigatePages);
		return new RestfulResponse<PageInfo<CwBdRecordSerial>, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,pageInfo,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}

}
