| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?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.goafanti.common.dao.RoleMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.Role">
- <id column="id" jdbcType="VARCHAR" property="id" />
- <result column="role_name" jdbcType="VARCHAR" property="roleName" />
- <result column="role_type" jdbcType="INTEGER" property="roleType" />
- </resultMap>
- <sql id="Base_Column_List">
- id, role_name, role_type
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from role
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- delete from role
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.Role">
- insert into role (id, role_name, role_type
- )
- values (#{id,jdbcType=VARCHAR}, #{roleName,jdbcType=VARCHAR}, #{roleType,jdbcType=INTEGER}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.Role">
- insert into role
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="roleName != null">
- role_name,
- </if>
- <if test="roleType != null">
- role_type,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="roleName != null">
- #{roleName,jdbcType=VARCHAR},
- </if>
- <if test="roleType != null">
- #{roleType,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Role">
- update role
- <set>
- <if test="roleName != null">
- role_name = #{roleName,jdbcType=VARCHAR},
- </if>
- <if test="roleType != null">
- role_type = #{roleType,jdbcType=INTEGER},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Role">
- update role
- set role_name = #{roleName,jdbcType=VARCHAR},
- role_type = #{roleType,jdbcType=INTEGER}
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <insert id="insertBatch" parameterType="com.goafanti.common.model.Role">
- insert into role (id, name)
- values
- <foreach item="item" index="index" collection="list" separator=",">
- (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR})
- </foreach>
- ON DUPLICATE KEY UPDATE
- name = values(name)
- </insert>
- <select id="findRolePermissions" resultType="com.goafanti.permission.bo.RolePermissionBo">
- select tr.id as rid, tr.role_name as rname, tr.role_type,tp.id as pid,tp.name as pname,tp.url
- from role tr
- left join role_permission trp on trp.rid=tr.id
- left join permission tp on tp.id=trp.pid
- where tr.role_type <![CDATA[ < ]]> 999999
- </select>
- <select id="findRoleByUserId" resultType="java.lang.String">
- select tr.role_type from role tr
- left join user_role tur on tur.rid=tr.id
- where tur.uid = #{userId,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKeys" parameterType="java.lang.String">
- delete from role
- where id in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item,jdbcType=VARCHAR}
- </foreach>
- </delete>
- </mapper>
|