作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
ssm实验室设备管理系统。前台jsp+layui+easyui等框架渲染数据、后台java语言搭配ssm(spring、springmvc、mybatis、maven) 数据库mysql5.7、8.0版本均可。该系统主要分三种角色:管理员、教师、学生。主要功能学校实验设备的借、还、修以及实验课程的发布等等;
管理员主要功能:
实验室管理:实验室基本信息管理;
系统管理:系统日志查看;
权限中心:用户组信息管理、用户组权限控制、菜单管理;
信息管理-管理员:教师信息管理、学生信息管理、用户账号管理、班级信息管理、专业信息管理、实验室类型管理、信息通告管理、实验设备管理、实验室使用审批、设备借用审批;
教师主要功能:
实验管理:实验课程管理;
信息管理-教师:个人信息维护、学生信息管理、借用设备管理、设备损坏登记、设备维修登记、信息通告浏览、借用实验室管理。
学生主要功能:
信息管理-学生:个人信息维护;
信息浏览:实验课程浏览、实验设备浏览、信息通告浏览;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7/8.0 版本均可;
技术栈
1. 后端:Spring SpringMVC MyBatis
2. 前端:jsp+layui+easyui
使用说明
1. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包;
2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置
4. 配置tomcat,然后运行项目,输入localhost:8080/xxx 登录
运行截图
相关代码
IndexController
package com.sys.controller;
import com.sys.model.Groupinfo;
import com.sys.model.Users;
import com.sys.service.GroupinfoService;
import com.sys.service.LogService;
import com.sys.service.MenuService;
import com.sys.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;
@Controller
public class IndexController {
@Autowired
private UsersService usersService;
@Autowired
private GroupinfoService groupinfoService;
@Autowired
private MenuService menuService;
@Autowired
private LogService logService;
@RequestMapping("/Index")
public String index(Model model, HttpServletRequest httpServletRequest){
HttpSession httpSession = httpServletRequest.getSession();
Users users = (Users) httpSession.getAttribute("islogin");
if (users!=null) {
int groupid = users.getGroupid();
String username = users.getUsername();
String password = users.getUpassword();
Users users1 = usersService.getusersByusername(username);
if (users1.getUpassword().equals(password)){
// 此处封装需要带到前端的数据
model.addAttribute("users",users1);
Groupinfo groupinfo = groupinfoService.selectByPrimaryKey(users1.getGroupid());
if (groupinfo!=null){
/*start权限中心*/
String quanxian = groupinfo.getQx();
String qx[] = {};
qx = quanxian.split(",");
Map map = new HashMap();
for (String qxcache : qx) {
int qxid = Integer.parseInt(qxcache);
Map map1 = new HashMap();
map1.put("pmenu", menuService.selectByPrimaryKey(qxid));
map1.put("cmenu", menuService.getmenubyfdm(qxid));
map.put(String.valueOf(qxid) + "menus", map1);
}
model.addAttribute("parentmenus", map);
/*end权限中心*/
return "index";
}
else {
model.addAttribute("errmsg","用户组信息错误!");
return "login";
}
}
else {
model.addAttribute("errmsg","您以更改密码请重新输入");
return "login";
}
}
return "login";
}
@RequestMapping("/Login")//登录模块
public String Login(@RequestParam String username,@RequestParam String password, Model model, HttpServletRequest httpServletRequest){
//管理员
HttpSession session = httpServletRequest.getSession();
password = UtilPacket.Md5MD5String(password);
// if (username.equals("admin")&&password.equals(UtilPacket.Md5MD5String("admin"))){
// Users users = usersService.getusersByusername(username); /*查询用户信息*/
// int groupid = users.getGroupid();
// Groupinfo groupinfo = groupinfoService.selectByPrimaryKey(groupid); // 获取管理员信息 权限
// if (groupinfo!=null) {
// /*start权限中心*/
// String quanxian = groupinfo.getQx();
// String qx[] = {};
// qx = quanxian.split(",");
// Map map = new HashMap();
// for (String qxcache : qx) {
// int qxid = Integer.parseInt(qxcache);
// Map map1 = new HashMap();
// map1.put("pmenu", menuService.selectByPrimaryKey(qxid)); //获取菜单信息
// map1.put("cmenu", menuService.getmenubyfdm(qxid)); //根据菜单id 获取 子模块
// map.put(String.valueOf(qxid) + "menus", map1);
// }
// model.addAttribute("parentmenus", map);
// /*end权限中心*/
// }
// users.setUsername("admin");
// model.addAttribute("users",users);
// session.setAttribute("islogin",users);
// setLog.setlod(httpServletRequest,"admin登录",logService);
// return "index";
// }
// //教师,学生
// else
if(usersService.getusersByusername(username)!=null){
if (usersService.getusersByusername(username).getUpassword().equals(password))
{
Users users = usersService.getusersByusername(username); /*查询用户信息*/
model.addAttribute("users",users);
session.setAttribute("islogin",users);
int groupid = users.getGroupid();
Groupinfo groupinfo = groupinfoService.selectByPrimaryKey(groupid);/*根据用户组id查询信息*/
if (groupinfo!=null){
/*start权限中心*/
String quanxian = groupinfo.getQx();
String qx[] = {};
qx = quanxian.split(",");
System.out.printf("qx");
Map map = new HashMap();
for (String qxcache : qx) {
int qxid = Integer.parseInt(qxcache);
Map map1 = new HashMap();
map1.put("pmenu", menuService.selectByPrimaryKey(qxid)); /*根据id 查询菜单信息*/
map1.put("cmenu", menuService.getmenubyfdm(qxid)); /*根据父id 查询子模块信息*/
map.put(String.valueOf(qxid) + "menus", map1);
}
model.addAttribute("parentmenus", map);
/*end权限中心*/
session.setAttribute("islogin",users);
setLog.setlod(httpServletRequest,"id为"+users.getId()+"的用户登录",logService);
return "index";
}
model.addAttribute("errmsg","用户组信息错误!");
return "login";
}
else {
model.addAttribute("errmsg","密码错误!");
return "login";
}
}
else {
model.addAttribute("errmsg","用户名不存在!");
return "login";
}
}
}
jumpController
package com.sys.controller;
import com.sys.service.LogService;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@Controller
public class jumpController {
@Autowired
private LogService logService;
/*用户添加页面跳转*/
@RequestMapping("/Jumpto")
public String Jumpto(@RequestParam("url") String url){
return url;
}
/*修改密码啊页面跳转*/
@RequestMapping("/resetpassword")
public String resetpassword()
{return "table/xgmm";}
/*安全退出页面跳转*/
@RequestMapping("/logout")
public String logout(HttpServletRequest httpServletRequest){
HttpSession httpSession = httpServletRequest.getSession();
setLog.setlod(httpServletRequest, "安全退出",logService);
httpSession.invalidate();
return "logout";
}
}
selectController
package com.sys.controller;
import com.alibaba.fastjson.JSONObject;
import com.sys.model.*;
import com.sys.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.*;
@RestController
public class selectController {
@Autowired
private MenuService menuService;
@Autowired
private LogService logService;
@Autowired
private GroupinfoService groupinfoService;
@Autowired
private StudentService studentService;
@Autowired
private TeacherService teacherService;
@Autowired
private ZyglService zyglService;
@Autowired
private ClassesService classesService;
@Autowired
private UsersService usersService;
@Autowired
private SyslxService syslxService;
@Autowired
private XxtgService xxtgService;
@Autowired
private SysbglService sysbglService;
@Autowired
private SysglService sysglService;
@Autowired
private JydjService jydjService;
@Autowired
private SyxxbService syxxbService;
@Autowired
private SbshdjService sbshdjService;
@Autowired
private SbwxdjService sbwxdjService;
/**
* 管理员 修改密码
* @param oldpass
* @param newpass
* @param newpass2
* @param httpServletRequest
* @return
*/
@RequestMapping("/getoldpass")
public JSONObject getoldpass(@RequestParam(value = "oldpass")String oldpass,
@RequestParam(value = "newpass")String newpass,
@RequestParam(value = "newpass2")String newpass2,
HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
oldpass = UtilPacket.Md5MD5String(oldpass);
newpass = UtilPacket.Md5MD5String(newpass);
newpass2 = UtilPacket.Md5MD5String(newpass2); //获取前端传入的数据
Integer code = 500;
String msg= "账号服务器错误!";
Users users = (Users)session.getAttribute("islogin"); //获取登录账户
String upass = users.getUpassword();
setLog.setlod(httpServletRequest, "正在修改密码",logService);
if (upass.equals(oldpass)){
if (newpass2.equals(newpass)){
if (!oldpass.equals(newpass)){
code = 0;
msg = "密码修改成功请重新登录";
users.setUpassword(newpass);
if(usersService.updateByPrimaryKeySelective(users)!=0) {
setLog.setlod(httpServletRequest, users.getUsername() + "用户修改了密码",logService);
session.invalidate();
}
}
else{
code=1;
msg="新密码与原密码相同!";
}
}
else {
code = 2;
msg="新密码两次输入不一致!";
}
}
else {
code = 3;
msg = "原密码错误!";
}
Map<String,Object> map = new HashMap<>();
map.put("success",true);
map.put("code",code);
map.put("msg",msg);
JSONObject json = new JSONObject(map);
return json;
}
/**
* 管理员 查询全部实验室信息
* @param sysname
* @param bh
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsysjbxxgl")
public JSONObject selectsysjbxxgl(@RequestParam(required = false)String sysname,@RequestParam(required = false)String bh,HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (sysname!=null&&!sysname.equals(""))
requestparamMap.put("sysname","%"+sysname+"%");
if (bh!=null&&!bh.equals(""))
requestparamMap.put("bh","%"+bh+"%");
List<Sysgl> sysgls = sysglService.getSysglList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (sysgls != null) {
for (Sysgl sysgl : sysgls) {
String yyridstr = "未预约";
Integer id = sysgl.getId();
String sysnamestr = sysgl.getSysname();
if (sysgl.getYyrid()!=null&&!sysgl.getYyrid().equals("")) {
Integer yyrid = sysgl.getYyrid();
yyridstr = usersService.selectByPrimaryKey(yyrid).getUsername(); /*返回预约用户名*/
System.out.println(yyridstr);
}
Integer lxid = sysgl.getLxid();
String lc = sysgl.getLc();
String fzrid = sysgl.getFzrid();
String bhstr = sysgl.getBh();
Integer sfyy = sysgl.getSfyy();
String lxidstr = syslxService.getSyslxById(lxid).getLx(); //返回实验室类型名称
String sfyystr = "未预约";
if (sfyy==1){
sfyystr="已预约";
}
if (sfyy==2){
sfyystr="预约未审核";
}
Map map = new HashMap();
map.put("id", id);
map.put("yyrid", yyridstr);
map.put("sysname", sysnamestr);
map.put("lc", lc);
map.put("fzrid", fzrid);
map.put("bh", bhstr);
map.put("lxid", lxidstr);
map.put("sfyy", sfyystr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验室基本信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询实验室 显示实验室名称
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsys")
public JSONObject selectsys(HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
List<Sysgl> sysgls = sysglService.getSysglList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (sysgls != null) {
for (Sysgl sysgl : sysgls) {
Integer id = sysgl.getId();
String sysname = sysgl.getSysname();
Map map = new HashMap();
map.put("id", id);
map.put("sysname", sysname);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验室信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部实验室使用审批
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsyssysp")
public JSONObject selectsyssysp(HttpServletRequest httpServletRequest) {
List<Sysgl> sysgls = sysglService.getSysglBySfyy(2);
List<Map<String, Object>> list = new ArrayList<>();
if (sysgls != null) {
for (Sysgl sysgl : sysgls) {
Integer id = sysgl.getId();
String sysname = sysgl.getSysname();
String bh = sysgl.getBh();
String fzrid = sysgl.getFzrid();
String lc = sysgl.getLc();
Integer lxid = sysgl.getLxid();
Integer yyrid = sysgl.getYyrid();
String lx = syslxService.getSyslxById(lxid).getLx();
String yyr = usersService.selectByPrimaryKey(yyrid).getUsername();//显示预约人名称
Map map = new HashMap();
map.put("id", id);
map.put("sysname", sysname);
map.put("bh", bh);
map.put("fzrid", fzrid);
map.put("lc", lc);
map.put("lx", lx);
map.put("yyr", yyr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "打开了实验室使用审批",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询已预约实验室
* @param httpServletRequest
* @return
*/
@RequestMapping("/selecttgkysys")
public JSONObject selecttgkysys(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
Users users = (Users) session.getAttribute("islogin");
Integer tid = users.getId();
List<Sysgl> sysgls = sysglService.getSysglByKysys(tid);
List<Map<String, Object>> list = new ArrayList<>();
if (sysgls != null) {
for (Sysgl sysgl : sysgls) {
Integer id = sysgl.getId();
String sysname = sysgl.getSysname();
String bh = sysgl.getBh();
Map map = new HashMap();
map.put("id", id);
map.put("sysname", sysname);
map.put("bh", bh);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验室信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询全部借用实验室
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectjysysgl")
public JSONObject selectjysysgl(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
Users users = (Users) session.getAttribute("islogin");
Integer tid = users.getId();
List<Sysgl> sysgls = sysglService.getSysglByteacher(tid);
List<Map<String, Object>> list = new ArrayList<>();
if (sysgls != null) {
for (Sysgl sysgl : sysgls) {
String yyridstr = "未预约";
Integer id = sysgl.getId();
String sysnamestr = sysgl.getSysname();
if (sysgl.getYyrid()!=null&&!sysgl.getYyrid().equals("")) {
Integer yyrid = sysgl.getYyrid();
yyridstr = usersService.selectByPrimaryKey(yyrid).getUsername();
}
Integer lxid = sysgl.getLxid();
String lc = sysgl.getLc();
String fzrid = sysgl.getFzrid();
String bhstr = sysgl.getBh();
Integer sfyy = sysgl.getSfyy();
String lxidstr = syslxService.getSyslxById(lxid).getLx();
String sfyystr = "未预约";
if (sfyy==1){
sfyystr="已预约";
}
if (sfyy==2){
sfyystr="预约未审核";
}
Map map = new HashMap();
map.put("id", id);
map.put("yyrid", yyridstr);
map.put("sysname", sysnamestr);
map.put("lc", lc);
map.put("fzrid", fzrid);
map.put("bh", bhstr);
map.put("lxid", lxidstr);
map.put("sfyy", sfyystr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验室基本信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询可用实验室 显示实验室名称
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectkysys")
public JSONObject selectkysys(HttpServletRequest httpServletRequest) {
List<Sysgl> sysgls = sysglService.getSysglBySfyy(0);
List<Map<String, Object>> list = new ArrayList<>();
if (sysgls != null) {
for (Sysgl sysgl : sysgls) {
Integer id = sysgl.getId();
String sysname = sysgl.getSysname();
String bh = sysgl.getBh();
Map map = new HashMap();
map.put("id", id);
map.put("sysname", sysname);
map.put("bh", bh);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验室信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部日志信息
* @param httpServletRequest
* @param page
* @param limit
* @return
*/
@RequestMapping("/selectxtrzgl")
public Map<String, Object> selectxtrzgl(HttpServletRequest httpServletRequest, @RequestParam(value = "page") Integer page,@RequestParam(value = "limit") Integer limit) {
page = page-1;
Integer start = page*limit;
Integer end = (page+1)*limit-1;
List<Log> logs = logService.getlogList();
Integer datacount = logs.size();
Integer i = 0;
List<Map<String, Object>> list = new ArrayList<>();
if (logs != null) {
for (Log log : logs) {
if (i>=start&&i<=end){
Integer id = log.getId();
String cz = log.getCz();
Integer czr = log.getCzr();
Date date = log.getTime();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String timestr = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
String czrstr=usersService.selectByPrimaryKey(czr).getUsername();
Map map = new HashMap();
map.put("id", id);
map.put("cz", cz);
map.put("czr", czrstr);
map.put("time", timestr);
list.add(map);
}
i++;
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", datacount);
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了全部系统日志信息数据",logService);
return map1;
}
/**
* 管理员 查询全部用户组信息
* @param name
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectyhzxxgl")
public JSONObject selectyhzxxgl(@RequestParam(required = false) String name, HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (name!=null&&!name.equals(""))
requestparamMap.put("groupname","%"+name+"%");
List<Groupinfo> groupinfos = groupinfoService.getgroupinfoList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (groupinfos != null) {
for (Groupinfo groupinfo : groupinfos) {
Integer id = groupinfo.getId();
String qx = groupinfo.getQx();
String groupname = groupinfo.getGroupname();
Map map = new HashMap();
map.put("id", id);
map.put("qx", qx);
map.put("groupname", groupname);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了全部用户组信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询用户组权限信息
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectyhzqxgl")
public JSONObject selectyhzqxgl(HttpServletRequest httpServletRequest) {
List<Groupinfo> groupinfos = groupinfoService.getgroupinfoList(null);
List<Map<String, Object>> list = new ArrayList<>();
if (groupinfos != null) {
for (Groupinfo groupinfo : groupinfos) {
Integer id = groupinfo.getId();
String qx = groupinfo.getQx();
String groupname = groupinfo.getGroupname();
String qxs[] ={};
Map map = new HashMap();
map.put("id", id+"_a");
map.put("field", id+"_a");
map.put("title", groupname);
if (qx!=null)
qxs = qx.split(",");
Map child = selectfcd(httpServletRequest);
List childdatas = (List) child.get("data");
List childsmap = new ArrayList();
for (Integer i = 0 ;i<childdatas.size();i++){
boolean sfxz = false;
Map childmap = (Map)childdatas.get(i);
Integer childid = Integer.parseInt(String.valueOf(childmap.get("id")));
String aaaa= Arrays.toString(qxs);
if (aaaa.length()>2&&qxs!=null) {
for (String qxbsstr : qxs) {
if (Integer.parseInt(qxbsstr) == childid) {
sfxz = true;
break;
}
}
}
String childmenuname = String.valueOf(childmap.get("menuname"));
childmap.put("id",childid+"_b_"+id);
childmap.put("title",childmenuname);
childmap.put("checked",sfxz);
childmap.put("field",childid+"_b_"+id);
childsmap.add(childmap);
}
map.put("children",childsmap);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了全部权限节点数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/*
* 管理员 查询父菜单*/
@RequestMapping("/selectfcd")
public Map<String, Object> selectfcd(HttpServletRequest httpServletRequest) {
List<Menu> menus = menuService.getfdmmenuList();
List<Map<String, Object>> list = new ArrayList<>();
if (menus != null) {
for (Menu menu : menus) {
Integer id = menu.getId();
String menuname = menu.getMenuname();
Map map = new HashMap();
map.put("id", id);
map.put("menuname", menuname);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了父菜单信息数据",logService);
return map1;
}
/**
* 管理员 查询菜单信息信息
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectcdgl")
public JSONObject selectcdgl(HttpServletRequest httpServletRequest) {
List<Menu> menus = menuService.getmenuList();
List<Map<String, Object>> list = new ArrayList<>();
if (menus != null) {
for (Menu menu : menus) {
Integer id = menu.getId();
String fdm = null;
if(menu.getFdm()!=null&&menu.getFdm()!="") {
/*查询父菜单名称他*/
fdm = menuService.selectByPrimaryKey(Integer.parseInt(menu.getFdm())).getMenuname();
}
String menulink = menu.getMenulink();
String menuname = menu.getMenuname();
Map map = new HashMap();
map.put("id", id);
map.put("fdm", fdm);
map.put("menulink", menulink);
map.put("menuname", menuname);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了全部菜单信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询父菜单信息 根据fdm是空查询
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectfcd2")
public JSONObject selectfcd2(HttpServletRequest httpServletRequest) {
List<Menu> menus = menuService.getfdmmenuList();
List<Map<String, Object>> list = new ArrayList<>();
if (menus != null) {
for (Menu menu : menus) {
Integer id = menu.getId();
String menuname = menu.getMenuname();
Map map = new HashMap();
map.put("id", id);
map.put("menuname", menuname);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了父菜单信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部教师信息
* @param tname
* @param idcard
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectjsxxgl")
public JSONObject selectjsxxgl(@RequestParam(required = false)String tname,@RequestParam(required = false) String idcard, HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (tname!=null&&!tname.equals(""))
requestparamMap.put("tname","%"+tname+"%");
if (idcard!=null&&!idcard.equals(""))
requestparamMap.put("idcard","%"+idcard+"%");
List<Teacher> teachers = teacherService.getTeacherList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (teachers != null) {
for (Teacher teacher : teachers) {
Integer id = teacher.getId();
String tnamestr = teacher.getTname();
String sex = teacher.getSex();
Date date = teacher.getBirth();
String birth = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日";
String zyzc = teacher.getZyzc();
Integer zyid = teacher.getZyid();
String zystr = zyglService.getZyglById(zyid).getZname();
String tel = teacher.getTel();
String jl = teacher.getJl();
String idcardstr = String.valueOf(teacher.getIdcard());
Map map = new HashMap();
map.put("id", id);
map.put("tname", tnamestr);
map.put("sex", sex);
map.put("birth", birth);
map.put("zyzc", zyzc);
map.put("zystr", zystr);
map.put("tel", tel);
map.put("jl", jl);
map.put("idcard", idcardstr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了教师信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询最后一条教师信息 账号
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectjslast")
public JSONObject selectjslast(HttpServletRequest httpServletRequest) {
Teacher teacher = teacherService.getteacherlast();
List<Map<String, Object>> list = new ArrayList<>();
Integer idcard = teacher.getIdcard();
Map map = new HashMap();
map.put("idcard", idcard+1);
list.add(map);
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了最后一条教师数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询教师信息 显示教师名称
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectjs")
public JSONObject selectjs(HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
List<Teacher> teachers = teacherService.getTeacherList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (teachers != null) {
for (Teacher teacher : teachers) {
Integer id = teacher.getId();
Integer idcard = teacher.getIdcard();
String tname = teacher.getTname();
Map map = new HashMap();
map.put("id", id);
map.put("tname", tname);
map.put("idcard",idcard);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了教师信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询个人信息
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectgrxxwhjs")
public JSONObject selectgrxxwhjs(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
Users users = (Users) session.getAttribute("islogin");
String username = users.getUsername();
Integer groupid = users.getGroupid();
List<Map<String, Object>> list = new ArrayList<>();
if (groupid==2) {
Teacher teacher = teacherService.getTeacherByIdcard(Integer.parseInt(username));
if (teacher!=null){
Integer id = teacher.getId();
Integer idcard = teacher.getIdcard();
Date date = teacher.getBirth();
String birth = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日";
String zyzc = teacher.getZyzc();
String jl = teacher.getJl();
String sex = teacher.getSex();
String tname = teacher.getTname();
String tel = teacher.getTel();
Integer zid = teacher.getZyid();
String zidstr = zyglService.getZyglById(zid).getZname();
Map map = new HashMap();
map.put("id",id);
map.put("idcard",idcard);
map.put("birth",birth);
map.put("zyzc",zyzc);
map.put("jl",jl);
map.put("sex",sex);
map.put("tname",tname);
map.put("tel",tel);
map.put("zid",zidstr);
list.add(map);
}
}
if (groupid==3){
Student student = studentService.getStudentByIdcard(Integer.parseInt(username));
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了个人信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部专业信息
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectzy")
public JSONObject selectzy(HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
List<Zygl> zygls = zyglService.getZyglList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (zygls != null) {
for (Zygl zygl : zygls) {
Integer id = zygl.getId();
String zname = zygl.getZname();
Map map = new HashMap();
map.put("id", id);
map.put("zname", zname);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了专业信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部学生信息
* @param sname
* @param idcard
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectxsxxgl")
public JSONObject selectxsxxgl(@RequestParam(required = false)String sname,@RequestParam(required = false) String idcard, HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (sname!=null&&!sname.equals(""))
requestparamMap.put("sname","%"+sname+"%");
if (idcard!=null&&!idcard.equals(""))
requestparamMap.put("idcard","%"+idcard+"%");
List<Student> students = studentService.getStudentList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (students != null) {
for (Student student : students) {
Integer id = student.getId();
String snamestr = student.getSname();
String sex = student.getSex();
Date date = student.getBirth();
String birth = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日";
Integer zyid = student.getZid();
Integer cid = student.getCid();
String cstr = classesService.getClassesById(cid).getBname();
String zystr = zyglService.getZyglById(zyid).getZname();
String tel = String.valueOf(student.getTel());
String jl = student.getJl();
String idcardstr = String.valueOf(student.getIdcard());
Map map = new HashMap();
map.put("id", id);
map.put("sname", snamestr);
map.put("sex", sex);
map.put("birth", birth);
map.put("zystr", zystr);
map.put("cstr", cstr);
map.put("tel", tel);
map.put("jl", jl);
map.put("idcard", idcardstr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了学生信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询最后一条学生信息 账号
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectxslast")
public JSONObject selectxslast(HttpServletRequest httpServletRequest) {
Student student = studentService.getStudentBylast();
List<Map<String, Object>> list = new ArrayList<>();
Integer idcard = student.getIdcard();
Map map = new HashMap();
map.put("idcard", idcard+1);
list.add(map);
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了最后一条学生数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 学生 个人信息维护
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectgrxxwh")
public JSONObject selectgrxxwh(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
Users users = (Users) session.getAttribute("islogin");
String username = users.getUsername();
Integer groupid = users.getGroupid();
List<Map<String, Object>> list = new ArrayList<>();
if (groupid==2) {
Teacher teacher = teacherService.getTeacherByIdcard(Integer.parseInt(username));
}
if (groupid==3){
Student student = studentService.getStudentByIdcard(Integer.parseInt(username));
if (student!=null){
Integer id = student.getId();
Integer idcard = student.getIdcard();
Date date = student.getBirth();
String birth = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日";
Integer cid = student.getCid();
String cidstr = classesService.getClassesById(cid).getBname();
String jl = student.getJl();
String sex = student.getSex();
String sname = student.getSname();
String tel = student.getTel();
Integer zid = student.getZid();
String zidstr = zyglService.getZyglById(zid).getZname();
Map map = new HashMap();
map.put("id",id);
map.put("idcard",idcard);
map.put("birth",birth);
map.put("cid",cidstr);
map.put("jl",jl);
map.put("sex",sex);
map.put("sname",sname);
map.put("tel",tel);
map.put("zid",zidstr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了个人信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询用户账号信息
* @param username
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectyhzhgl")
public JSONObject selectyhzhgl(@RequestParam(required = false)String username,HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (username!=null&&!username.equals(""))
requestparamMap.put("username","%"+username+"%");
List<Users> userss = usersService.getuserList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (userss != null) {
for (Users users : userss) {
Integer id = users.getId();
String usernamestr = users.getUsername();
Integer gid = users.getGroupid();
String groupstr = groupinfoService.selectByPrimaryKey(gid).getGroupname();// 显示用户组名称
Date date = users.getRegtime();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String regtime = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
Map map = new HashMap();
map.put("id", id);
map.put("username", usernamestr);
map.put("groupstr", groupstr);
map.put("regtime", regtime);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了用户信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部班级信息
* @param bname
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectbjxxgl")
public JSONObject selectbjxxgl(@RequestParam(required = false)String bname,HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (bname!=null&&!bname.equals(""))
requestparamMap.put("bname","%"+bname+"%");
List<Classes> classess = classesService.getClassesList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (classess != null) {
for (Classes classes : classess) {
Integer id = classes.getId();
String bnamestr = classes.getBname();
Integer tid = classes.getTid();
String idcard = String.valueOf(teacherService.getTeacherById(tid).getIdcard());
String tid1 = teacherService.getTeacherById(tid).getTname();
String tidstr = tid1+"---"+idcard;
Map map = new HashMap();
map.put("id", id);
map.put("bname", bnamestr);
map.put("tid", tidstr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了班级信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询班级信息 显示班级名称
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectbj")
public JSONObject selectbj(HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
List<Classes> classess = classesService.getClassesList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (classess != null) {
for (Classes classes : classess) {
Integer id = classes.getId();
String bname = classes.getBname();
Map map = new HashMap();
map.put("id", id);
map.put("bname", bname);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了班级信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部专业信息
* @param zname
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectzyxxgl")
public JSONObject selectzyxxgl(@RequestParam(required = false)String zname, HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (zname!=null&&!zname.equals(""))
requestparamMap.put("zname","%"+zname+"%");
List<Zygl> zygls = zyglService.getZyglList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (zygls != null) {
for (Zygl zygl : zygls) {
Integer id = zygl.getId();
String znamestr = zygl.getZname();
Map map = new HashMap();
map.put("id", id);
map.put("zname", znamestr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了专业信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部实验室类型
* @param lx
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsylxgl")
public JSONObject selectsylxgl(@RequestParam(required = false)String lx, HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (lx!=null&&!lx.equals(""))
requestparamMap.put("lx","%"+lx+"%");
List<Syslx> syslxes = syslxService.getSyslxList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (syslxes != null) {
for (Syslx syslx : syslxes) {
Integer id = syslx.getId();
String lxstr = syslx.getLx();
Map map = new HashMap();
map.put("id", id);
map.put("lx", lxstr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验室类型信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询实验室类型 显示实验类型名称
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsyslx")
public JSONObject selectsyslx(HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
List<Syslx> syslxs = syslxService.getSyslxList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (syslxs != null) {
for (Syslx syslx : syslxs) {
Integer id = syslx.getId();
String lx = syslx.getLx();
Map map = new HashMap();
map.put("id", id);
map.put("lx", lx);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验室类型数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部信息通告
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectxxtggl")
public JSONObject selectxxtggl(HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
List<Xxtg> xxtgs = xxtgService.getXxtgList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (xxtgs != null) {
for (Xxtg xxtg : xxtgs) {
Integer id = xxtg.getId();
String fbrstr = usersService.selectByPrimaryKey(xxtg.getFbrid()).getUsername(); //显示账号名称
String info = xxtg.getInfo();
Date date = xxtg.getFbtime();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String fbtime = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
Map map = new HashMap();
map.put("id", id);
map.put("fbrid", fbrstr);
map.put("info", info);
map.put("fbtime", fbtime);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了信息通告数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 学生 查询全部信息通告
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectxxtgll")
public JSONObject selectxxtgll(@RequestParam(required = false) String info, HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (info!=null&&!info.equals(""))
requestparamMap.put("info","%"+info+"%");
List<Xxtg> xxtgs = xxtgService.getXxtgList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (xxtgs != null) {
for (Xxtg xxtg : xxtgs) {
Integer id = xxtg.getId();
Integer fbrid = xxtg.getFbrid();
String infostr = xxtg.getInfo();
Date date = xxtg.getFbtime();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String fbsj = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
Users users = usersService.selectByPrimaryKey(fbrid);
String username = users.getUsername();
Map map = new HashMap();
map.put("id", id);
map.put("fbrid", username);
map.put("info", infostr);
map.put("fbtime", fbsj);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查看了信息通告",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部实验设备
* @param sbname
* @param bh
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsysbgl")
public JSONObject selectsysbgl(@RequestParam(required = false)String sbname,@RequestParam(required = false) String bh, HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (sbname!=null&&!sbname.equals(""))
requestparamMap.put("sbname","%"+sbname+"%");
if (bh!=null&&!bh.equals(""))
requestparamMap.put("bh","%"+bh+"%");
List<Sysbgl> sysbgls = sysbglService.getSysbglList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (sysbgls != null) {
for (Sysbgl sysbgl : sysbgls) {
Integer id = sysbgl.getId();
String sbnamestr = sysbgl.getSbname();
String bhstr = sysbgl.getBh();
String sysid = sysglService.getSysglById(sysbgl.getSysid()).getSysname(); //查询实验室名称
Date date = sysbgl.getCgsj();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String cgsj = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日";
Integer price = sysbgl.getPrice();
Integer ztid = sysbgl.getZtid();
String ztstr="未使用";
if (ztid==1)
ztstr = "正在使用";
if (ztid==2)
ztstr = "待审核";
if (ztid==3)
ztstr = "维修中";
if (ztid==4)
ztstr = "已损坏";
if (ztid==5)
ztstr = "无法维修";
String sfbxstr = "未报修";
Integer sfbx = sysbgl.getSfbx();
if (sfbx==1)
sfbxstr="已报修";
String info = sysbgl.getInfo();
String img = sysbgl.getImg();
Map map = new HashMap();
map.put("id", id);
map.put("sbname", sbnamestr);
map.put("bh", bhstr);
map.put("sysid", sysid);
map.put("cgsj", cgsj);
map.put("price", price);
map.put("ztid", ztstr);
map.put("sfbx", sfbxstr);
map.put("info", info);
map.put("img", img);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了设备信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 管理员 查询全部设备借用
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsbsysp")
public JSONObject selectsbsysp(HttpServletRequest httpServletRequest) {
List<Jydj> jydjs = jydjService.getJydjByZtid(2);
List<Map<String, Object>> list = new ArrayList<>();
if (jydjs != null) {
for (Jydj jydj : jydjs) {
Integer id = jydj.getId();
String info = jydj.getInfo();
Date date = jydj.getJysj();
Integer sbid = jydj.getSbid();
Integer uid = jydj.getUid();
String sbstr = sysbglService.getSysbglById(sbid).getSbname();
String ustr = usersService.selectByPrimaryKey(uid).getUsername();
String sbbh = sysbglService.getSysbglById(sbid).getBh();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String fbtime = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
Map map = new HashMap();
map.put("id", id);
map.put("info", info);
map.put("sbid", sbstr);
map.put("uid", ustr);
map.put("sbbh", sbbh);
map.put("jysj", fbtime);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "打开了设备使用审批",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询借用设备
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectjysbgl")
public JSONObject selectjysbgl(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
Users users = (Users) session.getAttribute("islogin");
Integer tid = users.getId();
List<Jydj> jydjs = jydjService.getJydjByUid(tid);
List<Map<String, Object>> list = new ArrayList<>();
if (jydjs != null) {
for (Jydj jydj : jydjs) {
Integer id = jydj.getId();
Integer sbid = jydj.getSbid();
Date date = jydj.getJysj();
String info = jydj.getInfo();
Date date1 = jydj.getGhsj();
Integer ztid = jydj.getZtid();
Sysbgl sysbgl = sysbglService.getSysbglById(sbid);
String sbname = sysbgl.getSbname();
String bh = sysbgl.getBh();
String ghsj = "未归还";
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String jysj = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
if (date1!=null) {
String hour2 = date1.getHours() > 9 ? String.valueOf(date1.getHours()) : 0 + String.valueOf(date1.getHours());
String minute2 = date1.getMinutes() > 9 ? String.valueOf(date1.getMinutes()) : 0 + String.valueOf(date1.getMinutes());
String second2 = date1.getSeconds() > 9 ? String.valueOf(date1.getSeconds()) : 0 + String.valueOf(date1.getSeconds());
ghsj = String.valueOf(date1.getYear() + 1900) + "年" + String.valueOf(date1.getMonth() + 1) + "月" + String.valueOf(date1.getDate()) + "日--" + hour + ":" + minute + ":" + second;
}
if(ztid==2)
ghsj="管理员审核中";
if(ztid==3)
ghsj="借用被拒绝";
Map map = new HashMap();
map.put("id", id);
map.put("sbname", sbname);
map.put("bh", bh);
map.put("jysj", jysj);
map.put("ghsj", ghsj);
map.put("info", info);
map.put("ztid", ztid);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了借用设备记录数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询可用设备
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectkysb")
public JSONObject selectkysb(HttpServletRequest httpServletRequest) {
List<Sysbgl> sysbgls = sysbglService.getSysbglByky();
List<Map<String, Object>> list = new ArrayList<>();
if (sysbgls != null) {
for (Sysbgl sysbgl : sysbgls) {
Integer id = sysbgl.getId();
String bh = sysbgl.getBh();
String sbname = sysbgl.getSbname();
Map map = new HashMap();
map.put("id", id);
map.put("bh", bh);
map.put("sbname", sbname);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了可用实验设备列表",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询全部损坏设备记录
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsbshdj")
public JSONObject selectsbshdj(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
Users users = (Users) session.getAttribute("islogin");
Integer uid = users.getId();
List<Sbshdj> sbshdjs = sbshdjService.getSbshdjByUid(uid);
List<Map<String, Object>> list = new ArrayList<>();
if (sbshdjs != null) {
for (Sbshdj sbshdj : sbshdjs) {
Integer id = sbshdj.getId();
Integer sbid = sbshdj.getSbid();
String info = sbshdj.getInfo();
Integer ztid = sbshdj.getZtid();
String ztidstr = "已损坏";
if (ztid==1){
ztidstr="已维修";
}
if (ztid==2){
ztidstr="无法维修";
}
if (ztid==3){
ztidstr="维修中";
}
Date date = sbshdj.getShsj();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String shsj = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
Sysbgl sysbgl = sysbglService.getSysbglById(sbid);
String sbname = sysbgl.getSbname();
String bh = sysbgl.getBh();
Map map = new HashMap();
map.put("id", id);
map.put("sbname", sbname);
map.put("bh", bh);
map.put("shsj", shsj);
map.put("info", info);
map.put("ztid", ztidstr);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了设备损坏记录数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询全部维修设备
* @param info
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsbwxdj")
public JSONObject selectsbwxdj(@RequestParam(required = false) String info, HttpServletRequest httpServletRequest) {
Map requestparamMap = new HashMap();
if (info!=null&&!info.equals(""))
requestparamMap.put("info","%"+info+"%");
List<Sbwxdj> sbwxdjs = sbwxdjService.getSbwxdjList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (sbwxdjs != null) {
for (Sbwxdj sbwxdj : sbwxdjs) {
Integer id = sbwxdj.getId();
Integer sbid = sbwxdj.getSbid();
String infostr = sbwxdj.getInfo();
Integer ztid = sbwxdj.getZtid();
String wxr = sbwxdj.getWxr();
Integer money = sbwxdj.getMoney();
String ztidstr = "正在维修";
if (ztid==1){
ztidstr="维修完毕";
}
if (ztid==2){
ztidstr="无法维修";
}
Date date = sbwxdj.getWssj();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String wxsj = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
Sysbgl sysbgl = sysbglService.getSysbglById(sbid);
String sbname = sysbgl.getSbname();
String bh = sysbgl.getBh();
Map map = new HashMap();
map.put("id", id);
map.put("sbname", sbname);
map.put("bh", bh);
map.put("wxsj", wxsj);
map.put("info", infostr);
map.put("ztid", ztidstr);
map.put("wxr", wxr);
map.put("money", money);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了设备维修记录数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询已损坏设备 显示维修设备名
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectkwxsb")
public JSONObject selectkwxsb(HttpServletRequest httpServletRequest) {
List<Sbshdj> sbshdjs = sbshdjService.getSbshdjByZtid(0);
List<Map<String, Object>> list = new ArrayList<>();
if (sbshdjs != null) {
for (Sbshdj sbshdj : sbshdjs) {
Integer id = sbshdj.getId();
Integer sbid = sbshdj.getSbid();
Sysbgl sysbgl = sysbglService.getSysbglById(sbid);
String sbname = sysbgl.getSbname();
String bh = sysbgl.getBh();
Map map = new HashMap();
map.put("id", sbid);
map.put("sbname", sbname);
map.put("bh", bh);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了可维修设备列表数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 学生 查询实验设备信息
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsysbll")
public JSONObject selectsysbll(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
Users users = (Users) session.getAttribute("islogin");
List<Map<String, Object>> list = new ArrayList<>();
if (users.getGroupid()==3){
Student student = studentService.getStudentByIdcard(Integer.parseInt(users.getUsername()));
List<Syxxb> syxxbList = syxxbService.getSyxxbByCid(student.getCid());
if (syxxbList!=null)
for (Syxxb syxxb : syxxbList){
Integer sysid = syxxb.getSysid();
List<Sysbgl> sysbgls = sysbglService.getSysbglBySysid(sysid);
for (Sysbgl sysbgl:sysbgls){
Integer id = sysbgl.getId();
String sbnamestr = sysbgl.getSbname();
String bhstr = sysbgl.getBh();
String sysidstr = sysglService.getSysglById(sysid).getSysname();
Date date = sysbgl.getCgsj();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String cgsj = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日";
Integer price = sysbgl.getPrice();
Integer ztid = sysbgl.getZtid();
String ztstr="未使用";
if (ztid==1)
ztstr = "正在使用";
if (ztid==2)
ztstr = "待审核";
if (ztid==3)
ztstr = "维修中";
if (ztid==4)
ztstr = "已损坏";
if (ztid==5)
ztstr = "无法维修";
String sfbxstr = "未报修";
Integer sfbx = sysbgl.getSfbx();
if (sfbx==1)
sfbxstr="已报修";
String info = sysbgl.getInfo();
String img = sysbgl.getImg();
Map map = new HashMap();
map.put("id", id);
map.put("sbname", sbnamestr);
map.put("bh", bhstr);
map.put("sysid", sysidstr);
map.put("cgsj", cgsj);
map.put("price", price);
map.put("ztid", ztstr);
map.put("sfbx", sfbxstr);
map.put("info", info);
map.put("img", img);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了设备信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了设备信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 教师 查询全部实验课程信息
* @param info
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsykcgl")
public JSONObject selectsykcgl(@RequestParam(required = false)String info,HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
Users users = (Users) session.getAttribute("islogin");
Integer uid = users.getId();
System.out.printf("uid");
Map requestparamMap = new HashMap();
if (info!=null&&!info.equals(""))
requestparamMap.put("info","%"+info+"%");
if (uid!=null&&!uid.equals(""))
requestparamMap.put("tid",uid);
List<Syxxb> syxxbs = syxxbService.getSyxxbList(requestparamMap);
List<Map<String, Object>> list = new ArrayList<>();
if (syxxbs != null) {
for (Syxxb syxxb : syxxbs) {
Integer cid = syxxb.getCid();
Date date = syxxb.getFbtime();
Integer id = syxxb.getId();
String infostr = syxxb.getInfo();
Integer sfwc = syxxb.getSfwc();
Integer sysid = syxxb.getSysid();
String cidstr = classesService.getClassesById(cid).getBname();
String sfwcstr = "未完成";
if (sfwc==1){
sfwcstr="已完成";
}
String sysidstr = sysglService.getSysglById(sysid).getSysname();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String fbtime = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
Map map = new HashMap();
map.put("id", id);
map.put("info", infostr);
map.put("sysid", sysidstr);
map.put("cid", cidstr);
map.put("sfwc", sfwcstr);
map.put("fbtime", fbtime);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验课程信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
/**
* 学生 查询实验课程信息
* @param httpServletRequest
* @return
*/
@RequestMapping("/selectsykcll")
public JSONObject selectsykcll(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
Users users = (Users) session.getAttribute("islogin");
List<Map<String, Object>> list = new ArrayList<>();
if (users.getGroupid()==3){
Student student = studentService.getStudentByIdcard(Integer.parseInt(users.getUsername()));
List<Syxxb> syxxbs = syxxbService.getSyxxbByCid(student.getCid());
if (syxxbs != null) {
for (Syxxb syxxb : syxxbs) {
Date date = syxxb.getFbtime();
Integer id = syxxb.getId();
String infostr = syxxb.getInfo();
Integer sysid = syxxb.getSysid();
String bh = sysglService.getSysglById(sysid).getBh();
String sysidstr = sysglService.getSysglById(sysid).getSysname();
String hour = date.getHours()>9?String.valueOf(date.getHours()):0+String.valueOf(date.getHours());
String minute = date.getMinutes()>9?String.valueOf(date.getMinutes()):0+String.valueOf(date.getMinutes());
String second = date.getSeconds()>9?String.valueOf(date.getSeconds()):0+String.valueOf(date.getSeconds());
String fbtime = String.valueOf(date.getYear()+1900)+"年"+String.valueOf(date.getMonth()+1)+"月"+String.valueOf(date.getDate())+"日--"+hour+":"+minute+":"+second;
Map map = new HashMap();
map.put("id", id);
map.put("info", infostr);
map.put("bh", bh);
map.put("sysid", sysidstr);
map.put("fbtime", fbtime);
list.add(map);
}
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验课程信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
Map<String, Object> map1 = new HashMap<>();
map1.put("code", 0);
map1.put("msg", "ok");
map1.put("count", list.size());
map1.put("data", list);
setLog.setlod(httpServletRequest, "查询了实验课程信息数据",logService);
JSONObject json = new JSONObject(map1);
return json;
}
}
如果也想学习本系统,下面领取。关注并回复:035ssm