首先在controller里面加上
@RequestMapping("deleteHot")
public void deleteHot(Integer orderId,OrderBean orderBean){
hotService.deleteHot(orderId,orderBean);
}
然后跳转页面到实现类
@Override
public void deleteHot(Integer orderId,OrderBean orderBean) {
String key = "user";
String key1=""+orderBean.getUserId();
redisTemplate.opsForHash().delete(key, key1);
orderDao.deleteById(orderId);
}
最后在前台页面
function delOne(orderId) {
bootbox.confirm({
size: "small",
title: "提示",
message: "是否确认删除??",
//普通弹框
buttons: {
cancel: {
label: "取消",
className: "btn-danger glyphicon glyphicon-remove"
},
confirm: {
label: "确定",
className: "btn-success glyphicon glyphicon-ok"
}
},
callback: function (r) {
if (r) {
$.ajax({
url: "../hot/deleteHot",
type: "post",
data: {orderId: orderId},
success: function () {
bootbox.alert({
size: "small",
title: "提示",
message: "删除成功!",
buttons: {
ok: {
label: "确定",
className: "btn-success glyphicon glyphicon-ok"
}
}
});
//刷新表格:【如果有条查直接调条查方法,没有条查自己写个refresh】
searchData();
}
});
}
}
});
}
大功告成,完成删除