2022年2022年教务管理系统核心代码 .pdf
《2022年2022年教务管理系统核心代码 .pdf》由会员分享,可在线阅读,更多相关《2022年2022年教务管理系统核心代码 .pdf(18页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、UserDao package com.cissst.dao; import java.util.List; import org.apache.ibatis.session.SqlSession; import com.cissst.entity.Users; import com.cissst.utils.MyBatisUtils; public class UserDao public static Users findUserById(int userId) SqlSession session=MyBatisUtils.getSqlSession(); Users users=ses
2、sion.selectOne(findUserById,userId); MyBatisUtils.closeConn(session); return users; public static boolean delUserInfo(int userId) SqlSession session=MyBatisUtils.getSqlSession(); int flag=session.insert(delUserInfo,userId); mit(); if(flag!=0) return true; return false; public static boolean updateUs
3、erInfo(Users users) SqlSession session=MyBatisUtils.getSqlSession(); int flag=session.update(updateUserInfo, users); mit(); if(flag!=0) return true; return false; public static boolean saveUserInfo(Users user) SqlSession session=MyBatisUtils.getSqlSession(); int flag=session.insert(saveUserInfo,user
4、); mit(); if(flag!=0) return true; return false; public static ListfindWithPage() Listlist=null; try 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 18 页 - - - - - - - - - SqlSession session=MyBatisUtils.getSqlSession(); list=session.selectList(selectUserTable);
5、 MyBatisUtils.closeConn(session); catch (Exception e) return list; UserDaoMapper select * from tb_users where id=#userId select * from tb_users where username=#uname and password=#upass update tb_users set usernumber=#userNumber, username=#username,password=#password,sex=#sex, address=#address,tel=#
6、tel,qq=#qq,age=#age,remark=#remark where id=#id delete from tb_users where id=#userId insert into tb_users(usernumber,username,password,sex,address,age,tel,qq,remark) values(#userNumber,#username,#password,#sex,#address,#age,#tel,#qq,#remark) select * from tb_users 名师资料总结 - - -精品资料欢迎下载 - - - - - - -
7、 - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 18 页 - - - - - - - - - Users.java package com.cissst.entity; public class Users private Integer id; private String userNumber; private String username; private String password; private String sex; private String age; private String address; private
8、 String tel; private String qq; private String remark; public String getUserNumber() return userNumber; public Users(String userNumber, String username, String password, String sex, String age, String address, String tel, String qq, String remark) this.userNumber = userNumber; this.username = userna
9、me; this.password = password; this.sex = sex; this.age = age; this.address = address; this.tel = tel; this.qq = qq; this.remark = remark; public Users() 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 18 页 - - - - - - - - - public void setUserNumber(String userN
10、umber) this.userNumber = userNumber; public Integer getId() return id; public void setId(Integer id) this.id = id; public String getUsername() return username; public void setUsername(String username) this.username = username; public String getPassword() return password; public void setPassword(Stri
11、ng password) this.password = password; public String getSex() return sex; public void setSex(String sex) this.sex = sex; public String getAge() return age; public void setAge(String age) this.age = age; public String getAddress() return address; public void setAddress(String address) this.address =
12、address; public String getTel() return tel; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 18 页 - - - - - - - - - public void setTel(String tel) this.tel = tel; public String getQq() return qq; public void setQq(String qq) this.qq = qq; public String getRemark(
13、) return remark; public void setRemark(String remark) this.remark = remark; UserServlet.java package com.cissst.servlet; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.S
14、ervletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.cissst.dao.UserDao; import com.cissst.entity.Users; import com.google.gson.Gson; WebServlet(/use
15、rServlet) public class UserServlet extends HttpServlet 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 18 页 - - - - - - - - - Users users=null; private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest req, HttpServletResponse resp
16、) throws ServletException, IOException this.doPost(req, resp); protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException String m=req.getParameter(m);/ 获得页面中传递的参数值resp.setCharacterEncoding(utf-8); if(find.equals(m) Listlist=UserDao.findWithPage(); f
17、or(Users u:list) if(1.equals(u.getSex() u.setSex(男 ); else if(0.equals(u.getSex() u.setSex(女 ); else u.setSex(什么都不是 ); resp.getWriter().print(new Gson().toJson(list); else if(saveUserInfo.equals(m) /编写后台自定生成编号SimpleDateFormat format=new SimpleDateFormat(yyyyMMddhhmmss); String userNumber=format.form
18、at(new Date(); Users users=new Users(userNumber, req.getParameter(username), req.getParameter(password), req.getParameter(sex), req.getParameter(age), req.getParameter(address), req.getParameter(tel), req.getParameter(qq), req.getParameter(remark); if(UserDao.saveUserInfo(users) resp.getWriter().pri
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年2022年教务管理系统核心代码 2022 教务 管理 系统 核心 代码
限制150内