lxw
2022-07-12 47c9f8dff31d9bf90edabd30f8c764704f9ae850
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
<?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.whyc.mapper.UserLogMapper" >
 
    <resultMap id="Map_UserLog" type="UserLog">
        <id property="num" column="num"/>
        <result property="uId" column="uId"/>
        <result property="operationType" column="uOprateType"/>
        <result property="operationTime" column="uOprateDay"/>
        <result property="terminalIp" column="uTerminalIp"/>
        <result property="operationMsg" column="uOprateMsg"/>
        <result property="operationDetail" column="operation_detail"/>
        <result property="uName" column="uName"/>
    </resultMap>
    <select id="getList" resultMap="Map_UserLog">
        select l.*,u.uName from db_user.tb_user_log l,db_user.tb_user_inf u
        where l.uId = u.uId
        and uOprateDay between #{operationTime} and  #{operationTime2}
        <if test="uId !=null">
            and l.uId = #{uId}
        </if>
        <!--条件查询-非全部-->
        <if test="eventType !=null">
            <choose>
                <!--系统级别(1)-->
                <when test="eventType ==1">
                    <choose>
                        <when test="operationType ==1
                            or operationType ==2
                            or operationType ==20
                            or operationType ==21
                        ">
                            <choose>
                                <!--登录包括普通登录和临时凭证ID登录-->
                                <when test="operationType ==1">
                                    and uoprateType in (#{operationType},35)
                                </when>
                                <otherwise>
                                    and uoprateType= #{operationType}
                                </otherwise>
                            </choose>
                        </when>
                        <when test="operationType ==31
                            or operationType ==32
                            or operationType ==33
                            or operationType ==34">
                            and uoprateType= #{operationType}
                            <choose>
                                <when test="operationType ==31">
                                    or uOprateMsg  regexp '登录PC系统失败'
                                </when>
                                <when test="operationType ==32">
                                    or uOprateMsg  regexp '配置参数修改|导航配置'
                                </when>
                                <when test="operationType ==33">
                                    or uOprateMsg  regexp '密码' and uOprateMsg not regexp '更新密码复杂度规则'
                                </when>
                                <otherwise>
                                    or uOprateMsg  regexp 'LoginAction!login|imeout'
                                </otherwise>
                            </choose>
                        </when>
                        <when test="operationType == 3 or operationType == 4 or operationType == 5">
                            and uoprateType= #{operationType}
                            and uOprateMsg  regexp
                            '添加新用户|的用户信息|权限组|审计数据记录容量
                            |执行了User模块|执行了PermitGroup'
                        </when>
                    </choose>
                </when>
                <!--业务级别-机房(2)-->
                <when test="eventType ==2">
                    and uoprateType= #{operationType}
                    and uOprateMsg regexp '单体|电池组|组端|设备|Batt|Dev|FBO|Fbs|Ld9|Li9130|Lithium|Station3D'
                    and uOprateMsg not regexp '电源|Pwrdev'
                </when>
                <!--业务级别-电源(3)-->
                <when test="eventType ==3">
                    and uoprateType= #{operationType}
                    and uOprateMsg regexp 'PowerInf|Pwr'
                </when>
                <!--业务级别-其他(4)-->
                <when test="eventType ==4">
                    and uoprateType= #{operationType}
                    and uOprateMsg not regexp '添加新用户|的用户信息|权限组|审计数据记录容量|配置参数修改|导航配置|密码|单体|电池组|组端|设备|电源|
                    |执行了User模块|执行了PermitGroup|
                    |Batt|Dev|FBO|Fbs|Ld9|Li9130|Lithium|Station3D|
                    |PowerInf|Pwr'
                </when>
            </choose>
        </if>
        ORDER BY uOprateDay DESC
    </select>
</mapper>