基于javaweb+jsp 的⾼校教师教职⼯管理系统
基于javaweb+jsp的⾼校教师教职⼯管理系统
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Layui Ajax
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+l)框架或SpringBoot…均可开发⼯具:eclipse/idea/myeclipse/sts等均可配置运⾏
适⽤
课程设计,⼤作业,毕业设计,项⽬练习,学习演⽰等 ps .setString (3, vo .getTeacherSex ()); ps .setString (4, vo .getTeacherAge ()); ps .setString (5, vo .getTeacherLevel ()); ps .setString (6, vo .getTeacherPosition ()); ps .setString (7, vo .getTeacherXi ()); ps .setString (8, vo .getTeacherDate ()); ps .setString (9, vo .getTeacherText ()); ps .setLong (10, vo .getId ()); ps .execute (); ps .close (); c .close (); } catch (Exception e ) { e .printStackTrace (); } } //@Override public boolean delete (long id ) { try { Connection c = Util .getConnection (); Statement s = c .createStatement (); String sql = "delete from `t_teacher` where id = " + id ; s .execute (sql ); s .close ();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24import List ;import Map ;/** * User 模块的Servlet 控制层,负责接收页⾯传过来的请求参数,根据action 参数的值来确定页⾯要执⾏的具体操作<br> * ⽽后再调⽤UserService 业务层的⽅法来处理具体的业务,最后将处理完成的结果返回或跳转⾄相应页⾯ *///@WebServlet("/UserServlet")public class UserServlet extends HttpServlet { /** * 处理Post 请求 * * @param request
1
2
3
4
5
6
7
8
9
10
11
12
13
14
User vo = userService .get (id ); request .getSession ().setAttribute ("vo", vo ); String to = "get".equalsIgnoreCase (action ) ? "info" : "edit";//判断是去详情显⽰页⾯还是编辑页⾯ response .sendRedirect ("user_" + to + ".jsp"); } else {//默认去列表页⾯ this .redirectList (request , response ); } } /** * 处理Get 请求1
2
3
4
5
6
7
8
9
10
11 return window .btoa (binary ); } layui .use ('table', function () { let table = layui .table ; table .render ({ elem : '#myData', id : 'myTable', url : 'TeacherServlet?action=list', parseData : function (res ) { //res :即为原始返回的数据 let result = this .page .curr ? res .slice (this .limit * (this .page .curr - 1), this .limit * this .page .curr ) : res .slice (0, thi
s .limit ); return { "code": 0, //解析接⼝状态 "msg": '', //解析提⽰⽂本 "count": res .length , //解析数据长度(集合个数) "data": result //解析数据列表 }; }, page : { //⽀持传⼊ laypage 组件的所有参数(某些参数除外,如:jump/elem ) - 详见⽂档 layout : ['limit', 'count', 'prev', 'page', 'next', 'skip'], //⾃定义分页布局 groups : 1, //只显⽰ 1 个连续页码 first : false , //不显⽰⾸页
1
2
3
4
5
6
7
8
9
10
11
12
13
基于java的课程设计题目14
15
16
17
18
19
20
21
22/** * Salary 模块的DAO 层(数据层)的具体实现类,对SalaryDAO 接⼝中定义的增删改查等抽象⽅法作出具体的功能实现 */public class SalaryDAOImpl implements SalaryDAO { //@Override public void add (Salary vo ) { String sql = "insert into `t_salary` (`salary_name`,`salary_no`,`salary_date`,`salary_basic`,`salary_jiang`,`salary_text`) values(?,?,?,?,?,?)"; try { Connection c = Util .getConnection ();1
2
3
4
5
6
7
8
9
10
11
let result = this .page .curr ? res .slice (this .limit * (this .page .curr - 1), this .limit * this .page .curr ) : res .slice (0, this .limit ); return { "code": 0, //解析接⼝状态 "msg": '', //解析提⽰⽂本 "count": res .length , //解析数据长度(集合个数) "data": result //解析数据列表 }; }, page : { //⽀持传⼊ laypage 组件的所有参数(某些参数除外,如:jump/elem ) - 详见⽂档 layout : ['limit', 'count', 'prev', 'page', 'next', 'skip'], //⾃定义分页布局 groups : 1, //只显⽰ 1 个连续页码 first : false , //不显⽰⾸页
1
2
3
4
5
6
7
8
9
10
11
12
let result = this .page .curr ? res .slice (this .limit * (this .page .curr - 1), this .limit * this .page .curr ) : res .slice (0, this .limit ); return { "code": 0, //解析接⼝状态 "msg": '', //解析提⽰⽂本 "count": res .length , //解析数据长度(集合个数) "data": resu
lt //解析数据列表 }; }, page : { //⽀持传⼊ laypage 组件的所有参数(某些参数除外,如:jump/elem ) - 详见⽂档 layout : ['limit', 'count', 'prev', 'page', 'next', 'skip'], //⾃定义分页布局 groups : 1, //只显⽰ 1 个连续页码 first : false , //不显⽰⾸页 last : false , //不显⽰尾页 }, toolbar : '#myToolbar', //开启头部⼯具栏,并为其绑定左侧模板 defaultToolbar : ['filter', 'exports', 'print', { //⾃定义头部⼯具栏右侧图标。如⽆需⾃定义,去除该参数即可 title : '提⽰', layEvent : 'LAYTABLE_TIPS', icon : 'layui-icon-tips' }], title : '⽤户列表', cols : [
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 console .log ("已删除!"); } }); obj .del (); //删除对应⾏(tr )的DOM 结构,并更新缓存 //load();//刷新⽗级页⾯ // layer.close(index); //load();//刷新⽗级页⾯ layer .msg (data .realName + ' 删除成功!'); // }); } else if (layEvent === 'edit') { //编辑 layer .open ({ type : 2, area : ['800px', '550px'], fixed : false , //不固定 maxmin : true , content : 'UserServlet?action=editPre&id=' + data .id 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 vo .setSalaryBasic (Util .decode (request , "salaryBasic")); vo .setSalaryJiang (Util .
decode (request , "salaryJiang")); vo .setSalaryText (Util .decode (request , "salaryText")); SalaryService salaryService = new SalaryServiceImpl (); //调⽤Service 层增加⽅法(add ),增加记录 salaryService .add (vo ); this .redirectList (request , response ); } else if ("delete".equals (action )) {//删除 //取出表要删除的⼯资记录的主键 long id = Long .parseLong (Util .decode (request , "id"));1
2
3
4
5
6
7
8
9
10
toolbar: '#myToolbar', //开启头部⼯具栏,并为其绑定左侧模板 defaultToolbar: ['filter', 'exports', 'print', { //⾃定义头部⼯具栏右侧图标。如⽆需⾃定义,去除该参数即可 title: '提⽰', layEvent: 'LAYTABLE_TIPS', icon: 'layui-icon-tips' }], title: '⽤户列表', cols: [ [ { field: 'username', title: '⽤户名', }, { field: 'realName', title: '姓名', templet: vo => (vo = vo.realName) ? '<a href ="#" style ="color : #009688;">' + vo + '</a >' : '', event: 'info', }, { field: 'userSex', title: '性别', templet: vo => vo.userSex ? vo.userSex : "",1
2
3
4
5
6
7
8
9101112131415161718192021
22
23
}}package ;
import Util ;import NoticeService ;import NoticeServiceImpl ;import Notice ;import ServletException ;import HttpServlet ;import HttpServletRequest ;import HttpServletResponse ;import IOException ;import Serializable ;import HashMap ;import List ;import Map ;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 vo .setTeacherText (rs .getString ("teacher_text")); } c .close (); } catch (Exception e ) { e .printStackTrace (); } return vo ; } //@Override public Map <String , Object > list (Map <String , Object > params ) { List <Teacher > list = new ArrayList (); int totalCount = 0; String condition = ""; String sqlList ; if (params .get ("searchColumn") != null && !"".equals (params .get ("searchColumn"))) { condition += " and `" + params .get ("searchColumn") + "` like '%" + params .get ("keyword") + "%'";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<ul class ="layui-nav layui-layout-left "></ul > <if test ="${loginUser==null}"> <ul class ="layui-nav layui-layout-right "> <li class ="layui-nav-item "><a href ="login.jsp ">请登录</a ></li > </ul > </if > <if test ="${loginUser!=null}"> <ul class ="layui-nav layui-layout-right "> <li class ="layui-nav-item "><a >${loginUser.username}</a ></li > <li class ="layui-nav-item "><a href ="AuthServlet?action=logout ">退出登录</a ></li > </ul > </if > </div >1234567891011121314 }); //头⼯具栏事件 table .on ('toolbar(myTable)', function (obj ) { if ('add' == obj .event ) { layer .msg ('添加'); layer .open ({ type : 2, area : ['800px', '550px'], fixed : false , //不固定 maxmin : true , content : 'notice_add.jsp' }); } else { //layer.alert('这是⼯具栏右侧⾃定义的⼀个图标按钮'); } }); //搜索1234567891011121314151617 String sqlCount = "select count(*) from `t_notice` where 1=1 " + condition ; ps = c .prepareStatement (sqlCount ); rs = ps .executeQuery (); if (rs .next ()) { totalCount = rs .getInt (1); } rs .close (); ps .close (); c .close (); } catch (Exception e ) { e .printStackTrace (); } Map <String , Object
> result = new HashMap (); result .put ("list", list ); result .put ("totalCount", totalCount ); return result ; }}123456789101112131415161718
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论