package cn.superdesk.uniorder.dubbo.provider.operationCenter.operators;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dto.param.operationCenter.base.OperationCenterParam;
import cn.superdesk.uniorder.dto.param.operationCenter.operators.OperationCenterOperatorsParam;
import cn.superdesk.uniorder.dto.vo.operationCenter.base.OperationCenterVo;
import cn.superdesk.uniorder.dto.vo.operationCenter.operators.OperationCenterOperatorsVo;
import cn.superdesk.uniorder.dubbo.facade.operationCenter.operators.DubboOperationCenterOperatorsService;
import cn.superdesk.uniorder.service.operationCenter.OperationCenterOperatorsService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Author : zx
 * @Create : 2023/3/28 11:13
 * Description : provider - 实现
 */
@Service(version = "1.0.0", retries = -1, timeout = 10000)
public class DubboOperationCenterOperatorsServiceImpl implements DubboOperationCenterOperatorsService {
    @Autowired
    private OperationCenterOperatorsService operationCenterOperatorsService;


    @Override
    public R<List<OperationCenterOperatorsVo>> getOpCenterOperatorList(OperationCenterOperatorsParam param) {
        PageHelper.startPage(param.getPageNumber(), param.getPageSize());
        List<OperationCenterOperatorsVo> resultList = operationCenterOperatorsService.getOpCenterOperatorList(param);

        PageInfo<OperationCenterOperatorsVo> page = new PageInfo<OperationCenterOperatorsVo>(resultList);
        PageHelper.clearPage();

        return new R<List<OperationCenterOperatorsVo>>(page.getPageNum(), page.getPageSize(), (int) page.getTotal(), resultList);

    }

    @Override
    public List<OperationCenterVo> selectOperationCenterOperators(OperationCenterParam param) {
        return operationCenterOperatorsService.selectOperationCenterOperators(param);
    }
}
