@Transactional(readOnly = true)
 public PageHandler getPage(
     Date startDateRegistered,
     Date endDateRegistered,
     Date startLastLoginDate,
     Date endLastLoginDate,
     Boolean superuserAccess,
     Boolean emailChecked,
     Integer deptId,
     String name,
     Boolean disabled,
     String orderField,
     String orderType,
     Integer pageIndex,
     Integer pageSize) {
   return dao.getPage(
       startDateRegistered,
       endDateRegistered,
       startLastLoginDate,
       endLastLoginDate,
       superuserAccess,
       emailChecked,
       deptId,
       name,
       disabled,
       orderField,
       orderType,
       pageIndex,
       pageSize);
 }
 public void checked(Integer userId, String email) {
   SysUser entity = dao.getEntity(userId);
   if (notEmpty(entity)) {
     entity.setEmail(email);
     entity.setEmailChecked(true);
   }
 }
 public SysUser updateStatus(Integer id, boolean status) {
   SysUser entity = dao.getEntity(id);
   if (notEmpty(entity)) {
     entity.setDisabled(status);
     entity.setAuthToken(null);
   }
   return entity;
 }
 public void deleteRoleIds(Integer userId, Integer roleId) {
   SysUser entity = dao.getEntity(userId);
   if (notEmpty(entity)) {
     String roles = entity.getRoles();
     String[] roleArray = split(roles, ',');
     removeElement(roleArray, roleId.toString());
     roles = arrayToCommaDelimitedString(roleArray);
     entity.setRoles(roles);
   }
 }
 public SysUser updateLoginStatus(Integer id, String username, String authToken, String ip) {
   SysUser entity = dao.getEntity(id);
   if (notEmpty(entity)) {
     LogLogin log = new LogLogin();
     log.setName(username);
     log.setUserId(id);
     log.setResult(true);
     log.setIp(ip);
     log.setErrorPassword(null);
     logLoginDao.save(log);
     entity.setAuthToken(authToken);
     entity.setLastLoginDate(getDate());
     entity.setLastLoginIp(ip);
     entity.setLoginCount(entity.getLoginCount() + 1);
   }
   return entity;
 }
 public void updatePassword(Integer id, String password) {
   SysUser entity = dao.getEntity(id);
   if (notEmpty(entity)) {
     entity.setPassword(password);
   }
 }
 public SysUser findByAuthToken(String authToken) {
   return dao.getEntity(authToken, "authToken");
 }
 public SysUser findByEmail(String email) {
   return dao.findByEmail(email);
 }
 public SysUser findByNickName(String nickName) {
   return dao.getEntity(nickName, "nickName");
 }