package com.zjrs.zwnw.dbgl.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 org.mohrss.leaf.core.framework.util.SecurityUtils;
import com.zjrs.zwnw.dbgl.blo.DbrwglCommPLO;
import com.zjrs.zwnw.dbgl.blo.DbrwgzPLO;
import com.zjrs.zwnw.dbgl.dto.DbrwglDbrwQueryDTO;
import com.zjrs.zwnw.dbgl.entity.DbrwgzMapper;
import com.zjrs.zwnw.dbgl.entity.DbxmMapper;
import com.zjrs.zwnw.portal.blo.CommonBLO;
import com.zjrs.zwnw.portal.entity.VSSgOrgMapper;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.Map;


/**
 * @Author chenzhibiao
 * @create 2022/6/30 8:43
 */
@Service
public class DbrwgzimplPLO extends BLOImpl implements DbrwgzPLO {
    @Resource
    private DbrwgzMapper dbrwgzMapper;
    @Resource
    private CommonBLO commonBLO;
    @Resource
    private DbrwglCommPLO dbrwglCommPLO;
    @Resource
    private VSSgOrgMapper vSSgOrgMapper;
    @Resource
    private DbxmMapper dbxmMapper;




    @Override
    public PageResult getDbrwList(DbrwglDbrwQueryDTO dto, Integer pagenum, Integer pagesize){
        CurrentUser currentUser = SecurityUtils.getCurrentUser();
        String userid = currentUser.getUserid() == null ? "" : currentUser.getUserid().trim();
//        String userid = "1c872fa8-8681-42b4-a221-04f5a7759b74";
        dto.setUserid(userid);
        Page<Map<String, Object>> page = new Page<>(dto.getPagenum(), dto.getPagesize());
        Page<Map<String, Object>> pageResult = (Page) dbrwgzMapper.getDbrwList(page,dto);
        PageResult result = PageUtil.PageResult(pageResult);
        return result;
    }
}
