IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Java知识库 -> 【项目实战】JavaWeb订单管理系统smbms -> 正文阅读

[Java知识库]【项目实战】JavaWeb订单管理系统smbms

项目搭建

1.搭建maven web项目

2.配置tomcat

3.测试项目能否成功启动

4.导入项目中可能会遇到的jar包

<dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>javax.servlet.jsp-api</artifactId>
      <version>2.3.3</version>
      <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.21</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl -->
    <dependency>
      <groupId>javax.servlet.jsp.jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/taglibs/standard -->
    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>

  </dependencies>

5.创建项目包结构

在这里插入图片描述

6.编写实体类 ORM映射:表-类映射

User,Role,Bill,Provider

7.编写基础公共类

7.1 数据库配置文件database.properties

driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/smbms?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=true&user=root&password=123456
user=root
password=123456

7.2 编写数据库公共类

主要的工作为:

  • 获取数据库连接
  • 编写增删改查公共方法
  • 关闭对应的资源
package xyz.yiui.dao;

import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
import java.util.Properties;

///操作数据库的公共类
public class BaseDao {
    private static String driver;
    private static String url;
    private static String username;
    private static String password;

    ///静态代码块,类加载的时候就初始化了
    static{
        Properties properties=new Properties();
        ///通过类加载器读取对应的资源
        InputStream is=BaseDao.class.getClassLoader().getResourceAsStream("database.properties");
        try {
            properties.load(is);
        } catch (IOException e) {
            e.printStackTrace();
        }

        driver=properties.getProperty("driver");
        url=properties.getProperty("url");
        username=properties.getProperty("username");
        password=properties.getProperty("password");

    }

    //获取数据库的连接
    public static Connection getConnection() throws ClassNotFoundException, SQLException {
        Connection connection=null;
        Class.forName(driver);
        connection= DriverManager.getConnection(url,username,password);
        return connection;
    }

    ///编写查询公共方法 为了方便统一关闭,传入参数resultSet等
    public static ResultSet execute(Connection connection, String sql, Object[] params, ResultSet resultSet, PreparedStatement preparedStatement) throws SQLException {
        preparedStatement=connection.prepareStatement(sql);
        for(int i=0;i<params.length;i++){
            preparedStatement.setObject(i+1,params[i]);
        }
        resultSet=preparedStatement.executeQuery();
        return resultSet;
    }
    ///编写增删改公共方法
    public static int execute(Connection connection, String sql, Object[] params,  PreparedStatement preparedStatement) throws SQLException {
        preparedStatement=connection.prepareStatement(sql);
        for(int i=0;i<params.length;i++){
            preparedStatement.setObject(i+1,params[i]);
        }
        int ans=preparedStatement.executeUpdate();
        return ans;
    }

    ///释放资源
    public static boolean closeResource(Connection connection,PreparedStatement preparedStatement,ResultSet resultSet)  {
        boolean flag=true;
        if(resultSet!=null){
            try{
                resultSet.close();
                resultSet=null;///GC回收
            }catch (SQLException e) {
                e.printStackTrace();
                flag = false;
            }
        }
        if(preparedStatement!=null){
            try{
                preparedStatement.close();
                preparedStatement=null;///GC回收
            }catch (SQLException e) {
                e.printStackTrace();
                flag = false;
            }
        }
        if(connection!=null){
            try{
                connection.close();
                connection=null;///GC回收
            }catch (SQLException e) {
                e.printStackTrace();
                flag = false;
            }
        }
        return flag;
    }
}

7.3 编写字符编码过滤器

package xyz.yiui.filter;

import javax.servlet.*;
import java.io.IOException;

public class CharacterEncodingFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        chain.doFilter(request,response);
    }

    @Override
    public void destroy() {

    }
}

在web.xml里注册

<filter>
        <filter-name>CharacterEncodingFilter</filter-name>
        <filter-class>xyz.yiui.filter.CharacterEncodingFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

8.导入静态资源

在这里插入图片描述

登录功能实现

1.编写前端页面login.jsp

2.设置首页

在web.xml里配置

    <!--设置首页-->
    <welcome-file-list>
        <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>

3.编写dao层 用户登录的接口

3.1 编写dao接口UserDao

package xyz.yiui.dao.user;

import xyz.yiui.pojo.User;

import java.sql.Connection;
import java.sql.SQLException;

public interface UserDao {
    //得到要登录的用户
    public User getLoginUser(Connection connection,String userCode) throws SQLException;
}

3.2 编写对应的实现类UserDaoImpl

package xyz.yiui.dao.user;

import xyz.yiui.dao.BaseDao;
import xyz.yiui.pojo.User;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class UserDaoImpl implements UserDao{

    @Override
    public User getLoginUser(Connection connection, String userCode) throws SQLException {
        PreparedStatement preparedStatement=null;
        ResultSet resultSet=null;
        User user=null;
        if(connection!=null){
            String sql="select * from smbms_user where userCode=?";
            Object[] params={userCode};
                resultSet= BaseDao.execute(connection,resultSet,preparedStatement,sql,params);
                if(resultSet.next()){
                    user=new User();
                    user.setId(resultSet.getInt("id"));
                    user.setUserCode(resultSet.getString("userCode"));
                    user.setUserName(resultSet.getString("userName"));
                    user.setUserPassword(resultSet.getString("userPassword"));
                    user.setGender(resultSet.getInt("gender"));
                    user.setBirthday(resultSet.getDate("birthday"));
                    user.setPhone(resultSet.getString("phone"));
                    user.setAddress(resultSet.getString("address"));
                    user.setUserRole(resultSet.getInt("userRole"));
                    user.setCreatedBy(resultSet.getInt("createdBy"));
                    user.setCreationDate(resultSet.getTimestamp("creationDate"));
                    user.setModifyBy(resultSet.getInt("modifyBy"));
                    user.setModifyDate(resultSet.getTimestamp("modifyDate"));
                }
                BaseDao.closeResource(connection,preparedStatement,resultSet);
        }
        return user;
    }
}

