package com.chushang.common.dict.annotation;

import com.chushang.common.dict.jackson.DictJsonSerializer;
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@JsonSerialize(using = DictJsonSerializer.class)
public @interface DictFormat {

    /**
     * 设置字典的type值 (如: sys_user_sex)
     */
    String dictType() default "";

    /**
     * 是否重写覆盖本身key
     */
    boolean rewrite() default false;

    /**
     * 根据 label 获取value 值, 默认根据value 获取label 值
     */
    boolean labelGetValue() default false;
}
