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 BusinessLicenseRiskHandler implements IGovRiskHandler {

    private final GovWorkbenchMapper govWorkbenchMapper;

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

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

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