新增本部门数据权限

master
RuoYi 5 years ago committed by Limy
parent 94e25752cd
commit 07f24b5ee1

@ -685,6 +685,20 @@ label {
float: none; float: none;
} }
.select-list .select-selectpicker li {
float: none;
}
.select-list .dropdown-menu>li>a {
line-height: inherit;
}
.select-list .dropdown-menu li>a:hover,.dropdown-menu li>a:focus,.dropdown-submenu:hover>a {
color: #fff;
text-decoration: none;
background-color: #12889a
}
.select-list .select-time input { .select-list .select-time input {
width: 93px; width: 93px;
} }

@ -26,11 +26,12 @@
<select id="dataScope" name="dataScope" class="form-control m-b"> <select id="dataScope" name="dataScope" class="form-control m-b">
<option value="1" th:field="*{dataScope}">全部数据权限</option> <option value="1" th:field="*{dataScope}">全部数据权限</option>
<option value="2" th:field="*{dataScope}">自定数据权限</option> <option value="2" th:field="*{dataScope}">自定数据权限</option>
<option value="3" th:field="*{dataScope}">本部门数据权限</option>
</select> </select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 特殊情况下,设置为“自定数据权限”</span> <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 特殊情况下,设置为“自定数据权限”</span>
</div> </div>
</div> </div>
<div class="form-group" id="authDataScope" th:style="'display:' + @{(*{dataScope=='1'} ? 'none' : 'block')} + ''"> <div class="form-group" id="authDataScope" th:style="'display:' + @{(*{dataScope=='2'} ? 'block' : 'none')} + ''">
<label class="col-sm-3 control-label">数据权限</label> <label class="col-sm-3 control-label">数据权限</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div id="deptTrees" class="ztree"></div> <div id="deptTrees" class="ztree"></div>

@ -34,6 +34,11 @@ public class DataScopeAspect
*/ */
public static final String DATA_SCOPE_CUSTOM = "2"; public static final String DATA_SCOPE_CUSTOM = "2";
/**
*
*/
public static final String DATA_SCOPE_DEPT = "3";
/** /**
* *
*/ */
@ -73,6 +78,7 @@ public class DataScopeAspect
/** /**
* *
*
* @param joinPoint * @param joinPoint
* @param user * @param user
* @param alias * @param alias
@ -95,6 +101,10 @@ public class DataScopeAspect
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", alias, " OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", alias,
role.getRoleId())); role.getRoleId()));
} }
else if (DATA_SCOPE_DEPT.equals(dataScope))
{
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", alias, user.getDeptId()));
}
} }
if (StringUtils.isNotBlank(sqlString.toString())) if (StringUtils.isNotBlank(sqlString.toString()))

@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessType != null"> <if test="businessType != null">
AND business_type = #{businessType} AND business_type = #{businessType}
</if> </if>
<if test="businessTypes != null and businessTypes != ''"> <if test="businessTypes != null and businessTypes.length > 0">
AND business_type in AND business_type in
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")"> <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
#{businessType} #{businessType}

Loading…
Cancel
Save