@RequestMapping("byLabel") public ResponseEntity<List<Topic>> findTopicsbyLabel( HttpServletRequest request, @RequestParam String labelname) throws Exception { labelname = new String(labelname.getBytes("iso-8859-1"), "utf-8"); List<Topic> topics = topicDao.findTopicByLabelName(labelname, 1); return new ResponseEntity<List<Topic>>(topics, HttpStatus.OK); }
@RequestMapping("bySubject") public ResponseEntity<List<Topic>> findTopics( HttpServletRequest request, @RequestParam String subject) throws Exception { subject = new String(subject.getBytes("iso-8859-1"), "utf-8"); List<Topic> topics = topicDao.findTopicBySubject(subject, 1); return new ResponseEntity<List<Topic>>(topics, HttpStatus.OK); }
@RequestMapping("leaveTopic") public String leaveTopic(@RequestParam String client_id, @RequestParam String huanxin_group_id) { User user = new User(); Topic topic = new Topic(); topic.setHuanxin_group_id(huanxin_group_id); user.setClient_id(client_id); topicDao.userLeaveTopic(user); return "SUCCESS"; }
@RequestMapping("addTopic") public String addTopic( HttpServletRequest request, @RequestParam String client_id, @RequestParam String huanxin_group_id, @RequestParam String subject, @RequestParam String label_name) throws Exception { request.setCharacterEncoding("UTF-8"); User user = new User(); user.setClient_id(client_id); Label label = new Label(); label.setLabel_name(label_name); Topic topic = new Topic(); topic.setHuanxin_group_id(huanxin_group_id); topic.setLabel(label); topic.setUser(user); topicDao.save(topic); return "success"; }
@RequestMapping("byUser") public ResponseEntity<List<Topic>> findTopicsbyUserl( HttpServletRequest request, @RequestParam String client_id) throws Exception { List<Topic> topics = topicDao.findTopicByUserId(client_id, 1); return new ResponseEntity<List<Topic>>(topics, HttpStatus.OK); }