4.编写业务层service 用户登录

4.1 业务层接口

package xyz.yiui.service.user;

import xyz.yiui.pojo.User;

public interface UserService {
    ///用户登录
    public User login(String userCode,String password);
}

4.2 业务层实现类

如果密码不正确,设user为空。

package xyz.yiui.service.user;

import org.junit.jupiter.api.Test;
import xyz.yiui.dao.BaseDao;
import xyz.yiui.dao.user.UserDao;
import xyz.yiui.dao.user.UserDaoImpl;
import xyz.yiui.pojo.User;

import java.sql.Connection;
import java.sql.SQLException;

public class UserServiceImpl implements UserService{
    ///引入dao层
    private UserDao userDao;
    public UserServiceImpl(){
        userDao=new UserDaoImpl();
    }
    @Override
    public User login(String userCode, String password) {
        Connection connection=null;
        User user=null;
        try{
            connection= BaseDao.getConnection();
            ///调用dao层具体操作
            user= userDao.getLoginUser(connection,userCode);
            if(!password.equals(user.getUserPassword())) user=null;
        }catch (SQLException | ClassNotFoundException e){
            e.printStackTrace();
        }finally {
            BaseDao.closeResource(connection,null,null);
        }
        return user;///返回查询结果
    }
    @Test
    public void test(){
        UserServiceImpl userService=new UserServiceImpl();
        User admin=userService.login("admin","111");
        System.out.println(admin.getUserPassword());
    }
}


4.3 编写测试类

    @Test
    public void test(){
        UserServiceImpl userService=new UserServiceImpl();
        User admin=userService.login("admin","111");
        System.out.println(admin.getUserPassword());
    }

5.编写控制层servlet

5.1 编写代码

package xyz.yiui.servlet.user;

import xyz.yiui.pojo.User;
import xyz.yiui.service.user.UserService;
import xyz.yiui.service.user.UserServiceImpl;
import xyz.yiui.util.Constans;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class LoginServlet extends HttpServlet {
    //控制层,调用业务层代码

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("LoginServlet----------start");
        //获取用户名和密码
        String userCode=req.getParameter("userCode");
        String userPassword=req.getParameter("userPassword");
        ///和数据库的密码进行对比,调用业务层
        UserService userService=new UserServiceImpl();
        User user=userService.login(userCode,userPassword);
        ///查询成功,可以登录
        if(user!=null){
            ///将用户的信息放到session
            req.getSession().setAttribute(Constans.USER_SESSION,user);
            ///跳转到主页
            resp.sendRedirect("jsp/frame.jsp");
        }else{
            ///查询失败,转发到登陆页面,提示用户名或密码错误
            req.setAttribute("error","用户名或密码不正确");
            req.getRequestDispatcher("login.jsp").forward(req,resp);   
        }

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}

utils里的Constans放常量

package xyz.yiui.util;

public class Constans {
    public final static String USER_SESSION="userSession";
}

5.2 注册servlet

在web.xml里注册

<servlet>
        <servlet-name>LoginServlet</servlet-name>
        <servlet-class>xyz.yiui.servlet.user.LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>LoginServlet</servlet-name>
        <url-pattern>/login.do</url-pattern>
    </servlet-mapping>

登录功能优化

1.注销:移除session,返回登陆页面

1.1servlet

package xyz.yiui.servlet.user;

import xyz.yiui.util.Constans;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class LogoutServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getSession().removeAttribute(Constans.USER_SESSION);///移除session里的登录信息
        resp.sendRedirect(req.getContextPath()+"/login.jsp");///跳转到登录页面
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}

1.2 web.xml

<!--退出登录servlet-->
    <servlet>
        <servlet-name>LogoutServlet</servlet-name>
        <servlet-class>xyz.yiui.servlet.user.LogoutServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>LogoutServlet</servlet-name>
        <url-pattern>/jsp/logout.do</url-pattern>
    </servlet-mapping>

2.登录拦截器

2.1 编写代码

package xyz.yiui.filter;


import xyz.yiui.pojo.User;
import xyz.yiui.util.Constans;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class SysFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request=(HttpServletRequest) req;
        HttpServletResponse response=(HttpServletResponse) resp;
        ///从session获取用户
        User user=(User) request.getSession().getAttribute(Constans.USER_SESSION);
        if(user==null){
            ///未登录或是注销
            response.sendRedirect("/smbms/error.jsp");
        }
        else{
            chain.doFilter(req,resp);
        }
    }

    @Override
    public void destroy() {

    }
}

