提交 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;
......
...@@ -45,17 +45,17 @@ public class DbEncryptXmlConfig { ...@@ -45,17 +45,17 @@ public class DbEncryptXmlConfig {
//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;
//接口加解密列表 //接口加解密列表
private List<String> interfaceEncryptList; private List<String> interfaceEncryptList;
private String interfaceSm2DecodeKey;//接口加解密时,sm2解密的私钥 private String interfaceSm2DecodeKey;//接口加解密时,sm2解密的私钥
...@@ -89,28 +89,28 @@ public class DbEncryptXmlConfig { ...@@ -89,28 +89,28 @@ public class DbEncryptXmlConfig {
this.globalDisableMapFields = globalDisableMapFields; this.globalDisableMapFields = globalDisableMapFields;
} }
public void setSqlFileds(List<Map> sqlFileds) { public void setSqlFields(List<Map> sqlFields) {
this.sqlFileds = sqlFileds; this.sqlFields = sqlFields;
} }
public void setSqlEncryptFileds(List<Map> sqlEncryptFileds) { public void setSqlEncryptFields(List<Map> sqlEncryptFields) {
this.sqlEncryptFileds = sqlEncryptFileds; this.sqlEncryptFields = sqlEncryptFields;
} }
public void setSqlDecryptFileds(List<Map> sqlDecryptFileds) { public void setSqlDecryptFields(List<Map> sqlDecryptFields) {
this.sqlDecryptFileds = sqlDecryptFileds; this.sqlDecryptFields = sqlDecryptFields;
} }
public void setEntityFileds(List<Map> entityFileds) { public void setEntityFields(List<Map> entityFields) {
this.entityFileds = entityFileds; this.entityFields = entityFields;
} }
public void setSqlSingleEncryptFileds(List<String> sqlSingleEncryptFileds) { public void setSqlSingleEncryptFields(List<String> sqlSingleEncryptFields) {
this.sqlSingleEncryptFileds = sqlSingleEncryptFileds; this.sqlSingleEncryptFields = sqlSingleEncryptFields;
} }
public void setSqlSingleDecryptFileds(List<String> sqlSingleDecryptFileds) { public void setSqlSingleDecryptFields(List<String> sqlSingleDecryptFields) {
this.sqlSingleDecryptFileds = sqlSingleDecryptFileds; this.sqlSingleDecryptFields = sqlSingleDecryptFields;
} }
public void setInterfaceEncryptList(List<String> interfaceEncryptList) { public void setInterfaceEncryptList(List<String> interfaceEncryptList) {
...@@ -142,12 +142,12 @@ public class DbEncryptXmlConfig { ...@@ -142,12 +142,12 @@ public class DbEncryptXmlConfig {
setGlobalEnableFields(null); setGlobalEnableFields(null);
setGlobalDisableEntityFields(null); setGlobalDisableEntityFields(null);
setGlobalDisableMapFields(null); setGlobalDisableMapFields(null);
setSqlFileds(null); setSqlFields(null);
setSqlEncryptFileds(null); setSqlEncryptFields(null);
setSqlDecryptFileds(null); setSqlDecryptFields(null);
setEntityFileds(null); setEntityFields(null);
setSqlSingleEncryptFileds(null); setSqlSingleEncryptFields(null);
setSqlSingleDecryptFileds(null); setSqlSingleDecryptFields(null);
setInterfaceEncryptList(null); setInterfaceEncryptList(null);
setInterfaceSm2DecodeKey(null); setInterfaceSm2DecodeKey(null);
setInterfaceSm2EncodeKey(null); setInterfaceSm2EncodeKey(null);
...@@ -177,25 +177,25 @@ public class DbEncryptXmlConfig { ...@@ -177,25 +177,25 @@ public class DbEncryptXmlConfig {
return this.interfaceEncryptList; return this.interfaceEncryptList;
}else { }else {
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
list = getFieldsInOneFiled("IneterfaceEcnrypt", "patternUrl"); list = getFieldsInOneField("IneterfaceEcnrypt", "patternUrl");
this.interfaceEncryptList = list; this.interfaceEncryptList = list;
return list; return list;
} }
} }
public List<String> getSqlSingleEncryptFileds(){ public List<String> getSqlSingleEncryptFields(){
if(CollectionUtils.isNotEmpty(this.sqlSingleEncryptFileds)){ if(CollectionUtils.isNotEmpty(this.sqlSingleEncryptFields)){
return this.sqlSingleEncryptFileds; return this.sqlSingleEncryptFields;
}else{ }else{
this.sqlSingleEncryptFileds = getArrFields("SqlSingleEncryptFileds"); this.sqlSingleEncryptFields = getArrFields("SqlSingleEncryptFields");
return this.sqlSingleEncryptFileds; return this.sqlSingleEncryptFields;
} }
} }
public List<String> getSqlSingleDecryptFileds(){ public List<String> getSqlSingleDecryptFields(){
if(CollectionUtils.isNotEmpty(this.sqlSingleDecryptFileds)){ if(CollectionUtils.isNotEmpty(this.sqlSingleDecryptFields)){
return this.sqlSingleDecryptFileds; return this.sqlSingleDecryptFields;
}else{ }else{
this.sqlSingleDecryptFileds = getArrFields("SqlSingleDecryptFileds"); this.sqlSingleDecryptFields = getArrFields("SqlSingleDecryptFields");
return this.sqlSingleDecryptFileds; return this.sqlSingleDecryptFields;
} }
} }
...@@ -249,80 +249,80 @@ public class DbEncryptXmlConfig { ...@@ -249,80 +249,80 @@ public class DbEncryptXmlConfig {
return globalDisableEntityFields; return globalDisableEntityFields;
} }
public List<Map> getSqlFileds() { public List<Map> getSqlFields() {
if(sqlFileds == null){ if(sqlFields == null){
List<String> getSqlFiledsList = getArrFields("SqlFileds"); List<String> getSqlFieldsList = getArrFields("SqlFields");
if(CollectionUtils.isNotEmpty(getSqlFiledsList)){ if(CollectionUtils.isNotEmpty(getSqlFieldsList)){
sqlFileds = new ArrayList<Map>(); sqlFields = new ArrayList<Map>();
for (String s : getSqlFiledsList) { for (String s : getSqlFieldsList) {
int i = s.lastIndexOf("."); int i = s.lastIndexOf(".");
String mapid = s.substring(0, i); String mapid = s.substring(0, i);
String fieldName = s.substring(i+1); String fieldName = s.substring(i+1);
Map sqlFiledsMap = new HashMap<String,Object>(); Map sqlFieldsMap = new HashMap<String,Object>();
sqlFiledsMap.put("mapid",mapid); sqlFieldsMap.put("mapid",mapid);
sqlFiledsMap.put("field",fieldName); sqlFieldsMap.put("field",fieldName);
sqlFileds.add(sqlFiledsMap); sqlFields.add(sqlFieldsMap);
} }
} }
} }
return sqlFileds; return sqlFields;
} }
public List<Map> getSqlEncryptFileds() { public List<Map> getSqlEncryptFields() {
if(sqlEncryptFileds == null){ if(sqlEncryptFields == null){
List<String> getSqlEncryptFiledsList = getArrFields("SqlEncryptFileds"); List<String> getSqlEncryptFieldsList = getArrFields("SqlEncryptFields");
if(CollectionUtils.isNotEmpty(getSqlEncryptFiledsList)){ if(CollectionUtils.isNotEmpty(getSqlEncryptFieldsList)){
sqlEncryptFileds = new ArrayList<Map>(); sqlEncryptFields = new ArrayList<Map>();
for (String s : getSqlEncryptFiledsList) { for (String s : getSqlEncryptFieldsList) {
int i = s.lastIndexOf("."); int i = s.lastIndexOf(".");
String mapid = s.substring(0, i); String mapid = s.substring(0, i);
String fieldName = s.substring(i+1); String fieldName = s.substring(i+1);
Map sqlEncryptFiledsMap = new HashMap<String,Object>(); Map sqlEncryptFieldsMap = new HashMap<String,Object>();
sqlEncryptFiledsMap.put("mapid",mapid); sqlEncryptFieldsMap.put("mapid",mapid);
sqlEncryptFiledsMap.put("field",fieldName); sqlEncryptFieldsMap.put("field",fieldName);
sqlEncryptFileds.add(sqlEncryptFiledsMap); sqlEncryptFields.add(sqlEncryptFieldsMap);
} }
} }
} }
return sqlEncryptFileds; return sqlEncryptFields;
} }
public List<Map> getSqlDecryptFileds() { public List<Map> getSqlDecryptFields() {
if(sqlDecryptFileds == null){ if(sqlDecryptFields == null){
List<String> getSqlDecryptFiledsList = getArrFields("SqlDecryptFileds"); List<String> getSqlDecryptFieldsList = getArrFields("SqlDecryptFields");
if(CollectionUtils.isNotEmpty(getSqlDecryptFiledsList)){ if(CollectionUtils.isNotEmpty(getSqlDecryptFieldsList)){
sqlDecryptFileds = new ArrayList<Map>(); sqlDecryptFields = new ArrayList<Map>();
for (String s : getSqlDecryptFiledsList) { for (String s : getSqlDecryptFieldsList) {
int i = s.lastIndexOf("."); int i = s.lastIndexOf(".");
String mapid = s.substring(0, i); String mapid = s.substring(0, i);
String fieldName = s.substring(i+1); String fieldName = s.substring(i+1);
Map sqlDecryptFiledsMap = new HashMap<String,Object>(); Map sqlDecryptFieldsMap = new HashMap<String,Object>();
sqlDecryptFiledsMap.put("mapid",mapid); sqlDecryptFieldsMap.put("mapid",mapid);
sqlDecryptFiledsMap.put("field",fieldName); sqlDecryptFieldsMap.put("field",fieldName);
sqlDecryptFileds.add(sqlDecryptFiledsMap); sqlDecryptFields.add(sqlDecryptFieldsMap);
} }
} }
} }
return sqlDecryptFileds; return sqlDecryptFields;
} }
public List<Map> getEntityFileds() { public List<Map> getEntityFields() {
if(entityFileds == null){ if(entityFields == null){
List<String> getEntityFiledsList = getArrFields("EntityFileds"); List<String> getEntityFieldsList = getArrFields("EntityFields");
if(CollectionUtils.isNotEmpty(getEntityFiledsList)){ if(CollectionUtils.isNotEmpty(getEntityFieldsList)){
entityFileds = new ArrayList<Map>(); entityFields = new ArrayList<Map>();
for (String s : getEntityFiledsList) { for (String s : getEntityFieldsList) {
int i = s.lastIndexOf("."); int i = s.lastIndexOf(".");
String mapid = s.substring(0, i); String mapid = s.substring(0, i);
String fieldName = s.substring(i+1); String fieldName = s.substring(i+1);
Map entityFiledsMap = new HashMap<String,Object>(); Map entityFieldsMap = new HashMap<String,Object>();
entityFiledsMap.put("entity",mapid); entityFieldsMap.put("entity",mapid);
entityFiledsMap.put("field",fieldName); entityFieldsMap.put("field",fieldName);
entityFileds.add(entityFiledsMap); entityFields.add(entityFieldsMap);
} }
} }
} }
return entityFileds; return entityFields;
} }
...@@ -361,7 +361,7 @@ public class DbEncryptXmlConfig { ...@@ -361,7 +361,7 @@ public class DbEncryptXmlConfig {
} }
return result; return result;
} }
public List<String> getFieldsInOneFiled(String fieldName,String secondFieldName){ public List<String> getFieldsInOneField(String fieldName,String secondFieldName){
SAXReader sr = new SAXReader(); SAXReader sr = new SAXReader();
Document document = null; Document document = null;
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<String>();
...@@ -451,7 +451,7 @@ public class DbEncryptXmlConfig { ...@@ -451,7 +451,7 @@ public class DbEncryptXmlConfig {
/** /**
* 从java文件中读取预置的加解密字段 * 从java文件中读取预置的加解密字段
*/ */
public void addBaseConfigFileds() { public void addBaseConfigFields() {
List<String> baseConfigOptions = this.getBaseConfigOptions(); List<String> baseConfigOptions = this.getBaseConfigOptions();
if(CollectionUtils.isNotEmpty(baseConfig)){ if(CollectionUtils.isNotEmpty(baseConfig)){
for (BaseConfig config : baseConfig) { for (BaseConfig config : baseConfig) {
...@@ -466,46 +466,46 @@ public class DbEncryptXmlConfig { ...@@ -466,46 +466,46 @@ public class DbEncryptXmlConfig {
globalEnableFields.addAll(config.getGlobalEnableFields()); globalEnableFields.addAll(config.getGlobalEnableFields());
} }
//预置的sql加解密字段(正向配置) //预置的sql加解密字段(正向配置)
if(CollectionUtils.isNotEmpty(config.getSqlFileds())){ if(CollectionUtils.isNotEmpty(config.getSqlFields())){
if(CollectionUtils.isEmpty(sqlFileds)){ if(CollectionUtils.isEmpty(sqlFields)){
sqlFileds = new ArrayList<Map>(); sqlFields = new ArrayList<Map>();
} }
sqlFileds.addAll(config.getSqlFileds()); sqlFields.addAll(config.getSqlFields());
} }
//预置的sql加密字段(正向配置) //预置的sql加密字段(正向配置)
if(CollectionUtils.isNotEmpty(config.getSqlEncryptFileds())){ if(CollectionUtils.isNotEmpty(config.getSqlEncryptFields())){
if(CollectionUtils.isEmpty(sqlEncryptFileds)){ if(CollectionUtils.isEmpty(sqlEncryptFields)){
sqlEncryptFileds = new ArrayList<Map>(); sqlEncryptFields = new ArrayList<Map>();
} }
sqlEncryptFileds.addAll(config.getSqlEncryptFileds()); sqlEncryptFields.addAll(config.getSqlEncryptFields());
} }
//预置的sql解密字段(正向配置) //预置的sql解密字段(正向配置)
if(CollectionUtils.isNotEmpty(config.getSqlDecryptFileds())){ if(CollectionUtils.isNotEmpty(config.getSqlDecryptFields())){
if(CollectionUtils.isEmpty(sqlDecryptFileds)){ if(CollectionUtils.isEmpty(sqlDecryptFields)){
sqlDecryptFileds = new ArrayList<Map>(); sqlDecryptFields = new ArrayList<Map>();
} }
sqlDecryptFileds.addAll(config.getSqlDecryptFileds()); sqlDecryptFields.addAll(config.getSqlDecryptFields());
} }
//预置的实体加解密字段(正向配置) //预置的实体加解密字段(正向配置)
if(CollectionUtils.isNotEmpty(config.getEntityFileds())){ if(CollectionUtils.isNotEmpty(config.getEntityFields())){
if(CollectionUtils.isEmpty(entityFileds)){ if(CollectionUtils.isEmpty(entityFields)){
entityFileds = new ArrayList<Map>(); entityFields = new ArrayList<Map>();
} }
entityFileds.addAll(config.getEntityFileds()); entityFields.addAll(config.getEntityFields());
} }
//单一string作为参数加密(正向配置) //单一string作为参数加密(正向配置)
if(CollectionUtils.isNotEmpty(config.getSqlSingleEncryptFileds())){ if(CollectionUtils.isNotEmpty(config.getSqlSingleEncryptFields())){
if(CollectionUtils.isEmpty(sqlSingleEncryptFileds)){ if(CollectionUtils.isEmpty(sqlSingleEncryptFields)){
sqlSingleEncryptFileds = new ArrayList<String>(); sqlSingleEncryptFields = new ArrayList<String>();
} }
sqlSingleEncryptFileds.addAll(config.getSqlSingleEncryptFileds()); sqlSingleEncryptFields.addAll(config.getSqlSingleEncryptFields());
} }
//单一string作为返回值解密(正向配置) //单一string作为返回值解密(正向配置)
if(CollectionUtils.isNotEmpty(config.getSqlSingleDecryptFileds())){ if(CollectionUtils.isNotEmpty(config.getSqlSingleDecryptFields())){
if(CollectionUtils.isEmpty(sqlSingleDecryptFileds)){ if(CollectionUtils.isEmpty(sqlSingleDecryptFields)){
sqlSingleDecryptFileds = new ArrayList<String>(); sqlSingleDecryptFields = new ArrayList<String>();
} }
sqlSingleDecryptFileds.addAll(config.getSqlSingleDecryptFileds()); sqlSingleDecryptFields.addAll(config.getSqlSingleDecryptFields());
} }
//全局加密字段在sql中的反向配置(配置在其中的不进行加解密处理) 反向配置 //全局加密字段在sql中的反向配置(配置在其中的不进行加解密处理) 反向配置
//不需要做特殊处理逻辑,因为在判断是否为加解密字段时,判断顺序为:是否为全局加解密字段-》是否为全局非加解密字段-》是否为加解密字段,所以是否为加解密字段本身优先级高于全局配置,不需要在此处根据已有的是否为加解密字段配置调整是否为全局非加解密字段 //不需要做特殊处理逻辑,因为在判断是否为加解密字段时,判断顺序为:是否为全局加解密字段-》是否为全局非加解密字段-》是否为加解密字段,所以是否为加解密字段本身优先级高于全局配置,不需要在此处根据已有的是否为加解密字段配置调整是否为全局非加解密字段
...@@ -571,7 +571,7 @@ public class DbEncryptXmlConfig { ...@@ -571,7 +571,7 @@ public class DbEncryptXmlConfig {
this.annoSqlPackage = annoSqlPackage; this.annoSqlPackage = annoSqlPackage;
} }
public void addAnnotationConfigFileds() { public void addAnnotationConfigFields() {
long begin = System.currentTimeMillis(); long begin = System.currentTimeMillis();
//获取注解加解密总开关 //获取注解加解密总开关
if(!isAnnoEnable()){ if(!isAnnoEnable()){
...@@ -589,7 +589,7 @@ public class DbEncryptXmlConfig { ...@@ -589,7 +589,7 @@ public class DbEncryptXmlConfig {
.setUrls(ClasspathHelper.forPackage(annoEntityPackage)) .setUrls(ClasspathHelper.forPackage(annoEntityPackage))
.addScanners(new FieldAnnotationsScanner())); .addScanners(new FieldAnnotationsScanner()));
Set<Field> encryptAnnoFields = ref.getFieldsAnnotatedWith(Encrypt.class); Set<Field> encryptAnnoFields = ref.getFieldsAnnotatedWith(Encrypt.class);
List<Map> annoEntityFileds = new ArrayList<Map>(); List<Map> annoEntityFields = new ArrayList<Map>();
if (CollectionUtils.isNotEmpty(encryptAnnoFields)) { if (CollectionUtils.isNotEmpty(encryptAnnoFields)) {
for (Field field : encryptAnnoFields) { for (Field field : encryptAnnoFields) {
Encrypt annotation = field.getAnnotation(Encrypt.class); Encrypt annotation = field.getAnnotation(Encrypt.class);
...@@ -604,14 +604,14 @@ public class DbEncryptXmlConfig { ...@@ -604,14 +604,14 @@ public class DbEncryptXmlConfig {
Map map = new HashMap<String, Object>(); Map map = new HashMap<String, Object>();
map.put("entity", className); map.put("entity", className);
map.put("field", field.getName()); map.put("field", field.getName());
annoEntityFileds.add(map); annoEntityFields.add(map);
} }
} }
if (CollectionUtils.isNotEmpty(annoEntityFileds)) { if (CollectionUtils.isNotEmpty(annoEntityFields)) {
if (CollectionUtils.isEmpty(entityFileds)) { if (CollectionUtils.isEmpty(entityFields)) {
entityFileds = new ArrayList<Map>(); entityFields = new ArrayList<Map>();
} }
entityFileds.addAll(annoEntityFileds); entityFields.addAll(annoEntityFields);
} }
} }
...@@ -632,21 +632,21 @@ public class DbEncryptXmlConfig { ...@@ -632,21 +632,21 @@ public class DbEncryptXmlConfig {
return; return;
} }
//sql加解密字段 //sql加解密字段
List<Map> annoSqlFileds = new ArrayList<Map>(); List<Map> annoSqlFields = new ArrayList<Map>();
//sql仅加密字段 //sql仅加密字段
List<Map> annoSqlEncryptFileds = new ArrayList<Map>(); List<Map> annoSqlEncryptFields = new ArrayList<Map>();
//sql仅解密字段 //sql仅解密字段
List<Map> annoSqlDecryptFileds = new ArrayList<Map>(); List<Map> annoSqlDecryptFields = new ArrayList<Map>();
//sql参数为单独的string,对参数加密(等价于注解) //sql参数为单独的string,对参数加密(等价于注解)
List<String> annoSqlSingleEncryptFileds = new ArrayList<String>(); List<String> annoSqlSingleEncryptFields = new ArrayList<String>();
//sql返回值为单独的string,对返回值加密(等价于注解) //sql返回值为单独的string,对返回值加密(等价于注解)
List<String> annoSqlSingleDecryptFileds = new ArrayList<String>(); List<String> annoSqlSingleDecryptFields = new ArrayList<String>();
//处理方法上的Encrypt注解 //处理方法上的Encrypt注解
if(CollectionUtils.isNotEmpty(enctyptMethods)){ if(CollectionUtils.isNotEmpty(enctyptMethods)){
for (Method method : enctyptMethods) { for (Method method : enctyptMethods) {
Encrypt annotation = method.getAnnotation(Encrypt.class); Encrypt annotation = method.getAnnotation(Encrypt.class);
getFieldsFromAnno(annoSqlFileds,annoSqlEncryptFileds,annoSqlDecryptFileds,annoSqlSingleEncryptFileds, getFieldsFromAnno(annoSqlFields,annoSqlEncryptFields,annoSqlDecryptFields,annoSqlSingleEncryptFields,
annoSqlSingleDecryptFileds,method,annotation); annoSqlSingleDecryptFields,method,annotation);
} }
} }
//处理方法上的Encrypts注解 //处理方法上的Encrypts注解
...@@ -656,46 +656,46 @@ public class DbEncryptXmlConfig { ...@@ -656,46 +656,46 @@ public class DbEncryptXmlConfig {
Encrypt[] value = annotation.value(); Encrypt[] value = annotation.value();
if(value != null && value.length > 0){ if(value != null && value.length > 0){
for (Encrypt encrypt : value) { for (Encrypt encrypt : value) {
getFieldsFromAnno(annoSqlFileds,annoSqlEncryptFileds,annoSqlDecryptFileds,annoSqlSingleEncryptFileds, getFieldsFromAnno(annoSqlFields,annoSqlEncryptFields,annoSqlDecryptFields,annoSqlSingleEncryptFields,
annoSqlSingleDecryptFileds,method,encrypt); annoSqlSingleDecryptFields,method,encrypt);
} }
} }
} }
} }
//预置的sql加解密字段(正向配置) //预置的sql加解密字段(正向配置)
if(CollectionUtils.isNotEmpty(annoSqlFileds)){ if(CollectionUtils.isNotEmpty(annoSqlFields)){
if(CollectionUtils.isEmpty(sqlFileds)){ if(CollectionUtils.isEmpty(sqlFields)){
sqlFileds = new ArrayList<Map>(); sqlFields = new ArrayList<Map>();
} }
sqlFileds.addAll(annoSqlFileds); sqlFields.addAll(annoSqlFields);
} }
//预置的sql加密字段(正向配置) //预置的sql加密字段(正向配置)
if(CollectionUtils.isNotEmpty(annoSqlEncryptFileds)){ if(CollectionUtils.isNotEmpty(annoSqlEncryptFields)){
if(CollectionUtils.isEmpty(sqlEncryptFileds)){ if(CollectionUtils.isEmpty(sqlEncryptFields)){
sqlEncryptFileds = new ArrayList<Map>(); sqlEncryptFields = new ArrayList<Map>();
} }
sqlEncryptFileds.addAll(annoSqlEncryptFileds); sqlEncryptFields.addAll(annoSqlEncryptFields);
} }
//预置的sql解密字段(正向配置) //预置的sql解密字段(正向配置)
if(CollectionUtils.isNotEmpty(annoSqlDecryptFileds)){ if(CollectionUtils.isNotEmpty(annoSqlDecryptFields)){
if(CollectionUtils.isEmpty(sqlDecryptFileds)){ if(CollectionUtils.isEmpty(sqlDecryptFields)){
sqlDecryptFileds = new ArrayList<Map>(); sqlDecryptFields = new ArrayList<Map>();
} }
sqlDecryptFileds.addAll(annoSqlDecryptFileds); sqlDecryptFields.addAll(annoSqlDecryptFields);
} }
//单一string作为参数加密(正向配置) //单一string作为参数加密(正向配置)
if(CollectionUtils.isNotEmpty(annoSqlSingleEncryptFileds)){ if(CollectionUtils.isNotEmpty(annoSqlSingleEncryptFields)){
if(CollectionUtils.isEmpty(sqlSingleEncryptFileds)){ if(CollectionUtils.isEmpty(sqlSingleEncryptFields)){
sqlSingleEncryptFileds = new ArrayList<String>(); sqlSingleEncryptFields = new ArrayList<String>();
} }
sqlSingleEncryptFileds.addAll(annoSqlSingleEncryptFileds); sqlSingleEncryptFields.addAll(annoSqlSingleEncryptFields);
} }
//单一string作为返回值解密(正向配置) //单一string作为返回值解密(正向配置)
if(CollectionUtils.isNotEmpty(annoSqlSingleDecryptFileds)){ if(CollectionUtils.isNotEmpty(annoSqlSingleDecryptFields)){
if(CollectionUtils.isEmpty(sqlSingleDecryptFileds)){ if(CollectionUtils.isEmpty(sqlSingleDecryptFields)){
sqlSingleDecryptFileds = new ArrayList<String>(); sqlSingleDecryptFields = new ArrayList<String>();
} }
sqlSingleDecryptFileds.addAll(annoSqlSingleDecryptFileds); sqlSingleDecryptFields.addAll(annoSqlSingleDecryptFields);
} }
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
LOGGER.error("anno scan used time:"+(end-begin)); LOGGER.error("anno scan used time:"+(end-begin));
...@@ -704,63 +704,63 @@ public class DbEncryptXmlConfig { ...@@ -704,63 +704,63 @@ public class DbEncryptXmlConfig {
/** /**
* 同时提供方法和注解参数,便于代码的复用 * 同时提供方法和注解参数,便于代码的复用
* @param annoSqlFileds * @param annoSqlFields
* @param annoSqlEncryptFileds * @param annoSqlEncryptFields
* @param annoSqlDecryptFileds * @param annoSqlDecryptFields
* @param annoSqlSingleEncryptFileds * @param annoSqlSingleEncryptFields
* @param annoSqlSingleDecryptFileds * @param annoSqlSingleDecryptFields
* @param method * @param method
* @param annotation * @param annotation
*/ */
private void getFieldsFromAnno(List<Map> annoSqlFileds,List<Map> annoSqlEncryptFileds,List<Map> annoSqlDecryptFileds, private void getFieldsFromAnno(List<Map> annoSqlFields,List<Map> annoSqlEncryptFields,List<Map> annoSqlDecryptFields,
List<String> annoSqlSingleEncryptFileds,List<String> annoSqlSingleDecryptFileds,Method method,Encrypt annotation){ List<String> annoSqlSingleEncryptFields,List<String> annoSqlSingleDecryptFields,Method method,Encrypt annotation){
if(annotation == null || !annoGroupNames.contains(annotation.group())){ if(annotation == null || !annoGroupNames.contains(annotation.group())){
return; return;
} }
String className = method.getDeclaringClass().getName(); String className = method.getDeclaringClass().getName();
String fileds = annotation.fileds();//注解的加解密属性处理 String Fields = annotation.fields();//注解的加解密属性处理
if(StringUtils.isNotBlank(fileds)){ if(StringUtils.isNotBlank(Fields)){
String[] split = fileds.split(","); String[] split = Fields.split(",");
if(split != null && split.length > 0){ if(split != null && split.length > 0){
for (String s : split) { for (String s : split) {
Map sqlFiledMap = new HashMap<String,Object>(); Map sqlFieldMap = new HashMap<String,Object>();
sqlFiledMap.put("mapid",className+"."+method.getName()); sqlFieldMap.put("mapid",className+"."+method.getName());
sqlFiledMap.put("field",s); sqlFieldMap.put("field",s);
annoSqlFileds.add(sqlFiledMap); annoSqlFields.add(sqlFieldMap);
} }
} }
} }
String encodeFileds = annotation.encodeFileds();//注解的加密属性处理 String encodeFields = annotation.encodeFields();//注解的加密属性处理
if(StringUtils.isNotBlank(encodeFileds)){ if(StringUtils.isNotBlank(encodeFields)){
String[] split = encodeFileds.split(","); String[] split = encodeFields.split(",");
if(split != null && split.length > 0){ if(split != null && split.length > 0){
for (String s : split) { for (String s : split) {
Map sqlEncryptFiledMap = new HashMap<String, Object>(); Map sqlEncryptFieldMap = new HashMap<String, Object>();
sqlEncryptFiledMap.put("mapid", className+"."+method.getName()); sqlEncryptFieldMap.put("mapid", className+"."+method.getName());
sqlEncryptFiledMap.put("field", s); sqlEncryptFieldMap.put("field", s);
annoSqlEncryptFileds.add(sqlEncryptFiledMap); annoSqlEncryptFields.add(sqlEncryptFieldMap);
} }
} }
} }
String decodeFileds = annotation.decodeFileds();//注解的解密属性处理 String decodeFields = annotation.decodeFields();//注解的解密属性处理
if(StringUtils.isNotBlank(decodeFileds)){ if(StringUtils.isNotBlank(decodeFields)){
String[] split = decodeFileds.split(","); String[] split = decodeFields.split(",");
if(split != null && split.length > 0) { if(split != null && split.length > 0) {
for (String s : split) { for (String s : split) {
Map sqlDecryptFiledMap = new HashMap<String, Object>(); Map sqlDecryptFieldMap = new HashMap<String, Object>();
sqlDecryptFiledMap.put("mapid", className+"."+method.getName()); sqlDecryptFieldMap.put("mapid", className+"."+method.getName());
sqlDecryptFiledMap.put("field", s); sqlDecryptFieldMap.put("field", s);
annoSqlDecryptFileds.add(sqlDecryptFiledMap); annoSqlDecryptFields.add(sqlDecryptFieldMap);
} }
} }
} }
boolean singleEncrypt = annotation.singleEncryptFileds();//注解的仅一个参数加密属性 boolean singleEncrypt = annotation.singleEncryptFields();//注解的仅一个参数加密属性
if(singleEncrypt){ if(singleEncrypt){
annoSqlSingleEncryptFileds.add(className+"."+method.getName()); annoSqlSingleEncryptFields.add(className+"."+method.getName());
} }
boolean singleDecrypt = annotation.singleDecryptFileds();//注解的仅有要给返回值解密属性 boolean singleDecrypt = annotation.singleDecryptFields();//注解的仅有要给返回值解密属性
if(singleDecrypt){ if(singleDecrypt){
annoSqlSingleDecryptFileds.add(className+"."+method.getName()); annoSqlSingleDecryptFields.add(className+"."+method.getName());
} }
} }
} }
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论