@Data
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Where(clause = "DELETE_FLAG='N'") //enable delete flag global //TODO:????why not work!
public abstract class AuditedEntity extends BaseEntity {
@CreatedBy
private String createUserId;
@CreatedDate
private Date createTime;
@LastModifiedBy
private String lastModifyUserId;
@LastModifiedDate
private Date lastModifyTime;
private String deleteFlag;
}
@Entity
@Data
@Table(name = "SYS_CATEGORY")
public class SysCategoryEntity extends AuditedEntity {
}
这里是完整的代码。当我在SysCategoryEntity上添加@Where(clause =“DELETE_FLAG ='N'”)时,它就可以了。