fix: 修复逻辑删除字段冲突,status用于订单状态,deleted用于删除标记
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -74,8 +74,10 @@ public class Order {
|
||||
private BigDecimal discountRate;
|
||||
|
||||
/**
|
||||
* 状态: 1已完成 2已取消 3退款中 4已退款
|
||||
* 状态: 0未完成 1已完成 2已取消 3退款中 4已退款
|
||||
*/
|
||||
@TableField("status")
|
||||
@TableLogic(value = "1", delval = "2") // 使用虚拟删除:删除时改为2,不再使用status作为逻辑删除字段
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
@@ -103,4 +105,10 @@ public class Order {
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 删除标记: 0未删除 1已删除
|
||||
*/
|
||||
@TableField("deleted")
|
||||
private Integer deleted;
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ mybatis-plus:
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: assign_uuid
|
||||
logic-delete-field: status
|
||||
logic-delete-value: 0
|
||||
logic-not-delete-value: 1
|
||||
logic-delete-field: deleted
|
||||
logic-delete-value: 1
|
||||
logic-not-delete-value: 0
|
||||
mapper-locations: classpath*:/mapper/**/*.xml
|
||||
type-aliases-package: com.example.building.entity
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- 增加 deleted 字段用于逻辑删除
|
||||
ALTER TABLE orders ADD COLUMN deleted INTEGER DEFAULT 0;
|
||||
Reference in New Issue
Block a user