当前位置:网站首页>Instructor add function_ Enable auto fill_ Instructor modification function
Instructor add function_ Enable auto fill_ Instructor modification function
2022-06-11 03:21:00 【The bright moon is always fresh】
1、 Realize automatic filling
(1) adding annotations
@ApiModelProperty(value = " Creation time ")
@TableField(fill = FieldFill.INSERT)
private Date gmtCreate;
@ApiModelProperty(value = " Update time ")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gmtModified;
(2) Add controller

@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
this.setFieldValByName("gmtCreate",new Date(),metaObject);
this.setFieldValByName("gmtModified",new Date(),metaObject);
}
@Override
public void updateFill(MetaObject metaObject) {
this.setFieldValByName("gmtModified",new Date(),metaObject);
}
}
2、 Implementation interface
2、 Implementation interface
@ApiOperation(value = " Add lecturers ")
@PostMapping("addTeacher")
public R addTeacher( @RequestBody EduTeacher eduTeacher){
boolean save = teacherService.save(eduTeacher);
if(save){
return R.ok();
}else{
return R.error();
}
}
Instructor modify function
1、 Analyze requirements

2、 According to id Query instructor information
@ApiOperation(value = " according to id Query lecturer ")
@GetMapping("getTeacherById/{id}")
public R getTeacherById(@PathVariable String id){
EduTeacher eduTeacher = teacherService.getById(id);
return R.ok().data("eduTeacher",eduTeacher);
}
3、 Modify Instructor
@ApiOperation(value = " Modify Instructor ")
@PostMapping("updateTeacher")
public R updateTeacher( @RequestBody EduTeacher eduTeacher){
boolean update = teacherService.updateById(eduTeacher);
if(update){
return R.ok();
}else{
return R.error();
}
}
边栏推荐
- Hqchart nailing applet tutorial 1- create a K-line diagram
- ROS Basics - use the launch file (I) - start multiple ROS nodes in batch
- TweenMax五彩小球弹跳动画
- How should Xiaobai start the Amazon self support evaluation?
- 正则表达式
- Vocabulary Construction -- code completion fast food tutorial (3) - word segmentation
- Lombok use
- Resolved: JDBC connection to MySQL failed with an error:'The last packet sent successfully to the server was 0 milliseconds ago. '
- If the source code of the home page module is not separated ----- > nanny level source code analysis (1)
- 三维GIS行业需求及展望
猜你喜欢

MySQL learning notes: JSON nested array query

If no separation ----- > > login module nanny level source code analysis (0)
![[safety science popularization] mining technology starts from the love story of a man of science and Engineering](/img/01/73376c133c33527e479685f8680238.jpg)
[safety science popularization] mining technology starts from the love story of a man of science and Engineering

postgresql源码学习(二十)—— 故障恢复①-事务日志格式

PIP installation Qt5.

【安全科普】今天你被社工了吗?

Hqchart actual combat tutorial 55 area map of K line of ouyi.com

canvas+svg线条粒子动画网页背景

Go language advantages and learning Roadmap

has been blocked by CORS policy: No ‘Access-Control-Allow-Origin‘ header is present on the requested
随机推荐
ArTalk | 如何用最小投入,构建国产超融合进化底座?
If not, use the code generator to generate a set of addition, deletion, modification and query (2)
iQOO 8实测上手体验:王者归来,从不高调
RequestContextHolder
svg实现纸飞机自由的飞翔动画
Lombok use
Demand and Prospect of 3D GIS Industry
R分析可视化实用数据(航班_教育_餐厅_租户_变迁_寿命_安全)
org. apache. solr. common. SolrException:Could not load core configuration for core hotel
文件合成器
HikariPool-1 - Shutdown initiated... HikariPool-1 - Shutdown completed.
R bioinformatics statistical analysis
蓄力618 ,苏宁如何打下这场硬仗?
C语言数组与指针练习题
Error in Solr access: error initializing queryelevationcomponent
What is the difference between a database unique index and a common index?
TweenMax五彩小球弹跳动画
HQChart实战教程55-欧易网K线面积图
LaTex环境下在TexStudio中使用minted插入高亮代码
Log4j use