首页>代码>spring+spring mvc+mybatis+bootstrap框架整合搭建ssm完整项目>/Manage_ssm/src/org/lq/ssm/active/controller/TemplateController.java
package org.lq.ssm.active.controller;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Results;
import org.lq.ssm.active.service.TemplateService;
import org.lq.ssm.entity.Template;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("tem.do")
public class TemplateController {
@Resource(name="templateServiceImpl")
private TemplateService templateServiceImpl;
@RequestMapping(params="save")
public String save(Template t){
if(templateServiceImpl.save(t)){
return "redirect:tem.do?findAll";
}
return "view/marketactive/template/template_add";
}
@RequestMapping(params="findAll")
public String findAll(Model m){
List<Template> list=templateServiceImpl.findAll();
m.addAttribute("tem_list", list);
return "view/marketactive/template/template_list";
}
@RequestMapping(params="findSeq")
public String findSeq(Model m){
int count=templateServiceImpl.findSeq();
m.addAttribute("temseq_list", count);
return "view/marketactive/template/template_add";
}
@RequestMapping(params="delete")
public String delete(int id,Model m){
templateServiceImpl.delete(id);
return "redirect:tem.do?findAll";
}
@RequestMapping(params="findById")
public String findById(Integer id,HttpSession session){
session.setAttribute("tem_list", templateServiceImpl.findById(id));
return "view/marketactive/template/template_update";
}
@RequestMapping(params="update")
public String update(Template t,HttpSession session){
Template tem=(Template) session.getAttribute("tem_list");
t.setId(tem.getId());
if(templateServiceImpl.update(t)){
return "redirect:tem.do?findAll";
}
return "view/marketactive/template/template_update";
}
@RequestMapping(params="findLike")
public String findLike(Model m,String title){
m.addAttribute("tem_list", templateServiceImpl.findLike(title));
return "view/marketactive/template/template_list";
}
public void setTemplateServiceImpl(TemplateService templateServiceImpl) {
this.templateServiceImpl = templateServiceImpl;
}
}
最近下载更多
1111112222 LV6
1月8日
educationAAA LV11
2024年8月10日
WBelong LV8
2024年3月5日
weilaizhisheng LV21
2023年12月26日
shuangfu LV25
2023年12月2日
qiangmin1223 LV12
2023年4月24日
laihao2012 LV3
2023年4月1日
woshizhulei LV3
2023年2月1日
南山难 LV4
2023年1月1日
admin0108 LV9
2022年10月24日

最近浏览