2.2 注册web.xml

 <!--登录拦截-->
    <filter>
        <filter-name>SysFilter</filter-name>
        <filter-class>xyz.yiui.filter.SysFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>SysFilter</filter-name>
        <url-pattern>/jsp/*</url-pattern>
    </filter-mapping>

密码修改

1.导入前端资源

2.编写代码dao层

2.1 userdao接口

///修改当前用户密码
    public int updatePwd(Connection connection,int id,String password) throws SQLException;

2.2 userdaoimpl实现类

///修改当前密码
    @Override
    public int updatePwd(Connection connection, int id, String password) throws SQLException {
        PreparedStatement preparedStatement=null;
        int ans=0;
        if(connection!=null){
            String sql="update smbms_user set userPassword = ? where id = ?";
            Object params[]={password,id};
            ans=BaseDao.execute(connection,preparedStatement,sql,params);
            BaseDao.closeResource(null,preparedStatement,null);///connection是传入的参数不需要释放资源
        }
        return ans;
    }

3.service层

3.1 接口UserService

///修改当前用户密码
    public boolean updatePwd(int id, String password);

3.2实现类UserServiceImpl

///修改用户密码
    @Override
    public boolean updatePwd(int id, String password) {
        boolean flag=false;
        Connection connection=null;
        try{
            connection=BaseDao.getConnection();
            if(userDao.updatePwd(connection,id,password)>0){
                flag=true;
            }
        }catch (SQLException | ClassNotFoundException e){
            e.printStackTrace();
        }
        finally {
            BaseDao.closeResource(connection,null,null);
        }
        return flag;
    }

4.servlet层UserServlet

提高servlet复用,写到方法里

 public  void updatePwd(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //从session里拿到当前登录用户的id
        Object o=req.getSession().getAttribute(Constans.USER_SESSION);
        ///拿到新密码
        String newpassword=req.getParameter("newpassword");
        System.out.println("UserServlet"+newpassword);
        boolean flag=false;
        if(o!=null && !StringUtils.isNullOrEmpty(newpassword)){
            UserService userService=new UserServiceImpl();
            flag=userService.updatePwd( ((User)o).getId(),newpassword );
            if(flag){//提示修改成功,并且移除当前session
                req.setAttribute("message","update success,please logout");
                System.out.println("update success,please logout");
                req.getSession().removeAttribute(Constans.USER_SESSION);
            }
            else{
                req.setAttribute("message","update failed");
                System.out.println("update failed");
            }
        }
        else{
            req.setAttribute("message","newpassword wrong");
            System.out.println("newpassword wrong");
        }
        req.getRequestDispatcher("pwdmodify.jsp").forward(req,resp);
        System.out.println("update suceess");
    }

在doGet里判断

@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method=req.getParameter("method");
        if(method.equals("savepwd")&&method!=null){
            this.updatePwd(req,resp);
        }
    }

密码修改优化

在输入旧密码的时候就应该匹配旧密码是否正确,如果都放到后端去判断的话,不太符合逻辑需求,使用Ajax在前端进行判断。

1.导入jar包依赖 编写Ajax代码

借助阿里巴巴的工具类JSONArray实现格式的转换,所以先导入依赖

    <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>fastjson</artifactId>
      <version>1.2.47</version>
    </dependency>
$.ajax({
			type:"GET",
			url:path+"/jsp/user.do",
			data:{method:"pwdmodify",oldpassword:oldpassword.val()},///Ajax传递的参数
			///等价于跳转到path+"/jsp/user.do/method="pwdmodify"&&oldpassword=oldpassword.val()"
			dataType:"json",
			success:function(data){
				if(data.result == "true"){//旧密码正确
					validateTip(oldpassword.next(),{"color":"green"},imgYes,true);
				}else if(data.result == "false"){//旧密码输入不正确
					validateTip(oldpassword.next(),{"color":"red"},imgNo + " 11oldpassword error",false);
				}else if(data.result == "sessionerror"){//当前用户session过期,请重新登录
					validateTip(oldpassword.next(),{"color":"red"},imgNo + " 22session timeout",false);
				}else if(data.result == "error"){//旧密码输入为空
					validateTip(oldpassword.next(),{"color":"red"},imgNo + " 33oldpassword null",false);
				}
			},
			error:function(data){
				//请求出错
				validateTip(oldpassword.next(),{"color":"red"},imgNo + " 44req error",false);
			}
		});

2.修改session过期时间web.xml

    <!--默认session过期时间30min-->
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>

3.编写servlet

首先进行判断,通过原生代码处理让map里的东西变为json

///修改密码
    public  void updatePwd(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //从session里拿到当前登录用户的id
        Object o=req.getSession().getAttribute(Constans.USER_SESSION);
        ///拿到新密码
        String newpassword=req.getParameter("newpassword");
        System.out.println("UserServlet"+newpassword);
        boolean flag=false;
        if(o!=null && !StringUtils.isNullOrEmpty(newpassword)){
            UserService userService=new UserServiceImpl();
            flag=userService.updatePwd( ((User)o).getId(),newpassword );
            if(flag){//提示修改成功,并且移除当前session
                req.setAttribute("message","update success,please logout");
                System.out.println("update success,please logout");
                req.getSession().removeAttribute(Constans.USER_SESSION);
            }
            else{
                req.setAttribute("message","update failed");
                System.out.println("update failed");
            }
        }
        else{
            req.setAttribute("message","newpassword wrong");
            System.out.println("newpassword wrong");
        }
        req.getRequestDispatcher("pwdmodify.jsp").forward(req,resp);
        System.out.println("update suceess");
    }
    ///判断旧密码是否合法,session里就有用户的密码,无需查询数据库
    public void pwdmodify(HttpServletRequest req, HttpServletResponse resp){
        //从session里拿id
        Object o=req.getSession().getAttribute(Constans.USER_SESSION);
        String oldpassword=req.getParameter("oldpassword");///跟Ajax里的保持一致
        ///万能的map存放结果集
        Map<String,String> resultMap=new HashMap<String,String>();
        if(o==null){
            ///session失效或是过期了
            resultMap.put("result","sessionerror");
        }else if(StringUtils.isNullOrEmpty(oldpassword)){
            ///输入的密码为空
            resultMap.put("result","error");
        }
        else{
            ///得到session里用户的密码
            String userpwd=((User)o).getUserPassword();
            if(oldpassword.equals(userpwd)){
                ///密码正确
                resultMap.put("result","true");
            }
            else{
                resultMap.put("result","false");///密码不正确
            }
        }
        ///将map转为json
        /*map=["result","true"]
        * json={key:value}
        * */
        try{
            resp.setContentType("application/json");//设置响应格式
            PrintWriter writer=resp.getWriter();
            writer.write(JSONArray.toJSONString(resultMap));
            writer.flush();///刷新
            writer.close();//关闭 防止内存溢出
        }catch (IOException e){
            e.printStackTrace();
        }

    }

