feat:增加查找替换逻辑

This commit is contained in:
wangyu 2021-10-21 20:21:44 +08:00
parent 45dd39fd95
commit 973040f363
4 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,31 @@
package com.flyfish.framework.annotations;
import java.lang.annotation.*;
/**
* 联动属性声明
* @author wangyu
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ComputedProps {
/**
* 属性名
* @return 结果
*/
String prop();
/**
* 来自的字段值
* @return 结果
*/
String field() default "";
/**
* 表达式
* @return 结果
*/
String expression() default "";
}

View File

@ -1,7 +1,5 @@
package com.flyfish.framework.annotations;
import org.springframework.core.annotation.AliasFor;
import java.lang.annotation.*;
/**

View File

@ -143,6 +143,11 @@ public class BeanProperty {
property.extra.put(BeanProps.GENERATED, generation.asMap());
property.extra.put(BeanProps.COMPONENT, "input-hidden");
}
// 追加属性映射
MergedAnnotation<ComputedProps> links = annotations.get(ComputedProps.class);
if (links.isPresent()) {
property.extra.put(BeanProps.LINKED, links.asMap());
}
// 优雅的设置额外的属性
MergedAnnotation<FormItem> item = annotations.get(FormItem.class);
if (item.isPresent()) {

View File

@ -30,6 +30,8 @@ public interface BeanProps {
String GENERATED = "generated";
String LINKED = "links";
String MAPPING = "mapping";
String CONDITION = "condition";