liding
2026-06-29 e492288919d92b8667c5781675c7581b37208405
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.ruoyi.device.mapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.device.dto.HazardReportDto;
import com.ruoyi.device.pojo.HazardReport;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import java.util.List;
 
/**
 * 隐患上报Mapper接口
 */
@Mapper
public interface HazardReportMapper extends BaseMapper<HazardReport> {
 
    /**
     * 查询隐患上报列表(关联设施信息)
     */
    @Select("<script>" +
            "SELECT hr.*, sf.facility_name, sf.facility_type " +
            "FROM hazard_report hr " +
            "LEFT JOIN safety_facility sf ON hr.facility_id = sf.id " +
            "WHERE hr.deleted = 0 " +
            "<if test='dto.reportType != null and dto.reportType != \"\"'> " +
            "AND hr.report_type = #{dto.reportType} " +
            "</if>" +
            "<if test='dto.severity != null and dto.severity != \"\"'> " +
            "AND hr.severity = #{dto.severity} " +
            "</if>" +
            "<if test='dto.rectificationStatus != null and dto.rectificationStatus != \"\"'> " +
            "AND hr.rectification_status = #{dto.rectificationStatus} " +
            "</if>" +
            "<if test='dto.reporter != null and dto.reporter != \"\"'> " +
            "AND hr.reporter LIKE CONCAT('%', #{dto.reporter}, '%') " +
            "</if>" +
            "ORDER BY hr.create_time DESC" +
            "</script>")
    List<HazardReportDto> selectHazardReportList(@Param("dto") HazardReportDto dto);
}