zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?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="cn.autoform.web.mapper.Enclosure.EnclosureMapper" >  
    
    <resultMap type="cn.autoform.web.client.bean.Enclosure" id="fileResult">
        
        <id property="id" column="id"/>
        <result property="fileName" column="file_name"/>
        <result property="volumeName" column="Volume_name"/>
        <result property="physicsFileName" column="physicsFileName"/>
        <result property="fileSize" column="file_size"/>
        <result property="dataRowNum" column="dataRowNum"/>
        <result property="formID" column="formID"/>
        
    </resultMap>
    
    
    
    <select id="selectFile" resultMap="fileResult">
        
        SELECT
            id,
            file_name,
            Volume_name,
            physicsFileName,
            file_size,
            dataRowNum,
            formID
        FROM
            enclosure_${tenantID}
            where formID = #{enc.formID} and dataRowNum = #{enc.dataRowNum}
 
    </select>
 
    <select id="selectFileStatus" resultType="int">
        select count(file_name) from  enclosure_${tenantID}
        where formID = #{formId} and dataRowNum = #{dataRowNum}
    </select>
    
    <select id="selectOne" resultMap="fileResult" >
        SELECT
            id,
            file_name,
            Volume_name,
            physicsFileName,
            file_size,
            dataRowNum,
            formID
        FROM
            enclosure_${tenantID}
            
            where physicsFileName = #{name}
            and formID = #{formId}
            LIMIT 1;
    
    
    </select>
    
    
    
    <insert id="insertFile">
        INSERT INTO enclosure_${tenantID} (
            file_Name,
            Volume_name,
            physicsFileName,
            file_size,
            dataRowNum,
            formID
        )
        VALUES
            (
        
                #{enc.fileName},
                #{enc.volumeName},
                #{enc.physicsFileName},
                #{enc.fileSize},
                #{enc.dataRowNum},
                #{enc.formID}
            );
    
    
    
    </insert>
    
    <delete id="deleteFile">
        DELETE
        FROM
            enclosure_${tenantID}
        WHERE
            physicsFileName = #{path}
    
    
    </delete>
    
    <select id="selectOnes" resultMap="fileResult" >
        SELECT
            id,
            file_name,
            Volume_name,
            physicsFileName,
            file_size,
            dataRowNum,
            formID
        FROM
            enclosure_${tenantID}
            
            where physicsFileName = #{name}
            LIMIT 1;
    
    </select>
    
    
    
 
</mapper>