package com.lightinit.hsdataportal.impl;

import com.lightinit.hsdataportal.mapper.CacheserverMapper;
import com.lightinit.hsdataportal.entity.BaseExample;
import com.lightinit.hsdataportal.entity.Cacheserver;
import com.lightinit.hsdataportal.entity.CacheserverExample;
import com.lightinit.hsdataportal.service.ICacheServerService;
import com.lightinit.hsdataportal.spring.DynamicDataContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Dictionary;
import java.util.List;

/**
 * Created by Mr.Yao on 2017/4/13.
 */
@Service
public class CacheServerServiceImpl implements ICacheServerService {
    @Autowired
    private CacheserverMapper cacheserverMapper;

    public List<Cacheserver> QueryList(Dictionary<String, String> condition, String order, int page, int rows) {
        DynamicDataContextHolder.setCustomerType(DynamicDataContextHolder.DEFAULT);
        CacheserverExample example=new CacheserverExample();
        BaseExample.Page _page=new BaseExample.Page();
        _page.setPageNo(page);
        _page.setPageSize(rows);
        example.setPage(_page);
        return cacheserverMapper.selectByExample(example);
    }

    public long QueryCount(Dictionary<String, String> condition, String order) {
        DynamicDataContextHolder.setCustomerType(DynamicDataContextHolder.DEFAULT);
        CacheserverExample example=new CacheserverExample();
        //CacheserverExample.Criteria criteria=example.createCriteria();
        return cacheserverMapper.countByExample(example);
    }
}
