src/main/java/top/phrack/ctf/pojo/Users.java
public class Users implements Serializable{
	private static final long serialVersionUID = 1L;  
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Long id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.username
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String username;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.password
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String password;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.email
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String email;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.phone
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String phone;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.organization
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String organization;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.countryid
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Long countryid;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.description
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String description;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.isenabled
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Boolean isenabled;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.score
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Long score;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.token
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String token;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.salt
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String salt;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.regtime
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Date regtime;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.lastactive
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Date lastactive;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.role
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String role;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.users.teamid
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Long teamid;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.id
     *
     * @return the value of public.users.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Long getId() {
        return id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.id
     *
     * @param id the value for public.users.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.username
     *
     * @return the value of public.users.username
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getUsername() {
        return username;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.username
     *
     * @param username the value for public.users.username
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.password
     *
     * @return the value of public.users.password
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getPassword() {
        return password;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.password
     *
     * @param password the value for public.users.password
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.email
     *
     * @return the value of public.users.email
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getEmail() {
        return email;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.email
     *
     * @param email the value for public.users.email
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.phone
     *
     * @return the value of public.users.phone
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getPhone() {
        return phone;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.phone
     *
     * @param phone the value for public.users.phone
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.organization
     *
     * @return the value of public.users.organization
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getOrganization() {
        return organization;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.organization
     *
     * @param organization the value for public.users.organization
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setOrganization(String organization) {
        this.organization = organization == null ? null : organization.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.countryid
     *
     * @return the value of public.users.countryid
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Long getCountryid() {
        return countryid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.countryid
     *
     * @param countryid the value for public.users.countryid
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setCountryid(Long countryid) {
        this.countryid = countryid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.description
     *
     * @return the value of public.users.description
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getDescription() {
        return description;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.description
     *
     * @param description the value for public.users.description
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.isenabled
     *
     * @return the value of public.users.isenabled
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Boolean getIsenabled() {
        return isenabled;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.isenabled
     *
     * @param isenabled the value for public.users.isenabled
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setIsenabled(Boolean isenabled) {
        this.isenabled = isenabled;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.score
     *
     * @return the value of public.users.score
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Long getScore() {
        return score;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.score
     *
     * @param score the value for public.users.score
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setScore(Long score) {
        this.score = score;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.token
     *
     * @return the value of public.users.token
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getToken() {
        return token;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.token
     *
     * @param token the value for public.users.token
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setToken(String token) {
        this.token = token == null ? null : token.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.salt
     *
     * @return the value of public.users.salt
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getSalt() {
        return salt;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.salt
     *
     * @param salt the value for public.users.salt
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setSalt(String salt) {
        this.salt = salt == null ? null : salt.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.regtime
     *
     * @return the value of public.users.regtime
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Date getRegtime() {
        return regtime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.regtime
     *
     * @param regtime the value for public.users.regtime
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setRegtime(Date regtime) {
        this.regtime = regtime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.lastactive
     *
     * @return the value of public.users.lastactive
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Date getLastactive() {
        return lastactive;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.lastactive
     *
     * @param lastactive the value for public.users.lastactive
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setLastactive(Date lastactive) {
        this.lastactive = lastactive;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.role
     *
     * @return the value of public.users.role
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getRole() {
        return role;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.role
     *
     * @param role the value for public.users.role
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setRole(String role) {
        this.role = role == null ? null : role.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.users.teamid
     *
     * @return the value of public.users.teamid
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Long getTeamid() {
        return teamid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.users.teamid
     *
     * @param teamid the value for public.users.teamid
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setTeamid(Long teamid) {
        this.teamid = teamid;
    }
    
    @Override
    public int hashCode() {
        return id.intValue();
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Users other = (Users) obj;
        if (id != other.id)
            return false;
        return true;
    }
}
src/main/java/top/phrack/ctf/pojo/SolveTable.java
public class SolveTable {
	
	private long id;
	
	private String title;
	
	private String catemark;
	
	private String catename;
	
	private long score;
	
	private Date passtime;
	
	public long getid() {
		return id;
	}
	
	public void setid(long id) {
		this.id = id;
	}
	public String gettitle(){
		return title;
	}
	
	public void settitle(String title) {
		this.title = title;
	}
	
	public String getcatemark(){
		return catemark;
	}
	
	public void setcatemark(String catemark) {
		this.catemark = catemark;
	}
	
	public long getscore(){
		return score;
	}
	
	public void setscore(long score) {
		this.score = score;
	}
	
	public String getcatename(){
		return catename;
	}
	
	public void setcatename(String catename) {
		this.catename = catename;
	}
	
	public Date getpasstime(){
		return passtime;
	}
	
	public void setpasstime(Date passtime) {
		this.passtime = passtime;
	}
	
	
}
src/main/java/top/phrack/ctf/utils/CommonUtils.java
public class CommonUtils {
	
	private static String flag_salt = "OtN0onrc1BWPfsHpczuWiEYZbRDzvRAOZLYySuVeWwd3PQ0Lj0PiGOjVBP9ZU4ab";
	/**

	 * 

	 * 获取当前控制器名称

	 */
	public static void setControllerName(final HttpServletRequest request,final ModelAndView mv){
		String servpath = request.getServletPath().substring(1);
		mv.addObject("ctrlname",servpath);
	} 
	
	private final static Whitelist user_content_filter = Whitelist.relaxed();  
	static {  
	    user_content_filter.addTags("embed","object","param","span","div");  
	    user_content_filter.addAttributes(":all", "style", "class", "id", "name");  
	    user_content_filter.addAttributes("object", "width", "height","classid","codebase");      
	    user_content_filter.addAttributes("param", "name", "value");  
	    user_content_filter.addAttributes("embed", "src","quality","width","height","allowFullScreen","allowScriptAccess","flashvars","name","type","pluginspage");  
	}  
	  
	/** 

	 * 对用户输入内容进行过滤 

	 * @param html 

	 * @return 

	 */  
	public static String filterUserInputContent(String html) {  
	    if(StringUtils.isBlank(html)) return "";  
	    return Jsoup.clean(html, user_content_filter);  
	    //return filterScriptAndStyle(html);  


	}  
	
	
	/**

	 *  统计用户使用信息

	 */
	public static void storeUserIpUsageInfo(HttpServletRequest request,UserServices userServices,IPlogServices ipLogServices,String username){
		String userip = request.getRemoteAddr(); 
		Users userobj = userServices.getUserByEmail(username);
		IpLogs oldrec = ipLogServices.getLogsByAddrAndId(userip, userobj.getId());
		Date current = new Date();
		if (oldrec==null) {
			oldrec = new IpLogs();
			oldrec.setAdded(current);
			oldrec.setIpaddr(userip);
			oldrec.setLastused(current);
			oldrec.setTimesused(Long.valueOf(1));
			oldrec.setUserid(userobj.getId());
			ipLogServices.insertNewLog(oldrec);
		} else {
			oldrec.setLastused(current);
			oldrec.setTimesused(oldrec.getTimesused()+1);
			ipLogServices.updateLogInfo(oldrec);
		}
		userobj.setLastactive(current);
		userServices.updateUser(userobj);
	}
	
	public static Users setUserInfo(Subject currentUser,UserServices userServices,SubmissionServices submissionServices,ModelAndView mv) {
		if (currentUser==null) {
			return null;
		}
		if (currentUser.isRemembered()||currentUser.isAuthenticated()) {
			
			Users userobj = userServices.getUserByEmail((String)currentUser.getPrincipal());
			String NickName = userobj.getUsername();
			Long score = userobj.getScore();
			long rank = getUserrank(userobj,userServices,submissionServices);
			mv.addObject("nickname", NickName);
			mv.addObject("score", score);
			mv.addObject("rank", rank);
			return userobj;
		}
		return null;
	}
	
	@SuppressWarnings("unchecked")
	public static long getUserrank(Users userobj,UserServices userServices,SubmissionServices submissionServices) {
		if (userobj.getRole().equals("admin")) {
			return 0;
		}
		List<Users> userforrank = userServices.getUsersForRank();
		ArrayList<RanklistObj> ranklist = new ArrayList<RanklistObj>();
		List<Submissions> allcorrect = submissionServices.getAllCorrectAndOrderByUserId();
		RanklistObj thisuser = null;
		for (Users u:userforrank) {
			RanklistObj aobj = new RanklistObj();
			Submissions last = null;//submissionServices.getLastCorrectSubmitByUserId(u.getId());
			for (Submissions sb:allcorrect) {
				if (sb.getUserid().longValue()==u.getId().longValue()) {
					last = sb;
					break;
				}
			}
			if (last==null) {
				aobj.setLastSummit(new Date());
			} else {
				aobj.setLastSummit(last.getSubmitTime());
			}
			aobj.setuserobj(u);
			ranklist.add(aobj);
			if (u.getId()-userobj.getId()==0) {
				thisuser = aobj;
			}
		}
		CompareScore c = new CompareScore();
		Collections.sort(ranklist,c);
		/*for (int i=0;i<ranklist.size()-1;i++) {
			for (int j=0;j<ranklist.size()-1;j++) {
				if (c.compare(ranklist.get(j),ranklist.get(j+1))==1) {
					RanklistObj tmp = ranklist.get(j);
					ranklist.set(j, ranklist.get(j+1));
					ranklist.set(j+1, tmp);
				}
			}
		}*/

//		for (RanklistObj robj:ranklist) {


//			System.out.println(robj.getuserobj().getScore()+" "+robj.getuserobj().getUsername()+" "+robj.getLastSummit());


//		}


		

		return ranklist.indexOf(thisuser)+1;
	}
	
	/**

	 * xss过滤器

	 * @param rawstr

	 * @return

	 */
	public static String XSSFilter(String rawstr) {
		String tmp = StringEscapeUtils.escapeHtml(rawstr);
		//tmp = StringEscapeUtils.escapeJavaScript(tmp);


		//tmp = StringEscapeUtils.escapeSql(tmp);


		return tmp;
	}
	
	public static boolean CheckIpBanned(HttpServletRequest request,BannedIpServices bannedIpServices) {
		String userip = request.getRemoteAddr();
		BannedIps banip = bannedIpServices.getRecordByIp(userip);
		if (banip!=null) {
			return true;
		} else {
			return false;
		}
		
	}
	
	public static String getFlagSalt() {
		return flag_salt;
	}
	
	public static boolean isValidDate(String str) {	
		boolean convertSuccess=true;
		// 指定日期格式为四位年/两位月份/两位日期，注意yyyy/MM/dd区分大小写；


		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		try {
			// 设置lenient为false. 否则SimpleDateFormat会比较宽松地验证日期，比如2007/02/29会被接受，并转换成2007/03/01


			format.setLenient(false);
			format.parse(str);
		} catch (ParseException e) {
			// e.printStackTrace();


			// 如果throw java.text.ParseException或者NullPointerException，就说明格式不对


			convertSuccess=false;
		} 
		return convertSuccess;
	}
	
}
src/main/java/top/phrack/ctf/models/services/CategoryServices.java
public interface CategoryServices {
	
	public List<Categories> selectAllCategory();
	
	public Categories selectById(Long id);

	public int insertNewCategory(Categories cate);
	
	public int deleteCategoryById(Long id);
	
	public int updateCategory(Categories cate);
	
}
src/main/java/top/phrack/ctf/pojo/Submissions.java
public class Submissions implements Serializable{
	private static final long serialVersionUID = 1L;  
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.submissions.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Long id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.submissions.userid
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Long userid;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.submissions.challenge_id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Long challengeId;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.submissions.submit_time
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Date submitTime;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.submissions.content
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String content;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.submissions.correct
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Boolean correct;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.submissions.id
     *
     * @return the value of public.submissions.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Long getId() {
        return id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.submissions.id
     *
     * @param id the value for public.submissions.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.submissions.userid
     *
     * @return the value of public.submissions.userid
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Long getUserid() {
        return userid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.submissions.userid
     *
     * @param userid the value for public.submissions.userid
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setUserid(Long userid) {
        this.userid = userid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.submissions.challenge_id
     *
     * @return the value of public.submissions.challenge_id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Long getChallengeId() {
        return challengeId;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.submissions.challenge_id
     *
     * @param challengeId the value for public.submissions.challenge_id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setChallengeId(Long challengeId) {
        this.challengeId = challengeId;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.submissions.submit_time
     *
     * @return the value of public.submissions.submit_time
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Date getSubmitTime() {
        return submitTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.submissions.submit_time
     *
     * @param submitTime the value for public.submissions.submit_time
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setSubmitTime(Date submitTime) {
        this.submitTime = submitTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.submissions.content
     *
     * @return the value of public.submissions.content
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getContent() {
        return content;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.submissions.content
     *
     * @param content the value for public.submissions.content
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.submissions.correct
     *
     * @return the value of public.submissions.correct
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Boolean getCorrect() {
        return correct;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.submissions.correct
     *
     * @param correct the value for public.submissions.correct
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setCorrect(Boolean correct) {
        this.correct = correct;
    }
    
    @Override
    public int hashCode() {
        return id.intValue();
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Submissions other = (Submissions) obj;
        if (id != other.id)
            return false;
        return true;
    }
}
src/main/java/top/phrack/ctf/models/services/UserServices.java
public interface UserServices {
	
	public Users getUserByEmail(String email);
	
	public Users getUserByName(String username);
	
	public int insertNewUser(Users auser);
	
	public int updateUser(Users User);
	
	public Users getUserById(Long id);
	
	public List<Users> getUsersForRank();
	
	public List<Users> getAllUsers();
	
	public int deleteUserById(Long id);
}
src/main/java/top/phrack/ctf/pojo/Categories.java
public class Categories implements Serializable{
	private static final long serialVersionUID = 1L;  
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.categories.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Long id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.categories.name
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String name;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.categories.mark
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String mark;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.categories.id
     *
     * @return the value of public.categories.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Long getId() {
        return id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.categories.id
     *
     * @param id the value for public.categories.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.categories.name
     *
     * @return the value of public.categories.name
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getName() {
        return name;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.categories.name
     *
     * @param name the value for public.categories.name
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.categories.mark
     *
     * @return the value of public.categories.mark
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getMark() {
        return mark;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.categories.mark
     *
     * @param mark the value for public.categories.mark
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setMark(String mark) {
        this.mark = mark == null ? null : mark.trim();
    }
    
    @Override
    public int hashCode() {
        return id.intValue();
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Categories other = (Categories) obj;
        if (id != other.id)
            return false;
        return true;
    }
}
src/main/java/top/phrack/ctf/models/services/ChallengeServices.java
public interface ChallengeServices {

	public List<Challenges> getAllAvailChallenges();
	
	public int updateChallenge(Challenges challenge);
	
	public Challenges getChallengeById(Long id);
	
	public Long getCateScoreByCateId(Long cateid);
	
	public List<Challenges> getAllChallenges();
	
	public int createNewChallenge(Challenges challenge);
	
	public List<Challenges> getAllChallengesInCateById(Long id);
	
	public int deleteChallengeById(Long id);
}
src/main/java/top/phrack/ctf/models/services/CountryServices.java
public interface CountryServices {
	public List<Countries> SelectAllCountry(); 
	
	public Countries getCountryById(Long id);
	
	public Countries getCountryByCode(String code);
}
src/main/java/top/phrack/ctf/pojo/Challenges.java
public class Challenges implements Serializable{
	private static final long serialVersionUID = 1L;  
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.id
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private Long id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.title
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private String title;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.description
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private String description;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.attachids
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private String attachids;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.score
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private Long score;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.categoryid
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private Long categoryid;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.flag
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private String flag;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.exposed
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private Boolean exposed;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.available
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private Date available;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.invalidate
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private Date invalidate;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.challenges.watchby
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    private String watchby;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.id
     *
     * @return the value of public.challenges.id
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public Long getId() {
        return id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.id
     *
     * @param id the value for public.challenges.id
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.title
     *
     * @return the value of public.challenges.title
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public String getTitle() {
        return title;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.title
     *
     * @param title the value for public.challenges.title
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.description
     *
     * @return the value of public.challenges.description
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public String getDescription() {
        return description;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.description
     *
     * @param description the value for public.challenges.description
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.attachids
     *
     * @return the value of public.challenges.attachids
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public String getAttachids() {
        return attachids;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.attachids
     *
     * @param attachids the value for public.challenges.attachids
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setAttachids(String attachids) {
        this.attachids = attachids == null ? null : attachids.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.score
     *
     * @return the value of public.challenges.score
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public Long getScore() {
        return score;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.score
     *
     * @param score the value for public.challenges.score
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setScore(Long score) {
        this.score = score;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.categoryid
     *
     * @return the value of public.challenges.categoryid
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public Long getCategoryid() {
        return categoryid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.categoryid
     *
     * @param categoryid the value for public.challenges.categoryid
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setCategoryid(Long categoryid) {
        this.categoryid = categoryid;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.flag
     *
     * @return the value of public.challenges.flag
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public String getFlag() {
        return flag;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.flag
     *
     * @param flag the value for public.challenges.flag
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setFlag(String flag) {
        this.flag = flag == null ? null : flag.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.exposed
     *
     * @return the value of public.challenges.exposed
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public Boolean getExposed() {
        return exposed;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.exposed
     *
     * @param exposed the value for public.challenges.exposed
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setExposed(Boolean exposed) {
        this.exposed = exposed;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.available
     *
     * @return the value of public.challenges.available
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public Date getAvailable() {
        return available;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.available
     *
     * @param available the value for public.challenges.available
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setAvailable(Date available) {
        this.available = available;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.invalidate
     *
     * @return the value of public.challenges.invalidate
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public Date getInvalidate() {
        return invalidate;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.invalidate
     *
     * @param invalidate the value for public.challenges.invalidate
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setInvalidate(Date invalidate) {
        this.invalidate = invalidate;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.challenges.watchby
     *
     * @return the value of public.challenges.watchby
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public String getWatchby() {
        return watchby;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.challenges.watchby
     *
     * @param watchby the value for public.challenges.watchby
     *
     * @mbggenerated Sun Apr 10 21:02:51 CST 2016
     */
    public void setWatchby(String watchby) {
        this.watchby = watchby == null ? null : watchby.trim();
    }
}
src/main/java/top/phrack/ctf/models/services/SubmissionServices.java
public interface SubmissionServices {

	public List<Submissions> getAllCorrectSubmitByTaskId(Long taskid);
	
	public List<Submissions> getAllSubmitByUserId(Long userid);
	
	public int insertNewSubmission(Submissions aSubmission);
	
	public Submissions getLastCorrectSubmitByUserId(Long userid);
	
	public Long getSolvedByUseridAndTaskId(Long userid,Long taskid);
	
	public Submissions getLastSubmitByUserId(Long userid);
	
	public List<Submissions> getCorrectSubmitByUserid(Long userid);
	
	public Submissions getCorrectByUserIdAndTaskId(Long userid,Long taskid);
	
	public List<Submissions> getAllSubmissions();
	
	public List<Submissions> getAllCorrectAndOrderByUserId();
	
	public Submissions getSubmissionById(Long id);
	
	public int updateSubmission(Submissions newsub);
	
	public int deleteSubmission(Long id);
	
	public Long getsubmitTimesByUserIdAndTaskId(Long userid,Long taskid);
}
src/main/java/top/phrack/ctf/pojo/CateProcess.java
public class CateProcess {
	
	private String name;
	
	private long proc;
	
	private long total;
	
	private double percent;
	
	private String style;
	
	private double percentall;
	
	public String getname() {
		return name;
	}
	
	public void setname(String name) {
		this.name = name;
	}
	
	public long getproc() {
		return proc;
	}
	
	public void setproc(long proc){
		this.proc = proc;
	}
	
	public long gettotal(){
		return total;
	}
	
	public void settotal(long total) {
		this.total = total;
	}
	
	public double getpercent() {
		return percent;
	}
	
	public void setpercent(double percent) {
		this.percent = percent;
	}
	
	public String getstyle() {
		return style;
	}
	
	public void setstyle(String style) {
		this.style = style;
	}
	
	public double getpercentall() {
		return percentall;
	} 
	
	public void setpercentall(double percentall) {
		this.percentall = percentall;
	}
	
	
}
src/main/java/top/phrack/ctf/models/services/BannedIpServices.java
public interface BannedIpServices {
	
	public BannedIps getRecordByIp(String ip);
	
	public List<BannedIps> getAllIps();
	
	public int deleteRecordById(Long id);
	
	public int updateRecord(BannedIps ip);
	
	public int insertIpRecord(BannedIps newip);
	
	public BannedIps getRecordById(Long id);
	
}
src/main/java/top/phrack/ctf/pojo/Countries.java
public class Countries implements Serializable{
	private static final long serialVersionUID = 1L;  
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.countries.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private Long id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.countries.countryname
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String countryname;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column public.countries.countrycode
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    private String countrycode;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.countries.id
     *
     * @return the value of public.countries.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public Long getId() {
        return id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.countries.id
     *
     * @param id the value for public.countries.id
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.countries.countryname
     *
     * @return the value of public.countries.countryname
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getCountryname() {
        return countryname;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.countries.countryname
     *
     * @param countryname the value for public.countries.countryname
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setCountryname(String countryname) {
        this.countryname = countryname == null ? null : countryname.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column public.countries.countrycode
     *
     * @return the value of public.countries.countrycode
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public String getCountrycode() {
        return countrycode;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column public.countries.countrycode
     *
     * @param countrycode the value for public.countries.countrycode
     *
     * @mbggenerated Thu Mar 31 16:07:59 CST 2016
     */
    public void setCountrycode(String countrycode) {
        this.countrycode = countrycode == null ? null : countrycode.trim();
    }
}


Question: import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import top.phrack.ctf.models.services.BannedIpServices;
import top.phrack.ctf.models.services.CategoryServices;
import top.phrack.ctf.models.services.ChallengeServices;
import top.phrack.ctf.models.services.CountryServices;
import top.phrack.ctf.models.services.SubmissionServices;
import top.phrack.ctf.models.services.UserServices;
import top.phrack.ctf.pojo.CateProcess;
import top.phrack.ctf.pojo.Categories;
import top.phrack.ctf.pojo.Challenges;
import top.phrack.ctf.pojo.Countries;
import top.phrack.ctf.pojo.SolveTable;
import top.phrack.ctf.pojo.Submissions;
import top.phrack.ctf.pojo.Users;
import top.phrack.ctf.utils.CommonUtils;
/**
 * 
 */
package top.phrack.ctf.controller;





/**
 * 用户资料显示页面
 *
 * @author Jarvis
 * @date 2016年4月14日
 */
@Controller
public class ProfileController {
	
	private Logger log = LoggerFactory.getLogger(ProfileController.class);
	

	@Autowired
	private HttpServletRequest request;
	@Resource 
	private UserServices userServices;
	@Resource
Answer: 	private BannedIpServices bannedIpServices;