小编Vio*_*ola的帖子

如何从 Number 值反序列化为 int(错误 - 没有从 Number 值反序列化的 int/Int 参数构造函数/工厂方法)

我有两个班级FlightTicket. 一个航班可以有很多票,所以Ticket有外键flight_id

这是我的数据库,其中包含表flightticket.

在此处输入图片说明

这是我的json request(来自 Mozilla 调试器),我想将其保存在数据库中。

在此处输入图片说明

您可以看到flight_id参数,但我无法将其保存到我的数据库中,我遇到了这样的错误:

at [Source: (PushbackInputStream); line: 1, column: 53] (through reference chain: dto.TicketDto["flight_id"]) DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of模型.(although at least one Creator exists): no int/Int-argument constructor/factory method to deserialize from Number value (199); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of飞行模型.飞行(although at least one …

java json foreign-keys angular

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

如何使用网格包绘制矩形

我需要在图表上绘制一个矩形以突出显示不同的变化。我需要使用grid包。我尝试使用 ,grid.rect但它不起作用。我希望我的矩形看起来像图片上的那样。

在图片的左侧,您可以看到我的图表,在图片的右侧,我添加了矩形(在 Paint 中),就像我想要的那样。

在此处输入图片说明

library(grid)
library(lattice)
library(sandwich)

data("Investment")
Investment <- as.data.frame(Investment)

trellis.par.set(theme = canonical.theme("postscript", color=FALSE))
grid.newpage()
pushViewport(viewport(x=0, width=.4, just="left"))
print(barchart(table(Investment$Interest)),
  newpage=FALSE)
popViewport()
pushViewport(viewport(x=.4, width=.5, just="left"))
print(xyplot(Investment ~ Price, data=Investment, 
         auto.key=list(space="right"),
         par.settings=list(superpose.symbol=list(pch=c(1, 3, 16),
                             fill="white"))),
  newpage=FALSE)

popViewport()
Run Code Online (Sandbox Code Playgroud)

r r-grid

5
推荐指数
0
解决办法
1583
查看次数

如何使用网格包添加箭头

我想使用grid包添加箭头,这将突出显示我的图表的重要部分.我希望箭头在右侧的图片上看起来像.

在左边的部分是我的图表由下面的代码创建,右边的部分是我的图表与箭头(我已经使用Paint添加它).这是我的目标.

在此输入图像描述

library(grid)
library(lattice)
library(sandwich)

data("Investment")
Investment <- as.data.frame(Investment)

pushViewport(plotViewport(c(5, 4, 2, 2)))
pushViewport(dataViewport(Investment$Investment, 
                      Investment$GNP,
                      name="Zaleznosc Investment od GNP"))

grid.points(Investment$Investment, Investment$GNP, gp=gpar(cex=0.5))

grid.rect()
grid.xaxis()
grid.yaxis()
grid.text("Investment", y=unit(-3, "line"))
grid.text("GNP", x=unit(-3, "line"), rot=90)
popViewport()
Run Code Online (Sandbox Code Playgroud)

plot r r-grid

5
推荐指数
1
解决办法
703
查看次数

如何在Angular中显示下拉列表从MySQL表中选择一项?

我有数据库表airline,我想显示drop down list表中的所有数据,然后能够从列表中选择一个项目.

我的桌子

在此输入图像描述

airline.ts

export class Airline {
  airline_id: number;
  name: string;
  symbol: string;
}
Run Code Online (Sandbox Code Playgroud)

我的HTML代码,但它不起作用(仅显示没有数据的下拉列表):

<mat-form-field>
  <mat-select placeholder="Airlines" [(ngModel)]="selectedValue" name="airline">
    <mat-option *ngFor="let airline of airlines" [value]="airline.name">
      {{airline.symbol}}
    </mat-option>
  </mat-select>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)

实际上它看起来像这样(列表中没有数据):

在此输入图像描述

airlineService.ts

export class AirlineService {
    private baseUrl = 'http://localhost:8080/api/airlines';

    constructor(private http: HttpClient) {
    }

    getAirline(airline_id: number): Observable<Airline> {
        return this.http.get<Airline>(`${this.baseUrl}/${airline_id}`);
    }

    getAirlinesList(): Observable<any> {
        return this.http.get(`${this.baseUrl}`);
    }
}
Run Code Online (Sandbox Code Playgroud)

航空公司,list.component.ts

export class AirlinesListComponent implements OnInit {
    airlines: Observable<Airline[]>;
    airline_id: number;
    selectedValue: string;

    @Input() airline: …
Run Code Online (Sandbox Code Playgroud)

html dropdown angular

3
推荐指数
1
解决办法
150
查看次数

标签 统计

angular ×2

r ×2

r-grid ×2

dropdown ×1

foreign-keys ×1

html ×1

java ×1

json ×1

plot ×1