从零开始学MySQL
事务的四大特性原子性(Atomicity)原子性是指事务包含的所有操作要么全部成功,要么全部失败回滚,操作如果成功就必须要完全应用到数据库,操作失败则不能对数据库有任何影响。 一致性(Consistency)一致性是指事务使数据库从一个一致性状态变换到另一个一致性状态,也就是说一个事务执行之前和执行之后都必须处于一致性状态。以转账为例假设A和B的各有100元,那么不管A和B之间如何转账,转几次账,事务结束后两个用户的钱相加起来还是200,这就是事务的一致性。 隔离性(Isolation)隔离性是当多个用户并发访问数据库时,比如操作同一张表时,数据库为每一个用户开启的事务,不能被其他事务的操作所干扰,多个并发事务之间要相互隔离。即要达到一种每个事务都互不影响,不能感对方的并发地执行。 持久性(Durability)持久性是指一个事务一旦被提交了,那么对数据库中的数据的改变就是永久性的,即便是在数据库系统遇到故障的情况下也不会丢失提交事务的操作。 存储引擎数据库存储引擎是数据库底层软件组织,数据库管理系统(DBMS)使用数据引擎进行创建、查询、更新和删除数据。不同的存储引擎提供不同的存储机 ...
从零开始的算法练习3
二叉树层序遍历123456789101112131415161718192021222324252627public class levelOrder { public List<List<Integer>> levelOrder(TreeNode root) { if(root==null){ return new ArrayList<>(); } Queue<TreeNode> queue = new LinkedList<>(); List<List<Integer>> result = new ArrayList<>(); queue.add(root); while (!queue.isEmpty()) { int count = queue.size(); List<In ...
从零开始的算法练习2
冒泡排序12345678910111213141516171819202122232425262728public class BubbleSort { public static void bubbleSort(int[] arr) { for (int i = arr.length; i > 1; i--) { boolean ifSwap = false; for (int j = 1; j < i; j++) { if (arr[j - 1] > arr[j]) { swap(arr, j - 1, j); ifSwap = true; } } System.out.println(ifSwap); System.out.prin ...
从零开始的算法练习
合并两个有序链表https://leetcode.cn/problems/merge-two-sorted-lists/?favorite=2cktkvj 要注意链表需要构造一个节点指针来遍历,,, 12345678910111213141516public class ListNode { int val; ListNode next; ListNode() { } ListNode(int val) { this.val = val; } ListNode(int val, ListNode next) { this.val = val; this.next = next; }} 123456789101112131415161718192021222324252627public class mergeTwoLists { class Solution { public L ...
MyBatisPlus
好几把炫酷 入门案例导入坐标12345678910<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.4.2</version></dependency><dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.16</version></dependency> yml配置1234567spring: datasource: driver-class-name: com.mysql.jdbc.Driver username: root password: root ...
SringBoot整合SSM
SpringBoot已经整合了Spring和SpringMVC SpringBoot整合MyBatis 提供实体类12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758public class Book { private Integer id; private String name; private String type; private String description; public Book() { } public Book(Integer id, String name, String type, String description) { this.id = id; this.name = name; this.type = type; this.description ...
SpringBoot之全部白学
简化Spring开发 入门案例创建工程 创建Controller类123456789@RestController@RequestMapping("/books")public class BookController { @GetMapping("/{id}") public String getById(@PathVariable Integer id){ System.out.println(id); return "hello world SpringBoot"; }} 完成启动app程序,用postman发请求即可看到功能已实现。 起步依赖切换功能配置文件格式读取数据例如在yml中有如下配置 12345678910111213lesson: SpringBootserver: port: 80enterprise: name: 111 age: 11 tel: 123 subject: - aa ...
Spring学习:拦截器
拦截器和过滤器有点像,只不过过滤器是servlet的技术,拦截器是SpringMVC的。 入门案例制作拦截器功能类123456789101112131415@Componentpublic class ProjectInterceptor implements HandlerInterceptor { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { System.out.println("preHandle"); return true; } public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Ex ...
SSM整合
创建工程 导入坐标注意:servlet-api包与tomcat7的依赖包servlet-api冲突,需要添加provided。 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970<dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.2.10.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</g ...
Spring学习:SpringMVC
SpringMVC入门案例基于java实现MVC模型的轻量web框架,替换servlet技术完成表现层开发。 导入坐标12345678910111213<dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>4.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.2.10.RELEASE</version> ...








