1.包含源程序,数据库脚本。代码和数据库脚本都有详细注释。
2.课题设计仅供参考学习使用,可以在此基础上进行扩展完善
代码已经上传github,下载地址:https://github.com/21503882/job
开发环境:
Eclipse ,MYSQL,JDK1.8,Tomcat 7
涉及技术点:
MVC模式、SpringMvc、Mybatis、Spring、bootstrap、HTML、JavaScript、CSS、JQUERY、log4j、Ajax、maven等
系统采用Mybatis框架实现ORM对象关系映射,前台JSP实现,后台springMvc映射,使用Spring框架进行整合。适合学习J2EE的一段时间的熟手,代码思路清晰,注解详细,数据库用的是mysql5.1,服务器用的tomcat7,JDK版本1.8. 编程软件Eclispe J2EE版本。是典型MVC架构,并且前后台分离
首页
就业新闻
就业新闻详细
招聘会信息
招聘文件下载
招聘信息查看
招聘详情
用户注册
就业招聘
招聘职位详情
投递简历
留言板
学生登录后台
企业用户登录
招聘信息录入
管理员登录
企业用户添加
package com.hotel.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hd123.lab.ext.type.ExtResponse;
import com.hotel.convert.RegistInfo2Member;
import com.hotel.entity.Member;
import com.hotel.pageform.RegistInfo;
import com.hotel.service.MemberService;
@Controller
@RequestMapping(value = "member", produces = "application/json;charset=utf-8")
public class MemberController {
@Autowired
MemberService memberService;
@RequestMapping(value = "/check")
public @ResponseBody ExtResponse checkLogin(HttpSession session) {
ExtResponse rsp = new ExtResponse();
if (session.getAttribute("member") != null) {
rsp.setData(Boolean.TRUE);
} else {
rsp.setData(Boolean.FALSE);
}
return rsp;
}
@RequestMapping(value = "/regist")
public @ResponseBody ExtResponse regist(@RequestBody RegistInfo bMember) {
ExtResponse rsp = new ExtResponse();
RegistInfo2Member convert = new RegistInfo2Member();
Member member = convert.convert(bMember);
if (memberService.getByName(member.getUserName()) == null) {
memberService.save(member);
} else {
List<String> msg = new ArrayList<String>();
msg.add("该账号已存在!");
rsp.setSuccess(Boolean.FALSE);
}
return rsp;
}
@RequestMapping(value = "/login")
public @ResponseBody ExtResponse login(@RequestParam(value = "userName") String userName,
@RequestParam(value = "password") String password, HttpSession session) {
ExtResponse rsp = new ExtResponse();
Member member = memberService.getByName(userName);
if (member != null) {
if (password.equals(member.getPassword())) {
session.setAttribute("member", member);
} else {
List<String> msg = new ArrayList<String>();
msg.add("账号密码错误");
rsp.setMessage(msg);
rsp.setSuccess(Boolean.FALSE);
}
} else {
List<String> msg = new ArrayList<String>();
msg.add("用户不存在");
rsp.setMessage(msg);
rsp.setSuccess(Boolean.FALSE);
}
return rsp;
}
@RequestMapping(value = "/logout")
public @ResponseBody ExtResponse logout(HttpSession session) {
ExtResponse rsp = new ExtResponse();
session.removeAttribute("member");
return rsp;
}
@RequestMapping(value = "/get")
public @ResponseBody ExtResponse getMemberInfo(HttpSession session) {
ExtResponse rsp = new ExtResponse();
Member curMember = (Member) session.getAttribute("member");
Member memberInfo = memberService.getById(curMember.getUuid());
rsp.setData(memberInfo);
return rsp;
}
@RequestMapping(value = "/editpass")
public @ResponseBody ExtResponse editPassword(@RequestParam(value = "oldPassword") String oldPassword,
@RequestParam(value = "newPassword") String newPassword, HttpSession session) {
ExtResponse rsp = new ExtResponse();
Member member = (Member) session.getAttribute("member");
try {
memberService.editPassword(oldPassword, newPassword, member);
rsp.setSuccess(Boolean.TRUE);
return rsp;
} catch (Exception e) {
rsp.setSuccess(Boolean.FALSE);
List<String> msg = new ArrayList<String>();
msg.add(e.getMessage());
rsp.setMessage(msg);
return rsp;
}
}
@RequestMapping(value = "/ticket")
public @ResponseBody ExtResponse getNumberOfTicket(HttpSession session) {
ExtResponse rsp = new ExtResponse();
Member curMember = (Member) session.getAttribute("member");
Member member = memberService.getByName(curMember.getUserName());
int number = member.getNumberOfTicket();
rsp.setData(new Integer(number));
return rsp;
}
}
代码已经上传github,下载地址:https://github.com/21503882/job