教务管理系统是一种基于计算机技术的信息管理系统,主要用于学校、教育机构等管理教务事务。其功能包括但不限于:
主要分为三类角色:管理员、教师和学生
系统管理:包括用户管理、角色管理、权限管理、通知管理等。
信息管理:包括学生信息、教师信息、基本课程管理、班级信息等。
课程管理:包括课程信息(管理员)。
信息报表:包括成绩报表、人数报表。
教务管理系统的好处是提高了工作效率,减轻了管理人员的工作负担,方便了学生和教师的信息查询与交流,同时也提高了教育教学的质量
Constants:
package com.jubilantz.controller;
public interface Constants {
public static final String LOGIN_USER = "login_user";
public static final String LOGIN_USER_PERS = "user_pers";
public static final String VALIDATE_CODE = "validateCode";
public static final String RANDOM_CODE = "randomCode";
public static final String CODE_ERROR = "randomCodeError";
//在个人资料位置用到过 数据库更改会有一点影响
public static final String STUDENT = "学生";
public static final String TEACHER = "教师";
}
EasBaseCourseController:
package com.jubilantz.controller;
import com.jubilantz.entity.EasBaseCourse;
import com.jubilantz.entity.EasClass;
import com.jubilantz.services.EasBaseCourseService;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author awei
* @Date: 2023/5/20 21:40
*/
@Controller
@RequestMapping("/easBaseCourse")
public class EasBaseCourseController {
@Autowired
private EasBaseCourseService easBaseCourseService;
@RequestMapping("/index")
public String index() throws Exception {
return "system/baseCourse/index";
}
@RequestMapping("/list")
@ResponseBody
public Map list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasBaseCourse easBaseCourse) throws Exception{
Map map = new HashMap<>();
int count = easBaseCourseService.getCount();
// System.out.println("总行数:"+count);
PageUtil pageUtil = new PageUtil(page,limit);
List list = easBaseCourseService.getList(easBaseCourse,pageUtil);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
@RequestMapping("/baseCourseAddForm")
public String baseCourseAddForm() throws Exception {
return "system/baseCourse/baseCourseAddForm";
}
@RequestMapping(value = "/addBaseCourse",method = RequestMethod.POST)
@ResponseBody
public Map addBaseCourse(EasBaseCourse easBaseCourse) throws Exception{
Map map = new HashMap<>();
// System.out.println("我是基本课程名称:"+easBaseCourse.getCoursename());
// System.out.println("我是基本课程简介:"+easBaseCourse.getSynopsis());
List list = easBaseCourseService.findBaseCourseName(easBaseCourse.getCoursename());
if (list.size() != 0){
map.put("msg","基本课程已存在");
map.put("result",false);
}else if(easBaseCourse.getCoursename().length() <= 0){
map.put("msg","课程名称不能为空");
map.put("result",false);
}else{
//课程为null也可以添加 待完善
easBaseCourseService.addBaseCourse(easBaseCourse);
map.put("msg","添加成功");
map.put("result",true);
}
return map;
}
@RequestMapping("/batchDeleteBaseCourse")
@ResponseBody
@RequiresPermissions("basecourse:delete")
public Map batchDeleteBaseCourse(Integer[] ids) throws Exception{
Map map = new HashMap();
easBaseCourseService.batchDeleteBaseCourse(ids);
map.put("msg","删除成功");
map.put("result",true);
return map;
}
@RequestMapping(value = "/getBaseCourseView")
@ResponseBody
public EasBaseCourse getBaseCourseView(Integer id) throws Exception {
return easBaseCourseService.getBaseCourseView(id);
}
@RequestMapping(value = "/editBaseCourse",method = RequestMethod.POST)
@ResponseBody
public Map editBaseCourse(EasBaseCourse easBaseCourse) throws Exception{
Map map = new HashMap<>();
easBaseCourseService.updateBaseCourse(easBaseCourse);
map.put("result",true);
return map;
}
@RequestMapping("/search")
@ResponseBody
public List search() throws Exception{
return easBaseCourseService.getAll();
}
}
EasClassController:
package com.jubilantz.controller;
import com.jubilantz.entity.EasClass;
import com.jubilantz.services.EasClassService;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author awei
* @Date: 2023/5/23 12:35
*/
@Controller
@RequestMapping("/easClass")
public class EasClassController {
@Autowired
private EasClassService easClassService;
@RequestMapping("/search")
@ResponseBody
public List search() throws Exception{
return easClassService.getAll();
}
@RequestMapping("/index")
public String index() throws Exception {
return "system/class/index";
}
@RequestMapping("/list")
@ResponseBody
public Map list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasClass easClass) throws Exception{
Map map = new HashMap<>();
int count = easClassService.getCount();
// System.out.println("总行数:"+count);
PageUtil pageUtil = new PageUtil(page,limit);
List list = easClassService.getList(easClass,pageUtil);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
@RequestMapping("/classForm")
public String classForm() throws Exception {
return "system/class/classForm";
}
@RequestMapping(value = "/addClass",method = RequestMethod.POST)
@ResponseBody
public Map addClass(EasClass easClass) throws Exception{
Map map = new HashMap<>();
// System.out.println("我是基本课程名称:"+easBaseCourse.getCoursename());
// System.out.println("我是基本课程简介:"+easBaseCourse.getSynopsis());
List list = easClassService.findClassName(easClass.getClasses());
if (list.size() != 0){
map.put("msg","班级已存在");
map.put("result",false);
}else if(easClass.getClasses().length() <= 0){
map.put("msg","班级不能为空");
map.put("result",false);
}else{
//课程为null也可以添加 待完善
easClassService.addClass(easClass);
map.put("msg","添加成功");
map.put("result",true);
}
return map;
}
@RequestMapping("/batchDeleteClass")
@ResponseBody
@RequiresPermissions("class:delete")
public Map batchDeleteClass(Integer[] ids) throws Exception{
Map map = new HashMap();
// System.out.println("前台传来的为:"+ids);
easClassService.batchDeleteClass(ids);
map.put("msg","删除成功");
map.put("result",true);
return map;
}
@RequestMapping(value = "/getClassView")
@ResponseBody
public EasClass getClassView(Integer id) throws Exception {
return easClassService.getClassView(id);
}
@RequestMapping(value = "/editClass",method = RequestMethod.POST)
@ResponseBody
public Map editClass(EasClass easClass) throws Exception{
Map map = new HashMap<>();
easClassService.updateClass(easClass);
map.put("result",true);
return map;
}
}
EasCourseController:
package com.jubilantz.controller;
import com.jubilantz.entity.EasCourse;
import com.jubilantz.entity.EasStudent;
import com.jubilantz.entity.EasTeacher;
import com.jubilantz.entity.EasUser;
import com.jubilantz.mappers.EasCourseMapper;
import com.jubilantz.services.EasCourseService;
import com.jubilantz.services.EasStudentService;
import com.jubilantz.services.EasTeacherService;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author awei
* @Date: 2023/5/21 21:40
*/
@Controller
@RequestMapping("/easCourse")
public class EasCourseController {
@Autowired
private EasCourseService easCourseService;
@Autowired
private EasTeacherService easTeacherService;
@Autowired
private EasStudentService easStudentService;
@RequestMapping("/adminIndex")
@RequiresPermissions("course:adminIndex")
public String adminIndex() throws Exception {
return "system/course/adminCourseIndex";
}
@RequestMapping("/studentIndex")
@RequiresPermissions("course:studentIndex")
public String studentIndex() throws Exception {
return "system/course/studentCourseIndex";
}
@RequestMapping("/teacherIndex")
@RequiresPermissions("course:teacherIndex")
public String teacherIndex() throws Exception {
return "system/course/teacherCourseIndex";
}
@RequestMapping("/courseAddForm")
public String courseAddForm() throws Exception{
return "system/course/courseAddForm";
}
@RequestMapping("/courseEditForm")
public String courseEditForm() throws Exception{
return "system/course/courseEditForm";
}
@RequestMapping("/getCourseList")
@ResponseBody
public Map getCourseList(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasCourse easCourse) throws Exception{
Map map = new HashMap<>();
int count = easCourseService.getCount();
// System.out.println("总行数:"+count);
PageUtil pageUtil = new PageUtil(page,limit);
List list = easCourseService.getList(easCourse,pageUtil);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
@RequestMapping("/baseCourseAddForm")
public String baseCourseAddForm() throws Exception {
return "system/baseCourse/baseCourseAddForm";
}
@RequestMapping(value = "/addCourse",method = RequestMethod.POST)
@ResponseBody
public Map addCourse(EasCourse easCourse) throws Exception{
Map map = new HashMap<>();
// System.out.println("课程id:"+easCourse.getBaseCourseId());
// System.out.println("教师id:"+easCourse.gettId());
int res = 0;
//查询是否有课程对应老师
List list = easCourseService.findCourseByBaseCourseIdAndTeacherId(easCourse.getBaseCourseId(),easCourse.gettId());
if(easCourse.gettId() == null || easCourse.getBaseCourseId() == null){
map.put("msg","课程名称和教师姓名不能为空");
map.put("result",false);;
} else if (list.size() != 0){
//判断老师是否已经选择该课程
map.put("msg","课程已存在");
map.put("result",false);;
}
else if(easCourse.getId() == null || easCourse.getId().equals("")){
try {
res = easCourseService.addCourse(easCourse);
} catch (Exception e) {
e.printStackTrace();
// System.out.println("添加失败!");
map.put("msg","添加失败");
map.put("result",false);;
}
if (res > 0){
map.put("msg","添加成功");
map.put("result",true);
}else {
map.put("msg", "添加失败");
map.put("result", false);
}
}else{
map.put("msg","添加失败,ID已经存在,请联系管理员");
map.put("result",false);
}
return map;
}
@RequestMapping(value = "/getCourseById")
@ResponseBody
public EasCourse getCourseById(Integer id) throws Exception {
EasCourse easCourse = easCourseService.getCourseById(id);
// System.out.println("课程id为:"+id);
// System.out.println("根据id查到的课程名称为:"+easCourse.getCourseName());
return easCourse;
}
@RequestMapping(value = "/editCourse",method = RequestMethod.POST)
@ResponseBody
public Map editCourse(EasCourse easCourse) throws Exception{
Map map = new HashMap<>();
// System.out.println("id到底是不是null:"+easCourse.getId());
// System.out.println("开始日期:"+easCourse.getStartDate());
// System.out.println("结束日期:"+easCourse.getEndDate());
if(easCourse.getId() != null){
easCourseService.updateCourseById(easCourse);
// easCourseMapper.updateDate(easCourse.getId(),startDate,endDate);
map.put("result",true);
}else{
map.put("result",false);
}
return map;
}
@RequestMapping("/batchDeleteCourse")
@ResponseBody
@RequiresPermissions("course:adminDelete")
public Map batchDeleteCourse(Integer[] ids) throws Exception{
Map map = new HashMap();
try{
easCourseService.batchDeleteCourse(ids);
map.put("msg","删除成功");
map.put("result",true);
}catch (Exception e){
e.printStackTrace();
map.put("result",false);
}
return map;
}
/**
* 返回教师自己教的课程列表
*/
@ResponseBody
@RequestMapping(value="/getMyCourseList")
public Map getMyCourseList(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit) {
Map map = new HashMap<>();
//获取用户信息
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
String username = easUser.getUsername();
// System.out.println("教师用户名为:"+username);
EasTeacher easTeacher = easTeacherService.findTeacherByUsername(username);
if (easTeacher.getUsername() == null || easTeacher.getUsername().equals("")){
map.put("code",1);
map.put("msg","您还没有教授课程");
}else{
// System.out.println("教师id为:"+easTeacher.getId());
int count = easCourseService.getCountBytId(easTeacher.getId());
PageUtil pageUtil = new PageUtil(page,limit);
List list = easCourseService.getCourseListBytId(easTeacher.getId(),pageUtil);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
}
return map;
}
@RequestMapping(value="/complete")
@ResponseBody
public Map complete(EasCourse easCourse) {
Map map = new HashMap<>();
if(easCourse.getComplete() == 1){
map.put("code",1);
map.put("msg","课程已结束,无需再结束");
}else{
int res = easCourseService.completeCourse(easCourse);
if (res > 0) {
map.put("code",0);
}else{
map.put("code",2);
map.put("msg","出错了");
}
}
return map;
}
/**
* 返回可选课程列表(可选:人数未满、课程开始时间在当前时间之后)
* @param page
* @param limit
* @param isAll
* @param searchKey
* @return
*/
@RequestMapping(value="/choiceList")
@ResponseBody
public Map getCourseChoiceList(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue="1") int isAll,
@RequestParam(defaultValue="")String searchKey) throws Exception {
Map map = new HashMap<>();
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
String username = easUser.getUsername();
// System.out.println("教师用户名为:"+username);
EasStudent easStudent = easStudentService.getStudentByUsername(username);
if (easStudent.getUsername() == null || easStudent.getUsername().equals("")){
map.put("code",1);
map.put("msg","目前还没有选课信息");
}else{
PageUtil pageUtil = new PageUtil(page,limit);
int sId = easStudent.getId();
int count = easCourseService.getTotalItemsCountBySid(isAll, searchKey, sId);
List list = easCourseService.getCourseListBySid(isAll, searchKey, sId,pageUtil);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
}
return map;
}
}
EasEchartController:
package com.jubilantz.controller;
import com.jubilantz.entity.EasBaseCourse;
import com.jubilantz.services.EasBaseCourseService;
import com.jubilantz.services.EasCourseService;
import com.jubilantz.services.EasStudentService;
import com.jubilantz.services.EasTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.Map;
/**
* @Author JubilantZ
* @Date: 2021/4/29 18:29
*/
@RequestMapping("/easEchart")
@Controller
public class EasEchartController {
@Autowired
private EasStudentService easStudentService;
@Autowired
private EasTeacherService easTeacherService;
@Autowired
private EasCourseService easCourseService;
@Autowired
private EasBaseCourseService easBaseCourseService;
@RequestMapping("/scoreEchart")
public String scoreEchart(){
return "echarts/ScoreEcharts";
}
@RequestMapping("/peopleEchart")
public String peopleEchart(){
return "echarts/peopleEcharts";
}
@RequestMapping("/getAllStuAndTea")
@ResponseBody
public Map getAllStuAndTea(){
Map map = new HashMap<>();
int totalStu = easStudentService.getTotal();
int totalTea = easTeacherService.getTotal();
// System.out.println("教师总行数---->"+totalTea);
map.put("totalStu",totalStu);
map.put("totalTea",totalTea);
map.put("code",0);
map.put("msg","我是返回的内容");
return map;
}
@RequestMapping("/getAllSex")
@ResponseBody
public Map getAllSex(){
Map map = new HashMap<>();
int totalMan = easStudentService.getTotalSex("男");
int totalWoman = easStudentService.getTotalSex("女");
map.put("totalMan",totalMan);
map.put("totalWoman",totalWoman);
map.put("code",0);
map.put("msg","我是返回的内容");
return map;
}
@RequestMapping("/getAllClassScore")
@ResponseBody
public Map getAllClassScore(Integer baseCourseId) throws Exception {
Map map = new HashMap<>();
// System.out.println("基础课程id为:"+baseCourseId);
//根据基本课程id 和是否结束 来获取每门课程 合格条数 和不合格条数
EasBaseCourse easBaseCourse = easBaseCourseService.getBaseCourseById(baseCourseId);
String coursename = easBaseCourse.getCoursename();
int totalPass = easCourseService.getTotalPass(baseCourseId);
int totalNoPass = easCourseService.getTotalNoPass(baseCourseId);
// if(totalPass != 0 && totalNoPass !=0 ){
if(totalPass != 0 || totalNoPass != 0 ){
map.put("coursename",coursename);
map.put("totalPass",totalPass);
map.put("totalNoPass",totalNoPass);
// System.out.println("通过人数:"+totalPass);
// System.out.println("未通过人数:"+totalNoPass);
// System.out.println("coursename:"+coursename);
}else {
map.put("coursename",coursename);
map.put("totalPass",0);
map.put("totalNoPass",0);
// System.out.println("通过人数:"+totalPass);
// System.out.println("未通过人数:"+totalNoPass);
}
return map;
}
}
EasLoginController:
package com.jubilantz.controller;
import com.jubilantz.entity.EasPermission;
import com.jubilantz.entity.EasUser;
import com.jubilantz.mappers.EasPermissionMapper;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author JubilantZ
* @Date: 2021/4/8 15:40
*/
@Controller
@RequestMapping("/easLogin")
public class EasLoginController {
@Autowired
private EasPermissionMapper easPermissionMapper;
@RequestMapping("/main")
public String main() throws Exception{
return "main";
}
// @RequestMapping("/home")
// public String home() throws Exception{
// return "system/home/homePage";
// }
@RequestMapping("/success")
@ResponseBody
public Map success(HttpSession session) throws Exception{
Map map = new HashMap<>();
map.put("code",0);
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();
session.setAttribute(Constants.LOGIN_USER,easUser);
List list = easPermissionMapper.getPersByUserId(easUser.getId());
session.setAttribute(Constants.LOGIN_USER_PERS,list);
return map;
}
@RequestMapping(value = "/login",method = RequestMethod.GET)
public String login() throws Exception{
return "login";
}
/**
* post方式的login方式什么时候调用?
* 身份认证失败的时候会自动调用
* @return
* @throws Exception
*/
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public Map login(HttpServletRequest request) throws Exception{
Map map = new HashMap<>();
// System.out.println("认证失败了吧!来我这了吧");
String exceptionName = request.getAttribute("shiroLoginFailure").toString();
if (exceptionName.equals(UnknownAccountException.class.getName())){
map.put("code",1);
map.put("msg","用户名不正确");
return map;
}else if(exceptionName.equals(IncorrectCredentialsException.class.getName())){
map.put("code",2);
map.put("msg","密码不正确");
return map;
}else if (exceptionName.equals("randomCodeError")){
map.put("code",3);
map.put("msg","验证码不正确");
return map;
}
return null;
}
}
EasMainController:
package com.jubilantz.controller;
import com.jubilantz.entity.EasNotice;
import com.jubilantz.entity.EasUser;
import com.jubilantz.services.EasNoticeService;
import com.jubilantz.services.EasUserService;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author JubilantZ
* @Date: 2021/4/28 20:25
*/
@RequestMapping("/main")
@Controller
public class EasMainController {
@Autowired
private EasNoticeService easNoticeService;
@Autowired
private EasUserService easUserService;
@RequestMapping("/homePage")
public String homePage() throws Exception{
return "system/home/homePage";
}
// @RequestMapping(value="/getNotice",method = RequestMethod.GET)
// @ResponseBody
// public Map getNotice(@RequestParam(defaultValue = "1") Integer page,
// @RequestParam(defaultValue = "2") Integer limit,
// EasNotice easNotice) throws Exception {
// Map map = new HashMap<>();
//
System.out.println("模糊查询的内容为:"+easNotice.getContent());
//
// EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
//
// //判断用户有没有 角色 有就返回角色id 没有就返回1000
//
// Integer roleId = easUserService.findRoleIdByUserId(easUser.getId());
//
//
// String strRoleId =roleId +"";
System.out.println("roleId:"+roleId);
System.out.println("strRoleId:"+strRoleId);
// PageUtil pageUtil = new PageUtil(page,limit);
//
// //没有角色
// if(roleId == null || !(strRoleId.length() >0 || roleId == 2)){//全体可见的部分公告,没要求
// //type = 1 全员可见 type = 2 教师可见 type = 3 草稿 管理员可见
// int type = 1;
// int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
// pageUtil.setTotal(count);
// pageUtil.setCount(limit);
// int totalPage = pageUtil.getTotalPage();
System.out.println("总页数为"+totalPage);
//
// List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//
// map.put("totalPage",totalPage);
// map.put("count",count);
// map.put("data",list);
// map.put("code",0);
// map.put("msg","");
// }else if(roleId == 3){//增加教师公告可见
// int type = 2;
// int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
// List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
// pageUtil.setTotal(count);
// pageUtil.setCount(limit);
// int totalPage = pageUtil.getTotalPage();
System.out.println("总页数为"+totalPage);
//
// map.put("totalPage",totalPage);
// map.put("count",count);
// map.put("data",list);
// map.put("code",0);
// map.put("msg","");
// }else{//管理员可见全部
// int type = 3;
// int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
// List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//
// pageUtil.setTotal(count);
// pageUtil.setCount(limit);
// int totalPage = pageUtil.getTotalPage();
//
// map.put("totalPage",totalPage);
//
// map.put("count",count);
// map.put("data",list);
// map.put("code",0);
// map.put("msg","");
// }
//
// return map;
// }
@RequestMapping(value="/getNotice",method = RequestMethod.GET)
@ResponseBody
public Map getNotice(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "2") Integer limit,
EasNotice easNotice) throws Exception {
Map map = new HashMap<>();
// System.out.println("模糊查询的内容为:"+easNotice.getContent());
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
//判断用户有没有 角色 有就返回角色id 没有就返回1000
List rolelist = easUserService.findRoleIdByUserId2(easUser.getId());
PageUtil pageUtil = new PageUtil(page,limit);
if(rolelist.size() >= 2){
int type = 3;
int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
pageUtil.setTotal(count);
pageUtil.setCount(limit);
int totalPage = pageUtil.getTotalPage();
map.put("totalPage",totalPage);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
}else {
if(rolelist.size() == 0 || rolelist.get(0) == 2){
//type = 1 全员可见 type = 2 教师可见 type = 3 草稿 管理员可见
int type = 1;
int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
pageUtil.setTotal(count);
pageUtil.setCount(limit);
int totalPage = pageUtil.getTotalPage();
// System.out.println("总页数为"+totalPage);
List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
map.put("totalPage",totalPage);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
}else if(rolelist.get(0) == 3) {
int type = 2;
int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
pageUtil.setTotal(count);
pageUtil.setCount(limit);
int totalPage = pageUtil.getTotalPage();
// System.out.println("总页数为"+totalPage);
map.put("totalPage",totalPage);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
}else{
int type = 3;
int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
pageUtil.setTotal(count);
pageUtil.setCount(limit);
int totalPage = pageUtil.getTotalPage();
map.put("totalPage",totalPage);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
}
}
return map;
}
//点击查看具体通知
@RequestMapping(value="/lookNotice")
public ModelAndView look(Integer id){
ModelAndView modelAndView = new ModelAndView();
// System.out.println("我是通知id:"+id);
List list = easNoticeService.getNoticeById(id);
modelAndView.addObject("noticeList",list);
modelAndView.setViewName("system/notice/homeNotice");
return modelAndView;
}
}
EasNoticeController:
package com.jubilantz.controller;
import com.jubilantz.entity.EasNotice;
import com.jubilantz.services.EasNoticeService;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author JubilantZ
* @Date: 2021/4/27 11:35
*/
@RequestMapping("/easNotice")
@Controller
public class EasNoticeController {
@Autowired
private EasNoticeService easNoticeService;
@RequestMapping("/index")
@RequiresPermissions("notice:query")
public String index() throws Exception{
return "system/notice/adminNoticeList";
}
@ResponseBody
@RequestMapping("/list")
public Map getNoticeList(
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue="")String searchKey) throws Exception {
Map map = new HashMap<>();
//一共三个权限 获取全部的行数
int type = 3;
int count = easNoticeService.getCountByType(type,searchKey);
PageUtil pageUtil = new PageUtil(page,limit);
List list = easNoticeService.getNoticeListByType(type,searchKey,pageUtil);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
@RequestMapping("/look")
public ModelAndView showNotice(){
return new ModelAndView("system/notice/notice");
}
@RequestMapping("/addPage")
public ModelAndView toAddPage() {
return new ModelAndView("system/notice/noticeAdd");
}
@RequestMapping("/addNotice")
@ResponseBody
public Map addNotice(@RequestParam(defaultValue="2")Integer opType, EasNotice easNotice) throws Exception {
Map map = new HashMap<>();
// System.out.println("通知id:"+easNotice.getId());
// System.out.println("opType为:"+opType);
// System.out.println("content为:"+easNotice.getContent());
int res = 0;
//opType等于0是添加 1是更新
if (opType == 0) {
try {
res = easNoticeService.addNotice(easNotice);
} catch (Exception e) {
// System.out.println("添加失败!");
map.put("result",false);
}
if (res > 0){
map.put("result",true);
}else{
map.put("result",false);
}
} else if (opType == 1) {
res = easNoticeService.updateNotice(easNotice);
if (res > 0) {
map.put("result",true);
}else{
map.put("result",false);
}
};
return map;
}
@ResponseBody
@RequestMapping("/deleteNotice")
public Map deleteNotice(EasNotice easNotice) {
Map map = new HashMap<>();
if (easNoticeService.deleteNotice(easNotice) > 0) {
map.put("result",true);
map.put("msg","删除成功");
}else {
map.put("result",false);
map.put("msg","删除失败");
}
return map;
}
/**
* 批量删除通知
* @param nIds
* @return
*/
@ResponseBody
@RequestMapping("/deleteList")
public Map deleteNoticeList(String nIds) {
Map map = new HashMap<>();
List list = new ArrayList();
try {
String[] ids = nIds.split(",");
for (String id: ids) {
list.add(Integer.parseInt(id));
}
if (easNoticeService.deleteNoticeList(list) > 0) {
map.put("result",true);
map.put("msg","批量删除成功");
}else {
map.put("result",false);
map.put("msg","批量删除失败");
}
} catch (Exception e) {
e.printStackTrace();
map.put("result",false);
map.put("msg","批量删除失败");
}
return map;
}
@ResponseBody
@RequestMapping(value="/uploadImg")
public String uploadImg(MultipartFile file, HttpServletRequest request) throws IOException {
System.out.println("comming!");
String path = request.getSession().getServletContext().getRealPath("/images");
System.out.println("path>>"+path);
//获取上传图片的名称
String fileName = file.getOriginalFilename();
System.out.println("fileName>>"+fileName);
// //获取图片的后缀 例:.jpg
// fileName = fileName.substring(fileName.lastIndexOf("."), fileName.length());
// System.out.println("fileName1>>"+fileName);
// //生成图片名称
// fileName = System.currentTimeMillis() + fileName; //System.currentTimeMillis()产生一个当前的毫秒 +文件后缀 例.jpg
System.out.println("fileName2>>"+fileName);
File dir = new File(path, fileName);
System.out.println("File>>"+dir);
if(!dir.exists()){
dir.mkdirs();
}
// MultipartFile自带的解析方法
file.transferTo(dir);
String jsonStr = "{\"code\":0,\"msg\":\"\",\"count\":" + null + ",\"data\":" + "{\"src\":\"" + "/images/" + fileName + "\"}" + "}";
return jsonStr;
}
}
EasPermissionController:
package com.jubilantz.controller;
import com.jubilantz.entity.EasPermission;
import com.jubilantz.mappers.EasPermissionMapper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/easPermission")
public class EasPermissionController {
@Autowired
private EasPermissionMapper easPermissionMapper;
@RequestMapping("/index")
@RequiresPermissions("permission:query")
public String index() throws Exception{
return "system/permission/index";
}
@RequestMapping("/parentList")
@ResponseBody
public List parentList() {
return easPermissionMapper.getParentPers();
}
@RequestMapping("/list")
@ResponseBody
public Map list() throws Exception {
Map map = new HashMap<>();
map.put("code",0);
map.put("msg",null);
map.put("data",easPermissionMapper.getAll());
return map;
}
}
EasRegisterController:
package com.jubilantz.controller;
import com.jubilantz.entity.EasUser;
import com.jubilantz.services.EasRegisterService;
import com.jubilantz.services.EasUserService;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author JubilantZ
* @Date: 2021/4/24 17:06
*/
@RequestMapping("/easRegister")
@Controller
public class EasRegisterController {
@Autowired
private EasRegisterService easRegisterService;
@Autowired
private EasUserService easUserService;
@RequestMapping("/registerForm")
public String registerForm(){
return "registerForm";
}
@RequestMapping(value = "/registerUser",method = RequestMethod.POST)
@ResponseBody
public Map registerUser(HttpServletRequest request) throws Exception{
Map map = new HashMap<>();
//获取页面输入的新旧密码
String username = request.getParameter("username");
String password = request.getParameter("password");
String password2 = request.getParameter("password2");
String regex = "^(?!([a-zA-Z]+|\\d+)$)[a-zA-Z\\d]{6,20}$";
boolean matches = password.matches(regex);
// System.out.println("页面输入的用户名为:"+username);
// System.out.println("页面输入的密码为:"+password);
List list = easUserService.findUserName(username);
if(list.size() > 0){
map.put("code",1);
map.put("msg","用户名已存在,请重新输入");
}else if(password.length() <= 0 || password2.length() <= 0 || username.length() <= 0){
map.put("code",1);
map.put("msg","用户名密码不能为空,请重新输入");
}else if(!password.equals(password2)){
map.put("code",1);
map.put("msg","两次输入密码不一致,请重新输入");
}else if(!matches){
map.put("code",1);
map.put("msg","密码必须包含字母、数字且长度为6-20位");
}else if(matches){
//由密码和用户名组成MD5加密 用户名为盐值
// Md5Hash Md5Hash = new Md5Hash(password, username);
// System.out.println("我是MD5Hash"+Md5Hash);
String algorithmName = "MD5";//加密算法
Object source = password;//要加密的密码
Object salt = username;//盐值,一般都是用户名或者userid,要保证唯一
int hashIterations = 1;//加密次数
SimpleHash simpleHash = new SimpleHash(algorithmName,source,salt,hashIterations);
// System.out.println("我是SimpleHash:"+simpleHash);
EasUser easUser = new EasUser();
easUser.setUsername(username);
easUser.setPassword(simpleHash.toString());
easUser.setSalt(username);
easUser.setLocked("0");
easUserService.addUser(easUser);
map.put("code",0);
}else{
map.put("code",1);
map.put("msg","注册失败,请联系管理员邮箱[email protected]!!!");
}
return map;
}
}
EasRoleController:
package com.jubilantz.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jubilantz.entity.EasBaseCourse;
import com.jubilantz.entity.EasRole;
import com.jubilantz.mappers.EasRoleMapper;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/easRole")
public class EasRoleController {
@Autowired
private EasRoleMapper easRoleMapper;
@RequestMapping("/search")
@ResponseBody
public List search() throws Exception{
return easRoleMapper.getAll();
}
@RequestMapping("/index")
@RequiresPermissions("role:query")
public String index() throws Exception{
return "system/role/index";
}
@RequestMapping("/rolePers")
@ResponseBody
public List rolePers(Integer id) throws Exception {
return easRoleMapper.getPerIdsByRoleId(id);
}
@RequestMapping("/assignPers")
@ResponseBody
public Map assignPers(Integer roleId, String persIds) throws Exception{
Map map = new HashMap<>();
easRoleMapper.deleteRolePermissions(roleId);
easRoleMapper.addRolePermissions(roleId,persIds.split(","));
return map;
}
@RequestMapping("/list")
@ResponseBody
public Map list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasRole easRole) throws Exception {
Map map = new HashMap<>();
int count = easRoleMapper.getCount();
PageUtil pageUtil = new PageUtil(page,limit);
map.put("code",0);
map.put("msg",null);
map.put("data",easRoleMapper.getList(easRole,pageUtil));
map.put("count",count);
return map;
}
@RequestMapping("/roleForm")
public String roleForm() throws Exception {
return "system/role/roleForm";
}
@RequestMapping(value = "/addRole",method = RequestMethod.POST)
@ResponseBody
public Map addRole(EasRole easRole) throws Exception{
Map map = new HashMap<>();
// System.out.println("角色名称:"+easRole.getName());
// System.out.println("角色是否可用:"+easRole.getAvailable());
List list = easRoleMapper.findRoleName(easRole.getName());
if (list.size() != 0){
map.put("msg","角色已存在");
map.put("result",false);
}else if(easRole.getName().length() <= 0){
map.put("msg","角色名称不能为空");
map.put("result",false);
}else{
//课程为null也可以添加 待完善
easRoleMapper.addRole(easRole);
map.put("msg","添加成功");
map.put("result",true);
}
return map;
}
@RequestMapping("/batchDeleteRole")
@ResponseBody
@RequiresPermissions("role:delete")
public Map batchDeleteRole(Integer[] ids) throws Exception{
Map map = new HashMap();
easRoleMapper.batchDeleteRole(ids);
map.put("msg","删除成功");
map.put("result",true);
return map;
}
@RequestMapping(value = "/getRoleView")
@ResponseBody
public EasRole getRoleView(Integer id) throws Exception {
return easRoleMapper.getRoleView(id);
}
@RequestMapping(value = "/editRole",method = RequestMethod.POST)
@ResponseBody
public Map editRole(EasRole easRole) throws Exception{
Map map = new HashMap<>();
easRoleMapper.updateBaseCourse(easRole);
map.put("result",true);
return map;
}
}
EasScoreController:
package com.jubilantz.controller;
import com.alibaba.fastjson.JSON;
import com.jubilantz.entity.*;
import com.jubilantz.services.EasScoreService;
import com.jubilantz.services.EasStudentService;
import com.jubilantz.services.EasTeacherService;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author JubilantZ
* @Date: 2021/4/25 20:14
*/
@RequestMapping("/easScore")
@Controller
public class EasScoreController {
@Autowired
private EasScoreService easScoreService;
@Autowired
private EasStudentService easStudentService;
@Autowired
private EasTeacherService easTeacherService;
//教师查看选我课的学生成绩列表 进行打分
@RequestMapping("/scoreIndex")
public String scoreIndex() throws Exception {
return "system/score/studentScoreIndex";
}
//学生查看我的成绩页面
@RequestMapping("/myScoreIndex")
public String myScoreIndex() throws Exception {
return "system/score/myScoreIndex";
}
//教师查看我的学生选课信息
@RequestMapping("/myStudentIndex")
public String myStudentIndex() throws Exception {
return "system/score/myStudentIndex";
}
/**
* 学生选课
* @param courseId
* @return
* @throws Exception
*/
@RequestMapping("/choiceCourse")
@ResponseBody
public Map choiceCourse(@RequestParam(defaultValue="")Integer courseId) throws Exception {
Map map = new HashMap<>();
if (courseId != null) {
//获取学生信息
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
String username = easUser.getUsername();
EasStudent easStudent = easStudentService.getStudentByUsername(username);
// System.out.println("学生用户名为:"+username);
if (easStudent.getUsername() == null || easStudent.getUsername().equals("")){
map.put("result",false);
map.put("msg","出错了!");
}else {
EasScore easScore = new EasScore();
easScore.setsId(easStudent.getId());
easScore.setcId(courseId);
//使用Date创建日期对象
Date nowDate = new Date();
//获取当前课程的开始日期
Date startDate = easScoreService.getStartDateByCourseId(courseId);
if(nowDate.getTime() > startDate.getTime()){
map.put("result",false);
map.put("msg","已经开课,无法选课!");
}else{
int res = easScoreService.choiceCourse(easScore);
if (res > 0) {
map.put("result",true);
map.put("msg","选课成功!");
}else {
map.put("result",false);
map.put("msg","人数已满,选课失败!");
}
}
//
// int res = easScoreService.choiceCourse(easScore);
//
// if (res > 0) {
// map.put("result",true);
// map.put("msg","选课成功!");
// }else {
// map.put("result",false);
// map.put("msg","人数已满,选课失败!");
// }
}
}else {
map.put("result",false);
map.put("msg","选课失败,请联系管理员!");
}
return map;
}
/**
* 学生退课
* @param courseId
* @return
* @throws Exception
*/
@RequestMapping("/outCourse")
@ResponseBody
public Map outCourse(@RequestParam(defaultValue="")Integer courseId) throws Exception {
Map map = new HashMap<>();
if (courseId != null) {
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
String username = easUser.getUsername();
EasStudent easStudent = easStudentService.getStudentByUsername(username);
if (easStudent.getUsername() == null || easStudent.getUsername().equals("")){
map.put("result",false);
map.put("msg","出错了!");
}else{
EasScore easScore = new EasScore();
easScore.setsId(easStudent.getId());
easScore.setcId(courseId);
//使用Date创建日期对象
Date nowDate=new Date();
// System.out.println("当前的日期是------>"+nowDate);
/**
* 创建格式化时间日期类
*构造入参String类型就是我们想要转换成的时间形式
*/
// SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
// System.out.println("格式化后的时间------->"+format.format(date));
// String ds=df.format(d);
//获取当前课程的开始日期
Date startDate = easScoreService.getStartDateByCourseId(courseId);
// System.out.println("开始日期为------>"+startDate);
if(nowDate.getTime() > startDate.getTime()){
map.put("result",false);
map.put("msg","已经开课,无法退课!");
}else{
int res = easScoreService.deleteScore(easScore);
if (res > 0) {
map.put("result",true);
map.put("msg","退选成功!");
}else {
map.put("result",false);
map.put("msg","退课失败!");
}
}
// //删除成绩信息时 ,同时将课程表中该课程的人数-1 该方法在service中
// int res = easScoreService.deleteScore(easScore);
//
// if (res > 0) {
// map.put("result",true);
// map.put("msg","退选成功!");
// }else {
// map.put("result",false);
// map.put("msg","退课失败!");
// }
}
}else {
map.put("result",false);
map.put("msg","退课失败,请联系管理员!");
}
return map;
}
/**
* 返回选修了我(教师)已结束课程的学生列表
* @param page
* @param limit
* @param baseCourseId
* @param classId
* @return
* @throws Exception
*/
@RequestMapping("/stuScoreList")
@ResponseBody
public Map stuScoreList(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(required=false) Integer baseCourseId,
@RequestParam(required=false) Integer classId) throws Exception {
// @requestparam(required = false)不传值后台也不会报错
Map map = new HashMap<>();
//获取当前教师id
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
String username = easUser.getUsername();
EasTeacher easTeacher = easTeacherService.findTeacherByUsername(username);
//获取行数
int count = easStudentService.getEndingCountBytIdandcId(easTeacher.getId(),baseCourseId,classId);
PageUtil pageUtil = new PageUtil(page,limit);
List list = easStudentService.getStudentScoreListByTid(easTeacher.getId(),baseCourseId,classId,pageUtil);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
/**
* 获取我的学生选课信息
* @param page
* @param limit
* @param baseCourseId
* @param classId
* @return
* @throws Exception
*/
@RequestMapping("/stuSelectCourseList")
@ResponseBody
public Map stuSelectCourseList(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(required=false) Integer baseCourseId,
@RequestParam(required=false) Integer classId) throws Exception {
// @requestparam(required = false)不传值后台也不会报错
Map map = new HashMap<>();
//获取当前教师id
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
String username = easUser.getUsername();
EasTeacher easTeacher = easTeacherService.findTeacherByUsername(username);
//获取行数
int count = easStudentService.getCountBytIdandcId(easTeacher.getId(),baseCourseId,classId);
PageUtil pageUtil = new PageUtil(page,limit);
List list = easStudentService.getStudentSelectCourseListByTid(easTeacher.getId(),baseCourseId,classId,pageUtil);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
@RequestMapping("/updateScore")
@ResponseBody
public Map updateScore(EasScore easScore) throws Exception {
Map map = new HashMap<>();
int res = easScoreService.updateScore(easScore);
if (res > 0){
map.put("result",true);
map.put("msg","评分成功");
}else {
map.put("result",false);
map.put("msg","课程还未结束,评分失败");
}
return map;
}
@RequestMapping("/updateScoreList")
@ResponseBody
public Map updateScoreList(String scoreListStr) throws Exception {
Map map = new HashMap<>();
List scoreList = JSON.parseArray(scoreListStr,EasScore.class);
// System.out.println("我是scoreList"+scoreList);
int res = easScoreService.updateScoreByScoreList(scoreList);
if (res > 0){
map.put("result",true);
map.put("msg","批量评分成功");
}else {
map.put("result",false);
map.put("msg","批量评分失败,请联系管理员!");
}
return map;
}
@RequestMapping("/myScore")
@ResponseBody
public Map myScore(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
Integer result) throws Exception {
Map map = new HashMap<>();
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
String username = easUser.getUsername();
EasStudent easStudent = easStudentService.getStudentByUsername(username);
PageUtil pageUtil = new PageUtil(page,limit);
int sId = easStudent.getId();
int count = easScoreService.getTotalItemsCount(sId,result);
List list = easScoreService.getCourseListBySid(sId,result,pageUtil);
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
}
EasStudentController:
package com.jubilantz.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jubilantz.entity.EasClass;
import com.jubilantz.entity.EasRole;
import com.jubilantz.entity.EasStudent;
import com.jubilantz.entity.EasUser;
import com.jubilantz.services.EasClassService;
import com.jubilantz.services.EasStudentService;
import org.apache.commons.beanutils.PropertyUtilsBean;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author JubilantZ
* @Date: 2021/4/14 10:11
*/
@Controller
@RequestMapping("/easStudent")
public class EasStudentController {
@Autowired
private EasStudentService easStudentService;
@RequestMapping("/index")
public String index() throws Exception{
return "system/student/index";
}
@RequestMapping("/list")
@ResponseBody
public Map list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasStudent easStudent) throws Exception{
Map map = new HashMap<>();
// System.out.println("我是:" + easStudent.getClass_id());
Page pager = PageHelper.startPage(page,limit);
// List list = easStudentService.getList(easStudent);
List list = easStudentService.findList(easStudent);
// System.out.println("获取信息总条数为:" + list.size());
// for (EasStudent e:list
// ) {
// System.out.println(e.getUser().getUsername());
// System.out.println(e.getName());
// System.out.println(e.getClass_id());
// }
map.put("count",pager.getTotal());
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
}
EasTeacherController:
package com.jubilantz.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jubilantz.entity.EasClass;
import com.jubilantz.entity.EasTeacher;
import com.jubilantz.services.EasTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author JubilantZ
* @Date: 2021/4/14 10:11
*/
@Controller
@RequestMapping("/easTeacher")
public class EasTeacherController {
@Autowired
private EasTeacherService easTeacherService;
@RequestMapping("/index")
public String index() throws Exception{
return "system/teacher/index";
}
@RequestMapping("/list")
@ResponseBody
public Map list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasTeacher easTeacher) throws Exception{
Map map = new HashMap<>();
// 分页不能用待修改。。。
Page pager = PageHelper.startPage(page,limit);
// List list = easTeacherService.getList(easTeacher);
List list = easTeacherService.findTeacherList(easTeacher);
// System.out.println("获取信息总条数为:" + list.size());
// for (EasTeacher e:list
// ) {
// System.out.println(e.getUser().getUsername());
// System.out.println(e.getName());
// }
map.put("count",pager.getTotal());
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
@RequestMapping("/search")
@ResponseBody
public List search() throws Exception{
return easTeacherService.getAll();
}
}
EasUserController:
package com.jubilantz.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jubilantz.entity.*;
import com.jubilantz.mappers.EasUserMapper;
import com.jubilantz.services.*;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/easUser")
public class EasUserController {
@Autowired
private EasUserMapper easUserMapper;
@Autowired
private EasUserService easUserService;
@Autowired
private EasClassService easClassService;
@Autowired
private EasStudentService easStudentService;
@Autowired
private EasTeacherService easTeacherService;
@Autowired
private EasRoleService easRoleService;
@RequestMapping("/index")
public String index(ModelMap modelMap) throws Exception {
modelMap.put("roleList",easRoleService.getAll());
return "system/user/index";
}
@RequestMapping("/list")
@ResponseBody
public Map list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasUser condition, String roleIds) throws Exception{
Map map = new HashMap<>();
//将传递过来的角色编号封装到角色集合中
if(roleIds != null && !roleIds.trim().equals("")){
String[] array = roleIds.split(",");
List roles = new ArrayList<>();
for (int i = 0; i < array.length; i++) {
EasRole role = new EasRole();
role.setId(Integer.parseInt(array[i]));
roles.add(role);
}
condition.setRoles(roles);
}
// Page pager = PageHelper.startPage(page,limit);
int count = easUserService.getCount();
PageUtil pageUtil = new PageUtil(page,limit);
List list = easUserMapper.getList(condition,pageUtil);
// map.put("count",pager.getTotal());
map.put("count",count);
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
@RequestMapping("/form")
public String form(ModelMap modelMap) throws Exception {
modelMap.put("roleList",easRoleService.getAll());
return "system/user/form";
}
@RequestMapping("/basicForm")
public String basicForm(ModelMap modelMap) throws Exception {
modelMap.put("classList",easClassService.getAll());
return "system/user/form2";
}
@RequestMapping("/batchDelete")
@ResponseBody
@RequiresPermissions("user:delete")
public Map batchDelete(Integer[] ids) throws Exception{
Map map = new HashMap();
easUserMapper.batchDelete(ids);
map.put("result",true);
return map;
}
@RequestMapping(value = "/add",method = RequestMethod.POST)
@ResponseBody
public Map add(EasUser user,@RequestParam(defaultValue = "7") String roleIds) throws Exception{
Map map = new HashMap<>();
String[] array = roleIds.split(",");
Integer[] ids = new Integer[array.length];
for (int i = 0; i < array.length; i++) {
ids[i] = Integer.parseInt(array[i]);
}
//对密码进行加密
Md5Hash md5Hash = new Md5Hash(user.getPassword(),user.getSalt());
user.setPassword(md5Hash.toString());
// List list = easUserMapper.findUserName(user.getUsername());
List list = easUserService.findUserName(user.getUsername());
if (list.size() != 0){
map.put("msg","用户名已存在");
map.put("result",false);
}else{
if(user.getLocked() == null){
user.setLocked("1");
easUserService.addUser(user);
easUserService.addUserRole(user,ids);
//根据用户id查询eas_user_role表中的角色id
int roleid = easUserService.findRoleIdByUserId(user.getId());
//roleid = 2 为学生 3为教师 将用户名在学生表/教师表进行添加
if(roleid == 2){
easStudentService.addUsername(user.getUsername());
}else if(roleid == 3){
easTeacherService.addUsername(user.getUsername());
}
}else {
easUserService.addUser(user);
easUserService.addUserRole(user,ids);
//根据用户id查询eas_user_role表中的角色id
int roleid = easUserService.findRoleIdByUserId(user.getId());
//roleid = 2 为学生 3为教师 将用户名在学生表/教师表进行添加
if(roleid == 2){
easStudentService.addUsername(user.getUsername());
}else if(roleid == 3){
easTeacherService.addUsername(user.getUsername());
}
}
map.put("result",true);
}
return map;
}
@RequestMapping(value = "/view")
@ResponseBody
public EasUser view(Integer id) throws Exception {
EasUser easUser =easUserMapper.get(id);
//将密码解密 放入对象中
// System.out.println("解密一次后密码为:"+convertMD5(easUser.getPassword()));
return easUser;
}
@RequestMapping(value = "/edit",method = RequestMethod.POST)
@ResponseBody
public Map edit(EasUser user, String roleIds) throws Exception{
Map map = new HashMap<>();
String[] array = roleIds.split(",");
Integer[] ids= new Integer[array.length];
for (int i=0 ;i < array.length; i++){
ids[i] = Integer.parseInt(array[i]);
}
//获取原先未修改的对象
EasUser easUser = easUserMapper.findUserById(user.getId());
if (easUser.getPassword().equals(user.getPassword())) {
// EasUser easUser = easUserMapper.findUserById(user.getId());
// System.out.println("我是easUser密码"+easUser.getPassword());
// System.out.println("我是user密码"+user.getPassword());
user.setPassword(user.getPassword());
}else{
Md5Hash md5Hash = new Md5Hash(user.getPassword(),user.getSalt());
user.setPassword(md5Hash.toString());
}
easUserService.updateUser(user);
easUserService.deleteUserRole(user.getId());
easUserService.addUserRole(user,ids);
//根据用户id获取eas_user_role表中的数据行数
int roleCount = easUserService.getRoleCountByUid(user.getId());
//判断用户是否只有一个角色
if(roleCount == 1){
//根据用户id查询eas_user_role表中的角色id
int roleid = easUserService.findRoleIdByUserId(user.getId());
//roleid = 2 为学生 3为教师 将用户名在学生表/教师表进行添加
List list1 = easStudentService.findListByUsername(user.getUsername());
List list2 = easTeacherService.findListByUsername(user.getUsername());
if(roleid == 2){
if(list1.size() == 0){
if(list2.size() > 0){
easTeacherService.deleteTeacher(user.getUsername());
}
easStudentService.addUsername(user.getUsername());
}
}else if(roleid == 3){
if(list2.size() == 0){
if(list1.size() > 0){
easStudentService.deleteStudent(user.getUsername());
}
easTeacherService.addUsername(user.getUsername());
}
}
}
// //根据用户id查询eas_user_role表中的角色id
// int roleid = easUserService.findRoleIdByUserId(user.getId());
// //roleid = 2 为学生 3为教师 将用户名在学生表/教师表进行添加
// List list1 = easStudentService.findListByUsername(user.getUsername());
// List list2 = easTeacherService.findListByUsername(user.getUsername());
//
// if(roleid == 2){
// if(list1.size() == 0){
// if(list2.size() > 0){
// easTeacherService.deleteTeacher(user.getUsername());
// }
// easStudentService.addUsername(user.getUsername());
// }
// }else if(roleid == 3){
// if(list2.size() == 0){
// if(list1.size() > 0){
// easStudentService.deleteStudent(user.getUsername());
// }
// easTeacherService.addUsername(user.getUsername());
// }
// }
map.put("result",true);
return map;
}
@RequestMapping("/passwordRestIndex")
public String passwordRestIndex(){
return "system/user/changePwd";
}
@RequestMapping(value = "/passwordRest",method = RequestMethod.POST)
@ResponseBody
public Map passwordRest(HttpServletRequest request) throws Exception {
Map map = new HashMap<>();
//获取页面输入的新旧密码
String oldPassword = request.getParameter("oldPassword");
String newPassword1 = request.getParameter("newPassword1");
String newPassword2 = request.getParameter("newPassword2");
String regex = "^(?!([a-zA-Z]+|\\d+)$)[a-zA-Z\\d]{6,20}$";
boolean matches = newPassword1.matches(regex);
//获取用户信息
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
//将页面输入的密码进行加密 存入oldMd5Hash
Md5Hash oldMd5Hash = new Md5Hash(oldPassword, easUser.getSalt());
Md5Hash newMd5Hash = new Md5Hash(newPassword1, easUser.getSalt());
//进行密码的判断
if(oldPassword.length() <= 0 || newPassword1.length() <= 0 || newPassword2.length() <= 0){
// if(oldPassword.equals("") || newPassword1.equals("") || newPassword2.equals("")){
map.put("code",4);
map.put("msg","密码不能为空");
}else if(!easUser.getPassword().equals(oldMd5Hash.toString())){
map.put("code",2);
map.put("msg","输入的旧密码不正确");
}else if(!newPassword1.equals(newPassword2)){
map.put("code",1);
map.put("msg","输入的新密码不一致");
}else if(!matches){
map.put("code",3);
map.put("msg","密码必须包含字母、数字且长度为6-20位");
}
// else if(newPassword1.length() < 6 || newPassword1.length() >16){
// map.put("code",3);
// map.put("msg","密码长度为6~16位");
// }
else if(easUser.getPassword().equals(oldMd5Hash.toString())){
easUser.setPassword(newMd5Hash.toString());
easUserService.updateUser(easUser);
map.put("code",0);
map.put("msg","修改成功");
}
return map;
}
@RequestMapping("/basicInformationIndex")
public String basicInformationIndex(Model model) throws Exception {
//获取身份信息 判断是哪个角色
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
Integer roleid = easUserService.findRoleIdByUserId(easUser.getId());
String rolename = easRoleService.findRoleNameByRoleId(roleid);
// System.out.println("角色id为:"+roleid);
// System.out.println("角色名称为:"+rolename);
if(roleid == 1000 || !(rolename.length() > 0)){
model.addAttribute("code",1);
model.addAttribute("msg","该用户还没有个人信息,请稍后再来查看和修改个人信息!");
}else if(rolename.equals(Constants.STUDENT)){
List list = easStudentService.findListByUsername(easUser.getUsername());
// System.out.println("我是学生信息:"+list);
model.addAttribute("data",list);
model.addAttribute("code",2);
model.addAttribute("msg","学生信息成功");
}else if(rolename.equals(Constants.TEACHER)){
List list = easTeacherService.findListByUsername(easUser.getUsername());
// System.out.println("我是教师信息:"+list.size());
model.addAttribute("data",list);
model.addAttribute("code",3);
model.addAttribute("msg","教师信息成功");
}else{
model.addAttribute("code",4);
model.addAttribute("msg","管理员还没有个人信息,请静候功能开放!");
}
return "system/user/basicInformation";
}
/**
* 获取修改个人资料时用户已有的信息
* @return
* @throws Exception
*/
@RequestMapping(value = "/getBasicInformation")
@ResponseBody
public Object getBasicInformation() throws Exception {
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
Integer roleid = easUserService.findRoleIdByUserId(easUser.getId());
String rolename = easRoleService.findRoleNameByRoleId(roleid);
if(roleid == 1000 || !(rolename.length() > 0)){
System.out.println("我怎么变成null了!");
return null;
}else if(rolename.equals(Constants.STUDENT)){
EasStudent easStudent = easStudentService.getStudentByUsername(easUser.getUsername());
return easStudent;
}else if(rolename.equals(Constants.TEACHER)){
EasTeacher easTeacher = easTeacherService.getTeacherByUsername(easUser.getUsername());
return easTeacher;
}else{
System.out.println("哪里出错了!");
return null;
}
}
@RequestMapping(value = "/modifyInformation",method = RequestMethod.POST)
@ResponseBody
public Map modifyInformation(EasStudent easStudent,EasTeacher easTeacher,Integer classes) throws Exception{
Map map = new HashMap<>();
EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
Integer roleid = easUserService.findRoleIdByUserId(easUser.getId());
String rolename = easRoleService.findRoleNameByRoleId(roleid);
if(roleid == 1000 || !(rolename.length() > 0)){
System.out.println("我怎么变成null了!");
map.put("result",false);
return map;
}else if(rolename.equals(Constants.STUDENT)){
//名称不符合必须重新set课程id
easStudent.setClass_id(classes);
easStudentService.updateStudent(easStudent);
map.put("result",true);
return map;
}else if(rolename.equals(Constants.TEACHER)){
easTeacherService.updateTeacher(easTeacher);
map.put("result",true);
return map;
}else{
/**
* 可以扩充。。。
*/
System.out.println("哪里出错了!");
map.put("result",false);
return map;
}
}
// //url : /kan/5.html
// @RequestMapping("/kan/{id}.shtml")
// @ResponseBody
// public EasUser kan(@PathVariable Integer id) throws Exception {
// return easUserMapper.get(id);
// }
}
login.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
教务管理系统
<%@include file="common.jsp"%>
main.js
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
教务管理系统
<%@include file="common.jsp"%>
管理员主页面界面:
用户管理:
角色管理:
权限管理:
通知管理:
学生信息:
教师信息:
基本课程信息:
班级信息:
课程信息(管理员):
成绩报表:
人数报表:
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
课程id |
int |
√ |
× |
× |
NULL |
|
2 |
coursename |
课程名 |
varchar |
100 |
× |
× |
× |
NULL |
3 |
synopsis |
课程简介 |
varchar |
255 |
× |
× |
√ |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
班级id |
int |
√ |
× |
× |
NULL |
|
2 |
classes |
班级 |
varchar |
255 |
× |
× |
× |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
Id |
int |
√ |
× |
× |
NULL |
|
2 |
start_date |
开设日期 |
date |
× |
× |
√ |
NULL |
|
3 |
end_date |
结束日期 |
date |
× |
× |
√ |
NULL |
|
4 |
class_hour |
总课时 |
smallint |
× |
× |
√ |
NULL |
|
5 |
test_mode |
考核方式 |
varchar |
255 |
× |
× |
√ |
NULL |
6 |
student_num |
学生数量 |
int |
× |
× |
√ |
NULL |
|
7 |
choice_num |
选课人数 |
int |
× |
× |
√ |
0 |
|
8 |
complete |
是否是完成的课程 |
int |
× |
× |
√ |
0 |
|
9 |
t_id |
外键-教师号 |
int |
× |
× |
× |
NULL |
|
10 |
base_course_id |
外键-课程号 |
int |
× |
× |
× |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
公告id |
int |
√ |
× |
× |
NULL |
|
2 |
title |
标题 |
varchar |
255 |
× |
× |
× |
NULL |
3 |
author |
作者 |
varchar |
255 |
× |
× |
× |
NULL |
4 |
content |
内容 |
varchar |
1000 |
× |
× |
× |
NULL |
5 |
type |
权限 |
int |
× |
× |
× |
3 |
|
6 |
releasedate |
发布日期 |
date |
× |
× |
× |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
功能id |
int |
× |
× |
× |
NULL |
|
2 |
text |
功能名称 |
varchar |
255 |
× |
× |
× |
NULL |
3 |
type |
功能类型 |
varchar |
255 |
× |
× |
× |
NULL |
4 |
url |
路径 |
varchar |
255 |
× |
× |
√ |
NULL |
5 |
percode |
别名 |
varchar |
255 |
× |
× |
× |
NULL |
6 |
parentid |
父级编号 |
int |
× |
× |
√ |
NULL |
|
7 |
sortstring |
进行排序 |
int |
× |
× |
√ |
NULL |
|
8 |
available |
是否启用 |
int |
× |
× |
√ |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
角色id |
int |
√ |
× |
× |
NULL |
|
2 |
name |
角色名称 |
varchar |
255 |
× |
× |
× |
NULL |
3 |
available |
是否启用 |
int |
× |
× |
× |
0 |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
int |
√ |
× |
× |
NULL |
||
2 |
eas_role_id |
角色id |
int |
× |
× |
× |
NULL |
|
3 |
eas_permission_id |
功能id |
int |
× |
× |
× |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
分数id |
int |
√ |
× |
× |
NULL |
|
2 |
score |
考试分数 |
int |
× |
× |
× |
0 |
|
3 |
result |
考试结果 |
varchar |
255 |
× |
× |
√ |
NULL |
4 |
s_id |
学生id |
int |
× |
× |
× |
NULL |
|
5 |
c_id |
课程id |
int |
× |
× |
× |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
学生id |
int |
√ |
× |
× |
NULL |
|
2 |
username |
账号 |
varchar |
255 |
× |
× |
× |
NULL |
3 |
name |
姓名 |
varchar |
255 |
× |
× |
√ |
NULL |
4 |
sex |
性别 |
varchar |
255 |
× |
× |
√ |
NULL |
5 |
birthday |
出生日期 |
date |
× |
× |
√ |
NULL |
|
6 |
phone |
电话号码 |
varchar |
255 |
× |
× |
√ |
NULL |
7 |
class_id |
班级id |
int |
× |
× |
√ |
NULL |
|
8 |
motto |
座右铭 |
varchar |
255 |
× |
× |
√ |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
教师id |
int |
√ |
× |
× |
NULL |
|
2 |
username |
用户名 |
varchar |
255 |
× |
× |
× |
NULL |
3 |
name |
教师姓名 |
varchar |
255 |
× |
× |
√ |
NULL |
4 |
sex |
性别 |
varchar |
255 |
× |
× |
√ |
NULL |
5 |
birthday |
出生年月 |
date |
× |
× |
√ |
NULL |
|
6 |
phone |
电话 |
varchar |
255 |
× |
× |
√ |
NULL |
7 |
education |
学历 |
varchar |
255 |
× |
× |
√ |
NULL |
8 |
motto |
座右铭 |
varchar |
255 |
× |
× |
√ |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
用户id |
int |
√ |
× |
× |
NULL |
|
2 |
username |
账号 |
varchar |
255 |
× |
× |
× |
NULL |
3 |
password |
密码 |
varchar |
255 |
× |
× |
× |
NULL |
4 |
salt |
盐值 |
varchar |
255 |
× |
× |
× |
NULL |
5 |
locked |
是否锁定 |
varchar |
255 |
× |
× |
× |
NULL |
序号 |
字段 |
说明 |
数据类型 |
长度 |
自增 |
主键 |
允许空 |
默认值 |
1 |
id |
int |
√ |
× |
× |
NULL |
||
2 |
eas_user_id |
用户id |
int |
× |
× |
× |
NULL |
|
3 |
eas_role_id |
角色id |
int |
× |
× |
× |
1000 |