Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
loit-shardingsphere-seata-example
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
loit-Infrastructure-example
loit-shardingsphere-seata-example
Commits
8758c858
提交
8758c858
authored
2月 21, 2020
作者:
陈世营
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【修改】test UID
上级
4f4b3896
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
6 行增加
和
50 行删除
+6
-50
DemoController.java
.../loit/shardingsphere/seata/controller/DemoController.java
+1
-1
Order.java
...a/com/loit/shardingsphere/seata/modules/entity/Order.java
+0
-45
OrderEntity.java
...loit/shardingsphere/seata/modules/entity/OrderEntity.java
+1
-2
OrderItemEntity.java
.../shardingsphere/seata/modules/entity/OrderItemEntity.java
+1
-2
BusinessServiceImpl.java
...phere/seata/modules/service/impl/BusinessServiceImpl.java
+3
-0
没有找到文件。
loit-shardingsphere-seata-main/src/main/java/com/loit/shardingsphere/seata/controller/DemoController.java
浏览文件 @
8758c858
...
...
@@ -28,7 +28,7 @@ public class DemoController {
@GetMapping
(
"purchase"
)
public
void
purchase
()
{
for
(
long
i
=
1
;
i
<
2
0
;
i
++)
{
for
(
long
i
=
1
;
i
<
2
;
i
++)
{
businessService
.
purchase
(
i
);
}
log
.
info
(
"success"
);
...
...
loit-shardingsphere-seata-main/src/main/java/com/loit/shardingsphere/seata/modules/entity/Order.java
deleted
100644 → 0
浏览文件 @
4f4b3896
package
com
.
loit
.
shardingsphere
.
seata
.
modules
.
entity
;
import
java.io.Serializable
;
public
class
Order
implements
Serializable
{
private
static
final
long
serialVersionUID
=
661434701950670670L
;
private
long
orderId
;
private
int
userId
;
private
String
status
;
public
long
getOrderId
()
{
return
orderId
;
}
public
void
setOrderId
(
final
long
orderId
)
{
this
.
orderId
=
orderId
;
}
public
int
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
final
int
userId
)
{
this
.
userId
=
userId
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
final
String
status
)
{
this
.
status
=
status
;
}
@Override
public
String
toString
()
{
return
String
.
format
(
"order_id: %s, user_id: %s, status: %s"
,
orderId
,
userId
,
status
);
}
}
loit-shardingsphere-seata-main/src/main/java/com/loit/shardingsphere/seata/modules/entity/OrderEntity.java
浏览文件 @
8758c858
...
...
@@ -2,13 +2,12 @@
package
com
.
loit
.
shardingsphere
.
seata
.
modules
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
@TableName
(
"t_order"
)
public
final
class
OrderEntity
{
@TableId
(
value
=
"id"
,
type
=
IdType
.
ID_WORKER_STR
)
@TableId
(
value
=
"id"
)
private
String
id
;
@TableId
(
value
=
"order_id"
)
private
long
orderId
;
...
...
loit-shardingsphere-seata-main/src/main/java/com/loit/shardingsphere/seata/modules/entity/OrderItemEntity.java
浏览文件 @
8758c858
...
...
@@ -2,13 +2,12 @@
package
com
.
loit
.
shardingsphere
.
seata
.
modules
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
@TableName
(
"t_order_item"
)
public
final
class
OrderItemEntity
{
@TableId
(
value
=
"id"
,
type
=
IdType
.
ID_WORKER_STR
)
@TableId
(
value
=
"id"
)
private
String
id
;
@TableId
(
value
=
"order_item_id"
)
private
long
orderItemId
;
...
...
loit-shardingsphere-seata-main/src/main/java/com/loit/shardingsphere/seata/modules/service/impl/BusinessServiceImpl.java
浏览文件 @
8758c858
...
...
@@ -4,6 +4,7 @@ import com.loit.shardingsphere.seata.modules.entity.OrderEntity;
import
com.loit.shardingsphere.seata.modules.service.IBusinessService
;
import
com.loit.shardingsphere.seata.modules.service.IOrderService
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shardingsphere.transaction.annotation.ShardingTransactionType
;
import
org.apache.shardingsphere.transaction.core.TransactionType
;
import
org.apache.shardingsphere.transaction.core.TransactionTypeHolder
;
...
...
@@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
@Service
@Slf4j
public
class
BusinessServiceImpl
implements
IBusinessService
{
@Autowired
...
...
@@ -29,6 +31,7 @@ public class BusinessServiceImpl implements IBusinessService {
orderEntity
.
setStatus
(
"seata"
);
orderEntity
.
setUserId
(
userId
.
intValue
());
orderService
.
insertOrder
(
orderEntity
);
log
.
info
(
orderEntity
.
getId
());
//throw new RuntimeException("回滚测试");
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论