コード例 #1
0
 public int loginCheck(String username, String password) {
   String sql = "select count(*) from t_user where username=?";
   long count = baseDao.findLongByArray(sql, username);
   if (count > 0) {
     sql = "select count(*) from t_user where username=? and password=?";
     count = baseDao.findLongByArray(sql, username, password);
     if (count > 0) {
       return 1;
     } else {
       return -2;
     }
   } else {
     return -1;
   }
 }
コード例 #2
0
 public User queryUserInfo(String username) {
   String sql = "select * from t_user where username = ? ";
   Object[] args = new Object[] {username};
   return (User) baseDao.findUniqueBeanByArray(sql, User.class, args);
 }
コード例 #3
0
 public int register(String username, String password, String cnname) throws Exception {
   String sql = "insert into t_user(username,password, cnname, createTime) values(?,?,?,now())";
   Object[] args = new Object[] {username, password, cnname};
   return baseDao.executeByArray(sql, args);
 }
コード例 #4
0
 public long queryUsername(String username) {
   String sql = "select count(*) from t_user where username=?";
   long count = baseDao.findLongByArray(sql, username);
   return count;
 }