首页>代码>ssm开发简单的学生信息管理系统,基于maven搭建>/StudentOA/src/main/java/com/hfxt/controller/ControllerOA.java
package com.hfxt.controller;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfxt.biz.OAUserdaoBiz;
import com.hfxt.pojo.OAStudent;
import com.hfxt.pojo.PagerMySQL;
import com.hfxt.pojo.UserOA;


@Controller
public class ControllerOA {
	private OAUserdaoBiz oaUserdaoBiz;
	@Resource(name = "oaUserdaoBiz")
	public void setBiz(OAUserdaoBiz oaUserdaoBiz) {
		this.oaUserdaoBiz = oaUserdaoBiz;
	}
	//登录
	@RequestMapping("/logindo")
	public ModelAndView oaLogin(HttpServletRequest request,String username,String password,Model model){
		ModelAndView modelAndView=new ModelAndView();
		UserOA userOA=oaUserdaoBiz.OaLogin(username, password);
		if(userOA!=null){
			modelAndView.addObject("userOA",userOA);
			modelAndView.addObject("mainpage",null);
			modelAndView.setViewName("/Index.jsp");
		}else{		
			request.setAttribute("error","请输入正确的用户名或密码!");		
			modelAndView.setViewName("/login.jsp");
		}
		return modelAndView;		
	}
	//Student信息查询
	@RequestMapping("StudentOAselect")
	public String getSelectMess(String text1,String text2,Model model,
			@RequestParam(value = "pageNo", defaultValue = "1") Integer curPage,
			@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize){       
		 PageHelper.startPage(curPage, pageSize);
		List<OAStudent> list=oaUserdaoBiz.getSelectMess(text1, text2);
		PageInfo<OAStudent> pageInfo = new PageInfo<OAStudent>(list);
		PagerMySQL<OAStudent> pager = new PagerMySQL<OAStudent>(
				curPage, pageSize, new Long(pageInfo.getTotal()).intValue());
		pager.setEntitiesList(list);
		if (text1!= null && text2!=null) {
			model.addAttribute("huixianName", text1);
			model.addAttribute("huixianNames", text2);
		}
		model.addAttribute("pagerBooks", pager);
		model.addAttribute("mainPage", "/StudentManager.jsp");
		return "/StudentManager.jsp";
	}
}
最近下载更多
wzb123  LV1 2023年7月4日
liaaaaaa  LV1 2023年6月24日
gecongkai  LV8 2023年6月22日
微信网友_6260196253601792  LV7 2023年6月7日
6389181  LV7 2023年6月1日
李亮  LV19 2023年3月6日
1481917707  LV4 2023年1月1日
LITIANYU084414  LV11 2023年1月1日
43093307  LV4 2022年12月16日
houxiongxiong  LV6 2022年12月16日
最近浏览更多
xiaolu-123  LV1 4月18日
自由吃柚子  LV2 3月26日
wangsheng818  LV4 2月29日
sun shike 2月28日
暂无贡献等级
KIKO666 2月21日
暂无贡献等级
3320151533  LV1 1月7日
minjing123  LV8 1月4日
微信网友_6802139027345408  LV2 2023年12月31日
微信网友_6796240543567872 2023年12月27日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友