资源简介

自己写的学校课设实验,没有用框架,直接写的servlet,使用了mvc开发方式,用的是layui美化的界面。

资源截图

代码片段和文件信息

package com.gugu.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

import com.gugu.pojo.GgUser;
import com.gugu.util.DbUtil;

public class AboutDao {
public GgUser getUserInfo(String userName){
String username = userName;
GgUser user = new GgUser();
DbUtil db=new DbUtil();
        try {
         String sql=“SELECT user_nameuser_sexuser_telephone_numbuteruser_qquser_hobbyuser_birthdayuser_emailuser_ageuser_wechat  FROM gg_user where user_name= “+“‘“+username+“‘“;
            Connection conn=db.getCon();
            PreparedStatement ps=conn.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();
            while(rs.next()) {
            user.setUserName(rs.getString(“user_name“));
            user.setBirthday(rs.getDate(“user_birthday“));
            user.setUserEmail(rs.getString(“user_email“));
            user.setUserAge(rs.getInt(“user_age“));
            user.setUserTel(rs.getInt(“user_telephone_numbuter“));
            user.setUserSex(rs.getString(“user_sex“));
            user.setUserQq(rs.getInt(“user_qq“));
            user.setUserWeChat(rs.getString(“user_wechat“));
            user.setUserHobby(rs.getString(“user_hobby“));
            }

            DbUtil.getClose(conn);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return user;
}

public GgUser updateUserInfo(GgUser user){
DbUtil db=new DbUtil();
        try {
         String sql=“UPDATE gg_user SET user_sex=‘“+user.getUserSex()+“‘user_age=“+user.getUserAge()+“user_hobby=‘“+user.getUserHobby()+“‘  WHERE user_id=1“;
            Connection conn=db.getCon();
            PreparedStatement ps=conn.prepareStatement(sql);
            ps.executeUpdate();

            DbUtil.getClose(conn);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return user;
}

public ArrayList getUsers(){
ArrayList users=new ArrayList();
DbUtil db=new DbUtil();
        try {
         String sql=“SELECT user_iduser_nameuser_emailuser_rightsuser_registration_time  FROM gg_user“;
            Connection conn=db.getCon();
            PreparedStatement ps=conn.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();
            rs.last();
            rs.beforeFirst();
            while(rs.next()) {
             GgUser user = new GgUser();
             user.setUserId(rs.getLong(“user_id“));
             user.setUserName(rs.getString(“user_name“));
             user.setUserEmail(rs.getString(“user_email“));
             user.setUserRights(rs.getString(“user_rights“));
             user.setUserRegistrationTime(rs.getDate(“user_registration_time“));
             users.add(user);
            }

            DbUtil.getClose(conn);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return users;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-11-23 12:07  gugu\
     文件         903  2018-11-23 12:07  gugu\.classpath
     目录           0  2018-12-09 21:43  gugu\.git\
     文件          13  2018-12-09 21:42  gugu\.git\COMMIT_EDITMSG
     文件         219  2018-12-09 21:43  gugu\.git\config
     文件          73  2018-11-23 12:03  gugu\.git\description
     文件           0  2018-12-07 21:50  gugu\.git\FETCH_HEAD
     文件          23  2018-11-23 12:07  gugu\.git\HEAD
     目录           0  2018-11-23 12:03  gugu\.git\hooks\
     文件         478  2018-11-23 12:03  gugu\.git\hooks\applypatch-msg.sample
     文件         896  2018-11-23 12:03  gugu\.git\hooks\commit-msg.sample
     文件        3327  2018-11-23 12:03  gugu\.git\hooks\fsmonitor-watchman.sample
     文件         189  2018-11-23 12:03  gugu\.git\hooks\post-update.sample
     文件         424  2018-11-23 12:03  gugu\.git\hooks\pre-applypatch.sample
     文件        1638  2018-11-23 12:03  gugu\.git\hooks\pre-commit.sample
     文件        1348  2018-11-23 12:03  gugu\.git\hooks\pre-push.sample
     文件        4898  2018-11-23 12:03  gugu\.git\hooks\pre-rebase.sample
     文件         544  2018-11-23 12:03  gugu\.git\hooks\pre-receive.sample
     文件        1492  2018-11-23 12:03  gugu\.git\hooks\prepare-commit-msg.sample
     文件        3610  2018-11-23 12:03  gugu\.git\hooks\update.sample
     文件       28225  2018-12-09 21:42  gugu\.git\index
     目录           0  2018-11-23 12:03  gugu\.git\info\
     文件         240  2018-11-23 12:03  gugu\.git\info\exclude
     目录           0  2018-11-23 12:05  gugu\.git\logs\
     文件        1367  2018-12-09 21:42  gugu\.git\logs\HEAD
     目录           0  2018-11-23 12:05  gugu\.git\logs\refs\
     目录           0  2018-11-23 12:05  gugu\.git\logs\refs\heads\
     文件         798  2018-12-09 21:42  gugu\.git\logs\refs\heads\master
     目录           0  2018-12-09 21:42  gugu\.git\objects\
     目录           0  2018-12-02 21:44  gugu\.git\objects\00\
     文件         625  2018-12-02 21:44  gugu\.git\objects\00\0bc6762a3b483ace5d08e28698292553434c06
............此处省略920个文件信息

评论

共有 条评论