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.SafetyFacilityDto;
import com.ruoyi.device.pojo.SafetyFacility;
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 SafetyFacilityMapper extends BaseMapper<SafetyFacility> {
 
    /**
     * 查询安全设施列表(关联设备信息)
     */
    @Select("<script>" +
            "SELECT sf.*, dl.device_name, dl.device_model " +
            "FROM safety_facility sf " +
            "LEFT JOIN device_ledger dl ON sf.device_id = dl.id " +
            "WHERE sf.deleted = 0 " +
            "<if test='dto.facilityName != null and dto.facilityName != \"\"'> " +
            "AND sf.facility_name LIKE CONCAT('%', #{dto.facilityName}, '%') " +
            "</if>" +
            "<if test='dto.facilityType != null and dto.facilityType != \"\"'> " +
            "AND sf.facility_type = #{dto.facilityType} " +
            "</if>" +
            "<if test='dto.status != null and dto.status != \"\"'> " +
            "AND sf.status = #{dto.status} " +
            "</if>" +
            "<if test='dto.location != null and dto.location != \"\"'> " +
            "AND sf.location LIKE CONCAT('%', #{dto.location}, '%') " +
            "</if>" +
            "ORDER BY sf.create_time DESC" +
            "</script>")
    List<SafetyFacilityDto> selectSafetyFacilityList(@Param("dto") SafetyFacilityDto dto);
}