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
<?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.ProcessLogMapper">
        
        <resultMap type="cn.autoform.db.entity.ProcessLog" id="resultLog">
            <id property="id" column="id" />
        
        </resultMap>
        
        
        <sql id="logSql">
            `processInstId`,
            `createUser`,
            `formID`,
            `dataRowNum`,
            `numberForm`,
            `formName`,
            `dataType`,
            `executeTime`,
            `overTime`,
            `insT`,
            `updT`,
            `insP`,
            `updP`,
            `dataStart`,
            `backlogStartTime`,
            `backlogArriveTime`,
            `isOvertime`,
            `activityDefName`,
            `tenantID`,
            `companyId`,
            `openId`
        </sql>
 
        <delete id="delProcessLog">
 
            DELETE
            FROM
                process_log
            WHERE
                id = #{id}
        </delete>
 
        <insert id="addProcessLog" parameterType="cn.autoform.db.entity.ProcessLog"
                useGeneratedKeys="true"  keyProperty="id" >
            INSERT INTO `process_log` (
                <include refid="logSql"/>
        )
        VALUES
            (
            #{processInstId},
            #{createUser},
            #{formID},
            #{dataRowNum},
            #{numberForm},
            #{formName},
            #{dataType},
            #{executeTime},
            #{overTime},
            #{insT},
            #{updT},
            #{insP},
            #{updP},
            #{dataStart},
            #{backlogStartTime},
            #{backlogArriveTime},
            #{isOvertime},
            #{activityDefName},
            #{tenantID},
            #{companyId},
            #{openId}
            );
        </insert>
 
        <select id="selectPage" parameterType="cn.autoform.db.entity.ProcessLog" resultType="cn.autoform.db.entity.ProcessLog">
            select
                <include refid="logSql"/>
            from process_log
            <trim prefix="WHERE" prefixOverrides="AND | OR">
                dataStart = 0
                <if test="openId!=null" >
                    and openId = #{openId}
                </if>
                <if test="companyId!=null" >
                    and companyId = #{companyId}
                </if>
                <if test="tenantID!=null" >
                    and tenantID = #{tenantID}
                </if>
                <choose>
                    <when test="dataType == 10">
                        AND dataType in('10','20')
                    </when>
                    <otherwise>
                        AND dataType = #{dataType}
                        <if test="openId!=null" >
                            and createUser = #{openId}
                        </if>
                    </otherwise>
                </choose>
            </trim>
            order by `insT` DESC
        </select>
 
        <update id="updateState" parameterType="cn.autoform.db.entity.ProcessLog">
            UPDATE process_log set
                dataStart = 1
            WHERE
                openId = #{openId}
            AND tenantID = #{tenantID}
            AND companyId = #{companyId}
            AND formID = #{formID}
            AND dataRowNum = #{dataRowNum}
            <choose>
                <when test="dataType != 30">
                    AND dataType in('10','20')
                </when>
                <otherwise>
                    AND dataType = '30'
                </otherwise>
            </choose>
        </update>
 
        <update id="updateDataType" parameterType="cn.autoform.db.entity.ProcessLog">
            UPDATE process_log set
                    dataType = '40',
                    overTime = NOW()
            WHERE
            openId = #{openId}
            AND tenantID = #{tenantID}
            AND companyId = #{companyId}
            AND formID = #{formID}
            AND dataRowNum = #{dataRowNum}
            AND dataStart = 0
            AND dataType = '30'
        </update>
 
    
</mapper>