09041612:编写规则引擎要调用的接口

master
冷调 2024-09-04 16:12:43 +08:00
parent 0559ebb209
commit f2e65ffd1f
3 changed files with 18 additions and 8 deletions

View File

@ -252,7 +252,7 @@ public class TableInfoController {
/**
* parentId
* @param id id
* @return
* @return tableInfo
*/
@PostMapping("/findTableIdByParentId/{id}")
@Operation(summary = "根据parentId向下查询出子表" , description = "根据parentId向下查询出子表")
@ -264,16 +264,14 @@ public class TableInfoController {
/**
* parentId
* @param id id
* @param parentId id
* @return
*/
@PostMapping("/findTableByStructure/{id}")
@PostMapping("/findTableByStructure/{parentId}")
@Operation(summary = "根据parentId向下查询出子表" , description = "根据parentId向下查询出子表")
public Result<List<Structure>> findTableByStructure(@PathVariable("id") Long id) {
List<Long> structureIds = tableInfoService.findTableIdByParentId(id);
List<TableInfo> tableInfoList=tableInfoService.listByIds(structureIds);
List<Long> tableInfoIds=tableInfoList.stream().map(TableInfo::getId).collect(Collectors.toList());
List<Structure> structureList = structureService.listByIds(tableInfoIds);
public Result<List<Structure>> findTableByStructure(@PathVariable("parentId") Long parentId) {
List<Long> structureIds = structureService.findTableIdByStructureId(parentId);
List<Structure> structureList=structureService.listByIds(structureIds);
return Result.success(structureList);
}
}

View File

@ -6,12 +6,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.source.domain.Structure;
import com.muyu.source.mapper.StructureMapper;
import com.muyu.source.service.StructureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure> implements StructureService {
@Autowired
private StructureMapper structureMapper;
@Override
public List<Structure> findStructureList(Long id) {
@ -28,5 +31,13 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
List<Structure> list = this.list(structureLambdaQueryWrapper);
return list;
}
@Override
public List<Long> findTableIdByStructureId(Long parentId) {
List<Long> list = structureMapper.selectObjs(new LambdaQueryWrapper<>() {{
eq(Structure::getId, parentId);
}});
return list;
}
}

View File

@ -11,4 +11,5 @@ public interface StructureService extends IService<Structure> {
List<Structure> findStructurelistS(Integer id);
List<Long> findTableIdByStructureId(Long parentId);
}