package cn.com.countrygarden.bi.main.service.wcx.impl;

import cn.com.countrygarden.bi.main.constant.wcx.WcxConstant;
import cn.com.countrygarden.bi.main.dao.wcx.WcxOriginalityMapper;
import cn.com.countrygarden.bi.main.dto.wcx.WcxOriginalityDto;
import cn.com.countrygarden.bi.main.dto.wcx.WcxRoleDto;
import cn.com.countrygarden.bi.main.exception.ServiceException;
import cn.com.countrygarden.bi.main.model.PageData;
import cn.com.countrygarden.bi.main.model.wcx.WcxRole;
import cn.com.countrygarden.bi.main.service.wcx.WcxOriginalityService;
import cn.com.countrygarden.bi.main.util.PageUtil;
import com.github.pagehelper.PageRowBounds;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;
import java.util.List;


@Service
@Transactional
@Deprecated
public class WcxOriginalityServiceImpl implements WcxOriginalityService {

    @Resource
    private WcxOriginalityMapper wcxOriginalityMapper;

    @Override
    public PageData selectPageList(WcxOriginalityDto dto) {
        int pageOffset = PageUtil.getPageOffset(dto.getPageIndex(), dto.getPageSize());
        dto.setPageOffset(pageOffset);

        List<WcxOriginalityDto> data = wcxOriginalityMapper.selectPageData(dto);
        Integer total = wcxOriginalityMapper.selectPageCount(dto);

        PageRowBounds pageRowBounds = new PageRowBounds(dto.getPageIndex(), dto.getPageSize());
        pageRowBounds.setTotal(total.longValue());
        pageRowBounds.setCount(true);

        PageData pageData = new PageData(data, pageRowBounds);
        return pageData;
    }

}
