角色权限唯一校验

This commit is contained in:
RuoYi
2018-08-01 13:17:11 +08:00
parent 982ce06cde
commit 336faf6feb
8 changed files with 97 additions and 2 deletions

View File

@ -64,6 +64,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where role_name=#{roleName}
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="RoleResult">
<include refid="selectRoleVo"/>
where role_key=#{roleKey}
</select>
<delete id="deleteRoleById" parameterType="Long">
delete from sys_role where role_id = #{roleId}
</delete>

View File

@ -98,6 +98,20 @@
},
roleKey:{
required:true,
remote: {
url: ctx + "system/role/checkRoleKeyUnique",
type: "post",
dataType: "json",
data: {
"roleName" : function() {
return $.trim($("#roleName").val());
}
},
dataFilter: function(data, type) {
if (data == "0") return true;
else return false;
}
}
},
roleSort:{
required:true,
@ -106,7 +120,10 @@
},
messages: {
"roleName": {
remote: "角色已经存在"
remote: "角色名称已经存在"
},
"roleKey": {
remote: "角色权限已经存在"
}
},
submitHandler:function(form){

View File

@ -102,6 +102,23 @@
},
roleKey:{
required:true,
remote: {
url: ctx + "system/role/checkRoleKeyUnique",
type: "post",
dataType: "json",
data: {
"roleId": function() {
return $("input[name='roleId']").val();
},
"roleKey": function() {
return $("input[name='roleKey']").val();
}
},
dataFilter: function(data, type) {
if (data == "0") return true;
else return false;
}
}
},
roleSort:{
required:true,
@ -110,7 +127,10 @@
},
messages: {
"roleName": {
remote: "角色已经存在"
remote: "角色名称已经存在"
},
"roleKey": {
remote: "角色权限已经存在"
}
},
submitHandler:function(form){