java如何在HTML中获取@Transient值
我想从HTML中获取@Transient值。我试过@Basic,它在db中创建条目。我需要得到这个值
Pojo:
@Transient
private int dueAmount;
public int getDueAmount() {
return dueAmount = this.getPaymentTotal() - this.getBillAmount() - this.getDiscountTotal();
}
public void setDueAmount(int dueAmount) {
this.dueAmount = dueAmount;
}
控制器
@RequestMapping(value="/billByPatientId/{id}", method = RequestMethod.GET)
public List<Bill> getBillsByPatientId(@PathVariable("id") String patientId)throws Exception {
List<Bill> BillDetailsByPatientId = billService.getBillsByPatientId(patientId);
for(Bill b : BillDetailsByPatientId){
System.out.println(b.getDueAmount());
}
return billService.getBillsByPatientId(patientId);
}
Js
$http.get('/bill/billByPatientId/'+patientData.id)
.success(function (data, status, headers, config) {
console.log(data)
$scope.bills = data;
});
HTML
<table data-ng-show='bills.length > 0' class="table table-hover">
<thead>
<tr>
<th class="col-lg-1 text-center">Bill No</th>
<th class="col-lg-3 text-center">Status</th>
</tr>
</thead>
<tr data-ng-repeat="bill in bills">
<td class="text-center">{{bill.billNo}}</td>
<td class="text-right">{{bill.dueAmount}}</td>
</tr>
在我当前的代码中,由于在我的控制器中打印“dueamunt”,所以我得到了“dueamunt”值,否则值将为null
如何做到这一点
我参考this文件
共 (0) 个答案