liurunyu
2024-04-15 a9e11d99db3ba48ad6367449d19f6320c31f2f34
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
102
103
104
105
106
107
108
109
110
111
112
113
114
<?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.dy.pmsGlobal.daoBa.BaRoleMapper">
  <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    <!--@Table ba_role-->
    <id column="id" property="id" />
    <result column="name" property="name" />
    <result column="disabled" property="disabled" />
    <result column="deleted" property="deleted" />
  </resultMap>
  <resultMap id="partResultMap" type="com.dy.pmsGlobal.pojoBa.BaRole">
    <result column="id" property="id" />
    <result column="name" property="name" />
  </resultMap>
 
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, `name`, disabled, deleted
  </sql>
 
  <sql id="Part_Column_List">
    <!--@mbg.generated-->
    id, `name`, disabled
  </sql>
 
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from ba_role
    where id = #{id}
  </select>
 
  <select id="selectByUserId" resultMap="partResultMap">
    select <include refid="Part_Column_List" />
    from ba_role r
    inner join ba_user_role ur on r.id = ur.role_id
    where r.deleted != 1
    <if test="userId != null">
      and ur.user_id = #{userId}
    </if>
  </select>
 
 
 
 
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ba_role
    where id = #{id}
  </delete>
  <insert id="insert" parameterType="com.dy.pmsGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    insert into ba_role (id, `name`, disabled, deleted)
    values (#{id}, #{name}, #{disabled}, #{deleted})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pmsGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    insert into ba_role
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="disabled != null">
        disabled,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id},
      </if>
      <if test="name != null">
        #{name},
      </if>
      <if test="disabled != null">
        #{disabled},
      </if>
      <if test="deleted != null">
        #{deleted},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    update ba_role
    <set>
      <if test="name != null">
        `name` = #{name},
      </if>
      <if test="disabled != null">
        disabled = #{disabled},
      </if>
      <if test="deleted != null">
        deleted = #{deleted},
      </if>
    </set>
    where id = #{id}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    update ba_role
    set `name` = #{name},
      disabled = #{disabled},
      deleted = #{deleted}
    where id = #{id}
  </update>
</mapper>