From c1ac1adede96e43882ee78d32b0fcbe329ef199c Mon Sep 17 00:00:00 2001 From: xioayue Date: Fri, 24 Jun 2022 16:43:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=95=86=E5=93=81=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=88=97=E8=A1=A8mapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/db.properties | 9 ++++++--- src/main/java/cn/chjyj/szwh/SzwhApplication.java | 2 ++ src/main/java/cn/chjyj/szwh/mapper/GoodsMapper.java | 1 + src/main/resources/application.properties | 3 +-- src/main/resources/mapper/szwh/GoodsMapper.xml | 6 +++--- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/conf/db.properties b/conf/db.properties index 27516fd..c18a08d 100644 --- a/conf/db.properties +++ b/conf/db.properties @@ -1,9 +1,12 @@ # 数据库服务器配置 type=com.alibaba.druid.pool.DruidDataSource driver-class-name=com.mysql.cj.jdbc.Driver -druid.url=jdbc:mysql://192.168.1.8:3306/szwhtrans?useUnioncode=true&charsetEncoding=UTF-8 -druid.username=szwhtrans -druid.password=rRyPkT2XYW6mMRiX +#druid.url=jdbc:mysql://192.168.1.8:3306/szwhtrans?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +druid.url=jdbc:mysql://localhost:3306/szwhtrans?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +#druid.username=szwhtrans +#druid.password=rRyPkT2XYW6mMRiX +druid.username=root +druid.password=xc1123 druid.initial-size=10 druid.max-active=100 druid.min-idle=10 diff --git a/src/main/java/cn/chjyj/szwh/SzwhApplication.java b/src/main/java/cn/chjyj/szwh/SzwhApplication.java index e0e6e5a..952ba36 100644 --- a/src/main/java/cn/chjyj/szwh/SzwhApplication.java +++ b/src/main/java/cn/chjyj/szwh/SzwhApplication.java @@ -1,9 +1,11 @@ package cn.chjyj.szwh; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication +@MapperScan("cn.chjyj.szwh.mapper") public class SzwhApplication { public static void main(String[] args) { diff --git a/src/main/java/cn/chjyj/szwh/mapper/GoodsMapper.java b/src/main/java/cn/chjyj/szwh/mapper/GoodsMapper.java index d89e828..d53ac22 100644 --- a/src/main/java/cn/chjyj/szwh/mapper/GoodsMapper.java +++ b/src/main/java/cn/chjyj/szwh/mapper/GoodsMapper.java @@ -1,6 +1,7 @@ package cn.chjyj.szwh.mapper; import cn.chjyj.szwh.bean.Goods; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Component; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 2c6603f..c75bf9b 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -6,5 +6,4 @@ logging.path=./logs/ server.port=9090 # 服务请求上下文 #server.servlet.context-path=/chapi - -spring.flyway.script-placeholder-prefix= \ No newline at end of file +mybatis.mapper-locations=classpath*:/mapper/**/*.xml \ No newline at end of file diff --git a/src/main/resources/mapper/szwh/GoodsMapper.xml b/src/main/resources/mapper/szwh/GoodsMapper.xml index e38e4cc..4470aa4 100644 --- a/src/main/resources/mapper/szwh/GoodsMapper.xml +++ b/src/main/resources/mapper/szwh/GoodsMapper.xml @@ -21,10 +21,10 @@