parent
1be6ca7e02
commit
68f5303a4c
@ -0,0 +1,35 @@
|
||||
package cn.teammodel.config.knife;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* Knife4j 接口文档配置 <br/>
|
||||
* https://doc.xiaominfo.com/knife4j/documentation/get_start.html
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
//@Profile({"dev", "test"})
|
||||
public class Knife4jConfig {
|
||||
|
||||
@Bean
|
||||
public Docket defaultApi2() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(new ApiInfoBuilder()
|
||||
.title("五育评价接口文档")
|
||||
.description("五育评价接口描述")
|
||||
.version("1.0.1")
|
||||
.build())
|
||||
.select()
|
||||
// 指定 Controller 扫描包路径
|
||||
.apis(RequestHandlerSelectors.basePackage("cn.teammodel.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
}
|
@ -1,30 +1,54 @@
|
||||
package cn.teammodel.controller;
|
||||
|
||||
import cn.teammodel.common.R;
|
||||
import cn.teammodel.model.dto.DeleteNodeDto;
|
||||
import cn.teammodel.model.dto.GetEvaluateTreeDto;
|
||||
import cn.teammodel.model.entity.EvaluationTreeNode;
|
||||
import cn.teammodel.model.dto.InsertNodeDto;
|
||||
import cn.teammodel.model.dto.UpdateNodeDto;
|
||||
import cn.teammodel.model.entity.Evaluation;
|
||||
import cn.teammodel.service.EvaluationService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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 javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author winter
|
||||
* @create 2023-11-22 15:10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/public/evaluate")
|
||||
@RequestMapping("/appraise")
|
||||
public class EvaluationController {
|
||||
@Resource
|
||||
private EvaluationService evaluationService;
|
||||
|
||||
@PostMapping("getTrees")
|
||||
public R<List<EvaluationTreeNode>> getEvaluateTree(@RequestBody GetEvaluateTreeDto getEvaluateTreeDto) {
|
||||
List<EvaluationTreeNode> tree = evaluationService.getTree(getEvaluateTreeDto);
|
||||
return R.success(tree);
|
||||
@ApiOperation(value = "获取评价树", notes = "获取评价树")
|
||||
public R<Evaluation> getEvaluateTree(@RequestBody GetEvaluateTreeDto getEvaluateTreeDto) {
|
||||
Evaluation evaluation = evaluationService.getTree(getEvaluateTreeDto);
|
||||
return R.success(evaluation);
|
||||
}
|
||||
|
||||
@PostMapping("insertNode")
|
||||
@ApiOperation(value = "新增评价树的节点")
|
||||
public R<Evaluation> insertNode(@RequestBody InsertNodeDto insertNodeDto) {
|
||||
Evaluation evaluation = evaluationService.insertNode(insertNodeDto);
|
||||
return R.success(evaluation);
|
||||
}
|
||||
@PostMapping("updateNode")
|
||||
@ApiOperation(value = "更新评价树的节点", notes = "传递更新后的节点,而不是局部更新的值")
|
||||
public R<Evaluation> updateTree(@RequestBody UpdateNodeDto updateNodeDto) {
|
||||
Evaluation evaluation = evaluationService.updateNode(updateNodeDto);
|
||||
return R.success(evaluation);
|
||||
}
|
||||
@PostMapping("deleteNode")
|
||||
@ApiOperation(value = "删除评价树的节点")
|
||||
public R<Evaluation> deleteNode(@RequestBody DeleteNodeDto deleteNodeDto) {
|
||||
// todo: 注意删除子节点
|
||||
Evaluation evaluation = evaluationService.deleteNode(deleteNodeDto);
|
||||
return R.success(evaluation);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package cn.teammodel.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author winter
|
||||
* @create 2023-11-22 16:16
|
||||
*/
|
||||
@Data
|
||||
public class DeleteNodeDto {
|
||||
// 检索需要,但是有 bug
|
||||
String schoolId;
|
||||
String periodId;
|
||||
// todo: 判断空
|
||||
String id;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.teammodel.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author winter
|
||||
* @create 2023-11-22 16:16
|
||||
*/
|
||||
@Data
|
||||
public class InsertNodeDto {
|
||||
// 检索需要,但是有 bug
|
||||
String schoolId;
|
||||
String periodId;
|
||||
@ApiModelProperty(value = "父亲节点,不传则为根节点")
|
||||
String pid;
|
||||
String name;
|
||||
String logo;
|
||||
Integer order;
|
||||
boolean isPraise;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.teammodel.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author winter
|
||||
* @create 2023-11-22 16:16
|
||||
*/
|
||||
@Data
|
||||
public class UpdateNodeDto {
|
||||
// 检索需要,但是有 bug
|
||||
String schoolId;
|
||||
String periodId;
|
||||
String id;
|
||||
String name;
|
||||
String logo;
|
||||
Integer order;
|
||||
boolean isPraise;
|
||||
}
|
Binary file not shown.
Loading…
Reference in new issue