123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?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">
- <!-- namespace必须指向DAO接口 -->
- <mapper namespace="com.jpsoft.picc.modules.sys.dao.PermissionDAO">
- <resultMap id="PermissionMap" type="com.jpsoft.picc.modules.sys.entity.Permission">
- <id property="id" column="id_"/>
- <result property="path" column="path_"/>
- <result property="method" column="method_"/>
- <result property="summary" column="summary_"/>
- <result property="delFlag" column="del_flag"/>
- <result property="createBy" column="create_by"/>
- <result property="updateBy" column="update_by"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- </resultMap>
- <insert id="insert" parameterType="com.jpsoft.picc.modules.sys.entity.Permission">
- <!--
- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
- select sys_guid() from dual
- </selectKey>
- -->
- <![CDATA[
- insert into sys_permission
- (id_,path_,method_,summary_,del_flag,create_by,update_by,create_time,update_time)
- values
- (
- #{id,jdbcType=VARCHAR}
- ,#{path,jdbcType=VARCHAR}
- ,#{method,jdbcType=VARCHAR}
- ,#{summary,jdbcType=VARCHAR}
- ,#{delFlag,jdbcType= NUMERIC }
- ,#{createBy,jdbcType=VARCHAR}
- ,#{updateBy,jdbcType=VARCHAR}
- ,#{createTime,jdbcType= TIMESTAMP }
- ,#{updateTime,jdbcType= TIMESTAMP }
- )
- ]]>
- </insert>
- <delete id="delete" parameterType="string">
- delete from sys_permission where id_=#{id,jdbcType=VARCHAR}
- </delete>
- <update id="update" parameterType="com.jpsoft.picc.modules.sys.entity.Permission">
- update sys_permission
- <set>
- <if test="path!=null">
- path_=#{path,jdbcType=VARCHAR},
- </if>
- <if test="method!=null">
- method_=#{method,jdbcType=VARCHAR},
- </if>
- <if test="summary!=null">
- summary_=#{summary,jdbcType=VARCHAR},
- </if>
- <if test="delFlag!=null">
- del_flag=#{delFlag,jdbcType= NUMERIC },
- </if>
- <if test="createBy!=null">
- create_by=#{createBy,jdbcType=VARCHAR},
- </if>
- <if test="updateBy!=null">
- update_by=#{updateBy,jdbcType=VARCHAR},
- </if>
- <if test="createTime!=null">
- create_time=#{createTime,jdbcType= TIMESTAMP },
- </if>
- <if test="updateTime!=null">
- update_time=#{updateTime,jdbcType= TIMESTAMP },
- </if>
- </set>
- where id_=#{id}
- </update>
- <select id="get" parameterType="string" resultMap="PermissionMap">
- select
- id_,path_,method_,summary_,del_flag,create_by,update_by,create_time,update_time from sys_permission where
- id_=#{0}
- </select>
- <select id="exist" parameterType="string" resultType="int">
- select count(*) from sys_permission where path_=#{path} and method_=#{method} and del_flag=0
- </select>
- <select id="list" resultMap="PermissionMap">
- select * from sys_permission where del_flag=0
- </select>
- <select id="search" parameterType="hashmap" resultMap="PermissionMap">
- <![CDATA[
- select * from sys_permission
- ]]>
- where del_flag=0
- <if test="searchParams.path != null">
- and path_ like #{searchParams.path}
- </if>
- <foreach item="sort" collection="sortList" open="order by" separator=",">
- ${sort.name} ${sort.order}
- </foreach>
- </select>
- <select id="hasPermitted" parameterType="string" resultType="int">
- <![CDATA[
- select count(*) from
- sys_user u,sys_user_role ur,sys_role_permission rp,sys_permission p
- where u.id_=#{userId}
- and u.id_=ur.user_id
- and ur.role_id = rp.role_id
- and rp.perm_id = p.id_
- and p.path_ = #{path}
- and p.method_ = #{method}
- ]]>
- </select>
- </mapper>
|