Package com.github.diamond.web.model

Examples of com.github.diamond.web.model.User


 
  private static final int LIMIT = 10;
 
  @RequestMapping("/project/index")
  public void queryProjects(ModelMap modelMap, @RequestParam(defaultValue="1") int page) {
    User user = (User) SessionHolder.getSession().getAttribute("sessionUser");
    List<Project> projects = projectService.queryProjects(user, PageUtil.getOffset(page, LIMIT), LIMIT);
   
    modelMap.addAttribute("projects", projects);
   
    long recordCount = projectService.queryProjectCount(user);
View Full Code Here


      if(userid == 0) {
        session.setAttribute("project", project);
        session.setAttribute("message", "项目管理者不存在,请检查拼写是否正确");
      } else {
        project.setOwnerId(userid);
        User user = (User) SessionHolder.getSession().getAttribute("sessionUser");
        projectService.saveProject(project, copyCode, user);
       
        session.setAttribute("message", "项目添加成功");
        return "redirect:/project/index";
      }
View Full Code Here

    return "redirect:/project/new";
  }
 
  @RequestMapping("/project/delete")
  public String deleteProject(long id, HttpSession session, HttpServletResponse response) {
    User user = (User) SessionHolder.getSession().getAttribute("sessionUser");
   
    if("admin".equals(user.getUserCode())) {
      projectService.deleteProject(id);
      session.setAttribute("message", "项目删除成功");
      return "redirect:/project/index";
    } else {
      response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
View Full Code Here

 
  @RequestMapping("/config/save")
  public String saveConfig(String type, Long configId, String configKey, String configValue,
      String configDesc, Long projectId, Long moduleId, Long selModuleId, int page,
      @RequestParam(defaultValue="")String flag) {
    User user = (User) SessionHolder.getSession().getAttribute("sessionUser");
    if(configId == null) {
      configService.insertConfig(configKey, configValue, configDesc, projectId, moduleId, user.getUserCode());
    } else {
      configService.updateConfig(type, configId, configKey, configValue, configDesc, projectId, moduleId, user.getUserCode());
    }

    String projCode = (String)projectService.queryProject(projectId).get("PROJ_CODE");
    String config = configService.queryConfigs(projCode, type, "");
    diamondServerHandler.pushConfig(projCode, type, config);
View Full Code Here

 
  private static final int LIMIT = 10;
 
  @RequestMapping("/index")
  public void index(ModelMap modelMap, @RequestParam(defaultValue="1") int page) {
    User user = (User) SessionHolder.getSession().getAttribute("sessionUser");
    List<Project> projects = projectService.queryProjectForUser(user, PageUtil.getOffset(page, LIMIT), LIMIT);
    for(Project project : projects) {
      List<String> roles = projectService.queryRoles(project.getId(), user.getId());
      project.setRoles(roles);
    }
    modelMap.addAttribute("projects", projects);
    long recordCount = projectService.queryProjectCountForUser(user);
    modelMap.addAttribute("totalPages", PageUtil.pageCount(recordCount, LIMIT));
View Full Code Here

  }
 
  @RequestMapping("/user/updatePassword")
  public String updatePassword(String password, String newpassword, HttpSession session) {
    String oldPassword = MD5.getInstance().getMD5String(password);
    User user = (User) SessionHolder.getSession().getAttribute("sessionUser");
   
    if(!oldPassword.equals(user.getPassword()))
      session.setAttribute("message", "原密码不正确");
    else {
      userService.updatePassword(user.getId(), MD5.getInstance().getMD5String(newpassword));
      session.setAttribute("message", "密码修改成功");
    }
    return "redirect:/user/password";
  }
View Full Code Here

 
  private class UserRowMapper implements RowMapper<User> {

    public User mapRow(ResultSet rs, int rowNum) throws SQLException,
        DataAccessException {
      User user = new User();
      user.setId(rs.getLong(1));
      user.setUserCode(rs.getString(2));
      user.setUserName(rs.getString(3));
      return user;
    }
View Full Code Here

    String md5Passwd = MD5.getInstance().getMD5String(password);

    try {
      String sql = "SELECT ID, USER_NAME, PASSWORD, DELETE_FLAG " +
          "FROM CONF_USER WHERE USER_CODE = ?";
      User user = jdbcTemplate.query(sql, new UserResultSetExtractor(), userCode);
     
      if(md5Passwd.equals(user.getPassword())) {
        user.setUserCode(userCode);
        return user;
      } else if(user.getDeleteFlag() == 1)
        return "用户已经被注销";
      else
        return "登录失败,用户密码不正确";
    } catch(TransientDataAccessResourceException e) {
      return "登录失败,用户不存在";
View Full Code Here

  private class UserResultSetExtractor implements ResultSetExtractor<User> {

    @Override
    public User extractData(ResultSet rs) throws SQLException,
        DataAccessException {
      User user = new User();
      rs.next();
      user.setId(rs.getLong(1));
      user.setUserName(rs.getString(2));
      user.setPassword(rs.getString(3));
      user.setDeleteFlag(rs.getInt(4));
      return user;
    }
View Full Code Here

 
  private class UserRowMapper implements RowMapper<User> {

    public User mapRow(ResultSet rs, int rowNum) throws SQLException,
        DataAccessException {
      User user = new User();
      user.setId(rs.getLong(1));
      user.setUserCode(rs.getString(2));
      user.setUserName(rs.getString(3));
      return user;
    }
View Full Code Here

TOP

Related Classes of com.github.diamond.web.model.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.