提交 452db1e3 authored 作者:  狄熙卜's avatar 狄熙卜

修改错误拼写

上级 f5c2ec91
...@@ -28,17 +28,17 @@ public class CryptProperties { ...@@ -28,17 +28,17 @@ public class CryptProperties {
//entity中全局加解密字段的例外(在例外中不加解密) //entity中全局加解密字段的例外(在例外中不加解密)
private List<Map> globalDisableMapFields; private List<Map> globalDisableMapFields;
//sql加解密字段 //sql加解密字段
private List<Map> sqlFileds; private List<Map> sqlFields;
//sql仅加密字段 //sql仅加密字段
private List<Map> sqlEncryptFileds; private List<Map> sqlEncryptFields;
//sql仅解密字段 //sql仅解密字段
private List<Map> sqlDecryptFileds; private List<Map> sqlDecryptFields;
//实体加解密字段 //实体加解密字段
private List<Map> entityFileds; private List<Map> entityFields;
//sql参数为单独的string,对参数加密(等价于注解) //sql参数为单独的string,对参数加密(等价于注解)
private List<String> sqlSingleEncryptFileds; private List<String> sqlSingleEncryptFields;
//sql返回值为单独的string,对返回值加密(等价于注解) //sql返回值为单独的string,对返回值加密(等价于注解)
private List<String> sqlSingleDecryptFileds; private List<String> sqlSingleDecryptFields;
public CryptProperties(boolean cryptEnable) { public CryptProperties(boolean cryptEnable) {
this.cryptEnable = cryptEnable; this.cryptEnable = cryptEnable;
} }
...@@ -47,20 +47,20 @@ public class CryptProperties { ...@@ -47,20 +47,20 @@ public class CryptProperties {
this.cryptType = cryptType; this.cryptType = cryptType;
} }
public List<String> getSqlSingleEncryptFileds() { public List<String> getSqlSingleEncryptFields() {
return sqlSingleEncryptFileds; return sqlSingleEncryptFields;
} }
public void setSqlSingleEncryptFileds(List<String> sqlSingleEncryptFileds) { public void setSqlSingleEncryptFields(List<String> sqlSingleEncryptFields) {
this.sqlSingleEncryptFileds = sqlSingleEncryptFileds; this.sqlSingleEncryptFields = sqlSingleEncryptFields;
} }
public List<String> getSqlSingleDecryptFileds() { public List<String> getSqlSingleDecryptFields() {
return sqlSingleDecryptFileds; return sqlSingleDecryptFields;
} }
public void setSqlSingleDecryptFileds(List<String> sqlSingleDecryptFileds) { public void setSqlSingleDecryptFields(List<String> sqlSingleDecryptFields) {
this.sqlSingleDecryptFileds = sqlSingleDecryptFileds; this.sqlSingleDecryptFields = sqlSingleDecryptFields;
} }
public boolean isUserSm4KeyEnable() { public boolean isUserSm4KeyEnable() {
...@@ -144,36 +144,36 @@ public class CryptProperties { ...@@ -144,36 +144,36 @@ public class CryptProperties {
this.globalDisableMapFields = globalDisableMapFields; this.globalDisableMapFields = globalDisableMapFields;
} }
public List<Map> getSqlFileds() { public List<Map> getSqlFields() {
return sqlFileds; return sqlFields;
} }
public void setSqlFileds(List<Map> sqlFileds) { public void setSqlFields(List<Map> sqlFields) {
this.sqlFileds = sqlFileds; this.sqlFields = sqlFields;
} }
public List<Map> getSqlEncryptFileds() { public List<Map> getSqlEncryptFields() {
return sqlEncryptFileds; return sqlEncryptFields;
} }
public void setSqlEncryptFileds(List<Map> sqlEncryptFileds) { public void setSqlEncryptFields(List<Map> sqlEncryptFields) {
this.sqlEncryptFileds = sqlEncryptFileds; this.sqlEncryptFields = sqlEncryptFields;
} }
public List<Map> getSqlDecryptFileds() { public List<Map> getSqlDecryptFields() {
return sqlDecryptFileds; return sqlDecryptFields;
} }
public void setSqlDecryptFileds(List<Map> sqlDecryptFileds) { public void setSqlDecryptFields(List<Map> sqlDecryptFields) {
this.sqlDecryptFileds = sqlDecryptFileds; this.sqlDecryptFields = sqlDecryptFields;
} }
public List<Map> getEntityFileds() { public List<Map> getEntityFields() {
return entityFileds; return entityFields;
} }
public void setEntityFileds(List<Map> entityFileds) { public void setEntityFields(List<Map> entityFields) {
this.entityFileds = entityFileds; this.entityFields = entityFields;
} }
public boolean isEncryptDecryptEntityField(String entityName, String fieldName) { public boolean isEncryptDecryptEntityField(String entityName, String fieldName) {
...@@ -183,8 +183,8 @@ public class CryptProperties { ...@@ -183,8 +183,8 @@ public class CryptProperties {
if(isGlobalFields(null, entityName, fieldName)){ if(isGlobalFields(null, entityName, fieldName)){
return true; return true;
}else{ }else{
List<Map> entityFileds = getEntityFileds(); List<Map> entityFields = getEntityFields();
if(getEntityContainsField(entityFileds,entityName,fieldName)){ if(getEntityContainsField(entityFields,entityName,fieldName)){
return true; return true;
}else{ }else{
return false; return false;
...@@ -199,9 +199,9 @@ public class CryptProperties { ...@@ -199,9 +199,9 @@ public class CryptProperties {
if(isGlobalFields(mapid,null, fieldName)){ if(isGlobalFields(mapid,null, fieldName)){
return true; return true;
}else{ }else{
List<Map> sqlFileds = getSqlFileds(); List<Map> sqlFields = getSqlFields();
List<Map> sqlEncryptFileds = getSqlEncryptFileds(); List<Map> sqlEncryptFields = getSqlEncryptFields();
if(getMapContainsField(sqlFileds,mapid,fieldName) || getMapContainsField(sqlEncryptFileds,mapid,fieldName)){ if(getMapContainsField(sqlFields,mapid,fieldName) || getMapContainsField(sqlEncryptFields,mapid,fieldName)){
return true; return true;
}else{ }else{
return false; return false;
...@@ -216,9 +216,9 @@ public class CryptProperties { ...@@ -216,9 +216,9 @@ public class CryptProperties {
if(isGlobalFields(mapid,null, fieldName)){ if(isGlobalFields(mapid,null, fieldName)){
return true; return true;
}else{ }else{
List<Map> sqlFileds = getSqlFileds(); List<Map> sqlFields = getSqlFields();
List<Map> sqlDecryptFileds = getSqlDecryptFileds(); List<Map> sqlDecryptFields = getSqlDecryptFields();
if(getMapContainsField(sqlFileds,mapid,fieldName) || getMapContainsField(sqlDecryptFileds,mapid,fieldName)){ if(getMapContainsField(sqlFields,mapid,fieldName) || getMapContainsField(sqlDecryptFields,mapid,fieldName)){
return true; return true;
}else{ }else{
return false; return false;
......
...@@ -122,10 +122,10 @@ public class EncryptAdapterBuilder { ...@@ -122,10 +122,10 @@ public class EncryptAdapterBuilder {
} }
} }
} }
if(CollectionUtils.isNotEmpty(cryptProperties.getSqlSingleEncryptFileds())){ if(CollectionUtils.isNotEmpty(cryptProperties.getSqlSingleEncryptFields())){
for (String filed : cryptProperties.getSqlSingleEncryptFileds()) { for (String field : cryptProperties.getSqlSingleEncryptFields()) {
String name = method.getDeclaringClass().getName()+"."+method.getName(); String name = method.getDeclaringClass().getName()+"."+method.getName();
if(StringUtils.isNotBlank(name) && name.endsWith(filed)){ if(StringUtils.isNotBlank(name) && name.endsWith(field)){
return true; return true;
} }
} }
...@@ -166,10 +166,10 @@ public class EncryptAdapterBuilder { ...@@ -166,10 +166,10 @@ public class EncryptAdapterBuilder {
if(annotation != null){ if(annotation != null){
return true; return true;
} }
if(CollectionUtils.isNotEmpty(cryptProperties.getSqlSingleDecryptFileds())){ if(CollectionUtils.isNotEmpty(cryptProperties.getSqlSingleDecryptFields())){
for (String filed : cryptProperties.getSqlSingleDecryptFileds()) { for (String field : cryptProperties.getSqlSingleDecryptFields()) {
String name = method.getDeclaringClass().getName()+"."+method.getName(); String name = method.getDeclaringClass().getName()+"."+method.getName();
if(StringUtils.isNotBlank(name) && name.endsWith(filed)){ if(StringUtils.isNotBlank(name) && name.endsWith(field)){
return true; return true;
} }
} }
......
...@@ -126,24 +126,24 @@ public class EncryptInterceptor implements Interceptor { ...@@ -126,24 +126,24 @@ public class EncryptInterceptor implements Interceptor {
dbEncryptXmlConfig.getGlobalEnableFields(); dbEncryptXmlConfig.getGlobalEnableFields();
dbEncryptXmlConfig.getGlobalDisableMapFields(); dbEncryptXmlConfig.getGlobalDisableMapFields();
dbEncryptXmlConfig.getGlobalDisableEntityFields(); dbEncryptXmlConfig.getGlobalDisableEntityFields();
dbEncryptXmlConfig.getSqlFileds(); dbEncryptXmlConfig.getSqlFields();
dbEncryptXmlConfig.getSqlEncryptFileds(); dbEncryptXmlConfig.getSqlEncryptFields();
dbEncryptXmlConfig.getSqlDecryptFileds(); dbEncryptXmlConfig.getSqlDecryptFields();
dbEncryptXmlConfig.getEntityFileds(); dbEncryptXmlConfig.getEntityFields();
dbEncryptXmlConfig.getSqlSingleEncryptFileds(); dbEncryptXmlConfig.getSqlSingleEncryptFields();
dbEncryptXmlConfig.getSqlSingleDecryptFileds(); dbEncryptXmlConfig.getSqlSingleDecryptFields();
//添加预置的字段 //添加预置的字段
dbEncryptXmlConfig.addBaseConfigFileds(); dbEncryptXmlConfig.addBaseConfigFields();
//根据注解获取加解密配置 //根据注解获取加解密配置
dbEncryptXmlConfig.addAnnotationConfigFileds(); dbEncryptXmlConfig.addAnnotationConfigFields();
this.cryptProperties.setGlobalEnableFields(dbEncryptXmlConfig.getGlobalEnableFields()); this.cryptProperties.setGlobalEnableFields(dbEncryptXmlConfig.getGlobalEnableFields());
this.cryptProperties.setGlobalDisableMapFields(dbEncryptXmlConfig.getGlobalDisableMapFields()); this.cryptProperties.setGlobalDisableMapFields(dbEncryptXmlConfig.getGlobalDisableMapFields());
this.cryptProperties.setGlobalDisableEntityFields(dbEncryptXmlConfig.getGlobalDisableEntityFields()); this.cryptProperties.setGlobalDisableEntityFields(dbEncryptXmlConfig.getGlobalDisableEntityFields());
this.cryptProperties.setSqlFileds(dbEncryptXmlConfig.getSqlFileds()); this.cryptProperties.setSqlFields(dbEncryptXmlConfig.getSqlFields());
this.cryptProperties.setSqlEncryptFileds(dbEncryptXmlConfig.getSqlEncryptFileds()); this.cryptProperties.setSqlEncryptFields(dbEncryptXmlConfig.getSqlEncryptFields());
this.cryptProperties.setSqlDecryptFileds(dbEncryptXmlConfig.getSqlDecryptFileds()); this.cryptProperties.setSqlDecryptFields(dbEncryptXmlConfig.getSqlDecryptFields());
this.cryptProperties.setEntityFileds(dbEncryptXmlConfig.getEntityFileds()); this.cryptProperties.setEntityFields(dbEncryptXmlConfig.getEntityFields());
this.cryptProperties.setSqlSingleEncryptFileds(dbEncryptXmlConfig.getSqlSingleEncryptFileds()); this.cryptProperties.setSqlSingleEncryptFields(dbEncryptXmlConfig.getSqlSingleEncryptFields());
this.cryptProperties.setSqlSingleDecryptFileds(dbEncryptXmlConfig.getSqlSingleDecryptFileds()); this.cryptProperties.setSqlSingleDecryptFields(dbEncryptXmlConfig.getSqlSingleDecryptFields());
} }
} }
...@@ -108,8 +108,8 @@ public class CommonEncryptAdapter implements EncryptAdapter { ...@@ -108,8 +108,8 @@ public class CommonEncryptAdapter implements EncryptAdapter {
if (MapUtils.isEmpty(cryptFieldMap)) { if (MapUtils.isEmpty(cryptFieldMap)) {
return param; return param;
} }
Map<String, Crypt> needCryptFiledMap = this.getNeedCryptFiledMap(cryptFieldMap, example); Map<String, Crypt> needCryptFieldMap = this.getNeedCryptFieldMap(cryptFieldMap, example);
if (MapUtils.isEmpty(needCryptFiledMap)) { if (MapUtils.isEmpty(needCryptFieldMap)) {
return param; return param;
}*/ }*/
List<String> cryptFieldList = this.getCryptFieldList(fields,entityclass); List<String> cryptFieldList = this.getCryptFieldList(fields,entityclass);
......
...@@ -11,13 +11,13 @@ public @interface Encrypt { ...@@ -11,13 +11,13 @@ public @interface Encrypt {
//分组 分组之后才能进行加解密 //分组 分组之后才能进行加解密
String group(); String group();
//方法上使用的字段 对sql中的字段进行加解密 //方法上使用的字段 对sql中的字段进行加解密
String fileds() default ""; String fields() default "";
//方法上使用的字段 对sql中入参的字段进行加密 //方法上使用的字段 对sql中入参的字段进行加密
String encodeFileds() default ""; String encodeFields() default "";
//方法上使用的字段 对sql中返回值的字段进行解密 //方法上使用的字段 对sql中返回值的字段进行解密
String decodeFileds() default ""; String decodeFields() default "";
//方法上使用的字段 在只有一个参数时加密 //方法上使用的字段 在只有一个参数时加密
boolean singleEncryptFileds() default false; boolean singleEncryptFields() default false;
//方法上使用的字段 在只有一个参数时解密 //方法上使用的字段 在只有一个参数时解密
boolean singleDecryptFileds() default false; boolean singleDecryptFields() default false;
} }
...@@ -11,17 +11,17 @@ public interface BaseConfig { ...@@ -11,17 +11,17 @@ public interface BaseConfig {
//全局加密字段 正向 //全局加密字段 正向
List<String> getGlobalEnableFields(); List<String> getGlobalEnableFields();
//sql加解密字段 正向 //sql加解密字段 正向
List<Map> getSqlFileds(); List<Map> getSqlFields();
//sql加密字段 正向 //sql加密字段 正向
List<Map> getSqlEncryptFileds(); List<Map> getSqlEncryptFields();
//sql解密字段 正向 //sql解密字段 正向
List<Map> getSqlDecryptFileds(); List<Map> getSqlDecryptFields();
//实体加解密字段 正向 //实体加解密字段 正向
List<Map> getEntityFileds(); List<Map> getEntityFields();
//单一string作为参数加密 正向 //单一string作为参数加密 正向
List<String> getSqlSingleEncryptFileds(); List<String> getSqlSingleEncryptFields();
//单一string作为返回值解密 正向 //单一string作为返回值解密 正向
List<String> getSqlSingleDecryptFileds(); List<String> getSqlSingleDecryptFields();
//全局加密字段在sql中的反向配置(配置在其中的不进行加解密处理) 反向 //全局加密字段在sql中的反向配置(配置在其中的不进行加解密处理) 反向
List<Map> getGlobalDisableMapFields(); List<Map> getGlobalDisableMapFields();
......
...@@ -19,22 +19,22 @@ public class QlrConfig implements BaseConfig { ...@@ -19,22 +19,22 @@ public class QlrConfig implements BaseConfig {
} }
@Override @Override
public List<Map> getSqlFileds() { public List<Map> getSqlFields() {
return null; return null;
} }
@Override @Override
public List<Map> getSqlEncryptFileds() { public List<Map> getSqlEncryptFields() {
return null; return null;
} }
@Override @Override
public List<Map> getSqlDecryptFileds() { public List<Map> getSqlDecryptFields() {
return null; return null;
} }
@Override @Override
public List<Map> getEntityFileds() { public List<Map> getEntityFields() {
List<Map> result = new ArrayList<Map>(); List<Map> result = new ArrayList<Map>();
Map map = new HashMap<String,Object>(); Map map = new HashMap<String,Object>();
map.put("entity","cn.gtmap.bdcdj.core.entity.BdcZs"); map.put("entity","cn.gtmap.bdcdj.core.entity.BdcZs");
...@@ -44,12 +44,12 @@ public class QlrConfig implements BaseConfig { ...@@ -44,12 +44,12 @@ public class QlrConfig implements BaseConfig {
} }
@Override @Override
public List<String> getSqlSingleEncryptFileds() { public List<String> getSqlSingleEncryptFields() {
return null; return null;
} }
@Override @Override
public List<String> getSqlSingleDecryptFileds() { public List<String> getSqlSingleDecryptFields() {
return null; return null;
} }
......
...@@ -16,32 +16,32 @@ public class QlrlxdhConfig implements BaseConfig{ ...@@ -16,32 +16,32 @@ public class QlrlxdhConfig implements BaseConfig{
} }
@Override @Override
public List<Map> getSqlFileds() { public List<Map> getSqlFields() {
return null; return null;
} }
@Override @Override
public List<Map> getSqlEncryptFileds() { public List<Map> getSqlEncryptFields() {
return null; return null;
} }
@Override @Override
public List<Map> getSqlDecryptFileds() { public List<Map> getSqlDecryptFields() {
return null; return null;
} }
@Override @Override
public List<Map> getEntityFileds() { public List<Map> getEntityFields() {
return null; return null;
} }
@Override @Override
public List<String> getSqlSingleEncryptFileds() { public List<String> getSqlSingleEncryptFields() {
return null; return null;
} }
@Override @Override
public List<String> getSqlSingleDecryptFileds() { public List<String> getSqlSingleDecryptFields() {
return null; return null;
} }
......
...@@ -16,32 +16,32 @@ public class ZlConfig implements BaseConfig{ ...@@ -16,32 +16,32 @@ public class ZlConfig implements BaseConfig{
} }
@Override @Override
public List<Map> getSqlFileds() { public List<Map> getSqlFields() {
return null; return null;
} }
@Override @Override
public List<Map> getSqlEncryptFileds() { public List<Map> getSqlEncryptFields() {
return null; return null;
} }
@Override @Override
public List<Map> getSqlDecryptFileds() { public List<Map> getSqlDecryptFields() {
return null; return null;
} }
@Override @Override
public List<Map> getEntityFileds() { public List<Map> getEntityFields() {
return null; return null;
} }
@Override @Override
public List<String> getSqlSingleEncryptFileds() { public List<String> getSqlSingleEncryptFields() {
return null; return null;
} }
@Override @Override
public List<String> getSqlSingleDecryptFileds() { public List<String> getSqlSingleDecryptFields() {
return null; return null;
} }
......
...@@ -31,11 +31,11 @@ public class BeanCryptHandler implements CryptHandler<Object> { ...@@ -31,11 +31,11 @@ public class BeanCryptHandler implements CryptHandler<Object> {
LOGGER.error("BeanCryptHandler.encrypt.getresult"+var11.getMessage()); LOGGER.error("BeanCryptHandler.encrypt.getresult"+var11.getMessage());
} }
List<Field> filedList = this.getEncryptDecryptFields(result.getClass(),cryptProperties); List<Field> fieldList = this.getEncryptDecryptFields(result.getClass(),cryptProperties);
if (CollectionUtils.isEmpty(filedList)) { if (CollectionUtils.isEmpty(fieldList)) {
return bean; return bean;
} else { } else {
for (Field field : filedList) { for (Field field : fieldList) {
try { try {
field.setAccessible(true); field.setAccessible(true);
Object o = field.get(result); Object o = field.get(result);
...@@ -60,9 +60,9 @@ public class BeanCryptHandler implements CryptHandler<Object> { ...@@ -60,9 +60,9 @@ public class BeanCryptHandler implements CryptHandler<Object> {
if (param == null) { if (param == null) {
return null; return null;
} else { } else {
List<Field> filedList = this.getEncryptDecryptFields(param.getClass(),cryptProperties); List<Field> fieldList = this.getEncryptDecryptFields(param.getClass(),cryptProperties);
if(CollectionUtils.isNotEmpty(filedList)){ if(CollectionUtils.isNotEmpty(fieldList)){
for (Field field : filedList) { for (Field field : fieldList) {
try { try {
field.setAccessible(true); field.setAccessible(true);
Object o = field.get(param); Object o = field.get(param);
...@@ -83,9 +83,9 @@ public class BeanCryptHandler implements CryptHandler<Object> { ...@@ -83,9 +83,9 @@ public class BeanCryptHandler implements CryptHandler<Object> {
//对bean来说,加密字段和解密字段应该一致 //对bean来说,加密字段和解密字段应该一致
private List<Field> getEncryptDecryptFields(Class clazz, CryptProperties cryptProperties) { private List<Field> getEncryptDecryptFields(Class clazz, CryptProperties cryptProperties) {
List<Field> filedList = new ArrayList(); List<Field> fieldList = new ArrayList();
if (clazz == null) { if (clazz == null) {
return filedList; return fieldList;
} else { } else {
Field[] fields = clazz.getDeclaredFields(); Field[] fields = clazz.getDeclaredFields();
String fieldName = ""; String fieldName = "";
...@@ -94,11 +94,11 @@ public class BeanCryptHandler implements CryptHandler<Object> { ...@@ -94,11 +94,11 @@ public class BeanCryptHandler implements CryptHandler<Object> {
for (Field field : fields) { for (Field field : fields) {
fieldName = field.getName(); fieldName = field.getName();
if(cryptProperties.isEncryptDecryptEntityField(className,fieldName)){ if(cryptProperties.isEncryptDecryptEntityField(className,fieldName)){
filedList.add(field); fieldList.add(field);
} }
} }
} }
return filedList; return fieldList;
} }
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论