From 06136635a46242fe6684b9abc556fee69089a2f7 Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Fri, 3 Sep 2021 17:19:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E5=AD=97=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E8=87=AA=E5=8A=A8=E8=AE=BE=E7=BD=AE/=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ConfigTableFieldServiceImpl.java | 34 ++++++++++++++----- .../config-table-operationmapper.xml | 2 +- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/module-config-table/src/main/java/cn/com/tenlion/configtable/service/configtablefield/impl/ConfigTableFieldServiceImpl.java b/module-config-table/src/main/java/cn/com/tenlion/configtable/service/configtablefield/impl/ConfigTableFieldServiceImpl.java index 5449e09..97e55bd 100644 --- a/module-config-table/src/main/java/cn/com/tenlion/configtable/service/configtablefield/impl/ConfigTableFieldServiceImpl.java +++ b/module-config-table/src/main/java/cn/com/tenlion/configtable/service/configtablefield/impl/ConfigTableFieldServiceImpl.java @@ -126,8 +126,14 @@ public class ConfigTableFieldServiceImpl extends DefaultBaseService implements I DTO.setConfigTableFieldNumber(configTableFieldVO.getConfigTableFieldNumber()); DTO.setConfigTableFieldType(configTableFieldVO.getConfigTableFieldType()); DTO.setConfigTableFieldName(configTableFieldVO.getConfigTableFieldName()); - // 2021年8月17日14:24:10 CBC 允许真实修改字段 - iConfigTableOperationSubService.saveTableField(configTableDTO.getConfigTableCode(), DTO); + /** + * 查询数据库表明是否存在 + */ + Integer tableCount = iConfigTableOperationSubService.getTableExist(configTableDTO.getConfigTableCode()); + if(tableCount > 0) { + // 2021年8月17日14:24:10 CBC 允许真实修改字段 + iConfigTableOperationSubService.saveTableField(configTableDTO.getConfigTableCode(), DTO); + } }catch(Exception e) { System.out.println(e.getLocalizedMessage()); if(e.getLocalizedMessage().contains("Data too long for column")) { @@ -139,9 +145,6 @@ public class ConfigTableFieldServiceImpl extends DefaultBaseService implements I } } configTableFieldDao.save(params); - if (1 == 1) { - throw new SaveException("12"); - } return configTableFieldId; } @@ -159,11 +162,18 @@ public class ConfigTableFieldServiceImpl extends DefaultBaseService implements I ConfigTableFieldDTO dto = get(id); String configTableId = dto.getConfigTableId(); ConfigTableDTO configTableDTO = iConfigTableService.get(configTableId); - // 2021年8月17日14:24:10 CBC 允许真实删除字段 - iConfigTableOperationSubService.deleteTableField(configTableDTO.getConfigTableCode(), dto); /* if("1".equals(configTableDTO.getConfigTableActivation())) { throw new SaveException("已激活的表单不允许删除字段"); }*/ + /** + * 查询数据库表明是否存在 + */ + // 2021年8月17日14:24:10 CBC 允许真实删除字段 + Integer tableCount = iConfigTableOperationSubService.getTableExist(configTableDTO.getConfigTableCode()); + if(tableCount > 0) { + // 2021年8月17日14:24:10 CBC 允许真实删除字段 + iConfigTableOperationSubService.deleteTableField(configTableDTO.getConfigTableCode(), dto); + } } Map params = getHashMap(2); params.put("configTableFieldIds", ids); @@ -258,7 +268,15 @@ public class ConfigTableFieldServiceImpl extends DefaultBaseService implements I DTO.setConfigTableFieldNumber(configTableFieldVO.getConfigTableFieldNumber()); DTO.setConfigTableFieldType(configTableFieldVO.getConfigTableFieldType()); DTO.setConfigTableFieldName(configTableFieldVO.getConfigTableFieldName()); - iConfigTableOperationSubService.updateTableField(configTableDTO.getConfigTableCode(), DTO); + /** + * 查询数据库表明是否存在 + */ + // 2021年8月17日14:24:10 CBC 允许真实修改字段 + Integer tableCount = iConfigTableOperationSubService.getTableExist(configTableDTO.getConfigTableCode()); + if(tableCount > 0) { + // 2021年8月17日14:24:10 CBC 允许真实修改字段 + iConfigTableOperationSubService.updateTableField(configTableDTO.getConfigTableCode(), DTO); + } } }catch(Exception e) { System.out.println(e.getLocalizedMessage()); diff --git a/module-config-table/src/main/resources/mybatis/mapper/configtableoperation/config-table-operationmapper.xml b/module-config-table/src/main/resources/mybatis/mapper/configtableoperation/config-table-operationmapper.xml index 61a6fe7..5de6447 100644 --- a/module-config-table/src/main/resources/mybatis/mapper/configtableoperation/config-table-operationmapper.xml +++ b/module-config-table/src/main/resources/mybatis/mapper/configtableoperation/config-table-operationmapper.xml @@ -198,7 +198,7 @@ `is_delete` char(1) DEFAULT NULL COMMENT '数据状态', PRIMARY KEY (`id`,`uid`), UNIQUE KEY `id` (`id`) - ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='${configTableName}'; + ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='${configTableName}';