基于javaweb+mysql的springboot访客管理系统(java+springboot+layui+jsp+maven+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot访客管理系统(java+springboot+layui+jsp+maven+mysql)
项目介绍
springboot搭建的访客管理系统,针对高端基地做严格把控来访人员信息管理,用户后端可以设置多个管理员帐号,给予不同部门的管理层使用,用户管理可以增加/修改内部成员的基本信息,需要到访的人员必须通过进入程序,在访客预约里面提交预约申请,预约后管理员可查询预约记录以及访客出入记录。
环境需要
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.数据库:MySql 8.0/5.7版本;
6.是否Maven项目:是;
技术栈
-
springboot 2. mybatis 3. layUi
-
JSP
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入http://localhost:8090 登录
帐号:admin 密码:admin
private VisitorRecordService smartUserService;
@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息")
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delVisitorRecord/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
smartUserService.deleteUserById(id);
return Response.ok("success");
}
@GetMapping("/visitorList")
public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
String appointmentTime,
ModelAndView modelAndView) {
PageInfo<VisitorRecord> data= smartUserService.getAllByPage(pageNum, pageSize,appointmentTime);
modelAndView.addObject("page",data);
modelAndView.setViewName("visitorRecord/visitor-list");
return modelAndView;
}
//到处访客记录
@GetMapping("/exportExcel")
public void exportExcel(HttpServletResponse response) {
try{
List<List<String>> rows =new ArrayList<>();
List<String> row1 = CollUtil.newArrayList("访客姓名", "访客手机号", "被访人姓名", "被访人电话", "预约日期", "访问事由");
rows.add(row1);
List<VisitorRecord> list=smartUserService.getAll();
for(VisitorRecord vr:list){
rows.add(CollUtil.newArrayList(vr.getVisitorName(), vr.getPhone(),vr.getUserPhone(),vr.getUserName(),vr.getAppointmentTime(),vr.getReasons()));
}
ExcelWriter writer = ExcelUtil.getWriter();
writer.write(rows);
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename="+ DateUtils.getTime3()+"visitorRecord.xls");
ServletOutputStream out=response.getOutputStream();
writer.flush(out);
writer.close();
IoUtil.close(out);
}catch (Exception e){
e.printStackTrace();
}
}
//跳转添加预约页面
@GetMapping("/visitor-add")
public ModelAndView visitorAddHtml(ModelAndView modelAndView) {
modelAndView.setViewName("visitorRecord/visitor-add");
return modelAndView;
@Api(tags="用户模块")
@Controller
@RequestMapping(value = "userManager")
public class SmartUserController {
@Autowired
private SmartUserService smartUserService;
@ApiOperation(value="添加用户",notes="添加用户")
@ResponseBody
@PostMapping("/addUser")
public Response<String> addUser(SmartUser user){
return smartUserService.saveOrUpdate(user);
}
@ApiOperation(value="按照编号删除用户信息",notes="按照编号删除用户信息")
@ApiImplicitParam(name="id",value="用户编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delUser/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
smartUserService.deleteUserById(id);
return Response.ok("success");
}
@ApiOperation(value="按照编号删除用户信息",notes="按照编号删除用户信息")
@ApiImplicitParam(name="id",value="用户编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/updateUser")
public Response<String> updateAdmin(SmartUser user, HttpSession session){
session.setAttribute("loginUser",user);
return smartUserService.saveOrUpdate(user);
}
return Response.ok("success");
}
@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息")
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/updateVisitor")
public Response<String> updateAdmin(Visitor visitor){
return visitorService.saveOrUpdate(visitor);
}
@ApiOperation(value="分页查找所有预约",notes="分页查找所有预约")
@ApiImplicitParams({
@ApiImplicitParam(name="pageNum",value="当前页码",defaultValue="1"),
@ApiImplicitParam(name="pageSize",value="每页显示数据个数(0是全部)",defaultValue="10")
})
@GetMapping("/visitorList")
public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
String shows,ModelAndView modelAndView) {
PageInfo<Visitor> data= visitorService.getAllByPage(pageNum, pageSize);
if(null!=shows&&!"".equals(shows)){
visitorService.updateShow();
modelAndView.addObject("num",0);
}
modelAndView.addObject("page",data);
modelAndView.setViewName("visitor/visitor-list");
return modelAndView;
}
/**
* @Description(功能描述): 预约访客地址
**/
@ResponseBody
@GetMapping("/visitorUrl")
public Response<String> visitorUrl() {
String port=environment.getProperty("server.port");
String url="http://"+IpUtils.getLocalIpAddr()+":"+port+"/visitorManager/subscribe";
return Response.ok(url);
}
/**
* @Description(功能描述): 预约页面
**/
@GetMapping("/subscribe")
public ModelAndView visitorUrl(ModelAndView modelAndView) {
modelAndView.setViewName("visitor/subscribe");
return modelAndView;
}
@GetMapping("/subscribeList/{phone}")
public ModelAndView subscribeList(@PathVariable("phone")String phone, ModelAndView modelAndView) {
List<Visitor> list= visitorService.findVisitorList(phone);
modelAndView.addObject("list",list);
modelAndView.setViewName("visitor/subscribeList");
return modelAndView;
}
public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
String appointmentTime,
ModelAndView modelAndView) {
PageInfo<VisitorRecord> data= smartUserService.getAllByPage(pageNum, pageSize,appointmentTime);
modelAndView.addObject("page",data);
modelAndView.setViewName("visitorRecord/visitor-list");
return modelAndView;
}
//到处访客记录
@GetMapping("/exportExcel")
public void exportExcel(HttpServletResponse response) {
try{
List<List<String>> rows =new ArrayList<>();
List<String> row1 = CollUtil.newArrayList("访客姓名", "访客手机号", "被访人姓名", "被访人电话", "预约日期", "访问事由");
rows.add(row1);
List<VisitorRecord> list=smartUserService.getAll();
for(VisitorRecord vr:list){
rows.add(CollUtil.newArrayList(vr.getVisitorName(), vr.getPhone(),vr.getUserPhone(),vr.getUserName(),vr.getAppointmentTime(),vr.getReasons()));
}
ExcelWriter writer = ExcelUtil.getWriter();
writer.write(rows);
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename="+ DateUtils.getTime3()+"visitorRecord.xls");
ServletOutputStream out=response.getOutputStream();
writer.flush(out);
writer.close();
IoUtil.close(out);
}catch (Exception e){
e.printStackTrace();
}
}
//跳转添加预约页面
@GetMapping("/visitor-add")
public ModelAndView visitorAddHtml(ModelAndView modelAndView) {
modelAndView.setViewName("visitorRecord/visitor-add");
return modelAndView;
}
@ApiOperation(value="添加预约",notes="添加预约")
@ResponseBody
@PostMapping("/addVisitorRecord")
public Response<String> addUser(VisitorRecord visitor){
return smartUserService.save(visitor);
}
//跳转添加预约页面
@GetMapping("/visitor-edit")
public ModelAndView visitorEditHtml(Long id,ModelAndView modelAndView) {
VisitorRecord visitor=smartUserService.findUserById(id);
e.printStackTrace();
}
}
//跳转添加预约页面
@GetMapping("/visitor-add")
public ModelAndView visitorAddHtml(ModelAndView modelAndView) {
modelAndView.setViewName("visitorRecord/visitor-add");
return modelAndView;
}
@ApiOperation(value="添加预约",notes="添加预约")
@ResponseBody
@PostMapping("/addVisitorRecord")
public Response<String> addUser(VisitorRecord visitor){
return smartUserService.save(visitor);
}
//跳转添加预约页面
@GetMapping("/visitor-edit")
public ModelAndView visitorEditHtml(Long id,ModelAndView modelAndView) {
VisitorRecord visitor=smartUserService.findUserById(id);
modelAndView.addObject("visitor",visitor);
modelAndView.setViewName("visitorRecord/visitor-edit");
return modelAndView;
}
}
@Api(tags="管理员")
@Controller
@RequestMapping(value = "adminManager")
}
modelAndView.addObject("page",data);
modelAndView.setViewName("visitor/visitor-list");
return modelAndView;
}
/**
* @Description(功能描述): 预约访客地址
**/
@ResponseBody
@GetMapping("/visitorUrl")
public Response<String> visitorUrl() {
String port=environment.getProperty("server.port");
String url="http://"+IpUtils.getLocalIpAddr()+":"+port+"/visitorManager/subscribe";
return Response.ok(url);
}
/**
* @Description(功能描述): 预约页面
**/
@GetMapping("/subscribe")
public ModelAndView visitorUrl(ModelAndView modelAndView) {
modelAndView.setViewName("visitor/subscribe");
return modelAndView;
}
@GetMapping("/subscribeList/{phone}")
public ModelAndView subscribeList(@PathVariable("phone")String phone, ModelAndView modelAndView) {
List<Visitor> list= visitorService.findVisitorList(phone);
modelAndView.addObject("list",list);
modelAndView.setViewName("visitor/subscribeList");
return modelAndView;
}
//跳转添加预约页面
@GetMapping("/visitor-add")
public ModelAndView visitorAddHtml(ModelAndView modelAndView) {
modelAndView.setViewName("visitor/visitor-add");
return modelAndView;
}
@ApiOperation(value="添加预约",notes="添加预约")
@ResponseBody
@PostMapping("/addVisitor")
public Response<String> addVisitor(Visitor visitor){
response.setHeader("Content-Disposition","attachment;filename="+ DateUtils.getTime3()+"visitorRecord.xls");
ServletOutputStream out=response.getOutputStream();
writer.flush(out);
writer.close();
IoUtil.close(out);
}catch (Exception e){
e.printStackTrace();
}
}
//跳转添加预约页面
@GetMapping("/visitor-add")
public ModelAndView visitorAddHtml(ModelAndView modelAndView) {
modelAndView.setViewName("visitorRecord/visitor-add");
return modelAndView;
}
@ApiOperation(value="添加预约",notes="添加预约")
@ResponseBody
@PostMapping("/addVisitorRecord")
public Response<String> addUser(VisitorRecord visitor){
return smartUserService.save(visitor);
}
//跳转添加预约页面
@GetMapping("/visitor-edit")
public ModelAndView visitorEditHtml(Long id,ModelAndView modelAndView) {
VisitorRecord visitor=smartUserService.findUserById(id);
modelAndView.addObject("visitor",visitor);
modelAndView.setViewName("visitorRecord/visitor-edit");
return modelAndView;
}
}
@Api(tags="管理员")
@Controller
@Api(tags="用户模块")
@Controller
@RequestMapping(value = "userManager")
public class SmartUserController {
@Autowired
private SmartUserService smartUserService;
@ApiOperation(value="添加用户",notes="添加用户")
@ResponseBody
@PostMapping("/addUser")
public Response<String> addUser(SmartUser user){
return smartUserService.saveOrUpdate(user);
}
@ApiOperation(value="按照编号删除用户信息",notes="按照编号删除用户信息")
@ApiImplicitParam(name="id",value="用户编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delUser/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
smartUserService.deleteUserById(id);
return Response.ok("success");
}
@ApiOperation(value="按照编号删除用户信息",notes="按照编号删除用户信息")
@ApiImplicitParam(name="id",value="用户编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/updateUser")
public Response<String> updateAdmin(SmartUser user, HttpSession session){
session.setAttribute("loginUser",user);
return smartUserService.saveOrUpdate(user);
}
@ApiOperation(value="分页查找所有用户",notes="分页查找所有用户")
@ApiImplicitParams({
@ApiImplicitParam(name="pageNum",value="当前页码",defaultValue="1"),
@ApiImplicitParam(name="pageSize",value="每页显示数据个数(0是全部)",defaultValue="10")
})
}
@Api(tags="历史预约记录管理")
@Controller
@RequestMapping(value = "visitorRecordManager")
public class VisitorRecordController {
@Autowired
private VisitorRecordService smartUserService;
@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息")
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delVisitorRecord/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
smartUserService.deleteUserById(id);
return Response.ok("success");
}
@GetMapping("/visitorList")
public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
PageInfo<Visitor> data= visitorService.getAllByPage(pageNum, pageSize);
if(null!=shows&&!"".equals(shows)){
visitorService.updateShow();
modelAndView.addObject("num",0);
}
modelAndView.addObject("page",data);
modelAndView.setViewName("visitor/visitor-list");
return modelAndView;
}
/**
* @Description(功能描述): 预约访客地址
**/
@ResponseBody
@GetMapping("/visitorUrl")
public Response<String> visitorUrl() {
String port=environment.getProperty("server.port");
String url="http://"+IpUtils.getLocalIpAddr()+":"+port+"/visitorManager/subscribe";
return Response.ok(url);
}
/**
* @Description(功能描述): 预约页面
**/
@GetMapping("/subscribe")
public ModelAndView visitorUrl(ModelAndView modelAndView) {
modelAndView.setViewName("visitor/subscribe");
return modelAndView;
}
@GetMapping("/subscribeList/{phone}")
public ModelAndView subscribeList(@PathVariable("phone")String phone, ModelAndView modelAndView) {
List<Visitor> list= visitorService.findVisitorList(phone);
modelAndView.addObject("list",list);
modelAndView.setViewName("visitor/subscribeList");
return modelAndView;
}
//跳转添加预约页面
@GetMapping("/visitor-add")
public ModelAndView visitorAddHtml(ModelAndView modelAndView) {
modelAndView.setViewName("visitor/visitor-add");
return modelAndView;
}
@ApiOperation(value="添加预约",notes="添加预约")
@ResponseBody
@PostMapping("/uploadImg")
public Response<String> uploadImg(){
return Response.ok();
}
@ResponseBody
@PostMapping("/doLogin")
public Response<String> doLogin(HttpSession session, Admin admin){
if("admin".equalsIgnoreCase(admin.getRole())){
Admin result= adminService.login(admin);
if(null!=result){
session.setAttribute("loginAdmin",result);
return Response.ok("index");
}else {
return Response.error(300);
}
}else{
SmartUser user=new SmartUser();
user.setAccount(admin.getAccount());
user.setPassword(admin.getPasswd());
user=userService.login(user);
if(null!=user){
session.setAttribute("loginUser",user);
return Response.ok("userIndex");
}else {
return Response.error(300);
}
}
}
}
@Configuration
@ControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(DataValidFailedException.class)
@ResponseBody
public Response<String> dataValidFailed(DataValidFailedException e){
e.printStackTrace();
return Response.error(e.getErrors());
}
private VisitorService visitorService;
@Autowired
private SmartUserService smartUserService;
@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息")
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delVisitor/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
visitorService.deleteUserById(id);
return Response.ok("success");
}
@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息")
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/updateVisitor")
public Response<String> updateAdmin(Visitor visitor){
return visitorService.saveOrUpdate(visitor);
}
@ApiOperation(value="分页查找所有预约",notes="分页查找所有预约")
@ApiImplicitParams({
@ApiImplicitParam(name="pageNum",value="当前页码",defaultValue="1"),
@ApiImplicitParam(name="pageSize",value="每页显示数据个数(0是全部)",defaultValue="10")
})
@GetMapping("/visitorList")
public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
String shows,ModelAndView modelAndView) {
PageInfo<Visitor> data= visitorService.getAllByPage(pageNum, pageSize);
if(null!=shows&&!"".equals(shows)){
visitorService.updateShow();
modelAndView.addObject("num",0);
}
modelAndView.addObject("page",data);
modelAndView.setViewName("visitor/visitor-list");
return modelAndView;
}
/**
* @Description(功能描述): 预约访客地址
**/
@Api(tags="登录管理")
@Controller
@RequestMapping()
public class LoginController {
@Autowired
private AdminService adminService;
@Autowired
private SmartUserService userService;
@Autowired
private VisitorService visitorService;
@GetMapping("/userIndex")
public ModelAndView userIndex(HttpSession session,ModelAndView modelAndView){
SmartUser user=(SmartUser) session.getAttribute("loginUser");
if(user!=null){
modelAndView.setViewName("userIndex");
}else{
modelAndView.setViewName("login");
}
}
@Api(tags="用户模块")
@Controller
@RequestMapping(value = "userManager")
public class SmartUserController {
@Autowired
private SmartUserService smartUserService;
@ApiOperation(value="添加用户",notes="添加用户")
@ResponseBody
@PostMapping("/addUser")
public Response<String> addUser(SmartUser user){
return smartUserService.saveOrUpdate(user);
}
@ApiOperation(value="按照编号删除用户信息",notes="按照编号删除用户信息")
@ApiImplicitParam(name="id",value="用户编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delUser/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
smartUserService.deleteUserById(id);
return Response.ok("success");
}
@ApiOperation(value="按照编号删除用户信息",notes="按照编号删除用户信息")
@ApiImplicitParam(name="id",value="用户编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/updateUser")
public Response<String> updateAdmin(SmartUser user, HttpSession session){
session.setAttribute("loginUser",user);
return smartUserService.saveOrUpdate(user);
}
//跳转添加用户页面
@GetMapping("/user-add")
public ModelAndView userAddHtml(ModelAndView modelAndView) {
modelAndView.setViewName("user/user-add");
return modelAndView;
} //跳转添加用户页面
@GetMapping("/user-edit")
public ModelAndView userEditHtml(Long id,ModelAndView modelAndView) {
SmartUser user=smartUserService.findUserById(id);
modelAndView.addObject("user",user);
modelAndView.setViewName("user/user-edit");
return modelAndView;
}
//个人信息修改
@GetMapping("/user-update")
public ModelAndView userUpdateHtml(Long id,ModelAndView modelAndView) {
SmartUser user=smartUserService.findUserById(id);
modelAndView.addObject("user",user);
modelAndView.setViewName("myInfo/user-edit");
return modelAndView;
}
}
@Api(tags="管理员")
@Controller
@RequestMapping(value = "adminManager")
public class AdminController {
@Autowired
private AdminService adminService;
@ApiOperation(value="添加子管理员",notes="添加子管理员")
@ResponseBody
@PostMapping("/addAdmin")
public Response<String> addAdmin(Admin admin){
return adminService.saveOrUpdate(admin);
}
@ApiOperation(value="按照编号删除子管理员信息",notes="按照编号删除子管理员信息")
@ApiImplicitParam(name="id",value="子管理员编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delAdmin/{id}")
public Response<String> delAdmin(@PathVariable("id")Long id){
adminService.deleteUserById(id);
return Response.ok("success");
}
@ApiOperation(value="按照编号删除子管理员信息",notes="按照编号删除子管理员信息")
@ApiImplicitParam(name="id",value="子管理员编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/updateAdmin")
public Response<String> updateAdmin(Admin admin, HttpSession session) {
session.setAttribute("loginAdmin",admin);
return adminService.saveOrUpdate(admin);
}
@Api(tags="预约管理")
@Controller
@RequestMapping(value = "visitorManager")
public class VisitorController {
@Autowired
private Environment environment;
@Autowired
private VisitorService visitorService;
@Autowired
private SmartUserService smartUserService;
@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息")
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delVisitor/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
visitorService.deleteUserById(id);
return Response.ok("success");
}
@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息")
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/updateVisitor")
public Response<String> updateAdmin(Visitor visitor){
return visitorService.saveOrUpdate(visitor);
}
@ApiOperation(value="分页查找所有预约",notes="分页查找所有预约")
@ApiImplicitParams({
@ApiImplicitParam(name="pageNum",value="当前页码",defaultValue="1"),
@ApiImplicitParam(name="pageSize",value="每页显示数据个数(0是全部)",defaultValue="10")
})
@GetMapping("/visitorList")
public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
String shows,ModelAndView modelAndView) {
PageInfo<Visitor> data= visitorService.getAllByPage(pageNum, pageSize);
if(null!=shows&&!"".equals(shows)){
visitorService.updateShow();
modelAndView.addObject("num",0);
@Api(tags="历史预约记录管理")
@Controller
@RequestMapping(value = "visitorRecordManager")
public class VisitorRecordController {
@Autowired
private VisitorRecordService smartUserService;
@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息")
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delVisitorRecord/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
smartUserService.deleteUserById(id);
return Response.ok("success");
}
@GetMapping("/visitorList")
public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
String appointmentTime,
ModelAndView modelAndView) {
PageInfo<VisitorRecord> data= smartUserService.getAllByPage(pageNum, pageSize,appointmentTime);
modelAndView.addObject("page",data);
modelAndView.setViewName("visitorRecord/visitor-list");
return modelAndView;
}
//到处访客记录
@GetMapping("/exportExcel")
public void exportExcel(HttpServletResponse response) {
try{
List<List<String>> rows =new ArrayList<>();
List<String> row1 = CollUtil.newArrayList("访客姓名", "访客手机号", "被访人姓名", "被访人电话", "预约日期", "访问事由");
rows.add(row1);
List<VisitorRecord> list=smartUserService.getAll();