This commit is contained in:
caozehui
2025-02-14 16:24:13 +08:00
parent 25e975fbc8
commit 2c950b3ac5
4 changed files with 52 additions and 18 deletions

View File

@@ -193,7 +193,7 @@ public class AdPlanController extends BaseController {
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
@GetMapping("/analyse")
@PostMapping("/analyse")
@ApiOperation("检测数据分析")
@ApiImplicitParam(name = "planId", value = "检测计划id", required = true)
public void analyse(String planId) {

View File

@@ -43,13 +43,24 @@ public class DictTreeController extends BaseController {
private final IDictTreeService dictTreeService;
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@GetMapping("/getTree")
@ApiOperation("按照名称模糊查询字典树")
@GetMapping("/getTreeByCode")
@ApiOperation("按照code查询字典树")
@ApiImplicitParam(name = "keyword", value = "查询参数", required = true)
public HttpResult<List<DictTree>> getDictTreeByKeyword(@RequestParam String keyword) {
String methodDescribe = getMethodDescribe("getDictTreeByKeyword");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, keyword);
List<DictTree> result = dictTreeService.getDictTreeByKeyword(keyword);
public HttpResult<List<DictTree>> getTreeByCode(@RequestParam("code") String code) {
String methodDescribe = getMethodDescribe("getTreeByCode");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, code);
List<DictTree> result = dictTreeService.getTreeByCode(code);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@GetMapping("/getTreeByName")
@ApiOperation("按照name模糊查询字典树")
@ApiImplicitParam(name = "keyword", value = "查询参数", required = true)
public HttpResult<List<DictTree>> getTreeByName(@RequestParam("name") String name) {
String methodDescribe = getMethodDescribe("getTreeByName");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, name);
List<DictTree> result = dictTreeService.getTreeByName(name);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}

View File

@@ -21,12 +21,20 @@ public interface IDictTreeService extends IService<DictTree> {
//void refreshDictTreeCache();
/**
* 根据关键字查询字典树
* 根据code查询字典树
*
* @param keyword 关键字
* @param code 编码
* @return 字典树
*/
List<DictTree> getDictTreeByKeyword(String keyword);
List<DictTree> getTreeByCode(String code);
/**
* 根据name查询字典树
*
* @param name 编码
* @return 字典树
*/
List<DictTree> getTreeByName(String name);
boolean addDictTree(DictTreeParam dictTreeParam);

View File

@@ -45,9 +45,24 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
// }
@Override
public List<DictTree> getDictTreeByKeyword(String keyword) {
public List<DictTree> getTreeByCode(String code) {
List<DictTree> dictTree = this.queryTree();
this.filterTreeByName(dictTree, keyword);
if (ObjectUtil.isNotEmpty(dictTree)) {
dictTree = dictTree.stream().filter(item -> item.getCode().equals(code)).collect(Collectors.toList());
}
//this.filterTreeByName(dictTree, keyword);
return dictTree;
}
@Override
public List<DictTree> getTreeByName(String name) {
List<DictTree> dictTree = this.queryTree();
if (ObjectUtil.isNotEmpty(dictTree)) {
dictTree = dictTree.stream().filter(item -> item.getName().contains(name)).collect(Collectors.toList());
}
return dictTree;
}