首页>代码>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;
	}
	
}
最近下载更多
WBelong  LV7 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日
wsgwly  LV6 2022年6月5日
testuser1234567  LV24 2022年5月22日
最近浏览更多
3159527503  LV2 前天
jimodeai  LV15 5月5日
myfz0662  LV10 5月5日
educationAAA  LV6 5月4日
2860615178  LV2 5月1日
chirsbey2 4月17日
暂无贡献等级
saaaaaa  LV14 4月16日
xiongM  LV4 4月1日
Iterman  LV2 3月12日
ice_candy  LV1 3月12日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友