package cn.iocoder.yudao.module.pms.config;

import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.IotTreeDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.failure.IotFailureReportDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.information.IotInformationDbDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectItemDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectOrderDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectPlanDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotlockstock.IotLockStockDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainworkorder.IotMainWorkOrderDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotoperationmeeting.IotOperationMeetingDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotoperationmeetingdetail.IotOperationMeetingDetailDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrddailyreport.IotRdDailyReportDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyReportDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotryimprovedailyreport.IotRyImproveDailyReportDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotsapstock.IotSapStockDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.IotMaintainDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.maintenance.IotMaintenancePlanDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.accident.IotAccidentReportDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.cert.IotMeasureCertDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.cert.QhseCertPersonDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.devicecert.QhseDeviceCertDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.emergency.QhseEmergencyBookDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.emergency.QhseEmergencyCertDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.file.QhseFileTreeDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.file.QhseInfoDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.hazard.IotHazardDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.measure.IotMeasureBookDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.measure.IotMeasureDetectDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.ptw.QhsePtwDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.report.QhseMonthReportDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.device.YfIotDeviceDO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * system 模块的数据权限 Configuration
 *
 * @author 芋道源码
 */
@Configuration(proxyBeanMethods = false)
public class PmsDataPermissionConfiguration {

    @Bean(name = "pmsDeptDataPermissionRuleCustomizer")
    public DeptDataPermissionRuleCustomizer sysDeptDataPermissionRuleCustomizer() {
        return rule -> {
            // dept
//            rule.addDeptColumn(SupplierDO.class);
            rule.addDeptColumn(DeptDO.class, "id");
//            rule.addDeptColumn(SupplierDO.class, "dept_id");
            rule.addDeptColumn(IotTreeDO.class,"dept_id");
            rule.addDeptColumn(IotDeviceDO.class,"dept_id");
            rule.addDeptColumn(IotFailureReportDO.class,"dept_id");
            rule.addDeptColumn(IotInfoDO.class, "dept_id");
            rule.addDeptColumn(IotMaintainDO.class,"dept_id");
            rule.addDeptColumn(IotInformationDbDO.class,"dept_id");
            rule.addDeptColumn(IotMainWorkOrderDO.class,"dept_id");
            rule.addDeptColumn(IotInspectItemDO.class,"dept_id");
//            rule.addDeptColumn(IotInspectRouteDO.class,"dept_id");
            rule.addDeptColumn(IotInspectPlanDO.class, "dept_id");
            rule.addDeptColumn(IotInspectOrderDO.class, "dept_id");
            rule.addDeptColumn(IotLockStockDO.class, "dept_id");
            rule.addDeptColumn(IotMainWorkOrderDO.class, "dept_id");
            rule.addDeptColumn(IotMaintenancePlanDO.class, "dept_id");
            rule.addDeptColumn(IotSapStockDO.class, "dept_id");
            rule.addDeptColumn(IotRhDailyReportDO.class, "dept_id");
            rule.addDeptColumn(IotRdDailyReportDO.class, "dept_id");
            rule.addDeptColumn(YfIotDeviceDO.class,"dept_id");
            rule.addDeptColumn(IotMeasureBookDO.class, "dept_id");
            rule.addDeptColumn(IotMeasureDetectDO.class, "dept_id");
            rule.addDeptColumn(IotMeasureCertDO.class, "dept_id");
            rule.addDeptColumn(IotAccidentReportDO.class, "dept_id");
            rule.addDeptColumn(IotHazardDO.class, "dept_id");
            rule.addDeptColumn(IotOperationMeetingDO.class, "dept_id");
            rule.addDeptColumn(IotOperationMeetingDetailDO.class, "dept_id");
            rule.addDeptColumn(IotRyImproveDailyReportDO.class, "dept_id");
            rule.addDeptColumn(QhseMonthReportDO.class,  "dept_id");
            rule.addDeptColumn(QhseEmergencyBookDO.class, "dept_id");
            rule.addDeptColumn(QhseEmergencyCertDO.class,  "dept_id");
            rule.addDeptColumn(QhseDeviceCertDO.class, "dept_id");
            rule.addDeptColumn(QhseFileTreeDO.class, "dept_id");
            rule.addDeptColumn(QhseInfoDO.class, "dept_id");
            // user
//            rule.addUserColumn(SupplierDO.class);
            rule.addUserColumn(AdminUserDO.class, "id");
            rule.addDeptColumn(QhseCertPersonDO.class, "dept_id");
            rule.addDeptColumn(QhsePtwDO.class, "dept_id");
//            rule.addUserColumn(SupplierDO.class, "creator");

        };
    }

}