用户管理

1.导入分页工具类PageSupport.java

OOP三大特性:封装(属性私有、get/set、在set里限定一些不安全情况

package xyz.yiui.util;

public class PageSupport {
	//当前页码-来自于用户输入
	private int currentPageNo = 1;
	
	//总数量(表)private int totalCount = 0;
	
	//页面容量
	private int pageSize = 0;
	
	//总页数-totalCount/pageSize(+1)
	private int totalPageCount = 1;

	public int getCurrentPageNo() {
		return currentPageNo;
	}

	public void setCurrentPageNo(int currentPageNo) {
		if(currentPageNo > 0){
			this.currentPageNo = currentPageNo;
		}
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		if(totalCount > 0){
			this.totalCount = totalCount;
			//设置总页数
			this.setTotalPageCountByRs();
		}
	}
	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		if(pageSize > 0){
			this.pageSize = pageSize;
		}
	}

	public int getTotalPageCount() {
		return totalPageCount;
	}

	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}
	
	public void setTotalPageCountByRs(){
		if(this.totalCount % this.pageSize == 0){
			this.totalPageCount = this.totalCount / this.pageSize;
		}else if(this.totalCount % this.pageSize > 0){
			this.totalPageCount = this.totalCount / this.pageSize + 1;
		}else{
			this.totalPageCount = 0;
		}
	}
	
}

2.用户列表页面导入userlist.jsp跟rollpage.jsp

3.获取用户数量

3.1 编写代码dao层

3.1.1 UserDao

//查询用户总数int
    public int getUserCount(Connection connection,String username,int userRole) throws SQLException;

3.1.2 UserDaoImpl

//根据用户名或用户角色查询用户总数
    @Override
    public int getUserCount(Connection connection, String username, int userRole) throws SQLException {

        PreparedStatement preparedStatement=null;///预编译的
        ResultSet resultSet=null;
        int cnt=0;///最终查询出来的数量

        if(connection!=null){
            StringBuffer sql=new StringBuffer();
            sql.append("select count(1) as count from smbms_user u,smbms_role r where u.userRole = r.id");
            ArrayList<Object> list = new ArrayList<>();///先存到列表里

            if(!StringUtils.isNullOrEmpty(username)){
                ///也要查询用户名
                sql.append("and u.userName like ?");
                list.add("%"+username+"%");
            }

            if(userRole>0){
                ///也要查询角色信息
                sql.append("and u.userRole = ?");
                list.add(userRole);
            }
            Object[] objects=list.toArray();///转化为对象数组

            System.out.println("UserDaoImpl->getUserCount"+sql.toString());

            resultSet=BaseDao.execute(connection,resultSet,preparedStatement, String.valueOf(sql),objects);
            if(resultSet.next()){
                cnt=resultSet.getInt("count");///从结果集中获取最终的数量
            }

            BaseDao.closeResource(null,preparedStatement,resultSet);
            ///注意!在这里不关闭connection,因为connection是传入的参数,在业务层关闭
        }

        return cnt;
    }

3.2 编写代码业务层

3.2.1 UserService

//查询用户总数int
    public int getUserCount(String username,int userRole);

3.2.2 UserServiceImpl

 //查询记录数
    @Override
    public int getUserCount(String username, int userRole) {
        Connection connection=null;
        int cnt=0;
        try{
            connection=BaseDao.getConnection();
            cnt=userDao.getUserCount(connection,username,userRole);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            BaseDao.closeResource(connection,null,null);
        }
        return cnt;
    }

3.3 测试

@Test
    public void test_getUserCount(){
        UserServiceImpl userService=new UserServiceImpl();
        int ans=userService.getUserCount(null,1);
        System.out.println(ans);
    }

在这里插入图片描述

4.获取用户列表

在获取用户列表的时候要考虑到分页问题。
数据库中,分页使用limit
语法 limit startindex,pagesize
比如0,5表示第一页,5,5表示第二页,10,5表示第三页。
startindex=(当前页面-1)*页面大小

4.1编写代码dao层

4.1.1 UserDao

   ///获取用户列表
    public List<User> getUserList(Connection connection, String userName, int userRole, int currentPageNo, int pageSize)throws Exception;

4.1.2 UserDaoImpl

