Commit dbde765f by liuyongshuai

修改批量授权的bug;完善角色子父级关系;

parent 8dbcf869
......@@ -96,21 +96,21 @@ public class SysUserController {
}
return code;
}
}
if (code.endsWith("0000000000")) {//省
code = code.substring(0, 2);
}else if (code.endsWith("00000000")) {//市
code = code.substring(0, 4);
}else if (code.endsWith("000000")) {//县
code = code.substring(0, 6);
}else if (code.endsWith("0000")) {//科所队
code = code.substring(0, 8);
}else if (code.endsWith("00")) {//科所中队
code = code.substring(0, 10);
} else {
code = code;
}
code = code.substring(0, 2);
}else if (code.endsWith("00000000")) {//市
code = code.substring(0, 4);
}else if (code.endsWith("000000")) {//县
code = code.substring(0, 6);
}else if (code.endsWith("0000")) {//科所队
code = code.substring(0, 8);
}else if (code.endsWith("00")) {//科所中队
code = code.substring(0, 10);
} else {
code = code;
}
return code;
}
......@@ -126,9 +126,6 @@ public class SysUserController {
//添加限制条件根据用户权限筛选用户能够看到的列表
//grade:X=县级,D=地市级,S=省级,T=特级
//1.举个栗子,陕西省渭南市用户只能看到渭南市以下的用户
System.out.println("usergrade===================="+usergrade);
if (usergrade!=null&&!"".equals(usergrade)){
dw = subUnitCode(usergrade, dlUser.getUnitcode(), dw);
}
......@@ -340,6 +337,8 @@ public class SysUserController {
String ids = user.getIds();
ids = ids.replace(" ","");
String[] idList = ids.split(",");
System.out.println(idList);
System.out.println(user.getRoleId());
for (int i = 0;i<idList.length;i++){
SysUser thisUser = new SysUser();
thisUser.setId(idList[i]);
......
......@@ -16,10 +16,11 @@
<result column="SFFB" property="sffb" jdbcType="VARCHAR" />
<result column="PID" property="pid" jdbcType="VARCHAR" />
<result column="TYPE" property="type" jdbcType="VARCHAR" />
<result column="ISPARENT" property="isParent" jdbcType="VARCHAR" />
<result column="rn" property="rn" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
ID, ROLENAME, DESCRIPTION, LRR, LRSJ, GXR, GXSJ, LRDWDM, LRDWMC, SCBZ, IP, SFFB , PID , TYPE
ID, ROLENAME, DESCRIPTION, LRR, LRSJ, GXR, GXSJ, LRDWDM, LRDWMC, SCBZ, IP, SFFB , PID , ISPARENT , TYPE
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
......@@ -107,6 +108,9 @@
<if test="pid != null" >
AND pid = #{pid,jdbcType=VARCHAR}
</if>
<if test="isParent != null" >
AND ISPARENT = #{isParent,jdbcType=VARCHAR}
</if>
<if test="type != null" >
AND type = #{type,jdbcType=VARCHAR}
</if>
......@@ -119,11 +123,11 @@
insert into SYS_ROLE (ID, ROLENAME, DESCRIPTION,
LRR, LRSJ, GXR, GXSJ,
LRDWDM, LRDWMC, SCBZ,
IP, SFFB, PID, TYPE)
IP, SFFB, PID, ISPARENT, TYPE)
values (#{id,jdbcType=VARCHAR}, #{rolename,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{lrr,jdbcType=VARCHAR}, #{lrsj,jdbcType=DATE}, #{gxr,jdbcType=VARCHAR}, #{gxsj,jdbcType=DATE},
#{lrdwdm,jdbcType=VARCHAR}, #{lrdwmc,jdbcType=VARCHAR}, #{scbz,jdbcType=DECIMAL},
#{ip,jdbcType=VARCHAR}, #{sffb,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR})
#{ip,jdbcType=VARCHAR}, #{sffb,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{isParent,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.xzxtshiro.pojo.SysRole" >
insert into SYS_ROLE
......@@ -208,6 +212,7 @@
update SYS_ROLE
set ROLENAME = #{rolename,jdbcType=VARCHAR},
TYPE = #{type,jdbcType=VARCHAR},
ISPARENT = #{isParent,jdbcType=VARCHAR},
PID = #{pid,jdbcType=VARCHAR},
DESCRIPTION = #{description,jdbcType=VARCHAR},
GXR = #{gxr,jdbcType=VARCHAR},
......
......@@ -35,5 +35,7 @@ public class SysRole extends BaseModel implements Serializable {
/**权限组的name合集*/
protected String permissionName;
protected String isParent;
}
\ No newline at end of file
......@@ -279,7 +279,11 @@ public class SysUserServiceImpl implements SysUserService {
sysUserRole.setScbz(0);
userRoles.add(sysUserRole);
}
int c = userDao.batchAddSysUserRole(userRoles);
System.out.println("角色信息");
System.out.println(userRoles);
if(userRoles.size()>0){
int c = userDao.batchAddSysUserRole(userRoles);
}
}
}
......
......@@ -64,8 +64,8 @@
<div class="layui-input-block">
<select id="isParent" name="isParent" lay-verify="required" lay-filter="isParent">
<option value="">请选择</option>
<option value="01">父级</option>
<option value="02">子级</option>
<option value="0">父级</option>
<option value="1">子级</option>
</select>
</div>
</div>
......@@ -141,6 +141,8 @@
$("#pidName").removeAttr('lay-verify');
//$("#hasPermission").hide();
$("#isParentRole").hide();
$("#pidName").val("");
$("#pid").val("");
}
if(data.value=="02"){
//如果是子级角色,权限选择为必填,父级角色为必填
......
......@@ -68,8 +68,8 @@
<div class="layui-input-block">
<select id="isParent" name="isParent" lay-verify="required" lay-filter="isParent">
<option value="">请选择</option>
<option value="01">父级</option>
<option value="02">子级</option>
<option value="0">父级</option>
<option value="1">子级</option>
</select>
</div>
</div>
......@@ -145,8 +145,6 @@
$("#pidName").removeAttr('lay-verify');
//$("#hasPermission").hide();
$("#isParentRole").hide();
$("#permissionName").val("");
$("#permissionId").val("");
$("#pidName").val("");
$("#pid").val("");
}
......@@ -171,10 +169,13 @@
if (msg.length != "") {
layer.msg(msg, {icon: 5});
}
//设置角色类型
//设置角色类型和层级
var type = "${oldRole.type}";
var isParent = "${oldRole.isParent}";
$("#isParent").val(isParent);
$("#type").val(type);
form.render('select');
//权限树
var data = ${permission};
var checkData = ${oldPermission};
......
......@@ -127,8 +127,8 @@
<div class="layui-form-item" style="display: inline-block;width:100%;text-align: center;">
<div class="layui-form-item demoTable">
<button class="layui-btn queryUserList" data-type="reload" style="margin-left: 20px;">查询</button>
<button class="layui-btn layui-btn-danger" style="margin-left: 20px;" onclick="reset();">清空</button>
<button class="layui-btn queryUserList layui-btn-normal" data-type="reload" style="margin-left: 20px;">查询</button>
<button class="layui-btn layui-btn-primary" style="margin-left: 20px;" onclick="reset();">清空</button>
</div>
</div>
......@@ -235,6 +235,7 @@
})
});
function removeUser(obj) {
console.log(obj);
var checkboxs, origin, target, num = 0;
if ($(obj).hasClass('right')) {
origin = $('.layui-table-main');
......@@ -255,7 +256,7 @@
idStr = $(this).find("div").text();
}
});
$("#selectUserTable td").each(function () {
target.each(function () {
if($(this).attr("data-field")=="id"){
if(idStr ==$(this).find("div").text()){
//如果已经有该用户,则不再允许移动
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment