chenw 7 лет назад
Родитель
Сommit
72f19c5a64

+ 1 - 1
bi-server/src/main/java/com/usoftchina/bi/server/controller/dashboard/DashboardsController.java

@@ -53,7 +53,7 @@ public class DashboardsController {
     @ApiOperation(value = "删除看板", notes = "删除看板", response = RepEntity.class)
     @CheckToken
     @PostMapping("/delDashboards")
-    public RepEntity delDashboards(@RequestHeader String token,@RequestBody List<Integer> body){
+    public RepEntity delDashboards(@RequestHeader String token,@RequestBody Integer body){
         return dashboardsService.delDashboards(token, body);
     }
 

+ 2 - 9
bi-server/src/main/java/com/usoftchina/bi/server/dao/dashboard/DashboardsMapper.java

@@ -77,15 +77,8 @@ public interface DashboardsMapper {
     /*
     删除看板
      */
-    @Delete("<script>" +
-            "delete from BI_DASHBOARDS where id in " +
-            "("+
-            "<foreach collection=\"list\" index=\"index\" item=\"item\"  separator=\",\">" +
-            "#{item, jdbcType = NUMERIC}"+
-            "</foreach>" +
-            ")"+
-            "</script>")
-    void delDashboards(List<Integer> idList);
+    @Delete("delete from BI_DASHBOARDS where id = #{id}")
+    void delDashboards(Integer id);
 
     /*
     查询看板列表

+ 6 - 10
bi-server/src/main/java/com/usoftchina/bi/server/service/dashboard/DashboardsService.java

@@ -139,20 +139,16 @@ public class DashboardsService {
     /*
     删除看板
      */
-    public RepEntity delDashboards(String token, List<Integer> idList) {
+    public RepEntity delDashboards(String token, Integer id) {
         Map<String, String> stringMap = GetTokenDataUtil.getTokenData(token);
         int userId = Integer.parseInt(stringMap.get("id"));
-        Iterator isList = idList.iterator();
-        while (isList.hasNext()) {
-            int id = (int) isList.next();
-            int createId = dashboardsMapper.getCreateIdById(id);
-            if (userId != createId) {
-                return new RepEntity(RepCode.NoAuthority);
-            }
+        int createId = dashboardsMapper.getCreateIdById(id);
+        if (userId != createId) {
+            return new RepEntity(RepCode.NoAuthority);
         }
-        dashboardsMapper.delDashboards(idList);
+        dashboardsMapper.delDashboards(id);
         //删除看板-图表关联关系
-        idList.forEach(id -> dashboardsMapper.deleteDashboardChartRelation(id));
+        dashboardsMapper.deleteDashboardChartRelation(id);
         return new RepEntity(RepCode.success);
     }