SpringBoot-----从前端更新数据到MySql数据库
目录
(一)连接MySql
(二)创建实体模型
(三)创建Repository接口
(四)创建Controller类
(五)运行AccessingDataMysqlApplication
(六)HTML页面设置
参考SpringBoot官网教程:
1.Validating Form Input
2.Handling Form Submission
3.Accessing data with MySQL
(一)连接MySql
在pom.xml中引入以下依赖:
---------连接数据库----------
<dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.12</version>
</dependency>-------用于启用JPA和Hibernate,实现数据的持久化-------<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId></dependency>-----------启用web应用程序----------<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>--------用于构建交互的WEB应用程序-------<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>-------启用校验功能----------<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-validation</artifactId><version>3.1.5</version></dependency>
在application.properties中添加如下代码,连接数据库
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/db_example?useSSL=false&serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=123456ab
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.jpa.show-sql: true
# spring.thymeleaf.cache=false
# spring.thymeleaf.prefix=classpath:/templates/
# spring.thymeleaf.suffix=.html
也可以添加application.yml:
application.yml 的功能和 application.properties 是一样的,不过因为yml文件是树状结构,写起来有更好的层次感,更易于理解,所以很多人都选择了yml文件。
spring:datasource:driver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=falseusername: rootpassword: 123456ab
(二)创建实体模型
@Entity注解用于将一个类标识为 JPA 实体,它告诉 Hibernate 或其他 JPA 实现框架将这个类映射为数据库中的表
注:想深入学习校验方法及注释的小伙伴可以看看这个:
如何在 Spring/Spring Boot 中优雅地做参数校验?-腾讯云开发者社区-腾讯云 (tencent.com)
package com.example.accessingdatamysql;import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.SequenceGenerator;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;@Entity // This tells Hibernate to make a table out of this class
public class User {@Id
//指定序列生成器,序列生成器的名称为"user_seq"@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_seq")
//每次增长值为1@SequenceGenerator(name = "user_seq", sequenceName = "user_seq", allocationSize = 1)private Integer id;@NotNull(message = "姓名不能为空")@Size(min = 2, max = 30, message = "姓名长度必须在2-30之间")private String name;@Email@NotEmpty(message = "邮箱不能为空")private String email;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getEmail() {return email;}public void setEmail(String email) {this.email = email;}public String toString() {return "User(id:" + this.id + ",name:" + this.name + ",email:" + this.email + ")";}
}
(三)创建Repository接口
Repository接口,用于定义数据访问的方法
package com.example.accessingdatamysql;import org.springframework.data.repository.CrudRepository;// import com.example.accessingdatamysql.User;// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
// CRUD refers Create, Read, Update, Delete//使用Iterable,可以根据条件来查询匹配的用户,并获取到一个包含所有符合条件的迭代的用户列表。
public interface UserRepository extends CrudRepository<User, Integer> {//根据姓名查询用户Iterable<User> findByName(String name);//根据邮箱查询用户Iterable<User> findByEmail(String email);//根据邮箱和姓名查询用户Iterable<User> findByNameAndEmail(String email,String name);}
(四)创建Controller类
Controller类通常用于Web应用程序,它接收用户的HTTP请求,调用业务逻辑处理请求,并返回一个包含响应数据的视图。
package com.example.accessingdatamysql;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;import jakarta.validation.Valid;@Controller
@Validated
public class WebController implements WebMvcConfigurer {@Autowiredprivate UserRepository userRepository;@Overridepublic void addViewControllers(ViewControllerRegistry registry) {registry.addViewController("/results").setViewName("results");}@GetMapping("/form")public String showForm(Model model) {model.addAttribute("user", new User());return "form";}@PostMapping("/")public String submintForm(@Valid @ModelAttribute("user") User user, BindingResult bindingResult) {if (bindingResult.hasErrors()) {return "form";}userRepository.save(user);return "redirect:/list";}@GetMapping("/list")public String showList(Model model) {model.addAttribute("userList", userRepository.findAll());return "list";}@GetMapping(path = "/deleteAll")public String deleteAllUsers(Model model) {userRepository.deleteAll();Iterable<User> userList = userRepository.findAll();model.addAttribute("userList", userList);return "redirect:/list";}@GetMapping(path = "/delete/{id}")public String deleteUser(@PathVariable("id") Integer id, Model model) {userRepository.deleteById(id);Iterable<User> userList = userRepository.findAll();model.addAttribute("userList", userList);return "redirect:/list"; // 返回list.html模板}@GetMapping(path = "/edit/{id}")public String updateUser(@PathVariable("id") Integer id, Model model) {User user = userRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Invalid user ID"));model.addAttribute("user", user);return "edit";}@PostMapping(path = "/update")public String update(@Valid User user, Model model) {userRepository.save(user);Iterable<User> userList = userRepository.findAll();model.addAttribute("userList", userList);return "list";}@GetMapping("/find")public String findUserByNameAndEmail(@RequestParam("name") String name,@RequestParam("email") String email, Model model) {Iterable<User> userlist;if (!name.isEmpty() && !email.isEmpty()) {// 根据姓名和邮箱查询用户userlist = userRepository.findByNameAndEmail(name, email);} else if (!name.isEmpty()) {// 根据姓名查询用户userlist = userRepository.findByName(name);} else if (!email.isEmpty()) {// 根据邮箱查询用户userlist = userRepository.findByEmail(email);} else {// 返回所有用户userlist = userRepository.findAll();}model.addAttribute("userlist", userlist);return "check";}
}
这里的注释
@Valid:用于验证注释是否符合要求,例如
这里就是检验密码是否为空
@RestController
@RequestMapping("/user")
public class UserController {@PostMappingpublic User create (@Valid @RequestBody User user) {System.out.println(user.getId());System.out.println(user.getUsername());System.out.println(user.getPassword());user.setId("1");return user;}
} public class User {private String id; @NotBlank(message = "密码不能为空")private String password;
}
@RequestParam:将请求参数绑定到你控制器的方法参数上(是springmvc中接收普通参数的注解)
//url参数中的name必须要和@RequestParam("name")一致@RequestMapping("show16")public ModelAndView test16(@RequestParam("name")String name){ModelAndView mv = new ModelAndView();mv.setViewName("hello");mv.addObject("msg", "接收普通的请求参数:" + name);return mv;}
得到结果
url:localhost:8080/hello/show16?name=cc
页面:
接收普通的请求参数:cc
(五)运行AccessingDataMysqlApplication
package com.example.accessingdatamysql;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class AccessingDataMysqlApplication {public static void main(String[] args) {SpringApplication.run(AccessingDataMysqlApplication.class, args);}
}
(六)HTML页面设置
check.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"><head><meta charset="UTF-8"><title>Check User List</title><style>body {display: flex;align-items: stretch;height: 100vh;background-color: #f2f2f2;justify-content: space-between;flex-wrap: wrap;flex-direction: column;align-content: center;}table {width: 600px;margin-top: 20px;border-collapse: collapse;background-color: #fff;box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);}table th,table td {padding: 10px;text-align: center;border: 1px solid #ccc;}table th {background-color: #f2f2f2;}a {display: block;text-align: center;margin-top: 20px;text-decoration: none;color: #4CAF50;font-weight: bold;}a:hover {color: #45a049;}.btn-edit,.btn-delete {display: inline-block;padding: 5px 10px;border: none;background-color: #4CAF50;color: white;text-decoration: none;cursor: pointer;}.btn-edit:hover,.btn-delete:hover {background-color: #45a049;}</style>
</head><body><h1 style="text-align: center; margin-bottom: 20px;">Check User List</h1><form th:action="@{/find}" method="get" style="text-align: center;"><input type="text" name="name" placeholder="姓名"><input type="text" name="email" placeholder="邮箱"><button type="submit">查询</button></form><table><tr><th>Name</th><th>Email</th><th>操作</th></tr><tr th:each="user : ${userlist}"><td th:text="${user.name}"></td><td th:text="${user.email}"></td><td><a th:href="@{'/edit/' + ${user.id}}" class="btn-edit">编辑</a><a th:href="@{'/delete/' + ${user.id}}" class="btn-delete">删除</a></td></tr></table><a href="/form" style="text-align: center; margin-top: 20px; display: block;">添加新信息</a>
</body></html>
edit.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"><head><meta charset="UTF-8"><title>Edit User</title><style>body {display: flex;align-items: center;height: 100vh;background-color: #f2f2f2;flex-direction: column;flex-wrap: wrap;align-content: center;justify-content: center;}form {width: 400px;padding: 20px;background-color: #fff;box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);text-align: center;}label {display: block;margin-bottom: 10px;font-weight: bold;}input {width: 100%;padding: 8px;margin-bottom: 20px;border: 1px solid #ccc;border-radius: 4px;box-sizing: border-box;}button {padding: 10px 20px;border: none;background-color: #4CAF50;color: white;text-decoration: none;cursor: pointer;}button:hover {background-color: #45a049;}a {display: block;margin-top: 20px;text-align: center;text-decoration: none;color: #4CAF50;font-weight: bold;}a:hover {color: #45a049;}</style>
</head><body><h1>编辑信息</h1><form th:action="@{/update}" method="post"><input type="hidden" th:name="id" th:value="${id}" /><label for="name">Name:</label><input type="text" id="name" name="name" th:value="${name}" /><label for="email">Email:</label><input type="email" id="email" name="email" th:value="${email}" /><button type="submit">保存</button></form><a href="/list">返回列表</a>
</body></html>
form.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"><head><meta charset="UTF-8"><title>Form</title><style>body {display: flex;justify-content: center;align-items: center;height: 100vh;background-color: #f2f2f2;}.form-container {width: 400px;padding: 20px;background-color: #fff;border-radius: 5px;box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);}.form-container h1 {text-align: center;margin-bottom: 20px;}.form-container label {display: block;margin-bottom: 10px;}.form-container input[type="text"],.form-container input[type="email"] {width: 100%;padding: 10px;border: 1px solid #ccc;border-radius: 5px;}.form-container button[type="submit"] {display: block;width: 100%;padding: 10px;margin-top: 20px;background-color: #4CAF50;color: #fff;border: none;border-radius: 5px;cursor: pointer;}.form-container button[type="submit"]:hover {background-color: #45a049;}.form-container button[type="reset"] {display: block;width: 100%;padding: 10px;margin-top: 20px;background-color: #4CAF50;color: #fff;border: none;border-radius: 5px;cursor: pointer;}.form-container button[type="reset"]:hover {background-color: #45a049;}.form-container button[type="delete"] {display: block;width: 100%;padding: 10px;margin-top: 20px;background-color: #4CAF50;color: #fff;border: none;border-radius: 5px;cursor: pointer;}.form-container button[type="delete"]:hover {background-color: #45a049;}.form-container span {color: red;font-size: 12px;margin-top: 5px;}</style>
</head><body><div class="form-container"><h1>表格</h1><form action="#" th:action="@{/}" th:object="${user}" method="post"><div><label for="name">Name:</label><input type="text" id="name" th:field="*{name}" required><span th:if="${#fields.hasErrors('name')}" th:errors="*{name}">Name Error</span></div><div><label for="email">Email:</label><input type="text" id="email" th:field="*{email}" required><span th:if="${#fields.hasErrors('email')}" th:errors="*{email}">Email Error</span></div><div><button type="submit">Submit</button><button type="reset">Reset</button><button type="delete">Delete</button></div></form></div>
</body></html>
list.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"><head><meta charset="UTF-8"><title>List</title><style>body {display: flex;align-items: stretch;height: 100vh;background-color: #f2f2f2;justify-content: space-between;flex-wrap: wrap;flex-direction: column;align-content: center;}table {width: 600px;margin-top: 20px;border-collapse: collapse;background-color: #fff;box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);}table th,table td {padding: 10px;text-align: center;border: 1px solid #ccc;}table th {background-color: #f2f2f2;}a {display: block;text-align: center;margin-top: 20px;text-decoration: none;color: #4CAF50;font-weight: bold;}a:hover {color: #45a049;}.btn-edit,.btn-delete {display: inline-block;padding: 5px 10px;border: none;background-color: #4CAF50;color: white;text-decoration: none;cursor: pointer;}.btn-edit:hover,.btn-delete:hover {background-color: #45a049;}.btn-delete-all {display: block;text-align: center;margin-top: 20px;text-decoration: none;color: #f44336;font-weight: bold;}.btn-delete-all:hover {color: #d32f2f;}</style>
</head><body><h1 style="text-align: center; margin-bottom: 20px;">信息系统</h1><form th:action="@{/find}" method="get" style="text-align: center;"><input type="text" name="name" placeholder="姓名"><input type="text" name="email" placeholder="邮箱"><button type="submit">查询</button></form><table><tr><th>Name</th><th>Email</th><th>操作</th></tr><tr th:each="user : ${userList}"><td th:text="${user.name}"></td><td th:text="${user.email}"></td><td><a th:href="@{'/edit/' + ${user.id}}" class="btn-edit">编辑</a><a th:href="@{'/delete/' + ${user.id}}" class="btn-delete">删除</a></td></tr></table><a href="/form" style="text-align: center; margin-top: 20px; display: block;">添加新信息</a><a href="/deleteAll" class="btn-delete-all">删除全部用户信息</a>
</body></html>
这里的页面可以通过设置css样式表等方式进行改进
结果:可以通过前端创建用户,并加入到mysql数据库中
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
相关文章
- C语言比较运算符
常用比较运算符 常用的比较运算符有: ! < > < > 运算符术语示例表示结果相等于2 10!不等于2 ! 11<小于2 < 10>大于2 > 11<小等于2 < 10>大于等于2 > 11 比较运算符注意事项 C语言的比较运算中,真用数字 1 表示…...
2024/4/24 19:30:39 - adb shell settings高级指令设置系统属性所有的指令汇总+注释
adb shell settings高级指令设置系统属性所有的指令汇总 目录 系统设置(system) 安全设置(secure) 全局设置(global) 删除设置 帮助 示例应用 屏幕超时时间 自动旋转屏幕 通知光 触觉反馈 动…...
2024/4/25 18:49:41 - Springboot集成JDBC
1,pom.xml配置jar包 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> 2,配置数据源信息 server:port: 8088spring:datasource:dr…...
2024/4/25 18:49:41 - 【科技素养】蓝桥杯STEMA 科技素养组模拟练习试卷B
1、以下选项中,( )不属于生物的是 A 玫瑰花 B 河流 C 蜜蜂 D 人 答案:B 2、以下选项中,( )描述的是一种物理变化 A 鸡蛋煮熟 B 食物发霉 C 将水烧开 D 火柴燃烧 答案:C 3、…...
2024/4/27 16:02:42 - 经典ctf ping题目详解 青少年CTF-WEB-PingMe02
题目环境: 根据题目名称可知 这是一道CTF-WEB方向常考的知识点:ping地址 随便ping一个地址查看接受的数据包?ip0.0.0.0 有回显数据,尝试列出目录文件 堆叠命令使用’;作为命令之间的连接符,当上一个命令完成后,继续执…...
2024/4/27 16:02:41 - gittee启动器
前言 很多小伙伴反馈不是使用gitee,不会寻找好的项目,在拿到一个项目不知道从哪里入手。 鼠鼠我呀就是宠粉,中嘞,老乡。整!!! git的基本指令 在使用gitee的时候呢,我们只需要记住…...
2024/4/27 16:02:33 - 001 opencv addWeighted
目录 一、环境 二、addWeighted函数 三、代码演示 一、环境 本文使用环境为: Windows10Python 3.9.17opencv-python 4.8.0.74 二、addWeighted函数 OpenCV中的cv.addWeighted函数是一个用于图像叠加的函数,它可以将两个具有相同尺寸和类型的图像按…...
2024/4/27 16:02:30 - AcWing 4520:质数 ← BFS
【题目来源】https://www.acwing.com/problem/content/4523/【题目描述】 给定一个正整数 X,请你在 X 后面添加若干位数字(至少添加一位数字;添加的数不能有前导0),使得结果为质数,在这个前提下所得的结果应…...
2024/4/27 16:02:25 - 信息检索与数据挖掘 | 【实验】检索评价指标MAP、MRR、NDCG
文章目录 📚实验内容📚知识梳理📚实验步骤🐇前情提要🐇MAP评价指标函数🐇MRR 评价指标函数🐇NDCG评价指标函数🐇调试结果 📚实验内容 实现以下指标评价,并对…...
2024/4/27 16:02:22 - WPF实现右键菜单
在WPF中,创建上下文菜单(通常称为“右键菜单”)是通过使用ContextMenu控件来实现的。你可以在XAML中声明上下文菜单,并将其关联到任何FrameworkElement。以下是如何在WPF中实现上下文菜单的基本步骤: 1. 在XAML中定义…...
2024/4/27 16:02:18 - 沉浸式航天vr科普馆VR太空主题馆展示
科普教育从小做起,现在我们的很多地方小孩子游乐体验不单单只有草坪玩耍体验,还有很多科普知识的体验馆和游玩馆。虽然现在我们还不能真实的上太空或者潜入海底,但是这些现在已经可以逼真的展示在我们面前。通过一种虚拟现实技术手段。人们带…...
2024/4/30 5:06:16 - 自动驾驶汽车:人工智能最具挑战性的任务
据说,自动驾驶汽车是汽车行业梦寐以求的状态,将彻底改变交通运输业。就在几年前,对自动驾驶汽车的炒作风靡一时,那么到底发生了什么呢?这么多公司吹嘘到2021年我们将迎来的无人驾驶汽车革命在何处?事实证明…...
2024/4/27 16:02:10 - 【LeetCode:2736. 最大和查询 | 贪心 + 二分 + 单调栈】
🚀 算法题 🚀 🌲 算法刷题专栏 | 面试必备算法 | 面试高频算法 🍀 🌲 越难的东西,越要努力坚持,因为它具有很高的价值,算法就是这样✨ 🌲 作者简介:硕风和炜,…...
2024/4/27 16:02:07 - React升级到18版本
前言 升级前react版本是16.9.0,react-dom版本为16.9.0,react-router-dom为5.1.2版本。 安装 // npm npm install react react-dom// yarn yarn add react react-dom// pnpm pnpm install react react-dom启动项目 此时,项目可以正常运行&…...
2024/4/27 16:02:02 - idea显示pom.xml文件漂黄警告 Dependency maven:xxx:xxx is vulnerable
场景: idea警告某些maven依赖包有漏洞或者依赖传递有易受攻击包,如下: 解决: 1、打开idea设置,找到 File | Settings | Editor | Inspections 2、取消上述两项勾选即可...
2024/4/27 16:01:58 - sql server 多行数据合并一行显示
在 SQL Server 中,可以使用 STUFF 和 FOR XML PATH 进行多行合并成一行。例如,假设有一个表名为 orders ,其中包含订单号和产品名称: order_idproduct_name1Product A1Product B2Product C2Product D 以下查询将在 order_id 列上…...
2024/4/27 16:01:54 - git 简单入门
git init touch test.txt git add test.txt git commit -m 初始化 仓库 git log //查找日志 git checkout -b dev //创建并切换dev分支 git branch // 查找分支 此时有master 和 dev分支, 此时在dev分支 dev分支也有test.txt文件 vim test.txt //写入dev …...
2024/4/27 16:01:50 - 使用Jupyter Notebook调试PySpark程序错误总结
项目场景: 在Ubuntu16.04 hadoop2.6.0 spark2.3.1环境下 简单调试一个PySpark程序,中间遇到的错误总结(发现版对应和基础配置很重要) 注意:在前提安装配置好 hadoop hive anaconda jupyternotebook spark zo…...
2024/4/27 16:01:46 - Jenkins 构建报错 Could not load
Could not load /src/layout/index.vue (imported by src/router/index.ts): ENOENT: no such file or directory, open /src/layout/index.vue在Windows和mac电脑上本地打包都可以,但是放到Jenkins上,就会找不到文件。 经过排查Linux是严格区分大小写的…...
2024/4/27 16:01:41 - C++中sort()函数的greater<int>()参数
目录 1 基础知识2 模板3 工程化 1 基础知识 sort()函数中的greater<int>()参数表示将容器内的元素降序排列。不填此参数,默认表示升序排列。 vector<int> a {1,2,3}; sort(a.begin(), a.end(), greater<int>()); //将a降序排列 sort(a.begin()…...
2024/4/25 18:49:51
最新文章
- Windows 系统中常用的命令提示符(CMD)命令
一、文件和目录操作: dir:列出当前目录中的文件和子目录。 cd 目录路径:更改当前目录。 mkdir 目录名:创建新目录。 del 文件名:删除文件。 rmdir 目录名:删除目录。 Mstsc 打开远程连接命令 二、系统信…...
2024/5/2 16:39:40 - 梯度消失和梯度爆炸的一些处理方法
在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言,在此感激不尽。 权重和梯度的更新公式如下: w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...
2024/3/20 10:50:27 - 小核引导RTOS
参考 参考1. How does FSBL load the FreeRTOS on the small core and execute it?参考2. Duo now supports big and little cores?Come and play!Milk-V Duo, start! 日志 FSBL Jb2829:g362832ac6-dirty:2024-04-02T13:31:1100:00 # 版本信息 st_on_reason…...
2024/5/1 4:39:19 - C#简单——多选框控件相关的神奇问题
他们真的很简单,但我怎么总是忘记啊QAQ 还是记下来吧,下次直接copy 点开后出现 有列名 列名有数据,有表 表里有数据但不显示的情况 解决:点击小三角-点击Design View-Columns-需要在这里对下拉列表里的内容进行对应配置。 多选框…...
2024/4/30 14:37:46 - 416. 分割等和子集问题(动态规划)
题目 题解 class Solution:def canPartition(self, nums: List[int]) -> bool:# badcaseif not nums:return True# 不能被2整除if sum(nums) % 2 ! 0:return False# 状态定义:dp[i][j]表示当背包容量为j,用前i个物品是否正好可以将背包填满ÿ…...
2024/5/2 11:19:01 - 【Java】ExcelWriter自适应宽度工具类(支持中文)
工具类 import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet;/*** Excel工具类** author xiaoming* date 2023/11/17 10:40*/ public class ExcelUti…...
2024/5/2 16:04:58 - Spring cloud负载均衡@LoadBalanced LoadBalancerClient
LoadBalance vs Ribbon 由于Spring cloud2020之后移除了Ribbon,直接使用Spring Cloud LoadBalancer作为客户端负载均衡组件,我们讨论Spring负载均衡以Spring Cloud2020之后版本为主,学习Spring Cloud LoadBalance,暂不讨论Ribbon…...
2024/5/1 21:18:12 - TSINGSEE青犀AI智能分析+视频监控工业园区周界安全防范方案
一、背景需求分析 在工业产业园、化工园或生产制造园区中,周界防范意义重大,对园区的安全起到重要的作用。常规的安防方式是采用人员巡查,人力投入成本大而且效率低。周界一旦被破坏或入侵,会影响园区人员和资产安全,…...
2024/5/2 9:47:31 - VB.net WebBrowser网页元素抓取分析方法
在用WebBrowser编程实现网页操作自动化时,常要分析网页Html,例如网页在加载数据时,常会显示“系统处理中,请稍候..”,我们需要在数据加载完成后才能继续下一步操作,如何抓取这个信息的网页html元素变化&…...
2024/5/2 9:47:31 - 【Objective-C】Objective-C汇总
方法定义 参考:https://www.yiibai.com/objective_c/objective_c_functions.html Objective-C编程语言中方法定义的一般形式如下 - (return_type) method_name:( argumentType1 )argumentName1 joiningArgument2:( argumentType2 )argumentName2 ... joiningArgu…...
2024/5/2 6:03:07 - 【洛谷算法题】P5713-洛谷团队系统【入门2分支结构】
👨💻博客主页:花无缺 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 本文由 花无缺 原创 收录于专栏 【洛谷算法题】 文章目录 【洛谷算法题】P5713-洛谷团队系统【入门2分支结构】🌏题目描述🌏输入格…...
2024/5/2 9:47:30 - 【ES6.0】- 扩展运算符(...)
【ES6.0】- 扩展运算符... 文章目录 【ES6.0】- 扩展运算符...一、概述二、拷贝数组对象三、合并操作四、参数传递五、数组去重六、字符串转字符数组七、NodeList转数组八、解构变量九、打印日志十、总结 一、概述 **扩展运算符(...)**允许一个表达式在期望多个参数࿰…...
2024/5/1 11:24:00 - 摩根看好的前智能硬件头部品牌双11交易数据极度异常!——是模式创新还是饮鸩止渴?
文 | 螳螂观察 作者 | 李燃 双11狂欢已落下帷幕,各大品牌纷纷晒出优异的成绩单,摩根士丹利投资的智能硬件头部品牌凯迪仕也不例外。然而有爆料称,在自媒体平台发布霸榜各大榜单喜讯的凯迪仕智能锁,多个平台数据都表现出极度异常…...
2024/5/2 5:31:39 - Go语言常用命令详解(二)
文章目录 前言常用命令go bug示例参数说明 go doc示例参数说明 go env示例 go fix示例 go fmt示例 go generate示例 总结写在最后 前言 接着上一篇继续介绍Go语言的常用命令 常用命令 以下是一些常用的Go命令,这些命令可以帮助您在Go开发中进行编译、测试、运行和…...
2024/5/1 20:22:59 - 用欧拉路径判断图同构推出reverse合法性:1116T4
http://cplusoj.com/d/senior/p/SS231116D 假设我们要把 a a a 变成 b b b,我们在 a i a_i ai 和 a i 1 a_{i1} ai1 之间连边, b b b 同理,则 a a a 能变成 b b b 的充要条件是两图 A , B A,B A,B 同构。 必要性显然࿰…...
2024/5/2 9:47:28 - 【NGINX--1】基础知识
1、在 Debian/Ubuntu 上安装 NGINX 在 Debian 或 Ubuntu 机器上安装 NGINX 开源版。 更新已配置源的软件包信息,并安装一些有助于配置官方 NGINX 软件包仓库的软件包: apt-get update apt install -y curl gnupg2 ca-certificates lsb-release debian-…...
2024/5/2 9:47:27 - Hive默认分割符、存储格式与数据压缩
目录 1、Hive默认分割符2、Hive存储格式3、Hive数据压缩 1、Hive默认分割符 Hive创建表时指定的行受限(ROW FORMAT)配置标准HQL为: ... ROW FORMAT DELIMITED FIELDS TERMINATED BY \u0001 COLLECTION ITEMS TERMINATED BY , MAP KEYS TERMI…...
2024/5/2 0:07:22 - 【论文阅读】MAG:一种用于航天器遥测数据中有效异常检测的新方法
文章目录 摘要1 引言2 问题描述3 拟议框架4 所提出方法的细节A.数据预处理B.变量相关分析C.MAG模型D.异常分数 5 实验A.数据集和性能指标B.实验设置与平台C.结果和比较 6 结论 摘要 异常检测是保证航天器稳定性的关键。在航天器运行过程中,传感器和控制器产生大量周…...
2024/5/2 8:37:00 - --max-old-space-size=8192报错
vue项目运行时,如果经常运行慢,崩溃停止服务,报如下错误 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 因为在 Node 中,通过JavaScript使用内存时只能使用部分内存(64位系统&…...
2024/5/2 9:47:26 - 基于深度学习的恶意软件检测
恶意软件是指恶意软件犯罪者用来感染个人计算机或整个组织的网络的软件。 它利用目标系统漏洞,例如可以被劫持的合法软件(例如浏览器或 Web 应用程序插件)中的错误。 恶意软件渗透可能会造成灾难性的后果,包括数据被盗、勒索或网…...
2024/5/2 9:47:25 - JS原型对象prototype
让我简单的为大家介绍一下原型对象prototype吧! 使用原型实现方法共享 1.构造函数通过原型分配的函数是所有对象所 共享的。 2.JavaScript 规定,每一个构造函数都有一个 prototype 属性,指向另一个对象,所以我们也称为原型对象…...
2024/5/1 14:33:22 - C++中只能有一个实例的单例类
C中只能有一个实例的单例类 前面讨论的 President 类很不错,但存在一个缺陷:无法禁止通过实例化多个对象来创建多名总统: President One, Two, Three; 由于复制构造函数是私有的,其中每个对象都是不可复制的,但您的目…...
2024/5/1 11:51:23 - python django 小程序图书借阅源码
开发工具: PyCharm,mysql5.7,微信开发者工具 技术说明: python django html 小程序 功能介绍: 用户端: 登录注册(含授权登录) 首页显示搜索图书,轮播图࿰…...
2024/5/2 7:30:11 - 电子学会C/C++编程等级考试2022年03月(一级)真题解析
C/C++等级考试(1~8级)全部真题・点这里 第1题:双精度浮点数的输入输出 输入一个双精度浮点数,保留8位小数,输出这个浮点数。 时间限制:1000 内存限制:65536输入 只有一行,一个双精度浮点数。输出 一行,保留8位小数的浮点数。样例输入 3.1415926535798932样例输出 3.1…...
2024/5/1 20:56:20 - 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...
解析如下:1、长按电脑电源键直至关机,然后再按一次电源健重启电脑,按F8健进入安全模式2、安全模式下进入Windows系统桌面后,按住“winR”打开运行窗口,输入“services.msc”打开服务设置3、在服务界面,选中…...
2022/11/19 21:17:18 - 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。
%读入6幅图像(每一幅图像的大小是564*564) f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...
2022/11/19 21:17:16 - 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...
win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面,在等待界面中我们需要等待操作结束才能关机,虽然这比较麻烦,但是对系统进行配置和升级…...
2022/11/19 21:17:15 - 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...
有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows,请勿关闭计算机”的提示,要过很久才能进入系统,有的用户甚至几个小时也无法进入,下面就教大家这个问题的解决方法。第一种方法:我们首先在左下角的“开始…...
2022/11/19 21:17:14 - win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...
置信有很多用户都跟小编一样遇到过这样的问题,电脑时发现开机屏幕显现“正在配置Windows Update,请勿关机”(如下图所示),而且还需求等大约5分钟才干进入系统。这是怎样回事呢?一切都是正常操作的,为什么开时机呈现“正…...
2022/11/19 21:17:13 - 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...
Win7系统开机启动时总是出现“配置Windows请勿关机”的提示,没过几秒后电脑自动重启,每次开机都这样无法进入系统,此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一:开机按下F8,在出现的Windows高级启动选…...
2022/11/19 21:17:12 - 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...
有不少windows10系统用户反映说碰到这样一个情况,就是电脑提示正在准备windows请勿关闭计算机,碰到这样的问题该怎么解决呢,现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法:1、2、依次…...
2022/11/19 21:17:11 - 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...
今天和大家分享一下win7系统重装了Win7旗舰版系统后,每次关机的时候桌面上都会显示一个“配置Windows Update的界面,提示请勿关闭计算机”,每次停留好几分钟才能正常关机,导致什么情况引起的呢?出现配置Windows Update…...
2022/11/19 21:17:10 - 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...
只能是等着,别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚,只能是考虑备份数据后重装系统了。解决来方案一:管理员运行cmd:net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...
2022/11/19 21:17:09 - 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?
原标题:电脑提示“配置Windows Update请勿关闭计算机”怎么办?win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢?一般的方…...
2022/11/19 21:17:08 - 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...
关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!关机提示 windows7 正在配…...
2022/11/19 21:17:05 - 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...
钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...
2022/11/19 21:17:05 - 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...
前几天班里有位学生电脑(windows 7系统)出问题了,具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面,长时间没反应,无法进入系统。这个问题原来帮其他同学也解决过,网上搜了不少资料&#x…...
2022/11/19 21:17:04 - 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...
本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法,并在最后教给你1种保护系统安全的好方法,一起来看看!电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中,添加了1个新功能在“磁…...
2022/11/19 21:17:03 - 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...
许多用户在长期不使用电脑的时候,开启电脑发现电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机。。.这要怎么办呢?下面小编就带着大家一起看看吧!如果能够正常进入系统,建议您暂时移…...
2022/11/19 21:17:02 - 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...
配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!配置windows update失败 还原更改 请勿关闭计算机&#x…...
2022/11/19 21:17:01 - 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...
不知道大家有没有遇到过这样的一个问题,就是我们的win7系统在关机的时候,总是喜欢显示“准备配置windows,请勿关机”这样的一个页面,没有什么大碍,但是如果一直等着的话就要两个小时甚至更久都关不了机,非常…...
2022/11/19 21:17:00 - 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...
当电脑出现正在准备配置windows请勿关闭计算机时,一般是您正对windows进行升级,但是这个要是长时间没有反应,我们不能再傻等下去了。可能是电脑出了别的问题了,来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...
2022/11/19 21:16:59 - 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...
我们使用电脑的过程中有时会遇到这种情况,当我们打开电脑之后,发现一直停留在一个界面:“配置Windows Update失败,还原更改请勿关闭计算机”,等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢࿰…...
2022/11/19 21:16:58 - 如何在iPhone上关闭“请勿打扰”
Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...
2022/11/19 21:16:57