From 4aadcec09232486adea42f321134cae0170ab05c Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Tue, 11 Feb 2020 00:23:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=A1=A8=E5=8D=95APP?= =?UTF-8?q?=E7=AB=AF=E6=96=B0=E5=A2=9E=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dynamic/DynamicDataAppController.java | 124 +++ .../routes/DynamicFormAppRouteController.java | 96 ++- .../dynamic/DynamicFormRouteController.java | 42 +- .../service/dynamic/IDynamicFormService.java | 9 + .../dynamic/impl/DynamicFormServiceImpl.java | 33 + .../dynamic/form/app/save-dynamic-form.html | 722 ++++++++++-------- .../dynamic/form/save-dynamic-form.html | 7 +- .../controller/apis/file/FileController.java | 1 - .../app/apis/file/FileAppController.java | 13 + .../templates/tree/app/tree-user.html | 12 +- .../resources/templates/tree/app/tree-v2.html | 4 + .../common/token/app/entity/AppTokenUser.java | 11 + .../token/app/entity/AppTokenUserGroup.java | 44 ++ 13 files changed, 770 insertions(+), 348 deletions(-) create mode 100644 cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/apis/dynamic/DynamicDataAppController.java create mode 100644 cloud-common/src/main/java/com/cm/common/token/app/entity/AppTokenUserGroup.java diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/apis/dynamic/DynamicDataAppController.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/apis/dynamic/DynamicDataAppController.java new file mode 100644 index 0000000..4ba688d --- /dev/null +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/apis/dynamic/DynamicDataAppController.java @@ -0,0 +1,124 @@ +package com.cm.common.plugin.controller.app.apis.dynamic; + +import com.cm.common.base.AbstractController; +import com.cm.common.constants.ISystemConstant; +import com.cm.common.plugin.service.dynamic.IDynamicDataService; +import com.cm.common.pojo.ListPage; +import com.cm.common.result.ErrorResult; +import com.cm.common.result.SuccessResult; +import com.cm.common.result.SuccessResultList; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: DynamicDataController + * @Description: 动态数据 + * @Author: WangGeng + * @Date: 2019/12/4 15:23 + * @Version: 1.0 + **/ +@Api(tags = ISystemConstant.API_TAGS_APP_ROUTE_PREFIX + "动态数据接口") +@RestController +@RequestMapping(ISystemConstant.APP_PREFIX + "/dynamicdata") +public class DynamicDataAppController extends AbstractController { + + @Autowired + private IDynamicDataService dynamicDataService; + + @ApiOperation(value = "保存动态数据", notes = "保存动态数据接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PostMapping("savedynamicdata/{tableName}") + public SuccessResult saveDynamicData(@PathVariable("tableName") String tableName, @RequestBody Map params) { + return dynamicDataService.saveDynamicData(tableName, params); + } + + @ApiOperation(value = "删除动态数据", notes = "删除动态数据接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"), + @ApiImplicitParam(name = "ids", value = "数据ID列表,用下划线分隔", paramType = "path", example = "1_2_3") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @DeleteMapping("removedynamicdata/{tableName}/{ids}") + public SuccessResult removeDynamicData(@PathVariable("tableName") String tableName, @PathVariable("ids") String ids) { + return dynamicDataService.removeDynamicData(tableName, ids); + } + + @ApiOperation(value = "修改动态数据", notes = "修改动态数据接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"), + @ApiImplicitParam(name = "id", value = "id", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PutMapping("updatedynamicdata/{tableName}/{id}") + public SuccessResult updateDynamicData(@PathVariable("tableName") String tableName, @PathVariable("id") String id, @RequestBody Map params) { + return dynamicDataService.updateDynamicData(tableName, id, params); + } + + @ApiOperation(value = " 修改动态数据(链接)", notes = " 修改动态数据(链接)接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"), + @ApiImplicitParam(name = "id", value = "id", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PutMapping("updatedynamicjoindata/{tableName}/{joinKey}/{joinId}") + public SuccessResult updateDynamicJoinData(@PathVariable("tableName") String tableName, @PathVariable("joinKey") String joinKey, @PathVariable("joinId") String joinId, @RequestBody Map params) { + return dynamicDataService.updateDynamicJoinData(tableName, joinKey, joinId, params); + } + + @ApiOperation(value = "动态数据列表", notes = "动态数据列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listdynamicdata/{tableName}") + public List> listDynamicData(@PathVariable("tableName") String tableName) { + Map params = getParams(); + return dynamicDataService.listDynamicData(tableName, params); + } + + @ApiOperation(value = "分页动态数据列表", notes = "分页动态数据列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpagedynamicdata/{tableName}") + public SuccessResultList>> listPageDynamicData(@PathVariable("tableName") String tableName, ListPage listPage) { + Map params = getParams(); + listPage.setParams(params); + return dynamicDataService.listPageDynamicData(tableName, listPage); + } + + @ApiOperation(value = "动态数据详情", notes = "动态数据详情接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"), + @ApiImplicitParam(name = "id", value = "id", paramType = "path"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("getdynamicdata/{tableName}/{id}") + public Map getDynamicData(@PathVariable("tableName") String tableName, @PathVariable("id") String id) { + return dynamicDataService.getDynamicData(tableName, id); + } + + @ApiOperation(value = "动态数据(链接)详情", notes = "动态数据(链接)详情接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"), + @ApiImplicitParam(name = "joinKey", value = "链接键名", paramType = "path"), + @ApiImplicitParam(name = "joinId", value = "链接键值", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("getdynamicjoindata/{tableName}/{joinKey}/{joinId}") + public Map getDynamicJoinData(@PathVariable("tableName") String tableName, @PathVariable("joinKey") String joinKey, @PathVariable("joinId") String joinId) { + return dynamicDataService.getDynamicJoinData(tableName, joinKey, joinId); + } + +} diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/routes/DynamicFormAppRouteController.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/routes/DynamicFormAppRouteController.java index c14a779..cb84f1d 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/routes/DynamicFormAppRouteController.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/routes/DynamicFormAppRouteController.java @@ -1,16 +1,27 @@ package com.cm.common.plugin.controller.app.routes; 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.dynamic.IDynamicFormService; +import com.cm.common.pojo.bos.DepartmentBO; +import com.cm.common.token.app.AppTokenManager; +import com.cm.common.token.app.entity.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; +import java.util.List; + /** * When you feel like quitting. Think about why you started * 当你想要放弃的时候,想想当初你为何开始 @@ -26,15 +37,96 @@ import org.springframework.web.servlet.ModelAndView; @RequestMapping(ISystemConstant.APP_ROUTE_PREFIX + "/dynamicform") public class DynamicFormAppRouteController { + @Autowired + private IDynamicFormService dynamicFormService; + @ApiOperation(value = "动态表单新增页面", notes = "动态表单新增页面接口") @ApiImplicitParams({ @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path") }) - @GetMapping("savedynamicformrelease/{tableName}") - public ModelAndView saveDynamicForm(@PathVariable("tableName") String tableName) { + @GetMapping("savedynamicform/{tableName}") + public ModelAndView saveDynamicForm(@RequestHeader("token") String token, @PathVariable("tableName") String tableName) { ModelAndView mv = new ModelAndView("dynamic/form/app/save-dynamic-form.html"); mv.addObject("tableName", tableName); + mv.addObject("token", token); + + List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); + mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs); + dynamicFormService.setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); + + setCurrentUserIdAndNameValues(mv, token, dynamicFormFormShowFieldDTOs); return mv; } + /** + * 设置ID和名称值:当前用户、部门、角色、组、职位等 + * + * @param mv + */ + private void setCurrentUserIdAndNameValues(ModelAndView mv, String token, List dynamicFormFormShowFieldDTOs) { + AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser(); + dynamicFormFormShowFieldDTOs.forEach(dynamicFormFormShowFieldDTO -> { + if (StringUtils.equals(FieldTypeEnum.CURRENT_USER.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + mv.addObject("userIdAndValue", String.format("%s|%s", appTokenUser.getId(), appTokenUser.getName())); + mv.addObject("userNameValue", appTokenUser.getName()); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_DEPARTMENT.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + List appTokenUserDepartments = appTokenUser.getDepartments(); + StringBuilder idStringBuilder = new StringBuilder(); + StringBuilder nameStringBuilder = new StringBuilder(); + appTokenUserDepartments.forEach(appTokenUserPosition -> { + if (idStringBuilder.length() > 0) { + idStringBuilder.append(","); + nameStringBuilder.append(","); + } + idStringBuilder.append(appTokenUserPosition.getDepartmentId()); + nameStringBuilder.append(appTokenUserPosition.getDepartmentName()); + }); + mv.addObject("departmentIdAndNamesValue", idStringBuilder.length() > 0 ? idStringBuilder.append("|").append(nameStringBuilder).toString() : ""); + mv.addObject("departmentNamesValue", nameStringBuilder.length() > 0 ? nameStringBuilder.toString() : ""); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_ROLE.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + List appTokenUserRoles = appTokenUser.getRoles(); + StringBuilder idStringBuilder = new StringBuilder(); + StringBuilder nameStringBuilder = new StringBuilder(); + appTokenUserRoles.forEach(appTokenUserPosition -> { + if (idStringBuilder.length() > 0) { + idStringBuilder.append(","); + nameStringBuilder.append(","); + } + idStringBuilder.append(appTokenUserPosition.getRoleId()); + nameStringBuilder.append(appTokenUserPosition.getRoleName()); + }); + mv.addObject("roleIdAndNamesValue", idStringBuilder.length() > 0 ? idStringBuilder.append("|").append(nameStringBuilder).toString() : ""); + mv.addObject("roleNamesValue", nameStringBuilder.length() > 0 ? nameStringBuilder.toString() : ""); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_GROUP.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + List appTokenUserGroups = appTokenUser.getGroups(); + StringBuilder idStringBuilder = new StringBuilder(); + StringBuilder nameStringBuilder = new StringBuilder(); + appTokenUserGroups.forEach(appTokenUserPosition -> { + if (idStringBuilder.length() > 0) { + idStringBuilder.append(","); + nameStringBuilder.append(","); + } + idStringBuilder.append(appTokenUserPosition.getGroupId()); + nameStringBuilder.append(appTokenUserPosition.getGroupName()); + }); + mv.addObject("groupIdAndNamesValue", idStringBuilder.length() > 0 ? idStringBuilder.append("|").append(nameStringBuilder).toString() : ""); + mv.addObject("groupNamesValue", nameStringBuilder.length() > 0 ? nameStringBuilder.toString() : ""); + } else if (StringUtils.equals(FieldTypeEnum.CURRENT_POSITION.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + List appTokenUserPositions = appTokenUser.getPositions(); + StringBuilder idStringBuilder = new StringBuilder(); + StringBuilder nameStringBuilder = new StringBuilder(); + appTokenUserPositions.forEach(appTokenUserPosition -> { + if (idStringBuilder.length() > 0) { + idStringBuilder.append(","); + nameStringBuilder.append(","); + } + idStringBuilder.append(appTokenUserPosition.getPositionId()); + nameStringBuilder.append(appTokenUserPosition.getPositionName()); + }); + mv.addObject("positionIdAndNamesValue", idStringBuilder.length() > 0 ? idStringBuilder.append("|").append(nameStringBuilder).toString() : ""); + mv.addObject("positionNamesValue", nameStringBuilder.length() > 0 ? nameStringBuilder.toString() : ""); + } + }); + } + } 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 11905f0..44354d7 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 @@ -44,8 +44,6 @@ public class DynamicFormRouteController extends AbstractController { @Autowired private IDynamicFormService dynamicFormService; @Autowired - private IDataDictionaryService dataDictionaryService; - @Autowired private SecurityComponent securityComponent; @ApiOperation(value = "动态表单新增页面", notes = "动态表单新增页面接口") @@ -59,7 +57,7 @@ public class DynamicFormRouteController extends AbstractController { List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs); - setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); + dynamicFormService.setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); setCurrentUserIdAndNameValues(mv, dynamicFormFormShowFieldDTOs); return mv; } @@ -77,7 +75,7 @@ public class DynamicFormRouteController extends AbstractController { List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs); - setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); + dynamicFormService.setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); setCurrentUserIdAndNameValues(mv, dynamicFormFormShowFieldDTOs); return mv; } @@ -96,44 +94,10 @@ public class DynamicFormRouteController extends AbstractController { List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs); - setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); + dynamicFormService.setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); return mv; } - /** - * 设置动态表单字段 - * - * @param mv - * @param dynamicFormFormShowFieldDTOs - */ - private void setDynamicFieldData(ModelAndView mv, List dynamicFormFormShowFieldDTOs) { - List> selectMapList = new ArrayList<>(0); - List> checkboxMapList = new ArrayList<>(0); - List> radioMapList = new ArrayList<>(0); - for (DynamicFormFormShowFieldDTO dynamicFormFormShowFieldDTO : dynamicFormFormShowFieldDTOs) { - String dictionaryId = dynamicFormFormShowFieldDTO.getDictionaryId(); - if (StringUtils.equals(FieldTypeEnum.SELECT.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { - Map selectMap = new HashMap<>(2); - selectMap.put("name", dynamicFormFormShowFieldDTO.getFieldName()); - selectMap.put("list", dataDictionaryService.listDictionaryByParentId(dictionaryId)); - selectMapList.add(selectMap); - } else if (StringUtils.equals(FieldTypeEnum.CHECKBOX.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { - Map checkboxMap = new HashMap<>(2); - checkboxMap.put("name", dynamicFormFormShowFieldDTO.getFieldName()); - checkboxMap.put("list", dataDictionaryService.listDictionaryByParentId(dictionaryId)); - checkboxMapList.add(checkboxMap); - } else if (StringUtils.equals(FieldTypeEnum.RADIO.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { - Map radioMap = new HashMap<>(2); - radioMap.put("name", dynamicFormFormShowFieldDTO.getFieldName()); - radioMap.put("list", dataDictionaryService.listDictionaryByParentId(dictionaryId)); - radioMapList.add(radioMap); - } - } - mv.addObject("selectMapList", selectMapList); - mv.addObject("checkboxMapList", checkboxMapList); - mv.addObject("radioMapList", radioMapList); - } - @ApiOperation(value = "动态表单列表页面", notes = "动态表单列表页面接口") @ApiImplicitParams({ @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path") diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicFormService.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicFormService.java index a6d82d9..d8c1b38 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicFormService.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicFormService.java @@ -7,6 +7,7 @@ import com.cm.common.plugin.pojo.dtos.dynamic.DynamicFormDTO; import com.cm.common.plugin.pojo.dtos.dynamic.DynamicFormFormShowFieldDTO; import com.cm.common.plugin.pojo.dtos.dynamic.DynamicFormListShowFieldDTO; import com.cm.common.plugin.pojo.vos.dynamic.DynamicFormVO; +import org.springframework.web.servlet.ModelAndView; import java.util.List; import java.util.Map; @@ -103,4 +104,12 @@ public interface IDynamicFormService { * @throws SearchException */ List> listJoinTableField(List dynamicFormDTOs) throws SearchException; + + /** + * 设置动态表单字段 + * + * @param mv + * @param dynamicFormFormShowFieldDTOs + */ + void setDynamicFieldData(ModelAndView mv, List dynamicFormFormShowFieldDTOs); } 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 2ec6644..5702efd 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 @@ -14,12 +14,14 @@ import com.cm.common.plugin.pojo.vos.database.table.TableColumnVO; import com.cm.common.plugin.pojo.vos.database.table.TableVO; import com.cm.common.plugin.pojo.vos.dynamic.DynamicFormFieldVO; import com.cm.common.plugin.pojo.vos.dynamic.DynamicFormVO; +import com.cm.common.plugin.service.datadictionary.IDataDictionaryService; import com.cm.common.plugin.service.dynamic.IDynamicFormService; import com.cm.common.plugin.service.dynamic.IDynamicTableService; import com.cm.common.utils.WStringUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; import java.util.*; @@ -40,6 +42,8 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF private IDynamicFormDao dynamicFormDao; @Autowired private IDynamicTableService dynamicTableService; + @Autowired + private IDataDictionaryService dataDictionaryService; @Override @@ -208,6 +212,35 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF return listShowField; } + @Override + public void setDynamicFieldData(ModelAndView mv, List dynamicFormFormShowFieldDTOs) { + List> selectMapList = new ArrayList<>(0); + List> checkboxMapList = new ArrayList<>(0); + List> radioMapList = new ArrayList<>(0); + for (DynamicFormFormShowFieldDTO dynamicFormFormShowFieldDTO : dynamicFormFormShowFieldDTOs) { + String dictionaryId = dynamicFormFormShowFieldDTO.getDictionaryId(); + if (StringUtils.equals(FieldTypeEnum.SELECT.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + Map selectMap = new HashMap<>(2); + selectMap.put("name", dynamicFormFormShowFieldDTO.getFieldName()); + selectMap.put("list", dataDictionaryService.listDictionaryByParentId(dictionaryId)); + selectMapList.add(selectMap); + } else if (StringUtils.equals(FieldTypeEnum.CHECKBOX.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + Map checkboxMap = new HashMap<>(2); + checkboxMap.put("name", dynamicFormFormShowFieldDTO.getFieldName()); + checkboxMap.put("list", dataDictionaryService.listDictionaryByParentId(dictionaryId)); + checkboxMapList.add(checkboxMap); + } else if (StringUtils.equals(FieldTypeEnum.RADIO.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { + Map radioMap = new HashMap<>(2); + radioMap.put("name", dynamicFormFormShowFieldDTO.getFieldName()); + radioMap.put("list", dataDictionaryService.listDictionaryByParentId(dictionaryId)); + radioMapList.add(radioMap); + } + } + mv.addObject("selectMapList", selectMapList); + mv.addObject("checkboxMapList", checkboxMapList); + mv.addObject("radioMapList", radioMapList); + } + /** * 判断是否是动态字段 * diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/app/save-dynamic-form.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/app/save-dynamic-form.html index eb506ea..c6b5a5a 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/app/save-dynamic-form.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/app/save-dynamic-form.html @@ -15,246 +15,277 @@
- -
-
输入文本
-
-
- -
-
-
- - -
-
时间戳
-
-
- -
-
-
- - -
-
日期
-
-
- -
-
-
- - -
-
整形
-
-
- -
-
-
- - -
-
双精度
-
-
- -
-
-
- - -
-
文本域
-
-
- -
-
-
- - -
-
富文本
-
-
-
-
-
-
- - -
-
下拉列表
-
-
- -
-
-
- - -
-
单选列表项
-
-