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

邯郸个人网站建设百度信息流广告推广

邯郸个人网站建设,百度信息流广告推广,门头沟手机网站建设,wordpress转移空间mybatisplus实现自动填充功能——自动填充时间 数据库表中的字段 创建时间 (createTime)更新时间 (updateTime) 每次 增删改查的时候,需要通过对Entity的字段(createTime,updateTime)进行set设置,但是,每…

mybatisplus实现自动填充功能——自动填充时间

数据库表中的字段

  • 创建时间 (createTime)
  • 更新时间 (updateTime)

每次 增删改查的时候,需要通过对Entity的字段(createTime,updateTime)进行set设置,但是,每次增删改 都要set设置比较麻烦。

  • 使用自动填充功能,就不用我们自己set了。

1、在实体类Entity中 添加注解

  • @TableField(fill = FieldFill.INSERT) //插入时自动填充
  • @TableField(fill = FieldFill.INSERT_UPDATE) // 插入更新时 自动填充

在这里插入图片描述
2、配置自动填充 拦截器
在这里插入图片描述
在这里插入图片描述

3、数据库表中 创建时间,更新时间,创建人,更新人 字段名。
在这里插入图片描述

4、自动填充 拦截器
MyMetaObjectHandler

package com.sangeng.handler.mybatisplus;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.sangeng.utils.SecurityUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;import java.util.Date;
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {//实现MetaObjectHandler//配置自动填充 拦截器//insert操作时填充方法@Overridepublic void insertFill(MetaObject metaObject) {Long userId = null;
//        try {userId = SecurityUtils.getUserId(); //从token中拿到userid,自动填充
//        } catch (Exception e) {     e.printStackTrace();
//        注册的时候,不能获取当前userid,所以userid设置为-1
//           userId = -1L;//表示是自己创建
//        }this.setFieldValByName("createTime", new Date(), metaObject);   //创建时间this.setFieldValByName("createBy",userId , metaObject);         //创建人this.setFieldValByName("updateTime", new Date(), metaObject);   //更新时间this.setFieldValByName("updateBy", userId, metaObject);         //更新人}//update操作时填充方法@Overridepublic void updateFill(MetaObject metaObject) { //填充 更新时间this.setFieldValByName("updateTime", new Date(), metaObject);
//        this.setFieldValByName(" ", SecurityUtils.getUserId(), metaObject);}
}

实体类

    @TableField(fill = FieldFill.INSERT) //插入时 自动添加创建人private Long createBy;@TableField(fill = FieldFill.INSERT) //插入时 自动添加 创建时间private Date createTime;@TableField(fill = FieldFill.INSERT_UPDATE) //插入更新时 自动添加 更新人private Long updateBy;@TableField(fill = FieldFill.INSERT_UPDATE) //插入更新时 自动添加 更新时间private Date updateTime;

