Browse Source

【CHG】新增计划时返回计划ID

ZhaoMn 3 years ago
parent
commit
11e488d17f

+ 1 - 1
railway-admin/src/main/java/com/railway/web/controller/business/safetool/SecScheduledController.java

@@ -43,7 +43,7 @@ public class SecScheduledController extends BaseController {
   @PostMapping("/add")
   public AjaxResult add(@Validated @RequestBody SecScheduledToolListVo secScheduled) {
     try {
-      return toAjax(secScheduledService.create(secScheduled));
+      return success(secScheduledService.create(secScheduled));
     } catch (Exception e) {
       e.printStackTrace();
     }

+ 1 - 1
railway-business/src/main/java/com/railway/business/safetool/service/ISecScheduledService.java

@@ -16,7 +16,7 @@ public interface ISecScheduledService{
     /**
     * 新增
     */
-    int create(SecScheduledToolListVo secScheduled) throws Exception;
+    Long create(SecScheduledToolListVo secScheduled) throws Exception;
 
     /**
     * 删除

+ 2 - 2
railway-business/src/main/java/com/railway/business/safetool/service/impl/SecScheduledServiceImpl.java

@@ -49,7 +49,7 @@ public class SecScheduledServiceImpl implements ISecScheduledService {
    */
   @Override
   @Transactional(rollbackFor = Exception.class)
-  public int create(SecScheduledToolListVo secScheduled) throws Exception {
+  public Long create(SecScheduledToolListVo secScheduled) throws Exception {
     secScheduled.setCreateTime(new Date());
     secScheduled.setCreateBy(SecurityUtils.getUsername());
     List<SecScheduledToolVo> baseSafetyTools = secScheduled.getBaseSafetyTools();
@@ -74,7 +74,7 @@ public class SecScheduledServiceImpl implements ISecScheduledService {
         throw new Exception("计划关系插入失败");
       }
     }
-    return 1;
+    return s.getId();
   }
 
   /**

+ 7 - 0
railway-common/src/main/java/com/railway/common/core/controller/BaseController.java

@@ -98,6 +98,13 @@ public class BaseController {
     return AjaxResult.success(message);
   }
 
+  /**
+   * 返回成功消息
+   */
+  public AjaxResult success(Long id) {
+    return AjaxResult.success(id);
+  }
+
   /**
    * 返回失败消息
    */