From 26db9e99f1623769d955496a7e711030c07b1d9e Mon Sep 17 00:00:00 2001 From: zyx <1029606625@qq.com> Date: Tue, 23 May 2023 09:34:18 +0800 Subject: [PATCH] 5/23 9:34 --- .idea/compiler.xml | 2 +- .idea/encodings.xml | 4 ++-- .idea/misc.xml | 1 + .../pom.xml | 2 +- .../src/main/java/cn/czyx007/bean/TbBrand.java | 0 .../src/main/java/cn/czyx007/dao/TbBrandDao.java | 0 .../main/java/cn/czyx007/service/TbBrandService.java | 0 .../cn/czyx007/service/impl/TbBrandServiceImpl.java | 4 ++++ .../src/main/resources/cn/czyx007/dao/TbBrandDao.xml | 0 .../src/main/resources/jdbc.properties | 0 .../src/main/resources/mybatis-config.xml | 0 .../src/main/resources/spring.xml | 10 ++++++++-- .../src/test/java/TestDemo.java | 8 ++++++++ 13 files changed, 25 insertions(+), 6 deletions(-) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/pom.xml (98%) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/src/main/java/cn/czyx007/bean/TbBrand.java (100%) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/src/main/java/cn/czyx007/dao/TbBrandDao.java (100%) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/src/main/java/cn/czyx007/service/TbBrandService.java (100%) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/src/main/java/cn/czyx007/service/impl/TbBrandServiceImpl.java (93%) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/src/main/resources/cn/czyx007/dao/TbBrandDao.xml (100%) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/src/main/resources/jdbc.properties (100%) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/src/main/resources/mybatis-config.xml (100%) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/src/main/resources/spring.xml (81%) rename {spring-mybatis01-522 => spring-mybatis01-522-523}/src/test/java/TestDemo.java (80%) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 7c85ad5..4ce4acd 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -9,7 +9,7 @@ - + diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 5dc4174..50deeda 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -13,8 +13,8 @@ - - + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 54cb61e..6a8bc54 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -18,6 +18,7 @@ diff --git a/spring-mybatis01-522/pom.xml b/spring-mybatis01-522-523/pom.xml similarity index 98% rename from spring-mybatis01-522/pom.xml rename to spring-mybatis01-522-523/pom.xml index b31d319..ddfb5f8 100644 --- a/spring-mybatis01-522/pom.xml +++ b/spring-mybatis01-522-523/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.example - spring-mybatis01-522 + spring-mybatis01-522-523 1.0-SNAPSHOT diff --git a/spring-mybatis01-522/src/main/java/cn/czyx007/bean/TbBrand.java b/spring-mybatis01-522-523/src/main/java/cn/czyx007/bean/TbBrand.java similarity index 100% rename from spring-mybatis01-522/src/main/java/cn/czyx007/bean/TbBrand.java rename to spring-mybatis01-522-523/src/main/java/cn/czyx007/bean/TbBrand.java diff --git a/spring-mybatis01-522/src/main/java/cn/czyx007/dao/TbBrandDao.java b/spring-mybatis01-522-523/src/main/java/cn/czyx007/dao/TbBrandDao.java similarity index 100% rename from spring-mybatis01-522/src/main/java/cn/czyx007/dao/TbBrandDao.java rename to spring-mybatis01-522-523/src/main/java/cn/czyx007/dao/TbBrandDao.java diff --git a/spring-mybatis01-522/src/main/java/cn/czyx007/service/TbBrandService.java b/spring-mybatis01-522-523/src/main/java/cn/czyx007/service/TbBrandService.java similarity index 100% rename from spring-mybatis01-522/src/main/java/cn/czyx007/service/TbBrandService.java rename to spring-mybatis01-522-523/src/main/java/cn/czyx007/service/TbBrandService.java diff --git a/spring-mybatis01-522/src/main/java/cn/czyx007/service/impl/TbBrandServiceImpl.java b/spring-mybatis01-522-523/src/main/java/cn/czyx007/service/impl/TbBrandServiceImpl.java similarity index 93% rename from spring-mybatis01-522/src/main/java/cn/czyx007/service/impl/TbBrandServiceImpl.java rename to spring-mybatis01-522-523/src/main/java/cn/czyx007/service/impl/TbBrandServiceImpl.java index 44bc4a0..52d834a 100644 --- a/spring-mybatis01-522/src/main/java/cn/czyx007/service/impl/TbBrandServiceImpl.java +++ b/spring-mybatis01-522-523/src/main/java/cn/czyx007/service/impl/TbBrandServiceImpl.java @@ -5,6 +5,7 @@ import cn.czyx007.dao.TbBrandDao; import cn.czyx007.service.TbBrandService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** * (TbBrand)表服务实现类 @@ -13,6 +14,7 @@ import org.springframework.stereotype.Service; * @since 2023-05-22 15:33:50 */ @Service +@Transactional public class TbBrandServiceImpl implements TbBrandService { @Autowired TbBrandDao tbBrandDao; @@ -34,9 +36,11 @@ public class TbBrandServiceImpl implements TbBrandService { * @param tbBrand 实例对象 * @return 实例对象 */ + @Override public TbBrand insert(TbBrand tbBrand) { this.tbBrandDao.insert(tbBrand); + int i = 1/0; return tbBrand; } diff --git a/spring-mybatis01-522/src/main/resources/cn/czyx007/dao/TbBrandDao.xml b/spring-mybatis01-522-523/src/main/resources/cn/czyx007/dao/TbBrandDao.xml similarity index 100% rename from spring-mybatis01-522/src/main/resources/cn/czyx007/dao/TbBrandDao.xml rename to spring-mybatis01-522-523/src/main/resources/cn/czyx007/dao/TbBrandDao.xml diff --git a/spring-mybatis01-522/src/main/resources/jdbc.properties b/spring-mybatis01-522-523/src/main/resources/jdbc.properties similarity index 100% rename from spring-mybatis01-522/src/main/resources/jdbc.properties rename to spring-mybatis01-522-523/src/main/resources/jdbc.properties diff --git a/spring-mybatis01-522/src/main/resources/mybatis-config.xml b/spring-mybatis01-522-523/src/main/resources/mybatis-config.xml similarity index 100% rename from spring-mybatis01-522/src/main/resources/mybatis-config.xml rename to spring-mybatis01-522-523/src/main/resources/mybatis-config.xml diff --git a/spring-mybatis01-522/src/main/resources/spring.xml b/spring-mybatis01-522-523/src/main/resources/spring.xml similarity index 81% rename from spring-mybatis01-522/src/main/resources/spring.xml rename to spring-mybatis01-522-523/src/main/resources/spring.xml index 35ce9ec..9344f76 100644 --- a/spring-mybatis01-522/src/main/resources/spring.xml +++ b/spring-mybatis01-522-523/src/main/resources/spring.xml @@ -1,14 +1,20 @@ + http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> + + + + + + diff --git a/spring-mybatis01-522/src/test/java/TestDemo.java b/spring-mybatis01-522-523/src/test/java/TestDemo.java similarity index 80% rename from spring-mybatis01-522/src/test/java/TestDemo.java rename to spring-mybatis01-522-523/src/test/java/TestDemo.java index b579131..e436b0a 100644 --- a/spring-mybatis01-522/src/test/java/TestDemo.java +++ b/spring-mybatis01-522-523/src/test/java/TestDemo.java @@ -21,4 +21,12 @@ public class TestDemo { TbBrand tbBrand = brandService.queryById(5); System.out.println("tbBrand = " + tbBrand); } + + @Test + public void test2(){ + TbBrand brand = new TbBrand(); + brand.setId(123); + brand.setBrandName("123"); + brandService.insert(brand); + } }