I want to send 2 values from angular to spring boot API, in spring boot API there is a query which is accepting some parameter which I have hardcoded, but want to send that parameter from angular in that query So as given in query there are two parameters, so want to post this parameter to API from angular and get data in angular according to that parameter passed,
this is the daoimpl in which query has 2 arguments
@Override
public List<ThingworxStoreDeviceConnStatusBean> getStoreDS() {
System.out.println("ThingworxDaoImp is runing" + "\\getStoreDS");
String Query = "select * from ncr_store_connectivity_info('28152','0002')";
System.out.println("Query getAllStores::" + Query);
List<ThingworxStoreDeviceConnStatusBean> thingworxModelList = jdbcTemplate.query(Query, new RowMapper<ThingworxStoreDeviceConnStatusBean>() {
@Override public ThingworxStoreDeviceConnStatusBean mapRow(ResultSet rs, int rowNum)throws SQLException {
ThingworxStoreDeviceConnStatusBean mThingworxStoreDeviceConnStatusBean = new ThingworxStoreDeviceConnStatusBean();
mThingworxStoreDeviceConnStatusBean.setConnected(rs.getInt("connected"));
mThingworxStoreDeviceConnStatusBean.setDisconnected(rs.getInt("disConnected"));
mThingworxStoreDeviceConnStatusBean.setTotal(rs.getInt("total"));
mThingworxStoreDeviceConnStatusBean.setConnected_per(rs.getString("connected_per"));
return mThingworxStoreDeviceConnStatusBean;
}
});
return thingworxModelList;
}
and this fronthand code where I am getting data from API
getTotalDevice() {
this.users2 = this
._dataService
.getCustomerInfo()
.subscribe((result2) => {
this.users2 = result2
console.log("total subset1" + result2);
// LOGIC FOR SPLITING ARRAY
for (let i = 0; i < this.users2.length; i++) {
this.Jsonobj3 = this.users2[i];
console.log("json " + JSON.stringify(this.Jsonobj3));
this.Connect_Total = this.Jsonobj3['connected'];
console.log("inside loop connected" + this.Connect_Total[i]);
this.DisConnect_Total = this.Jsonobj3['disconnected'];
this.totalSubset = this.Jsonobj3['total'];
this.Connected_per = this.Jsonobj3['connected_per'];
this.Discoonected_per = 100 - this.Connected_per;
}
console.log("result array" + this.DisConnect_Total);
console.log("connected total" + this.Connect_Total);
console.log("total subset" + this.totalSubset);
console.log("Connected_per" + this.Connected_per);
console.log("disconnecetd per" + this.Discoonected_per)
this.ConnectMethod(this.Connect_Total);
// this.options.series[0]['data']=this.Connect_Total
Highcharts.chart('card', this.options);
Highcharts.chart('card', this.options1);
// console.log(result2)
// if (result2) {
// this.user2 = result2;
// console.log(this.user2[0].ncr_customer_info.split(','));
// var splittedArray = this.user2[0].ncr_customer_info.split(',');
// for (var i = 0; i < splittedArray.length; i++) {
// this.globalObj[i] = splittedArray[0].value;
// }
// console.log("connected" +this.globalObj);
// }
}, (error) => {})