需求:
模型字段上使用 pro.shushi.pamirs.user.api.crypto.annotation.EncryptField 注解
模型动作上使用 pro.shushi.pamirs.user.api.crypto.annotation.NeedDecrypt 注解
示例:
对需要加密的字段添加@EncryptField注解
@Model.model(Student.MODEL_MODEL)
@Model(displayName = "学生", summary = "学生")
public class Student extends IdModel {
public static final String MODEL_MODEL = "top.Student";
@Field(displayName = "学生名字")
@Field.String
private String studentName;
@Field(displayName = "学生ID")
@Field.Integer
private Long studentId;
@Field(displayName = "学生卡号")
@Field.String
@EncryptField
private String studentCard;
}
对函数添加@NeedDecrypt注解
@Action.Advanced(name = FunctionConstants.create, managed = true)//默认取的是方法名
@Action(displayName = "确定", summary = "添加", bindingType = ViewTypeEnum.FORM)
@Function(name = FunctionConstants.create)//默认取的是方法名
@Function.fun(FunctionConstants.create)//默认取的是方法名
@NeedDecrypt
public Student create(Student data) {
String studentCard = data.getStudentCard();
if (studentCard != null) {
//自定义加密方法
data.setStudentCard(StudentEncoder.encode(studentCard));
}
return data.create();
}
Oinone社区 作者:yexiu原创文章,如若转载,请注明出处:https://doc.oinone.top/dai-ma-shi-jian/18227.html
访问Oinone官网:https://www.oinone.top获取数式Oinone低代码应用平台体验