|  |  |  | 
|---|
|  |  |  | 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 userId !=''"> | 
|---|
|  |  |  | <if test="userId != null"> | 
|---|
|  |  |  | and ur.user_id = #{userId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ba_role | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null and id !=''"> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="name != null and name !=''"> | 
|---|
|  |  |  | `name`, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="disabled != null and disabled !=''"> | 
|---|
|  |  |  | <if test="disabled != null"> | 
|---|
|  |  |  | disabled, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="deleted != null and deleted !=''"> | 
|---|
|  |  |  | <if test="deleted != null"> | 
|---|
|  |  |  | deleted, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null and id !=''"> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | #{id}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="name != null and name !=''"> | 
|---|
|  |  |  | #{name}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="disabled != null and disabled !=''"> | 
|---|
|  |  |  | <if test="disabled != null"> | 
|---|
|  |  |  | #{disabled}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="deleted != null and deleted !=''"> | 
|---|
|  |  |  | <if test="deleted != null"> | 
|---|
|  |  |  | #{deleted}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="name != null and name !=''"> | 
|---|
|  |  |  | `name` = #{name}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="disabled != null and disabled !=''"> | 
|---|
|  |  |  | <if test="disabled != null"> | 
|---|
|  |  |  | disabled = #{disabled}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="deleted != null and deleted !=''"> | 
|---|
|  |  |  | <if test="deleted != null"> | 
|---|
|  |  |  | deleted = #{deleted}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="name != null and name != ''"> | 
|---|
|  |  |  | r.name like concat('%', #{name}, '%') and | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="disabled != null and disabled != ''"> | 
|---|
|  |  |  | <if test="disabled != null"> | 
|---|
|  |  |  | r.disabled =#{disabled,jdbcType=BOOLEAN} and | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dt != null and dt != ''"> | 
|---|
|  |  |  | <if test="dt != null"> | 
|---|
|  |  |  | DATE_FORMAT(r.dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="name != null and name != ''"> | 
|---|
|  |  |  | r.name like concat('%', #{name}, '%') and | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="disabled != null and disabled != ''"> | 
|---|
|  |  |  | <if test="disabled != null"> | 
|---|
|  |  |  | r.disabled =#{disabled,jdbcType=BOOLEAN} and | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dt != null and dt != ''"> | 
|---|
|  |  |  | <if test="dt != null"> | 
|---|
|  |  |  | DATE_FORMAT(r.dt, '%Y-%m-%d') = #{dt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|