🍊作者:计算机编程-吉哥
技术选型
springboot、mybatis、vue、elementui、layui、html、css、mysql、jdk1.8
数据库表结构
13张
开发工具
idea或者eclipse、navicat
⭐功能
【角色】管理员、学生、老师
【管理员功能】
首页、个人中心、学生管理、教师管理、问题发布管理、疑难解答管理
【学生功能】
首页、个人中心、问题发布管理、疑难解答管理、资料管理、作业管理、消息管理
【教师功能】
首页、个人中心、疑难解答管理、课程管理、资料管理、试题管理、作业管理、消息管理
🏆项目演示截图:
1、管理员端-登录
2、管理员端-学生管理
3、管理员端-教师管理
4、管理员端-问题发布管理
5、管理员端-疑难解答
6、学生端-问题发布
7、学生端-疑难解答
8、学生端-资料管理
9、学生端-作业管理-课程列表
10、学生端-消息管理-在线聊天
11、学生端-消息管理-聊天回复
12、学生端-开始作业
13、教师端-疑难解答
14、教师端-课程管理
15、教师端-资料管理
16、教师端-试题管理
17、教师端-课程列表
18、教师端-消息管理-在线聊天
19、教师端-消息管理-聊天回复
核心功能代码实现
1、问题发布Controller
package com.controller;
/**
* 问题发布
* 后端接口
* @author 计算机编程-吉哥
* @email
* @date 2022-10-01 17:15:52
*/
@RestController
@RequestMapping("/wentifabu")
public class WentifabuController {
@Autowired
private WentifabuService wentifabuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,WentifabuEntity wentifabu, HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("xuesheng")) {
wentifabu.setXuehao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<WentifabuEntity> ew = new EntityWrapper<WentifabuEntity>();
PageUtils page = wentifabuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wentifabu), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,WentifabuEntity wentifabu, HttpServletRequest request){
EntityWrapper<WentifabuEntity> ew = new EntityWrapper<WentifabuEntity>();
PageUtils page = wentifabuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wentifabu), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( WentifabuEntity wentifabu){
EntityWrapper<WentifabuEntity> ew = new EntityWrapper<WentifabuEntity>();
ew.allEq(MPUtil.allEQMapPre( wentifabu, "wentifabu"));
return R.ok().put("data", wentifabuService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(WentifabuEntity wentifabu){
EntityWrapper< WentifabuEntity> ew = new EntityWrapper< WentifabuEntity>();
ew.allEq(MPUtil.allEQMapPre( wentifabu, "wentifabu"));
WentifabuView wentifabuView = wentifabuService.selectView(ew);
return R.ok("查询问题发布成功").put("data", wentifabuView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
WentifabuEntity wentifabu = wentifabuService.selectById(id);
return R.ok().put("data", wentifabu);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") String id){
WentifabuEntity wentifabu = wentifabuService.selectById(id);
return R.ok().put("data", wentifabu);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody WentifabuEntity wentifabu, HttpServletRequest request){
wentifabu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wentifabu);
wentifabuService.insert(wentifabu);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody WentifabuEntity wentifabu, HttpServletRequest request){
wentifabu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wentifabu);
wentifabuService.insert(wentifabu);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody WentifabuEntity wentifabu, HttpServletRequest request){
//ValidatorUtils.validateEntity(wentifabu);
wentifabuService.updateById(wentifabu);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
wentifabuService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
2、问题发布Service
package com.service.impl;
/**
* 计算机编程-吉哥
**/
@Service("wentifabuService")
public class WentifabuServiceImpl extends ServiceImpl<WentifabuDao, WentifabuEntity> implements WentifabuService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<WentifabuEntity> page = this.selectPage(
new Query<WentifabuEntity>(params).getPage(),
new EntityWrapper<WentifabuEntity>()
);
return new PageUtils(page);
}
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<WentifabuEntity> wrapper) {
Page<WentifabuView> page =new Query<WentifabuView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
public List<WentifabuVO> selectListVO(Wrapper<WentifabuEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
}
@Override
public WentifabuVO selectVO(Wrapper<WentifabuEntity> wrapper) {
return baseMapper.selectVO(wrapper);
}
@Override
public List<WentifabuView> selectListView(Wrapper<WentifabuEntity> wrapper) {
return baseMapper.selectListView(wrapper);
}
@Override
public WentifabuView selectView(Wrapper<WentifabuEntity> wrapper) {
return baseMapper.selectView(wrapper);
}
}
3、问题发布Dao(数据访问对象)
package com.dao;
/**
* 问题发布
*
* @author 计算机编程-吉哥
* @email
* @date 2022-10-01 17:15:52
*/
public interface WentifabuDao extends BaseMapper<WentifabuEntity> {
List<WentifabuVO> selectListVO(@Param("ew") Wrapper<WentifabuEntity> wrapper);
WentifabuVO selectVO(@Param("ew") Wrapper<WentifabuEntity> wrapper);
List<WentifabuView> selectListView(@Param("ew") Wrapper<WentifabuEntity> wrapper);
List<WentifabuView> selectListView(Pagination page,@Param("ew") Wrapper<WentifabuEntity> wrapper);
WentifabuView selectView(@Param("ew") Wrapper<WentifabuEntity> wrapper);
}
4、问题发布Dao.xml(mybatis映射文件)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dao.WentifabuDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.entity.WentifabuEntity" id="wentifabuMap">
<result property="biaoti" column="biaoti"/>
<result property="timu" column="timu"/>
<result property="daan" column="daan"/>
<result property="faburiqi" column="faburiqi"/>
<result property="xuehao" column="xuehao"/>
<result property="xingming" column="xingming"/>
<result property="sfsh" column="sfsh"/>
<result property="shhf" column="shhf"/>
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.WentifabuVO" >
SELECT * FROM wentifabu wentifabu
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectVO"
resultType="com.entity.vo.WentifabuVO" >
SELECT wentifabu.* FROM wentifabu wentifabu
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectListView"
resultType="com.entity.view.WentifabuView" >
SELECT wentifabu.* FROM wentifabu wentifabu
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.WentifabuView" >
SELECT * FROM wentifabu wentifabu <where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper>