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 com.zjrs.zwnw.dbgl.blo.JgxxwhPLO;
import com.zjrs.zwnw.dbgl.dto.DbrwglCommDTO;
import com.zjrs.zwnw.dbgl.dto.DbrwglJgxxwhQueryDTO;
import com.zjrs.zwnw.dbgl.dto.DbrwglJgxxwhUDTO;
import com.zjrs.zwnw.dbgl.entity.OrgexMapper;
import com.zjrs.zwnw.dbgl.po.SsgorgexPO;
import com.zjrs.zwnw.portal.blo.CommonBLO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

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


/**
 * @Author chenzhibiao
 * @create 2022/6/30 8:43
 */
@Service
public class JgxxwhimplPLO extends BLOImpl implements JgxxwhPLO {
    @Resource
    private OrgexMapper orgexMapper;
    @Resource
    private CommonBLO commonBLO;

    @Override
    public PageResult getJgxxwhList(DbrwglJgxxwhQueryDTO dto, Integer pagenum, Integer pagesize){
        Page<Map<String, Object>> page = new Page<>(dto.getPagenum(), dto.getPagesize());
        Page<Map<String, Object>> pageResult = (Page) this.orgexMapper.getJgxxwhList(page,dto);
        PageResult result = PageUtil.PageResult(pageResult);
        return result;
    }

    @Override
    public Map<String, Object> getJgxxwh(DbrwglCommDTO dto){
        return  this.orgexMapper.getJgxxwh(dto);
    }

    @Override
    public void saveJgxxwh(DbrwglJgxxwhUDTO dto){
        SsgorgexPO po =new SsgorgexPO();
        BeanUtils.copyProperties(dto, po);
        this.orgexMapper.insert(po);

    }

}
