zhongrj
2024-11-26 4a59a2d8a8951981ad8d3fb624b6fbae90225783
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.yw.mapper.FacilityMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="facilityResultMap" type="org.springblade.modules.yw.entity.FacilityEntity">
        <result column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="lng" property="lng"/>
        <result column="lat" property="lat"/>
        <result column="fac_level" property="facLevel"/>
        <result column="remark" property="remark"/>
        <result column="firm_id" property="firmId"/>
        <result column="image_url" property="imageUrl"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
 
 
    <!--自定义分页查询-->
    <select id="selectFacilityPage" resultMap="facilityResultMap">
        select * from yw_facility where is_deleted = 0
    </select>
 
    <!--三道防线信息查询-->
    <select id="getFacilityList" resultType="org.springblade.modules.yw.vo.FacilityVO">
        select
        yf.*,
        yfi.name as firmName
        from yw_facility yf
        left join yw_firm_info yfi on yfi.id = yf.firm_id and yfi.is_deleted = 0
        where yf.is_deleted = 0
        <if test="facility.facLevel!=null">
            and yf.fac_level = #{facility.facLevel}
        </if>
        <if test="facility.firmId!=null">
            and yf.firm_id = #{facility.firmId}
        </if>
    </select>
 
    <!--三道防线信息查询-->
    <select id="getTreeFacilityList" resultType="org.springblade.modules.yw.vo.FacilityVO">
        select
        yes.id,yes.name,yes.lng,yes.lat,yes.image_url,yes.capacity,yfi.id as firm_id,
        yfi.name as firmName
        from yw_emergency_space yes
        left join yw_firm_info yfi on yfi.id = yes.firm_id and yfi.is_deleted = 0
        where yes.is_deleted = 0
        <if test="facility.facLevel==2">
            and yes.type in (2,10)
        </if>
        <if test="facility.facLevel==3">
            and yes.type = 1
        </if>
        <if test="facility.firmId!=null">
            and yes.firm_id = #{facility.firmId}
        </if>
    </select>
 
</mapper>