基于javaEE的简单教务系统实现
Posted 你的撒凋零呦
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于javaEE的简单教务系统实现相关的知识,希望对你有一定的参考价值。
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.system.mapper.RoleMapper" > <resultMap id="BaseResultMap" type="com.system.po.Role" > <id column="roleID" property="roleid" jdbcType="INTEGER" /> <result column="roleName" property="rolename" jdbcType="VARCHAR" /> <result column="permissions" property="permissions" jdbcType="VARCHAR" /> </resultMap> <sql id="Example_Where_Clause" > <where > <foreach collection="oredCriteria" item="criteria" separator="or" > <if test="criteria.valid" > <trim prefix="(" suffix=")" prefixOverrides="and" > <foreach collection="criteria.criteria" item="criterion" > <choose > <when test="criterion.noValue" > and ${criterion.condition} </when> <when test="criterion.singleValue" > and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue" > and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue" > and ${criterion.condition} <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Update_By_Example_Where_Clause" > <where > <foreach collection="example.oredCriteria" item="criteria" separator="or" > <if test="criteria.valid" > <trim prefix="(" suffix=")" prefixOverrides="and" > <foreach collection="criteria.criteria" item="criterion" > <choose > <when test="criterion.noValue" > and ${criterion.condition} </when> <when test="criterion.singleValue" > and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue" > and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue" > and ${criterion.condition} <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Base_Column_List" > roleID, roleName, permissions </sql> <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.system.po.RoleExample" > select <if test="distinct" > distinct </if> <include refid="Base_Column_List" /> from role <if test="_parameter != null" > <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null" > order by ${orderByClause} </if> </select> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > select <include refid="Base_Column_List" /> from role where roleID = #{roleid,jdbcType=INTEGER} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > delete from role where roleID = #{roleid,jdbcType=INTEGER} </delete> <delete id="deleteByExample" parameterType="com.system.po.RoleExample" > delete from role <if test="_parameter != null" > <include refid="Example_Where_Clause" /> </if> </delete> <insert id="insert" parameterType="com.system.po.Role" > insert into role (roleID, roleName, permissions ) values (#{roleid,jdbcType=INTEGER}, #{rolename,jdbcType=VARCHAR}, #{permissions,jdbcType=VARCHAR} ) </insert> <insert id="insertSelective" parameterType="com.system.po.Role" > insert into role <trim prefix="(" suffix=")" suffixOverrides="," > <if test="roleid != null" > roleID, </if> <if test="rolename != null" > roleName, </if> <if test="permissions != null" > permissions, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="roleid != null" > #{roleid,jdbcType=INTEGER}, </if> <if test="rolename != null" > #{rolename,jdbcType=VARCHAR}, </if> <if test="permissions != null" > #{permissions,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="countByExample" parameterType="com.system.po.RoleExample" resultType="java.lang.Integer" > select count(*) from role <if test="_parameter != null" > <include refid="Example_Where_Clause" /> </if> </select> <update id="updateByExampleSelective" parameterType="map" > update role <set > <if test="record.roleid != null" > roleID = #{record.roleid,jdbcType=INTEGER}, </if> <if test="record.rolename != null" > roleName = #{record.rolename,jdbcType=VARCHAR}, </if> <if test="record.permissions != null" > permissions = #{record.permissions,jdbcType=VARCHAR}, </if> </set> <if test="_parameter != null" > <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByExample" parameterType="map" > update role set roleID = #{record.roleid,jdbcType=INTEGER}, roleName = #{record.rolename,jdbcType=VARCHAR}, permissions = #{record.permissions,jdbcType=VARCHAR} <if test="_parameter != null" > <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByPrimaryKeySelective" parameterType="com.system.po.Role" > update role <set > <if test="rolename != null" > roleName = #{rolename,jdbcType=VARCHAR}, </if> <if test="permissions != null" > permissions = #{permissions,jdbcType=VARCHAR}, </if> </set> where roleID = #{roleid,jdbcType=INTEGER} </update> <update id="updateByPrimaryKey" parameterType="com.system.po.Role" > update role set roleName = #{rolename,jdbcType=VARCHAR}, permissions = #{permissions,jdbcType=VARCHAR} where roleID = #{roleid,jdbcType=INTEGER} </update> </mapper>
package com.system.mapper; import com.system.po.Role; import com.system.po.RoleExample; import org.apache.ibatis.annotations.Param; import java.util.List; public interface RoleMapper { int countByExample(RoleExample example); int deleteByExample(RoleExample example); int deleteByPrimaryKey(Integer roleid); int insert(Role record); int insertSelective(Role record); List<Role> selectByExample(RoleExample example); Role selectByPrimaryKey(Integer roleid); int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example); int updateByExample(@Param("record") Role record, @Param("example") RoleExample example); int updateByPrimaryKeySelective(Role record); int updateByPrimaryKey(Role record); }
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html> <html> <head> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- 引入bootstrap --> <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css"> <!-- 引入JQuery bootstrap.js--> <script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></script> <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script> </head> <body> <!-- 顶栏 --> <jsp:include page="top.jsp"></jsp:include> <!-- 中间主体 --> <div class="container" id="content"> <div class="row"> <jsp:include page="menu.jsp"></jsp:include> <div class="col-md-10"> <div class="panel panel-default"> <div class="panel-heading"> <div class="row"> <h1 style="text-align: center;">添加教师信息</h1> </div> </div> <div class="panel-body"> <form class="form-horizontal" role="form" action="${pageContext.request.contextPath}/admin/addTeacher" id="editfrom" method="post"> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label">工号</label> <div class="col-sm-10"> <input type="number" class="form-control" id="inputEmail3" name="userid" placeholder="请输入学号"> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label">姓名</label> <div class="col-sm-10"> <input type="text" class="form-control" id="inputPassword3" name="username" placeholder="请输入姓名"> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label">性别</label> <div class="col-sm-10"> <label class="checkbox-inline"> <input type="radio" name="sex" value="男" checked>男 </label> <label class="checkbox-inline"> <input type="radio" name="sex" value="女">女 </label> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label">出生年份</label> <div class="col-sm-10"> <input type="date" value="1996-09-02" name="birthyear"/> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label" name="degree">学历:</label> <div class="col-sm-10"> <select class="form-control" name="degree"> <option value="本科">本科</option> <option value="硕士">硕士</option> <option value="博士">博士</option> </select> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label" name="title">职称:</label> <div class="col-sm-10"> <select class="form-control" name="title"> <option value="普通教师">普通教师</option> <以上是关于基于javaEE的简单教务系统实现的主要内容,如果未能解决你的问题,请参考以下文章基于java Springboot实现教务管理系统《视频版-建议收藏》