|  |  | 
 |  |  |     <result column="num" property="num" /> | 
 |  |  |     <result column="name" property="name" /> | 
 |  |  |     <result column="type" property="type" /> | 
 |  |  |     <result column="type_name" property="typeName" /> | 
 |  |  |   </resultMap> | 
 |  |  |   <sql id="Base_Column_List"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     id, num, `name`, `type` | 
 |  |  |     id, num, `name`, `type`,type_name | 
 |  |  |   </sql> | 
 |  |  |   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  | 
 |  |  |     </if> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <select id="selectPrivilegeByRoleId" resultType="Integer"> | 
 |  |  |     select p.num | 
 |  |  |   <select id="selectPrivilegeByRoleId" resultType="Long"> | 
 |  |  |     select p.id | 
 |  |  |     from ba_privilege p | 
 |  |  |     inner join ba_role_privilege rp on p.id = rp.privilege_id | 
 |  |  |     <if test="roleId != null"> | 
 |  |  | 
 |  |  |     </if> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  | <!--  <select id="selectByRole" resultType="com.dy.pmsGlobal.pojoBa.BaPrivilege">--> | 
 |  |  | <!--    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">--> | 
 |  |  | <!--      where rp.role_id = #{roleId, jdbcType=BIGINT}--> | 
 |  |  | <!--    </if>--> | 
 |  |  | <!--  </select>--> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |   <insert id="insert" parameterType="com.dy.pmsGlobal.pojoBa.BaPrivilege"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     insert into ba_privilege (id, num, `name`, `type`) | 
 |  |  |     values (#{id}, #{num}, #{name}, #{type}) | 
 |  |  |     insert into ba_privilege (id, num, `name`, `type`,type_name) | 
 |  |  |     values (#{id}, #{num}, #{name}, #{type}, #{typeName}) | 
 |  |  |   </insert> | 
 |  |  |   <insert id="insertSelective" parameterType="com.dy.pmsGlobal.pojoBa.BaPrivilege"> | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  | 
 |  |  |       <if test="id != null"> | 
 |  |  |         id, | 
 |  |  |       </if> | 
 |  |  |       <if test="num != null"> | 
 |  |  |       <if test="num != null and num !=''"> | 
 |  |  |         num, | 
 |  |  |       </if> | 
 |  |  |       <if test="name != null"> | 
 |  |  |       <if test="name != null and name !=''"> | 
 |  |  |         `name`, | 
 |  |  |       </if> | 
 |  |  |       <if test="type != null"> | 
 |  |  |         `type`, | 
 |  |  |       </if> | 
 |  |  |       <if test="typeName!= null and typeName !=''"> | 
 |  |  |         type_name, | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |     <trim prefix="values (" suffix=")" suffixOverrides=","> | 
 |  |  | 
 |  |  |       <if test="num != null"> | 
 |  |  |         #{num}, | 
 |  |  |       </if> | 
 |  |  |       <if test="name != null"> | 
 |  |  |       <if test="name != null and name !=''"> | 
 |  |  |         #{name}, | 
 |  |  |       </if> | 
 |  |  |       <if test="type != null"> | 
 |  |  |       <if test="type != null and type !=''"> | 
 |  |  |         #{type}, | 
 |  |  |       </if> | 
 |  |  |       <if test="typeName!= null and typeName !=''"> | 
 |  |  |         #{typeName}, | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |   </insert> | 
 |  |  | 
 |  |  |     <!--@mbg.generated--> | 
 |  |  |     update ba_privilege | 
 |  |  |     <set> | 
 |  |  |       <if test="num != null"> | 
 |  |  |       <if test="num != null and num !=''"> | 
 |  |  |         num = #{num}, | 
 |  |  |       </if> | 
 |  |  |       <if test="name != null"> | 
 |  |  |       <if test="name != null and name !=''"> | 
 |  |  |         `name` = #{name}, | 
 |  |  |       </if> | 
 |  |  |       <if test="type != null"> | 
 |  |  |       <if test="type != null and type !=''"> | 
 |  |  |         `type` = #{type}, | 
 |  |  |       </if> | 
 |  |  |       <if test="typeName!= null and typeName !=''"> | 
 |  |  |         type_name = #{typeName}, | 
 |  |  |       </if> | 
 |  |  |     </set> | 
 |  |  |     where id = #{id} | 
 |  |  | 
 |  |  |     update ba_privilege | 
 |  |  |     set num = #{num}, | 
 |  |  |       `name` = #{name}, | 
 |  |  |       `type` = #{type} | 
 |  |  |       `type` = #{type}, | 
 |  |  |        type_name = #{typeName} | 
 |  |  |     where id = #{id} | 
 |  |  |   </update> | 
 |  |  |  | 
 |  |  | 
 |  |  |     delete from ba_privilege | 
 |  |  |     where id = #{id} | 
 |  |  |   </delete> | 
 |  |  |  | 
 |  |  |   <select id="selectByIds" parameterType="arraylist" resultMap="BaseResultMap"> | 
 |  |  |     select | 
 |  |  |     <include refid="Base_Column_List" /> | 
 |  |  |     from ba_privilege where id in | 
 |  |  |     <foreach item="id" collection="ids" open="(" separator="," close=")"> | 
 |  |  |       #{id} | 
 |  |  |     </foreach> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <select id="selectSome" resultType="com.dy.pmsGlobal.pojoBa.BaPrivilege"> | 
 |  |  |     select | 
 |  |  |       <include refid="Base_Column_List" /> | 
 |  |  |     from ba_privilege | 
 |  |  |     <trim prefix="where " suffixOverrides="and"> | 
 |  |  |       <if test="num != null and num != ''"> | 
 |  |  |         num = #{num,jdbcType=INTEGER} and | 
 |  |  |       </if> | 
 |  |  |       <if test="name != null and name != ''"> | 
 |  |  |         name like concat('%', #{name}, '%') and | 
 |  |  |       </if> | 
 |  |  |       <if test="typeName != null  and typeName != '' "> | 
 |  |  |         type_name like concat('%', #{typeName}, '%') and | 
 |  |  |       </if> | 
 |  |  |       <if test="type != null and type != ''"> | 
 |  |  |         type = #{type,jdbcType=INTEGER} and | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |     order by id desc | 
 |  |  |     <trim prefix="limit " > | 
 |  |  |       <if test="start != null and count != null"> | 
 |  |  |         #{start}, #{count} | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |   </select> | 
 |  |  |  | 
 |  |  |   <select id="selectSomeCount" resultType="java.lang.Long"> | 
 |  |  |     select | 
 |  |  |     count(1) | 
 |  |  |     from ba_privilege | 
 |  |  |     <trim prefix="where " suffixOverrides="and"> | 
 |  |  |       <if test="num != null and num != ''"> | 
 |  |  |         num = #{num,jdbcType=INTEGER} and | 
 |  |  |       </if> | 
 |  |  |       <if test="name != null and name != ''"> | 
 |  |  |         name like concat('%', #{name}, '%') and | 
 |  |  |       </if> | 
 |  |  |       <if test="typeName != null  and typeName != '' "> | 
 |  |  |         type_name like concat('%', #{typeName}, '%') and | 
 |  |  |       </if> | 
 |  |  |       <if test="type != null and type != ''"> | 
 |  |  |         type = #{type,jdbcType=INTEGER} and | 
 |  |  |       </if> | 
 |  |  |     </trim> | 
 |  |  |   </select> | 
 |  |  | </mapper> |