Closed Easy-Easy-Easy closed 1 year ago
@LogRecord(type = "媒体数据", subType = "删除", bizNo = "{{#oldData.graphId}}_{{#oldData.entityId}}", successCondition = "{{#myCondition==200}}", success = "删除媒体数据,id为:{{#id}}", fail = "操作失败:{{#_errorMsg}}") public AjaxResult remove(@PathVariable Long id) { GraphRelationData graphRelationData = Optional.ofNullable(graphRelationDataService.getById(id)).orElse(new GraphRelationData()); LogRecordContext.putVariable("oldData", graphRelationData); LogRecordContext.putVariable("myCondition", 500); return toAjax(graphRelationDataService.removeById(id)); }
myCondition 设置为500的时候,fail不会被执行
你的方法抛出异常了吗? 你的表达式抛出异常时才会记录,或者你修改fail的文案,{{#_errorMsg}}是系统预留记录异常的
fail
@LogRecord(type = "媒体数据", subType = "删除", bizNo = "{{#oldData.graphId}}_{{#oldData.entityId}}", successCondition = "{{#myCondition==200}}", success = "删除媒体数据,id为:{{#id}}", fail = "操作失败:{{#_errorMsg}}") public AjaxResult remove(@PathVariable Long id) { GraphRelationData graphRelationData = Optional.ofNullable(graphRelationDataService.getById(id)).orElse(new GraphRelationData()); LogRecordContext.putVariable("oldData", graphRelationData); LogRecordContext.putVariable("myCondition", 500); return toAjax(graphRelationDataService.removeById(id)); }
myCondition 设置为500的时候,fail不会被执行