///获取用户列表,考虑到分页问题
    @Override
    public List<User> getUserList(Connection connection, String userName, int userRole, int currentPageNo, int pageSize) throws Exception {
        PreparedStatement pstm = null;
        ResultSet rs = null;
        List<User> userList = new ArrayList<User>();
        if(connection != null){
            StringBuffer sql = new StringBuffer();
            sql.append("select u.*,r.roleName as userRoleName from smbms_user u,smbms_role r where u.userRole = r.id");
            List<Object> list = new ArrayList<Object>();
            if(!StringUtils.isNullOrEmpty(userName)){
                sql.append(" and u.userName like ?");
                list.add("%"+userName+"%");
            }
            if(userRole > 0){
                sql.append(" and u.userRole = ?");
                list.add(userRole);
            }
            sql.append(" order by creationDate DESC limit ?,?");
            currentPageNo = (currentPageNo-1)*pageSize;
            list.add(currentPageNo);
            list.add(pageSize);

            Object[] params = list.toArray();
            System.out.println("UserDaoImpl---->getUserList" + sql.toString());
            rs = BaseDao.execute(connection, rs,pstm , sql.toString(), params);
            while(rs.next()){
                User _user = new User();
                _user.setId(rs.getInt("id"));
                _user.setUserCode(rs.getString("userCode"));
                _user.setUserName(rs.getString("userName"));
                _user.setGender(rs.getInt("gender"));
                _user.setBirthday(rs.getDate("birthday"));
                _user.setPhone(rs.getString("phone"));
                _user.setUserRole(rs.getInt("userRole"));
                _user.setUserRoleName(rs.getString("userRoleName"));
                userList.add(_user);
            }
            BaseDao.closeResource(null, pstm, rs);
        }
        return userList;
    }

4.2 编写代码业务层

4.2.1 UserService

 //获取用户列表
    public List<User> getUserList(String queryUserName, int queryUserRole, int currentPageNo, int pageSize);

4.2.2 UserServiceImpl

@Override
    public List<User> getUserList(String queryUserName, int queryUserRole, int currentPageNo, int pageSize) {
        Connection connection = null;
        List<User> userList = null;
        try {
            connection = BaseDao.getConnection();
            userList = userDao.getUserList(connection, queryUserName,queryUserRole,currentPageNo,pageSize);
        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            BaseDao.closeResource(connection, null, null);
        }
        return userList;
    }

4.3 测试

@Test
    public void test_getUserList(){
        UserServiceImpl userService=new UserServiceImpl();
        List<User> ans=userService.getUserList(null,3,1,5);
        for(User t:ans) System.out.println(t);
    }

在这里插入图片描述

改为2以后,查询第2页的数据
在这里插入图片描述

5.获取角色列表

5.1编写代码dao层

5.1.1 RoleDao

//获取角色列表
    public List<Role> getRoleList(Connection connection)throws SQLException;

5.1.2 RoleDaoImpl

 ///获取角色列表
    @Override
    public List<Role> getRoleList(Connection connection) throws SQLException {
        PreparedStatement pstm = null;
        ResultSet rs = null;
        List<Role> roleList = new ArrayList<Role>();
        if(connection != null){
            String sql = "select * from smbms_role";
            Object[] params = {};
            rs = BaseDao.execute(connection, rs,pstm , sql, params);
            while(rs.next()){
                Role _role = new Role();
                _role.setId(rs.getInt("id"));
                _role.setRoleCode(rs.getString("roleCode"));
                _role.setRoleName(rs.getString("roleName"));
                roleList.add(_role);
            }
            BaseDao.closeResource(null, pstm, rs);
        }

        return roleList;
    }

5.2 编写代码业务层

5.2.1 RoleService

///得到角色列表
    public List<Role> getRoleList();

5.2.2 RoleServiceImpl


public class RoleServiceImpl implements RoleService{
    private RoleDao roleDao;

    public RoleServiceImpl(){
        roleDao = new RoleDaoImpl();
    }

    @Override
    public List<Role> getRoleList() {
        Connection connection = null;
        List<Role> roleList = null;
        try {
            connection = BaseDao.getConnection();
            roleList = roleDao.getRoleList(connection);
        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            BaseDao.closeResource(connection, null, null);
        }
        return roleList;
    }
}

5.3 测试

@Test
    public void test_getRoleList(){
        RoleServiceImpl roleService=new RoleServiceImpl();
        List<Role> ans=roleService.getRoleList();
        for(Role t:ans) System.out.println(t);
    }

在这里插入图片描述

6.编写servlet

  • 获取用户的前端的数据,用于查询
  • 判断请求是否要执行,看参数的值进行判断
  • 为了实现分页,需要计算出当前页面,总页面等,借助分页工具类实现
  • 用户列表显示
  • 将得到的数据返回给前端

UserServlet里

@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method=req.getParameter("method");
        if(method.equals("savepwd")&&method!=null){
            this.updatePwd(req,resp);
        }else if(method.equals("pwdmodify")&&method!=null){
            this.pwdmodify(req,resp);
        }else if(method.equals("query")&&method!=null){
            this.query(req,resp);
        }

    }
    ///查询所有用户
    public void query(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
        //查询用户列表
        //获取前端数据
        String queryUserName=req.getParameter("queryname");
        String tmp=req.getParameter("queryUserRole");///临时变量
        String pageIndex=req.getParameter("pageIndex");
        int queryUserRole=0;

        //获取用户列表
        UserServiceImpl userService=new UserServiceImpl();
        RoleServiceImpl roleService=new RoleServiceImpl();
        ///第一次走这个请求,一定是第一页,假设页面大小是固定的
        int pageSize=Constans.PAGESIZE;
        int currentPageNo=1;//当前

        if(queryUserName==null){
            queryUserName="";
        }
        System.out.println(tmp);
        System.out.println(queryUserRole);
        if(!StringUtils.isNullOrEmpty(tmp)){
            queryUserRole= Integer.parseInt(tmp);///查询真正的值
            System.out.println(queryUserRole);
        }

        if(pageIndex!=null){
            currentPageNo=Integer.parseInt(pageIndex);
        }
        //获取用户的总数(分页,上一页和下一页)
        int totalCount=userService.getUserCount(queryUserName,queryUserRole);
        //总页数支持
        PageSupport pageSupport=new PageSupport();
        pageSupport.setCurrentPageNo(currentPageNo);
        pageSupport.setPageSize(pageSize);
        pageSupport.setTotalCount(totalCount);
        int totalPageCount=pageSupport.getTotalPageCount();///得到总页数

        //下面控制首页和尾页
        if(currentPageNo<1) currentPageNo=1;
        if(currentPageNo>totalPageCount) currentPageNo=totalPageCount;

        ///获取用户列表展示 将数据给前端
        List<User> userList=userService.getUserList(queryUserName,queryUserRole,currentPageNo,pageSize);
        req.setAttribute("userList",userList);
        List<Role>roleList=roleService.getRoleList();
        req.setAttribute("roleList",roleList);
        req.setAttribute("totalCount",totalCount);
        req.setAttribute("currentPageNo",currentPageNo);
        req.setAttribute("totalPageCount",totalPageCount);
        req.setAttribute("queryUserName",queryUserName);
        req.setAttribute("queryUserRole",queryUserRole);

        //返回前端
        try{
            req.getRequestDispatcher("userlist.jsp").forward(req,resp);
        }catch (Exception e){
            e.printStackTrace();
        }


    }

