未进行判空处理,增加了判断为空不进行校验

This commit is contained in:
Mr-wang 2023-11-14 17:42:36 +08:00
parent 67dcd110ba
commit bbffddcf6e

View File

@ -5,6 +5,7 @@ import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.dw.exec.event.ideimport.DataWindowValidateImport; import com.actionsoft.bpms.dw.exec.event.ideimport.DataWindowValidateImport;
import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql; import com.actionsoft.bpms.util.DBSql;
import org.apache.commons.lang.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -33,22 +34,24 @@ public class PermissionReadingDataWindowValidateEvent extends DataWindowValidate
* @author wangpf * @author wangpf
*/ */
private void mapNameSToIds(BO bo, Map<String, String> map, String permTypeName, int type) { private void mapNameSToIds(BO bo, Map<String, String> map, String permTypeName, int type) {
String[] names = permTypeName.split("\\s+|\\.|\\|\\,|@"); if (StringUtils.isNotEmpty(permTypeName)) {
String ids = ""; String[] names = permTypeName.split("\\s+|\\.|\\|\\,|@");
for (String name : names) { String ids = "";
String sql = generateSqlByType(type, name); for (String name : names) {
List<RowMap> maps = DBSql.getMaps(sql); String sql = generateSqlByType(type, name);
if (maps != null && maps.size() == 1) { List<RowMap> maps = DBSql.getMaps(sql);
ids += maps.get(0).getString("ID") + ","; if (maps != null && maps.size() == 1) {
} else { ids += maps.get(0).getString("ID") + ",";
if (type == 0) { } else {
map.put("ORGPERM", "" + name + "】,名称错误,请检查后再导入"); if (type == 0) {
} map.put("ORGPERM", "" + name + "】,名称错误,请检查后再导入");
if (type == 1) { }
map.put("POSTPERM", "" + name + "】,名称错误,请检查后再导入"); if (type == 1) {
} map.put("POSTPERM", "" + name + "】,名称错误,请检查后再导入");
if (type == 2) { }
map.put("LEVELPERM", "" + name + "】,名称错误,请检查后再导入"); if (type == 2) {
map.put("LEVELPERM", "" + name + "】,名称错误,请检查后再导入");
}
} }
} }
} }