package com.qiaoba.api.system.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qiaoba.common.base.entity.BaseEntity;
import com.qiaoba.common.base.validate.AddGroup;
import com.qiaoba.common.base.validate.EditGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 岗位信息 sys_post
 *
 * @author ailanyin
 * @version 1.0
 * @since 2022-09-22 04:20:28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_post")
public class SysPost extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @TableId
    @Excel(name = "岗位序号", width = 20)
    private String postId;

    @Excel(name = "岗位名称", width = 20)
    @Schema(description = "岗位名称")
    @NotBlank(message = "岗位名称不能为空", groups = {AddGroup.class, EditGroup.class})
    @Size(max = 50, message = "岗位名称不能超过{max}个字符", groups = {AddGroup.class, EditGroup.class})
    private String postName;

    @Excel(name = "岗位编码", width = 20)
    @Schema(description = "岗位编码")
    @NotBlank(message = "岗位编码不能为空", groups = {AddGroup.class, EditGroup.class})
    @Size(max = 50, message = "岗位编码不能超过{max}个字符", groups = {AddGroup.class, EditGroup.class})
    private String postCode;

    @Excel(name = "岗位排序", width = 20)
    @Schema(description = "岗位排序")
    @Min(value = 1, message = "排序最小允许: {value}", groups = {AddGroup.class, EditGroup.class})
    private Integer postSort;

    @Excel(name = "状态", width = 20, replace = {"正常_1", "异常_0"})
    @Schema(description = "状态(0->禁用,1->正常)")
    @NotBlank(message = "状态不能为空", groups = {AddGroup.class, EditGroup.class})
    @Size(max = 1, message = "状态不能超过{max}个字符", groups = {AddGroup.class, EditGroup.class})
    private String status;

}
