执行更新的操作时,根据前台传来的 id ,选中数据库里的数据信息,然后根据前台传来的type确定要执行的操作。
public String indexHomeCRUD(HttpServletRequest request, Integer t_id, String type) {
Template temp =
templateMapper.selectByPrimaryKey(t_id);/// 选中对应id的数据
request.setAttribute(
"temp",temp);/// 把取出的值 放入 temp
if(type.equals(
"change")){ ///根据不同的tpye 跳转不同的页面
return "alterhome";
///把并且把值带过去
}
else if(type.equals(
"read")){
return "inspecthome";
///
}
else if(type.equals(
"delete")){
return "deletehome";
}
else{
return "";
}
}
具体的增删改查还是对应页面的功能语句去处理,以上只是执行分类和赋值操作