@Override public EmployeeModel login(String userName, String userPass, String loginIp) { EmployeeModel em = findByNameAndPass(userName, userPass); if (em != null) { em.setLastLoginIp(loginIp); em.setLastLoginTime(System.currentTimeMillis()); em.setLoginTimes(em.getLoginTimes() + 1); } return em; }
public void save(EmployeeModel model, Long[] roleUuids) { Set<RoleModel> roms = new HashSet<RoleModel>(); for (Long uuid : roleUuids) { RoleModel rm = roleDao.findById(uuid); roms.add(rm); } model.setRoles(roms); employeeDao.save(model); }
public void update(EmployeeModel model, Long[] roleUuids) { EmployeeModel em = new EmployeeModel(); em = employeeDao.findById(model.getUuid()); em.setUserName(model.getUserName()); em.setName(model.getName()); em.setEmail(model.getEmail()); em.setPhone(model.getPhone()); em.setSex(model.getSex()); em.setAddres(model.getAddres()); em.setBirthday(model.getBirthday()); em.setDepartM(model.getDepartM()); Set<RoleModel> roms = new HashSet<RoleModel>(); for (Long uuid : roleUuids) { RoleModel rm = roleDao.findById(uuid); roms.add(rm); } em.setRoles(roms); employeeDao.update(em); }
// 废弃 @Override public void update(EmployeeModel model) { EmployeeModel em = new EmployeeModel(); em = employeeDao.findById(model.getUuid()); em.setUserName(model.getUserName()); em.setName(model.getName()); em.setEmail(model.getEmail()); em.setPhone(model.getPhone()); em.setSex(model.getSex()); em.setAddres(model.getAddres()); em.setBirthday(model.getBirthday()); em.setDepartM(model.getDepartM()); employeeDao.update(em); }
// 废弃 @Override public void save(EmployeeModel model) { String pass = model.getUserPass(); model.setUserPass(MD5Utils.md5(pass)); employeeDao.save(model); }