提交 36a6e373 编写于 作者: 偏锋书生's avatar 偏锋书生

支持同步资源

上级 e14b4485
......@@ -62,6 +62,11 @@ public class SysResource {
* @mbg.generated
*/
private String remark;
/**
* Database Column Remarks: 是否由程序同否 This field was generated by MyBatis Generator. This field corresponds to the database column sys_resource.is_sync
* @mbg.generated
*/
private String isSync;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column sys_resource.bound1
* @mbg.generated
......@@ -113,8 +118,9 @@ public class SysResource {
* @mbg.generated
*/
public SysResource(Long id, String resCode, String resName, String resValue, String resType, String icon,
Integer resLevel, String isEdit, Long parentId, Long showOrder, String remark, String bound1, String bound2,
String bound3, String bound4, String bound5, String bound6, String bound7, String bound8, String bound9) {
Integer resLevel, String isEdit, Long parentId, Long showOrder, String remark, String isSync, String bound1,
String bound2, String bound3, String bound4, String bound5, String bound6, String bound7, String bound8,
String bound9) {
this.id = id;
this.resCode = resCode;
this.resName = resName;
......@@ -126,6 +132,7 @@ public class SysResource {
this.parentId = parentId;
this.showOrder = showOrder;
this.remark = remark;
this.isSync = isSync;
this.bound1 = bound1;
this.bound2 = bound2;
this.bound3 = bound3;
......@@ -343,6 +350,24 @@ public class SysResource {
this.remark = remark;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column sys_resource.is_sync
* @return the value of sys_resource.is_sync
* @mbg.generated
*/
public String getIsSync() {
return isSync;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column sys_resource.is_sync
* @param isSync the value for sys_resource.is_sync
* @mbg.generated
*/
public void setIsSync(String isSync) {
this.isSync = isSync;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column sys_resource.bound1
* @return the value of sys_resource.bound1
......
......@@ -892,6 +892,76 @@ public class SysResourceExample {
return (Criteria) this;
}
public Criteria andIsSyncIsNull() {
addCriterion("is_sync is null");
return (Criteria) this;
}
public Criteria andIsSyncIsNotNull() {
addCriterion("is_sync is not null");
return (Criteria) this;
}
public Criteria andIsSyncEqualTo(String value) {
addCriterion("is_sync =", value, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncNotEqualTo(String value) {
addCriterion("is_sync <>", value, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncGreaterThan(String value) {
addCriterion("is_sync >", value, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncGreaterThanOrEqualTo(String value) {
addCriterion("is_sync >=", value, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncLessThan(String value) {
addCriterion("is_sync <", value, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncLessThanOrEqualTo(String value) {
addCriterion("is_sync <=", value, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncLike(String value) {
addCriterion("is_sync like", value, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncNotLike(String value) {
addCriterion("is_sync not like", value, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncIn(List<String> values) {
addCriterion("is_sync in", values, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncNotIn(List<String> values) {
addCriterion("is_sync not in", values, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncBetween(String value1, String value2) {
addCriterion("is_sync between", value1, value2, "isSync");
return (Criteria) this;
}
public Criteria andIsSyncNotBetween(String value1, String value2) {
addCriterion("is_sync not between", value1, value2, "isSync");
return (Criteria) this;
}
public Criteria andBound1IsNull() {
addCriterion("bound1 is null");
return (Criteria) this;
......
......@@ -40,16 +40,17 @@ public interface SysResourceMapper extends BaseMapper<SysResource>{
* @mbg.generated
*/
@Insert({ "insert into sys_resource (id, res_code, ", "res_name, res_value, ", "res_type, icon, res_level, ",
"is_edit, parent_id, ", "show_order, remark, ", "bound1, bound2, ", "bound3, bound4, ", "bound5, bound6, ",
"bound7, bound8, ", "bound9)", "values (#{id,jdbcType=BIGINT}, #{resCode,jdbcType=VARCHAR}, ",
"is_edit, parent_id, ", "show_order, remark, ", "is_sync, bound1, ", "bound2, bound3, ", "bound4, bound5, ",
"bound6, bound7, ", "bound8, bound9)", "values (#{id,jdbcType=BIGINT}, #{resCode,jdbcType=VARCHAR}, ",
"#{resName,jdbcType=VARCHAR}, #{resValue,jdbcType=VARCHAR}, ",
"#{resType,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{resLevel,jdbcType=INTEGER}, ",
"#{isEdit,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT}, ",
"#{showOrder,jdbcType=BIGINT}, #{remark,jdbcType=VARCHAR}, ",
"#{bound1,jdbcType=VARCHAR}, #{bound2,jdbcType=VARCHAR}, ",
"#{bound3,jdbcType=VARCHAR}, #{bound4,jdbcType=VARCHAR}, ",
"#{bound5,jdbcType=VARCHAR}, #{bound6,jdbcType=VARCHAR}, ",
"#{bound7,jdbcType=VARCHAR}, #{bound8,jdbcType=VARCHAR}, ", "#{bound9,jdbcType=VARCHAR})" })
"#{isSync,jdbcType=VARCHAR}, #{bound1,jdbcType=VARCHAR}, ",
"#{bound2,jdbcType=VARCHAR}, #{bound3,jdbcType=VARCHAR}, ",
"#{bound4,jdbcType=VARCHAR}, #{bound5,jdbcType=VARCHAR}, ",
"#{bound6,jdbcType=VARCHAR}, #{bound7,jdbcType=VARCHAR}, ",
"#{bound8,jdbcType=VARCHAR}, #{bound9,jdbcType=VARCHAR})" })
int insert(SysResource record);
/**
......@@ -69,7 +70,7 @@ public interface SysResourceMapper extends BaseMapper<SysResource>{
* @mbg.generated
*/
@Select({ "select", "id, res_code, res_name, res_value, res_type, icon, res_level, is_edit, parent_id, ",
"show_order, remark, bound1, bound2, bound3, bound4, bound5, bound6, bound7, ", "bound8, bound9",
"show_order, remark, is_sync, bound1, bound2, bound3, bound4, bound5, bound6, ", "bound7, bound8, bound9",
"from sys_resource", "where id = #{id,jdbcType=BIGINT}" })
@ResultMap("net.wicp.tams.app.duckula.controller.dao.SysResourceMapper.BaseResultMap")
SysResource selectByPrimaryKey(Long id);
......@@ -101,11 +102,11 @@ public interface SysResourceMapper extends BaseMapper<SysResource>{
"res_type = #{resType,jdbcType=VARCHAR},", "icon = #{icon,jdbcType=VARCHAR},",
"res_level = #{resLevel,jdbcType=INTEGER},", "is_edit = #{isEdit,jdbcType=VARCHAR},",
"parent_id = #{parentId,jdbcType=BIGINT},", "show_order = #{showOrder,jdbcType=BIGINT},",
"remark = #{remark,jdbcType=VARCHAR},", "bound1 = #{bound1,jdbcType=VARCHAR},",
"bound2 = #{bound2,jdbcType=VARCHAR},", "bound3 = #{bound3,jdbcType=VARCHAR},",
"bound4 = #{bound4,jdbcType=VARCHAR},", "bound5 = #{bound5,jdbcType=VARCHAR},",
"bound6 = #{bound6,jdbcType=VARCHAR},", "bound7 = #{bound7,jdbcType=VARCHAR},",
"bound8 = #{bound8,jdbcType=VARCHAR},", "bound9 = #{bound9,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}" })
"remark = #{remark,jdbcType=VARCHAR},", "is_sync = #{isSync,jdbcType=VARCHAR},",
"bound1 = #{bound1,jdbcType=VARCHAR},", "bound2 = #{bound2,jdbcType=VARCHAR},",
"bound3 = #{bound3,jdbcType=VARCHAR},", "bound4 = #{bound4,jdbcType=VARCHAR},",
"bound5 = #{bound5,jdbcType=VARCHAR},", "bound6 = #{bound6,jdbcType=VARCHAR},",
"bound7 = #{bound7,jdbcType=VARCHAR},", "bound8 = #{bound8,jdbcType=VARCHAR},",
"bound9 = #{bound9,jdbcType=VARCHAR}", "where id = #{id,jdbcType=BIGINT}" })
int updateByPrimaryKey(SysResource record);
}
\ No newline at end of file
......@@ -84,7 +84,8 @@ public class MenuService implements IMenuService {
// conf.setTextConvert(i18NConvert);
conf.setIconClsCol("icon");
conf.setAttrCols("isEdit","resType", "resLevel", "resCode", "resName", "resValue", "remark", "bound1", "bound2");
conf.setAttrCols("isEdit", "resType", "resLevel", "resCode", "resName", "resValue", "remark", "bound1",
"bound2");
conf.setIsRoot(new Predicate() {
@Override
......@@ -126,8 +127,7 @@ public class MenuService implements IMenuService {
@Override
public List<SysResource> findSyncRes() {
QueryWrapper<SysResource> queryWrapper = new QueryWrapper<SysResource>();
queryWrapper.gt("res_level", 1);
queryWrapper.eq("res_type", 3);
queryWrapper.eq("is_sync", "yes");
return sysResourceMapper.selectList(queryWrapper);
}
......
......@@ -188,11 +188,13 @@ public class ResManager extends ParentPageBean<SysResource> {
hasResList.add(res);
}
final List<SysResource> dbResList = menuService.findSyncRes();// 查找数据库已有的菜单
Set<Object> synValueList = CollectionUtil.getColSetFromObj(hasResList, "resValue");
// 数据库中有的,但已不存在此页面的,需要删除
List<SysResource> deleteList = (List<SysResource>) CollectionUtils.select(dbResList, new Predicate() {
@Override
public boolean evaluate(Object object) {
return !hasResList.contains(object);
SysResource temp = (SysResource) object;
return !synValueList.contains(temp.getResValue());
}
});
......@@ -205,26 +207,23 @@ public class ResManager extends ParentPageBean<SysResource> {
@Override
public boolean evaluate(Object object) {
SysResource tempobj = (SysResource) object;
return hasResList.contains(object);
// && "yes".equals(tempobj.getisEdit());
return synValueList.contains(tempobj.getResValue()) && "yes".equals(tempobj.getIsEdit());
}
});
for (SysResource ca_Resource : updateList) {
SysResource updateObj = hasResList.get(hasResList.indexOf(ca_Resource));
ca_Resource.setResCode(updateObj.getResCode());
ca_Resource.setResName(updateObj.getResName());
ca_Resource.setResValue(updateObj.getResValue());
ca_Resource.setRemark("程序自动更新");
ca_Resource.setIsEdit(YesOrNo.yes.name());
ca_Resource.setRemark("系统自动同步");
ca_Resource.setIsSync(YesOrNo.yes.name());
ca_Resource.setBound2(YesOrNo.yes.name());
sysResourceMapper.updateByPrimaryKeySelective(ca_Resource);
}
for (SysResource caResource : updateList) {
sysResourceMapper.updateByPrimaryKey(caResource);
}
Set<Object> dbValueList = CollectionUtil.getColSetFromObj(dbResList, "resValue");
// 数据库没有的,但已存在的、需添加
List<SysResource> addList = (List<SysResource>) CollectionUtils.select(hasResList, new Predicate() {
@Override
public boolean evaluate(Object object) {
return !dbResList.contains(object);
SysResource tempobj = (SysResource) object;
return !dbValueList.contains(tempobj.getResValue());
}
});
......@@ -234,9 +233,10 @@ public class ResManager extends ParentPageBean<SysResource> {
caResource.setIcon("icon-user");
caResource.setIsEdit(YesOrNo.yes.name());
caResource.setRemark("系统自动同步");
// caResource.setCaResource(defaulModel);
caResource.setIsSync(YesOrNo.yes.name());
caResource.setResLevel(2);
sysResourceMapper.updateByPrimaryKeySelective(caResource);
caResource.setBound2(YesOrNo.yes.name());
sysResourceMapper.insert(caResource);
}
} catch (Exception e) {
ret.setMessage(LK("tip.sys.error.sync") + e.getMessage());
......
......@@ -18,6 +18,7 @@
<arg column="parent_id" javaType="java.lang.Long" jdbcType="BIGINT" />
<arg column="show_order" javaType="java.lang.Long" jdbcType="BIGINT" />
<arg column="remark" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="is_sync" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="bound1" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="bound2" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="bound3" javaType="java.lang.String" jdbcType="VARCHAR" />
......@@ -101,8 +102,8 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, res_code, res_name, res_value, res_type, icon, res_level, is_edit, parent_id,
show_order, remark, bound1, bound2, bound3, bound4, bound5, bound6, bound7, bound8,
bound9
show_order, remark, is_sync, bound1, bound2, bound3, bound4, bound5, bound6, bound7,
bound8, bound9
</sql>
<select id="selectByExample" parameterType="net.wicp.tams.app.duckula.controller.bean.models.SysResourceExample" resultMap="BaseResultMap">
<!--
......@@ -172,6 +173,9 @@
<if test="remark != null">
remark,
</if>
<if test="isSync != null">
is_sync,
</if>
<if test="bound1 != null">
bound1,
</if>
......@@ -234,6 +238,9 @@
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="isSync != null">
#{isSync,jdbcType=VARCHAR},
</if>
<if test="bound1 != null">
#{bound1,jdbcType=VARCHAR},
</if>
......@@ -313,6 +320,9 @@
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.isSync != null">
is_sync = #{record.isSync,jdbcType=VARCHAR},
</if>
<if test="record.bound1 != null">
bound1 = #{record.bound1,jdbcType=VARCHAR},
</if>
......@@ -362,6 +372,7 @@
parent_id = #{record.parentId,jdbcType=BIGINT},
show_order = #{record.showOrder,jdbcType=BIGINT},
remark = #{record.remark,jdbcType=VARCHAR},
is_sync = #{record.isSync,jdbcType=VARCHAR},
bound1 = #{record.bound1,jdbcType=VARCHAR},
bound2 = #{record.bound2,jdbcType=VARCHAR},
bound3 = #{record.bound3,jdbcType=VARCHAR},
......@@ -412,6 +423,9 @@
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="isSync != null">
is_sync = #{isSync,jdbcType=VARCHAR},
</if>
<if test="bound1 != null">
bound1 = #{bound1,jdbcType=VARCHAR},
</if>
......
......@@ -4,7 +4,7 @@
xmlns:p="tapestry:parameter"
xmlns:c="tapestry-library:cas">
<head>
<title isMenu="true" module="3">${message:title.sys.groupmanager}</title>
<title isMenu="false" module="2">群组管理</title>
</head>
<body>
<r:query id="main" qBlock="aa" queryUrl="/cas/groupmanager:query"
......
......@@ -4,7 +4,7 @@
xmlns:p="tapestry:parameter"
xmlns:c="tapestry-library:cas">
<head>
<title isMenu="true" module="3">组织管理</title>
<title isMenu="true" module="2">组织管理</title>
</head>
<body class="easyui-layout">
<r:dialog id="addDlg" width="400" height="150" title="message:common.button.save" toolbar="[{id:'saveBut',iconCls:'icon-save',text:'common.button.save'}]">
......
......@@ -4,7 +4,7 @@
xmlns:p="tapestry:parameter"
xmlns:c="tapestry-library:cas">
<head>
<title isMenu="true" module="3">职位管理</title>
<title isMenu="false" module="2">职位管理</title>
</head>
<body>
<r:query id="main" qBlock="aa" queryUrl="/cas/positionmanager:query"
......
......@@ -4,16 +4,15 @@
xmlns:p="tapestry:parameter"
xmlns:c="tapestry-library:cas">
<head>
<title isMenu="true" module="3">资源管理</title>
<title isMenu="true" module="2">资源管理</title>
</head>
<body class="easyui-layout">
<div data-options="region:'west'" style="width:400px">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',split:false" style="height:31px;">
<a id="collapseAllBtn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-collapse-all'">收缩</a>
<a id="expandAllBtn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-expand-all'">展开</a>
<!-- a id="synBtn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'">同步资源</a -->
<a id="expandAllBtn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-expand-all'">展开</a>
<a id="synBtn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'">同步资源</a>
</div>
<div data-options="region:'center'" style="height:100px;">
<r:tree id="menuTree" url="/cas/ResManager:queryMenu" lines="true" params="{onContextMenu:showContextMenu,onClick:selNode,onDblClick:editNode,onDragEnter:dragEnter,onBeforeDrag:beforeDrag,onBeforeDrop:beforeDrop,onStopDrag:stopDrag}"></r:tree>
......@@ -103,12 +102,15 @@
</div>
<script>
function init($){
$('#collapseAllBtn').unbind('click');
$('#collapseAllBtn').click(function(){
$('#menuTree').tree('collapseAll');
});
$('#expandAllBtn').unbind('click');
$('#expandAllBtn').click(function(){
$('#menuTree').tree('expandAll');
});
$('#synBtn').unbind('click');
$('#synBtn').click(function(){
$.post(contextpath+'/cas/ResManager:syncRes',{},function(data){
//刷新页面,reload不会去远程拿数据,loadData也是需要load全部数据。
......
......@@ -4,7 +4,7 @@
xmlns:p="tapestry:parameter"
xmlns:c="tapestry-library:cas">
<head>
<title isMenu="true" module="3">用户管理</title>
<title isMenu="true" module="2">用户管理</title>
</head>
<body>
<r:query id="q" qBlock="query" queryUrl="/cas/UserManager:query" uBlock="save" saveUrl="/cas/UserManager:save" deleteUrl="/cas/UserManager:del" opFormatter="showopt"
......
......@@ -3,7 +3,7 @@
xmlns:s="tapestry-library:tams"
xmlns:p="tapestry:parameter">
<head>
<title isMenu="true" module="3">检查点服务管理</title>
<title isMenu="true" module="3">全量服务管理</title>
</head>
<body>
<r:query id="q" qBlock="query" queryUrl="/runing/DumpManager:query" uBlock="save" saveUrl="/runing/DumpManager:save" deleteUrl="/runing/DumpManager:del" opFormatter="showopt"
......
......@@ -3,7 +3,7 @@
xmlns:s="tapestry-library:tams"
xmlns:p="tapestry:parameter">
<head>
<title isMenu="true" module="3">检查点服务管理</title>
<title isMenu="true" module="3">binlog监听任务管理</title>
</head>
<body>
<r:query id="q" qBlock="query" queryUrl="/runing/TaskManager:query" uBlock="save" saveUrl="/runing/TaskManager:save" deleteUrl="/runing/TaskManager:del" opFormatter="showopt"
......
......@@ -3,7 +3,7 @@
xmlns:s="tapestry-library:tams"
xmlns:p="tapestry:parameter">
<head>
<title isMenu="true" module="3">实例管理</title>
<title isMenu="true" module="3">中间件管理</title>
</head>
<body>
<r:query id="q" qBlock="query" queryUrl="/setting/MiddlewareManager:query" uBlock="save" saveUrl="/setting/MiddlewareManager:save" deleteUrl="/setting/MiddlewareManager:del" opFormatter="showopt"
......
......@@ -3,7 +3,7 @@
xmlns:s="tapestry-library:tams"
xmlns:p="tapestry:parameter">
<head>
<title isMenu="true" module="3">实例管理</title>
<title isMenu="true" module="3">duckula版本管理</title>
</head>
<body>
<r:query id="q" qBlock="query" queryUrl="/setting/VersionManager:query" uBlock="save" saveUrl="/setting/VersionManager:save" deleteUrl="/setting/VersionManager:del" opFormatter="showopt"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册