Skip to content

Commit

Permalink
新增教师对学生的搜索
Browse files Browse the repository at this point in the history
  • Loading branch information
“mokeeqian committed May 12, 2021
1 parent 8a66034 commit 99f7da1
Show file tree
Hide file tree
Showing 11 changed files with 444 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;

@SpringBootApplication
@SpringBootApplication//(exclude = {SecurityAutoConfiguration.class })
@MapperScan(value = "cn.edu.ahut.copydetector.dao")
public class CopydetectorApplication {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,6 @@ public String search(Model model){
return "admin/search";
}
}
@RequestMapping(value = "/welcome")
public String welcome(Model model) {
Object a = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if ("anonymousUser".equals(a.toString())){
return "redirect:logout";
}else {
user = (User) a;
model.addAttribute("current", user);
return "admin/welcome";
}
}


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package cn.edu.ahut.copydetector.controller;

import cn.edu.ahut.copydetector.common.TableResult;
import cn.edu.ahut.copydetector.constant.BasicConstant;
import cn.edu.ahut.copydetector.constant.DatabaseConstant;
import cn.edu.ahut.copydetector.constant.OtherConstant;
Expand Down Expand Up @@ -32,6 +33,7 @@
@Controller
@Slf4j
@RequestMapping("/teacher")
@SuppressWarnings("unchecked")
public class TeacherController {

private User user = new User();
Expand Down Expand Up @@ -119,6 +121,40 @@ public String myFolder(Model model) {
}
}

@RequestMapping(value = "/students")
public String students(Model model) {
Object a = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if ("anonymousUser".equals(a.toString())){
return "redirect:logout";
}else {
user = (User) a;
model.addAttribute("current", user);
return "admin/students";
}
}

/**
* 教师搜索学生用户
* @param page
* @param limit
* @param role
* @return
*/
@RequestMapping(value = "/users", method = RequestMethod.GET)
@ResponseBody
public TableResult<User> users(
@RequestParam("page") int page,
@RequestParam("limit") int limit,
@RequestParam(required = false, value = "role") Integer role) {
TableResult<User> tableResult = new TableResult<>();
PageBean<User> res = userService.selectUsersByRole(page, limit, role, new HashMap<>());
tableResult.setData(res.getList());
tableResult.setCode(0);
tableResult.setCount(res.getTotalRecord());
tableResult.setMsg("");
return tableResult;
}


