コード例 #1
0
 @RequestMapping("add")
 public String addLabe(@RequestParam String labelname) {
   Label label = new Label();
   label.setLabel_name(labelname);
   label.setCreated_at(new Date());
   label.setId(202);
   labelDao.save(label);
   return "SUCCESS";
 }
コード例 #2
0
ファイル: User.java プロジェクト: rpgmakervx/th_serverapi
 // 获取某用户的标签名
 public List<String> getLabelnames() {
   List<String> labels = new ArrayList<String>();
   if (this.getLabellist() != null) {
     for (Label l : this.getLabellist()) {
       labels.add(l.getLabel_name());
     }
     return labels;
   } else {
     return null;
   }
 }
コード例 #3
0
 @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";
 }
コード例 #4
0
ファイル: UserUtil.java プロジェクト: rpgmakervx/th_serverapi
 /**
  * 业务功能:标记用户和目标标签列表有哪些是相同的
  *
  * @param u
  * @param label_names
  * @return
  */
 private List<String> markLabel(User u, List<String> label_names) {
   List<String> labels = new ArrayList<String>();
   for (Label l : u.getLabellist()) {
     boolean ismarked = false;
     for (String lab_name : label_names) {
       if (l.getLabel_name().equalsIgnoreCase(lab_name)
           || l.getLabel_name().contains(lab_name)
           || lab_name.contains(l.getLabel_name())) {
         ismarked = true;
       }
     }
     if (ismarked) {
       labels.add(l.getLabel_name() + "\t\t");
     } else {
       labels.add(l.getLabel_name());
     }
   }
   return labels;
 }