数据权限分配问题BUG修复

jeecg_3.6.6
zhangdaihao 7 years ago
parent 0ee665e4ba
commit ce5df01692

@ -72,18 +72,17 @@ public class FunctionController extends BaseController {
public void setUserService(UserService userService) {
this.userService = userService;
}
/**
*
*
* @return
*/
@RequestMapping(params = "function")
public ModelAndView function(Integer type,ModelMap model) {
model.addAttribute("type", type);
public ModelAndView function(ModelMap model) {
return new ModelAndView("system/function/functionList");
}
/**
*
*
@ -91,7 +90,11 @@ public class FunctionController extends BaseController {
*/
@RequestMapping(params = "operation")
public ModelAndView operation(HttpServletRequest request, String functionId) {
// ----------------------------------------------------------------
// ----------------------------------------------------------------
request.setAttribute("functionId", functionId);
// ----------------------------------------------------------------
// ----------------------------------------------------------------
return new ModelAndView("system/operation/operationList");
}
@ -103,7 +106,11 @@ public class FunctionController extends BaseController {
@RequestMapping(params = "dataRule")
public ModelAndView operationData(HttpServletRequest request,
String functionId) {
// ----------------------------------------------------------------
// ----------------------------------------------------------------
request.setAttribute("functionId", functionId);
// ----------------------------------------------------------------
// ----------------------------------------------------------------
return new ModelAndView("system/dataRule/ruleDataList");
}
@ -135,10 +142,14 @@ public class FunctionController extends BaseController {
public void opdategrid(HttpServletRequest request,
HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(TSOperation.class, dataGrid);
// ----------------------------------------------------------------
// ----------------------------------------------------------------
String functionId = oConvertUtils.getString(request
.getParameter("functionId"));
cq.eq("TSFunction.id", functionId);
cq.add();
// ----------------------------------------------------------------
// ----------------------------------------------------------------
this.systemService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
@ -159,12 +170,14 @@ public class FunctionController extends BaseController {
systemService
.updateBySqlString("delete from t_s_role_function where functionid='"
+ function.getId() + "'");
//update-begin--Author:张忠亮 Date:20150605 for删除时提示先删除页面权限和数据规则
try{
systemService.delete(function);
}catch (Exception e){
e.printStackTrace();
message=MutiLangUtil.getMutiLangInstance().getLang("common.menu.del.fail");
}
//update-end--Author:张忠亮 Date:20150605 for删除时提示先删除页面权限和数据规则
systemService.addLog(message, Globals.Log_Type_DEL,
Globals.Log_Leavel_INFO);
@ -202,7 +215,7 @@ public class FunctionController extends BaseController {
operation.getId());
message = MutiLangUtil.paramDelSuccess("common.operation");
userService.delete(operation);
// ---author:jg_xugj----start-----date:20151211--------for#779 【菜单问题】当删了t_s_operation表中记录时 t_s_role_function 表中operation 字段应该同步更新。
String operationId = operation.getId();
String hql = "from TSRoleFunction rolefun where rolefun.operation like '%"+operationId+"%'";
List<TSRoleFunction> roleFunctions= userService.findByQueryString(hql);
@ -214,7 +227,7 @@ public class FunctionController extends BaseController {
roleFunction.setOperation(newOper);
userService.updateEntitie(roleFunction);
}
// ---author:jg_xugj----start-----date:20151211--------for#779 【菜单问题】当删了t_s_operation表中记录时 t_s_role_function 表中operation 字段应该同步更新。
systemService.addLog(message, Globals.Log_Type_DEL,
Globals.Log_Leavel_INFO);
@ -254,14 +267,12 @@ public class FunctionController extends BaseController {
public AjaxJson saveFunction(TSFunction function, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
// ----------------------------------------------------------------
function.setFunctionUrl(function.getFunctionUrl().trim());
String functionOrder = function.getFunctionOrder();
if (StringUtils.isEmpty(functionOrder)) {
function.setFunctionOrder("0");
}
if(function.getTSIcon() != null && oConvertUtils.isEmpty(function.getTSIcon().getId())){
function.setTSIcon(null);
}
if (function.getTSFunction().getId().equals("")) {
function.setTSFunction(null);
} else {
@ -273,11 +284,16 @@ public class FunctionController extends BaseController {
message = MutiLangUtil.paramUpdSuccess("common.menu");
userService.saveOrUpdate(function);
systemService.addLog(message, Globals.Log_Type_UPDATE,Globals.Log_Leavel_INFO);
// update-end--Author:anchao Date:20140914 forJeecg bug 20140914 菜单更新级别后显示混乱
List<TSFunction> subFunction = systemService.findByProperty(TSFunction.class, "TSFunction.id", function.getId());
updateSubFunction(subFunction,function);
// update-end--Author:anchao Date:20140914 forJeecg bug 20140914 菜单更新级别后显示混乱
// ----------------------------------------------------------------
systemService.flushRoleFunciton(function.getId(), function);
// ----------------------------------------------------------------
} else {
if (function.getFunctionLevel().equals(Globals.Function_Leave_ONE)) {
List<TSFunction> functionList = systemService.findByProperty(
@ -344,6 +360,7 @@ public class FunctionController extends BaseController {
String functionid = req.getParameter("id");
List<TSFunction> fuinctionlist = systemService.getList(TSFunction.class);
req.setAttribute("flist", fuinctionlist);
// update-begin--Author:zhangguoming Date:20140509 for添加云桌面图标管理
// List<TSIcon> iconlist = systemService.getList(TSIcon.class);
List<TSIcon> iconlist = systemService
.findByQueryString("from TSIcon where iconType != 3");
@ -351,6 +368,7 @@ public class FunctionController extends BaseController {
List<TSIcon> iconDeskList = systemService
.findByQueryString("from TSIcon where iconType = 3");
req.setAttribute("iconDeskList", iconDeskList);
// update-end--Author:zhangguoming Date:20140509 for添加云桌面图标管理
if (functionid != null) {
function = systemService.getEntity(TSFunction.class, functionid);
req.setAttribute("function", function);
@ -364,30 +382,6 @@ public class FunctionController extends BaseController {
}
return new ModelAndView("system/function/function");
}
/**
*
*
* @return
*/
@RequestMapping(params = "addorupdateDataFunction")
public ModelAndView addorupdateDataFunction(TSFunction function, HttpServletRequest req) {
String functionid = req.getParameter("id");
List<TSFunction> fuinctionlist = systemService.getList(TSFunction.class);
req.setAttribute("flist", fuinctionlist);
if (functionid != null) {
function = systemService.getEntity(TSFunction.class, functionid);
req.setAttribute("function", function);
}
if (function.getTSFunction() != null
&& function.getTSFunction().getId() != null) {
function.setFunctionLevel((short) 1);
function.setTSFunction((TSFunction) systemService.getEntity(
TSFunction.class, function.getTSFunction().getId()));
req.setAttribute("function", function);
}
return new ModelAndView("system/function/dataFunction");
}
/**
*
@ -433,14 +427,16 @@ public class FunctionController extends BaseController {
cq.addOrder("functionOrder", SortDirection.asc);
cq.add();
//update--begin------author:scott--------------date:20151208-----------for:手工加载数据权限条件--------
//获取装载数据权限的条件HQL
cq = HqlGenerateUtil.getDataAuthorConditionHql(cq, new TSFunction());
cq.add();
//update--end------author:scott--------------date:20151208-----------for:手工加载数据权限条件--------
List<TSFunction> functionList = systemService.getListByCriteriaQuery(cq, false);
// update-start-Author:zhangguoming Date:20140914 for菜单管理页面菜单排序
Collections.sort(functionList, new NumberComparator());
// update-end-Author:zhangguoming Date:20140914 for菜单管理页面菜单排序
List<TreeGrid> treeGrids = new ArrayList<TreeGrid>();
TreeGridModel treeGridModel = new TreeGridModel();
treeGridModel.setIcon("TSIcon_iconPath");
@ -452,7 +448,9 @@ public class FunctionController extends BaseController {
treeGridModel.setChildList("TSFunctions");
// 添加排序字段
treeGridModel.setOrder("functionOrder");
// update-begin--Author:chenj Date:20160722 for添加菜单图标样式
treeGridModel.setIconStyle("functionIconStyle");
// update-end--Author:chenj Date:20160722 for添加菜单图标样式
treeGridModel.setFunctionType("functionType");
@ -488,7 +486,7 @@ public class FunctionController extends BaseController {
*/
@RequestMapping(params = "setPFunction")
@ResponseBody
public List<ComboTree> setPFunction(Integer type,HttpServletRequest request,
public List<ComboTree> setPFunction(HttpServletRequest request,
ComboTree comboTree) {
CriteriaQuery cq = new CriteriaQuery(TSFunction.class);
if (null != request.getParameter("selfId")) {
@ -500,26 +498,16 @@ public class FunctionController extends BaseController {
if (comboTree.getId() == null) {
cq.isNull("TSFunction");
}
if(type != null){
cq.eq("functionType", type.shortValue());
}
cq.add();
List<TSFunction> functionList = systemService.getListByCriteriaQuery(
cq, false);
List<TSFunction> functionList = systemService.getListByCriteriaQuery(cq, false);
List<ComboTree> comboTrees = new ArrayList<ComboTree>();
ComboTreeModel comboTreeModel = new ComboTreeModel("id","functionName", "TSFunctions");
TSFunction defaultFunction = new TSFunction();
if(type != null && type.intValue() == 0){
defaultFunction.setFunctionName("请选择上级菜单管理");
}else if(type != null && type.intValue() == 1){
defaultFunction.setFunctionName("请选择上级数据权限");
}
functionList.add(0, defaultFunction);
comboTrees = systemService.ComboTree(functionList, comboTreeModel,
null, false);
comboTrees = systemService.ComboTree(functionList, comboTreeModel,null, false);
MutiLangUtil.setMutiTree(comboTrees);
return comboTrees;
}
// update-end--Author:gaofeng Date:20140619 for修改云桌面的搜索功能中的系统中应用内搜索
/**
*
*
@ -583,10 +571,13 @@ public class FunctionController extends BaseController {
menuListMap = menuListMap + "很遗憾,在系统中没有检索到与“" + name + "”相关的信息!";
}
// menuListMap = menuListMap + "</div>";
//System.out.println("-------------------------------" + menuListMap);
req.setAttribute("menuListMap", menuListMap);
return new ModelAndView("system/function/menuAppList");
}
// update-end--Author:gaofeng Date:20140619 for修改云桌面的搜索功能中的系统中应用内搜索
/**
*
* addorupdaterule

@ -9,8 +9,7 @@
$(function() {
$('#cc').combotree({
url : 'functionController.do?setPFunction&type=0&selfId=${function.id}',
url : 'functionController.do?setPFunction&selfId=${function.id}',
panelHeight: 200,
width: 157,
onClick: function(node){
@ -44,10 +43,8 @@
$('#pfun').hide();
}
});
});
function viewStyle(param) {
var url = "<%=basePath%>/functionIconStyle.jsp?style = "+ param;
//add("图标样式预览",url,'functionIconStyle',700,450);
@ -58,14 +55,13 @@
<body style="overflow-y: hidden" scroll="no">
<t:formvalid formid="formobj" layout="div" dialog="true" refresh="true" action="functionController.do?saveFunction">
<input name="id" type="hidden" value="${function.id}">
<input name="functionType" id="functionType" type="hidden" value="0">
<fieldset class="step">
<div class="form">
<label class="Validform_label"> <t:mutiLang langKey="menu.name"/>: </label>
<input name="functionName" class="inputxt" value="${function.functionName}" datatype="*2-50">
<span class="Validform_checktip"> <t:mutiLang langKey="menuname.rang2to15"/> </span>
</div>
<!-- <div class="form">
<div class="form">
<label class="Validform_label"> <t:mutiLang langKey="funcType"/>: </label>
<select name="functionType" id="functionType" datatype="*">
<option value="0" <c:if test="${function.functionType eq 0}">selected="selected"</c:if>>
@ -76,7 +72,7 @@
</option>
</select>
<span class="Validform_checktip"></span>
</div> -->
</div>
<div class="form">
<label class="Validform_label"> <t:mutiLang langKey="menu.level"/>: </label>
<select name="functionLevel" id="functionLevel" datatype="*">
@ -111,6 +107,7 @@
</c:forEach>
</select>
</div>
<%--update-begin--Author:zhangguoming Date:20140509 for云桌面图标管理--%>
<div class="form" id="desktopIcon">
<label class="Validform_label"> <t:mutiLang langKey="desktop.icon"/>: </label>
<select name="TSIconDesk.id">
@ -121,15 +118,20 @@
</c:forEach>
</select>
</div>
<%--update-end--Author:zhangguoming Date:20140509 for云桌面图标管理--%>
<div class="form" id="funorder"><label class="Validform_label"> <t:mutiLang langKey="menu.order"/>: </label> <input name="functionOrder" class="inputxt" value="${function.functionOrder}" datatype="n1-3"></div>
<%-- update-begin--Author:chenj Date:20160722 for添加菜单图标样式 --%>
<div class="form" id="funiconstyle">
<label class="Validform_label">
<t:mutiLang langKey="menu.funiconstyle"/>:
</label>
<input name="functionIconStyle" class="inputxt" value="${function.functionIconStyle}" />
<%-- update-start--Author:chenj Date:20160729 for增加图标样式预览页面 --%>
<a href="<%=basePath%>/webpage/common/functionIconStyleList.jsp?style=ace" target="_blank">[ace图标样式]</a>
<a href="<%=basePath%>/webpage/common//functionIconStyleList.jsp?style=hplus" target="_blank">[hplus图标样式]</a>
<%-- update-end--Author:chenj Date:20160729 for增加图标样式预览页面 --%>
</div>
<%-- update-end--Author:chenj Date:20160722 for添加菜单图标样式 --%>
</fieldset>
</t:formvalid>
</body>

@ -1,41 +1,27 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<%-- update-start--Author:duanql Date:20130619 for操作按钮窗口显示控制--%>
<div id="system_function_functionList" class="easyui-layout" fit="true"><%-- update-end--Author:duanql Date:20130619 for操作按钮窗口显示控制--%>
<div region="center" style="padding:0px;border:0px">
<c:if test="${type == 0}">
<t:datagrid name="functionList" title="menu.manage"
actionUrl="functionController.do?functionGrid&type=${type }" idField="id" treegrid="true" pagination="false">
<t:dgCol title="common.id" field="id" treefield="id" hidden="true"></t:dgCol>
<t:dgCol title="menu.name" field="functionName" treefield="text"></t:dgCol>
<t:dgCol title="common.icon" field="TSIcon_iconPath" treefield="code" image="true"></t:dgCol>
<t:dgCol title="funcType" field="functionType" hidden="true" treefield="functionType" replace="funcType.page_0,funcType.from_1"></t:dgCol>
<t:dgCol title="menu.url" field="functionUrl" treefield="src"></t:dgCol>
<t:dgCol title="menu.order" field="functionOrder" treefield="order"></t:dgCol>
<t:dgCol title="menu.funiconstyle" field="functionIconStyle" treefield="iconStyle"></t:dgCol>
<t:dgCol title="common.operation" field="opt" width="100"></t:dgCol>
<t:dgDelOpt url="functionController.do?del&id={id}" title="common.delete" urlclass="ace_button" urlfont="fa-trash-o"></t:dgDelOpt>
<t:dgFunOpt funname="operationDetail(id)" title="button.setting" urlclass="ace_button" urlfont="fa-cog"></t:dgFunOpt>
<t:dgFunOpt funname="operationData(id)" title="数据规则" urlclass="ace_button" urlfont="fa-database"></t:dgFunOpt>
<t:dgToolBar title="common.add.param" langArg="common.menu" icon="icon-add" url="functionController.do?addorupdate" height="400" funname="addFun"></t:dgToolBar>
<t:dgToolBar title="common.edit.param" langArg="common.menu" icon="icon-edit" url="functionController.do?addorupdate" height="490" funname="update"></t:dgToolBar>
</t:datagrid>
</c:if>
<c:if test="${type == 1}">
<t:datagrid name="functionList" title="数据权限列表"
actionUrl="functionController.do?functionGrid&type=${type}" idField="id" treegrid="true" pagination="false">
<t:dgCol title="common.id" field="id" treefield="id" hidden="true"></t:dgCol>
<t:dgCol title="数据权限名称" field="functionName" treefield="text"></t:dgCol>
<t:dgCol title="数据权限URL" field="functionUrl" treefield="src"></t:dgCol>
<t:dgCol title="数据权限顺序" field="functionOrder" treefield="order"></t:dgCol>
<t:dgCol title="common.operation" field="opt" width="100"></t:dgCol>
<t:dgDelOpt url="functionController.do?del&id={id}" title="common.delete" urlclass="ace_button" urlfont="fa-trash-o"></t:dgDelOpt>
<t:dgToolBar title="添加数据权限" icon="icon-add" url="functionController.do?addorupdateDataFunction" height="400" funname="addFun"></t:dgToolBar>
<t:dgToolBar title="编辑数据权限" langArg="common.menu" icon="icon-edit" url="functionController.do?addorupdateDataFunction" height="400" funname="update"></t:dgToolBar>
</t:datagrid>
</c:if>
<t:datagrid name="functionList" title="menu.manage" actionUrl="functionController.do?functionGrid" idField="id" treegrid="true" pagination="false">
<t:dgCol title="common.id" field="id" treefield="id" hidden="true"></t:dgCol>
<t:dgCol title="menu.name" field="functionName" treefield="text"></t:dgCol>
<t:dgCol title="common.icon" field="TSIcon_iconPath" treefield="code" image="true"></t:dgCol>
<t:dgCol title="funcType" field="functionType" treefield="functionType" replace="funcType.page_0,funcType.from_1"></t:dgCol>
<t:dgCol title="menu.url" field="functionUrl" treefield="src"></t:dgCol>
<t:dgCol title="menu.order" field="functionOrder" treefield="order"></t:dgCol>
<t:dgCol title="menu.funiconstyle" field="functionIconStyle" treefield="iconStyle"></t:dgCol>
<t:dgCol title="common.operation" field="opt" width="100"></t:dgCol>
<t:dgDelOpt url="functionController.do?del&id={id}" title="common.delete" urlclass="ace_button" urlfont="fa-trash-o"></t:dgDelOpt>
<t:dgFunOpt funname="operationDetail(id)" title="button.setting" urlclass="ace_button" urlfont="fa-cog"></t:dgFunOpt>
<t:dgFunOpt funname="operationData(id)" title="数据规则" urlclass="ace_button" urlfont="fa-database"></t:dgFunOpt>
<t:dgToolBar title="common.add.param" langArg="common.menu" icon="icon-add" url="functionController.do?addorupdate" height="400" funname="addFun"></t:dgToolBar>
<t:dgToolBar title="common.edit.param" langArg="common.menu" icon="icon-edit" url="functionController.do?addorupdate" height="490" funname="update"></t:dgToolBar>
</t:datagrid>
</div>
</div>
<%-- update-start--Author:duanql Date:20130619 for操作按钮窗口显示控制--%>
<div data-options="region:'east',
title:'<t:mutiLang langKey="operate.button.list"/>',
collapsed:true,
@ -53,6 +39,7 @@
</div>
<script type="text/javascript">
<%-- update-start--Author:anchao Date:20130415 for按钮权限控制--%>
$(function() {
var li_east = 0;
});
@ -70,6 +57,8 @@ function operationDetail(functionId)
}
$('#operationDetailpanel').panel("refresh", "functionController.do?operation&functionId=" +functionId);
}
<%-- update-end--Author:anchao Date:20130415 for按钮权限控制--%>
<%-- update-start--Author:jueyue Date:20130622 for菜单录入代入父菜单--%>
function addFun(title,url, id) {
var rowData = $('#'+id).datagrid('getSelected');
if (rowData) {
@ -77,5 +66,6 @@ function addFun(title,url, id) {
}
add(title,url,'functionList',700,480);
}
<%-- update-end--Author:jueyue Date:20130622 for菜单录入代入父菜单--%>
</script>

Loading…
Cancel
Save