如上图所示,后端代码定义的id值是long类型,
onGet() {
this.udpService.getUdp(String(this.udpEntity.loanProductsId)).subscribe(value => {
const resp = value as GeneralResponse;
if ('0' === resp.code) {
this.messageService.add({severity: 'success', detail: '查询成功'});
this.udpEntity = resp.data;
} else {
this.messageService.add({severity: 'error', detail: resp.message});
}
});
}
上图是前端对应的一个接口,当获取的值有可能时一个String类型这时候传给后端的值就是一个String类型,这时候会报类型装换异常,修改前端代码如下
onGet() {
this.udpService.getUdp(this.udpEntity.loanProductsId.toString()).subscribe(value => {
const resp = value as Genera