夏文涛 2 лет назад
Родитель
Сommit
0d72be9059

+ 4 - 0
src/main/java/com/template/api/SmartSectionControllerAPI.java

@@ -24,4 +24,8 @@ public interface SmartSectionControllerAPI {
     @GetMapping(value = "/queryPageSmartUser")
     @ApiOperation(value = "用户分页数据", notes = "用户分页数据", httpMethod = "GET")
     CommonResult queryPageSmartSection(@RequestParam int currentPage, @RequestParam int pageCount);
+
+    @GetMapping(value = "/deleteSmartSection")
+    @ApiOperation(value = "删除分段数据", notes = "删除分段数据", httpMethod = "GET")
+    CommonResult deleteSmartSection(@RequestParam int id);
 }

+ 17 - 0
src/main/java/com/template/controller/SmartSectionController.java

@@ -180,6 +180,23 @@ public class SmartSectionController implements SmartSectionControllerAPI {
         return CommonResult.ok(result);
     }
 
+    @Override
+    public CommonResult deleteSmartSection(int id) {
+        SmartSection data = smartSectionService.getSmartById(id);
+        if(data == null){
+            return CommonResult.fail("当前数据已失效,删除失败");
+        }
+
+        int result = smartSectionService.deleteSmartUserById(id);
+        if(result <= 0){
+            return CommonResult.fail("删除失败");
+        }
+
+        smartSectionDetailService.deletedDetailBySenctionId(id);
+
+        return CommonResult.ok("删除成功");
+    }
+
 
 }
 

+ 4 - 0
src/main/java/com/template/services/SmartSectionService.java

@@ -8,6 +8,8 @@ import com.template.model.result.PageUtils;
 import com.template.model.vo.SmartSectionPageVo;
 import com.template.model.vo.UserDeleteVo;
 
+import java.util.List;
+
 /**
  * <p>
  * 应用管理 服务类
@@ -24,5 +26,7 @@ public interface SmartSectionService extends IService<SmartSection> {
 
     SmartSection getSmartById(Integer id);
 
+    int deleteSmartUserById(Integer id);
+
     PageUtils<SmartSectionPageVo> querySmartSectionPages(int currentPage, int pageCount);
 }

+ 6 - 0
src/main/java/com/template/services/impl/SmartSectionServiceImpl.java

@@ -46,6 +46,12 @@ public class SmartSectionServiceImpl extends ServiceImpl<SmartSectionMapper, Sma
     }
 
     @Override
+    public int deleteSmartUserById(Integer id) {
+        int result = smartSectionMapper.deleteById(id);
+        return result;
+    }
+
+    @Override
     public PageUtils<SmartSectionPageVo> querySmartSectionPages(int currentPage, int pageCount) {
         Page<SmartSectionPageVo> page = new Page<>();
         page.setCurrent(currentPage);