一切的增删改操作都需要处理事务,ACID

7.增加用户

7.1 编写UserDao

///增加用户
    public int add(Connection connection, User user)throws Exception;

7.2 编写UserDaoImpl

//修改用户
    @Override
    public int add(Connection connection, User user) throws Exception {
        PreparedStatement pstm = null;
        int updateRows = 0;
        if(null != connection){
            String sql = "insert into smbms_user (userCode,userName,userPassword," +
                    "userRole,gender,birthday,phone,address,creationDate,createdBy) " +
                    "values(?,?,?,?,?,?,?,?,?,?)";
            Object[] params = {user.getUserCode(),user.getUserName(),user.getUserPassword(),
                    user.getUserRole(),user.getGender(),user.getBirthday(),
                    user.getPhone(),user.getAddress(),user.getCreationDate(),user.getCreatedBy()};
            updateRows = BaseDao.execute(connection, pstm, sql, params);///影响的行数
            BaseDao.closeResource(null, pstm, null);
        }
        return updateRows;
    }

7.3 编写UserService

//增加用户呢
    public boolean add(User user);

7.4 编写UserServiceImpl

//增加用户
    @Override
    public boolean add(User user) {
        boolean flag = false;
        Connection connection = null;
        try {
            connection = BaseDao.getConnection();
            connection.setAutoCommit(false);//开启JDBC事务管理
            int updateRows = userDao.add(connection,user);
            connection.commit();//成功的话直接提交
            if(updateRows > 0){
                flag = true;
                System.out.println("add success!");
            }else{
                System.out.println("add failed!");
            }
        } catch (Exception e) {
            e.printStackTrace();
            try {
                System.out.println("rollback==================");
                connection.rollback();//失败的话回滚
            } catch (SQLException e1) {
                e1.printStackTrace();
            }
        }finally{
            //关闭资源
            BaseDao.closeResource(connection, null, null);
        }
        return flag;
    }

7.5 编写UserServlet

在doget里添加

}else if(method != null && method.equals("add")){
            //增加操作
            this.add(req, resp);
        }

add函数如下

