lyhzzz 2 年 前
コミット
28bd37e75c

+ 14 - 5
src/main/java/com/fdkankan/manage/controller/CaseController.java

@@ -2,6 +2,7 @@ package com.fdkankan.manage.controller;
 
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.manage.common.ResultCode;
 import com.fdkankan.manage.exception.BusinessException;
 import com.fdkankan.common.response.ResultData;
@@ -12,11 +13,7 @@ import com.fdkankan.manage.vo.request.CaseParam;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * <p>
@@ -61,5 +58,17 @@ public class CaseController {
         caseService.removeById(param.getId());
         return ResultData.ok();
     }
+    @GetMapping("/release")
+    public ResultData release(@RequestParam(required = false) Integer id,
+                              @RequestParam(required = false) Integer isPublic){
+        if(id == null || isPublic == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        LambdaUpdateWrapper<Case> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(Case::getId,id);
+        wrapper.set(Case::getIsPublic,isPublic);
+        caseService.update(wrapper);
+        return ResultData.ok();
+    }
 }