zzw
2023-12-04 f54545abf716d0af8b5a7f9cd749fa8cd95ea65a
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
<?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.zt.modules.log.dao.SysLogOperationDao">
 
    <sql id="custom_where">
        <choose>
            <when test="startCreateTime!=null and endCreateTime!=null">
                and a.CREATE_DATE between #{startCreateTime} and #{endCreateTime}
            </when>
            <when test="startCreateTime!=null">
                and a.CREATE_DATE &gt;= #{startCreateTime}
            </when>
            <when test="endCreateTime!=null">
                and a.CREATE_DATE &lt;= #{endCreateTime}
            </when>
            <otherwise>
            </otherwise>
        </choose>
    </sql>
 
    <select id="getList" resultType="com.zt.modules.log.model.SysLogOperation">
        select * from (
        select a.*
        ,(SELECT replace(GROUP_CONCAT(aa.name),',',';') FROM SYS_ROLE aa,SYS_ROLE_USER bb WHERE aa.id=bb.ROLE_ID AND bb.USER_ID = a.CREATOR) AS role_names
        from SYS_LOG_OPERATION a
        ) a
        <where>
            <if test="whereSql!=null">
                ${whereSql}
            </if>
            <if test="action == 'all'">
                and 1 = 1
            </if>
            <if test="action == 'xtbmybm'">
                and role_names NOT LIKE '%xtgly%'  OR role_names NOT LIKE '%xtsjy%'
                and REQUEST_URI not IN (
                SELECT
                a.DICT_LABEL AS urlLabel
                FROM
                SYS_DICT_DATA a,
                SYS_DICT_TYPE b
                WHERE 1=1
                AND b.DICT_TYPE = 'adminURL'
                AND b.ID = a.DICT_TYPE_ID
                AND b.IS_DELETE = 0
                )
            </if>
            <if test="action == 'xtsjybm'">
                and role_names LIKE '%xtgly%'  OR role_names LIKE '%xtsjy%'
                and REQUEST_URI IN (
                SELECT
                a.DICT_LABEL AS urlLabel
                FROM
                SYS_DICT_DATA a,
                SYS_DICT_TYPE b
                WHERE 1=1
                AND b.DICT_TYPE = 'adminURL'
                AND b.ID = a.DICT_TYPE_ID
                AND b.IS_DELETE = 0
                )
            </if>
            <if test="action == 'other'">
                and a.CREATOR = ${currentUserId}
            </if>
            <if test="status != null">
                and a.status = ${status}
            </if>
            <if test="startCreateTime!=null and endCreateTime!=null and startCreateTime!=''and endCreateTime!=''">
                and a.CREATE_DATE between #{startCreateTime} and #{endCreateTime}
            </if>
            <if test="startCreateTime!=null and startCreateTime!=''">
                and a.CREATE_DATE &gt;= #{startCreateTime}
            </if>
            <if test="endCreateTime!=null and endCreateTime!=''">
                and a.CREATE_DATE &lt;= #{endCreateTime}
            </if>
            and IS_DELETE = 0
            ORDER BY a.CREATE_DATE DESC
        </where>
    </select>
 
    <update id="deleteCondition">
        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
        update SYS_LOG_OPERATION
        <set>
            IS_DELETE = 1
        </set>
        where id = ${item.id}
        </foreach>
    </update>
</mapper>