| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?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.PermissionMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.Permission">
- <id column="id" jdbcType="VARCHAR" property="id" />
- <result column="url" jdbcType="VARCHAR" property="url" />
- <result column="name" jdbcType="VARCHAR" property="name" />
- </resultMap>
- <sql id="Base_Column_List">
- id, url, name
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from permission
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- delete from permission
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.Permission">
- insert into permission (id, url, name
- )
- values (#{id,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.Permission">
- insert into permission
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="url != null">
- url,
- </if>
- <if test="name != null">
- name,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="url != null">
- #{url,jdbcType=VARCHAR},
- </if>
- <if test="name != null">
- #{name,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Permission">
- update permission
- <set>
- <if test="url != null">
- url = #{url,jdbcType=VARCHAR},
- </if>
- <if test="name != null">
- name = #{name,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Permission">
- update permission
- set url = #{url,jdbcType=VARCHAR},
- name = #{name,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <select id="findPermissionByUserId" parameterType="java.lang.String" resultType="java.lang.String">
- select tp.url
- from permission tp
- left join role_permission trp on tp.id=trp.pid
- left join user_role tur on tur.rid=trp.rid
- where tur.uid = #{userId,jdbcType=VARCHAR}
- </select>
- <select id="findAll" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from permission order by name
- </select>
-
- <insert id="insertBatch" parameterType="com.goafanti.common.model.Permission">
- insert into permission (id, name, url)
- values
- <foreach item="item" index="index" collection="list" separator=",">
- (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.url,jdbcType=VARCHAR})
- </foreach>
- ON DUPLICATE KEY UPDATE
- name = values(name),
- url = values(url)
- </insert>
-
- <delete id="deleteByPrimaryKeys" parameterType="java.lang.String">
- delete from permission
- where id in
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
- #{item,jdbcType=VARCHAR}
- </foreach>
- </delete>
- </mapper>
|