Permissions2.xml 5.1 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
<?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.lyms.platform.permission.dao.Permissions2Mapper">

<resultMap id="Permissions2ResultMap" type="com.lyms.platform.permission.model.Permissions2">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="uri" property="uri" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="VARCHAR" />
<result column="puri" property="puri" jdbcType="VARCHAR" />
<result column="icon" property="icon" jdbcType="VARCHAR" />
<result column="yn" property="yn" jdbcType="INTEGER" />
<result column="create_date" property="createDate" jdbcType="TIMESTAMP" javaType="java.sql.Timestamp"/>
<result column="create_user" property="createUser" jdbcType="VARCHAR" />
<result column="enable" property="enable" jdbcType="INTEGER" />
<result column="extra_data" property="extra_data" jdbcType="VARCHAR" />
<result column="weight" property="weight" jdbcType="INTEGER" />
</resultMap>



<insert id="addPermissions2" parameterType="com.lyms.platform.permission.model.Permissions2">
insert into permissions2 (name,uri,type,puri,icon,yn,create_date,create_user,enable) values (#{name},#{uri},#{type},#{puri},#{icon},#{yn},#{createDate},#{createUser},#{enable})
</insert>



<update id="updatePermissions2" parameterType="com.lyms.platform.permission.model.Permissions2">
update permissions2 <set><if test="name != null and name != ''">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="uri != null and uri != ''">
uri = #{uri,jdbcType=VARCHAR},
</if>
<if test="type != null and type != ''">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="puri != null and puri != ''">
puri = #{puri,jdbcType=VARCHAR},
</if>
<if test="icon != null and icon != ''">
icon = #{icon,jdbcType=VARCHAR},
</if>
<if test="yn != null and yn >= 0">
yn = #{yn,jdbcType=INTEGER},
</if>
<if test="createDate != null ">
create_date = #{createDate,jdbcType=TIMESTAMP}
</if>
<if test="createUser != null and createUser != ''">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="enable != null and enable >= 0">
enable = #{enable,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>


<delete id="deletePermissions2" parameterType="java.lang.Integer">
delete from permissions2 where id = #{id,jdbcType=INTEGER}
</delete>



<select id="getPermissions2" resultMap="Permissions2ResultMap" parameterType="java.lang.Integer">
select id,name,uri,type,puri,icon,yn,create_date,create_user,enable,extra_data,weight
from permissions2 where id = #{id,jdbcType=INTEGER}
</select>


<sql id="orderAndLimit">
<if test="sort != null and sort != '' ">
order by ${sort}
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</if>
</sql>



<sql id="Permissions2Condition">
<where>
1 = 1
<if test="id != null and id >= 0">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="name != null and name != ''">
and name = #{name,jdbcType=VARCHAR}
</if>
<if test="uri != null and uri != ''">
and uri = #{uri,jdbcType=VARCHAR}
</if>
<if test="type != null and type != ''">
and type = #{type,jdbcType=VARCHAR}
</if>
<if test="puri != null and puri != ''">
and puri = #{puri,jdbcType=VARCHAR}
</if>
<if test="icon != null and icon != ''">
and icon = #{icon,jdbcType=VARCHAR}
</if>
<if test="yn != null and yn >= 0">
and yn = #{yn,jdbcType=INTEGER}
</if>
<if test="createDate != null">
and create_date = #{createDate,jdbcType=TIMESTAMP}
</if>
<if test="createUser != null and createUser != ''">
and create_user = #{createUser,jdbcType=VARCHAR}
</if>
<if test="enable != null and enable >= 0">
and enable = #{enable,jdbcType=INTEGER}
</if>
</where>
</sql>



<select id="queryPermissions2" resultMap="Permissions2ResultMap" parameterType="com.lyms.platform.permission.model.Permissions2Query">
select id,name,uri,type,puri,icon,yn,create_date,create_user,enable,extra_data,weight
from permissions2
<include refid="Permissions2Condition" />
<include refid="orderAndLimit" />
</select>



<select id="queryPermissions2Count" resultType="int" parameterType="com.lyms.platform.permission.model.Permissions2Query">
select count(1) from permissions2
<include refid="Permissions2Condition" />
</select>


<select id="queryPermissionByRoleIds" parameterType="java.util.List" resultMap="Permissions2ResultMap">
select b.* from role_permission_maps a, permissions2 b where a.yn=1 and b.yn=1 and a.role_id
in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and a.permission_id=b.id ORDER BY b.weight
</select>

<select id="queryPermissionByRoleIds1" parameterType="int" resultMap="Permissions2ResultMap">
select b.* from role_permission_maps a, permissions2 b where a.role_id=
#{weight,jdbcType=INTEGER}
and b.yn=1 and a.yn=1 and a.permission_id=b.id;
</select>
</mapper>