/**
* 修改密码(后续优化:将旧密码的确认做成异步)
Expand Down
25 changes: 17 additions & 8 deletions src/main/resources/templates/admin/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,24 @@
, groups: 5
}
, cols: [[
// {type: 'checkbox', fixed: 'left'}
// , {field: 'name', title: '文件名', sort: true, style: 'cursor: pointer;', event: 'setSign'}
// , {field: 'submittername', title: '姓名', sort: true, style: 'cursor: pointer;'}
// , {field: 'submitterid', title: '学号', sort: true, style: 'cursor: pointer;'} // 新增提交者姓名
// , {field: 'date', title: '修改日期', width: 150, sort: true}
// , {field: 'size', title: '文件大小', width: 120, sort: true}
// , {field: 'type', title: '文件类型', width: 120}
// , {field: 'status', title: '状态', sort: true, templet:'#statusTpl'}
// , {fixed: 'right', title:'操作', toolbar: '#barDemo', width:220}
{type: 'checkbox', fixed: 'left'}
, {field: 'name', title: '文件名', sort: true, style: 'cursor: pointer;', event: 'setSign'}
, {field: 'submittername', title: '姓名', sort: true, style: 'cursor: pointer;'}
, {field: 'submitterid', title: '学号', sort: true, style: 'cursor: pointer;'} // 新增提交者姓名
, {field: 'date', title: '修改日期', width: 150, sort: true}
, {field: 'size', title: '文件大小', width: 120, sort: true}
, {field: 'type', title: '文件类型', width: 120}
, {field: 'status', title: '状态', sort: true, templet:'#statusTpl'}
, {fixed: 'right', title:'操作', toolbar: '#barDemo', width:220}
, {field: 'name', title: '文件名', sort: true, style: 'cursor: pointer;', event: 'setSign', width: '28%'}
, {field: 'submittername', title: '姓名', width: '7%', sort: true}
, {field: 'submitterid', title: '学号', width: '6%', sort: true} // 新增提交者姓名
, {field: 'date', title: '修改日期', width: '15%', sort: true}
, {field: 'size', title: '文件大小', width: '7%', sort: true}
, {field: 'type', title: '文件类型', width: '7%'}
, {field: 'status', title: '状态', sort: true, templet:'#statusTpl', width: '10%'}
, {fixed: 'right', title:'操作', toolbar: '#barDemo', width:'20%'}
]]
, done: function(){
//监听上传按钮,支持拖拽上传
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<i class="iconfont nav_right">&#xe697;</i></a>
<ul class="sub-menu">
<li>
<a onclick="xadmin.add_tab('拆线图','/admin/welcome')">
<a onclick="xadmin.add_tab('拆线图','/admin/systeminfo')">
<i class="iconfont">&#xe6a7;</i>
<cite>拆线图</cite></a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/admin/informs.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<select name="department" id="departmentSelect" lay-filter="departmentSelect">
<option value="">选择系别</option>
<option value="计算机系">计算机系</option>
<option value="软件系">软件系</option>
<option value="信管系">信管系</option>
<option value="外语系">外语系</option>
<option value="国贸系">国贸系</option>
<option value="市场营销系">市场营销系</option>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/admin/students.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
table.render({
elem: '#test'
,height: 'full-100'
,url:'/admin/users?role=3'
,url:'/teacher/users?role=3'
,limit:20
,page: {
layout: ['prev', 'page', 'next', 'skip','count']
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/student/checkInforms.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<select id="departmentSelect" name="department" lay-verify=""
lay-filter="departmentSelect">
<option value="计算机系">计算机系</option>
<option value="软件系">软件系</option>
<option value="信管系">信管系</option>
<option value="外语系">外语系</option>
<option value="国贸系">国贸系</option>
<option value="市场营销系">市场营销系</option>
Expand Down
20 changes: 14 additions & 6 deletions src/main/resources/templates/teacher/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,27 @@
<ul id="nav">
<li>
<a href="javascript:;">
<i class="iconfont left-nav-li" lay-tips="用户画像">&#xe6b8;</i>
<cite>用户画像</cite>
<i class="iconfont left-nav-li" lay-tips="个人信息">&#xe6b8;</i>
<cite>个人信息</cite>
<i class="iconfont nav_right">&#xe697;</i></a>
<ul class="sub-menu">
<li>
<a onclick="xadmin.add_tab('个人信息','/teacher/aboutme', true)">
<a onclick="xadmin.add_tab('修改密码','/teacher/update',true)">
<i class="iconfont">&#xe6a7;</i>
<cite>个人信息</cite></a>
<cite>修改密码</cite></a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="iconfont left-nav-li" lay-tips="学生管理">&#xe6b8;</i>
<cite>学生管理</cite>
<i class="iconfont nav_right">&#xe697;</i></a>
<ul class="sub-menu">
<li>
<a onclick="xadmin.add_tab('修改密码','/teacher/update',true)">
<a onclick="xadmin.add_tab('学生管理','/teacher/students', true)">
<i class="iconfont">&#xe6a7;</i>
<cite>修改密码</cite></a>
<cite>学生管理</cite></a>
</li>
</ul>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/teacher/informs.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<select name="department" id="departmentSelect" lay-filter="departmentSelect">
<option value="">选择系别</option>
<option value="计算机系">计算机系</option>
<option value="软件系">软件系</option>
<option value="信管系">信管系</option>
<option value="外语系">外语系</option>
<option value="国贸系">国贸系</option>
<option value="市场营销系">市场营销系</option>
Expand Down
Loading

0 comments on commit 99f7da1

Please sign in to comment.