Explorar el Código

修复新增报错问题

zhouhao hace 7 años
padre
commit
e6af1e789a

+ 8 - 4
hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-web/src/main/java/org/hswebframework/web/controller/dashboard/DashBoardConfigController.java

@@ -12,10 +12,7 @@ import org.hswebframework.web.dashboard.DashBoardService;
 import org.hswebframework.web.dashboard.executor.DashBoardExecutor;
 import org.hswebframework.web.service.CrudService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 @RestController
 @RequestMapping("/dashboard")
@@ -35,6 +32,13 @@ public class DashBoardConfigController implements SimpleGenericEntityController<
     }
 
 
+    @Override
+    public ResponseMessage<String> add(@RequestBody DashBoardConfigEntity data) {
+        Authentication.current().ifPresent(a -> data.setCreatorId(a.getUser().getId()));
+        data.setCreateTimeNow();
+        return SimpleGenericEntityController.super.add(data);
+    }
+
     @GetMapping("{id}/execute")
     @Authorize
     @ApiOperation("执行仪表盘配置")