当前位置:网站首页>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();
}
}
边栏推荐
- Stringutils string tool class used by FreeMarker to create templates
- Difference between idea open and import project
- 已解决: JDBC连接Mysql失败报错: 'The last packet sent successfully to the server was 0 milliseconds ago. '
- 马志强:语音识别技术研究进展和应用落地分享丨RTC Dev Meetup
- Lombok use
- PostgreSQL source code learning (22) - fault recovery ③ - transaction log registration
- R分析可视化实用数据(航班_教育_餐厅_租户_变迁_寿命_安全)
- Ora-00392 ora-00312 error handling
- B_ QuRT_ User_ Guide(18)
- Mavros控制无人机在gazebo环境下进行双目SLAM
猜你喜欢

net::ERR_ FILE_ NOT_ Found error

msg=SolrCore ‘collection1‘ is not available due to init failure: Could not l

cv. Matchtemplate image model matching opencv

超算Disk quota exceed

postgresql源码学习(22)—— 故障恢复③-事务日志的注册

How to ensure reliable delivery of messages?

Solr initialization failure: requesthandler INIT failure

has been blocked by CORS policy: No ‘Access-Control-Allow-Origin‘ header is present on the requested

CheckBox美化按钮选中样式

The solution of invalid @data annotation in idea2018
随机推荐
Logical deletion_ Swagger2 framework integration
GD32 can发送报no mailbox 故障
Integrated MP code generator
B_QuRT_User_Guide(18)
Reasons why Chinese comments cannot be written in XML
MySQL learning notes: JSON nested array query
关于玩家身上有个普通Set并发安全的讨论
Windows10 installing keras
PostgreSQL source code learning (18) -- mvcc ③ - creating (obtaining) snapshots
Lombok use
GD32F4串口dma接收问题解决
Artalk | how to build a domestic hyperfusion evolutionary base with minimum investment?
ArTalk | 如何用最小投入,构建国产超融合进化底座?
svg实现纸飞机自由的飞翔动画
Stringutils string tool class used by FreeMarker to create templates
蓄力618 ,苏宁如何打下这场硬仗?
【安全科普】今天你被社工了吗?
Pyqt5: basic usage of label control
canvas绘图——如何把图形放置画布中心
Discussion on the concurrency security of a common set on players