package com.jwipc.sys.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.sys.entity.DealtWithTargetInfo;
import com.jwipc.sys.mapper.DealtWithTargetInfoMapper;
import com.jwipc.sys.model.dto.DwtItemDto;
import com.jwipc.sys.model.po.DealtWithTargetInfoPO;
import com.jwipc.sys.model.po.UserDwtItemPO;
import com.jwipc.sys.model.query.DealtInfoQuery;
import com.jwipc.sys.service.IDealtWithTargetInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 指标信息表 服务实现类
 * </p>
 *
 * @author shenyang.ou
 * @since 2024-01-30
 */
@Service
public class DealtWithTargetInfoServiceImpl extends ServiceImpl<DealtWithTargetInfoMapper, DealtWithTargetInfo> implements IDealtWithTargetInfoService {

    @Override
    public List<DealtWithTargetInfoPO> findPageByQuery(Page<DealtWithTargetInfo> dbPage, DealtInfoQuery query) {
        if (dbPage==null){
            return baseMapper.findPageByQuery(query);
        }
        return baseMapper.findPageByQuery(dbPage,query);
    }

    @Override
    public DealtWithTargetInfoPO getDataById(Long id) {
        if (id!=null){
            return baseMapper.getDataById(id);
        }
        return null;
    }

    @Override
    public List<UserDwtItemPO> selectUserDwtData(Long userId, int type) {
        return baseMapper.selectUserDwtData(userId,type);
    }

    @Override
    public Integer getSqlCount(String sql) {
        return this.baseMapper.getSqlCount(sql);
    }
    @Override
    public List<DwtItemDto> findWorkbenchDwtData(Long userId, Integer category){
        return baseMapper.findWorkbenchDwtData(userId,category);
    }
}
