public Integer countServiceItemGroupByUserId(Long userId) { return (Integer) dao.getHibernateTemplate() .find("select count(*) from ServiceItemGroup where userId=" + userId + " and status=1") .iterator() .next(); }
public User getUser(String username, String password) { String hql = "from User where username='******' and password='******'"; List<User> userList = dao.getHibernateTemplate().find(hql); if (CollectionUtils.isNotEmpty(userList)) { return userList.get(0); } else { return null; } }
@SuppressWarnings("unchecked") public List<ServiceItemGroup> getServiceItemGroupsByUserId(Long userId) { return (List<ServiceItemGroup>) dao.getHibernateTemplate() .find("from ServiceItemGroup where userId=" + userId + " and status=1"); }
public ServiceItemGroup saveServiceItemGroup(ServiceItemGroup serviceItemGroup) { dao.getHibernateTemplate().save(serviceItemGroup); return serviceItemGroup; }
public void deleteServiceItemGroup(Long gid) { ServiceItemGroup serviceItemGroup = dao.getHibernateTemplate().load(ServiceItemGroup.class, gid); dao.getHibernateTemplate().delete(serviceItemGroup); }
public ServiceItemGroup getServiceItemGroup(Long id) { return (ServiceItemGroup) dao.getHibernateTemplate().get(ServiceItemGroup.class, id); }
public User updateUser(User user) { dao.getHibernateTemplate().update(user); return user; }
public User getUser(Long id) { return (User) dao.getHibernateTemplate().get(User.class, id); }
public User saveUser(User user) { dao.getHibernateTemplate().save(user); return user; }