--添加操作生命周期接口
This commit is contained in:
@ -6,6 +6,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.pictc.datalog.DataOperationContent;
|
||||
import com.pictc.datalog.DataOperationListener;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
@ -29,8 +31,9 @@ import com.xjrsoft.module.dev.dto.Testfrom3PageDto;
|
||||
import com.xjrsoft.module.dev.entity.Testfrom3;
|
||||
import com.xjrsoft.module.dev.service.ITestfrom3Service;
|
||||
import com.xjrsoft.module.dev.vo.Testfrom3PageVo;
|
||||
|
||||
import com.xjrsoft.module.common.db.utils.CommonCallUtils;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.datalog.vo.OperationType;
|
||||
import com.xjrsoft.module.dev.vo.Testfrom3Vo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -135,7 +138,39 @@ public class Testfrom3Controller {
|
||||
@ApiOperation(value = "修改Testfrom3")
|
||||
@SaCheckPermission("testfrom3:edit")
|
||||
public R update(@Valid @RequestBody UpdateTestfrom3Dto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateTestfrom3Dto>() {
|
||||
|
||||
@Override
|
||||
public UpdateTestfrom3Dto before(DataOperationContent<UpdateTestfrom3Dto> content) {
|
||||
if(content.getType()==OperationType.DELETE) {
|
||||
CommonCallUtils.deleteBefore(content.getTableName(),content.getIdValue());
|
||||
}else if(content.getType()==OperationType.DISABLE){
|
||||
CommonCallUtils.disableBefore(content.getTableName(),content.getIdValue());
|
||||
}else if(content.getType()==OperationType.ENABLE){
|
||||
CommonCallUtils.enableBefore(content.getTableName(),content.getIdValue());
|
||||
}
|
||||
return content.getObj();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpdateTestfrom3Dto after(DataOperationContent<UpdateTestfrom3Dto> content) {
|
||||
if(content.getType()==OperationType.INSERT || content.getType()==OperationType.UPDATE) {
|
||||
CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue());
|
||||
}
|
||||
return content.getObj();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(DataOperationContent<UpdateTestfrom3Dto> content) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinally(DataOperationContent<UpdateTestfrom3Dto> content) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user