package com.ozs.kpim.service.common.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ozs.kpim.dto.common.KpiFunctionDTO;
import com.ozs.kpim.dto.kpiconfig.KpiConfigForListDTO;
import com.ozs.kpim.mapper.common.KpiFunctionMapper;
import com.ozs.kpim.service.common.KpiFunctionService;
import com.ozs.kpim.util.R;
import com.github.pagehelper.PageHelper;

/**
 * 
 * @ClassName: KpiFunctionServiceImpl
 * @Description:kpi函数
 * @author: Zhao You Kai
 * @date: May 10, 2019 5:01:45 PM
 */
@Service
public class KpiFunctionServiceImpl implements KpiFunctionService {

	@Resource
	private KpiFunctionMapper kpiFunctionMapper;

	@Override
	public R<List<KpiFunctionDTO>> listKpiFunction() {
		return new R<List<KpiFunctionDTO>>(kpiFunctionMapper.listKpiFunction());
	}

	@Override
	public R<List<KpiConfigForListDTO>> listKpiFunctionPage(String functionName, Integer page, Integer pageSize) {
		R<KpiConfigForListDTO> r = new R<>();
		r.pageStart(null, null, page, pageSize);
		List<KpiConfigForListDTO> list = kpiFunctionMapper.listKpiFunctionPage(functionName);
		return r.page(list);
	}

	@Override
	public R<KpiFunctionDTO> getKpiFunction(String id) {
		return new R<KpiFunctionDTO>(kpiFunctionMapper.getKpiFunction(id));
	}

}