//增加新用户
    private void add(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        System.out.println("add()================");
        String userCode = request.getParameter("userCode");
        String userName = request.getParameter("userName");
        String userPassword = request.getParameter("userPassword");
        String gender = request.getParameter("gender");
        String birthday = request.getParameter("birthday");
        String phone = request.getParameter("phone");
        String address = request.getParameter("address");
        String userRole = request.getParameter("userRole");

        User user = new User();
        user.setUserCode(userCode);
        user.setUserName(userName);
        user.setUserPassword(userPassword);
        user.setAddress(address);
        try {
            user.setBirthday(new SimpleDateFormat("yyyy-MM-dd").parse(birthday));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        user.setGender(Integer.valueOf(gender));
        user.setPhone(phone);
        user.setUserRole(Integer.valueOf(userRole));
        user.setCreationDate(new Date());
        user.setCreatedBy(((User)request.getSession().getAttribute(Constans.USER_SESSION)).getId());

        UserService userService = new UserServiceImpl();
        if(userService.add(user)){
            response.sendRedirect(request.getContextPath()+"/jsp/user.do?method=query");
        }else{
            request.getRequestDispatcher("useradd.jsp").forward(request, response);
        }
    }

8.修改用户信息

8.1 编写UserDao

 ///更新用户
    public int modify(Connection connection, User user)throws Exception;

8.2 编写UserDaoImpl

//更新用户
    @Override
    public int modify(Connection connection, User user) throws Exception {
        int flag = 0;
        PreparedStatement pstm = null;
        if(null != connection){
            String sql = "update smbms_user set userName=?,"+
                    "gender=?,birthday=?,phone=?,address=?,userRole=?,modifyBy=?,modifyDate=? where id = ? ";
            Object[] params = {user.getUserName(),user.getGender(),user.getBirthday(),
                    user.getPhone(),user.getAddress(),user.getUserRole(),user.getModifyBy(),
                    user.getModifyDate(),user.getId()};
            flag = BaseDao.execute(connection, pstm, sql, params);
            BaseDao.closeResource(null, pstm, null);
        }
        return flag;
    }

8.3 编写UserService

//修改用户
    public boolean modify(User user);

8.4 编写UserServiceImpl

//更新用户
    @Override
    public boolean modify(User user) {
        Connection connection = null;
        boolean flag = false;
        try {
            connection = BaseDao.getConnection();
            if(userDao.modify(connection,user) > 0)
                flag = true;
        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            BaseDao.closeResource(connection, null, null);
        }
        return flag;
    }

8.5 编写UserServlet

else if(method != null && method.equals("modify")){
            this.getUserById(req, resp,"usermodify.jsp");
        }else if(method != null && method.equals("modifyexe")){
            this.modify(req, resp);
        }
//更新用户
    private void modify(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String id = request.getParameter("uid");
        String userName = request.getParameter("userName");
        String gender = request.getParameter("gender");
        String birthday = request.getParameter("birthday");
        String phone = request.getParameter("phone");
        String address = request.getParameter("address");
        String userRole = request.getParameter("userRole");

        User user = new User();
        user.setId(Integer.valueOf(id));
        user.setUserName(userName);
        user.setGender(Integer.valueOf(gender));
        try {
            user.setBirthday(new SimpleDateFormat("yyyy-MM-dd").parse(birthday));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        user.setPhone(phone);
        user.setAddress(address);
        user.setUserRole(Integer.valueOf(userRole));
        user.setModifyBy(((User)request.getSession().getAttribute(Constans.USER_SESSION)).getId());
        user.setModifyDate(new Date());

        UserService userService = new UserServiceImpl();
        if(userService.modify(user)){
            response.sendRedirect(request.getContextPath()+"/jsp/user.do?method=query");
        }else{
            request.getRequestDispatcher("usermodify.jsp").forward(request, response);
        }

    }

9.删除用户

9.1 编写UserDao

//删除用户
    public int deleteUserById(Connection connection, Integer delId)throws Exception;

9.2 编写UserDaoImpl

//删除用户
    @Override
    public int deleteUserById(Connection connection,Integer delId) throws Exception {
        PreparedStatement pstm = null;
        int flag = 0;
        if(null != connection){
            String sql = "delete from smbms_user where id=?";
            Object[] params = {delId};
            flag = BaseDao.execute(connection, pstm, sql, params);
            BaseDao.closeResource(null, pstm, null);
        }
        return flag;
    }

9.3 编写UserService

//删除用户
    public boolean deleteUserById(Integer delId);

9.4 编写UserServiceImpl

///删除用户
    @Override
    public boolean deleteUserById(Integer delId) {
        Connection connection = null;
        boolean flag = false;
        try {
            connection = BaseDao.getConnection();
            connection.setAutoCommit(false);//开启JDBC事务管理
            connection.commit();//成功的话直接提交
            if(userDao.deleteUserById(connection,delId) > 0)
                flag = true;
        } catch (Exception e) {
            e.printStackTrace();
            try {
                System.out.println("rollback==================");
                connection.rollback();//失败的话回滚
            } catch (SQLException e1) {
                e1.printStackTrace();
            }
        }finally{
            BaseDao.closeResource(connection, null, null);
        }
        return flag;
    }

9.5 编写UserServlet

在doget里添加

else if(method != null && method.equals("deluser")){
            this.delUser(req, resp);
        }

删除方法如下:

//删除用户
    private void delUser(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String id = request.getParameter("uid");
        Integer delId = 0;
        try{
            delId = Integer.parseInt(id);
        }catch (Exception e) {
            delId = 0;
        }
        HashMap<String, String> resultMap = new HashMap<String, String>();
        if(delId <= 0){
            resultMap.put("delResult", "notexist");
        }else{
            UserService userService = new UserServiceImpl();
            if(userService.deleteUserById(delId)){
                resultMap.put("delResult", "true");
            }else{
                resultMap.put("delResult", "false");
            }
        }
        //把resultMap转换成json对象输出
        response.setContentType("application/json");
        PrintWriter outPrintWriter = response.getWriter();
        outPrintWriter.write(JSONArray.toJSONString(resultMap));
        outPrintWriter.flush();
        outPrintWriter.close();
    }

10.查看用户详细信息

10.1 编写UserDao

///根据id得到用户
    public User getUserById(Connection connection, String id)throws Exception;

10.2 编写UserDaoImpl

///根据id得到用户
    @Override
    public User getUserById(Connection connection, String id) throws Exception {
        User user = null;
        PreparedStatement pstm = null;
        ResultSet rs = null;
        if(null != connection){
            String sql = "select u.*,r.roleName as userRoleName from smbms_user u,smbms_role r where u.id=? and u.userRole = r.id";
            Object[] params = {id};
            rs = BaseDao.execute(connection, rs,pstm , sql, params);
            if(rs.next()){
                user = new User();
                user.setId(rs.getInt("id"));
                user.setUserCode(rs.getString("userCode"));
                user.setUserName(rs.getString("userName"));
                user.setUserPassword(rs.getString("userPassword"));
                user.setGender(rs.getInt("gender"));
                user.setBirthday(rs.getDate("birthday"));
                user.setPhone(rs.getString("phone"));
                user.setAddress(rs.getString("address"));
                user.setUserRole(rs.getInt("userRole"));
                user.setCreatedBy(rs.getInt("createdBy"));
                user.setCreationDate(rs.getTimestamp("creationDate"));
                user.setModifyBy(rs.getInt("modifyBy"));
                user.setModifyDate(rs.getTimestamp("modifyDate"));
                user.setUserRoleName(rs.getString("userRoleName"));
            }
            BaseDao.closeResource(null, pstm, rs);
        }
        return user;
    }

10.3 编写UserService

//根据id得到用户
    public User getUserById(String id);

10.4 编写UserServiceImpl

//根据id得到用户
    @Override
    public User getUserById(String id) {
        User user = null;
        Connection connection = null;
        try{
            connection = BaseDao.getConnection();
            user = userDao.getUserById(connection,id);
        }catch (Exception e) {
            e.printStackTrace();
            user = null;
        }finally{
            BaseDao.closeResource(connection, null, null);
        }
        return user;
    }

10.5 编写UserServlet

在doGET里添加

else if(method != null && method.equals("view")){
            this.getUserById(req, resp,"userview.jsp");
        }
//根据id得到用户
    private void getUserById(HttpServletRequest request, HttpServletResponse response,String url)
            throws ServletException, IOException {
        String id = request.getParameter("uid");
        if(!StringUtils.isNullOrEmpty(id)){
            //调用后台方法得到user对象
            UserService userService = new UserServiceImpl();
            User user = userService.getUserById(id);
            request.setAttribute("user", user);
            request.getRequestDispatcher(url).forward(request, response);
        }
    }

11.完善

11.1添加获取角色列表

在servlet里添加获取角色列表的方法
doGet添加

else if(method != null && method.equals("getrolelist")){
            this.getRoleList(req,resp);
        }

然后写这个方法,就是得到角色列表,调用之前写好的业务层逻辑即可

private void getRoleList(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        List<Role> roleList = null;
        RoleService roleService = new RoleServiceImpl();
        roleList = roleService.getRoleList();
        //把roleList转换成json对象输出
        response.setContentType("application/json");
        PrintWriter outPrintWriter = response.getWriter();
        outPrintWriter.write(JSONArray.toJSONString(roleList));
        outPrintWriter.flush();
        outPrintWriter.close();
    }

11.2 查看相同用户编码的人是否存在

因为在填写的时候,使用了Ajax异步判断相同用户编码的人在数据库里是否已经存在,所以对其进行判断。

11.2.1 UserDao

///通过用户编码查找用户
    public User getUserByCode(Connection connection, String userCode)throws Exception;

11.2.2 UserDaoImpl

@Override
    public User getUserByCode(Connection connection, String userCode)
            throws Exception {
        // TODO Auto-generated method stub
        PreparedStatement pstm = null;
        ResultSet rs = null;
        User user = null;
        if(null != connection){
            String sql = "select * from smbms_user where userCode=?";
            Object[] params = {userCode};
            rs = BaseDao.execute(connection, rs, pstm, sql, params);
            if(rs.next()){
                user = new User();
                user.setId(rs.getInt("id"));
                user.setUserCode(rs.getString("userCode"));
                user.setUserName(rs.getString("userName"));
                user.setUserPassword(rs.getString("userPassword"));
                user.setGender(rs.getInt("gender"));
                user.setBirthday(rs.getDate("birthday"));
                user.setPhone(rs.getString("phone"));
                user.setAddress(rs.getString("address"));
                user.setUserRole(rs.getInt("userRole"));
                user.setCreatedBy(rs.getInt("createdBy"));
                user.setCreationDate(rs.getTimestamp("creationDate"));
                user.setModifyBy(rs.getInt("modifyBy"));
                user.setModifyDate(rs.getTimestamp("modifyDate"));
            }
            BaseDao.closeResource(null, pstm, rs);
        }
        return user;
    }

11.2.3 userService

///根据用户编码查找用户
    public User selectUserCodeExist(String userCode);

11.2.4 userServiceImpl

//根据用户编码查找用户
    @Override
    public User selectUserCodeExist(String userCode) {
        Connection connection = null;
        User user = null;
        try {
            connection = BaseDao.getConnection();
            user = userDao.getUserByCode(connection, userCode);
        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            BaseDao.closeResource(connection, null, null);
        }
        return user;
    }

11.2.5 UserServlet

在doGet里添加判断

else if(method != null && method.equals("ucexist")){
            this.userCodeExist(request, response);
        }

编写判断函数

///判断用户编码的用户是否存在
    private void userCodeExist(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String userCode = request.getParameter("userCode");
        HashMap<String, String> resultMap = new HashMap<String, String>();
        if(StringUtils.isNullOrEmpty(userCode)){
            resultMap.put("userCode", "exist");
        }else{
            UserService userService = new UserServiceImpl();
            User user = userService.selectUserCodeExist(userCode);
            if(null != user){
                resultMap.put("userCode","exist");
            }else{
                resultMap.put("userCode", "notexist");
            }
        }
        //把resultMap转为json字符串以json的形式输出
        //配置上下文的输出类型
        response.setContentType("application/json");
        //从response对象中获取往外输出的writer对象
        PrintWriter outPrintWriter = response.getWriter();
        //把resultMap转为json字符串 输出
        outPrintWriter.write(JSONArray.toJSONString(resultMap));
        outPrintWriter.flush();//刷新
        outPrintWriter.close();//关闭流
    }

项目地址

  Java知识库 最新文章
计算距离春节还有多长时间
系统开发系列 之WebService(spring框架+ma
springBoot+Cache(自定义有效时间配置)
SpringBoot整合mybatis实现增删改查、分页查
spring教程
SpringBoot+Vue实现美食交流网站的设计与实
虚拟机内存结构以及虚拟机中销毁和新建对象
SpringMVC---原理
小李同学: Java如何按多个字段分组
打印票据--java
上一篇文章      下一篇文章      查看所有文章
加:2022-05-01 15:33:33  更:2022-05-01 15:37:42 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/24 2:07:20-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码