最新产品

This commit is contained in:
ZZX9599
2025-09-08 17:01:50 +08:00
commit 8056245ade
119 changed files with 8281 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package com.yj.earth.annotation;
import java.lang.annotation.*;
/**
* 返回结果加密注解
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface EncryptResponse {
/**
* 加密密钥的配置键
*/
String keyProperty() default "encrypt.aes.key";
/**
* 加密算法模式
*/
String algorithm() default "AES/CBC/PKCS5Padding";
}

View File

@ -0,0 +1,34 @@
package com.yj.earth.annotation;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.PropertyWriter;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 用于标记需要在JSON序列化时排除的字段
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ExcludeField {
/**
* Jackson 序列化过滤器、用于过滤被 @ExcludeField 注解标记的字段
*/
class Filter extends SimpleBeanPropertyFilter {
@Override
public void serializeAsField(Object pojo, JsonGenerator jsonGenerator, SerializerProvider provider, PropertyWriter writer) throws Exception {
// 检查字段是否有 @ExcludeField 注解、如果有则不序列化该字段
if (writer.getAnnotation(ExcludeField.class) != null) {
return;
}
// 没有注解的字段正常序列化
super.serializeAsField(pojo, jsonGenerator, provider, writer);
}
}
}

View File

@ -0,0 +1,16 @@
package com.yj.earth.annotation;
import java.lang.annotation.*;
/**
* 角色访问控制注解
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RoleAccess {
/**
* 允许访问的角色名称数组
*/
String[] roleNames();
}

View File

@ -0,0 +1,9 @@
package com.yj.earth.annotation;
import java.lang.annotation.*;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface SourceType {
String value();
}