@RequestMapping("/addFriendList") public String addFriendList( @RequestParam String friendId, @RequestParam String friendPicture, Error errors, ModelMap model, HttpSession session) throws DuplicatedIdException, SQLException { String URL = ""; Customer customer = (Customer) session.getAttribute("loginInfo"); String id = customer.getCsId(); System.out.println(friendId); FriendList friendList = new FriendList(id, friendId, friendPicture); // FriendList friendList2 = new FriendList(friendId, id); FriendList fl = friendService.findFriend(friendList); // FriendList fl2 = friendService.findFriend(friendList2); if (fl == null) { friendService.addFriendList(friendList); List<FriendList> list = friendService.findFriendListById(id); model.addAttribute("friendList", list); URL = "customer/friend_list.tiles"; System.out.println(fl); } else { // 이미친구일때 팝업창. System.out.println(fl); JOptionPane.showMessageDialog(null, "이미친구입니다.."); List<FriendList> list = friendService.findFriendListById(id); model.addAttribute("friendList", list); URL = "customer/friend_list.tiles"; } return URL; }
@RequestMapping("/logincheck/myFriend") public String myFriend(HttpSession session, Error errors, ModelMap model) { Customer customer = (Customer) session.getAttribute("loginInfo"); String id = customer.getCsId(); List<FriendList> list = friendService.findFriendListById(id); model.addAttribute("friendList", list); session.setAttribute("seionFriendList", list); return "customer/friend_list.tiles"; }
@RequestMapping("/deleteFriendList") public String deleteFriendList( @RequestParam String friendId, @RequestParam String friendPicture, Error errors, ModelMap model, HttpSession session) { Customer customer = (Customer) session.getAttribute("loginInfo"); String id = customer.getCsId(); FriendList list = new FriendList(id, friendId, friendPicture); friendService.deleteFriendList(list); JOptionPane.showMessageDialog(null, "삭제되었습니.다"); List<FriendList> list1 = friendService.findFriendListById(id); model.addAttribute("friendList", list1); return "customer/friend_list.tiles"; }