package org.hswebframework.web.entity.authorization;

import lombok.*;
import lombok.experimental.Wither;
import org.hswebframework.web.commons.entity.CloneableEntity;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ActionEntity implements CloneableEntity {

    private static final long serialVersionUID = -5756333786703175612L;

    private String action;

    private String describe;

    private boolean defaultCheck;

    public ActionEntity(String action) {
        this.action = action;
    }

    @Override
    @SneakyThrows
    public ActionEntity clone() {
        return (ActionEntity) super.clone();
    }

    public static List<ActionEntity> create(String... actions) {
        return Arrays.stream(actions).map(ActionEntity::new).collect(Collectors.toList());
    }

    @Override
    public int hashCode() {
        return getAction().hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof ActionEntity && obj.hashCode() == hashCode();
    }

}
@@ -160,16 +160,61 @@
 eEntity;
+%0Aimport org.springframework.util.StringUtils;
 %0A%0Aimport
@@ -1153,9 +1153,145 @@
 %0A    %7D%0A%0A
+    @Override%0A    public String toString() %7B%0A        return action + (StringUtils.hasText(describe) ? %22(%22 + describe + %22)%22 : %22%22);%0A    %7D%0A
 %7D

add toString