diff --git a/src/main/java/com/zhgd/mybatis/DataScopeHandler.java b/src/main/java/com/zhgd/mybatis/DataScopeHandler.java index b5434f3b7..a92a4c008 100644 --- a/src/main/java/com/zhgd/mybatis/DataScopeHandler.java +++ b/src/main/java/com/zhgd/mybatis/DataScopeHandler.java @@ -96,6 +96,9 @@ public class DataScopeHandler implements DataPermissionHandler { tables.put("inspect_task_record", "enterprise_id"); tables.put("xz_security_inspect_task_record", "enterprise_id"); tables.put("xz_security_quality_inspection_record", "enterprise_id"); + tables.put("exam_notice", "enterprise_id"); + tables.put("exam_train_record", "enterprise_id"); + tables.put("exam_course_record", "enterprise_id"); if (!environmentUtil.isBaise()) { tables.put("car_info", "enterprise_id"); tables.put("enterprise_info", "id"); diff --git a/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamCourseRecord.java b/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamCourseRecord.java index 3d0da3fca..41586e8e9 100644 --- a/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamCourseRecord.java +++ b/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamCourseRecord.java @@ -122,6 +122,12 @@ public class ExamCourseRecord implements Serializable { @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "修改时间") private Date updateTime; + /** + * 企业ID + */ + @Excel(name = "企业ID", width = 15) + @ApiModelProperty(value = "企业ID") + private Long enterpriseId; @TableField(exist = false) @Excel(name = "课程名称", width = 20) diff --git a/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamTrainRecord.java b/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamTrainRecord.java index c79ac37ec..1fd031c53 100644 --- a/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamTrainRecord.java +++ b/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamTrainRecord.java @@ -147,4 +147,10 @@ public class ExamTrainRecord implements Serializable { @Excel(name = "考试时长", width = 20, format = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "考试时长") private String duration; + /** + * 企业ID + */ + @Excel(name = "企业ID", width = 15) + @ApiModelProperty(value = "企业ID") + private Long enterpriseId; } diff --git a/src/main/java/com/zhgd/xmgl/modules/exam/mapper/ExamCourseRecordMapper.java b/src/main/java/com/zhgd/xmgl/modules/exam/mapper/ExamCourseRecordMapper.java index b7a975612..565805dd5 100644 --- a/src/main/java/com/zhgd/xmgl/modules/exam/mapper/ExamCourseRecordMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/exam/mapper/ExamCourseRecordMapper.java @@ -5,6 +5,7 @@ import java.util.List; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.annotation.DataScope; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import com.zhgd.xmgl.modules.exam.entity.ExamCourseRecord; @@ -17,6 +18,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @version: V1.0 */ @Mapper +@DataScope public interface ExamCourseRecordMapper extends BaseMapper { Page pageList(Page page, @Param(Constants.WRAPPER) Wrapper wrapper); diff --git a/src/main/java/com/zhgd/xmgl/modules/exam/mapper/ExamTrainRecordMapper.java b/src/main/java/com/zhgd/xmgl/modules/exam/mapper/ExamTrainRecordMapper.java index 81f8e1327..c9c9f3360 100644 --- a/src/main/java/com/zhgd/xmgl/modules/exam/mapper/ExamTrainRecordMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/exam/mapper/ExamTrainRecordMapper.java @@ -5,6 +5,7 @@ import java.util.List; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.annotation.DataScope; import com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -18,6 +19,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @version: V1.0 */ @Mapper +@DataScope public interface ExamTrainRecordMapper extends BaseMapper { Page pageList(Page page, @Param(Constants.WRAPPER)Wrapper wrapper); diff --git a/src/main/java/com/zhgd/xmgl/modules/exam/service/IExamTrainService.java b/src/main/java/com/zhgd/xmgl/modules/exam/service/IExamTrainService.java index 7e3f5e0c6..84b58e162 100644 --- a/src/main/java/com/zhgd/xmgl/modules/exam/service/IExamTrainService.java +++ b/src/main/java/com/zhgd/xmgl/modules/exam/service/IExamTrainService.java @@ -1,6 +1,7 @@ package com.zhgd.xmgl.modules.exam.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zhgd.xmgl.modules.exam.entity.ExamCourse; import com.zhgd.xmgl.modules.exam.entity.ExamTrain; @@ -14,7 +15,7 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IExamTrainService extends IService { - Page pageList(Page page, Wrapper wrapper); + Page pageList(Page page, QueryWrapper wrapper); boolean saveInfo(ExamTrain examTrain); diff --git a/src/main/java/com/zhgd/xmgl/modules/exam/service/impl/ExamTrainServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/exam/service/impl/ExamTrainServiceImpl.java index b222122dc..753299c4a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/exam/service/impl/ExamTrainServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/exam/service/impl/ExamTrainServiceImpl.java @@ -1,6 +1,7 @@ package com.zhgd.xmgl.modules.exam.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zhgd.xmgl.modules.basicdata.entity.SystemUser; @@ -28,6 +29,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -56,7 +58,12 @@ public class ExamTrainServiceImpl extends ServiceImpl pageList(Page page, Wrapper wrapper) { + public Page pageList(Page page, QueryWrapper wrapper) { + Set trainIds = examTrainRecordService.list().stream().map(e -> e.getTrainId()).collect(Collectors.toSet()); + if (trainIds.size() == 0) { + return new Page<>(); + } + wrapper.lambda().in(ExamTrain::getId, trainIds); Page examTrainPage = baseMapper.pageList(page, wrapper); List ids = examTrainPage.getRecords().stream().map(e -> e.getId()).collect(Collectors.toList()); if (ids.size() > 0) { @@ -108,6 +115,7 @@ public class ExamTrainServiceImpl extends ServiceImpl queryWrapper2=new QueryWrapper<>(); queryWrapper2.lambda().eq(WorkerInfoAuditRecord::getProjectSn,workerInfoAuditRecord.getProjectSn()) .eq(WorkerInfoAuditRecord::getIdCard,workerInfoAuditRecord.getIdCard()); - int count2=workerInfoAuditRecordMapper.selectCount(queryWrapper2); - if(count2>0){ - throw new OpenAlertException(MessageUtil.get("existsIDCardErr")); + WorkerInfoAuditRecord workerInfoAuditRecord1 = workerInfoAuditRecordMapper.selectOne(queryWrapper2); + if(workerInfoAuditRecord1 != null){ +// throw new OpenAlertException(MessageUtil.get("existsIDCardErr")); + workerInfoAuditRecord.setId(workerInfoAuditRecord1.getId()); + workerInfoAuditRecord.setIsExamPass(0); + workerInfoAuditRecordMapper.updateById(workerInfoAuditRecord1); + return; } workerInfoAuditRecord.setAddTime(new Date()); workerInfoAuditRecordMapper.insert(workerInfoAuditRecord);