1

spring mvc で DAO を使用してタグを追加し、データベース (MySQL) で取得しています。db からタグを取得するための私の Dao は次のとおりです。

public List<TagCloud> getAllTags() {
    String sql = "SELECT * FROM tags";

    List<TagCloud> tagcloud = new ArrayList<TagCloud>();
    List<Map<String, Object>> rows=null;
    try{
     rows= getJdbcTemplate().queryForList(sql);

    }catch(Exception e)
    {

        e.printStackTrace();
    }

    for (Map row : rows) {
        TagCloud tc1 = new TagCloud();

        tc1.setName((String)row.get("name"));
        tc1.setCount((Integer)row.get("count"));
        tc1.setFontSize((Double)row.get("fontsize"));
        tc1.setTagid( (Integer)row.get("tagid")  );

        tagcloud.add(tc1);
    }

    return tagcloud;
}

今、私はすでに大学をデータベースのタグとして持っています。大学を1つのタグとして追加すると、これらの単語を分割し、重複をチェックする必要があります..大学はすでに追加されているため、大学を無視し、カウントとフォントを増やして追加する必要がありますタグへのコース..どうすればいいですか

4

0 に答える 0