吉安感知网项目-后端
xiebin
2026-04-01 939e76b90691c8f4e66e437791bce9e11bc4bfad
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
<?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.sxkj.resource.mapper.OssMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="ossResultMap" type="org.sxkj.resource.entity.Oss">
        <result column="id" property="id"/>
        <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="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="oss_code" property="ossCode"/>
        <result column="category" property="category"/>
        <result column="endpoint" property="endpoint"/>
        <result column="access_key" property="accessKey"/>
        <result column="secret_key" property="secretKey"/>
        <result column="bucket_name" property="bucketName"/>
        <result column="app_id" property="appId"/>
        <result column="region" property="region"/>
        <result column="remark" property="remark"/>
    </resultMap>
 
    <!--自定义分页查询-->
    <select id="selectOssPage" resultType="org.sxkj.resource.vo.OssVO">
        select
        bo.*,
        bd.dict_value as categoryName,
        bd1.dict_value as statusName
        from blade_oss bo
        left join blade_dict bd on bd.dict_key = bo.category::VARCHAR and bd.code = 'oss' and bd.is_deleted = 0
        left join blade_dict bd1 on bd1.dict_key = bo.status::VARCHAR and bd1.code = 'yes_no' and bd1.is_deleted = 0
        where bo.is_deleted = 0
        <if test="oss.name!=null and oss.name!=''">
            and bo.name like concat('%',#{oss.name},'%')
        </if>
        <if test="oss.status!=null">
            and bo.status = #{oss.status}
        </if>
        <if test="oss.category!=null">
            and bo.category = #{oss.category}
        </if>
        <if test="oss.ossCode!=null and oss.ossCode!=''">
            and bo.oss_code like concat('%',#{oss.ossCode},'%')
        </if>
        <if test="oss.accessKey!=null and oss.accessKey!=''">
            and bo.access_key like concat('%',#{oss.accessKey},'%')
        </if>
        <if test="oss.categoryKeys!=null and oss.categoryKeys!=''">
            AND bo.category in
            <foreach collection="oss.categoryKeys.split(',')" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        order by bo.id desc
    </select>
 
    <!--根据设备(机场)编号获取存储对象信息-->
    <select id="getOssInfoByDevSn" resultType="org.sxkj.resource.entity.Oss">
        select
        bo.*
        from blade_oss bo
        left join sys_oss_bind sob on bo.id = sob.oss_id
        where bo.is_deleted = 0
        and bo.status = 2
        and sob.sn = #{sn}
    </select>
 
</mapper>