|  |  | 
 |  |  |     inner join ba_user_role ur on rp.role_id = ur.role_id | 
 |  |  |     inner join ba_role r on ur.role_id = r.id | 
 |  |  |     where r.deleted != 1 | 
 |  |  |     <if test="userId != null and userId !=''"> | 
 |  |  |     <if test="userId != null"> | 
 |  |  |       and ur.user_id = #{userId, jdbcType=BIGINT} | 
 |  |  |     </if> | 
 |  |  |   </select> | 
 |  |  | 
 |  |  |     select p.id | 
 |  |  |     from ba_privilege p | 
 |  |  |     inner join ba_role_privilege rp on p.id = rp.privilege_id | 
 |  |  |     <if test="roleId != null and roleId !=''"> | 
 |  |  |     <if test="roleId != null"> | 
 |  |  |       where rp.role_id = #{roleId, jdbcType=BIGINT} | 
 |  |  |     </if> | 
 |  |  |   </select> | 
 |  |  | 
 |  |  | <!--    select p.id,p.num,p.name,p.type--> | 
 |  |  | <!--    from ba_privilege p--> | 
 |  |  | <!--    inner join ba_role_privilege rp on p.id = rp.privilege_id--> | 
 |  |  | <!--    <if test="roleId != null and roleId !=''">--> | 
 |  |  | <!--    <if test="roleId != null">--> | 
 |  |  | <!--      where rp.role_id = #{roleId, jdbcType=BIGINT}--> | 
 |  |  | <!--    </if>--> | 
 |  |  | <!--  </select>--> | 
 |  |  | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     insert into ba_privilege | 
 |  |  |     <trim prefix="(" suffix=")" suffixOverrides=","> | 
 |  |  |       <if test="id != null and id !=''"> | 
 |  |  |       <if test="id != null"> | 
 |  |  |         id, | 
 |  |  |       </if> | 
 |  |  |       <if test="num != null and num !=''"> | 
 |  |  | 
 |  |  |       <if test="name != null and name !=''"> | 
 |  |  |         `name`, | 
 |  |  |       </if> | 
 |  |  |       <if test="type != null and type !=''"> | 
 |  |  |       <if test="type != null"> | 
 |  |  |         `type`, | 
 |  |  |       </if> | 
 |  |  |       <if test="typeName!= null and typeName !=''"> | 
 |  |  | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |     <trim prefix="values (" suffix=")" suffixOverrides=","> | 
 |  |  |       <if test="id != null and id !=''"> | 
 |  |  |       <if test="id != null"> | 
 |  |  |         #{id}, | 
 |  |  |       </if> | 
 |  |  |       <if test="num != null and num !=''"> | 
 |  |  |       <if test="num != null"> | 
 |  |  |         #{num}, | 
 |  |  |       </if> | 
 |  |  |       <if test="name != null and name !=''"> |