mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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.dg.core.db.gen.mapper.RoleManagementMapper">
 
    <resultMap type="com.dg.core.db.gen.entity.RoleManagementEntity" id="RoleManagementEntityResult">
        <id     property="id"      column="id"      />
        <id     property="roleName"      column="role_name"      />
        <id     property="createUserId"      column="create_user_id"      />
        <id     property="createTime"      column="create_time"      />
        <id     property="updateUserId"      column="update_user_id"      />
        <id     property="updateTime"      column="update_time"      />
        <id     property="permission"      column="permission"      />
 
    </resultMap>
 
    <sql id="selectRoleManagementEntityVo">
        SELECT
            id,
            role_name,
            permission,
            create_time,
            update_time,
            create_user_id,
            (select user_name from automessage_sys_user where create_user_id=automessage_sys_user.user_id) as createName,
            update_user_id
        FROM
            automessage_role_management
    </sql>
 
    <select id="selectConfigList"  resultMap="RoleManagementEntityResult">
        <include refid="selectRoleManagementEntityVo"/>
        <where>
            AND id not in(1,2,3,4)
            <if test="name!=null and name!=''">
                and role_name like concat('%', #{name}, '%')
            </if>
        <!--            <if test="streetName != null and streetName != ''">-->
--             AND id not in(1,2,3,4)
        <!--            </if>-->
        <!--            <if test="loginName != null and loginName != ''">-->
        <!--                AND login_name like concat('%', #{loginName}, '%')-->
        <!--            </if>-->
        <!--            <if test="phonenumber != null and phonenumber != ''">-->
        <!--                AND phonenumber like concat('%', #{phonenumber}, '%')-->
        <!--            </if>-->
        <!--            <if test="roleId != null and roleId != ''">-->
        <!--                AND role_id=#{roleId}-->
        <!--            </if>-->
 
        </where>
 
        order by create_time desc
    </select>
 
    <insert id="insertConfig" parameterType="com.dg.core.db.gen.entity.RoleManagementEntity">
        insert into automessage_role_management (
        <if test="id != null">id,</if>
        <if test="roleName != null and roleName != '' ">role_name,</if>
        <if test="permission != null">permission,</if>
        <if test="createUserId != null and createUserId != '' ">create_user_id,</if>
        <if test="updateUserId != null and updateUserId != '' ">update_user_id,</if>
        update_time,
        create_time
        )values(
        <if test="id != null">#{id},</if>
        <if test="roleName != null and roleName != '' ">#{roleName},</if>
        <if test="permission != null and permission != '' "  >#{permission},</if>
        <if test="createUserId != null and createUserId != '' ">#{createUserId},</if>
        <if test="updateUserId != null and updateUserId != '' ">#{updateUserId},</if>
        sysdate(),
        sysdate()
        )
    </insert>
 
    <update id="updateConfig" parameterType="com.dg.core.db.gen.entity.RoleManagementEntity">
        update automessage_role_management
        <set>
            <if test="id != null">id=#{id},</if>
            <if test="roleName != null and roleName != '' ">role_name=#{roleName},</if>
            <if test="permission != null and permission != '' "  >permission=#{permission},</if>
            <if test="createUserId != null and createUserId != '' ">create_user_id=#{createUserId},</if>
            <if test="updateUserId != null and updateUserId != '' ">update_user_id=#{updateUserId},</if>
            update_time=sysdate()
        </set>
        where  id= #{id}
    </update>
 
    <delete id="deleteConfigById" parameterType="string">
        delete from automessage_role_management where id= #{Id}
    </delete>
 
    <select id="countNum" resultType="integer">
        select count(id) from automessage_role_management
        <where>
            <if test="name!=null and name!=''">
                and role_name like concat('%', #{name}, '%')
            </if>
        </where>
    </select>
 
</mapper>