public KeyTagSearchInfo getKeyTagSearchInfoByYearAndMonth(long tagId, int year, int month) { Query query = manager.createQuery(); return query.getObjectEx( KeyTagSearchInfo.class, "tagid=? and year=? and month=?", new Object[] {tagId, year, month}); }
public boolean createHkObjKeyTag(long tagId, long objId) { Query query = manager.createQuery(); if (query.count(HkObjKeyTag.class, "tagid=? and hkobjid=?", new Object[] {tagId, objId}) > 0) { return false; } query.addField("tagid", tagId); query.addField("hkobjid", objId); query.insert(HkObjKeyTag.class); return true; }
public long createKeyTag(String name) { KeyTag o = this.getKeyTagByName(name); if (o != null) { return o.getTagId(); } Query query = manager.createQuery(); query.addField("name", name); query.addField("searchcount", 0); long id = query.insert(KeyTag.class).longValue(); return id; }
public List<KeyTag> getKeyTagListInId(List<Long> idList) { if (idList.size() == 0) { return new ArrayList<KeyTag>(); } StringBuilder sql = new StringBuilder("select * from keytag where tagid in ("); for (Long l : idList) { sql.append(l).append(","); } sql.deleteCharAt(sql.length() - 1).append(")"); Query query = manager.createQuery(); return query.listBySqlEx("ds1", sql.toString(), KeyTag.class); }
public KeyTag getKeyTagByName(String name) { Query query = manager.createQuery(); return query.getObjectEx(KeyTag.class, "name=?", new Object[] {name}); }
public KeyTag getKeyTag(long tagId) { Query query = manager.createQuery(); return query.getObjectById(KeyTag.class, tagId); }