| | |
| | | <!--@Table ba_role_permissions--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="roleId" jdbcType="BIGINT" property="roleid" /> |
| | | <result column="permissions" jdbcType="VARCHAR" property="permissions" /> |
| | | <!-- <result column="permissions" jdbcType="VARCHAR" property="permissions" />--> |
| | | <result column="permissions" property="permissions" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, roleId, permissions |
| | | </sql> |
| | | |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | |
| | | <!--@mbg.generated--> |
| | | insert into ba_role_permissions (id, roleId, permissions |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{roleid,jdbcType=BIGINT}, #{permissions,jdbcType=VARCHAR} |
| | | values (#{id,jdbcType=BIGINT}, #{roleid,jdbcType=BIGINT}, #{permissions,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler} |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | #{roleid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="permissions != null"> |
| | | #{permissions,jdbcType=VARCHAR}, |
| | | #{permissions,jdbcType=JAVA_OBJECT,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | |
| | | roleId = #{roleid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="permissions != null"> |
| | | permissions = #{permissions,jdbcType=VARCHAR}, |
| | | permissions = #{permissions,jdbcType=JAVA_OBJECT,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | |
| | | <!--@mbg.generated--> |
| | | update ba_role_permissions |
| | | set roleId = #{roleid,jdbcType=BIGINT}, |
| | | permissions = #{permissions,jdbcType=VARCHAR} |
| | | permissions = #{permissions,jdbcType=JAVA_OBJECT,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据指定条件获取角色记录数--> |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM ba_role role |
| | | LEFT JOIN ba_role_permissions per ON per.roleId = role.id |
| | | <where> |
| | | AND role.deleted = 0 |
| | | |
| | | <if test = "roleId != null and roleId > 0"> |
| | | AND role.id = ${roleId} |
| | | </if> |
| | | |
| | | <if test = "roleName != null and roleName !=''"> |
| | | AND role.name LIKE CONCAT('%',#{roleName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取角色记录--> |
| | | <select id="getRoles" resultType="com.dy.pipIrrGlobal.voBa.VoRole"> |
| | | SELECT |
| | | |
| | | CAST(role.id AS char) AS roleId, |
| | | role.name AS roleName, |
| | | per.id AS perId, |
| | | (SELECT `name` FROM ba_user WHERE id = role.operator) AS operator, |
| | | role.operate_dt AS operateDt |
| | | FROM ba_role role |
| | | LEFT JOIN ba_role_permissions per ON per.roleId = role.id |
| | | <where> |
| | | AND role.deleted = 0 |
| | | |
| | | <if test = "roleId != null and roleId > 0"> |
| | | AND role.id = ${roleId} |
| | | </if> |
| | | |
| | | <if test = "roleName != null and roleName !=''"> |
| | | AND role.name LIKE CONCAT('%',#{roleName},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY role.operate_dt DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | </mapper> |