html代码:
<tr>
<td colspan="8" height="40px">
姓名:<input type="text" v-model="user" placeholder="请输入查询的内容" />
班级:<input type="text" v-model="cname" placeholder="请输入查询的内容" />
<input type="button" v-on:click="dataListFn(user,cname)" value="搜索"></td>
</tr>
js代码:
dataListFn:function(){
$.post("/demo/fenye",{user:this.user,cname:this.cname},function(data){
vm.sites=[];//需要定义一个数组
var len=data.content.length;
for(var i=0;i<len;i++){
vm.sites.push(dataList[i]);
}
})
},
Controller:
//分页查询
@RequestMapping(value = "fenye")
@ResponseBody
public Page<List<Map>> fenye(int pagese,String user,String cname) {
Page<List<Map>> p=spService.finAll(page,user,cname);
return p;
}
DAO里面的方法:
@Query(value="select * from user join cla on user.ccid = cla.cid "
+ " where user LIKE CONCAT('%',:user,'%') and cname LIKE CONCAT('%',:cname,'%') order by id desc",nativeQuery = true)
Page<List<Map>> findAll(String user,String cname);
️我还很喜欢你,就像sin²x+cos²x始终如一