互联网发展至今,无论是其理论还是技术都已经成熟,而且它广泛参与在社会中的方方面面。它让信息都可以通过网络传播,搭配信息管理工具可以很好地为人们提供服务。针对高校教师成果信息管理混乱,出错率高,信息安全性差,劳动强度大,费时费力等问题,采用基于web的高校教师成果管理可以有效管理,使信息管理能够更加科学和规范。
基于web的高校教师成果管理使用Java语言进行编码,使用Mysql创建数据表保存本系统产生的数据。总之,基于web的高校教师成果管理集中管理信息,有着保密性强,效率高,存储空间大,成本低等诸多优点。它可以降低信息管理成本,实现信息管理计算机化。
关键词:基于web的高校教师成果管理;Java语言;Mysql
基于springboot的高校教师成果管理小程序的设计与实现weixin177
演示视频:
基于springboot的高校教师成果管理小程序
Abstract
Since the development of the Internet, both its theory and technology have matured, and it has been widely involved in all aspects of society. It allows information to be disseminated through the Internet, and it can serve people well with information management tools. In view of the chaotic information management of CET-4, high error rate, poor information security, high labor intensity, and time-consuming and labor-consuming problems, the use of the web-based CET-4 online test system can effectively manage the information and make information management more scientific and standardized.
The web-based English Level 4 online examination system uses Java language for coding, and uses Mysql to create data tables to save the data generated by the system. The system can provide information display and corresponding services. Its administrator manages the test papers and the information of the question bank that composes the test papers, checks the scores of the student test papers, and manages classes and students. Students choose the test questions to answer the questions, and they can view the answer scores.
In short, the web-based English Level 4 online examination system centrally manages information and has many advantages such as strong confidentiality, high efficiency, large storage space, and low cost. It can reduce the cost of information management and realize the computerization of information management.
Key Words:Web-based English Level 4 online examination system; Java language; Mysql文章来源:https://www.toymoban.com/news/detail-827052.html
文章来源地址https://www.toymoban.com/news/detail-827052.html
package com.controller;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
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.bind.annotation.RestController;
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;
/**
* 登录相关
*/
@RequestMapping("users")
@RestController
public class UserController{
@Autowired
private UserService userService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
if(user==null || !user.getPassword().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
userService.insert(user);
return R.ok();
}
/**
* 退出
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
if(user==null) {
return R.error("账号不存在");
}
user.setPassword("123456");
userService.update(user,null);
return R.ok("密码已重置为:123456");
}
/**
* 列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,UserEntity user){
EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/list")
public R list( UserEntity user){
EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
ew.allEq(MPUtil.allEQMapPre( user, "user"));
return R.ok().put("data", userService.selectListView(ew));
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
UserEntity user = userService.selectById(id);
return R.ok().put("data", user);
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
UserEntity user = userService.selectById(id);
return R.ok().put("data", user);
}
/**
* 保存
*/
@PostMapping("/save")
public R save(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
userService.insert(user);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername()));
if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {
return R.error("用户名已存在。");
}
userService.updateById(user);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
userService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 荣誉信息
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/rongyu")
public class RongyuController {
private static final Logger logger = LoggerFactory.getLogger(RongyuController.class);
@Autowired
private RongyuService rongyuService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
@Autowired
private JiaoshiService jiaoshiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
else if("教师".equals(role))
params.put("jiaoshiId",request.getSession().getAttribute("userId"));
params.put("rongyuDeleteStart",1);params.put("rongyuDeleteEnd",1);
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
PageUtils page = rongyuService.queryPage(params);
//字典表数据转换
List<RongyuView> list =(List<RongyuView>)page.getList();
for(RongyuView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
RongyuEntity rongyu = rongyuService.selectById(id);
if(rongyu !=null){
//entity转view
RongyuView view = new RongyuView();
BeanUtils.copyProperties( rongyu , view );//把实体数据重构到view中
//级联表
JiaoshiEntity jiaoshi = jiaoshiService.selectById(rongyu.getJiaoshiId());
if(jiaoshi != null){
BeanUtils.copyProperties( jiaoshi , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setJiaoshiId(jiaoshi.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody RongyuEntity rongyu, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,rongyu:{}",this.getClass().getName(),rongyu.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
else if("教师".equals(role))
rongyu.setJiaoshiId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
Wrapper<RongyuEntity> queryWrapper = new EntityWrapper<RongyuEntity>()
.eq("rongyu_name", rongyu.getRongyuName())
.eq("rongyu_types", rongyu.getRongyuTypes())
.eq("jiaoshi_id", rongyu.getJiaoshiId())
.eq("rongyu_yesno_types", rongyu.getRongyuYesnoTypes())
.eq("rongyu_delete", rongyu.getRongyuDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
RongyuEntity rongyuEntity = rongyuService.selectOne(queryWrapper);
if(rongyuEntity==null){
rongyu.setRongyuYesnoTypes(1);
rongyu.setRongyuDelete(1);
rongyu.setCreateTime(new Date());
rongyuService.insert(rongyu);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody RongyuEntity rongyu, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,rongyu:{}",this.getClass().getName(),rongyu.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(StringUtil.isEmpty(role))
// return R.error(511,"权限为空");
// else if("教师".equals(role))
// rongyu.setJiaoshiId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
//根据字段查询是否有相同数据
Wrapper<RongyuEntity> queryWrapper = new EntityWrapper<RongyuEntity>()
.notIn("id",rongyu.getId())
.andNew()
.eq("rongyu_name", rongyu.getRongyuName())
.eq("rongyu_types", rongyu.getRongyuTypes())
.eq("jiaoshi_id", rongyu.getJiaoshiId())
.eq("rongyu_yesno_types", rongyu.getRongyuYesnoTypes())
.eq("rongyu_delete", rongyu.getRongyuDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
RongyuEntity rongyuEntity = rongyuService.selectOne(queryWrapper);
if("".equals(rongyu.getRongyuPhoto()) || "null".equals(rongyu.getRongyuPhoto())){
rongyu.setRongyuPhoto(null);
}
if(rongyuEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// rongyu.set
// }
rongyuService.updateById(rongyu);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
ArrayList<RongyuEntity> list = new ArrayList<>();
for(Integer id:ids){
RongyuEntity rongyuEntity = new RongyuEntity();
rongyuEntity.setId(id);
rongyuEntity.setRongyuDelete(2);
list.add(rongyuEntity);
}
if(list != null && list.size() >0){
rongyuService.updateBatchById(list);
}
return R.ok();
}
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
List<RongyuEntity> rongyuList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
}else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
return R.error(511,"找不到上传文件,请联系管理员");
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List<String> data:dataList){
//循环
RongyuEntity rongyuEntity = new RongyuEntity();
// rongyuEntity.setRongyuName(data.get(0)); //标题 要改的
// rongyuEntity.setRongyuTypes(Integer.valueOf(data.get(0))); //类型 要改的
// rongyuEntity.setRongyuPhoto("");//照片
// rongyuEntity.setJiaoshiId(Integer.valueOf(data.get(0))); //发布教师 要改的
// rongyuEntity.setRongyuYesnoTypes(Integer.valueOf(data.get(0))); //审核结果 要改的
// rongyuEntity.setRongyuContent("");//照片
// rongyuEntity.setRongyuDelete(1);//逻辑删除字段
// rongyuEntity.setCreateTime(date);//时间
rongyuList.add(rongyuEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
rongyuService.insertBatch(rongyuList);
return R.ok();
}
}
}
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = rongyuService.queryPage(params);
//字典表数据转换
List<RongyuView> list =(List<RongyuView>)page.getList();
for(RongyuView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
RongyuEntity rongyu = rongyuService.selectById(id);
if(rongyu !=null){
//entity转view
RongyuView view = new RongyuView();
BeanUtils.copyProperties( rongyu , view );//把实体数据重构到view中
//级联表
JiaoshiEntity jiaoshi = jiaoshiService.selectById(rongyu.getJiaoshiId());
if(jiaoshi != null){
BeanUtils.copyProperties( jiaoshi , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setJiaoshiId(jiaoshi.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody RongyuEntity rongyu, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,rongyu:{}",this.getClass().getName(),rongyu.toString());
Wrapper<RongyuEntity> queryWrapper = new EntityWrapper<RongyuEntity>()
.eq("rongyu_name", rongyu.getRongyuName())
.eq("rongyu_types", rongyu.getRongyuTypes())
.eq("jiaoshi_id", rongyu.getJiaoshiId())
.eq("rongyu_yesno_types", rongyu.getRongyuYesnoTypes())
.eq("rongyu_delete", rongyu.getRongyuDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
RongyuEntity rongyuEntity = rongyuService.selectOne(queryWrapper);
if(rongyuEntity==null){
rongyu.setRongyuYesnoTypes(1);
rongyu.setRongyuDelete(1);
rongyu.setCreateTime(new Date());
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// rongyu.set
// }
rongyuService.insert(rongyu);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}
到了这里,关于基于springboot的高校教师成果管理小程序的设计与实现的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!