|
@@ -15,6 +15,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -30,6 +31,26 @@ public class LogController {
|
|
|
@Autowired
|
|
|
private SysLogService sysLogService;
|
|
|
|
|
|
+ @GetMapping("add")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public MessageResult<SysLog> add() throws Exception{
|
|
|
+ MessageResult<SysLog> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ SysLog sysLog = new SysLog();
|
|
|
+ sysLog.setUserId("test");
|
|
|
+ messageResult.setData(sysLog);
|
|
|
+
|
|
|
+ int affectCount = sysLogService.insert(sysLog);
|
|
|
+
|
|
|
+ logger.warn("affectCount=" + affectCount);
|
|
|
+
|
|
|
+ if (affectCount>0){
|
|
|
+ throw new Exception("回滚测试");
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value="列表")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "userId",value = "用户编号", paramType = "form"),
|