zhongrj
2025-02-11 b1e8a099eb3117bcbd5f2e0c9a2eb0accabd8cbf
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?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.EmergencySuppliesMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="emergencySuppliesResultMap" type="org.springblade.modules.yw.entity.EmergencySuppliesEntity">
        <result column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="num" property="num"/>
        <result column="unit" property="unit"/>
        <result column="sto_loc" property="stoLoc"/>
        <result column="supplies_id" property="suppliesId"/>
        <result column="remark" property="remark"/>
        <result column="firm_id" property="firmId"/>
        <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="selectEmergencySuppliesPage" resultType="org.springblade.modules.yw.vo.EmergencySuppliesVO">
        select
        yes.*,
        yfi.name as firmName,
        ys.per_in_cha as personInCha,ys.per_in_cha_pho as personInChaPhone,ys.address supAdd,
        ys.lng,ys.lat,
        bdb.dict_value as emeSupType,
        concat(yes.num,ifnull(bdb1.dict_value,'')) as numUnit
        from
        yw_emergency_supplies yes
        left join yw_supplies ys on ys.id = yes.supplies_id and ys.is_deleted = 0
        left join yw_firm_info yfi on yfi.id = yes.firm_id and yfi.is_deleted = 0
        left join blade_dict_biz bdb on bdb.dict_key = yes.type and bdb.code = 'eme_sup_type'
        left join blade_dict_biz bdb1 on bdb1.dict_key = yes.unit and bdb1.code = 'unit'
        where yes.is_deleted = 0
        <if test="emergencySupplies.name!=null and emergencySupplies.name!=''">
            and yes.name like concat('%',#{emergencySupplies.name},'%')
        </if>
        <if test="emergencySupplies.firmId!=null">
            and yes.firm_id = #{emergencySupplies.firmId}
        </if>
        <if test="emergencySupplies.type!=null">
            and yes.type = #{emergencySupplies.type}
        </if>
        <if test="emergencySupplies.ownership!=null">
            <if test="emergencySupplies.ownership==1">
                and yes.firm_id is null
            </if>
            <if test="emergencySupplies.ownership==2">
                and yes.firm_id is not null
            </if>
        </if>
    </select>
 
    <!--查询企业对应的应急物资信息-->
    <select id="getEmergencySuppliesList" resultType="org.springblade.modules.yw.vo.EmergencySuppliesVO">
        select
        yes.*,
        yfi.name as firmName,
        ys.per_in_cha as personInCha,ys.per_in_cha_pho as personInChaPhone,ys.address supAdd,
        ifnull(ys.lng,yp.lng) as lng,ifnull(ys.lat,yp.lat) as lat,
        bdb.dict_value as emeSupType,
        concat(yes.num,ifnull(bdb1.dict_value,'')) as numUnit,
        yp.url as panoramicUrl
        from
        yw_emergency_supplies yes
        left join yw_supplies ys on ys.id = yes.supplies_id and ys.is_deleted = 0
        left join yw_firm_info yfi on yfi.id = yes.firm_id and yfi.is_deleted = 0
        left join blade_dict_biz bdb on bdb.dict_key = yes.type and bdb.code = 'eme_sup_type'
        left join blade_dict_biz bdb1 on bdb1.dict_key = yes.unit and bdb1.code = 'unit'
        left join yw_panoramic yp on yp.firm_id = yes.firm_id and yp.is_deleted = 0
        where yes.is_deleted = 0
        and yes.firm_id = #{emergencySupplies.firmId}
    </select>
 
</mapper>