idea正则表达式-正则替换示例-2024.11笔记
注意idea中反向引用的格式是【$1】换行符是【\n】
需要在如下的代码中往接口的方法中添加一行注解,注解需要用到以后注解的中文备注
原文
@Autowired
private WomanService womanService;
/**
* 自定义分页
*/
@PostMapping("/page/{current}/{size}")
@ApiOperation(value = "查询分页列表", position = 2)
public Result page(@RequestBody WomanVO woman, Page page,User user) {
IPage<WomanVO> pages = womanService.selectWomanPage(page, woman,user);
return DataResult.success(pages);
}需要添加的代码行 《查询分页列表》保持一致
@OperationCommonLog(platform = PlatType.PORTAL, operationType = OperationType.QUERY, module = OperationLogConstant.MODULE, menuName = "人员信息", description = "查询分页列表", executePoint = OperationLogMessageServiceImpl.class)
方法一、采用正向预查,description不能匹配
搜索内容:【(?=^ public.*\()】
替换内容:
【 @OperationCommonLog(platform = PlatType.PORTAL, operationType = OperationType.QUERY, module = OperationLogConstant.MODULE, menuName = "菜单名称", description = "", executePoint = OperationLogMessageServiceImpl.class)
】
方法二、采用正向预查与反向引用,description不能匹配
搜索内容【@ApiOperation\(value = "(.*)"\)((.*\n)*?.*)(?=^ public.*\()】
替换内容【@ApiOperation\(value = "$1"\)$2 @OperationCommonLog(platform = PlatType.PORTAL, operationType = OperationType.QUERY, module = OperationLogConstant.MODULE, menuName = "菜单名称", description = "$1", executePoint = OperationLogMessageServiceImpl.class)
】