yangys
2024-10-15 131d4bcb26e721c09c89d330f78639af7a0eda72
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
79
80
81
82
83
<?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="com.qianwen.smartman.modules.dnc.mapper.TransferDirectoryFileMapper">
 
    <select id="getFilePages"
            resultType="com.qianwen.smartman.modules.dnc.vo.TransferDirectoryFilePageVO">
        select id,
        transfer_directory_id as transferDirectoryId,
        file_type as fileType,
        filename as filename,
        original_filename as originalFilename,
        content_md5 as contentMd5,
        content_length as contentLength,
        content_type as contentType,
        object_key as objectKey,
        suffix as suffix,
        workstation_id as workstationId,
        link,
        update_user as updateUser,
        storage_space as storageSpace,
        1 as documentOwnership,
        '工位' as documentOwnershipDesc,
        version
        from
        dnc_transfer_dir_file
        where is_deleted = 0 and is_current = 1
        and workstation_id =#{workstationId}
        <if test="fileType != null">
            and file_type = #{fileType}
        </if>
        <if test="fileType != null and fileType == 1">
            <if test="suffixs != null and suffixs.size > 0">
                and (suffix in
                <foreach item="item" index="index" collection="suffixs" open="(" separator="," close=")">
                    #{item}
                </foreach>
                <if test="notSuffix != null and notSuffix !=''">
                    or suffix = ''
                </if>)
            </if>
        </if>
        <if test="keywords != null and keywords !=''">
            AND (filename like concat(#{keywords},'%')
            OR suffix like concat(#{keywords},'%'))
        </if>
        UNION all
        select id,
        '' as transferDirectoryId,
        '' as fileType,
        filename as filename,
        original_filename as originalFilename,
        content_md5 as contentMd5,
        content_length as contentLength,
        content_type as contentType,
        object_key as objectKey,
        suffix as suffix,
        '' as workstationId,
        link,
        update_user as updateUser,
        1 as storageSpace,
        2 as documentOwnership,
        '工厂' as documentOwnershipDesc,
        version
        from
        blade_dnc_factory_file
        where is_deleted = 0 and is_current = 1
        <if test="keywords != null and keywords !=''">
            AND (filename like concat(#{keywords},'%')
            OR suffix like concat(#{keywords},'%'))
        </if>
        <if test="fileType != null and fileType == 1">
            <if test="suffixs != null and suffixs.size > 0">
                and (suffix in
                <foreach item="item" index="index" collection="suffixs" open="(" separator="," close=")">
                    #{item}
                </foreach>
                <if test="notSuffix != null and notSuffix !=''">
                    or suffix = ''
                </if>)
            </if>
        </if>
    </select>
</mapper>