package com.steerinfo.ems.trmindexitem.service.impl;

import com.steerinfo.framework.mapper.IBaseMapper;
import com.steerinfo.framework.service.impl.BaseServiceImpl;
import com.steerinfo.framework.service.pagehelper.PageHelper;
import com.steerinfo.framework.service.pagehelper.PageList;
import com.steerinfo.ems.trmindexitem.model.TRmIndexItem;
import com.steerinfo.ems.formula.mapper.FormulaMapper;
import com.steerinfo.ems.trmindexitem.mapper.TRmIndexItemMapper;
import com.steerinfo.ems.trmindexitem.service.ITRmIndexItemService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

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

/**
 * TRmIndexItem服务实现：
 * @author generator
 * @version 1.0-SNAPSHORT 2019-10-22 10:51
 * 类描述
 * 修订历史：
 * 日期：2019-10-22
 * 作者：generator
 * 参考：
 * 描述：TRmIndexItem服务实现
 * @see null
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 */
@Service(value = "tRmIndexItemService")
public class TRmIndexItemServiceImpl extends BaseServiceImpl<TRmIndexItem, String> implements ITRmIndexItemService {

    @Autowired
    private TRmIndexItemMapper tRmIndexItemMapper;
    
    @Autowired
    private FormulaMapper formulaMapper;

    @Override
    protected IBaseMapper<TRmIndexItem, String> getMapper() {
        return tRmIndexItemMapper;
    }

	@Override
    public PageList<Map<String, Object>> getDate613ForPage(HashMap<String, Object> parmas, Integer pageNum,
                                                           Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Map<String, Object>> rows = tRmIndexItemMapper.getDate613(parmas);
        PageList<Map<String, Object>> pageInfo = new PageList<Map<String, Object>>(rows);
        return pageInfo;
    }

	@Override
	public List<Map<String, Object>> getDate6141ForPage(HashMap<String, Object> parmas, Integer pageNum,
			Integer pageSize) {
        List<Map<String, Object>> rows = tRmIndexItemMapper.getDate6141(parmas);
        return rows;
	}

	@Override
	public List<Map<String, Object>> getDate6142ForPage(HashMap<String, Object> parmas, Integer pageNum,
			Integer pageSize) {
        List<Map<String, Object>> rows = tRmIndexItemMapper.getDate6142(parmas);
        return rows;
	}

	@Override
	public List<Map<String, Object>> getDate6311ForPage(HashMap<String, Object> parmas) {
        List<Map<String, Object>> rows = tRmIndexItemMapper.getDate6311(parmas);
        return rows;
	}
	
	@Override
	public List<Map<String, Object>> getDate6312ForPage(HashMap<String, Object> parmas) {
        List<Map<String, Object>> rows = tRmIndexItemMapper.getDate6312(parmas);
        return rows;
	}

	@Override
	public List<Map<String, Object>> getDate632ForPage(HashMap<String, Object> parmas, Integer pageNum,
			Integer pageSize) {
		// PageHelper.startPage(pageNum, pageSize);
        List<Map<String, Object>> rows = tRmIndexItemMapper.getDate632(parmas);
        // PageList<Map<String, Object>> pageInfo = new PageList<Map<String, Object>>(rows);
        return rows;
	}

    @Override
    public PageList<Map<String, Object>> getTrees(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Map<String, Object>> trees = tRmIndexItemMapper.getTrees(parmas);
        PageList<Map<String, Object>> pageInfo = new PageList<Map<String, Object>>(trees);
        return pageInfo;
    }

    @Override
    public String getMaxId(TRmIndexItem tRmIndexItem) {
        return tRmIndexItemMapper.getMaxId(tRmIndexItem);
    }

    @Override
    public List<TRmIndexItem> getIdAndNameByIndextype(String indextype) {
        return tRmIndexItemMapper.getIdAndNameByIndextype(indextype);
    }

    @Override
    public List<Map<String, Object>> getDate641ForPage(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize) {
        List<Map<String, Object>> indexItems = tRmIndexItemMapper.getDate641(parmas);
        // PageList<Map<String,Object>> pageInfo = new PageList<>(indexItems);
        return indexItems;
    }

    @Override
    public List<Map<String, Object>> getDate643ForPage(Map<String, Object> parameters, Integer pageNum, Integer pageSize) {
        List<Map<String, Object>> indexitemDetail = tRmIndexItemMapper.getDate643(parameters);
        // PageList<Map<String,Object>> pageInfo = new PageList<>(indexitemDetail);
        return indexitemDetail;
    }

	@Override
	@Transactional(rollbackFor=Exception.class)
	public void delIndexItem(String[] ids) {
		for (int i = 0; i < ids.length; i++) {
			formulaMapper.deleteBycode(ids[i]);
			this.delete(ids[i]);
		}
	}

	@Override
	public PageList<TRmIndexItem> queryLikewForPage(HashMap<String, Object> parmas, Integer pageNum, Integer pageSize) {
		PageHelper.startPage(pageNum,pageSize);
        List<TRmIndexItem> list = tRmIndexItemMapper.selectLikewByParameters(parmas);
        PageList<TRmIndexItem> pageInfo = new PageList<TRmIndexItem>(list);
        return pageInfo;
	}

}
