| | |
| | | for (GenTableColumn cenTableColumn : genTable.getColumns()) { |
| | | genTableColumnMapper.update(cenTableColumn, |
| | | new LambdaUpdateWrapper<GenTableColumn>() |
| | | .set(cenTableColumn.getIsPk() == null, GenTableColumn::getIsPk, null) |
| | | .set(cenTableColumn.getIsIncrement() == null, GenTableColumn::getIsIncrement, null) |
| | | .set(cenTableColumn.getIsInsert() == null, GenTableColumn::getIsInsert, null) |
| | | .set(cenTableColumn.getIsEdit() == null, GenTableColumn::getIsEdit, null) |
| | | .set(cenTableColumn.getIsList() == null, GenTableColumn::getIsList, null) |
| | | .set(cenTableColumn.getIsQuery() == null, GenTableColumn::getIsQuery, null) |
| | | .set(cenTableColumn.getIsRequired() == null, GenTableColumn::getIsRequired, null) |
| | | .eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId())); |
| | | .set(StrUtil.isBlank(cenTableColumn.getColumnComment()), GenTableColumn::getColumnComment, null) |
| | | .set(StrUtil.isBlank(cenTableColumn.getIsPk()), GenTableColumn::getIsPk, null) |
| | | .set(StrUtil.isBlank(cenTableColumn.getIsIncrement()), GenTableColumn::getIsIncrement, null) |
| | | .set(StrUtil.isBlank(cenTableColumn.getIsInsert()), GenTableColumn::getIsInsert, null) |
| | | .set(StrUtil.isBlank(cenTableColumn.getIsEdit()), GenTableColumn::getIsEdit, null) |
| | | .set(StrUtil.isBlank(cenTableColumn.getIsList()), GenTableColumn::getIsList, null) |
| | | .set(StrUtil.isBlank(cenTableColumn.getIsQuery()), GenTableColumn::getIsQuery, null) |
| | | .set(StrUtil.isBlank(cenTableColumn.getIsRequired()), GenTableColumn::getIsRequired, null) |
| | | .set(StrUtil.isBlank(cenTableColumn.getDictType()), GenTableColumn::getDictType, "") |
| | | .eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId())); |
| | | } |
| | | } |
| | | } |
| | |
| | | List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); |
| | | for (GenTableColumn column : genTableColumns) { |
| | | GenUtils.initColumnField(column, table); |
| | | genTableColumnMapper.insert(column); |
| | | genTableColumnMapper.insert(column); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | throw new CustomException("导入失败:" + e.getMessage()); |
| | |
| | | // 获取模板列表 |
| | | List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory()); |
| | | for (String template : templates) { |
| | | if (!StrUtil.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) { |
| | | if (!StrUtil.containsAny("sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm", template)) { |
| | | // 渲染模板 |
| | | StringWriter sw = new StringWriter(); |
| | | Template tpl = Velocity.getTemplate(template, Constants.UTF8); |
| | |
| | | dbTableColumns.forEach(column -> { |
| | | if (!tableColumnNames.contains(column.getColumnName())) { |
| | | GenUtils.initColumnField(column, table); |
| | | genTableColumnMapper.insert(column); |
| | | } |
| | | }); |
| | | genTableColumnMapper.insert(column); |
| | | } |
| | | }); |
| | | |
| | | List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(delColumns)) { |