Bladeren bron

fix 增加问题详情接口

zoujiajian 3 jaren geleden
bovenliggende
commit
cd5a9a37c4

+ 15 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/sys/HelpController.java

@@ -13,6 +13,8 @@ import com.cyksj.service.sys.SysHelpService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
+import javax.validation.constraints.NotNull;
+
 /*
  *项目名: netflix
  *文件名: HelpController
@@ -28,6 +30,7 @@ public class HelpController {
 	private final HelpQuestionClassificationMapper classificationMapper;
 
 	private final HelpQuestionMapper helpQuestionMapper;
+
 	/**
 	 * 新增问题分类
 	 */
@@ -136,6 +139,18 @@ public class HelpController {
 		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
 	}
 
+	/**
+	 * 问题详情
+	 */
+	@GetMapping("/get/question/detail")
+	private Result<HelpQuestion> getQuestionById(@NotNull Long id) {
+		if (id == null || id < 1) {
+			throw BusinessRuntimeException.getInstance("id error");
+		}
+		HelpQuestion helpQuestion = helpQuestionMapper.selectById(id);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(helpQuestion);
+	}
+
 	/**
 	 * 上下架问题
 	 */

+ 36 - 24
netflix-web/src/main/java/com/cyksj/web/controller/sys/SysConfigController.java

@@ -28,43 +28,43 @@ import javax.servlet.http.HttpServletRequest;
 @RequiredArgsConstructor
 public class SysConfigController {
 
-    private final SysConfigService sysConfigService;
+	private final SysConfigService sysConfigService;
 
 	private final HelpQuestionMapper helpQuestionMapper;
 
 	private final BeanSearcher beanSearcher;
 
-    @GetMapping("/get")
-    public Result<SysConfig> get(String key){
-        SysConfig sysConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, key).last(" limit 1"));
+	@GetMapping("/get")
+	public Result<SysConfig> get(String key) {
+		SysConfig sysConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, key).last(" limit 1"));
 
-        if (sysConfig == null) {
-            throw new BusinessRuntimeException("配置不存在");
-        }
+		if (sysConfig == null) {
+			throw new BusinessRuntimeException("配置不存在");
+		}
 
-        return GatewayResponse.SUCCESS.newBuilder().toResult(sysConfig);
-    }
+		return GatewayResponse.SUCCESS.newBuilder().toResult(sysConfig);
+	}
 
-    @PostMapping("/post")
-    public Result<SysConfig> post(@RequestBody SysConfig sysConfig){
-        sysConfigService.save(sysConfig);
+	@PostMapping("/post")
+	public Result<SysConfig> post(@RequestBody SysConfig sysConfig) {
+		sysConfigService.save(sysConfig);
 
-        return GatewayResponse.SUCCESS.newBuilder().toResult(sysConfig);
-    }
+		return GatewayResponse.SUCCESS.newBuilder().toResult(sysConfig);
+	}
 
-    @PutMapping("/update")
-    public Result<SysConfig> update(@RequestBody SysConfig sysConfig){
-        sysConfigService.updateById(sysConfig);
+	@PutMapping("/update")
+	public Result<SysConfig> update(@RequestBody SysConfig sysConfig) {
+		sysConfigService.updateById(sysConfig);
 
-        return GatewayResponse.SUCCESS.newBuilder().toResult(sysConfig);
-    }
+		return GatewayResponse.SUCCESS.newBuilder().toResult(sysConfig);
+	}
 
-    @DeleteMapping("/delete/{id}")
-    public Result<String> update(@PathVariable Long id){
-        sysConfigService.removeById(id);
+	@DeleteMapping("/delete/{id}")
+	public Result<String> update(@PathVariable Long id) {
+		sysConfigService.removeById(id);
 
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
 
 	/**
 	 * 问题分类列表
@@ -83,4 +83,16 @@ public class SysConfigController {
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
+
+	/**
+	 * 问题详情
+	 */
+	@GetMapping("/get/question/detail")
+	private Result<HelpQuestion> getQuestionById(Long id) {
+		if (id == null || id < 1) {
+			throw BusinessRuntimeException.getInstance("id error");
+		}
+		HelpQuestion helpQuestion = helpQuestionMapper.selectById(id);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(helpQuestion);
+	}
 }