package cn.estsh.i3plus.pojo.platform.bean;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @Description : 单号规则
 * @Reference :
 * @Author : yunhao
 * @CreateDate : 2018-11-21 15:12
 * @Modify:
 *      Dev 2018-12-12 09:41:07
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="SYS_ORDER_RULE")
@Api(value="单号规则",description = "单号规则")
public class SysOrderNoRule extends BaseBean {

    private static final long serialVersionUID = -283233170141936426L;
    @Column(name = "NAME")
    @ApiParam(value = "规则名称")
    private String name;

    @Column(name = "ORDER_NO_RULE_CODE")
    @ApiParam(value = "规则代码")
    private String orderNoRuleCode;

    @Column(name = "ORDER_NO_RULE")
    @ApiParam(value = "单号规则")
    private String orderNoRule;

    @Column(name = "SERIAL_NO_SEED")
    @ApiParam(value = "流水号种子",example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long serialNoSeed;

    @Column(name = "ORDER_NO_INCREMENT")
    @ApiParam(value = "流水号步长",example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long serialNoIncrement;

    @Column(name = "SERIAL_NO_LENGTH")
    @ApiParam(value = "流水号长度",example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long serialNoLength;

    @Column(name = "IS_CYCLE")
    @ApiParam(value = "达到最大值后是否循环",example = "1")
    @AnnoOutputColumn(refClass = CommonEnumUtil.TRUE_OR_FALSE.class)
    private Integer isCycle;

    @Column(name = "IS_FIXED_LENGTH")
    @ColumnDefault("2")
    @ApiParam(value = "是否固定序号长度长度",example = "1")
    @AnnoOutputColumn(refClass = CommonEnumUtil.TRUE_OR_FALSE.class)
    private Integer isFixedLength;

    @Column(name = "SERIAL_NO")
    @ApiParam(value = "当前流水号",example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    @AnnoOutputColumn(hidden = true)
    private Long serialNo;

    @Column(name = "ORDER_NO")
    @ApiParam(value = "当前单号")
    @AnnoOutputColumn(hidden = true)
    private String orderNo;

    @Column(name = "ORDER_NO_RULE_STATUS")
    @ApiParam(value = "单号规则状态")
    @AnnoOutputColumn(hidden = true)
    private Integer orderNoRuleStatus;

    @Column(name="ORDER_NO_RULE_DESCRIPTION")
    @ApiParam(value ="描述")
    private String orderNoRuleDescription;
}
