zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cn.autoform.bean.power;
 
import cn.autoform.db.entity.CustomButtonEntity;
import cn.autoform.db.entity.FormsettingEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
 
import java.lang.reflect.Field;
import java.util.List;
 
@Data
@AllArgsConstructor
@NoArgsConstructor
@Slf4j
public class AutoPowerButton {
 
    private List<CustomButtonEntity> show;
 
    private List<String> hide;
 
    public void hide(FormsettingEntity result) {
        hide.stream().forEach(hideName->{
            try {
                Field field = result.getClass().getDeclaredField(hideName);
                field.setAccessible(true);
                field.set(result, "0");
            } catch (NoSuchFieldException|IllegalAccessException e) {
                log.error(e.getMessage(), e);
            }
        });
    }
}