【Spring Boot+Thymeleaf+MyBatis+mysql】实现电子商务平台实战(附源码)持续更新~~ 包括sql语句、java、html代码

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,高可用系列 2核4GB
云数据库 RDS PostgreSQL,高可用系列 2核4GB
简介: 【Spring Boot+Thymeleaf+MyBatis+mysql】实现电子商务平台实战(附源码)持续更新~~ 包括sql语句、java、html代码

源码请点赞关注收藏后评论区留言和私信博主

开发环境:Web服务器使用Servlet容器,数据库采用mysql,集成开发环境为Spring Tool Suite(STS)

一、系统设计

电子商务平台分为两个子系统 一个是后台管理系统 一个是电子商务系统,下面分别讲解着两个子系统的功能需要与模块划分

系统功能需求

1:后台管理子系统

要求管理员登录成功后,才能对商品进行管理,包括添加商品,查询商品,修改商品以及删除商品,除商品管理外,管理员还需要对商品类型,注册用户以及用户的订单等进行管理

2:电子商务子系统

(1):非注册用户

具有浏览首页,查看商品详情以及搜索商品的功能

(2):注册用户

还可以购买商品,查看购物车,收藏商品,查看订单等等

系统模块划分

1:后台管理子系统

模块划分如下

2:电子商务子系统

模块划分如下

二、数据库设计

系统采用加载纯Java数据库驱动程序的方式连接MYSQL数据库,创建数据库shop并创建8张系统表 数据库E-R图如下

建表的sql语句此处省略 需要请点赞关注收藏后私信博主

部分sql语句如下

