diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/DynamicDataController.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/DynamicDataController.java index ee366bf..6ab69f6 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/DynamicDataController.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/DynamicDataController.java @@ -66,6 +66,17 @@ public class DynamicDataController extends AbstractController { 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") @@ -100,4 +111,16 @@ public class DynamicDataController extends AbstractController { 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/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java index 55c6487..2960e54 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java @@ -55,7 +55,7 @@ public class DynamicFormRouteController extends AbstractController { return mv; } - @ApiOperation(value = "动态表单列表页面", notes = "动态表单列表页面接口") + @ApiOperation(value = "动态表单更新页面", notes = "动态表单列表更新接口") @ApiImplicitParams({ @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"), @ApiImplicitParam(name = "uuidValue", value = "id值", paramType = "path") @@ -72,6 +72,24 @@ public class DynamicFormRouteController extends AbstractController { return mv; } + @ApiOperation(value = "动态表单更新(链接)页面", notes = "动态表单更新(链接)页面接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"), + @ApiImplicitParam(name = "joinId", value = "链接id值", paramType = "path") + }) + @GetMapping("updatedynamicjoinform/{tableName}/{joinKey}/{joinId}") + public ModelAndView updateDynamicJoinForm(@PathVariable("tableName") String tableName, @PathVariable("joinKey") String joinKey, @PathVariable("joinId") String joinId) { + ModelAndView mv = new ModelAndView("dynamic/form/updatedynamicjoinform"); + mv.addObject("tableName", tableName); + mv.addObject("joinKey", joinKey); + mv.addObject("joinId", joinId); + + List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); + mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs); + setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); + return mv; + } + /** * 设置动态表单字段 * diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/dao/dynamic/IDynamicDataDao.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/dao/dynamic/IDynamicDataDao.java index 8c339fa..9380e5b 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/dao/dynamic/IDynamicDataDao.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/dao/dynamic/IDynamicDataDao.java @@ -5,6 +5,7 @@ import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.exception.UpdateException; import com.cm.common.result.SuccessResult; +import net.sf.jsqlparser.statement.update.Update; import org.springframework.stereotype.Repository; import java.util.List; @@ -49,6 +50,14 @@ public interface IDynamicDataDao { */ void updateDynamicData(Map params) throws UpdateException; + /** + * 修改动态数据(链接) + * + * @param params + * @throws UpdateException + */ + void updateDynamicJoinData(Map params) throws UpdateException; + /** * 动态数据列表 * @@ -66,4 +75,13 @@ public interface IDynamicDataDao { * @throws SearchException */ Map getDynamicData(Map params) throws SearchException; + + /** + * 动态数据(链接)详情 + * + * @param params + * @return + * @throws SearchException + */ + Map getDynamicJoinData(Map params) throws SearchException; } diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/enums/dynamic/FieldTypeEnum.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/enums/dynamic/FieldTypeEnum.java index ce5c72f..168f22d 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/enums/dynamic/FieldTypeEnum.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/enums/dynamic/FieldTypeEnum.java @@ -63,7 +63,11 @@ public enum FieldTypeEnum { /** * 文件 */ - FILE("file"); + FILE("file"), + /** + * 外联 + */ + JOIN("join"); private String value; diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/DynamicFormFieldVO.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/DynamicFormFieldVO.java index 5fa9fa9..de37053 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/DynamicFormFieldVO.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/DynamicFormFieldVO.java @@ -25,7 +25,7 @@ public class DynamicFormFieldVO { @CheckEmptyAnnotation(name = "字段说明") private String fieldExplain; @ApiModelProperty(name = "fieldType", value = "字段类型") - @CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment"}) + @CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment", "file", "join"}) private String fieldType; @ApiModelProperty(name = "fieldDefault", value = "字段默认值") private String fieldDefault; diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/config/form/DynamicConfigFormVO.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/config/form/DynamicConfigFormVO.java index 80b1793..dd16791 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/config/form/DynamicConfigFormVO.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/config/form/DynamicConfigFormVO.java @@ -28,7 +28,7 @@ public class DynamicConfigFormVO { @CheckEmptyAnnotation(name = "字段说明") private String fieldExplain; @ApiModelProperty(name = "fieldType", value = "字段类型") - @CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment", "file"}) + @CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment", "file", "join"}) private String fieldType; @ApiModelProperty(name = "fieldDefault", value = "字段默认值") private String fieldDefault; diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicDataService.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicDataService.java index e0a1284..a8d0dc0 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicDataService.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicDataService.java @@ -55,6 +55,16 @@ public interface IDynamicDataService { */ SuccessResult updateDynamicData(String tableName, String id, Map params) throws UpdateException; + /** + * 修改动态数据(链接) + * @param tableName + * @param joinKey + * @param joinId + * @param params + * @return + */ + SuccessResult updateDynamicJoinData(String tableName, String joinKey, String joinId, Map params); + /** * 动态数据列表 * @@ -84,4 +94,15 @@ public interface IDynamicDataService { */ Map getDynamicData(String tableName, String id) throws SearchException; + /** + * 动态数据(链接)详情 + * + * @param tableName + * @param joinKey + * @param joinId + * @return + * @throws SearchException + */ + Map getDynamicJoinData(String tableName, String joinKey, String joinId) throws SearchException; + } diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicDataServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicDataServiceImpl.java index 3c6f376..894b78e 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicDataServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicDataServiceImpl.java @@ -78,6 +78,37 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD @Override public SuccessResult updateDynamicData(String tableName, String id, Map params) throws UpdateException { + List updateFieldValueList = listUpdateFieldValueList(tableName, params); + params.clear(); + setUpdateBaseInfo(tableName, params); + params.put("uuidValue", id); + params.put("updateFieldValueList", updateFieldValueList); + setUpdateInfo(params); + dynamicDataDao.updateDynamicData(params); + return new SuccessResult(); + } + + @Override + public SuccessResult updateDynamicJoinData(String tableName, String joinKey, String joinId, Map params) { + List updateFieldValueList = listUpdateFieldValueList(tableName, params); + params.clear(); + setUpdateBaseInfo(tableName, params); + params.put("joinKey", WStringUtil.lowerUpper2UnderLine(joinKey)); + params.put("joinId", joinId); + params.put("updateFieldValueList", updateFieldValueList); + setUpdateInfo(params); + dynamicDataDao.updateDynamicJoinData(params); + return new SuccessResult(); + } + + /** + * 更新字段列表 + * + * @param tableName + * @param params + * @return + */ + private List listUpdateFieldValueList(String tableName, Map params) { List dynamicFormDTOs = dynamicFormService.listDynamicForm(tableName); LOG.debug("校验参数"); requireData(params, dynamicFormDTOs); @@ -86,13 +117,7 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) { updateFieldValueList.add(new DefaultKeyValue(WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getFieldName()), params.get(dynamicFormDTO.getFieldName()))); } - params.clear(); - setUpdateBaseInfo(tableName, params); - params.put("uuidValue", id); - params.put("updateFieldValueList", updateFieldValueList); - setUpdateInfo(params); - dynamicDataDao.updateDynamicData(params); - return new SuccessResult(); + return updateFieldValueList; } @Override @@ -123,6 +148,20 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD return dynamicData; } + @Override + public Map getDynamicJoinData(String tableName, String joinKey, String joinId) throws SearchException { + Map params = getHashMap(0); + setSearchBaseGetInfo(tableName, params); + params.put("joinKey", WStringUtil.lowerUpper2UnderLine(joinKey)); + params.put("joinId", joinId); + Map dynamicData = dynamicDataDao.getDynamicJoinData(params); + if (Objects.isNull(dynamicData)) { + dynamicData = new HashMap<>(); + } + resetDynamicDataKey2LowerUpper(dynamicData); + return dynamicData; + } + /** * 设置查询列表基础信息 * diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java index 1dd6255..0b5d426 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java @@ -262,6 +262,8 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF return true; } else if (StringUtils.equals(FieldTypeEnum.FILE.getValue(), fieldType) && StringUtils.equals(ColumnDataTypeEnum.TEXT.getDataType(), dataType)) { return true; + } else if (StringUtils.equals(FieldTypeEnum.JOIN.getValue(), fieldType) && StringUtils.equals(ColumnDataTypeEnum.CHAR.getDataType(), dataType)) { + return true; } return false; } @@ -309,6 +311,9 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF tableColumnVO.setDataType(ColumnDataTypeEnum.TEXT.getDataType()); } else if (StringUtils.equals(FieldTypeEnum.FILE.getValue(), dynamicFormFieldVO.getFieldType())) { tableColumnVO.setDataType(ColumnDataTypeEnum.TEXT.getDataType()); + } else if (StringUtils.equals(FieldTypeEnum.JOIN.getValue(), dynamicFormFieldVO.getFieldType())) { + tableColumnVO.setDataType(ColumnDataTypeEnum.CHAR.getDataType()); + tableColumnVO.setColumnLength(36); } return tableColumnVO; } diff --git a/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/dynamicdata-mapper.xml b/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/dynamicdata-mapper.xml index d129e2d..39bde7a 100644 --- a/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/dynamicdata-mapper.xml +++ b/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/dynamicdata-mapper.xml @@ -58,6 +58,22 @@ ${uuidField} = #{uuidValue} + + + UPDATE + ${tableName} + SET + + + ${item.key} = #{item.value}, + + + modifier = #{modifier}, + gmt_modified = #{gmtModified} + WHERE + ${joinKey} = #{joinId} + + + + + \ No newline at end of file diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/list.html b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/list.html index ee23a25..daa927b 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/list.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/list.html @@ -89,7 +89,6 @@ [ {type:'checkbox', fixed: 'left'}, {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, - // {field:'tableName', width:120, title: '表名', align:'center', fixed: 'left'}, {field:'fieldName', width:120, title: '字段名称', align:'center', fixed: 'left'}, {field:'fieldExplain', width: 160, title: '字段说明', align:'center'}, {field:'fieldType', width:100, title: '字段类型', align:'center', @@ -129,6 +128,12 @@ case 'selectDepartment': value = '选择部门'; break; + case 'file': + value = '文件'; + break; + case 'join': + value = '外联'; + break; default: value = '文本'; } diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/save.html b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/save.html index 7b0017a..fef2c56 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/save.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/save.html @@ -56,6 +56,7 @@ + diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/update.html b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/update.html index 16846f6..da2c7a6 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/update.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/update.html @@ -56,6 +56,7 @@ + diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/form/savedynamicform.html b/cloud-common-plugin/src/main/resources/templates/dynamic/form/savedynamicform.html index ede90d8..fefcab0 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/form/savedynamicform.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/form/savedynamicform.html @@ -22,6 +22,7 @@
+
@@ -150,6 +151,7 @@ var wangEditorArray = []; var formFieldList = [[${dynamicFormFormShowFieldDTOList}]]; + function closeBox() { parent.layer.close(parent.layer.getFrameIndex(window.name)); } diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/form/updatedynamicform.html b/cloud-common-plugin/src/main/resources/templates/dynamic/form/updatedynamicform.html index 5b8d1ab..b2b37e6 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/form/updatedynamicform.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/form/updatedynamicform.html @@ -22,6 +22,7 @@
+
diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html b/cloud-common-plugin/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html new file mode 100644 index 0000000..8ba88dd --- /dev/null +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html @@ -0,0 +1,482 @@ + + + + + + + + + + + + + +
+
+
+ + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+ + +
+ +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+
+ +
+
+ +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/cloud-common-plugin/src/main/resources/templates/file/file-upload-v2.html b/cloud-common-plugin/src/main/resources/templates/file/file-upload-v2.html index 49b90e2..b47c714 100644 --- a/cloud-common-plugin/src/main/resources/templates/file/file-upload-v2.html +++ b/cloud-common-plugin/src/main/resources/templates/file/file-upload-v2.html @@ -6,7 +6,12 @@ - +