package com.ningdatech.pmapi.sys.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity;
import com.ningdatech.pmapi.sys.model.enumeration.DataScopeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.Size;
import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 菜单
 * </p>
 *
 * @author PoffyZhang
 * @since 2022-9-30
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("nd_menu")
@ApiModel(value = "Menu", description = "菜单")
@AllArgsConstructor
public class Menu extends MenuTreeEntity<Menu, Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "组件")
    @Size(max = 255, message = "组件长度不能超过255")
    @TableField(value = "component", condition = LIKE)
    private String component;

    @ApiModelProperty(value = "菜单图标")
    @Size(max = 255, message = "菜单图标长度不能超过255")
    @TableField(value = "icon", condition = LIKE)
    private String icon;

    @ApiModelProperty(value = "是否隐藏")
    @TableField(value = "hidden")
    private Integer hidden;

    @ApiModelProperty(value = "activeMenu")
    @TableField(value = "active_menu")
    private String activeMenu;

    @ApiModelProperty(value = "跳转")
    @TableField(value = "redirect")
    private String redirect;

    @ApiModelProperty("是否有数据权限")
    private Boolean hasDataScope;

    /**
     * @see DataScopeEnum
     */
    @ApiModelProperty("数据权限选项")
    private String dataScopeOption;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateBy;

    @TableField(fill = FieldFill.INSERT)
    private Long createBy;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateOn;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createOn;

}
