摘要
三省学堂-学习辅助系统是学校是学习辅助管理必不可少的一个部分。在学校学习辅助管理的整个过程中,学习辅助系统担负着最重要的角色。为满足如今日益复杂的管理需求,各类学习辅助管理程序也在不断改进。本课题所设计的三省学堂-学习辅助系统,使用java技术进行开发,它的优点代码不能从浏览器查看,保密性非常好,比其他的系统更具安全性。java还容易修改和调试,毕竟学校是在不断发展过程中,难免有更多需求,这点很重要。而且,本系统对学习辅助的管理,是为了满足学校更深层次的需求。除了上述优势外,本系统还具有查询迅速,搜索资料方便,可靠性强等特点。
关键词:三省学堂-学习辅助系统;java;可靠性
ssm三省学堂—学习辅助系统和论文答辩PPT723
演示视频:
ssm三省学堂—学习辅助系统和论文答辩PPT
Absract
Three provinces school - learning aid system is an essential part of school learning aid management. In the whole process of school learning aid management, learning aid system plays the most important role. To meet today's increasingly complex management needs, all kinds of learning assistance management programs are constantly improved. This topic designed by the three provinces of the school - learning assistance system, using Java technology for development, its advantages of the code can not be viewed from the browser, confidentiality is very good, more security than other systems. Java is also easy to modify and debug, which is important as schools continue to grow and need more. Moreover, the system of learning assistance management, is to meet the deeper needs of the school. In addition to the advantages mentioned above, the system also has the characteristics of quick inquiry, convenient data search and strong reliability.
Key words: Three provinces schools-learning assistance system; Java; reliability
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.JiazhangEntity;
import com.entity.view.JiazhangView;
import com.service.JiazhangService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 家长
* 后端接口
* @author
* @email
* @date 2022-04-01 10:37:30
*/
@RestController
@RequestMapping("/jiazhang")
public class JiazhangController {
@Autowired
private JiazhangService jiazhangService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
JiazhangEntity user = jiazhangService.selectOne(new EntityWrapper().eq("jiazhangzhanghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"jiazhang", "家长" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody JiazhangEntity jiazhang){
//ValidatorUtils.validateEntity(jiazhang);
JiazhangEntity user = jiazhangService.selectOne(new EntityWrapper().eq("jiazhangzhanghao", jiazhang.getJiazhangzhanghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
jiazhang.setId(uId);
jiazhangService.insert(jiazhang);
return R.ok();
}
/**
* 退出
*/
@RequestMapping("/logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
JiazhangEntity user = jiazhangService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
JiazhangEntity user = jiazhangService.selectOne(new EntityWrapper().eq("jiazhangzhanghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
jiazhangService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map params,JiazhangEntity jiazhang,
HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = jiazhangService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiazhang), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map params,JiazhangEntity jiazhang,
HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = jiazhangService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiazhang), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( JiazhangEntity jiazhang){
EntityWrapper ew = new EntityWrapper();
ew.allEq(MPUtil.allEQMapPre( jiazhang, "jiazhang"));
return R.ok().put("data", jiazhangService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(JiazhangEntity jiazhang){
EntityWrapper< JiazhangEntity> ew = new EntityWrapper< JiazhangEntity>();
ew.allEq(MPUtil.allEQMapPre( jiazhang, "jiazhang"));
JiazhangView jiazhangView = jiazhangService.selectView(ew);
return R.ok("查询家长成功").put("data", jiazhangView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
JiazhangEntity jiazhang = jiazhangService.selectById(id);
return R.ok().put("data", jiazhang);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
JiazhangEntity jiazhang = jiazhangService.selectById(id);
return R.ok().put("data", jiazhang);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody JiazhangEntity jiazhang, HttpServletRequest request){
jiazhang.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(jiazhang);
JiazhangEntity user = jiazhangService.selectOne(new EntityWrapper().eq("jiazhangzhanghao", jiazhang.getJiazhangzhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
jiazhang.setId(new Date().getTime());
jiazhangService.insert(jiazhang);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody JiazhangEntity jiazhang, HttpServletRequest request){
jiazhang.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(jiazhang);
JiazhangEntity user = jiazhangService.selectOne(new EntityWrapper().eq("jiazhangzhanghao", jiazhang.getJiazhangzhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
jiazhang.setId(new Date().getTime());
jiazhangService.insert(jiazhang);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody JiazhangEntity jiazhang, HttpServletRequest request){
//ValidatorUtils.validateEntity(jiazhang);
jiazhangService.updateById(jiazhang);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
jiazhangService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper wrapper = new EntityWrapper();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = jiazhangService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.ZuoyexinxiEntity;
import com.entity.view.ZuoyexinxiView;
import com.service.ZuoyexinxiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import com.service.StoreupService;
import com.entity.StoreupEntity;
/**
* 作业信息
* 后端接口
* @author
* @email
* @date 2022-04-01 10:37:30
*/
@RestController
@RequestMapping("/zuoyexinxi")
public class ZuoyexinxiController {
@Autowired
private ZuoyexinxiService zuoyexinxiService;
@Autowired
private StoreupService storeupService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map params,ZuoyexinxiEntity zuoyexinxi,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
zuoyexinxi.setJiaoshigonghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper ew = new EntityWrapper();
PageUtils page = zuoyexinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zuoyexinxi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map params,ZuoyexinxiEntity zuoyexinxi,
HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = zuoyexinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zuoyexinxi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ZuoyexinxiEntity zuoyexinxi){
EntityWrapper ew = new EntityWrapper();
ew.allEq(MPUtil.allEQMapPre( zuoyexinxi, "zuoyexinxi"));
return R.ok().put("data", zuoyexinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ZuoyexinxiEntity zuoyexinxi){
EntityWrapper< ZuoyexinxiEntity> ew = new EntityWrapper< ZuoyexinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( zuoyexinxi, "zuoyexinxi"));
ZuoyexinxiView zuoyexinxiView = zuoyexinxiService.selectView(ew);
return R.ok("查询作业信息成功").put("data", zuoyexinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ZuoyexinxiEntity zuoyexinxi = zuoyexinxiService.selectById(id);
zuoyexinxi.setClicknum(zuoyexinxi.getClicknum()+1);
zuoyexinxi.setClicktime(new Date());
zuoyexinxiService.updateById(zuoyexinxi);
return R.ok().put("data", zuoyexinxi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ZuoyexinxiEntity zuoyexinxi = zuoyexinxiService.selectById(id);
zuoyexinxi.setClicknum(zuoyexinxi.getClicknum()+1);
zuoyexinxi.setClicktime(new Date());
zuoyexinxiService.updateById(zuoyexinxi);
return R.ok().put("data", zuoyexinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ZuoyexinxiEntity zuoyexinxi, HttpServletRequest request){
zuoyexinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(zuoyexinxi);
zuoyexinxiService.insert(zuoyexinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ZuoyexinxiEntity zuoyexinxi, HttpServletRequest request){
zuoyexinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(zuoyexinxi);
zuoyexinxiService.insert(zuoyexinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ZuoyexinxiEntity zuoyexinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(zuoyexinxi);
zuoyexinxiService.updateById(zuoyexinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
zuoyexinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper wrapper = new EntityWrapper();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaoshi")) {
wrapper.eq("jiaoshigonghao", (String)request.getSession().getAttribute("username"));
}
int count = zuoyexinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map params,ZuoyexinxiEntity zuoyexinxi, HttpServletRequest request,String pre){
EntityWrapper ew = new EntityWrapper();
Map newMap = new HashMap();
Map param = new HashMap();
Iterator> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicknum");
params.put("order", "desc");
PageUtils page = zuoyexinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zuoyexinxi), params), params));
return R.ok().put("data", page);
}
}