toBase64() 改变字符串的编码
IdUtil.simpleUUID(); 不带-
IdUtil.randomUUID(); 带-
(详情博客有)
@ApiModelProperty(value = "盐", hidden = true)
hiddrn --> 在文档中隐藏起来
响应信息类:
private static final int CODE_SUCCESSFUL = 0;
private static final int CODE_ERRPR = -1;
因为内容不变 , 又是响应的信息类 所以 static final
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
在接口文档里面若时间格式不对就
用mybatis_plus记得配置
@Configuration
@MapperScan("mapper路径")
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
开启链式编程注解
@Accessors(chain = true)
AOP
JoinPoint类 封装了切面的相关方法
System.out.println("目标方法名为:" + joinPoint.getSignature().getName());
System.out.println("目标方法所属类的简单类名:" + joinPoint.getSignature().getDeclaringType().getSimpleName());
System.out.println("目标方法所属类的类名:" + joinPoint.getSignature().getDeclaringTypeName());
System.out.println("目标方法声明类型:" + Modifier.toString(joinPoint.getSignature().getModifiers()));
System.out.println("被代理的对象:" + joinPoint.getTarget());
System.out.println("代理对象自己:" + joinPoint.getThis());
AOP模板(可直接cv):
@Aspect
public class AnnotationAspect {
/**
* 这个表示 --> com.example.chiptest.controller下面的任意包(..)的任意类(*)的任意方法(*)的任意参数(..)
*/
@Pointcut("execution(* com.example.chiptest.controller..*.*(..)) ")
public void declareJoinPointerExpression() {
}
@Before("declareJoinPointerExpression()")
public void before(){
System.out.println("==========方法执行前(注解)==========");
}
@After("declareJoinPointerExpression()")
public void after(){
System.out.println("==========方法执行后(注解)==========");
}
}
Signature getSignature(); *获取封装了署名信息的对象,在该对象中可以获取到目标方法名,所属类的Class等信息* Object[] getArgs(); 获取传入目标方法的参数对象 Object getTarget(); 获取被代理的对象 Object getThis(); 获取代理对象
class类(反射)
getAnnotation()
此方法返回该元素的注解在此元素的指定注释类型(如果存在),否则返回null
builder() 类似于构造器 .builder()了就可以用自己想用的字段
@Builder 在实体类贴了这个注解才能.builder
计算机方法所花时间
System.currentTimeMillis()
执行时间 = 前 - 后
自定义注解格式
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Logs {
参数
}
写判断权限的(ju'ti)
@RestControllerAdvice 捕获各种异常 ,用文字描述
类实现ResponseBodyAdvice
supports()判断是否需要对结果进行包装
beforeBodyWrite()对结果进行包装处理逻辑
Hutool核心工具类之集合工具-CollUtil
常用方法:
具体看收藏的博客 , 主要用来拆分 , 区分
拓展方法:
.split("通过什么拆分")