public Integer countServiceItemGroupByUserId(Long userId) {
   return (Integer)
       dao.getHibernateTemplate()
           .find("select count(*) from ServiceItemGroup where userId=" + userId + " and status=1")
           .iterator()
           .next();
 }
Example #2
0
 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);
 }
Example #7
0
 public User updateUser(User user) {
   dao.getHibernateTemplate().update(user);
   return user;
 }
Example #8
0
 public User getUser(Long id) {
   return (User) dao.getHibernateTemplate().get(User.class, id);
 }
Example #9
0
 public User saveUser(User user) {
   dao.getHibernateTemplate().save(user);
   return user;
 }