代码提交
parent
2ad1d3fe28
commit
a81291f3c0
@ -0,0 +1,24 @@
|
|||||||
|
package com.baiye.util;
|
||||||
|
|
||||||
|
import javax.persistence.AttributeConverter;
|
||||||
|
import javax.persistence.Converter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YQY
|
||||||
|
* @date : 2022/01/12
|
||||||
|
*/
|
||||||
|
@Converter
|
||||||
|
public class JpaConverterAes implements AttributeConverter<Object, String> {
|
||||||
|
|
||||||
|
private final String secret = "ad-platform";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String convertToDatabaseColumn(Object obj) {
|
||||||
|
return AESUtils.encrypt((String) obj, secret);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object convertToEntityAttribute(String s) {
|
||||||
|
return AESUtils.decrypt(s,secret);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue