我正在使用 Spring Boot 框架,并且我的回應回傳重復并反向反轉。求指教,這種情況怎么解決?
控制器端點
@GetMapping("/getPDetailsW/{W}")
public PPreviewW getPDetailsPreviewW(@PathVariable String W) {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
String nullCheckBill = "bos";
PPreviewW response = new PromoPreviewWGsm();
PPreviewInfo pPreviewInfo = listRepository.findPByW(W);
log.info(dtf.format(now) "|getPDetailsPreviewW|" W "|i?in istek at?ld?.");
response.setDisplayId(pPreviewInfo.getDISPLAY_ID());
response.setAccountCode(pPreviewInfo.getACCOUNT_CODE());
if (pPreviewInfo.W!= "bos") {
nullCheckBill = promoPreviewInfo.W;
}
if (nullCheckBill == "bos") {
response.setNEXTFLAG(Boolean.FALSE);
} else {
response.setNEXTFLAG(Boolean.TRUE);
}
return response;
}
我的 Controller 類頂部有 @RestController 注釋。
PPreviewW 回應類
@Getter
@Setter
public class PPreviewW implements Serializable {
public String DisplayId;
public String AccountCode;
}
我正在使用 lombok getter 和 setter
存盤庫類
public PPreviewInfo findPByW(String W) {
PPreviewInfo list = jdbcTemplate
.queryForObject(QueryConstants.GET_P_PREVIEW_INFOW, new Object[]{W}, new PPreviewInfoMapper());
return list;
}
@Repository 和 @Autowired 注釋位于 Repository 類的頂部。并且 QueryContants 包括我的 sql,它回傳正確的大小,例如 XXXX 和 YYYY PPreviewInfo 類
@Getter
@Setter
public class PPreviewInfo {
public String CUSTOMER_ID;
public String BILLING_ACCOUNT_CODE;
}
PPreviewInfoMapper 類
public class PPreviewInfoMapper implements RowMapper<PPreviewInfo> {
@Override
public PPreviewInfo mapRow(ResultSet rs, int i) throws SQLException {
PPreviewInfo pbn = new PPreviewInfo();
pbn.setDISPLAY_ID(rs.getString("DISPLAY_ID"));
pbn.setACCOUNT_CODE(rs.getString("ACCOUNT_CODE"));
return pbn;
}
}
回復
{"DisplayId":"XXXX","AccountCode":"YYYYYY","NEXTFLAG":true,"nextflag":true,"displayId":"XXXX","accountCode":"YYYYYY"}
uj5u.com熱心網友回復:
屬性的可見性可能會導致問題,您可以查看將它們更改為私有是否有助于解決問題:
@Getter
@Setter
public class PPreviewW implements Serializable {
private String DisplayId;
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/439930.html
