Skip to content

Commit

Permalink
feat: Add a logical deletion field.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzm0809 committed Nov 27, 2024
1 parent f619a41 commit a7c2dac
Show file tree
Hide file tree
Showing 28 changed files with 1,339 additions and 1,002 deletions.
5 changes: 5 additions & 0 deletions dinky-admin/src/main/java/org/dinky/data/model/Dashboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -59,6 +60,10 @@ public class Dashboard extends Model<Dashboard> {
@ApiModelProperty(value = "Layouts", dataType = "String", example = "[]", notes = "Layouts of the metrics")
private String layouts;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@TableField(fill = FieldFill.INSERT)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
Expand Down
5 changes: 2 additions & 3 deletions dinky-admin/src/main/java/org/dinky/data/model/LoginLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(value = "LoginLog", description = "Login Log Information")
@TableName("dinky_sys_login_log")
Expand Down Expand Up @@ -85,9 +87,6 @@ public class LoginLog extends DateBaseEntity<LoginLog> implements Serializable {
@ApiModelProperty(value = "Message", dataType = "String", notes = "Additional message or details about the login")
private String msg;

@ApiModelProperty(value = "Is Deleted", dataType = "Boolean", notes = "Flag indicating if the login log is deleted")
private Boolean isDeleted;

@ApiModelProperty(value = "Access Time", dataType = "String", notes = "Timestamp indicating the time of login")
private LocalDateTime accessTime;
}
5 changes: 5 additions & 0 deletions dinky-admin/src/main/java/org/dinky/data/model/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -93,6 +94,10 @@ public class Metrics extends Model<Metrics> {
notes = "Timestamp indicating the last update time of the metrics")
private LocalDateTime updateTime;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@TableField(exist = false)
private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

Expand All @@ -49,6 +50,10 @@ public class OperateLog implements Serializable {
notes = "Name of the operation module")
private String moduleName;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@ApiModelProperty(
value = "Business Type",
dataType = "Integer",
Expand Down
5 changes: 5 additions & 0 deletions dinky-admin/src/main/java/org/dinky/data/model/Resources.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
Expand Down Expand Up @@ -105,6 +106,10 @@ public class Resources extends Model<Resources> {
notes = "Flag indicating if the resource is a directory")
private Boolean isDirectory;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@TableField(fill = FieldFill.INSERT)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -95,6 +96,10 @@ public class Savepoints implements Serializable {
notes = "Timestamp indicating the creation time of the savepoint")
private LocalDateTime createTime;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "Creator", dataType = "String", notes = "Creator of the savepoint")
private Integer creator;
Expand Down
2 changes: 2 additions & 0 deletions dinky-admin/src/main/java/org/dinky/data/model/SysToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.dinky.data.model;

import lombok.EqualsAndHashCode;
import org.dinky.mybatis.model.DateBaseEntity;

import java.io.Serializable;
Expand All @@ -39,6 +40,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -60,6 +61,10 @@ public class TaskVersion implements Serializable {
@TableField(value = "task_id")
private Integer taskId;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@ApiModelProperty(value = "Version ID", dataType = "Integer", notes = "ID of the version")
@TableField(value = "version_id")
private Integer versionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
Expand Down Expand Up @@ -85,6 +86,10 @@ public class AlertHistory implements Serializable {
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime createTime;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value = "Update Time", example = "2022-02-24 20:12:00", dataType = "LocalDateTime")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -129,6 +130,10 @@ public class History implements Serializable {
@ApiModelProperty(value = "Group by count", dataType = "Integer")
private Long count;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@ApiModelProperty(hidden = true)
public JobInstance buildJobInstance() {
JobInstance jobInstance = new JobInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
Expand Down Expand Up @@ -81,6 +82,10 @@ public class JobHistory implements Serializable {
@TableField(typeHandler = JSONObjectHandler.class)
private FlinkJobDetailInfo jobJson;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@ApiModelProperty(
value = "Exceptions JSON",
dataType = "String",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -103,6 +104,10 @@ public class JobInstance implements Serializable {
@ApiModelProperty(value = "Error", dataType = "String", notes = "Error message associated with the job instance")
private String error;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
Expand Down
6 changes: 0 additions & 6 deletions dinky-admin/src/main/java/org/dinky/data/model/rbac/Role.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ public class Role extends DateBaseEntity<Role> implements Serializable {
@ApiModelProperty(value = "Role Name", dataType = "String", example = "Administrator", notes = "Name of the role")
private String roleName;

@ApiModelProperty(
value = "Is Delete",
dataType = "Boolean",
notes = "Flag indicating if the role is marked as deleted")
private Boolean isDelete;

@ApiModelProperty(value = "Note", dataType = "String", notes = "Additional notes or details about the role")
private String note;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,4 @@ public class Tenant extends DateBaseEntity<Tenant> implements Serializable {
@ApiModelProperty(value = "Tenant Note", required = true, dataType = "String", example = "Default")
private String note;

/** is delete */
@ApiModelProperty(value = "Is Delete", required = true, dataType = "Boolean", example = "false")
private Boolean isDelete;
}
5 changes: 0 additions & 5 deletions dinky-admin/src/main/java/org/dinky/data/model/rbac/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import io.swagger.annotations.ApiModel;
Expand Down Expand Up @@ -80,10 +79,6 @@ public class User extends DateBaseEntity<User> implements Serializable {
@ApiModelProperty(value = "Enabled", dataType = "Boolean", notes = "Whether the user is enabled")
private Boolean enabled;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@ApiModelProperty(value = "Super Admin Flag", dataType = "Boolean", notes = "Whether the user is a super admin")
private Boolean superAdminFlag;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -56,6 +57,10 @@ public class DateBaseEntity<T extends Model<?>> extends Model<T> {
example = "2021-05-28 00:00:00")
private LocalDateTime createTime;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@TableField(fill = FieldFill.INSERT_UPDATE)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
Expand All @@ -51,7 +52,9 @@
@ApiModel(value = "SuperEntity", description = "Super Base Entity", parent = Model.class)
public class SuperEntity<T extends Model<?>> extends Model<T> {

/** 主键ID */
/**
* 主键ID
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "ID", required = true, dataType = "Integer", example = "1", notes = "Primary Key")
private Integer id;
Expand Down Expand Up @@ -96,6 +99,10 @@ public class SuperEntity<T extends Model<?>> extends Model<T> {
@ApiModelProperty(value = "Updater", required = true, dataType = "String", example = "Updater")
private Integer updater;

@ApiModelProperty(value = "Is Delete", dataType = "Boolean", notes = "Whether the user is deleted")
@TableLogic
private Boolean isDelete;

@Override
public Serializable pkVal() {
return this.id;
Expand Down
Loading

0 comments on commit a7c2dac

Please sign in to comment.