package com.hotwj.platform.workbench.strategy.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hotwj.platform.workbench.domain.enums.GovHiddenDangerType;
import com.hotwj.platform.workbench.domain.vo.GovHiddenDangerDetailVo;
import com.hotwj.platform.workbench.mapper.GovWorkbenchMapper;
import com.hotwj.platform.workbench.strategy.IGovRiskHandler;
import lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.springframework.stereotype.Component;

/**
 * 驾驶员岗前培训隐患处理器
 */
@Component
@RequiredArgsConstructor
public class DriverPreJobTrainingRiskHandler implements IGovRiskHandler {

    private final GovWorkbenchMapper govWorkbenchMapper;

    @Override
    public String getType() {
        return GovHiddenDangerType.DRIVER_PRE_JOB_TRAINING.getKey();
    }

    @Override
    public long count(String districtCode, Long companyId) {
        return govWorkbenchMapper.countDriverPreJobTraining(districtCode, companyId);
    }

    @Override
    public TableDataInfo<GovHiddenDangerDetailVo> list(String districtCode, Long companyId, PageQuery pageQuery) {
        Page<GovHiddenDangerDetailVo> page = pageQuery.build();
        Page<GovHiddenDangerDetailVo> result = govWorkbenchMapper.listDriverPreJobTraining(page, districtCode, companyId);
        return TableDataInfo.build(result);
    }
}
