Spring Boot中如何注解字段和使用SQL查询加密数据
发表于:2024-11-24 作者:热门IT资讯网编辑
编辑最后更新 2024年11月24日,1、注解字段:@Column(name = "phone", length = 100)@ColumnTransformer(read = "AES_DECRYPT(UNHEX(phone), 'ae
1、注解字段:
@Column(name = "phone", length = 100)
@ColumnTransformer(read = "AES_DECRYPT(UNHEX(phone), 'aes_phone')", write = "HEX(AES_ENCRYPT(?, 'aes_phone'))")
private String phone;
2、原生SQL 查询加密数据:
SELECT AES_DECRYPT(UNHEX(s.phone),'aes_phone') FROM TABLSE s