小编Noa*_*h13的帖子

Angular 4组合来自多个HTTP请求的数据

我正在使用角度4,我尝试从2个端点获取数据,但我在理解rxjs时遇到问题.

使用此代码我只能获得学生和用户的列表.

 getStudent() {
    return this.http.get(this.url + this.student_url, this.getHeaders()).map(res => res.json());
  }

getUsers() {
    return this.http.get(this.url + this.users_url, this.getHeaders()).map(res => res.json());
  }
Run Code Online (Sandbox Code Playgroud)

让我们说这是数据:学生

[{"ID" : 1 , "SchoolCode": "A150", "UserID": 1 }, 
{"ID" : 5 , "SchoolCode": "A140" , "UserID": 3}, 
{"ID" : 9 , "SchoolCode": "C140" , "UserID": 4}]
Run Code Online (Sandbox Code Playgroud)

用户

[{"ID" : 1  ,"Name": "Rick" , "FamilyName" , "Grimes" },
{"ID" : 4 ,"Name": "Carle" , "FamilyName" , "Grimes" }]
Run Code Online (Sandbox Code Playgroud)

我想先得到所有学生,然后比较UserID,如果它与用户相同,那么我将两个对象合并为一个,直到我得到这样的数组:

{"ID" : 1 , "SchoolCode": "A150","Name": "Rick" , …
Run Code Online (Sandbox Code Playgroud)

rxjs typescript angular2-http angular

8
推荐指数
1
解决办法
3496
查看次数

QueryDSL Q类在目标文件夹中生成,但无法在其他Spring Boot模块中导入

我有多模块项目(spring boot),我在 dao 模块中配置了 QueryDSL,它运行良好,并且生成了所有 Q 类。但是,当我在服务模块中导入此模块并在 IDE (Intellij) 中导入 Q 类时,它不会显示任何错误,但在运行 mvn clean install 时,出现该类未解析的错误。

Unresolved reference: QRole
Run Code Online (Sandbox Code Playgroud)

这是 pom(dao 模块)的代码:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>com.test.test</groupId>
        <artifactId>test-api</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <version>1.0.0-SNAPSHOT</version>

    <artifactId>dao</artifactId>
    <description>Module that have repositories and entities.</description>

    <dependencies>
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- QueryDSL JPA -->
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>
            <version>${querydsl.version}</version>
        </dependency>

        <!-- Database & JPA -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <!-- Kotlin -->
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <querydsl.version>5.0.0</querydsl.version> …
Run Code Online (Sandbox Code Playgroud)

java querydsl spring-data-jpa kotlin spring-boot

2
推荐指数
1
解决办法
1979
查看次数