jinlin
2023-12-28 63447fec93e8e562833db30bc848884001b808c4
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
<?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.SysLogLoginDao">
    <select id="getList" resultType="com.zt.modules.log.model.SysLogLogin">
        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_login a
        ) a
        <where>
            <if test="status!=null">
              and  status=#{status}
            </if>
            <if test="status!=null">
                and CREATOR_NAME like concat('%',#{creatorName},'%')
            </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%'
            </if>
            <if test="action == 'xtsjybm'">
                and role_names LIKE '%xtgly%'  OR role_names LIKE '%xtsjy%'
            </if>
            <if test="action == 'other'">
                and a.CREATOR = ${currentUserId}
            </if>
            <if test="order!=null and order!=''">
                order by a.CREATE_DATE  ${order}
            </if>
 
            <if test="order==null">
                order by a.CREATE_DATE
            </if>
        </where>
    </select>
</mapper>