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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?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.process.ProcessApprovalMapper">
    
    <resultMap type="cn.autoform.db.entity.ProcessApproval" id="ApprovalMap">
        <id property="id" column="id"/>
        <result property="formId" column="form_id"/>
        <result property="organizationId" column="organization_id"/>
        <result property="processDefId" column="processDef_id"/>
        <result property="defJson" column="def_json"/>
        <result property="processDefName" column="processDef_Name"/>
        <result property="templateProcessDefId" column="templateProcessDefId"/>
        <result property="version" column="version"/>
        <result property="companyId" column="company_id"/>
    </resultMap>
    
    <select id="getApproval" resultMap="ApprovalMap">
        SELECT
            id,
            form_id,
            organization_id,
            processDef_id,
            processDef_Name,
            templateProcessDefId,
            def_json,
            dataState,
            version
        FROM
            process_approval
        WHERE
            dataState = 0
            and organization_id = #{pro.organizationId}
            and form_id = #{pro.formId}
            and tenant_id = #{tenantID}
            LIMIT 1
    </select>
    
    <select id="selectProcessApproval" resultMap="ApprovalMap">
        SELECT
            id,
            form_id,
            organization_id,
            processDef_id,
            processDef_Name,
            templateProcessDefId,
            def_json,
            dataState,
            version
        FROM
            process_approval
        WHERE
            dataState = 0  and processDef_id = #{processDefId}
            LIMIT 1
    </select>
    
    <select id="select" resultMap="ApprovalMap">
        SELECT
            id,
            form_id,
            organization_id,
            processDef_id,
            processDef_Name,
            templateProcessDefId,
            def_json,
            dataState,
            version
        FROM
            process_approval
        WHERE
            dataState = 0
            and organization_id = #{orgId}
            and form_id = #{formId}
            and tenant_id = #{tenantId}
            LIMIT 1
    </select>
    
    <select id="selectApp" resultMap="ApprovalMap">
        SELECT
            id,
            form_id,
            organization_id,
            processDef_id,
            processDef_Name,
            templateProcessDefId,
            def_json,
            dataState,
            version
        FROM
            process_approval
        WHERE
            dataState = 0
            and form_id = #{formId}
            and tenant_id = #{tenantId}
            LIMIT 1
    </select>
    
    <update id="deleteProcessApproval">
        UPDATE process_approval
        SET dataState = 99
        WHERE
            processDef_id = #{id}
    </update>
    
    <update id="updateDefInfo" parameterType="cn.autoform.db.entity.ProcessApproval">
        update process_approval 
        <trim prefix="set" suffix="where" suffixOverrides=",">
            <if test="defJson !=null">
                def_json = #{defJson},
            </if>
            <if test="version != null">
                version = #{version},
            </if>
        </trim>
            processDef_id = #{processDefId}
    </update>
    
    <insert id="addProcessApproval" parameterType="cn.autoform.db.entity.ProcessApproval">
        INSERT INTO process_approval
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="formId !=null">
                form_id,
            </if>
            <!-- <if test="organizationId !=null">
                organization_id,
            </if> -->
            <if test="processDefId !=null">
                processDef_id,
            </if>
            <if test="processDefName !=null">
                processDef_Name,
            </if>
            <if test="defJson !=null">
                def_json,
            </if>
            <if test="true">
                dataState,
            </if>
            <if test="templateProcessDefId !=null">
                templateProcessDefId,
            </if>
            <if test="version !=null">
                version,
            </if>
            <if test="tenantID !=null">
                tenant_id
            </if>
        </trim>
        VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="formId !=null">
                #{formId},
            </if>
            <!-- <if test="organizationId !=null">
                #{organizationId},
            </if> -->
            <if test="processDefId !=null">
                #{processDefId},
            </if>
            <if test="processDefName">
                #{processDefName},
            </if>
            <if test="defJson !=null">
                #{defJson},
            </if>
            <if test="true">
                0,
            </if>
            <if test="templateProcessDefId !=null">
                #{templateProcessDefId},
            </if>
            <if test="version !=null">
                #{version},
            </if>
            <if test="tenantID !=null">
                #{tenantID}
            </if>
        </trim>
        
    </insert>
 
    
 
 
 
 
 
 
</mapper>