Commit 0dc0c8af by fsn

整理

parent f38ee05b
#Guns #Guns
一款简洁并且通用的后台管理系统!整合了spring+mybatis-plus+beetl! 一款简洁通用的后台管理系统!整合了spring+mybatis-plus+beetl!
\ No newline at end of file \ No newline at end of file
...@@ -73,7 +73,7 @@ public class BaseController { ...@@ -73,7 +73,7 @@ public class BaseController {
/** /**
* 删除cookie * 删除cookie
*/ */
protected void deletePhoneCookie(String cookieName) { protected void deleteCookieByName(String cookieName) {
Cookie[] cookies = this.getHttpServletRequest().getCookies(); Cookie[] cookies = this.getHttpServletRequest().getCookies();
for (Cookie cookie : cookies) { for (Cookie cookie : cookies) {
if (cookie.getName().equals(cookieName)) { if (cookie.getName().equals(cookieName)) {
......
package com.stylefeng.guns.core.aop; package com.stylefeng.guns.core.aop;
import com.stylefeng.guns.core.log.ILog;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.shiro.ShiroUser;
import com.stylefeng.guns.core.support.StrKit;
import com.stylefeng.guns.core.util.DateUtil; import com.stylefeng.guns.core.util.DateUtil;
import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.core.util.ToolUtil;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
...@@ -8,53 +12,57 @@ import org.aspectj.lang.annotation.Around; ...@@ -8,53 +12,57 @@ import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.lang.reflect.Method; import java.lang.reflect.Method;
/** /**
* @Description 日志记录
* @author fengshuonan * @author fengshuonan
* @Description 日志记录
* @date 2016年12月6日 下午8:48:30 * @date 2016年12月6日 下午8:48:30
*/ */
@Aspect @Aspect
@Component @Component
public class LogAop { public class LogAop {
private Logger log = Logger.getLogger(this.getClass()); private Logger log = Logger.getLogger(this.getClass());
@Pointcut("execution(* com.stylefeng.guns.*..service.*.*(..))") @Autowired
public void cutService() { ILog factory;
}
@Pointcut("execution(* com.stylefeng.guns..service.*.*(..))")
@Around("cutService()") public void cutService() {
public Object recordSysLog(ProceedingJoinPoint point) throws Throwable { }
//获取拦截的方法名 @Around("cutService()")
MethodSignature ms = (MethodSignature) point.getSignature(); public Object recordSysLog(ProceedingJoinPoint point) throws Throwable {
Method method = ms.getMethod();
String methodName = method.getName(); //获取拦截的方法名
MethodSignature ms = (MethodSignature) point.getSignature();
//如果当前用户未登录,不做日志 Method method = ms.getMethod();
// ShiroUser user = ShiroKit.getUser(); String methodName = method.getName();
// if(null == user){
// return point.proceed(); //如果当前用户未登录,不做日志
// } ShiroUser user = ShiroKit.getUser();
if (null == user) {
//获取拦截方法的参数 return point.proceed();
String className = point.getTarget().getClass().getName(); }
Object[] params = point.getArgs();
//获取拦截方法的参数
StringBuilder sb = new StringBuilder(); String className = point.getTarget().getClass().getName();
for(Object param : params){ Object[] params = point.getArgs();
sb.append(param);
sb.append(" & "); StringBuilder sb = new StringBuilder();
} for (Object param : params) {
sb.append(param);
String msg = ToolUtil.format("[时间]:{} [类名]:{} [方法]:{} [参数]:{}", DateUtil.getTime(), className, methodName, sb.toString()); sb.append(" & ");
// LogFactory.me().doLog("例如:新增",msg,true); }
log.info(msg);
String msg = ToolUtil.format("[时间]:{} [类名]:{} [方法]:{} [参数]:{}", DateUtil.getTime(), className, methodName, sb.toString());
return point.proceed(); log.info(StrKit.removeSuffix(msg, "& "));
} factory.doLog(methodName, StrKit.removeSuffix(msg, "& "), true);
return point.proceed();
}
} }
\ No newline at end of file
package com.stylefeng.guns.core.beetl;
public class Feng {
public Integer parseInt(Double value){
if(value != null){
return value.intValue();
}else{
return 0;
}
}
}
...@@ -9,7 +9,8 @@ package com.stylefeng.guns.core.log; ...@@ -9,7 +9,8 @@ package com.stylefeng.guns.core.log;
public interface ILog { public interface ILog {
/** /**
* @Description 日志记录 * 日志记录
*
* @author fengshuonan * @author fengshuonan
*/ */
void doLog(String logName, String msg, boolean succeed); void doLog(String logName, String msg, boolean succeed);
......
package com.stylefeng.guns.core.log; package com.stylefeng.guns.core.log;
import org.springframework.context.annotation.DependsOn; import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.shiro.ShiroUser;
import com.stylefeng.guns.persistence.dao.OperationLogMapper;
import com.stylefeng.guns.persistence.model.OperationLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.stylefeng.guns.core.util.SpringContextHolder; import java.util.Date;
/** /**
* 日志记录工厂 * 日志记录工厂
...@@ -12,34 +16,20 @@ import com.stylefeng.guns.core.util.SpringContextHolder; ...@@ -12,34 +16,20 @@ import com.stylefeng.guns.core.util.SpringContextHolder;
* @date 2016年12月6日 下午9:18:27 * @date 2016年12月6日 下午9:18:27
*/ */
@Component @Component
@DependsOn("springContextHolder")
public class LogFactory implements ILog { public class LogFactory implements ILog {
private LogFactory() { @Autowired
} OperationLogMapper operationLogMapper;
public static ILog me() {
return SpringContextHolder.getBean(ILog.class);
}
@Override @Override
public void doLog(String logName, String msg, boolean succeed) { public void doLog(String logName, String msg, boolean succeed) {
//添加到数据库 ShiroUser user = ShiroKit.getUser();
// ShiroUser user = ShiroKit.getUser(); OperationLog log = new OperationLog();
// if (null == user) { log.setMethod(msg);
// return true; log.setCreatetime(new Date());
// } log.setSucceed((succeed) ? "1" : "0");
// try { log.setUserid(String.valueOf(user.getId()));
// OperationLog log = new OperationLog(); log.setLogname(logName);
// log.setMethod(msg); operationLogMapper.insert(log);
// log.setCreatetime(new Date());
// log.setSucceed((succeed)?"1":"0");
// log.setUserid(Func.toStr(user.getId()));
// log.setLogname(logName);
// boolean temp = Blade.create(OperationLog.class).save(log);
// return temp;
// } catch (Exception ex) {
// return false;
// }
} }
} }
...@@ -13,12 +13,12 @@ public class ShiroUser implements Serializable { ...@@ -13,12 +13,12 @@ public class ShiroUser implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public Integer id; // 主键ID public Integer id; // 主键ID
public String account; // 账号 public String account; // 账号
public String name; // 姓名 public String name; // 姓名
public Integer deptId; // 部门id public Integer deptId; // 部门id
public List<Integer> roleList; // 角色集 public List<Integer> roleList; // 角色集
public String deptName; // 部门名称 public String deptName; // 部门名称
public List<String> roleNames; // 角色名称集 public List<String> roleNames; // 角色名称集
......
package project.config.web.beetl; package project.config.web.beetl;
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
import com.stylefeng.guns.core.beetl.Feng;
import com.stylefeng.guns.core.beetl.ShiroExt; import com.stylefeng.guns.core.beetl.ShiroExt;
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
public class BeetlConfiguration extends BeetlGroupUtilConfiguration { public class BeetlConfiguration extends BeetlGroupUtilConfiguration {
...@@ -11,7 +9,7 @@ public class BeetlConfiguration extends BeetlGroupUtilConfiguration { ...@@ -11,7 +9,7 @@ public class BeetlConfiguration extends BeetlGroupUtilConfiguration {
public void initOther() { public void initOther() {
groupTemplate.registerFunctionPackage("shiro", new ShiroExt()); groupTemplate.registerFunctionPackage("shiro", new ShiroExt());
groupTemplate.registerFunctionPackage("feng", new Feng());
} }
} }
...@@ -32,30 +32,22 @@ public class MpGenerator { ...@@ -32,30 +32,22 @@ public class MpGenerator {
// 全局配置 // 全局配置
GlobalConfig gc = new GlobalConfig(); GlobalConfig gc = new GlobalConfig();
gc.setOutputDir("D:\\ideaSpace\\guns\\src\\main\\java"); gc.setOutputDir("D:\\ideaSpace\\guns\\src\\main\\java");//这里写你自己的java目录
gc.setFileOverride(true); gc.setFileOverride(true);
gc.setActiveRecord(true); gc.setActiveRecord(true);
gc.setEnableCache(false);// XML 二级缓存 gc.setEnableCache(false);// XML 二级缓存
gc.setBaseResultMap(true);// XML ResultMap gc.setBaseResultMap(true);// XML ResultMap
gc.setBaseColumnList(false);// XML columList gc.setBaseColumnList(false);// XML columList
gc.setAuthor("stylefeng"); gc.setAuthor("stylefeng");
// 自定义文件命名,注意 %s 会自动填充表实体属性!
// gc.setMapperName("%sMapper");
// gc.setXmlName("%sMapper");
// gc.setServiceName(null);
// gc.setServiceImplName(null);
// gc.setControllerName(null);
mpg.setGlobalConfig(gc); mpg.setGlobalConfig(gc);
// 数据源配置 // 数据源配置
DataSourceConfig dsc = new DataSourceConfig(); DataSourceConfig dsc = new DataSourceConfig();
dsc.setDbType(DbType.MYSQL); dsc.setDbType(DbType.MYSQL);
dsc.setTypeConvert(new MySqlTypeConvert(){ dsc.setTypeConvert(new MySqlTypeConvert() {
// 自定义数据库表字段类型转换【可选】 // 自定义数据库表字段类型转换【可选】
@Override @Override
public DbColumnType processTypeConvert(String fieldType) { public DbColumnType processTypeConvert(String fieldType) {
// System.out.println("转换类型:" + fieldType);
return super.processTypeConvert(fieldType); return super.processTypeConvert(fieldType);
} }
}); });
...@@ -67,30 +59,12 @@ public class MpGenerator { ...@@ -67,30 +59,12 @@ public class MpGenerator {
// 策略配置 // 策略配置
StrategyConfig strategy = new StrategyConfig(); StrategyConfig strategy = new StrategyConfig();
strategy.setTablePrefix(new String[]{"dd_","_"});// 此处可以修改为您的表前缀 strategy.setTablePrefix(new String[]{"_"});// 此处可以修改为您的表前缀
strategy.setNaming(NamingStrategy.remove_prefix_and_camel);// 表名生成策略 strategy.setNaming(NamingStrategy.remove_prefix_and_camel);// 表名生成策略
// strategy.setInclude(new String[] { "user" }); // 需要生成的表 // strategy.setInclude(new String[] { "user" }); // 需要生成的表
// strategy.setExclude(new String[]{"test"}); // 排除生成的表 // strategy.setExclude(new String[]{"test"}); // 排除生成的表
// 字段名生成策略 // 字段名生成策略
strategy.setFieldNaming(NamingStrategy.nochange); strategy.setFieldNaming(NamingStrategy.nochange);
// 自定义实体父类
// strategy.setSuperEntityClass("com.baomidou.demo.TestEntity");
// 自定义实体,公共字段
// strategy.setSuperEntityColumns(new String[] { "test_id", "age" });
// 自定义 mapper 父类
// strategy.setSuperMapperClass("com.baomidou.demo.TestMapper");
// 自定义 service 父类
// strategy.setSuperServiceClass("com.baomidou.demo.TestService");
// 自定义 service 实现类父类
// strategy.setSuperServiceImplClass("com.baomidou.demo.TestServiceImpl");
// 自定义 controller 父类
// strategy.setSuperControllerClass("com.baomidou.demo.TestController");
// 【实体】是否生成字段常量(默认 false)
// public static final String ID = "test_id";
// strategy.setEntityColumnConstant(true);
// 【实体】是否为构建者模型(默认 false)
// public User setName(String name) {this.name = name; return this;}
// strategy.setEntityBuliderModel(true);
mpg.setStrategy(strategy); mpg.setStrategy(strategy);
// 包配置 // 包配置
...@@ -108,34 +82,13 @@ public class MpGenerator { ...@@ -108,34 +82,13 @@ public class MpGenerator {
InjectionConfig cfg = new InjectionConfig() { InjectionConfig cfg = new InjectionConfig() {
@Override @Override
public void initMap() { public void initMap() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<>();
map.put("abc", this.getConfig().getGlobalConfig().getAuthor() + "-mp"); map.put("abc", this.getConfig().getGlobalConfig().getAuthor() + "-mp");
this.setMap(map); this.setMap(map);
} }
}; };
// 自定义 xxList.jsp 生成
// List<FileOutConfig> focList = new ArrayList<FileOutConfig>();
// focList.add(new FileOutConfig("/template/list.jsp.vm") {
// @Override
// public String outputFile(TableInfo tableInfo) {
// // 自定义输入文件名称
// return "D://my_" + tableInfo.getEntityName() + ".jsp";
// }
// });
// cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg); mpg.setCfg(cfg);
// 自定义模板配置,可以 copy 源码 mybatis-plus/src/main/resources/template 下面内容修改,
// 放置自己项目的 src/main/resources/template 目录下, 默认名称一下可以不配置,也可以自定义模板名称
// TemplateConfig tc = new TemplateConfig();
// tc.setController("...");
// tc.setEntity("...");
// tc.setMapper("...");
// tc.setXml("...");
// tc.setService("...");
// tc.setServiceImpl("...");
// mpg.setTemplate(tc);
// 执行生成 // 执行生成
mpg.execute(); mpg.execute();
......
...@@ -2,81 +2,73 @@ ...@@ -2,81 +2,73 @@
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function () {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
$("#btn_close").bind("click", function() {
parent.layer.close(index);
});
$("#btn_save").bind(
"click",
function() {
var zTree = $.fn.zTree.getZTreeObj("zTree");
var nodes = zTree.getCheckedNodes();
var ids = "";
for (var i = 0, l = nodes.length; i < l; i++) {
ids += "," + nodes[i].id;
}
ids = ids.substring(1);
var ajax = new $ax(Feng.ctxPath + "/role/setAuthority", $("#btn_close").bind("click", function () {
function(data) { parent.layer.close(index);
Feng.success("分配角色成功!"); });
window.parent.Role.table.refresh();
parent.layer.close(index);
}, function(data) {
Feng.error("分配角色失败!"
+ data.responseJSON.message + "!");
});
ajax.set("roleId", "${roleId}");
ajax.set("ids", ids);
ajax.start();
});
initZtree(); $("#btn_save").bind("click", function () {
}); var ids = Feng.zTreeCheckedNodes("zTree");
var ajax = new $ax(Feng.ctxPath + "/role/setAuthority", function (data) {
Feng.success("分配角色成功!");
window.parent.Role.table.refresh();
parent.layer.close(index);
}, function (data) {
Feng.error("分配角色失败!"
+ data.responseJSON.message + "!");
});
ajax.set("roleId", "${roleId}");
ajax.set("ids", ids);
ajax.start();
});
function initZtree() { initZtree();
var setting = { });
check : {
enable : true
},
data : {
simpleData : {
enable : true
}
}
};
var ztree = new $ZTree("zTree", "/menu/menuTreeListByRoleId/" function initZtree() {
+ "${roleId}"); var setting = {
ztree.setSettings(setting); check: {
ztree.init(); enable: true
} },
data: {
simpleData: {
enable: true
}
}
};
var ztree = new $ZTree("zTree", "/menu/menuTreeListByRoleId/"
+ "${roleId}");
ztree.setSettings(setting);
ztree.init();
}
</script> </script>
<!-- 配置grid --> <!-- 配置grid -->
<div class="container" style="padding: 0px 10px !important;margin-top: -10px;text-align: center !important;"> <div class="container" style="padding: 0px 10px !important;margin-top: -10px;text-align: center !important;">
<div class="row"> <div class="row">
<div class="ibox float-e-margins"> <div class="ibox float-e-margins">
<div class="ibox-title"> <div class="ibox-title">
<h5>${roleName!}</h5> <h5>${roleName!}</h5>
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<ul id="zTree" class="ztree"></ul> <ul id="zTree" class="ztree"></ul>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<button class="btn btn-sm btn-info" type="button" id="btn_save"> <button class="btn btn-sm btn-info" type="button" id="btn_save">
<i class="ace-icon fa fa-check bigger-110"></i>保存 <i class="ace-icon fa fa-check bigger-110"></i>保存
</button> </button>
&nbsp; &nbsp;
<button class="btn btn-sm btn-danger" type="button" id="btn_close"> <button class="btn btn-sm btn-danger" type="button" id="btn_close">
<i class="ace-icon fa fa-close bigger-110"></i>关闭 <i class="ace-icon fa fa-close bigger-110"></i>关闭
</button> </button>
</div> </div>
</div> </div>
</div> </div>
@} @}
...@@ -2,83 +2,78 @@ ...@@ -2,83 +2,78 @@
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function () {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
$("#btn_close").bind("click", function() {
parent.layer.close(index);
});
$("#btn_save").bind("click", function() {
var zTree = $.fn.zTree.getZTreeObj("zTree");
var nodes = zTree.getCheckedNodes();
var ids = "";
for (var i = 0, l = nodes.length; i < l; i++) {
ids += "," + nodes[i].id;
}
ids = ids.substring(1);
var ajax = new $ax(Feng.ctxPath + "/mgr/setRole", function(data) { var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
Feng.success("分配角色成功!");
window.parent.MgrUser.table.refresh();
parent.layer.close(index);
}, function(data) {
Feng.error("分配角色失败!" + data.responseJSON.message + "!");
});
ajax.set("roleIds", ids);
ajax.set("userId", "${userId}");
ajax.start();
});
initZtree(); $("#btn_close").bind("click", function () {
}); parent.layer.close(index);
});
function initZtree() { $("#btn_save").bind("click", function () {
var setting = { var ids = Feng.zTreeCheckedNodes("zTree");
check : { var ajax = new $ax(Feng.ctxPath + "/mgr/setRole", function (data) {
enable : true, Feng.success("分配角色成功!");
chkboxType : { window.parent.MgrUser.table.refresh();
"Y" : "", parent.layer.close(index);
"N" : "" }, function (data) {
} Feng.error("分配角色失败!" + data.responseJSON.message + "!");
}, });
data : { ajax.set("roleIds", ids);
simpleData : { ajax.set("userId", "${userId}");
enable : true ajax.start();
} });
}
};
var ztree = new $ZTree("zTree", "/role/roleTreeListByUserId/" initZtree();
+ "${userId}"); });
ztree.setSettings(setting);
ztree.init(); function initZtree() {
} var setting = {
check: {
enable: true,
chkboxType: {
"Y": "",
"N": ""
}
},
data: {
simpleData: {
enable: true
}
}
};
var ztree = new $ZTree("zTree", "/role/roleTreeListByUserId/${userId}");
ztree.setSettings(setting);
ztree.init();
}
</script> </script>
<!-- 配置grid --> <!-- 配置grid -->
<div class="container" <div class="container"
style="padding: 0px 10px !important; margin-top: -10px; text-align: center !important;"> style="padding: 0px 10px !important; margin-top: -10px; text-align: center !important;">
<div class="row"> <div class="row">
<div class="ibox float-e-margins"> <div class="ibox float-e-margins">
<div class="ibox-title"> <div class="ibox-title">
<h5>${userAccount!}</h5> <h5>${userAccount!}</h5>
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<ul id="zTree" class="ztree"></ul> <ul id="zTree" class="ztree"></ul>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<button class="btn btn-sm btn-info" type="button" id="btn_save"> <button class="btn btn-sm btn-info" type="button" id="btn_save">
<i class="ace-icon fa fa-check bigger-110"></i> 保存 <i class="ace-icon fa fa-check bigger-110"></i> 保存
</button> </button>
&nbsp; &nbsp;
<button class="btn btn-sm btn-danger" type="button" id="btn_close"> <button class="btn btn-sm btn-danger" type="button" id="btn_close">
<i class="ace-icon fa fa-close bigger-110"></i> 关闭 <i class="ace-icon fa fa-close bigger-110"></i> 关闭
</button> </button>
</div> </div>
</div> </div>
</div> </div>
@} @}
var Feng = { var Feng = {
ctxPath : "", ctxPath: "",
addCtx : function(ctx) { addCtx: function (ctx) {
if (this.ctxPath == "") { if (this.ctxPath == "") {
this.ctxPath = ctx; this.ctxPath = ctx;
} }
}, },
log : function(info) { log: function (info) {
console.log(info); console.log(info);
}, },
alert : function(info, iconIndex) { alert: function (info, iconIndex) {
parent.layer.msg(info, { parent.layer.msg(info, {
icon : iconIndex icon: iconIndex
}); });
}, },
info : function(info) { info: function (info) {
Feng.alert(info, 0); Feng.alert(info, 0);
}, },
success : function(info) { success: function (info) {
Feng.alert(info, 1); Feng.alert(info, 1);
}, },
error : function(info) { error: function (info) {
Feng.alert(info, 2); Feng.alert(info, 2);
}, },
writeObj : function(obj) { writeObj: function (obj) {
var description = ""; var description = "";
for ( var i in obj) { for (var i in obj) {
var property = obj[i]; var property = obj[i];
description += i + " = " + property + ","; description += i + " = " + property + ",";
} }
layer.alert(description, { layer.alert(description, {
skin : 'layui-layer-molv', skin: 'layui-layer-molv',
closeBtn : 0 closeBtn: 0
}); });
}, },
showInputTree : function(inputId,inputTreeContentId) { showInputTree: function (inputId, inputTreeContentId) {
var onBodyDown = function(event) { var onBodyDown = function (event) {
if (!(event.target.id == "menuBtn" || event.target.id == inputTreeContentId || $(event.target).parents("#" + inputTreeContentId).length > 0)) { if (!(event.target.id == "menuBtn" || event.target.id == inputTreeContentId || $(event.target).parents("#" + inputTreeContentId).length > 0)) {
$("#" + inputTreeContentId).fadeOut("fast"); $("#" + inputTreeContentId).fadeOut("fast");
$("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起 $("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起
} }
}; };
var inputDiv = $("#" + inputId);
var inputDivOffset = $("#" + inputId).offset();
$("#" + inputTreeContentId).css({
left : inputDivOffset.left + "px",
top : inputDivOffset.top + inputDiv.outerHeight() + "px"
}).slideDown("fast");
$("body").bind("mousedown", onBodyDown); var inputDiv = $("#" + inputId);
}, var inputDivOffset = $("#" + inputId).offset();
baseAjax : function(url,tip){
var ajax = new $ax(Feng.ctxPath + url, function(data){ $("#" + inputTreeContentId).css({
Feng.success(tip + "成功!"); left: inputDivOffset.left + "px",
},function(data){ top: inputDivOffset.top + inputDiv.outerHeight() + "px"
Feng.error(tip + "失败!" + data.responseJSON.message + "!"); }).slideDown("fast");
});
return ajax; $("body").bind("mousedown", onBodyDown);
}, },
changeAjax : function(url){ baseAjax: function (url, tip) {
return Feng.baseAjax(url,"修改"); var ajax = new $ax(Feng.ctxPath + url, function (data) {
}, Feng.success(tip + "成功!");
addAjax : function(url){ }, function (data) {
return Feng.baseAjax(url,"添加"); Feng.error(tip + "失败!" + data.responseJSON.message + "!");
} });
return ajax;
},
changeAjax: function (url) {
return Feng.baseAjax(url, "修改");
},
zTreeCheckedNodes: function (zTreeId) {
var zTree = $.fn.zTree.getZTreeObj(zTreeId);
var nodes = zTree.getCheckedNodes();
var ids = "";
for (var i = 0, l = nodes.length; i < l; i++) {
ids += "," + nodes[i].id;
}
return ids.substring(1);
}
}; };
package com.stylefeng.guns.base; package com.stylefeng.guns.base;
import com.stylefeng.guns.core.log.ILog;
import com.stylefeng.guns.core.util.SpringContextHolder;
import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
...@@ -10,4 +13,11 @@ import project.config.root.RootSpringConfig; ...@@ -10,4 +13,11 @@ import project.config.root.RootSpringConfig;
@ContextConfiguration(classes = RootSpringConfig.class) @ContextConfiguration(classes = RootSpringConfig.class)
public class BaseTest { public class BaseTest {
@Test
public void test() {
ILog logFactory = SpringContextHolder.getBean(ILog.class);
logFactory.doLog("12", "message", true);
}
} }
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