赞
踩
出现 Cannot resolve class or package ‘mysql’处理方法
https://blog.csdn.net/zhouhan_0509/article/details/127319458
这个是因为连接mysql的版本的关系,cj是8.0的
Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsExc
https://blog.csdn.net/RavenWE/article/details/121482923
useSSL=false和true的区别
https://blog.csdn.net/sungancd/article/details/119183605
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>kafka</artifactId> <version>1.0-SNAPSHOT</version> <!--springboot启动类依赖导入--> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.2.RELEASE</version> <relativePath/> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.71</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.38</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.1</version> </dependency> </dependencies> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> </project>
SpringBoot中Server层以及Mapper层常用注解
mapper层
批量修改或者新增
@Controller @RequestMapping("/hello") public class Test1Controller { @Autowired private OrderServiceImpl orderServiceImpl; @RequestMapping("/h") public void test(){ // System.out.println(orderService.findById()); /*Order order = new Order(); order.setOrderName("圣女果"); order.setOrderId(4L); order.setFeature("贵且好吃"); System.out.println(order); //orderService.updateById(order); System.out.println(orderServiceImpl.saveOrUpdate(order));*/ List <Order> orderList = new ArrayList<>(); orderList.add(new Order().setOrderId(1L).setOrderName("批量修改")); orderList.add(new Order().setOrderId(5L).setOrderName("新增水果").setNumber("100005").setFeature("批量新增或者修改测试")); System.out.println(orderServiceImpl.saveOrUpdateBatch(orderList)); }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。