parent
01e5404e8c
commit
957b2eb893
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.mall.admin.sdk.dict;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-04-16 20:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class Bean {
|
||||||
|
|
||||||
|
@DictVal(dicKey = "gender", dicValue = "1")
|
||||||
|
private String gender;
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.mall.admin.sdk.dict;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典转换
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-04-16 20:22
|
||||||
|
*/
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface DictVal {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典的 key
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String dicKey();
|
||||||
|
/**
|
||||||
|
* 字典 value
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String dicValue();
|
||||||
|
/**
|
||||||
|
* - 暂时只有 dictDisplayName 字典值转换为 dictDisplayName 给用户界面
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String mode() default "dictDisplayName";
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.mall.admin.sdk.dict;
|
||||||
|
|
||||||
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link DictVal} 处理器
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-04-16 20:43
|
||||||
|
*/
|
||||||
|
public class DictValProcessor {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processor(Class<?> clazz) {
|
||||||
|
// ReflectionUtils.ann
|
||||||
|
// clazz.getFi
|
||||||
|
// ReflectionUtils
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue