小程序端JS
onQuery: function() {
var a=1;
wx.request({
url: 'http://localhost:8081/excelData/getwe?id='+a,//模拟查询id为1的数据
header: {
'content-type': 'application/json' // 默认值
},
success: res => {
console.log(res.data)
},
})
},
JAVA后台Control
@RestController
@RequestMapping("/weDemo")
public class WeDemoControl {
@Autowired
private StudentService studentService;
@RequestMapping(value = "/getwe")
public List<Student> getstus(String id){
List<Student> students= studentService.getStus(id);
return students;
}
}