From 370b26066c560f15f6a84caca2be149e48e86556 Mon Sep 17 00:00:00 2001
From: 田源 <tianyuan@vci-tech.com>
Date: 星期二, 07 一月 2025 15:52:05 +0800
Subject: [PATCH] 系统菜单 默认显示&&系统配置、对象建模按钮权限以及按钮图标
---
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java | 177 ++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 110 insertions(+), 67 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
index 2601a7f..15ecbdd 100644
--- a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
@@ -15,21 +15,23 @@
import com.vci.omd.utils.ObjectTool;
import com.vci.pagemodel.*;
import com.vci.starter.web.annotation.Column;
+import com.vci.starter.web.annotation.VciFieldType;
import com.vci.starter.web.constant.QueryOptionConstant;
import com.vci.starter.web.enumpck.BooleanEnum;
+import com.vci.starter.web.enumpck.VciFieldTypeEnum;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.PageHelper;
import com.vci.starter.web.util.BeanUtilForVCI;
import com.vci.starter.web.util.Lcm.Func;
import com.vci.starter.web.util.VciBaseUtil;
+import com.vci.starter.web.util.VciDateUtil;
import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
import com.vci.web.properties.WebProperties;
import com.vci.web.service.*;
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.math3.distribution.TDistribution;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.slf4j.Logger;
@@ -118,6 +120,23 @@
*/
public static final Map<String,String> BO_BASE_FIELD_MAP = new HashMap<>();
+ /**
+ * 鍙互淇敼鍊肩殑榛樿灞炴��
+ */
+ public static final List<String> EDIT_BASE_FIELD_LIST = new ArrayList<String>(){{
+ add("id");
+ add("name");
+ add("description");
+ add("lcstatus");
+ add("revisionvalue");
+ add("versionvalue");
+ add("copyfromversion");
+ add("lastr");
+ add("firstr");
+ add("lastv");
+ add("firstv");
+ }};
+
public WebBoServiceImpl(){
List<Field> fields = WebUtil.getAllFieldForObj(BusinessObject.class);
if(!CollectionUtils.isEmpty(fields)) {
@@ -170,7 +189,7 @@
String userName = WebUtil.getCurrentUserId();
BusinessObject bo = new BusinessObject();
bo.oid = (new ObjectUtility()).getNewObjectID36();
- bo.revisionid = (new ObjectUtility()).getNewObjectID36();
+ bo.revoid = (new ObjectUtility()).getNewObjectID36();
bo.nameoid = (new ObjectUtility()).getNewObjectID36();
bo.btName = boName;
bo.isLastR = true;
@@ -243,7 +262,7 @@
if(cbo !=null){
BusinessObject businessObject = new BusinessObject();
businessObject.oid = new ObjectUtility().getNewObjectID36();
- businessObject.revisionid = new ObjectUtility().getNewObjectID36();
+ businessObject.revoid = new ObjectUtility().getNewObjectID36();
businessObject.nameoid = new ObjectUtility().getNewObjectID36();
businessObject.btName = cbo.btName;
businessObject.isLastR = cbo.isLastR;
@@ -288,7 +307,7 @@
private AttributeValue[] clone(AttributeValue[] newAttrValList) {
AttributeValue[] n = new AttributeValue[newAttrValList.length];
for (int i = 0; i < newAttrValList.length; i++) {
- n[i] = new AttributeValue(newAttrValList[i].attrName,newAttrValList[i].attrVal);
+ n[i] = new AttributeValue(newAttrValList[i].name,newAttrValList[i].value);
}
return n;
}
@@ -553,7 +572,7 @@
// 涓�灞傚弬鐓� a.b
// 绗簩涓弬鏁扮粰绌猴紝鏄涓嶅浠庡睘鎬т腑鏌ュ叾鍙傛暟鐨勪笟鍔$被鍨嬶紝鐢变笅涓嬩笓鐢ㄦ帄涓繘琛屽鐞�
BtmRefQueryOption refOpt = new BtmRefQueryOption(
- kvs[0], "", new String[]{kvs[1]}
+ kvs[0], "", new String[]{kvs[1]}
);
refOpts.add(refOpt);
} else if(len == 3){
@@ -563,7 +582,7 @@
// 涓夊眰浠ョ殑鍙傜収 a.b.c.d a.b.c.d.e
// TODO 闇�瑕佹敮鎸佷笁灞備互鍙婁互涓婄殑鍙傜収
}
- }else if(attrName.indexOf("_")>-1
+ }else if(attrName.indexOf("_")>-1
&& !"lcStatus_text".toLowerCase().equalsIgnoreCase(attrName.toLowerCase())){
enumAttrName.add(attrName);
}else{
@@ -596,8 +615,6 @@
ObjectQueryService.FindBTMObjectsV3Result bos = qtService.findBTMObjectsV3(qt.getId(), OQTool.qtTOXMl(qt).asXML(), refOpts.toArray(new BtmRefQueryOption[refOpts.size()]));
if (bos != null && bos.count > 0) {
for (BusinessObject bo : bos.returnValue) {
-// BusinessObject cbo = new BusinessObject();
-// cbo = bo;
queryEnumText(bo,enumAttrName);
allCbos.add(bo);
}
@@ -614,8 +631,8 @@
AttributeValue[] attributeValueList = new AttributeValue[attributeValues.length];
for (int i = 0; i < attributeValues.length; i++) {
AttributeValue newAttributeValue = new AttributeValue();
- newAttributeValue.attrName = attributeValues[i].attrName;
- newAttributeValue.attrVal = attributeValues[i].attrVal;
+ newAttributeValue.name = attributeValues[i].name;
+ newAttributeValue.value = attributeValues[i].value;
attributeValueList[i] = newAttributeValue;
}
return attributeValueList;
@@ -700,7 +717,7 @@
Map<String, OsStatusVO> statusVOMap = statusService.selectAllStatusMap();
cbos.stream().forEach(cbo->{
try{
- ObjectTool.setBOAttributeValue(cbo,"lcStatus_text", statusVOMap.getOrDefault(cbo.lcStatus,new OsStatusVO()).getName());
+ ObjectTool.setBOAttributeValue(cbo,"lcStatus_text".toLowerCase(), statusVOMap.getOrDefault(cbo.lcStatus,new OsStatusVO()).getName());
}catch(Exception e){
logger.error("鑾峰彇鐢熷懡鍛ㄦ湡涓姸鎬佺殑鏄剧ず鏂囨湰鍑洪敊",e);
}
@@ -728,7 +745,7 @@
@Override
public void queryEnumText(BusinessObject cbo, LinkObject clo, List<String> enumAttrName) throws VciBaseException{
if(enumAttrName.size()>0){//鏌ヨ鏋氫妇
- for(String enumAttr:enumAttrName){//鏍煎紡涓� code_field code鏄灇涓剧殑缂栫爜锛宖ield鏄綋鍓嶄笟鍔$被鍨嬪瓨鍌ㄦ灇涓惧�肩殑瀛楁
+ for(String enumAttr : enumAttrName){//鏍煎紡涓� code_field code鏄灇涓剧殑缂栫爜锛宖ield鏄綋鍓嶄笟鍔$被鍨嬪瓨鍌ㄦ灇涓惧�肩殑瀛楁
if(enumAttr.toLowerCase().equals("creator_name")){
//鍒涘缓浜虹殑鍚嶇О
String creator = "";
@@ -770,18 +787,20 @@
String enumCode = tempArray[0];//鏋氫妇缂栫爜
if (tempArray.length > 1) {
//浠庢灇涓句腑鑾峰彇鍊�
- String valueFieldName = tempArray[1];
+ String valueFieldName = tempArray[1];//鏋氫妇鍦ㄤ笟鍔$被鍨嬩笂瀛樻斁鐨勫睘鎬�
String comboxField = "";
if(valueFieldName.contains("#")){
valueFieldName = tempArray[1].split("#")[0];
comboxField = tempArray[1].split("#")[1];
}
+ //鑾峰彇鏋氫妇椤�
String enumKey = "";
if (cbo != null) {
enumKey = ObjectTool.getBOAttributeValue(cbo,valueFieldName);
} else if (clo != null) {
enumKey = ObjectTool.getLOAttributeValue(clo,valueFieldName);
}
+ //鑾峰彇鏋氫妇椤圭殑涓枃鏄剧ず
String enumText = "";
if (WebUtil.isNotNull(enumKey)) {
enumText = enumService.getValue(enumCode, enumKey);
@@ -843,8 +862,8 @@
for (i = 0; i < attrValList.size(); ++i) {
attrVal = (AttributeValue) attrValList.get(i);
- if (attrVal.attrName.toUpperCase().equals(attributeName.toUpperCase())) {
- attrVal.attrVal = attributeValue;
+ if (attrVal.name.toUpperCase().equals(attributeName.toUpperCase())) {
+ attrVal.value = attributeValue;
isExist = true;
break;
}
@@ -852,8 +871,8 @@
if (!isExist) {
attrVal = new AttributeValue();
- attrVal.attrName = attributeName.toUpperCase();
- attrVal.attrVal = attributeValue;
+ attrVal.name = attributeName.toUpperCase();
+ attrVal.value = attributeValue;
attrValList.add(attrVal);
}
@@ -994,9 +1013,8 @@
* @throws VciBaseException 鏌ヨ鍑洪敊浼氭姏鍑哄紓甯�
*/
@Override
- public List<BusinessObject> queryCBOByScheme(String queryScheme,
- Map<String, String> conditionMap, Map<String, Object> replaceMap,
- PageHelper ph, List<String> clauseList) throws VciBaseException {
+ public List<BusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, Object> replaceMap,
+ PageHelper ph, List<String> clauseList) throws VciBaseException {
QueryTemplate qt = getQtByName(queryScheme,replaceMap);
return baseQueryCBO(qt,conditionMap,ph,clauseList);
}
@@ -1155,7 +1173,7 @@
/**
* 鍙敤sql璇彞鏌ヨ锛岃繖涓拰queryBySqlForMap鍖哄埆鏄紝鐗规畩鐨剆ql(濡傚寘鍚湁鍑芥暟鐨�)鍙互鐢ㄨ繖涓柟娉曪紝浣嗘槸鏈塻ql娉ㄥ叆椋庨櫓
* @param sql sql璇彞锛屾煡璇㈡潯浠跺繀椤昏嚜琛屽湪鍏朵腑澶勭悊瀹屾垚
- * @return 鏁版嵁鏄犲皠
+ * @return 鏁版嵁鏄犲皠銆侻ap涓紝key鍊间负澶у啓銆�
* @throws VciBaseException 鏌ヨ鍑洪敊娲绘姏鍑哄紓甯�
*/
@Override
@@ -1198,13 +1216,32 @@
List<Map> allData = queryByOnlySqlForMap(sql);
//闇�瑕佽浆鎹竴涓媍bo鐨勯偅涓睘鎬�
Map<String/**涓氬姟绫诲瀷涓殑瀛楁*/, String/**灞炴�ч噷鐨勫瓧娈�**/> fieldNameMap = WebUtil.getFieldNameMap(tClass);
+ Map<String, Field> fieldMap = WebUtil.getFieldMapForObject(tClass);
List<T> dataList = new ArrayList<>();
if(!CollectionUtils.isEmpty(allData)){
allData.stream().forEach(data->{
Map thisData = new HashMap();
if(!CollectionUtils.isEmpty(data)){
data.forEach((key,value)->{
- thisData.put(fieldNameMap.getOrDefault(((String)key).toLowerCase(Locale.ROOT), (String) key),value);
+ String fieldName = fieldNameMap.getOrDefault(((String)key).toLowerCase(Locale.ROOT), (String) key);
+ String fieldValue = String.valueOf(value);
+ if(fieldMap.containsKey(fieldName)){
+ Field field = fieldMap.get(fieldName);
+ if(field.isAnnotationPresent(VciFieldType.class)){
+ VciFieldType vciFieldType = field.getAnnotation(VciFieldType.class);
+ VciFieldTypeEnum vciFieldTypeEnum = vciFieldType.value();
+ if(VciFieldTypeEnum.VTDateTime.equals(vciFieldTypeEnum) && StringUtils.isNotBlank(fieldValue)){
+ fieldValue = VciDateUtil.date2Str(VciDateUtil.long2Date(Long.parseLong(fieldValue)), VciDateUtil.DateTimeFormat);
+ }
+ if(VciFieldTypeEnum.VTDate.equals(vciFieldTypeEnum) && StringUtils.isNotBlank(fieldValue)){
+ fieldValue = VciDateUtil.date2Str(VciDateUtil.long2Date(Long.parseLong(fieldValue)), VciDateUtil.DateFormat);
+ }
+ if(VciFieldTypeEnum.VTTime.equals(vciFieldTypeEnum) && StringUtils.isNotBlank(fieldValue)){
+ fieldValue = VciDateUtil.date2Str(VciDateUtil.long2Date(Long.parseLong(fieldValue)), VciDateUtil.TimeFormat);
+ }
+ }
+ }
+ thisData.put(fieldName,fieldValue);
});
}
try {
@@ -1224,7 +1261,7 @@
* 鏍规嵁sql璇彞鏉ユ煡璇㈠唴瀹癸紝杩斿洖Map----sql涓嶈兘鏄痵elect * 鎴栬�� select t.*
* @param sql 涓轰簡闃叉SQL娉ㄥ叆锛屽�煎繀椤诲湪sql璇彞閲屼互:xxx鏍煎紡锛屽 id =:idvalue锛岀劧鍚庡湪conditionMap涓坊鍔犲缓涓篿dvalue鐨勬牸寮�
* @param conditionMap 鏌ヨ鏉′欢锛屽繀椤讳笌sql閲屽搴�
- * @return 涓氬姟鏁版嵁鐨勬槧灏�
+ * @return 涓氬姟鏁版嵁鐨勬槧灏勩��
* @throws VciBaseException 鏌ヨ鍑洪敊浼氭姏鍑哄紓甯�
*/
@Override
@@ -1234,7 +1271,7 @@
}
/**
- * 鍜屼笂涓柟娉曚竴鏍凤紝澶氫紶浜嗘煡璇㈠瓧娈� selectKeys
+ * 鍜屼笂涓柟娉曚竴鏍凤紝澶氫紶浜嗘煡璇㈠瓧娈� selectKeys銆俿ql涓嶈兘鏄痵elect * 鎴栬�� select t.*
* @param sql sql璇彞
* @param conditionMap 鏌ヨ鏉′欢
* @param selectKeys 鏌ヨ鐨勫瓧娈�
@@ -1272,7 +1309,7 @@
ava = new AttributeValue[0];
}
try {
- String[][] results =platformClientUtil.getSqlQueryService(sql, ava);
+ String[][] results = platformClientUtil.getSqlQueryService(sql, ava);
if(results.length>0){
if(selectKeys==null) {
String selectSql = sql.substring(sql.toLowerCase(Locale.ROOT).indexOf("select") + 6, sql.toLowerCase(Locale.ROOT).indexOf(" from")).trim();
@@ -1345,35 +1382,32 @@
swapConditionMap(c,conditionMap);
//鑾峰彇瑕佹煡璇㈢殑鎵�鏈夌殑鍒�
Map<String,String> allFieldAttrMap = WebUtil.getFieldNameMap(c);
- if(!allFieldAttrMap.containsKey("lctid")){
- allFieldAttrMap.put("lctid","lctid");
+ //淇敼allFieldAttrMap闆嗗悎涓殑key鐨勫ぇ灏忓啓
+ List<String> queryAttr = new ArrayList<String>();
+ Iterator<String> it = allFieldAttrMap.keySet().iterator();
+ while(it.hasNext()){
+ queryAttr.add(it.next());
}
- List<String> queryAttr = new ArrayList<String>();
- Iterator<String> it = allFieldAttrMap.keySet().iterator();
- while(it.hasNext()){
- queryAttr.add(it.next());
- }
- for(String columnName:queryAttr){
- String fieldName = allFieldAttrMap.get(columnName);
- allFieldAttrMap.remove(columnName);
+ for(String columnName : queryAttr){
+ String fieldName = allFieldAttrMap.get(columnName);
+ allFieldAttrMap.remove(columnName);
allFieldAttrMap.put(columnName.toLowerCase(),fieldName);
}
+
List<T> allObject = new ArrayList<T>();
- List<BusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//鎵ц鏌ヨ
- List<String> oids = new ArrayList<String>();
-
- if(allCbos!=null&&allCbos.size()>0){
+ List<String> clauseList = new ArrayList<>(allFieldAttrMap.keySet());
+
+ List<BusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c).toLowerCase(), conditionMap, ph, clauseList);
+ if(!CollectionUtils.isEmpty(allCbos)){
for(BusinessObject cbo : allCbos){
T obj = null;
try {
obj = c.newInstance();
- WebUtil.copyValueToObjectFromCbos(cbo, obj,allFieldAttrMap);//涓轰簡灏戝幓鏌ヨ涓�娆″瓧娈�
- } catch (InstantiationException e) {
+ WebUtil.copyValueToObjectFromCbos(cbo, obj, allFieldAttrMap);//涓轰簡灏戝幓鏌ヨ涓�娆″瓧娈�
+ } catch (Exception e) {
- } catch (IllegalAccessException e) {
}
if(obj !=null){
- oids.add(cbo.oid);
allObject.add(obj);
}
}
@@ -1453,6 +1487,7 @@
swapConditionMap(c,conditionMap);
//鑾峰彇瑕佹煡璇㈢殑鎵�鏈夌殑鍒�
Map<String,String> allFieldAttrMap = WebUtil.getFieldNameMap(c);
+ //淇敼allFieldAttrMap闆嗗悎涓殑key鐨勫ぇ灏忓啓
List<String> queryAttr = new ArrayList<String>();
Iterator<String> it = allFieldAttrMap.keySet().iterator();
while(it.hasNext()){
@@ -1463,18 +1498,18 @@
allFieldAttrMap.remove(columnName);
allFieldAttrMap.put(columnName.toLowerCase(),fieldName);
}
+ List<String> clauseList = new ArrayList<>(allFieldAttrMap.keySet());
List<T> allObject = new ArrayList<T>();
- List<BusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));
+ List<BusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, clauseList);
List<String> oids = new ArrayList<String>();
- if(allCbos!=null&&allCbos.size()>0){
+ if(allCbos != null && allCbos.size() > 0){
for(BusinessObject cbo : allCbos){
T obj = null;
try {
obj = c.newInstance();
WebUtil.copyValueToObjectFromCbos(cbo, obj,allFieldAttrMap);//涓轰簡灏戝幓鏌ヨ涓�娆″瓧娈�
- } catch (InstantiationException e) {
+ } catch (Exception e) {
- } catch (IllegalAccessException e) {
}
if(obj !=null){
oids.add(cbo.oid);
@@ -1597,11 +1632,15 @@
if(isEdit && checkUnAttrUnEdit(attrName)){
//缂栬緫鐨勬椂鍊欙紝TS鍜孫ID涓嶈兘璁剧疆.鍥犱负骞冲彴閭f帴鍙h缃簡灏变細鎶ラ敊
}else {
- //闇�瑕佸垽鏂槸鍚﹂粯璁ょ殑灞炴�э紝濡傛灉鏄粯璁ゅ睘鎬э紝鍒欎娇鐢ㄥ璞$殑璧嬪�肩殑鏂瑰紡
- if (WebUtil.isDefaultField(fieldName) && WebUtil.inArray(new String[]{"id", "name", "description","lcstatus","revisionvalue","versionvalue"}, fieldName.toLowerCase())) {
- WebUtil.setValueToField(fieldName, cbo, value);
- ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value);
- } else {
+ //闇�瑕佸垽鏂槸鍚﹂粯璁ょ殑灞炴�э紝濡傛灉鏄紝鍒欎娇鐢ㄥ璞$殑璧嬪�肩殑鏂瑰紡
+ if (WebUtil.isDefaultField(fieldName.toLowerCase())) {
+ WebUtil.setValueToCboField(fieldName, cbo, value);
+ //鍒ゆ柇鏄惁涓哄彲浠ヤ慨鏀圭殑榛樿灞炴��
+ if(EDIT_BASE_FIELD_LIST.contains(fieldName.toLowerCase())){
+ //闇�瑕佹敞鎰忥紝榛樿灞炴�т腑锛岄儴鍒嗗睘鎬у悕绉帮紝鍜屾暟鎹簱涓殑瀛楁涓嶄竴鏍凤紝闇�瑕佽浆鎹�
+ ObjectTool.setBOAttributeValue(cbo, VciQueryWrapperForDO.BASE_MODEL_COMPATIBILITY_MAP.getOrDefault(fieldName.toLowerCase(),fieldName.toLowerCase()), value);
+ }
+ }else{
ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value);
}
}
@@ -1752,13 +1791,20 @@
public <T> BatchCBO delete(T obj) throws VciBaseException {
return delete(obj,true);
}
+
+ /**
+ * 鍒犻櫎鏁版嵁锛屽彲浠ュ湪request閲岃缃笉鎸佷箙鍖�
+ * @param obj 鍒犻櫎鏁版嵁瀵硅薄
+ * @param checkRefered 鏄惁鍒犻櫎寮曠敤鐨勬暟鎹�
+ * @return 闇�瑕佸垱寤虹殑CBO,CLO;闇�瑕佷慨鏀圭殑CBO,CLO;闇�瑕佸垹闄ょ殑CBO,CLO
+ * @throws VciBaseException
+ */
@Override
public <T> BatchCBO delete(T obj,boolean checkRefered) throws VciBaseException{
List<T> list = new ArrayList<T>();
list.add(obj);
return batchDelete(list,checkRefered);
}
-
/**
* 鎵归噺鍒犻櫎鏁版嵁锛屽彲浠ュ湪request閲岃缃笉鎸佷箙鍖�
@@ -1796,9 +1842,8 @@
String btmType = WebUtil.getBtmTypeByObject(obj.getClass());
String pkValue = WebUtil.getValueFromFieldForCbo(pkField, obj);
//鎵�浠ヨ繖閲屼篃鏄洿鎺ユ煡璇㈢殑鍗曚釜'
- List<BusinessObject> deleteCbos = queryCBO(btmType, getOneQuery(
- WebUtil.getCboAttrNameFromField(pkField, obj.getClass()), pkValue));
- if(deleteCbos!=null){
+ List<BusinessObject> deleteCbos = queryCBO(btmType, getOneQuery(WebUtil.getCboAttrNameFromField(pkField, obj.getClass()), pkValue));
+ if(!CollectionUtils.isEmpty(deleteCbos)){
allDeleteCbos.addAll(deleteCbos);
if(!btmBos.containsKey(btmType)){
btmBos.put(btmType, deleteCbos);
@@ -1894,15 +1939,14 @@
conditionMap.put(QUERY_FILTER_SECRET,BooleanEnum.FASLE.getValue());//鏌ヨ鐨勬椂鍊欎笉鑳芥煡璇㈠瘑绾�
List<BusinessObject> allCbos = queryCBO(btmType, conditionMap);
BatchCBO batchCbo = new BatchCBO();
- if(allCbos.size()>0){
+ if(!CollectionUtils.isEmpty(allCbos)){
Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>();
btmBos.put(btmType, allCbos);
checkCanDelete(btmBos);
- Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>();
- allDeleteCbos.addAll(allCbos);
+ Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(allCbos);
batchCbo.setDeleteCbos(allDeleteCbos);
}
- if(allCbos.size()>0 && WebUtil.isPersistence()){
+ if(!CollectionUtils.isEmpty(allCbos) && WebUtil.isPersistence()){
persistenceBatch(batchCbo);
}
return batchCbo;
@@ -1931,7 +1975,7 @@
selectSql += ",btmname ";
}
sql = selectSql + fromSql;
- List<BusinessObject> allDelete =queryBySql(sql, conditionMap);
+ List<BusinessObject> allDelete = queryBySql(sql, conditionMap);
if(allDelete.size() == 0){
return batchCbo;//娌℃湁鍒犻櫎浠讳綍鏁版嵁
}
@@ -2002,7 +2046,6 @@
return queryGridByBo(btmType,conditionMap,new PageHelper(-1,true));
}
-
/**
* 鏍规嵁涓氬姟绫诲瀷鏉ユ煡璇㈠垪琛ㄦ暟鎹紱鍙互鍦╬ageHelper涓缃槸鍚︽煡璇㈡�绘暟
* @param btmType 涓氬姟绫诲瀷鍚嶇О
@@ -2015,7 +2058,7 @@
public DataGrid queryGridByBo(String btmType,
Map<String, String> conditionMap, PageHelper ph)
throws VciBaseException {
- return queryGridByBo(btmType,conditionMap,ph,null);
+ return queryGridByBo(btmType,conditionMap,ph,new ArrayList<String>());
}
/**
@@ -2037,7 +2080,7 @@
}
List<BusinessObject> allCbos = queryCBO(btmType, conditionMap, ph, clauseList);
DataGrid dg = new DataGrid();
- if(allCbos.size()>0){
+ if(!CollectionUtils.isEmpty(allCbos)){
List<Map> mapList = cbos2Map(allCbos);
dg.setData(mapList);
//鑲畾鏄綋鍓嶅垎椤垫湁鍊硷紝鎵嶄細鏈夋�绘暟
@@ -2357,9 +2400,9 @@
if (bo.newAttrValList != null) {
for (int i = 0; i < bo.newAttrValList.length; ++i) {
AttributeValue av = bo.newAttrValList[i];
- if (WebUtil.isNormalAttr(av.attrName)) {
- if(av.attrVal == null){
- av.attrVal = "";
+ if (WebUtil.isNormalAttr(av.name)) {
+ if(av.value == null){
+ av.value = "";
}
newAttr.add(av);
}
--
Gitblit v1.9.3