use of com.jfinal.aop.Before in project fruit-manage by liuzhaozhao.
the class OrderDetail method update.
/**
* 推荐
*/
@Before(Tx.class)
public boolean update(UserTypeConstant type, Integer uid, String orderId, Integer productId, Integer productStandardId, Integer beforeNum, Integer afterNum) {
super.setUpdateTime(new Date());
super.update();
return getOrderLog(type, uid, orderId, productId, productStandardId, afterNum - beforeNum).save();
}
use of com.jfinal.aop.Before in project fruit-manage by liuzhaozhao.
the class OrderDetail method update.
@Deprecated
@Override
@Before(Tx.class)
public boolean update() {
OrderDetail orderDetail = OrderDetail.dao.findById(super.getId());
super.update();
return getOrderLog(orderDetail.getOrderId(), orderDetail.getProductId(), orderDetail.getProductStandardId(), super.getNum() - orderDetail.getNum()).save();
}
use of com.jfinal.aop.Before in project jfinal by jfinal.
the class ProxyGenerator method hasInterceptor.
/**
* 当前 method 是否存在有效拦截器
* 1:如果存在 method 级拦截器,则 return true
* 2:否则结合 method 级的 @Clear 考察 global、class 两层拦截器的留存
* global、class 两层拦截器已作为参数 methodUpperInters 被传入
* methodUpperInters 中的拦截器已结合 class 级 @Clear 处理过
*/
protected boolean hasInterceptor(List<Class<?>> methodUpperInters, ProxyClass proxyClass, Method method) {
// 如果 method 存在拦截器,可断定 hasInterceptor 为真,因为 @Clear 不能清除 method 级拦截器
Before beforeOnMethod = method.getAnnotation(Before.class);
if (beforeOnMethod != null && beforeOnMethod.value().length != 0) {
return true;
}
// method 级拦截器不存在的情况,只需考虑察 global、class 级拦截器结合 method 级 @Clear 的留存情况
List<Class<?>> ret;
Clear clearOnMethod = method.getAnnotation(Clear.class);
if (clearOnMethod != null) {
Class<?>[] clearIntersOnMethod = clearOnMethod.value();
if (clearIntersOnMethod.length != 0) {
// 复制一份 methodUpperInters,以免 removeInterceptorClass 操作影响下次迭代
ret = copyInterceptors(methodUpperInters);
removeInterceptor(ret, clearIntersOnMethod);
} else {
ret = null;
}
} else {
ret = methodUpperInters;
}
return ret != null && ret.size() > 0;
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class ActFormTplController method viewModel.
/**
* 预览
*/
@Before(IdRequired.class)
public void viewModel() {
String id = get("id");
ActFormTpl formTpl = ActFormTpl.dao.findById(id);
setAttr("tplRemark", formTpl.getRemark());
setAttr("plugins", formTpl.getPlugins());
setAttr("template", formTpl.getTemplate());
render("process/actFormTpl_preview.ftl");
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class ActFormTplController method downloadHtml.
// 模板文件下载
@Before(IdRequired.class)
public void downloadHtml() {
String id = get("id");
ActFormTpl formTpl = ActFormTpl.dao.findById(id);
if (formTpl == null) {
renderFail("id 参数错误");
return;
}
render(StringAsFileRender.me(formTpl.getTemplate()).fileName(formTpl.getFormKey() + "-v" + formTpl.getFormVersion() + ".html"));
}
Aggregations