@SuppressWarnings("unchecked") public Integer getAllowedNumbByCompany(Long companyId) { List<Subsciber> subscibers = subsciberDao.find(QUERY_BY_TENANT_HQL, companyId, false); Integer num = 0; for (Subsciber sb : subscibers) { if (num < sb.getUseNumber()) { num = sb.getUseNumber(); } } return num; }
/** * 取公司的服务器配置方式 * * @param companyId * @return */ public ServerConfig getServerConfigByCompanyId(Long companyId) { return (ServerConfig) serverConfigDao.findUnique("from ServerConfig s where s.companyId=?", companyId); }
/** * 取实体 * * @param id * @return */ @Transactional(readOnly = true) public ServerConfig getServerConfig(Long id) { return serverConfigDao.get(id); }
/** * 保存 * * @param entity */ public void save(ServerConfig entity) { serverConfigDao.save(entity); }
public void updateUseNumber(Long tenantId, Integer useNumber) { subsciberDao .createQuery("update Subsciber set useNumber=? where tenantId = ?", useNumber, tenantId) .executeUpdate(); }
public Page<Subsciber> getSubsciberByTenant(Page<Subsciber> page, Long tenantId) { return subsciberDao.find(page, QUERY_BY_TENANT_HQL, tenantId, false); }
public Page<Subsciber> getAllSubsciber(Page<Subsciber> page) { return subsciberDao.findAll(page); }
public List<Subsciber> getAllSubsciber() { return subsciberDao.findAll(); }
public Subsciber getSubsciber(Long id) { return subsciberDao.get(id); }
public void deleteSubsciber(Long id) { Subsciber subsciber = subsciberDao.get(id); subsciber.setDeleted(true); subsciberDao.save(subsciber); }
public void saveSubsciber(Subsciber subsciber) { subsciberDao.save(subsciber); }