Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
ffc2bcec
S
SpringBoot-kwan
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringBoot-kwan
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBoot-kwan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
ffc2bcec
编写于
2月 19, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:保存2个表的信息
上级
51bf66ef
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
212 addition
and
1 deletion
+212
-1
src/main/java/com/kwan/springbootkwan/controller/SeataControlller.java
.../com/kwan/springbootkwan/controller/SeataControlller.java
+29
-0
src/main/java/com/kwan/springbootkwan/mapper/PersonMapper.java
...ain/java/com/kwan/springbootkwan/mapper/PersonMapper.java
+12
-0
src/main/java/com/kwan/springbootkwan/service/IPersonService.java
.../java/com/kwan/springbootkwan/service/IPersonService.java
+9
-0
src/main/java/com/kwan/springbootkwan/service/IUserService.java
...in/java/com/kwan/springbootkwan/service/IUserService.java
+9
-0
src/main/java/com/kwan/springbootkwan/service/impl/PersonServiceImpl.java
...m/kwan/springbootkwan/service/impl/PersonServiceImpl.java
+22
-0
src/main/java/com/kwan/springbootkwan/service/impl/UserServiceImpl.java
...com/kwan/springbootkwan/service/impl/UserServiceImpl.java
+16
-1
src/main/resources/application-bak.yaml
src/main/resources/application-bak.yaml
+115
-0
未找到文件。
src/main/java/com/kwan/springbootkwan/controller/SeataControlller.java
0 → 100644
浏览文件 @
ffc2bcec
package
com.kwan.springbootkwan.controller
;
import
com.kwan.springbootkwan.entity.User
;
import
com.kwan.springbootkwan.service.IUserService
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
@Slf4j
@RestController
@RequestMapping
(
"/seata"
)
public
class
SeataControlller
{
@Autowired
private
IUserService
userService
;
@ApiOperation
(
value
=
"保存用户"
,
notes
=
"保存用户"
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
GET
)
public
User
save
()
{
//保存用户
User
user
=
new
User
();
user
.
setName
(
"秦梓淞"
);
user
.
setSex
(
"男"
);
return
userService
.
saveUser
(
user
);
}
}
src/main/java/com/kwan/springbootkwan/mapper/PersonMapper.java
0 → 100644
浏览文件 @
ffc2bcec
package
com.kwan.springbootkwan.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.kwan.springbootkwan.entity.Person
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
PersonMapper
extends
BaseMapper
<
Person
>
{
}
src/main/java/com/kwan/springbootkwan/service/IPersonService.java
0 → 100644
浏览文件 @
ffc2bcec
package
com.kwan.springbootkwan.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.kwan.springbootkwan.entity.Person
;
public
interface
IPersonService
extends
IService
<
Person
>
{
Person
savePerson
(
Person
person
);
}
src/main/java/com/kwan/springbootkwan/service/IUserService.java
浏览文件 @
ffc2bcec
...
@@ -28,4 +28,13 @@ public interface IUserService extends IService<User> {
...
@@ -28,4 +28,13 @@ public interface IUserService extends IService<User> {
* @return
* @return
*/
*/
User
getUserByName
(
String
sex
);
User
getUserByName
(
String
sex
);
/**
* 保存用户
*
* @param user
* @return
*/
User
saveUser
(
User
user
);
}
}
src/main/java/com/kwan/springbootkwan/service/impl/PersonServiceImpl.java
0 → 100644
浏览文件 @
ffc2bcec
package
com.kwan.springbootkwan.service.impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.kwan.springbootkwan.entity.Person
;
import
com.kwan.springbootkwan.mapper.PersonMapper
;
import
com.kwan.springbootkwan.service.IPersonService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
PersonServiceImpl
extends
ServiceImpl
<
PersonMapper
,
Person
>
implements
IPersonService
{
@Autowired
private
PersonMapper
personMapper
;
// @DS(value ="ali-ds" )
@Override
public
Person
savePerson
(
Person
person
)
{
personMapper
.
insert
(
person
);
return
person
;
}
}
src/main/java/com/kwan/springbootkwan/service/impl/UserServiceImpl.java
浏览文件 @
ffc2bcec
package
com.kwan.springbootkwan.service.impl
;
package
com.kwan.springbootkwan.service.impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.kwan.springbootkwan.entity.Person
;
import
com.kwan.springbootkwan.entity.User
;
import
com.kwan.springbootkwan.entity.User
;
import
com.kwan.springbootkwan.mapper.UserMapper
;
import
com.kwan.springbootkwan.mapper.UserMapper
;
import
com.kwan.springbootkwan.service.IPersonService
;
import
com.kwan.springbootkwan.service.IUserService
;
import
com.kwan.springbootkwan.service.IUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -15,6 +17,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
...
@@ -15,6 +17,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
@Autowired
@Autowired
private
UserMapper
userMapper
;
private
UserMapper
userMapper
;
@Autowired
private
IPersonService
personService
;
@Override
@Override
public
List
<
User
>
getUsers
()
{
public
List
<
User
>
getUsers
()
{
...
@@ -28,10 +32,21 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
...
@@ -28,10 +32,21 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
@Override
@Override
public
User
getUserByName
(
String
sex
)
{
public
User
getUserByName
(
String
sex
)
{
User
userByName
=
userMapper
.
getUserByName
(
sex
);
User
userByName
=
userMapper
.
getUserByName
(
sex
);
if
(
Objects
.
isNull
(
userByName
))
{
if
(
Objects
.
isNull
(
userByName
))
{
userByName
=
new
User
();
userByName
=
new
User
();
}
}
return
userByName
;
return
userByName
;
}
}
@Override
public
User
saveUser
(
User
user
)
{
userMapper
.
insert
(
user
);
Person
person
=
new
Person
();
person
.
setUsername
(
user
.
getName
());
person
.
setAddress
(
"当铺"
);
person
.
setGender
(
user
.
getSex
());
personService
.
savePerson
(
person
);
return
user
;
}
}
}
\ No newline at end of file
src/main/resources/application-bak.yaml
0 → 100644
浏览文件 @
ffc2bcec
server
:
port
:
8761
servlet
:
encoding
:
force
:
true
charset
:
UTF-8
enabled
:
true
swagger
:
enable
:
true
#兼容swagger配置
spring
:
application
:
name
:
spring-boot-demo
#项目启动时创建数据表的 SQL 脚本,该脚本由 Spring Batch 提供
#spring.datasource.schema=classpath:/org/springframework/batch/core/schema-mysql.sql
# 在项目启动时执行建表 SQL
batch
:
initialize-schema
:
always
# 禁止 Spring Batch 自动执行,在 SpringBoot 中,默认情况,当项目启动时就会执行配置好的批理操作,添加了该配置后则不会自动执行,而需要用户手动触发执行
job
:
enabled
:
false
mail
:
host
:
smtp.qq.com
# 发送者的邮箱账号
username
:
327782001@qq.com
# 邮箱密码授权码
password
:
kypxnmwfniqrcbeh
properties
:
mail
:
smtp
:
auth
:
true
starttls
:
enable
:
true
required
:
true
redis
:
database
:
0
# Redis数据库索引(默认为0)
host
:
120.79.36.53
#Redis服务器地址
port
:
6379
# Redis服务器连接端口
password
:
# Redis服务器连接密码(默认为空)
jedis
:
pool
:
max-active
:
200
# 连接池最大连接数(使用负值表示没有限制)
max-idle
:
10
# 连接池中的最大空闲连接
min-idle
:
0
# 连接池中的最小空闲连接
max-wait
:
-1
# 连接池最大阻塞等待时间(使用负值表示没有限制)
mvc
:
pathmatch
:
matching-strategy
:
ant_path_matcher
# mysql
datasource
:
url
:
jdbc:mysql://localhost:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
716288qwe
# dynamic:
# primary: kwan-ds
# datasource:
# kwan-ds:
# url: jdbc:mysql://localhost:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.mysql.cj.jdbc.Driver
# username: root
# password: 716288qwe
## ali-ds:
## url: jdbc:mysql://localhost:3306/spring-boot?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
## driver-class-name: com.mysql.cj.jdbc.Driver
## username: root
## password: 1716288qwe
# seata: true
# cloud:
# nacos:
# discovery:
# server-addr: http://120.79.36.53:8848 #服务注册地址
# config:
# enabled: false
#seata配置
seata
:
enable-auto-data-source-proxy
:
false
application-id
:
${spring.application.name}
tx-service-group
:
${spring.application.name}-group
service
:
vgroup-mapping
:
spring-boot-demo-group
:
default
grouplist
:
default
:
127.0.0.1:8091
config
:
type
:
file
registry
:
type
:
file
#mybatis-plus配置
mybatis-plus
:
configuration
:
map-underscore-to-camel-case
:
true
call-setters-on-nulls
:
true
auto-mapping-behavior
:
full
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations
:
classpath*:mapper/**/*Mapper.xml
global-config
:
banner
:
false
# 逻辑删除配置
db-config
:
id-type
:
AUTO
logic-delete-field
:
delFlag
logic-delete-value
:
1
logic-not-delete-value
:
0
table-underline
:
true
#logger配置
logging
:
config
:
classpath:logback-spring.xml
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录