Permissions.xml 6.91 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
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
<?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.intf.IPermissionsDao">

<resultMap id="PermissionsResultMap" type="com.lyms.platform.permission.model.Permissions">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="type" property="type" jdbcType="INTEGER"/>
<result column="module_name" property="moduleName" jdbcType="VARCHAR"/>
<result column="function_name" property="functionName" jdbcType="VARCHAR"/>
<result column="module_code" property="moduleCode" jdbcType="VARCHAR"/>
<result column="function_code" property="functionCode" jdbcType="VARCHAR"/>
<result column="permission_name" property="permissionName" jdbcType="VARCHAR"/>
<result column="action" property="action" jdbcType="VARCHAR"/>
<result column="ext" property="ext" jdbcType="VARCHAR"/>
<result column="url" property="url" jdbcType="VARCHAR"/>
<result column="publish_id" property="publishId" jdbcType="VARCHAR"/>
<result column="publish_name" property="publishName" jdbcType="VARCHAR"/>
<result column="yn" property="yn" jdbcType="INTEGER"/>
<result column="modified" property="modified" jdbcType="TIMESTAMP"/>
<result column="created" property="created" jdbcType="TIMESTAMP"/>
</resultMap>


<insert id="addPermissions" parameterType="com.lyms.platform.permission.model.Permissions">
insert into permissions (type,module_name,function_name,module_code,function_code,permission_name,action,ext,url,publish_id,publish_name,yn,modified,created) values (#{type},#{moduleName},#{functionName},#{moduleCode},#{functionCode},#{permissionName},#{action},#{ext},#{url},#{publishId},#{publishName},#{yn},#{modified},#{created})
</insert>


<update id="updatePermissions" parameterType="com.lyms.platform.permission.model.Permissions">
update permissions
<set>
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
<if test="moduleName != null and moduleName != ''">
module_name = #{moduleName,jdbcType=VARCHAR},
</if>
<if test="functionName != null and functionName != ''">
function_name = #{functionName,jdbcType=VARCHAR},
</if>
<if test="moduleCode != null and moduleCode != ''">
module_code = #{moduleCode,jdbcType=VARCHAR},
</if>
<if test="functionCode != null and functionCode != ''">
function_code = #{functionCode,jdbcType=VARCHAR},
</if>
<if test="permissionName != null and permissionName != ''">
permission_name = #{permissionName,jdbcType=VARCHAR},
</if>
<if test="action != null and action != ''">
action = #{action,jdbcType=VARCHAR},
</if>
<if test="ext != null and ext != ''">
ext = #{ext,jdbcType=VARCHAR},
</if>
<if test="url != null and url != ''">
url = #{url,jdbcType=VARCHAR},
</if>
<if test="publishId != null">
publish_id = #{publishId,jdbcType=INTEGER},
</if>
<if test="publishName != null and publishName != ''">
publish_name = #{publishName,jdbcType=VARCHAR},
</if>
<if test="yn != null">
yn = #{yn,jdbcType=INTEGER},
</if>
<if test="modified != null">
modified = #{modified,jdbcType=TIMESTAMP},
</if>
<if test="created != null">
created = #{created,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>


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


<select id="getPermissions" resultMap="PermissionsResultMap" parameterType="java.lang.String">
select id,type,module_name,function_name,module_code,function_code,permission_name,action,ext,url,publish_id,publish_name,yn,modified,created
from permissions 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="PermissionsCondition">
<where>
1 = 1
<if test="id != null">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="type != null">
and type = #{type,jdbcType=INTEGER}
</if>
<if test="moduleName != null and moduleName != ''">
and module_name = #{moduleName,jdbcType=VARCHAR}
</if>
<if test="functionName != null and functionName != ''">
and function_name = #{functionName,jdbcType=VARCHAR}
</if>
<if test="permissionName != null and permissionName != ''">
and permission_name = #{permissionName,jdbcType=VARCHAR}
</if>
<if test="action != null and action != ''">
and action = #{action,jdbcType=VARCHAR}
</if>
<if test="ext != null and ext != ''">
and ext = #{ext,jdbcType=VARCHAR}
</if>
<if test="url != null and url != ''">
and url = #{url,jdbcType=VARCHAR}
</if>
<if test="publishId != null">
and publish_id = #{publishId,jdbcType=INTEGER}
</if>
<if test="publishName != null and publishName != ''">
and publish_name = #{publishName,jdbcType=VARCHAR}
</if>
<if test="yn != null">
and yn = #{yn,jdbcType=INTEGER}
</if>
<if test="modified != null">
and modified = #{modified,jdbcType=TIMESTAMP}
</if>
<if test="created != null">
and created = #{created,jdbcType=TIMESTAMP}
</if>
</where>
</sql>


<select id="queryPermissions" resultMap="PermissionsResultMap"
parameterType="com.lyms.platform.permission.model.PermissionsQuery">
select
id,type,module_name,function_name,module_code,function_code,permission_name,action,ext,url,publish_id,publish_name,yn,modified,created
from permissions
<include refid="PermissionsCondition"/>
<include refid="orderAndLimit"/>
</select>


<select id="queryPermissionsCount" resultType="int"
parameterType="com.lyms.platform.permission.model.PermissionsQuery">
select count(1) from permissions
<include refid="PermissionsCondition"/>
</select>
</mapper>