/*
Navicat MySQL Data Transfer
Source Server         : testSpringMVC
Source Server Version : 50519
Source Host           : localhost:3306
Source Database       : shop
Target Server Type    : MYSQL
Target Server Version : 50519
File Encoding         : 65001
Date: 2019-10-08 07:41:20
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `ausertable`
-- ----------------------------
DROP TABLE IF EXISTS `ausertable`;
CREATE TABLE `ausertable` (
  `aname` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `apwd` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`aname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of ausertable
-- ----------------------------
INSERT INTO ausertable VALUES ('admin', 'admin');
-- ----------------------------
-- Table structure for `busertable`
-- ----------------------------
DROP TABLE IF EXISTS `busertable`;
CREATE TABLE `busertable` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `bemail` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `bpwd` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of busertable
-- ----------------------------
INSERT INTO busertable VALUES ('6', 'chenhengdl@126.com', '78f8a7ae700c91db09facb05a675432b');
-- ----------------------------
-- Table structure for `carttable`
-- ----------------------------
还没弄
DROP TABLE IF EXISTS `carttable`;
CREATE TABLE `carttable` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `busertable_id` int(11) NOT NULL,
  `goodstable_id` int(11) NOT NULL,
  `shoppingnum` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bid` (`busertable_id`),
  KEY `gno` (`goodstable_id`),
  CONSTRAINT `bid` FOREIGN KEY (`busertable_id`) REFERENCES `busertable` (`id`),
  CONSTRAINT `gno` FOREIGN KEY (`goodstable_id`) REFERENCES `goodstable` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of carttable
-- ----------------------------
-- ----------------------------
-- Table structure for `focustable`
-- ----------------------------
还没弄
DROP TABLE IF EXISTS `focustable`;
CREATE TABLE `focustable` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `goodstable_id` int(11) NOT NULL,
  `busertable_id` int(11) NOT NULL,
  `focustime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `gno1` (`goodstable_id`),
  KEY `bid1` (`busertable_id`),
  CONSTRAINT `bid1` FOREIGN KEY (`busertable_id`) REFERENCES `busertable` (`id`),
  CONSTRAINT `gno1` FOREIGN KEY (`goodstable_id`) REFERENCES `goodstable` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of focustable
-- ----------------------------
INSERT INTO focustable VALUES ('5', '29', '6', '2019-10-05 14:55:51');
-- ----------------------------
-- Table structure for `goodstable`
-- ----------------------------
还没弄
DROP TABLE IF EXISTS `goodstable`;
CREATE TABLE `goodstable` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `gname` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `goprice` double DEFAULT NULL,
  `grprice` double DEFAULT NULL,
  `gstore` int(11) DEFAULT NULL,
  `gpicture` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `isRecommend` tinyint(2) DEFAULT NULL,
  `isAdvertisement` tinyint(2) DEFAULT NULL,
  `goodstype_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `typeid` (`goodstype_id`),
  CONSTRAINT `typeid` FOREIGN KEY (`goodstype_id`) REFERENCES `goodstype` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of goodstable
-- ----------------------------
INSERT INTO goodstable VALUES ('26', '广告商品4', '90', '80', '1000', '201910274135059473.jpg', '0', '1', '2');
INSERT INTO goodstable VALUES ('27', '广告商品5', '80', '30', '122', '201910274135126352.jpg', '0', '1', '3');
INSERT INTO goodstable VALUES ('28', '抱枕11号', '100', '20', '200', '201910274135150096.jpg', '1', '0', '14');
INSERT INTO goodstable VALUES ('29', '抱枕22号', '300', '200', '180', '201910274135212497.jpg', '1', '0', '15');
INSERT INTO goodstable VALUES ('32', '抱枕99', '80', '70', '80', '201910280135330014.jpg', '1', '0', '14');
DROP TABLE IF EXISTS `orderdetail`;
CREATE TABLE `orderdetail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `orderbasetable_id` int(11) NOT NULL,
  `goodstable_id` int(11) NOT NULL,
  `shoppingnum` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `odsn` (`orderbasetable_id`),
  KEY `gno3` (`goodstable_id`),
  CONSTRAINT `gno3` FOREIGN KEY (`goodstable_id`) REFERENCES `goodstable` (`id`),
  CONSTRAINT `odsn` FOREIGN KEY (`orderbasetable_id`) REFERENCES `orderbasetable` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of orderdetail
-- ----------------------------
INSERT INTO orderdetail VALUES ('5', '3', '29', '20');
INSERT INTO orderdetail VALUES ('6', '4', '33', '20');

建表后效果如下

 

三、系统管理

1:添加相关依赖

在pom.xml文件中添加如下代码

<!-- 添加MySQL依赖 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
<!-- MySQL8.x时,请使用8.x的连接器 -->
</dependency>
<!-- MyBatis-Spring,Spring Boot应用整合MyBatis框架的核心依赖配置 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<!-- 由于commons-fileupload组件不属于Spring Boot,所以需要加上版本 -->
<version>1.3.3</version>
</dependency>

应用的目录结构如下

 

 

在配置文件application.properties中添加如下代码

server.servlet.context-path=/eBusiness
###
##数据源信息配置
###
#数据库地址
spring.datasource.url=jdbc:mysql://localhost:3306/shop?characterEncoding=utf8
#数据库MySQL为8.x时,url为jdbc:mysql://localhost:3306/springbootjpa?useSSL=false&serverTimezone=Asia/Beijing&characterEncoding=utf-8
#数据库用户名
spring.datasource.username=root
#数据库密码
spring.datasource.password=root
#数据库驱动
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#设置包别名(在Mapper映射文件中直接使用实体类名)
mybatis.type-aliases-package=com.ch.ebusiness.entity
#告诉系统在哪里去找mapper.xml文件(映射文件)
mybatis.mapperLocations=classpath:mappers/*.xml
#在控制台输出SQL语句日志
logging.level.com.ch.ebusiness.repository=debug
#关闭Thymeleaf模板引擎缓存(使页面热部署),默认是开启的
spring.thymeleaf.cache=false
#上传文件时,默认单个上传文件大小是1MB,max-file-size设置单个上传文件大小
spring.servlet.multipart.max-file-size=50MB
#默认总文件大小是10MB,max-request-size设置总上传文件大小
spring.servlet.multipart.max-request-size=500MB

四、组件设计

包括 管理员登录权限验证 前台用户登录权限验证 验证码 统一异常处理 工具类等等

五、后台管理子系统的实现

管理员登录界面如下

代码如下

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>管理员登录页面</title>
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" />
<body>
  <div class="container">
      <div class="bg-primary"  style="width:70%; height: 60px;padding-top: 1px;">
         <h3 align="center">管理员登录</h3>
     </div>
    <br>
    <br>
    <form th:action="@{/admin/login}" name="myform" method="post" th:object="${aUser}"  class="form-horizontal" role="form" >
      <div class="form-group has-success">
        <label class="col-sm-2 col-md-2 control-label">用户名</label>
        <div class="col-sm-4 col-md-4">
          <input type="text" class="form-control"
           placeholder="请输入管理员名"
          th:field="*{aname}"/>
          <span th:errors="*{aname}"></span>
        </div>
      </div>
      <div class="form-group has-success">
          <label class="col-sm-2 col-md-2 control-label">密码</label>
          <div class="col-sm-4 col-md-4">
              <input type="password" class="form-control"
           placeholder="请输入您的密码" th:field="*{apwd}"/>
           <span th:errors="*{apwd}"></span>
          </div>
       </div>
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button type="submit"class="btn btn-success" >登录</button>
          <button type="reset" class="btn btn-primary" >重置</button>
        </div>
      </div>
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <font size="6" color="red">
            <span th:text="${errorMessage }"></span>
          </font>
        </div>
      </div>
    </form>
  </div>
</body>
</html>

类型管理界面如下 包括增删改查

添加类型页面代码如下

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>商品类型添加页面</title>
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" />
<body>
  <div th:include="admin/header"></div>
  <br><br><br>
  <div class="container">
    <div class="bg-primary"  style="width:70%; height: 60px;padding-top: 0.5px;">
         <h3 align="center">添加类型</h3>
     </div><br>
    <form th:action="@{/type/addType}" name="myform" method="post" th:object="${goodsType}"  class="form-horizontal" role="form" >
      <div class="form-group has-success">
        <label class="col-sm-2 col-md-2 control-label">类型名称</label>
        <div class="col-sm-4 col-md-4">
          <input type="text" class="form-control"
           placeholder="请输入类型名"
          th:field="*{typename}"/>
        </div>
      </div>
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button type="submit"class="btn btn-success" >添加</button>
          <button type="reset" class="btn btn-primary" >重置</button>
        </div>
      </div>
    </form>
  </div>
</body>
</html>

添加商品效果如下

代码如下

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>商品类型添加页面</title>
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" />
<body>
  <div th:include="admin/header"></div>
  <br><br><br>
  <div class="container">
    <div class="bg-primary"  style="width:70%; height: 60px;padding-top: 0.5px;">
         <h3 align="center">添加商品</h3>
     </div><br>
    <form th:action="@{/goods/addGoods?act=add}"
     name="myform" method="post" 
     th:object="${goods}"  
     class="form-horizontal" 
     enctype="multipart/form-data" >
      <div class="form-group has-success">
        <label class="col-sm-2 col-md-2 control-label">商品名称</label>
        <div class="col-sm-4 col-md-4">
          <input type="text" class="form-control"
           placeholder="请输入商品名"
          th:field="*{gname}"/>
        </div>
      </div>
      <div class="form-group has-success">
        <label class="col-sm-2 col-md-2 control-label">商品原价</label>
        <div class="col-sm-4 col-md-4">
          <input type="number" class="form-control"
           placeholder="请输入商品原价"
          th:field="*{goprice}"/>
        </div>
      </div>
      <div class="form-group has-success">
        <label class="col-sm-2 col-md-2 control-label">商品折扣价</label>
        <div class="col-sm-4 col-md-4">
          <input type="number" class="form-control"
           placeholder="请输入商品折扣价"
          th:field="*{grprice}"/>
        </div>
      </div>
      <div class="form-group has-success">
        <label class="col-sm-2 col-md-2 control-label">商品库存</label>
        <div class="col-sm-4 col-md-4">
          <input type="number" class="form-control"
           placeholder="请输入商品库存"
          th:field="*{gstore}"/>
        </div>
      </div>
      <div class="form-group has-success">
          <label class="col-sm-2 col-md-2 control-label">商品图片</label>
          <div class="col-sm-4 col-md-4">
              <input type="file" placeholder="请选择商品图片"  class="form-control" name="fileName"/>
          </div>
       </div>
      <div class="form-group has-success">
        <label class="col-sm-2 col-md-2 control-label">是否推荐</label>
        <div class="col-sm-4 col-md-4 radio">
          <label> 
            <input type="radio" th:field="*{isRecommend}" value="1">是
          </label>
          <label> 
            <input type="radio"  th:field="*{isRecommend}" value="0">否
          </label>
        </div>
      </div>
      <div class="form-group has-success">
        <label class="col-sm-2 col-md-2 control-label">是否广告</label>
        <div class="col-sm-4 col-md-4 radio">
          <label> 
            <input type="radio" th:field="*{isAdvertisement}" value="1">是
          </label>
          <label> 
            <input type="radio"    th:field="*{isAdvertisement}"s  value="0">否
          </label>
        </div>
      </div>
      <div class="form-group has-success">
        <label class="col-sm-2 col-md-2 control-label">商品类型</label>
        <div class="col-sm-4 col-md-4">
          <select class="form-control" th:field="*{goodstype_id}">
                        <option th:each="gty:${goodsType}" th:value="${gty.id}" th:text="${gty.typename}">
          </select>
        </div>
      </div>
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button type="submit"class="btn btn-success" >添加</button>
          <button type="reset" class="btn btn-primary" >重置</button>
        </div>
      </div>
    </form>
  </div>
</body>
</html>

其余的删除修改页面此处省略 有需要者点赞关注收藏后评论区留言或私信博主

六、前台商务子系统的实现

导航页效果如下 点击即可跳转到其他页面

代码如下

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>导航页</title>
<base th:href="@{/}"><!-- 不用base就使用th:src="@{/js/jquery.min.js} -->
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<style type="text/css">
     .carousel{
         height: 200px;
         background-color: #000;
      }
      .carousel .item{
         height: 200px;
         background-color: #000;
      }
      .carousel img{
         width: 100%;
      }
</style>
</head>
<body>
  <div class="container-fruid">
    <div class="navbar navbar-default navbar-fixed-top" role="navigation"
      style="padding-left: 30px;">
      <div class="navbar-header">
        <span class="navbar-brand">欢迎光临eBusiness</span>
      </div>
      <ul class="nav navbar-nav">
        <li><a th:href="@{user/toRegister}">注册</a></li>
        <li>
          <a th:href="(${session.bUser} == null)?'user/toLogin':'#'" >
            <span th:if="${session.bUser} == null" >
              登录
            </span>
            <span th:if="${session.bUser} != null" >
              欢迎<span th:text="${session.bUser.bemail}" ></span>
            </span>
          </a>
        </li>
        <li><a th:href="@{admin/toLogin}">后台</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right" style="padding-right: 30px;">
        <li><a href="cart/userInfo">个人信息</a></li>
        <li><a href="cart/selectCart">我的购物车</a></li>
        <li><a href="cart/myFocus">我的收藏</a></li>
        <li><a href="cart/myOder">我的订单</a></li>
        <li class="dropdown"><a href="##" data-toggle="dropdown"
          class="dropdown-toggle">关于我们<span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="##">联系我们</a></li>
            <li><a href="##">投诉建议</a></li>
          </ul>
        </li>
      </ul>
    </div>
    <!-- ************************************************** -->
    <div id="carousel-example-generic" class="carousel slide"
      data-ride="carousel" style="margin-top: 20px;">
      <!-- Indicators 小圆圈-->
      <ol class="carousel-indicators">
        <li data-target="#carousel-example-generic" 
        th:each="advertise,adstat:${advertisementGoods}" 
        th:data-slide-to="${adstat.index}"
        th:class="(${adstat.index}==0)? 'active' : ''"></li>
      </ol>
      <!-- 滚动广告图片 -->
      <div class="carousel-inner" role="listbox">
        <div th:each="advertise,adstat:${advertisementGoods}" th:class="(${adstat.index}==0)? 'item active' : 'item'">
          <img th:src="'images/' + ${advertise.gpicture}" th:alt="${adstat.index + 1}">
          <div class="carousel-caption"><span th:text="${advertise.gname}"></span></div>
        </div>
      </div>
      <!-- Controls -->
      <a class="left carousel-control" href="#carousel-example-generic"
        role="button" data-slide="prev"> <span
        class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
      </a> <a class="right carousel-control" href="#carousel-example-generic"
        role="button" data-slide="next"> <span
        class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
      </a>
    </div>
    <!-- *************************************** -->
    <div class="navbar navbar-default " role="navigation">
      <ul class="nav navbar-nav" style="padding-left: 50px;">
        <li><a th:href="@{/}">首页</a></li>
        <li th:each="gty:${goodsType}"><a th:href="'?tid=' + ${gty.id}"><span th:text="${gty.typename}"></span></a></li>
      </ul>
      <form action="search" class="navbar-form navbar-right"
        style="padding-right: 50px;">
        <div class="form-group">
          <input type="text" class="form-control" name="mykey" placeholder="请输入关键词" />
        </div>
        <button type="submit" class="btn btn-default">搜索</button>
      </form>
    </div>
  </div>
</body>
</html>

商品详情页面如下

代码如下

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="@{/}"><!-- 不用base就使用th:src="@{/js/jquery.min.js} -->
<meta charset="UTF-8">
<title>商品页面</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script src="js/jquery.min.js"></script>
<script type="text/javascript" th:inline="javascript">
  function focus(){
      $.ajax(
        {
          //请求路径,要注意的是url和th:inline="javascript"
          url : [[@{/cart/focus}]],
          //请求类型
          type : "post",
          contentType : "application/json",
          //data表示发送的数据
          data : JSON.stringify({
            id : $("#gid").val()
          }),
          //成功响应的结果
          success : function(obj){//obj响应数据
            if(obj == "no"){
              alert("您已收藏该商品!");
            }else if(obj == "ok"){
              alert("成功收藏该商品");
            }else{
              alert("您没有登录,请登录!");
            }
          },
              error : function() {
                  alert("处理异常!");
              }
        } 
      );
  }
  function putCart(){
    if(!(/(^[1-9]\d*$)/.test($("#buyNumber").val()))){
      alert("购买量请输入正整数!");
      $("#buyNumber").focus();
      return;
    }
    if(parseInt($("#buyNumber").val()) > parseInt($("#gstore").text())){
      alert("购买量超出库存!");
      $("#buyNumber").focus();
      return;
    }
    //获取路径
    var pathName=window.document.location.pathname;
    //截取,得到项目名称
    var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
    window.location.href = projectName + "/cart/putCart?id=" +  $("#gid").val() + "&buyNumber=" + $("#buyNumber").val();
  }
</script>
</head>
<body>
  <!-- 加载header.html -->
  <div th:include="user/header"></div>
  <div class="container">
    <div class="row">
      <div class="col-xs-6 col-md-3">
        <img
          th:src="'images/' + ${goods.gpicture}"
          style="height: 220px; width: 280px; display: block;">
      </div>
      <div class="col-xs-6 col-md-3">
        <p>商品名:<span th:text="${goods.gname}"></span></p>
        <p>
          商品折扣价:<span style="color: red;">&yen;
            <span th:text="${goods.grprice}"></span>
          </span>
        </p>
        <p>
          商品原价:
          <span class="text-dark" style="text-decoration: line-through;"> &yen;
            <span th:text="${goods.goprice}"></span>
          </span>
        </p>
        <p>
          商品类型:<span th:text="${goods.typename}"></span>
        </p>
        <p>
          库存:<span id="gstore"  th:text="${goods.gstore}"></span>
        </p>
        <p>
          <input type="text" size="12" class="form-control" placeholder="请输入购买量" id="buyNumber" name="buyNumber"/>
          <input type="hidden" name="gid" id="gid" th:value="${goods.id}"/>
        </p>
        <p>
          <a href="javascript:focus()" class="btn btn-primary"
            style="font-size: 10px;">加入收藏</a>
          <a href="javascript:putCart()" class="btn btn-success"
            style="font-size: 10px;">加入购物车</a>
        </p>
      </div>
    </div>
  </div>
</body>
</html>

测试效果如下

如果账号密码不对则弹出错误窗口

 

 

还有用户注册 登录页面 购物车 下单页面 个人信息 我的收藏页面等等此处省略

需要源码请点赞关注收藏后评论区留言或 私信博主即可

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。 &nbsp; 相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/mysql&nbsp;
相关文章
|
6月前
|
SQL Java 数据库连接
Java中实现SQL分页的方法
无论何种情况,选择适合自己的,理解了背后的工作原理,并能根据实际需求灵活变通的方式才是最重要的。
189 9
|
6月前
|
负载均衡 算法 关系型数据库
大数据大厂之MySQL数据库课程设计:揭秘MySQL集群架构负载均衡核心算法:从理论到Java代码实战,让你的数据库性能飙升!
本文聚焦 MySQL 集群架构中的负载均衡算法,阐述其重要性。详细介绍轮询、加权轮询、最少连接、加权最少连接、随机、源地址哈希等常用算法,分析各自优缺点及适用场景。并提供 Java 语言代码实现示例,助力直观理解。文章结构清晰,语言通俗易懂,对理解和应用负载均衡算法具有实用价值和参考价值。
大数据大厂之MySQL数据库课程设计:揭秘MySQL集群架构负载均衡核心算法:从理论到Java代码实战,让你的数据库性能飙升!
|
10月前
|
SQL NoSQL Java
Java使用sql查询mongodb
通过MongoDB Atlas Data Lake或Apache Drill,可以在Java中使用SQL语法查询MongoDB数据。这两种方法都需要适当的配置和依赖库的支持。希望本文提供的示例和说明能够帮助开发者实现这一目标。
412 17
|
10月前
|
SQL Java 数据库连接
【潜意识Java】MyBatis中的动态SQL灵活、高效的数据库查询以及深度总结
本文详细介绍了MyBatis中的动态SQL功能,涵盖其背景、应用场景及实现方式。
1093 6
|
10月前
|
SQL Java 数据库连接
如何用 Java 校验 SQL 语句的合法性?
本文介绍了五种校验 SQL 语句合法性的方案:1) 使用 JDBC API 的 `execute()` 方法,通过捕获异常判断合法性;2) 使用 JSqlParser 库解析 SQL 语句为 Java 对象;3) 使用正则表达式检查 SQL 语句格式;4) 使用 ANTLR 生成 SQL 解析器;5) 使用 Apache Calcite 解析 SQL。每种方法各有优劣,具体选择取决于需求和个人偏好。需要注意的是,这些方法仅能校验语法合法性,无法保证语义正确性,仍需防范 SQL 注入攻击。
434 6
|
10月前
|
SQL Java 数据库连接
如何在 Java 代码中使用 JSqlParser 解析复杂的 SQL 语句?
大家好,我是 V 哥。JSqlParser 是一个用于解析 SQL 语句的 Java 库,可将 SQL 解析为 Java 对象树,支持多种 SQL 类型(如 `SELECT`、`INSERT` 等)。它适用于 SQL 分析、修改、生成和验证等场景。通过 Maven 或 Gradle 安装后,可以方便地在 Java 代码中使用。
3282 11
|
10月前
|
SQL 存储 关系型数据库
MySQL秘籍之索引与查询优化实战指南
最左前缀原则。不冗余原则。最大选择性原则。所谓前缀索引,说白了就是对文本的前几个字符建立索引(具体是几个字符在建立索引时去指定),比如以产品名称的前 10 位来建索引,这样建立起来的索引更小,查询效率更快!
362 22
 MySQL秘籍之索引与查询优化实战指南
|
11月前
|
SQL NoSQL Java
Java使用sql查询mongodb
通过使用 MongoDB Connector for BI 和 JDBC,开发者可以在 Java 中使用 SQL 语法查询 MongoDB 数据库。这种方法对于熟悉 SQL 的团队非常有帮助,能够快速实现对 MongoDB 数据的操作。同时,也需要注意到这种方法的性能和功能限制,根据具体应用场景进行选择和优化。
435 9
|
SQL Java 数据库连接
JAVA插入sql代码
插入数据 import java.sql.*; /** * @version 2012-02-22 * @author */ public class InsertDemo { public static void main(String[] args) thr...
918 0
|
1月前
|
JSON 网络协议 安全
【Java】(10)进程与线程的关系、Tread类;讲解基本线程安全、网络编程内容;JSON序列化与反序列化
几乎所有的操作系统都支持进程的概念,进程是处于运行过程中的程序,并且具有一定的独立功能,进程是系统进行资源分配和调度的一个独立单位一般而言,进程包含如下三个特征。独立性动态性并发性。
142 1

推荐镜像

更多
下一篇
oss云网关配置