Ejemplo n.º 1
0
 @Override
 public User login(User user) {
   Map<String, Object> params = new HashMap<String, Object>();
   params.put("pwd", Encrypt.e(user.getPwd()));
   params.put("name", user.getName());
   Tuser t = userDao.get("from Tuser t where t.name = :name and t.pwd = :pwd", params);
   if (t != null) {
     return user;
   }
   return null;
 }
Ejemplo n.º 2
0
 @Override
 public User save(User user) {
   Tuser t = new Tuser();
   BeanUtils.copyProperties(user, t, new String[] {"pwd"});
   t.setId(UUID.randomUUID().toString());
   t.setCreatedatetime(new Date());
   t.setPwd(Encrypt.e(user.getPwd()));
   userDao.save(t);
   BeanUtils.copyProperties(t, user);
   return user;
 }