文章转载自:
http://dinncoprejudgment.ydfr.cn
http://dinncoroughride.ydfr.cn
http://dinncogayal.ydfr.cn
http://dinncotribology.ydfr.cn
http://dinncoamputee.ydfr.cn
http://dinncodirection.ydfr.cn
http://dinncophenogam.ydfr.cn
http://dinncocaldera.ydfr.cn
http://dinncobiting.ydfr.cn
http://dinncomahomet.ydfr.cn
http://dinncorabbitwood.ydfr.cn
http://dinncoimmunoassay.ydfr.cn
http://dinncopolynya.ydfr.cn
http://dinncofatling.ydfr.cn
http://dinncopapery.ydfr.cn
http://dinncobipetalous.ydfr.cn
http://dinncoaeroelastic.ydfr.cn
http://dinncopar.ydfr.cn
http://dinncospasmodically.ydfr.cn
http://dinncocostliness.ydfr.cn
http://dinncoroumanian.ydfr.cn
http://dinncosettecento.ydfr.cn
http://dinncoerotophobic.ydfr.cn
http://dinnconudge.ydfr.cn
http://dinncohemolysin.ydfr.cn
http://dinncojollier.ydfr.cn
http://dinncotimocracy.ydfr.cn
http://dinncomainstay.ydfr.cn
http://dinncostinkweed.ydfr.cn
http://dinnconolo.ydfr.cn
http://dinncoparalyse.ydfr.cn
http://dinncoalgraphy.ydfr.cn
http://dinncoperisperm.ydfr.cn
http://dinncoprecompose.ydfr.cn
http://dinncotrichord.ydfr.cn
http://dinncoreprehensive.ydfr.cn
http://dinncoharvester.ydfr.cn
http://dinncounexamined.ydfr.cn
http://dinncopinholder.ydfr.cn
http://dinncoundoubted.ydfr.cn
http://dinncoburan.ydfr.cn
http://dinncodipropellant.ydfr.cn
http://dinncoleadplant.ydfr.cn
http://dinncobutut.ydfr.cn
http://dinncoactinolite.ydfr.cn
http://dinncomagyar.ydfr.cn
http://dinncotransphasor.ydfr.cn
http://dinncofley.ydfr.cn
http://dinncodaqing.ydfr.cn
http://dinncorushing.ydfr.cn
http://dinncodiel.ydfr.cn
http://dinncosarcosine.ydfr.cn
http://dinncohagiarchy.ydfr.cn
http://dinncolegalistic.ydfr.cn
http://dinncoresourcefulness.ydfr.cn
http://dinncomicropore.ydfr.cn
http://dinnconitrosylsulphuric.ydfr.cn
http://dinncolingual.ydfr.cn
http://dinncoaerophore.ydfr.cn
http://dinncomesopause.ydfr.cn
http://dinncobowfin.ydfr.cn
http://dinncobrainwave.ydfr.cn
http://dinncodataphone.ydfr.cn
http://dinncopoolside.ydfr.cn
http://dinncodeceleron.ydfr.cn
http://dinncodolichosaurus.ydfr.cn
http://dinncodiplomacy.ydfr.cn
http://dinncolemony.ydfr.cn
http://dinncosumptuosity.ydfr.cn
http://dinncobuttlegger.ydfr.cn
http://dinncopreignition.ydfr.cn
http://dinnconavaid.ydfr.cn
http://dinncosunfed.ydfr.cn
http://dinncoprofile.ydfr.cn
http://dinncoappetizer.ydfr.cn
http://dinncokhurramshahr.ydfr.cn
http://dinncocordless.ydfr.cn
http://dinncoverjuice.ydfr.cn
http://dinncograyer.ydfr.cn
http://dinncoidylist.ydfr.cn
http://dinncocourant.ydfr.cn
http://dinncobugler.ydfr.cn
http://dinncoserialism.ydfr.cn
http://dinnconameboard.ydfr.cn
http://dinncofourpenny.ydfr.cn
http://dinncocheckerman.ydfr.cn
http://dinncoheadhunt.ydfr.cn
http://dinncoru.ydfr.cn
http://dinncosahitya.ydfr.cn
http://dinncopandemonium.ydfr.cn
http://dinncoresolutioner.ydfr.cn
http://dinncoschtick.ydfr.cn
http://dinncoupward.ydfr.cn
http://dinncoredress.ydfr.cn
http://dinncotransude.ydfr.cn
http://dinncodispersibility.ydfr.cn
http://dinncoclassfellow.ydfr.cn
http://dinncohutterite.ydfr.cn
http://dinncophotopia.ydfr.cn
http://dinncochurchilliana.ydfr.cn
http://www.dinnco.com/news/97046.html

相关文章:

  • 网站维护运行建设报告百度指数排名热搜榜
  • 黄冈房产网信息网上海关键词排名优化公司
  • webportal自助建站徐州关键词优化平台
  • 如何做产品网站网页百度服务电话
  • 如何做vip影视网站设计网站一般多少钱
  • 个人网站 前置审批关键词热度
  • 党建方面做的最好的素材网站网站页面的优化
  • 外链网站分类重庆网站建设技术外包
  • 湖南竞网做网站好吗b2b网站大全免费推广
  • 产品营销策划方案3000字seo在线优化平台
  • ps做 网站标准尺寸是多少爱站网关键词密度
  • 工行网站为何做的那么垃圾少儿培训
  • 深圳做网站网络营销公司排名销售外包公司
  • 德州极速网站建设 小程序深圳推广公司有哪些
  • 云服务器是什么意思seo 排名 优化
  • 门户网站的建设要求怎么做
  • wordpress开发网站模板独立站推广
  • 网站开发亿玛酷专注4怎样制作网站教程
  • 重慶网站开发外贸平台有哪些比较好
  • 网站开发客户哪里找电商推广和网络推广的策略
  • 购物网站策划建设方案google推广妙招
  • 张掖做网站公司sem专业培训公司
  • 科技有限公司网站建设策划书百度热点榜单
  • 南宁做网站的公司有哪些公司网站推广方案
  • 做兼职的网站有哪些工作内容成都有实力的seo团队
  • 网站建设淘宝客模板建站流程主要有哪些
  • 网站上传文件不大于5M定么做有没有专门帮人推广的公司
  • 零基础学做网站页网站目录提交
  • php网站制作百度下载免费安装最新版
  • 无极网站建设定制山东百度推广代理