@Override public List<User> selectAllLogin(){ return adminMapper.selectAllLogin(); }
@Override public List<Customer> selectAllCustomer(){ return adminMapper.selectAllCustomer(); }
@Override public Integer insertAdmin(Admin admin)throws UsernameConflictException { Integer result = 0; String phone = admin.getAdPhone(); if (userMapper.getUserByUsername(phone) != null) { thrownew UsernameConflictException("用户已经存在!"); } else { String password = admin.getAdPassword(); int role = -1; int status = 1; User user = new User(); user.setUsername(phone); user.setPassword(password); user.setRole(role); user.setStatus(status); result = adminMapper.insertAdmin(admin); userMapper.insert(user); } return result; }
@Override public Integer insertCustomer(Customer customer)throws UsernameConflictException { Integer result = 0; String phone = customer.getCmPhone(); if (userMapper.getUserByUsername(phone) != null) { thrownew UsernameConflictException("用户已经存在!"); } else { String password = customer.getCmPassword(); int role = 1; int status = 1; User user = new User(); user.setUsername(phone); user.setPassword(password); user.setRole(role); user.setStatus(status); result = adminMapper.insertCustomer(customer); userMapper.insert(user); } return result; }
/** * 绘制干扰线 * @param g */ privatevoiddrowLine(Graphics g){ int x = random.nextInt(width); int y = random.nextInt(height); int xl = random.nextInt(13); int yl = random.nextInt(15); g.drawLine(x, y, x + xl, y + yl); }
/** * 获取随机的字符 * @param num * @return */ public String getRandomString(int num){ return String.valueOf(randString.charAt(num)); } } package com.xxxx.service.impl;
@PostMapping("/getCertifyStatus") @ResponseBody public ResponseResult<Integer> getCertifyStatus(HttpSession session){ ResponseResult<Integer> result = new ResponseResult<>(); Integer data = personService.getCertifyStatus(session); result.setData(data); return result; }
@PostMapping("/getAllMessage") @ResponseBody public ResponseResult<List<Message>> getAllMessage () { ResponseResult<List<Message>> result = new ResponseResult<>(); List<Message> list = personService.getAllMessage(); result.setData(list); return result; }
@PostMapping("/getSingleMessage") @ResponseBody public ResponseResult<String> getSingleMessage( @RequestParam("id") Integer id ){ ResponseResult<String> result = new ResponseResult<>(); String message = personService.getSingleMessage(id); result.setData(message); return result; }
@PostMapping("/deleteSingleMessage") @ResponseBody public ResponseResult<Void> deleteSingleMessage( @RequestParam("id") String id ){ Integer mid = Integer.parseInt(id); personService.deleteSingleMessage(mid); returnnew ResponseResult<>(); }