xiangpei
2025-03-04 3cbfc1624bb7a23a4dfa62ec4558578b00be56b3
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
<?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.ycl.mapper.ProcessLogMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.domain.vo.ProcessLogVO">
        <result column="task_id" property="taskId" />
        <result column="task_name" property="taskName" />
        <result column="event_type" property="eventType" typeHandler="com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler"/>
        <result column="project_id" property="projectId" />
        <result column="process_ins_id" property="processInsId" />
        <result column="user_id" property="userId" />
        <result column="nick_name" property="nickName" />
        <result column="gmt_create" property="gmtCreate" />
        <result column="event_data_json" property="eventDataJson" />
    </resultMap>
 
 
 
 
 
 
 
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            TFL.task_id,
            TFL.task_name,
            TFL.event_type,
            TFL.project_id,
            TFL.process_ins_id,
            TFL.user_id,
            TFL.event_data_json,
            TFL.id
        FROM
            t_process_log TFL
        WHERE
            TFL.id = #{id} AND TFL.deleted = 0
    </select>
 
 
    <select id="getPage" resultMap="BaseResultMap">
        SELECT
            TFL.task_id,
            TFL.task_name,
            TFL.event_type,
            TFL.project_id,
            TFL.process_ins_id,
            TFL.user_id,
            TFL.event_data_json,
            TFL.gmt_create,
            TFL.id
        FROM
            t_process_log TFL
        WHERE
            TFL.deleted = 0
    </select>
 
 
    <select id="projectProcessLogPage" resultMap="BaseResultMap">
        SELECT
            TFL.task_id,
            TFL.task_name,
            TFL.event_type,
            TFL.project_id,
            TFL.process_ins_id,
            TFL.user_id,
            CONCAT(SU.nick_name, '(',COALESCE(SD.dept_name, '无部门'), ')') as nick_name,
            TFL.event_data_json,
            TFL.gmt_create,
            TFL.id
        FROM
            t_process_log TFL
                LEFT JOIN sys_user SU ON SU.user_id = TFL.user_id
                LEFT JOIN sys_dept SD ON SU.dept_id = SD.dept_id
        WHERE
            TFL.deleted = 0 AND TFL.process_ins_id = #{query.processInsId}
            <if test="query.taskId != null and query.taskId != ''">AND TFL.task_id = #{query.taskId}</if>
            <if test="query.projectId != null and query.projectId != ''">AND TFL.project_id = #{query.projectId}</if>
            <if test="query.taskDefKey != null and query.taskDefKey != ''">AND TFL.task_def_key = #{query.taskDefKey}</if>
        ORDER BY
            TFL.gmt_create DESC
    </select>
 
    <select id="getAllHangup" resultType="java.lang.String">
        SELECT task_id
        FROM (
                 SELECT task_id,
                        COUNT(*) AS num
                 FROM t_process_log
                 WHERE task_id IS NOT NULL
                 GROUP BY task_id
                 HAVING MOD(num, 2) != 0
             ) AS t;
    </select>
</mapper>