diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java index 3abca9d..8587e20 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java @@ -1,11 +1,14 @@ package com.cm.common.plugin.controller.routes.dynamic; import com.cm.common.base.AbstractController; +import com.cm.common.component.SecurityComponent; import com.cm.common.constants.ISystemConstant; import com.cm.common.plugin.enums.dynamic.FieldTypeEnum; import com.cm.common.plugin.pojo.dtos.dynamic.DynamicFormFormShowFieldDTO; import com.cm.common.plugin.service.datadictionary.IDataDictionaryService; import com.cm.common.plugin.service.dynamic.IDynamicFormService; +import com.cm.common.pojo.bos.RoleBO; +import com.cm.common.pojo.bos.UserInfoBO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -42,6 +45,8 @@ public class DynamicFormRouteController extends AbstractController { private IDynamicFormService dynamicFormService; @Autowired private IDataDictionaryService dataDictionaryService; + @Autowired + private SecurityComponent securityComponent; @ApiOperation(value = "动态表单新增页面", notes = "动态表单新增页面接口") @ApiImplicitParams({ @@ -55,6 +60,7 @@ public class DynamicFormRouteController extends AbstractController { List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs); setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); + setCurrentUserIdAndNameValues(mv, dynamicFormFormShowFieldDTOs); return mv; } @@ -140,4 +146,34 @@ public class DynamicFormRouteController extends AbstractController { return mv; } + /** + * 设置ID和名称值:当前用户、部门、角色、组、职位等 + * + * @param mv + */ + private void setCurrentUserIdAndNameValues(ModelAndView mv, List dynamicFormFormShowFieldDTOs) { + dynamicFormFormShowFieldDTOs.forEach(dynamicFormFormShowFieldDTO -> { + if (StringUtils.equals(FieldTypeEnum.CURRENT_USER.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + mv.addObject("userIdAndValue", String.format("%s|%s", securityComponent.getCurrentUser().getUserId(), securityComponent.getCurrentUser().getUserName())); + mv.addObject("userNameValue", securityComponent.getCurrentUser().getUserName()); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_DEPARTMENT.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + String departmentIdAndNamesValue = securityComponent.getCurrentUser().getDepartmentIdAndNamesValue(); + mv.addObject("departmentIdAndNamesValue", departmentIdAndNamesValue); + mv.addObject("departmentNamesValue", departmentIdAndNamesValue.isEmpty() ? departmentIdAndNamesValue : departmentIdAndNamesValue.split("\\|")[1]); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_ROLE.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + String roleIdAndNamesValue = securityComponent.getCurrentUser().getRoleIdAndNamesValue(); + mv.addObject("roleIdAndNamesValue", roleIdAndNamesValue); + mv.addObject("roleNamesValue", roleIdAndNamesValue.isEmpty() ? roleIdAndNamesValue : roleIdAndNamesValue.split("\\|")[1]); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_GROUP.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + String groupIdAndNamesValue = securityComponent.getCurrentUser().getGroupIdAndNamesValue(); + mv.addObject("groupIdAndNamesValue", groupIdAndNamesValue); + mv.addObject("groupNamesValue", groupIdAndNamesValue.isEmpty() ? groupIdAndNamesValue : groupIdAndNamesValue.split("\\|")[1]); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_POSITION.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + String positionIdAndNamesValue = securityComponent.getCurrentUser().getPositionIdAndNamesValue(); + mv.addObject("positionIdAndNamesValue", positionIdAndNamesValue); + mv.addObject("positionNamesValue", positionIdAndNamesValue.isEmpty() ? positionIdAndNamesValue : positionIdAndNamesValue.split("\\|")[1]); + } + }); + } + } diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/enums/database/table/ColumnDataTypeEnum.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/enums/database/table/ColumnDataTypeEnum.java index 167a670..06201c8 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/enums/database/table/ColumnDataTypeEnum.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/enums/database/table/ColumnDataTypeEnum.java @@ -47,7 +47,15 @@ public enum ColumnDataTypeEnum { /** * 长文本 */ - LONGTEXT("longtext"); + LONGTEXT("longtext"), + /** + * ID和名称 + */ + ID_AND_NAME("idAndName"), + /** + * ID列表和名称列表 + */ + IDS_AND_NAMES("idsAndNames"); private String dataType; diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/enums/dynamic/FieldTypeEnum.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/enums/dynamic/FieldTypeEnum.java index 2fdeb9f..3fb7ea9 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/enums/dynamic/FieldTypeEnum.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/enums/dynamic/FieldTypeEnum.java @@ -79,7 +79,27 @@ public enum FieldTypeEnum { /** * 右联 */ - RIGHT_JOIN("rightJoin"); + RIGHT_JOIN("rightJoin"), + /** + * 当前用户 + */ + CURRENT_USER("currentUser"), + /** + * 当前部门 + */ + CURRENT_DEPARTMENT("currentDepartment"), + /** + * 当前角色 + */ + CURRENT_ROLE("currentRole"), + /** + * 当前组 + */ + CURRENT_GROUP("currentGroup"), + /** + * 当前职位 + */ + CURRENT_POSITION("currentPosition"); private String value; diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java index 0e0f37c..2ec6644 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java @@ -41,6 +41,7 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF @Autowired private IDynamicTableService dynamicTableService; + @Override public void saveDynamicForm(DynamicFormVO dynamicFormVO) throws SaveException { saveDynamicFormInfo(dynamicFormVO); @@ -420,6 +421,16 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF } else if (StringUtils.equals(FieldTypeEnum.RIGHT_JOIN.getValue(), dynamicFormFieldVO.getFieldType())) { tableColumnVO.setDataType(ColumnDataTypeEnum.VARCHAR.getDataType()); tableColumnVO.setColumnLength(255); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_USER.getValue(), dynamicFormFieldVO.getFieldType())) { + tableColumnVO.setDataType(ColumnDataTypeEnum.ID_AND_NAME.getDataType()); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_DEPARTMENT.getValue(), dynamicFormFieldVO.getFieldType())) { + tableColumnVO.setDataType(ColumnDataTypeEnum.IDS_AND_NAMES.getDataType()); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_ROLE.getValue(), dynamicFormFieldVO.getFieldType())) { + tableColumnVO.setDataType(ColumnDataTypeEnum.IDS_AND_NAMES.getDataType()); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_GROUP.getValue(), dynamicFormFieldVO.getFieldType())) { + tableColumnVO.setDataType(ColumnDataTypeEnum.IDS_AND_NAMES.getDataType()); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_POSITION.getValue(), dynamicFormFieldVO.getFieldType())) { + tableColumnVO.setDataType(ColumnDataTypeEnum.IDS_AND_NAMES.getDataType()); } return tableColumnVO; } diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicTableServiceImpl.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicTableServiceImpl.java index 8560588..c24df89 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicTableServiceImpl.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicTableServiceImpl.java @@ -123,6 +123,10 @@ public class DynamicTableServiceImpl extends AbstractService implements IDynamic } else if (StringUtils.equals(tableColumn.getDataType(), ColumnDataTypeEnum.LONGTEXT.getDataType())) { columnSql.append(String.format("`%s` LONGTEXT DEFAULT NULL", WStringUtil.lowerUpper2UnderLine(tableColumn.getColumnName()), tableColumn.getColumnLength())); notNull = false; + } else if (StringUtils.equals(tableColumn.getDataType(), ColumnDataTypeEnum.ID_AND_NAME.getDataType()) + || StringUtils.equals(tableColumn.getDataType(), ColumnDataTypeEnum.IDS_AND_NAMES.getDataType())) { + columnSql.append(String.format("`%s` VARCHAR(500) DEFAULT NULL", WStringUtil.lowerUpper2UnderLine(tableColumn.getColumnName()), tableColumn.getColumnLength())); + notNull = false; } if (notNull && StringUtils.equals(tableColumn.getIsNullable(), ColumnIsNullableEnum.YES.getIsNullable())) { columnSql.append(" NOT NULL"); diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/listdynamicform.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/listdynamicform.html index ebe731d..25a4daa 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/listdynamicform.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/listdynamicform.html @@ -162,6 +162,21 @@ return value; } }); + } else if(item.fieldTyp === 'currentUser' + || item.fieldTyp === 'currentDepartment' + || item.fieldTyp === 'currentRole' + || item.fieldTyp === 'currentGroup' + || item.fieldTyp === 'currentPosition') { + autoCols.push({field: item.fieldName, width: 150, title: item.fieldExplain, align:'center', + templet: function(row) { + var currentData = row[this.field]; + if(typeof(currentData) === 'undefined' || currentData == null || currentData == '') { + return '-'; + } + var idAndNameValue = currentData; + return idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '无'; + } + }); } else { autoCols.push({field: item.fieldName, width: 150, title: item.fieldExplain, align:'center', templet: function(row) { diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/savedynamicform.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/savedynamicform.html index 121e74e..7141952 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/savedynamicform.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/savedynamicform.html @@ -122,6 +122,46 @@ + +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicform.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicform.html index d4ca10a..894d8bb 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicform.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicform.html @@ -122,6 +122,46 @@
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
@@ -427,6 +467,41 @@ }, function(code, data) { top.dialog.msg(data.msg); }); + } else if(item.fieldTyp === 'currentUser') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentUser'] = nameValue; + form.val('dataForm', formData); + } else if(item.fieldTyp === 'currentDepartment') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentDepartment'] = nameValue; + form.val('dataForm', formData); + } else if(item.fieldTyp === 'currentRole') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentRole'] = nameValue; + form.val('dataForm', formData); + } else if(item.fieldTyp === 'currentGroup') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentGroup'] = nameValue; + form.val('dataForm', formData); + } else if(item.fieldTyp === 'currentPosition') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentPosition'] = nameValue; + form.val('dataForm', formData); } } }, function(code, data) { diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html index 5341271..a3782b2 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html @@ -116,6 +116,46 @@
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
@@ -426,6 +466,41 @@ }, function(code, data) { top.dialog.msg(data.msg); }); + } else if(item.fieldTyp === 'currentUser') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentUser'] = nameValue; + form.val('dataForm', formData); + } else if(item.fieldTyp === 'currentDepartment') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentDepartment'] = nameValue; + form.val('dataForm', formData); + } else if(item.fieldTyp === 'currentRole') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentRole'] = nameValue; + form.val('dataForm', formData); + } else if(item.fieldTyp === 'currentGroup') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentGroup'] = nameValue; + form.val('dataForm', formData); + } else if(item.fieldTyp === 'currentPosition') { + var formData = {}; + var idAndNameValue = dataFormData[item.fieldName]; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + formData[item.fieldName] = idAndNameValue; + formData[item.fieldName +'CurrentPosition'] = nameValue; + form.val('dataForm', formData); } } }, function(code, data) { diff --git a/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java b/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java index 6f2dfc4..1790ddd 100644 --- a/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java +++ b/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java @@ -27,6 +27,10 @@ public class UserBO extends User { private List groups; private List departments; private List positions; + private String roleIdAndNamesValue; + private String groupIdAndNamesValue; + private String departmentIdAndNamesValue; + private String positionIdAndNamesValue; public UserBO() { super("", "", null); @@ -110,6 +114,17 @@ public class UserBO extends User { public void setRoles(List roles) { this.roles = roles; + StringBuilder idSB = new StringBuilder(); + StringBuilder nameSB = new StringBuilder(); + roles.forEach(roleBO -> { + if (idSB.length() > 0) { + idSB.append(","); + nameSB.append(","); + } + idSB.append(roleBO.getRoleId()); + nameSB.append(roleBO.getRoleName()); + }); + this.roleIdAndNamesValue = idSB.append("|").append(nameSB).toString(); } public List getGroups() { @@ -118,6 +133,17 @@ public class UserBO extends User { public void setGroups(List groups) { this.groups = groups; + StringBuilder idSB = new StringBuilder(); + StringBuilder nameSB = new StringBuilder(); + groups.forEach(groupBO -> { + if (idSB.length() > 0) { + idSB.append(","); + nameSB.append(","); + } + idSB.append(groupBO.getGroupId()); + nameSB.append(groupBO.getGroupName()); + }); + this.groupIdAndNamesValue = idSB.append("|").append(nameSB).toString(); } public List getDepartments() { @@ -126,6 +152,17 @@ public class UserBO extends User { public void setDepartments(List departments) { this.departments = departments; + StringBuilder idSB = new StringBuilder(); + StringBuilder nameSB = new StringBuilder(); + departments.forEach(departmentBO -> { + if (idSB.length() > 0) { + idSB.append(","); + nameSB.append(","); + } + idSB.append(departmentBO.getDepartmentId()); + nameSB.append(departmentBO.getDepartmentName()); + }); + this.departmentIdAndNamesValue = idSB.append("|").append(nameSB).toString(); } public List getPositions() { @@ -134,6 +171,33 @@ public class UserBO extends User { public void setPositions(List positions) { this.positions = positions; + StringBuilder idSB = new StringBuilder(); + StringBuilder nameSB = new StringBuilder(); + positions.forEach(positionBO -> { + if (idSB.length() > 0) { + idSB.append(","); + nameSB.append(","); + } + idSB.append(positionBO.getPositionId()); + nameSB.append(positionBO.getPositionName()); + }); + this.positionIdAndNamesValue = idSB.append("|").append(nameSB).toString(); + } + + public String getRoleIdAndNamesValue() { + return roleIdAndNamesValue == null ? "" : roleIdAndNamesValue.trim(); + } + + public String getGroupIdAndNamesValue() { + return groupIdAndNamesValue == null ? "" : groupIdAndNamesValue.trim(); + } + + public String getDepartmentIdAndNamesValue() { + return departmentIdAndNamesValue == null ? "" : departmentIdAndNamesValue.trim(); + } + + public String getPositionIdAndNamesValue() { + return positionIdAndNamesValue == null ? "" : positionIdAndNamesValue.trim(); } @Override @@ -163,6 +227,14 @@ public class UserBO extends User { .append(departments); sb.append(",\"positions\":") .append(positions); + sb.append(",\"roleIdAndNamesValue\":") + .append("\"").append(roleIdAndNamesValue).append("\""); + sb.append(",\"groupIdAndNamesValue\":") + .append("\"").append(groupIdAndNamesValue).append("\""); + sb.append(",\"departmentIdAndNamesValue\":") + .append("\"").append(departmentIdAndNamesValue).append("\""); + sb.append(",\"positionIdAndNamesValue\":") + .append("\"").append(positionIdAndNamesValue).append("\""); sb.append('}'); return sb.toString(); } diff --git a/cloud-common/src/main/java/com/cm/common/pojo/bos/UserInfoBO.java b/cloud-common/src/main/java/com/cm/common/pojo/bos/UserInfoBO.java index c65d7af..9dff0c9 100644 --- a/cloud-common/src/main/java/com/cm/common/pojo/bos/UserInfoBO.java +++ b/cloud-common/src/main/java/com/cm/common/pojo/bos/UserInfoBO.java @@ -23,6 +23,10 @@ public class UserInfoBO { private List roles; private List groups; private List positions; + private String roleIdAndNamesValue; + private String groupIdAndNamesValue; + private String departmentIdAndNamesValue; + private String positionIdAndNamesValue; public String getUserId() { return userId == null ? "" : userId.trim(); @@ -86,6 +90,17 @@ public class UserInfoBO { public void setDepartments(List departments) { this.departments = departments; + StringBuilder idSB = new StringBuilder(); + StringBuilder nameSB = new StringBuilder(); + departments.forEach(departmentBO -> { + if (idSB.length() > 0) { + idSB.append(","); + nameSB.append(","); + } + idSB.append(departmentBO.getDepartmentId()); + nameSB.append(departmentBO.getDepartmentName()); + }); + this.departmentIdAndNamesValue = idSB.append("|").append(nameSB).toString(); } public List getRoles() { @@ -94,6 +109,17 @@ public class UserInfoBO { public void setRoles(List roles) { this.roles = roles; + StringBuilder idSB = new StringBuilder(); + StringBuilder nameSB = new StringBuilder(); + roles.forEach(roleBO -> { + if (idSB.length() > 0) { + idSB.append(","); + nameSB.append(","); + } + idSB.append(roleBO.getRoleId()); + nameSB.append(roleBO.getRoleName()); + }); + this.roleIdAndNamesValue = idSB.append("|").append(nameSB).toString(); } public List getGroups() { @@ -102,6 +128,17 @@ public class UserInfoBO { public void setGroups(List groups) { this.groups = groups; + StringBuilder idSB = new StringBuilder(); + StringBuilder nameSB = new StringBuilder(); + groups.forEach(groupBO -> { + if (idSB.length() > 0) { + idSB.append(","); + nameSB.append(","); + } + idSB.append(groupBO.getGroupId()); + nameSB.append(groupBO.getGroupName()); + }); + this.groupIdAndNamesValue = idSB.append("|").append(nameSB).toString(); } public List getPositions() { @@ -110,6 +147,33 @@ public class UserInfoBO { public void setPositions(List positions) { this.positions = positions; + StringBuilder idSB = new StringBuilder(); + StringBuilder nameSB = new StringBuilder(); + positions.forEach(positionBO -> { + if (idSB.length() > 0) { + idSB.append(","); + nameSB.append(","); + } + idSB.append(positionBO.getPositionId()); + nameSB.append(positionBO.getPositionName()); + }); + this.positionIdAndNamesValue = idSB.append("|").append(nameSB).toString(); + } + + public String getRoleIdAndNamesValue() { + return roleIdAndNamesValue == null ? "" : roleIdAndNamesValue.trim(); + } + + public String getGroupIdAndNamesValue() { + return groupIdAndNamesValue == null ? "" : groupIdAndNamesValue.trim(); + } + + public String getDepartmentIdAndNamesValue() { + return departmentIdAndNamesValue == null ? "" : departmentIdAndNamesValue.trim(); + } + + public String getPositionIdAndNamesValue() { + return positionIdAndNamesValue == null ? "" : positionIdAndNamesValue.trim(); } @Override