package com.zjrs.zwnw.rlzysc.blo.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.mohrss.leaf.core.framework.domain.blo.impl.BLOImpl;
import org.mohrss.leaf.core.framework.persistens.PageResult;
import org.mohrss.leaf.core.framework.persistens.PageUtil;
import org.mohrss.leaf.core.framework.util.CurrentUser;
import com.zjrs.zwnw.rlzysc.blo.QylrBLO;
import com.zjrs.zwnw.rlzysc.dto.QyxxShtgListDTO;
import com.zjrs.zwnw.rlzysc.dto.QyxxlrListDTO;
import com.zjrs.zwnw.rlzysc.entity.QylrMapper;
import com.zjrs.zwnw.rlzysc.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class QylrBLOimpl extends BLOImpl implements QylrBLO {

    @Autowired
    QylrMapper qylrMapper;

    @Override
    public PageResult getQyxxlrList(QyxxlrListDTO dto) {
        CurrentUser currentUser = getCurrentUser();
        String userregioncode = UserUtil.getBae001(currentUser);//行政区划代码
        dto.setUserregioncode(userregioncode);
        Page<Map<String, Object>> page = new Page<>(dto.getPagenum(), dto.getPagesize());
        Page<Map<String, Object>> pageResult = (Page) qylrMapper.getQyxxlrList(page, dto);
        PageResult result = PageUtil.PageResult(pageResult);
        return result;
    }

    @Override
    public PageResult getQyxxShtgList(QyxxShtgListDTO dto) {
        Page<Map<String, Object>> page = new Page<>(dto.getPagenum(), dto.getPagesize());
        Page<Map<String, Object>> pageResult = (Page) qylrMapper.getQyxxShtgList(page, dto);
        PageResult result = PageUtil.PageResult(pageResult);
        return result;
    }
}
