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 ad63455..ee366bf 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 @@ -33,8 +33,6 @@ public class DynamicDataController extends AbstractController { @Autowired private IDynamicDataService dynamicDataService; - @Autowired - private IDynamicFormService dynamicFormService; @ApiOperation(value = "保存动态数据", notes = "保存动态数据接口") @ApiImplicitParams({ diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/DynamicFormController.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/DynamicFormController.java index 78f3182..0882d3a 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/DynamicFormController.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/DynamicFormController.java @@ -1,17 +1,17 @@ package com.cm.common.plugin.controller.apis.dynamic; -import com.cm.common.annotation.CheckRequestBodyAnnotation; import com.cm.common.base.AbstractController; import com.cm.common.constants.ISystemConstant; 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 com.cm.common.plugin.service.dynamic.IDynamicFormService; import com.cm.common.result.ErrorResult; -import com.cm.common.result.SuccessResult; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/file/FileController.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/file/FileController.java index ea9964a..727650a 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/file/FileController.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/file/FileController.java @@ -104,5 +104,16 @@ public class FileController extends AbstractController { return fileService.uEditor(file, request, params); } + @ApiOperation(value = "上传图片", notes = "上传图片接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "image", value = "文件name", paramType = "form") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PostMapping("wangeditorimage") + public JSONObject wangEditorImage(MultipartFile image, HttpServletRequest request) { + Map params = requestParams(); + return fileService.wangEditorImage(image, UploadTypeEnum.IMAGE, params); + } + } diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/tree/TreeRouteController.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/tree/TreeRouteController.java index 0aa491c..7f1d6b3 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/tree/TreeRouteController.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/tree/TreeRouteController.java @@ -32,4 +32,10 @@ public class TreeRouteController extends AbstractController { return mv; } + @GetMapping("treeuser") + public ModelAndView treeUser() { + ModelAndView mv = new ModelAndView("tree/tree-user"); + return mv; + } + } 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 46d2b40..ce5c72f 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 @@ -59,7 +59,11 @@ public enum FieldTypeEnum { /** * 选择部门 */ - SELECT_DEPARTMENT("selectDepartment"); + SELECT_DEPARTMENT("selectDepartment"), + /** + * 文件 + */ + FILE("file"); private String value; 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 23b408e..80b1793 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"}) + @CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment", "file"}) 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/impl/DynamicFormServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java index 2feb226..c1ff5d4 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 @@ -81,7 +81,7 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF List listShowField = new ArrayList<>(); for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) { if (dynamicFormDTO.getFormShow() == 1) { - listShowField.add(WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getFieldName())); + listShowField.add(dynamicFormDTO.getFieldName()); } } return listShowField; @@ -94,7 +94,7 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) { if (dynamicFormDTO.getListShow() == 1) { DynamicFormListShowFieldDTO dynamicFormListShowFieldDTO = new DynamicFormListShowFieldDTO(); - dynamicFormListShowFieldDTO.setFieldName(WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getFieldName())); + dynamicFormListShowFieldDTO.setFieldName(dynamicFormDTO.getFieldName()); dynamicFormListShowFieldDTO.setFieldExplain(dynamicFormDTO.getFieldExplain()); dynamicFormListShowFieldDTOList.add(dynamicFormListShowFieldDTO); } @@ -109,7 +109,7 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) { if (dynamicFormDTO.getFormShow() == 1) { DynamicFormFormShowFieldDTO dynamicFormFormShowFieldDTO = new DynamicFormFormShowFieldDTO(); - dynamicFormFormShowFieldDTO.setFieldName(WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getFieldName())); + dynamicFormFormShowFieldDTO.setFieldName(dynamicFormDTO.getFieldName()); dynamicFormFormShowFieldDTO.setFieldExplain(dynamicFormDTO.getFieldExplain()); dynamicFormFormShowFieldDTO.setFieldDefault(dynamicFormDTO.getFieldDefault()); dynamicFormFormShowFieldDTO.setDictionaryId(dynamicFormDTO.getDictionaryId()); @@ -260,6 +260,8 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF return true; } else if (StringUtils.equals(FieldTypeEnum.SELECT_DEPARTMENT.getValue(), fieldType) && StringUtils.equals(ColumnDataTypeEnum.TEXT.getDataType(), dataType)) { return true; + } else if (StringUtils.equals(FieldTypeEnum.FILE.getValue(), fieldType) && StringUtils.equals(ColumnDataTypeEnum.TEXT.getDataType(), dataType)) { + return true; } return false; } @@ -305,6 +307,8 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF tableColumnVO.setDataType(ColumnDataTypeEnum.TEXT.getDataType()); } else if (StringUtils.equals(FieldTypeEnum.SELECT_DEPARTMENT.getValue(), dynamicFormFieldVO.getFieldType())) { tableColumnVO.setDataType(ColumnDataTypeEnum.TEXT.getDataType()); + } else if (StringUtils.equals(FieldTypeEnum.FILE.getValue(), dynamicFormFieldVO.getFieldType())) { + tableColumnVO.setDataType(ColumnDataTypeEnum.TEXT.getDataType()); } return tableColumnVO; } diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/IFileService.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/IFileService.java index 2ec388b..9e6f8ee 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/IFileService.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/IFileService.java @@ -100,6 +100,7 @@ public interface IFileService { /** * 文件上传 + * * @param token * @param uploadFile * @param uploadTypeEnum @@ -130,6 +131,16 @@ public interface IFileService { */ JSONObject uEditor(MultipartFile file, HttpServletRequest request, Map params) throws SystemException, IOException; + /** + * wangEditor上传文件 + * + * @param image + * @param image1 + * @param params + * @return + */ + JSONObject wangEditorImage(MultipartFile image, UploadTypeEnum image1, Map params); + /** * 获取文件详情 * diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java index 1a4fc41..ef8eae8 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java @@ -1,8 +1,11 @@ package com.cm.common.plugin.service.file.impl; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cm.common.base.AbstractService; import com.cm.common.config.properties.FileProperties; +import com.cm.common.constants.ISystemConstant; +import com.cm.common.enums.ErrorResultCodeEnum; import com.cm.common.enums.UploadTypeEnum; import com.cm.common.exception.FileException; import com.cm.common.exception.ParamsException; @@ -191,6 +194,22 @@ public class FileServiceImpl extends AbstractService implements IFileService { return result; } + @Override + public JSONObject wangEditorImage(MultipartFile image, UploadTypeEnum image1, Map params) { + JSONObject result = new JSONObject(); + try { + FileDTO fileDTO = uploadSingleForFileDTO(null, image, UploadTypeEnum.IMAGE, params); + result.put("errno", 0); + JSONArray fileArray = new JSONArray(); + fileArray.add(String.format("route/file/downloadfile/false/%s", fileDTO.getFileId())); + result.put("data", fileArray); + } catch (Exception e) { + LOG.error(e.getMessage(), e); + result.put("errno", ErrorResultCodeEnum.FILE_ERROR.getValue()); + } + return result; + } + @Override public FilePO getFile(Map params) throws SearchException { return fileDao.getFile(params); @@ -522,7 +541,7 @@ public class FileServiceImpl extends AbstractService implements IFileService { * @param fileFullPath */ private void compressImage(String fileFullPath) { - if(fileFullPath.endsWith(".blob")) { + if (fileFullPath.endsWith(".blob")) { return; } try { 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 1013761..a426b9c 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 @@ -61,8 +61,8 @@ SELECT - ${uuidField}, - + ${uuidField} + ${item} FROM diff --git a/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/dynamicform-mapper.xml b/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/dynamicform-mapper.xml index acfff99..c8b69dc 100644 --- a/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/dynamicform-mapper.xml +++ b/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/dynamicform-mapper.xml @@ -19,7 +19,7 @@ - INSERT INTO dynamic_form( + INSERT INTO dynamic_config_form( id, table_name, field_name, @@ -51,7 +51,7 @@ UPDATE - dynamic_form + dynamic_config_form SET field_name = #{fieldName}, field_explain = #{fieldExplain}, @@ -74,8 +74,10 @@ SELECT * FROM - dynamic_form + dynamic_config_form WHERE + is_delete = 0 + AND table_name = #{_parameter} ORDER BY field_sort 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 02dd85d..d190139 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 @@ -55,6 +55,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 b5c62c0..fff29c5 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 @@ -55,6 +55,7 @@ + diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/config/list.html b/cloud-common-plugin/src/main/resources/templates/dynamic/config/list.html index 589fe14..2896a5a 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/config/list.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/config/list.html @@ -238,28 +238,34 @@ height: '500px' }); } else if(layEvent === 'saveDynamicTable') { - var layIndex; - top.restAjax.post(top.restAjax.path('api/dynamicconfigtable/savedynamictable/{id}', [data.id]), {}, null, function(code, data) { - top.dialog.msg('建表成功'); - reloadTable(); - }, function (code, data) { - top.dialog.msg(data.msg); - }, function () { - layIndex = top.dialog.msg('正在建表,请稍后...', {icon: 16, time: 0, shade: 0.3}); - }, function () { - top.dialog.close(layIndex); + top.dialog.confirm('确定建表吗?', function(index) { + top.dialog.close(index); + var layIndex; + top.restAjax.post(top.restAjax.path('api/dynamicconfigtable/savedynamictable/{id}', [data.id]), {}, null, function(code, data) { + top.dialog.msg('建表成功'); + reloadTable(); + }, function (code, data) { + top.dialog.msg(data.msg); + }, function () { + layIndex = top.dialog.msg('正在建表,请稍后...', {icon: 16, time: 0, shade: 0.3}); + }, function () { + top.dialog.close(layIndex); + }); }); } else if(layEvent === 'updateDynamicTable') { - var layIndex; - top.restAjax.put(top.restAjax.path('api/dynamicconfigtable/updatedynamictable/{id}', [data.id]), {}, null, function(code, data) { - top.dialog.msg('更新成功'); - reloadTable(); - }, function (code, data) { - top.dialog.msg(data.msg); - }, function () { - layIndex = top.dialog.msg('正在更新,请稍后...', {icon: 16, time: 0, shade: 0.3}); - }, function () { - top.dialog.close(layIndex); + top.dialog.confirm('确定更新表吗?字段新增或者删除都会直接修改表结构,有数据的列也会直接删除!', function(index) { + top.dialog.close(index); + var layIndex; + top.restAjax.put(top.restAjax.path('api/dynamicconfigtable/updatedynamictable/{id}', [data.id]), {}, null, function(code, data) { + top.dialog.msg('更新成功'); + reloadTable(); + }, function (code, data) { + top.dialog.msg(data.msg); + }, function () { + layIndex = top.dialog.msg('正在更新,请稍后...', {icon: 16, time: 0, shade: 0.3}); + }, function () { + top.dialog.close(layIndex); + }); }); } }); 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 85e2bea..e8f49d1 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 @@ -20,60 +20,122 @@
-
-
- -
- - - - - - - - - -
-
- - - - -
-
- - - - -
-
- - - - -
-
- - - -
-
- -
-
- -
-
-
- + +
+
+ +
+ + + + + + + + +
-
-
- +
+ +
+ + + + +
+
+
+ +
+ + + + +
+
+
+ +
+ + + + +
+
+
+ +
+ + + +
+
+
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+ + +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
@@ -91,21 +153,197 @@
+ + + + \ No newline at end of file