安全教育,可选全部,已培训,未培训,默认选择已培训

This commit is contained in:
guoshengxiong 2025-12-25 11:35:36 +08:00
parent de651bfcd8
commit 66f68a0623
5 changed files with 62 additions and 13 deletions

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.edu.entity.dto.WorkerSafeEducationDto;
import com.zhgd.xmgl.modules.worker.entity.WorkerSafeEducation;
import com.zhgd.xmgl.modules.edu.service.ISafeEducationQuestionService;
import io.swagger.annotations.Api;
@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import java.util.Objects;
/**
@ -98,9 +100,11 @@ public class SafeEducationQuestionController {
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "educationStatus", value = "0全部、1已培训默认、2未培训", paramType = "body", required = false, dataType = "Integer"),
})
@PostMapping(value = "/selectWorkerEducationPage")
public Result<IPage<EntityMap>> selectWorkerEducationPage(@RequestBody Map<String,Object> map) {
map.putIfAbsent("educationStatus", 1);
return Result.success(safeEducationQuestionService.selectWorkerEducationPage(map));
}
@ -122,7 +126,10 @@ public class SafeEducationQuestionController {
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", dataType = "String"),
})
@GetMapping(value = "/exportExcelWorkerEducation")
public void exportExcelWorkerEducation(HttpServletResponse response, WorkerSafeEducation workerSafeEducation ) {
public void exportExcelWorkerEducation(HttpServletResponse response, WorkerSafeEducationDto workerSafeEducation ) {
if (Objects.isNull(workerSafeEducation.getEducationStatus())) {
workerSafeEducation.setEducationStatus(1);
}
safeEducationQuestionService.exportExcelWorkerEducation(response,workerSafeEducation);
}

View File

@ -0,0 +1,14 @@
package com.zhgd.xmgl.modules.edu.entity.dto;
import com.zhgd.xmgl.modules.worker.entity.WorkerSafeEducation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class WorkerSafeEducationDto extends WorkerSafeEducation {
/**
*0全部1已培训默认2未培训
*/
@ApiModelProperty("0全部、1已培训默认、2未培训")
private Integer educationStatus;
}

View File

@ -31,11 +31,13 @@
<select id="selectWorkerEducationPage" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
SELECT a.*,w.worker_name,b.edu_content,b.edu_course_name,b.edu_type
,ec.classify_name
from worker_safe_education_worker a
INNER JOIN worker_info w ON a.worker_id=w.id
INNER JOIN worker_safe_education b ON a.edu_id=b.id
INNER JOIN education_classify ec on ec.id=b.classify_id
WHERE video_type=1 and w.project_sn=#{param.projectSn}
,if(a.is_qualified is null,2,1) educationStatus
FROM
worker_info w
JOIN worker_safe_education b ON b.project_sn = w.project_sn AND b.video_type = 1
LEFT JOIN worker_safe_education_worker a ON a.edu_id = b.id and a.worker_id = w.id
INNER JOIN education_classify ec on ec.id=b.classify_id
WHERE w.project_sn=#{param.projectSn}
<if test="param.eduCourseName != null and param.eduCourseName != ''">
and b.edu_course_name like CONCAT(CONCAT('%',#{param.eduCourseName}),'%')
</if>
@ -48,6 +50,18 @@
<if test="param.workerId != null and param.workerId != ''">
and w.id=#{param.workerId}
</if>
<if test="param.educationStatus != null and param.educationStatus != ''">
<choose>
<when test="param.educationStatus == 1">
<!-- 已培训:有培训记录 -->
AND a.is_qualified IS NOT NULL
</when>
<when test="param.educationStatus == 2">
<!-- 未培训:无培训记录 -->
AND a.is_qualified IS NULL
</when>
</choose>
</if>
</select>
<select id="selectSafeEducationQuestionList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
select a.*,cl.classify_name
@ -78,11 +92,11 @@
w.worker_name,b.edu_content,b.edu_course_name,
(case when b.edu_type=1 then '入场三级教育' when b.edu_type=2 then '定期安全教育' when b.edu_type=3 then '安全技术交底' when
b.edu_type=4 then 'VR安全教育' else '' end) edu_type
from worker_safe_education_worker a
INNER JOIN worker_info w ON a.worker_id=w.id
INNER JOIN worker_safe_education b ON a.edu_id=b.id
FROM
worker_info w
JOIN worker_safe_education b ON b.project_sn = w.project_sn AND b.video_type = 1
LEFT JOIN worker_safe_education_worker a ON a.edu_id = b.id and a.worker_id = w.id
where 1=1
and b.video_type = 1
<if test="param.projectSn != null and param.projectSn != ''">
and w.project_sn=#{param.projectSn}
</if>
@ -94,6 +108,18 @@
</if>
<if test="param.eduType != null and param.eduType != ''">
and b.edu_type=#{param.eduType}
</if>
</if>
<if test="param.educationStatus != null and param.educationStatus != ''">
<choose>
<when test="param.educationStatus == 1">
<!-- 已培训:有培训记录 -->
AND a.is_qualified IS NOT NULL
</when>
<when test="param.educationStatus == 2">
<!-- 未培训:无培训记录 -->
AND a.is_qualified IS NULL
</when>
</choose>
</if>
</select>
</mapper>

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.edu.entity.SafeEducationQuestion;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.edu.entity.dto.WorkerSafeEducationDto;
import com.zhgd.xmgl.modules.worker.entity.WorkerSafeEducation;
import javax.servlet.http.HttpServletResponse;
@ -62,5 +63,5 @@ public interface ISafeEducationQuestionService extends IService<SafeEducationQue
* @param response
* @param workerSafeEducation
*/
void exportExcelWorkerEducation(HttpServletResponse response, WorkerSafeEducation workerSafeEducation);
void exportExcelWorkerEducation(HttpServletResponse response, WorkerSafeEducationDto workerSafeEducation);
}

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.edu.entity.SafeEducationQuestion;
import com.zhgd.xmgl.modules.edu.entity.SafeEducationQuestionOption;
import com.zhgd.xmgl.modules.edu.entity.dto.WorkerSafeEducationDto;
import com.zhgd.xmgl.modules.edu.mapper.SafeEducationQuestionMapper;
import com.zhgd.xmgl.modules.edu.mapper.SafeEducationQuestionOptionMapper;
import com.zhgd.xmgl.modules.edu.service.ISafeEducationQuestionService;
@ -153,7 +154,7 @@ public class SafeEducationQuestionServiceImpl extends ServiceImpl<SafeEducationQ
}
@Override
public void exportExcelWorkerEducation(HttpServletResponse response, WorkerSafeEducation workerSafeEducation) {
public void exportExcelWorkerEducation(HttpServletResponse response, WorkerSafeEducationDto workerSafeEducation) {
try {
List<EntityMap> list = safeEducationQuestionMapper.exportExcelWorkerEducation(workerSafeEducation);
String[] heads = {"人员姓名", "培训日期", "培训类型", "培训主题", "考试分数", "是否及格"};