|
@@ -0,0 +1,55 @@
|
|
|
+package com.fdkankan.fusion.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.fdkankan.fusion.common.ResultCode;
|
|
|
+import com.fdkankan.fusion.common.ResultData;
|
|
|
+import com.fdkankan.fusion.entity.CaseSettings;
|
|
|
+import com.fdkankan.fusion.exception.BusinessException;
|
|
|
+import com.fdkankan.fusion.service.ICaseSettingsService;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2022-12-14
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/fusion/caseSettings")
|
|
|
+public class CaseSettingsController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ICaseSettingsService caseSettingsService;
|
|
|
+
|
|
|
+ @GetMapping("/info")
|
|
|
+ public ResultData info(@RequestParam(required = false) Integer caseId){
|
|
|
+ if(caseId == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ return ResultData.ok(caseSettingsService.getByCaseId(caseId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/saveOrUpdate")
|
|
|
+ public ResultData saveOrUpdate(@RequestBody CaseSettings caseSettings){
|
|
|
+ if(caseSettings.getCaseId() == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ if(caseSettings.getSettingsId() == null ){
|
|
|
+ List<CaseSettings> list = caseSettingsService.getByCaseId(caseSettings.getCaseId());
|
|
|
+ if(list.size() >0){
|
|
|
+ throw new BusinessException(ResultCode.CASE_HAVE_SETTINGS);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ caseSettingsService.saveOrUpdate(caseSettings);
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|