月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-06-02 c31e03f0e51214a524d3fc34d30f3459698ff625
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
<?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.moon.server.mapper.sys.AuthMapper">
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_auth
        <where>
            <if test="name != null">
                name = #{name}
            </if>
        </where>
    </select>
 
    <select id="selectByPage" resultType="com.moon.server.entity.sys.AuthEntity">
        select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_auth a
        <where>
            <if test="name != null">
                name = #{name}
            </if>
        </where>
        order by id
        limit #{limit} offset #{offset}
    </select>
 
    <select id="selectCountForMenu" resultType="java.lang.Integer">
        select count(a.*) from lf.sys_auth a where not exists (select b.id from lf.sys_menu_auth b
        <where>
            b.authid = a.id
            <if test="menuid != null">
                and b.menuid = #{menuid}
            </if>
        </where>
        )
    </select>
 
    <select id="selectByPageForMenu" resultType="com.moon.server.entity.sys.AuthEntity">
        select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName
        from lf.sys_auth a where not exists (select b.id from lf.sys_menu_auth b
        <where>
            b.authid = a.id
            <if test="menuid != null">
                and b.menuid = #{menuid}
            </if>
        </where>
        )
        order by a.id
        limit #{limit} offset #{offset}
    </select>
 
    <select id="selectAuthAll" resultType="com.moon.server.entity.sys.AuthEntity">
        select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName
        from lf.sys_auth a
        order by id
    </select>
 
    <select id="selectAuth" resultType="com.moon.server.entity.sys.AuthEntity">
        select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName
        from lf.sys_auth a
        where id = #{id}
    </select>
 
    <insert id="insertAuth" parameterType="com.moon.server.entity.sys.AuthEntity">
       insert into lf.sys_auth
       (name,tag,create_user,create_time,bak)
       values
       (#{name},#{tag},#{createUser},now(),#{bak});
    </insert>
 
    <insert id="insertAuths">
       insert into lf.sys_auth
        (name,tag,create_user,create_time,bak)
       values
        <foreach collection="list" item="item" index="index" separator=","  >
            (#{item.name},#{item.tag},#{item.createUser},now(),#{item.bak})
        </foreach>
    </insert>
 
    <delete id="deleteAuth">
        delete from lf.sys_role_menu_auth where menu_auth_id in (select id from lf.sys_menu_auth where authid = #{id});
        delete from lf.sys_menu_auth where authid = #{id};
        delete from lf.sys_auth where id = #{id};
    </delete>
 
    <delete id="deleteAuths"  >
        delete from lf.sys_role_menu_auth where menu_auth_id in (select id from lf.sys_menu_auth where authid in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>);
        delete from lf.sys_menu_auth where authid in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>;
        delete from lf.sys_auth where id in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>;
    </delete>
 
    <update id="updateAuth">
    update lf.sys_auth set name=#{name},tag=#{tag},update_user=#{id},update_time=now(),bak=#{bak} where id=#{id}
    </update>
</mapper>