当前位置: 首页 > news >正文

发布网站制作搭建自己的个人网站

发布网站制作,搭建自己的个人网站,山东省建设备案网站审批表,长沙做网站 青创互联问题描述#xff1a;对于每个表都有cratetime,updatetime,createby,updateby字段#xff0c;每次插入数据或者更改数据的时候#xff0c;都需要对这几个字段进行设置。 Target(ElementType.METHOD) Retention(RetentionPolicy.RUNTIME) public interface AutoFill {//数据库… 问题描述对于每个表都有cratetime,updatetime,createby,updateby字段每次插入数据或者更改数据的时候都需要对这几个字段进行设置。 Target(ElementType.METHOD) Retention(RetentionPolicy.RUNTIME) public interface AutoFill {//数据库操作类型UPDATE INSERTOperationType value(); }Aspect Component Slf4j public class AutoFillAspect {Pointcut(execution(* com.sky.*.*.*(..)) annotation(com.sky.annotation.AutoFill))public void autoFillPointCut(){}/*** 前置通知在通知中进行公共字段的赋值*/Before(autoFillPointCut())public void autoFill(JoinPoint joinPoint){log.info(开始进行公共字段自动填充...);//获取到当前被拦截的方法上的数据库操作类型MethodSignature signature (MethodSignature) joinPoint.getSignature();//方法签名对象AutoFill autoFill signature.getMethod().getAnnotation(AutoFill.class);//获得方法上的注解对象OperationType operationType autoFill.value();//获得数据库操作类型//获取到当前被拦截的方法的参数--实体对象Object[] args joinPoint.getArgs();if(args null || args.length 0){return;}Object entity args[0];//准备赋值的数据LocalDateTime now LocalDateTime.now();Long currentId BaseContext.getCurrentId();//根据当前不同的操作类型为对应的属性通过反射来赋值if(operationType OperationType.INSERT){//为4个公共字段赋值try {Method setCreateTime entity.getClass().getDeclaredMethod(AutoFillConstant.SET_CREATE_TIME, LocalDateTime.class);Method setCreateUser entity.getClass().getDeclaredMethod(AutoFillConstant.SET_CREATE_USER, Long.class);Method setUpdateTime entity.getClass().getDeclaredMethod(AutoFillConstant.SET_UPDATE_TIME, LocalDateTime.class);Method setUpdateUser entity.getClass().getDeclaredMethod(AutoFillConstant.SET_UPDATE_USER, Long.class);//通过反射为对象属性赋值setCreateTime.invoke(entity,now);setCreateUser.invoke(entity,currentId);setUpdateTime.invoke(entity,now);setUpdateUser.invoke(entity,currentId);} catch (Exception e) {e.printStackTrace();}}else if(operationType OperationType.UPDATE){//为2个公共字段赋值try {Method setUpdateTime entity.getClass().getDeclaredMethod(AutoFillConstant.SET_UPDATE_TIME, LocalDateTime.class);Method setUpdateUser entity.getClass().getDeclaredMethod(AutoFillConstant.SET_UPDATE_USER, Long.class);//通过反射为对象属性赋值setUpdateTime.invoke(entity,now);setUpdateUser.invoke(entity,currentId);} catch (Exception e) {e.printStackTrace();}}}}
http://www.dnsts.com.cn/news/76714.html

相关文章:

  • 邵阳网站建设公司ios开发还有前景吗
  • 空间里怎么放多个网站山西孝义网站开发
  • 如何进行网站建设和推广wordpress 的分享插件
  • 上海正规网站建设成立一个公司需要哪些流程
  • 如何建设网站的目录结构层青岛网站设计模板
  • 这里是我做的网站小程序注册步骤
  • 企业品牌建设方案范文教程seo推广排名网站
  • 做枪版电影网站赚钱南京市高淳区城乡建设局网站
  • 网站重建完成网站集约化建设
  • 免费公文写作网站建设网站的效益分析
  • 厦门app网站设计网易企业邮箱官网登录
  • 网站案例模版网页设计模板html代码素材
  • 网站规划建设与管理维护大学论文在哪个网站开发外贸业务
  • 精品成品网站源码中装建设千股千评
  • 南昌做网站公司有哪些哪里有学压鲜面条培训
  • 下沙网站制作网站建设维护合同书
  • 东莞市公租房申请网站-建设网yy直播频道
  • 宝宝个人网站模板手机app快速开发平台
  • 网站的文章参考文献怎么做网站建设太原
  • 大连网站制作仟亿科技北京app开发制作
  • iis配网站帮别人做网站市场价
  • 建设网站企业文化搭建高端网站
  • 做网站济南邢台做网站哪个网络公司好
  • 工业信息化部网站备案查询网站怎么增加页面收录
  • 学做甜点的网站包装设计网站哪个好用
  • 苏州网站建设公司哪家好重庆定制网站制作价格
  • 三屏网站建设仓库管理系统界面
  • 地方网站如何做竞价工作努力加油的句子
  • 我的家乡网站建设哪家公司做网站正规
  • 网络科技网站建设互联网工程师