diff --git a/doc/sql/increase.sql b/doc/sql/increase.sql new file mode 100644 index 0000000..e141023 --- /dev/null +++ b/doc/sql/increase.sql @@ -0,0 +1,9 @@ +-- 2024-12-16 +-- 删除研发工具菜单 +DELETE +FROM blade_menu +WHERE id = '1123598815738675217' + OR parent_id = 1123598815738675217 + OR parent_id IN ( + 1123598815738675218, 1161272593873321991, 1161272593873321996 + ) diff --git a/src/main/java/org/springblade/modules/develop/controller/CodeController.java b/src/main/java/org/springblade/modules/develop/controller/CodeController.java deleted file mode 100644 index 1d3859e..0000000 --- a/src/main/java/org/springblade/modules/develop/controller/CodeController.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.launch.constant.AppConstant; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.secure.annotation.PreAuth; -import org.springblade.core.tenant.annotation.NonDS; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.constant.RoleConstant; -import org.springblade.core.tool.utils.Func; -import org.springblade.modules.develop.pojo.dto.GeneratorDTO; -import org.springblade.modules.develop.pojo.entity.Code; -import org.springblade.modules.develop.service.ICodeService; -import org.springblade.modules.develop.service.IGenerateService; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** - * 控制器 - * - * @author Chill - */ -@NonDS -@Hidden -@RestController -@AllArgsConstructor -@RequestMapping(AppConstant.APPLICATION_DEVELOP_NAME + "/code") -@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) -@Tag(name = "代码生成", description = "代码生成") -public class CodeController extends BladeController { - - private final ICodeService codeService; - private final IGenerateService generateService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @Operation(summary = "详情", description = "传入code") - public R detail(Code code) { - Code detail = codeService.getOne(Condition.getQueryWrapper(code)); - return R.data(detail); - } - - /** - * 分页 - */ - @GetMapping("/list") - @Parameters({ - @Parameter(name = "codeName", description = "模块名", in = ParameterIn.QUERY, schema = @Schema(type = "string")), - @Parameter(name = "tableName", description = "表名", in = ParameterIn.QUERY, schema = @Schema(type = "string")), - @Parameter(name = "modelName", description = "实体名", in = ParameterIn.QUERY, schema = @Schema(type = "string")) - }) - @ApiOperationSupport(order = 2) - @Operation(summary = "分页", description = "传入code") - public R> list(@Parameter(hidden = true) @RequestParam Map code, Query query) { - IPage pages = codeService.page(Condition.getPage(query), Condition.getQueryWrapper(code, Code.class)); - return R.data(pages); - } - - /** - * 新增或修改 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 3) - @Operation(summary = "新增或修改", description = "传入code") - public R submit(@Valid @RequestBody Code code) { - return R.status(codeService.submit(code)); - } - - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 4) - @Operation(summary = "删除", description = "传入ids") - public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { - return R.status(codeService.removeByIds(Func.toLongList(ids))); - } - - /** - * 复制 - */ - @PostMapping("/copy") - @ApiOperationSupport(order = 5) - @Operation(summary = "复制", description = "传入id") - public R copy(@Parameter(description = "主键", required = true) @RequestParam Long id) { - Code code = codeService.getById(id); - code.setId(null); - code.setCodeName(code.getCodeName() + "-copy"); - return R.status(codeService.save(code)); - } - - /** - * 代码生成 - */ - @PostMapping("/gen-code") - @ApiOperationSupport(order = 6) - @Operation(summary = "代码生成", description = "传入ids") - public R genCode(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { - return R.status(generateService.code(Func.toLongList(ids))); - } - - /** - * 代码生成 - */ - @PostMapping("/gen-code-fast") - @ApiOperationSupport(order = 7) - @Operation(summary = "代码快速生成", description = "传入配置集合") - public R genCodeFast(@Parameter(description = "主键集合", required = true) @RequestBody GeneratorDTO dto) { - return R.status(generateService.codeFast(dto)); - } - -} diff --git a/src/main/java/org/springblade/modules/develop/controller/CodeSettingController.java b/src/main/java/org/springblade/modules/develop/controller/CodeSettingController.java deleted file mode 100644 index db80784..0000000 --- a/src/main/java/org/springblade/modules/develop/controller/CodeSettingController.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.launch.constant.AppConstant; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.secure.annotation.PreAuth; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.constant.BladeConstant; -import org.springblade.core.tool.constant.RoleConstant; -import org.springblade.core.tool.utils.Func; -import org.springblade.modules.develop.pojo.entity.CodeSetting; -import org.springblade.modules.develop.service.ICodeSettingService; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** - * 代码生成器配置表 控制器 - * - * @author BladeX - */ -@RestController -@AllArgsConstructor -@RequestMapping(AppConstant.APPLICATION_DEVELOP_NAME + "/code-setting") -@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) -@Tag(name = "代码生成器配置表", description = "代码生成器配置表接口") -public class CodeSettingController extends BladeController { - - private final ICodeSettingService codeSettingService; - - /** - * 代码生成器配置表 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @Operation(summary = "详情", description = "传入codeSetting") - public R detail(CodeSetting codeSetting) { - CodeSetting detail = codeSettingService.getOne(Condition.getQueryWrapper(codeSetting)); - return R.data(detail); - } - - /** - * 代码生成器配置表 分页 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @Operation(summary = "分页", description = "传入codeSetting") - public R> list(@Parameter(hidden = true) @RequestParam Map codeSetting, Query query) { - IPage pages = codeSettingService.page(Condition.getPage(query), Condition.getQueryWrapper(codeSetting, CodeSetting.class)); - return R.data(pages); - } - - /** - * 代码生成器配置表 新增 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 3) - @Operation(summary = "新增", description = "传入codeSetting") - public R save(@Valid @RequestBody CodeSetting codeSetting) { - return R.status(codeSettingService.save(codeSetting)); - } - - /** - * 代码生成器配置表 修改 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 4) - @Operation(summary = "修改", description = "传入codeSetting") - public R update(@Valid @RequestBody CodeSetting codeSetting) { - return R.status(codeSettingService.updateById(codeSetting)); - } - - /** - * 代码生成器配置表 新增或修改 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 5) - @Operation(summary = "新增或修改", description = "传入codeSetting") - public R submit(@Valid @RequestBody CodeSetting codeSetting) { - return R.status(codeSettingService.saveOrUpdate(codeSetting)); - } - - /** - * 代码生成器配置表 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 6) - @Operation(summary = "删除", description = "传入ids") - public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { - return R.status(codeSettingService.removeByIds(Func.toLongList(ids))); - } - - - /** - * 代码生成器配置表 启用 - */ - @PostMapping("/enable") - @ApiOperationSupport(order = 7) - @Operation(summary = "配置启用", description = "传入id") - public R enable(@Parameter(description = "主键", required = true) @RequestParam Long id) { - return R.status(codeSettingService.enable(id)); - } - - /** - * 代码生成器配置表 启用详情 - */ - @GetMapping("/enable-detail") - @ApiOperationSupport(order = 8) - @Operation(summary = "详情", description = "传入codeSetting") - public R enableDetail() { - CodeSetting detail = codeSettingService.getOne(Wrappers.lambdaQuery().eq(CodeSetting::getStatus, BladeConstant.DB_STATUS_2).eq(CodeSetting::getIsDeleted, BladeConstant.DB_NOT_DELETED)); - return R.data(detail); - } -} diff --git a/src/main/java/org/springblade/modules/develop/controller/DatasourceController.java b/src/main/java/org/springblade/modules/develop/controller/DatasourceController.java deleted file mode 100644 index 6823896..0000000 --- a/src/main/java/org/springblade/modules/develop/controller/DatasourceController.java +++ /dev/null @@ -1,140 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.launch.constant.AppConstant; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tenant.annotation.NonDS; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.modules.develop.pojo.entity.Datasource; -import org.springblade.modules.develop.service.IDatasourceService; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 数据源配置表 控制器 - * - * @author Chill - */ -@NonDS -@RestController -@AllArgsConstructor -@RequestMapping(AppConstant.APPLICATION_DEVELOP_NAME + "/datasource") -@Tag(name = "数据源配置表", description = "数据源配置表接口") -public class DatasourceController extends BladeController { - - private final IDatasourceService datasourceService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @Operation(summary = "详情", description = "传入datasource") - public R detail(Datasource datasource) { - Datasource detail = datasourceService.getOne(Condition.getQueryWrapper(datasource)); - return R.data(detail); - } - - /** - * 分页 数据源配置表 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @Operation(summary = "分页", description = "传入datasource") - public R> list(Datasource datasource, Query query) { - IPage pages = datasourceService.page(Condition.getPage(query), Condition.getQueryWrapper(datasource)); - return R.data(pages); - } - - /** - * 新增 数据源配置表 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 4) - @Operation(summary = "新增", description = "传入datasource") - public R save(@Valid @RequestBody Datasource datasource) { - return R.status(datasourceService.save(datasource)); - } - - /** - * 修改 数据源配置表 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 5) - @Operation(summary = "修改", description = "传入datasource") - public R update(@Valid @RequestBody Datasource datasource) { - return R.status(datasourceService.updateById(datasource)); - } - - /** - * 新增或修改 数据源配置表 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 6) - @Operation(summary = "新增或修改", description = "传入datasource") - public R submit(@Valid @RequestBody Datasource datasource) { - if (StringUtil.isNotBlank(datasource.getUrl())) { - datasource.setUrl(datasource.getUrl().replace("&", "&")); - } - return R.status(datasourceService.saveOrUpdate(datasource)); - } - - - /** - * 删除 数据源配置表 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 7) - @Operation(summary = "逻辑删除", description = "传入ids") - public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { - return R.status(datasourceService.deleteLogic(Func.toLongList(ids))); - } - - /** - * 数据源列表 - */ - @GetMapping("/select") - @ApiOperationSupport(order = 8) - @Operation(summary = "下拉数据源", description = "查询列表") - public R> select() { - List list = datasourceService.list(); - return R.data(list); - } - -} diff --git a/src/main/java/org/springblade/modules/develop/controller/ModelController.java b/src/main/java/org/springblade/modules/develop/controller/ModelController.java deleted file mode 100644 index bd80195..0000000 --- a/src/main/java/org/springblade/modules/develop/controller/ModelController.java +++ /dev/null @@ -1,203 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder; -import com.baomidou.mybatisplus.generator.config.po.TableInfo; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.launch.constant.AppConstant; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringPool; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.modules.develop.pojo.entity.Datasource; -import org.springblade.modules.develop.pojo.entity.Model; -import org.springblade.modules.develop.pojo.entity.ModelPrototype; -import org.springblade.modules.develop.service.IDatasourceService; -import org.springblade.modules.develop.service.IModelPrototypeService; -import org.springblade.modules.develop.service.IModelService; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * 数据模型表 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping(AppConstant.APPLICATION_DEVELOP_NAME + "/model") -@Tag(name = "数据模型表", description = "数据模型表接口") -public class ModelController extends BladeController { - - private final IModelService modelService; - private final IModelPrototypeService modelPrototypeService; - private final IDatasourceService datasourceService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @Operation(summary = "详情", description = "传入model") - public R detail(Model model) { - Model detail = modelService.getOne(Condition.getQueryWrapper(model)); - return R.data(detail); - } - - /** - * 分页 数据模型表 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @Operation(summary = "分页", description = "传入model") - public R> list(Model model, Query query) { - IPage pages = modelService.page(Condition.getPage(query), Condition.getQueryWrapper(model)); - return R.data(pages); - } - - /** - * 新增 数据模型表 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 3) - @Operation(summary = "新增", description = "传入model") - public R save(@Valid @RequestBody Model model) { - return R.status(modelService.save(model)); - } - - /** - * 修改 数据模型表 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 4) - @Operation(summary = "修改", description = "传入model") - public R update(@Valid @RequestBody Model model) { - return R.status(modelService.updateById(model)); - } - - /** - * 新增或修改 数据模型表 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 5) - @Operation(summary = "新增或修改", description = "传入model") - public R submit(@Valid @RequestBody Model model) { - boolean temp = modelService.saveOrUpdate(model); - if (temp) { - return R.data(model); - } else { - return R.status(Boolean.FALSE); - } - } - - /** - * 删除 数据模型表 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 6) - @Operation(summary = "逻辑删除", description = "传入ids") - public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { - return R.status(modelService.delete(Func.toLongList(ids))); - } - - /** - * 模型列表 - */ - @GetMapping("/select") - @ApiOperationSupport(order = 7) - @Operation(summary = "模型列表", description = "模型列表") - public R> select() { - List list = modelService.list(); - list.forEach(model -> model.setModelName(model.getModelTable() + StringPool.COLON + StringPool.SPACE + model.getModelName())); - return R.data(list); - } - - /** - * 获取物理表列表 - */ - @GetMapping("/table-list") - @ApiOperationSupport(order = 8) - @Operation(summary = "物理表列表", description = "传入datasourceId") - public R> tableList(Long datasourceId) { - Datasource datasource = datasourceService.getById(datasourceId); - ConfigBuilder config = modelPrototypeService.getConfigBuilder(datasource); - List tableInfoList = config.getTableInfoList().stream() - .filter(tableInfo -> !StringUtil.startsWithIgnoreCase(tableInfo.getName(), "ACT_") && !StringUtil.startsWithIgnoreCase(tableInfo.getName(), "FLW_")) - .map(tableInfo -> tableInfo.setComment(tableInfo.getName() + StringPool.COLON + tableInfo.getComment())) - .collect(Collectors.toList()); - return R.data(tableInfoList); - } - - /** - * 获取物理表信息 - */ - @GetMapping("/table-info") - @ApiOperationSupport(order = 9) - @Operation(summary = "物理表信息", description = "传入model信息") - public R tableInfo(Long modelId, String tableName, Long datasourceId) { - if (StringUtil.isBlank(tableName)) { - Model model = modelService.getById(modelId); - tableName = model.getModelTable(); - } - TableInfo tableInfo = modelPrototypeService.getTableInfo(tableName, datasourceId); - return R.data(tableInfo); - } - - /** - * 获取字段信息 - */ - @GetMapping("/model-prototype") - @ApiOperationSupport(order = 10) - @Operation(summary = "物理表字段信息", description = "传入modelId与datasourceId") - public R modelPrototype(Long modelId, Long datasourceId) { - List modelPrototypeList = modelPrototypeService.list(Wrappers.query().lambda().eq(ModelPrototype::getModelId, modelId)); - if (!modelPrototypeList.isEmpty()) { - return R.data(modelPrototypeList); - } - Model model = modelService.getById(modelId); - String tableName = model.getModelTable(); - TableInfo tableInfo = modelPrototypeService.getTableInfo(tableName, datasourceId); - if (tableInfo != null) { - return R.data(tableInfo.getFields()); - } else { - return R.fail("未获得相关表信息"); - } - } - -} diff --git a/src/main/java/org/springblade/modules/develop/controller/ModelPrototypeController.java b/src/main/java/org/springblade/modules/develop/controller/ModelPrototypeController.java deleted file mode 100644 index ed39b43..0000000 --- a/src/main/java/org/springblade/modules/develop/controller/ModelPrototypeController.java +++ /dev/null @@ -1,146 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.launch.constant.AppConstant; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringPool; -import org.springblade.modules.develop.pojo.entity.ModelPrototype; -import org.springblade.modules.develop.service.IModelPrototypeService; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 数据原型表 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping(AppConstant.APPLICATION_DEVELOP_NAME + "/model-prototype") -@Tag(name = "数据原型表", description = "数据原型表接口") -public class ModelPrototypeController extends BladeController { - - private final IModelPrototypeService modelPrototypeService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @Operation(summary = "详情", description = "传入modelPrototype") - public R detail(ModelPrototype modelPrototype) { - ModelPrototype detail = modelPrototypeService.getOne(Condition.getQueryWrapper(modelPrototype)); - return R.data(detail); - } - - /** - * 分页 数据原型表 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @Operation(summary = "分页", description = "传入modelPrototype") - public R> list(ModelPrototype modelPrototype, Query query) { - IPage pages = modelPrototypeService.page(Condition.getPage(query), Condition.getQueryWrapper(modelPrototype)); - return R.data(pages); - } - - /** - * 新增 数据原型表 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 4) - @Operation(summary = "新增", description = "传入modelPrototype") - public R save(@Valid @RequestBody ModelPrototype modelPrototype) { - return R.status(modelPrototypeService.save(modelPrototype)); - } - - /** - * 修改 数据原型表 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 5) - @Operation(summary = "修改", description = "传入modelPrototype") - public R update(@Valid @RequestBody ModelPrototype modelPrototype) { - return R.status(modelPrototypeService.updateById(modelPrototype)); - } - - /** - * 新增或修改 数据原型表 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 6) - @Operation(summary = "新增或修改", description = "传入modelPrototype") - public R submit(@Valid @RequestBody ModelPrototype modelPrototype) { - return R.status(modelPrototypeService.saveOrUpdate(modelPrototype)); - } - - /** - * 批量新增或修改 数据原型表 - */ - @PostMapping("/submit-list") - @ApiOperationSupport(order = 7) - @Operation(summary = "批量新增或修改", description = "传入modelPrototype集合") - public R submitList(@Valid @RequestBody List modelPrototypes) { - return R.status(modelPrototypeService.submitList(modelPrototypes)); - } - - /** - * 删除 数据原型表 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 8) - @Operation(summary = "逻辑删除", description = "传入ids") - public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { - return R.status(modelPrototypeService.deleteLogic(Func.toLongList(ids))); - } - - /** - * 数据原型列表 - */ - @GetMapping("/select") - @ApiOperationSupport(order = 9) - @Operation(summary = "数据原型列表", description = "数据原型列表") - public R> select(@Parameter(description = "数据模型Id", required = true) @RequestParam Long modelId) { - List list = modelPrototypeService.list(Wrappers.query().lambda().eq(ModelPrototype::getModelId, modelId)); - list.forEach(prototype -> prototype.setJdbcComment(prototype.getJdbcName() + StringPool.COLON + StringPool.SPACE + prototype.getJdbcComment())); - return R.data(list); - } - -} diff --git a/src/main/java/org/springblade/modules/develop/mapper/CodeMapper.java b/src/main/java/org/springblade/modules/develop/mapper/CodeMapper.java deleted file mode 100644 index 9c533ca..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/CodeMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springblade.modules.develop.pojo.entity.Code; - -/** - * Mapper 接口 - * - * @author Chill - */ -public interface CodeMapper extends BaseMapper { - -} diff --git a/src/main/java/org/springblade/modules/develop/mapper/CodeMapper.xml b/src/main/java/org/springblade/modules/develop/mapper/CodeMapper.xml deleted file mode 100644 index dd5ec25..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/CodeMapper.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/org/springblade/modules/develop/mapper/CodeSettingMapper.java b/src/main/java/org/springblade/modules/develop/mapper/CodeSettingMapper.java deleted file mode 100644 index b2f4cd1..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/CodeSettingMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springblade.modules.develop.pojo.entity.CodeSetting; - -/** - * 代码生成器配置表 Mapper 接口 - * - * @author BladeX - */ -public interface CodeSettingMapper extends BaseMapper { - -} diff --git a/src/main/java/org/springblade/modules/develop/mapper/CodeSettingMapper.xml b/src/main/java/org/springblade/modules/develop/mapper/CodeSettingMapper.xml deleted file mode 100644 index 4584c75..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/CodeSettingMapper.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/main/java/org/springblade/modules/develop/mapper/DatasourceMapper.java b/src/main/java/org/springblade/modules/develop/mapper/DatasourceMapper.java deleted file mode 100644 index 534f03e..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/DatasourceMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springblade.modules.develop.pojo.entity.Datasource; - -/** - * 数据源配置表 Mapper 接口 - * - * @author Chill - */ -public interface DatasourceMapper extends BaseMapper { - -} diff --git a/src/main/java/org/springblade/modules/develop/mapper/DatasourceMapper.xml b/src/main/java/org/springblade/modules/develop/mapper/DatasourceMapper.xml deleted file mode 100644 index 7a443dd..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/DatasourceMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/org/springblade/modules/develop/mapper/ModelMapper.java b/src/main/java/org/springblade/modules/develop/mapper/ModelMapper.java deleted file mode 100644 index e06980a..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/ModelMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springblade.modules.develop.pojo.entity.Model; - -/** - * 数据模型表 Mapper 接口 - * - * @author Chill - */ -public interface ModelMapper extends BaseMapper { - -} diff --git a/src/main/java/org/springblade/modules/develop/mapper/ModelMapper.xml b/src/main/java/org/springblade/modules/develop/mapper/ModelMapper.xml deleted file mode 100644 index 3265bfb..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/ModelMapper.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/org/springblade/modules/develop/mapper/ModelPrototypeMapper.java b/src/main/java/org/springblade/modules/develop/mapper/ModelPrototypeMapper.java deleted file mode 100644 index 7c927ec..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/ModelPrototypeMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springblade.modules.develop.pojo.entity.ModelPrototype; - -/** - * 数据原型表 Mapper 接口 - * - * @author Chill - */ -public interface ModelPrototypeMapper extends BaseMapper { - -} diff --git a/src/main/java/org/springblade/modules/develop/mapper/ModelPrototypeMapper.xml b/src/main/java/org/springblade/modules/develop/mapper/ModelPrototypeMapper.xml deleted file mode 100644 index 4c6ac56..0000000 --- a/src/main/java/org/springblade/modules/develop/mapper/ModelPrototypeMapper.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/org/springblade/modules/develop/pojo/dto/GeneratorDTO.java b/src/main/java/org/springblade/modules/develop/pojo/dto/GeneratorDTO.java deleted file mode 100644 index 5411971..0000000 --- a/src/main/java/org/springblade/modules/develop/pojo/dto/GeneratorDTO.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.pojo.dto; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 代码生成DTO - * - * @author Chill - */ -@Data -public class GeneratorDTO implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 上级菜单主键 - */ - @JsonSerialize(using = ToStringSerializer.class) - @Schema(description = "上级菜单主键") - private Long menuId; - - /** - * 数据源主键 - */ - @Schema(description = "数据源主键") - @JsonSerialize(using = ToStringSerializer.class) - private Long datasourceId; - /** - * 模型编号 - */ - @Schema(description = "模型编号") - private String modelCode; - /** - * 物理表名 - */ - @Schema(description = "物理表名") - private String modelTable; - /** - * 模型类名 - */ - @Schema(description = "模型类名") - private String modelClass; - - /** - * 模块名称 - */ - @Schema(description = "服务名称") - private String serviceName; - - /** - * 模块名称 - */ - @Schema(description = "模块名称") - private String codeName; - - /** - * 表名 - */ - @Schema(description = "表名") - private String tableName; - - /** - * 实体名 - */ - @Schema(description = "表前缀") - private String tablePrefix; - - /** - * 主键名 - */ - @Schema(description = "主键名") - private String pkName; - - /** - * 后端包名 - */ - @Schema(description = "后端包名") - private String packageName; - - /** - * 基础业务模式 - */ - @Schema(description = "基础业务模式") - private Integer baseMode; - - /** - * 包装器模式 - */ - @Schema(description = "包装器模式") - private Integer wrapMode; - - /** - * 远程调用模式 - */ - @Schema(description = "远程调用模式") - private Integer feignMode; - - /** - * 代码风格 - */ - @Schema(description = "代码风格") - private String codeStyle; - - /** - * 后端路径 - */ - @Schema(description = "后端路径") - private String apiPath; - - /** - * 前端路径 - */ - @Schema(description = "前端路径") - private String webPath; - -} diff --git a/src/main/java/org/springblade/modules/develop/pojo/dto/ModelDTO.java b/src/main/java/org/springblade/modules/develop/pojo/dto/ModelDTO.java deleted file mode 100644 index ffdd2c2..0000000 --- a/src/main/java/org/springblade/modules/develop/pojo/dto/ModelDTO.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.pojo.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.modules.develop.pojo.entity.Model; -import org.springblade.modules.develop.pojo.entity.ModelPrototype; - -import java.io.Serial; -import java.util.List; - -/** - * 代码模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class ModelDTO extends Model { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 代码建模原型 - */ - private List prototypes; - -} diff --git a/src/main/java/org/springblade/modules/develop/pojo/entity/Code.java b/src/main/java/org/springblade/modules/develop/pojo/entity/Code.java deleted file mode 100644 index 5dd5b80..0000000 --- a/src/main/java/org/springblade/modules/develop/pojo/entity/Code.java +++ /dev/null @@ -1,197 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.pojo.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 实体类 - * - * @author Chill - */ -@Data -@TableName("blade_code") -@Schema(description = "Code对象") -public class Code implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - @JsonSerialize(using = ToStringSerializer.class) - @Schema(description = "主键") - @TableId(value = "id", type = IdType.ASSIGN_ID) - private Long id; - - /** - * 数据模型主键 - */ - @JsonSerialize(using = ToStringSerializer.class) - @Schema(description = "数据模型主键") - private Long modelId; - - /** - * 上级菜单主键 - */ - @JsonSerialize(using = ToStringSerializer.class) - @Schema(description = "上级菜单主键") - private Long menuId; - - /** - * 模块名称 - */ - @Schema(description = "服务名称") - private String serviceName; - - /** - * 模块名称 - */ - @Schema(description = "模块名称") - private String codeName; - - /** - * 表名 - */ - @Schema(description = "表名") - private String tableName; - - /** - * 实体名 - */ - @Schema(description = "表前缀") - private String tablePrefix; - - /** - * 主键名 - */ - @Schema(description = "主键名") - private String pkName; - - /** - * 后端包名 - */ - @Schema(description = "后端包名") - private String packageName; - - /** - * 模版类型 - */ - @Schema(description = "模版类型") - private String templateType; - - /** - * 作者信息 - */ - @Schema(description = "作者信息") - private String author; - - /** - * 子表模型主键 - */ - @Schema(description = "子表模型主键") - private String subModelId; - - /** - * 子表绑定外键 - */ - @Schema(description = "子表绑定外键") - private String subFkId; - - /** - * 树主键字段 - */ - @Schema(description = "树主键字段") - private String treeId; - - /** - * 树父主键字段 - */ - @Schema(description = "树父主键字段") - private String treePid; - - /** - * 树名称字段 - */ - @Schema(description = "树名称字段") - private String treeName; - - /** - * 基础业务模式 - */ - @Schema(description = "基础业务模式") - private Integer baseMode; - - /** - * 包装器模式 - */ - @Schema(description = "包装器模式") - private Integer wrapMode; - - /** - * 远程调用模式 - */ - @Schema(description = "远程调用模式") - private Integer feignMode; - - /** - * 代码风格 - */ - @Schema(description = "代码风格") - private String codeStyle; - - /** - * 后端路径 - */ - @Schema(description = "后端路径") - private String apiPath; - - /** - * 前端路径 - */ - @Schema(description = "前端路径") - private String webPath; - - /** - * 是否已删除 - */ - @TableLogic - @Schema(description = "是否已删除") - private Integer isDeleted; - - -} diff --git a/src/main/java/org/springblade/modules/develop/pojo/entity/CodeSetting.java b/src/main/java/org/springblade/modules/develop/pojo/entity/CodeSetting.java deleted file mode 100644 index ee8f746..0000000 --- a/src/main/java/org/springblade/modules/develop/pojo/entity/CodeSetting.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.pojo.entity; - -import lombok.Data; -import io.swagger.v3.oas.annotations.media.Schema; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; - -import java.io.Serializable; -import java.io.Serial; - -/** - * 代码生成器配置表 实体类 - * - * @author BladeX - */ -@Data -@TableName("blade_code_setting") -@Schema(description = "CodeSetting对象") -public class CodeSetting implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - @JsonSerialize(using = ToStringSerializer.class) - @Schema(description = "主键") - @TableId(value = "id", type = IdType.ASSIGN_ID) - private Long id; - - /** - * 配置项 - */ - @Schema(description = "配置项") - private String settings; - - /** - * 状态[1:正常] - */ - @Schema(description = "业务状态", hidden = true) - private Integer status; - /** - * 是否已删除 - */ - @Schema(description = "是否已删除") - private Integer isDeleted; - -} diff --git a/src/main/java/org/springblade/modules/develop/pojo/entity/Datasource.java b/src/main/java/org/springblade/modules/develop/pojo/entity/Datasource.java deleted file mode 100644 index 26c756e..0000000 --- a/src/main/java/org/springblade/modules/develop/pojo/entity/Datasource.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.pojo.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; - -import java.io.Serial; - -/** - * 数据源配置表实体类 - * - * @author Chill - */ -@Data -@TableName("blade_datasource") -@EqualsAndHashCode(callSuper = true) -@Schema(description = "数据源配置表") -public class Datasource extends BaseEntity { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 数据源类型 - */ - @Schema(description = "数据源类型") - private Integer category; - /** - * 名称 - */ - @Schema(description = "名称") - private String name; - /** - * 驱动类 - */ - @Schema(description = "驱动类") - private String driverClass; - /** - * 连接地址 - */ - @Schema(description = "连接地址") - private String url; - /** - * 用户名 - */ - @Schema(description = "用户名") - private String username; - /** - * 密码 - */ - @Schema(description = "密码") - private String password; - /** - * 分库分表配置 - */ - @Schema(description = "分库分表配置") - private String shardingConfig; - /** - * 备注 - */ - @Schema(description = "备注") - private String remark; - - -} diff --git a/src/main/java/org/springblade/modules/develop/pojo/entity/Model.java b/src/main/java/org/springblade/modules/develop/pojo/entity/Model.java deleted file mode 100644 index 89b2655..0000000 --- a/src/main/java/org/springblade/modules/develop/pojo/entity/Model.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.pojo.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; - -import java.io.Serial; - -/** - * 数据模型表实体类 - * - * @author Chill - */ -@Data -@TableName("blade_model") -@EqualsAndHashCode(callSuper = true) -@Schema(description = "数据模型表") -public class Model extends BaseEntity { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 数据源主键 - */ - @Schema(description = "数据源主键") - @JsonSerialize(using = ToStringSerializer.class) - private Long datasourceId; - /** - * 模型名称 - */ - @Schema(description = "模型名称") - private String modelName; - /** - * 模型编号 - */ - @Schema(description = "模型编号") - private String modelCode; - /** - * 物理表名 - */ - @Schema(description = "物理表名") - private String modelTable; - /** - * 模型类名 - */ - @Schema(description = "模型类名") - private String modelClass; - /** - * 模型备注 - */ - @Schema(description = "模型备注") - private String modelRemark; - - -} diff --git a/src/main/java/org/springblade/modules/develop/pojo/entity/ModelPrototype.java b/src/main/java/org/springblade/modules/develop/pojo/entity/ModelPrototype.java deleted file mode 100644 index 032ec22..0000000 --- a/src/main/java/org/springblade/modules/develop/pojo/entity/ModelPrototype.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.pojo.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; - -import java.io.Serial; - -/** - * 数据原型表实体类 - * - * @author Chill - */ -@Data -@TableName("blade_model_prototype") -@EqualsAndHashCode(callSuper = true) -@Schema(description = "数据原型表") -public class ModelPrototype extends BaseEntity { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 模型主键 - */ - @Schema(description = "模型主键") - @JsonSerialize(using = ToStringSerializer.class) - private Long modelId; - /** - * 物理列名 - */ - @Schema(description = "物理列名") - private String jdbcName; - /** - * 物理类型 - */ - @Schema(description = "物理类型") - private String jdbcType; - /** - * 注释说明 - */ - @Schema(description = "注释说明") - private String jdbcComment; - /** - * 实体列名 - */ - @Schema(description = "实体列名") - private String propertyName; - /** - * 实体类型 - */ - @Schema(description = "实体类型") - private String propertyType; - /** - * 实体类型引用 - */ - @Schema(description = "实体类型引用") - private String propertyEntity; - /** - * 列表显示 - */ - @Schema(description = "列表显示") - private Integer isList; - /** - * 表单显示 - */ - @Schema(description = "表单显示") - private Integer isForm; - /** - * 独占一行 - */ - @Schema(description = "独占一行") - private Integer isRow; - /** - * 组件类型 - */ - @Schema(description = "组件类型") - private String componentType; - /** - * 字典编码 - */ - @Schema(description = "字典编码") - private String dictCode; - /** - * 是否必填 - */ - @Schema(description = "是否必填") - private Integer isRequired; - /** - * 查询配置 - */ - @Schema(description = "查询配置") - private Integer isQuery; - /** - * 查询类型 - */ - @Schema(description = "查询类型") - private String queryType; - - -} diff --git a/src/main/java/org/springblade/modules/develop/service/ICodeService.java b/src/main/java/org/springblade/modules/develop/service/ICodeService.java deleted file mode 100644 index 2f04371..0000000 --- a/src/main/java/org/springblade/modules/develop/service/ICodeService.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service; - - -import com.baomidou.mybatisplus.extension.service.IService; -import org.springblade.modules.develop.pojo.entity.Code; - -/** - * 服务类 - * - * @author Chill - */ -public interface ICodeService extends IService { - - /** - * 提交 - * - * @param code - * @return - */ - boolean submit(Code code); - -} diff --git a/src/main/java/org/springblade/modules/develop/service/ICodeSettingService.java b/src/main/java/org/springblade/modules/develop/service/ICodeSettingService.java deleted file mode 100644 index c9eb056..0000000 --- a/src/main/java/org/springblade/modules/develop/service/ICodeSettingService.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.springblade.modules.develop.pojo.entity.CodeSetting; - -/** - * 代码生成器配置表 服务类 - * - * @author BladeX - */ -public interface ICodeSettingService extends IService { - - /** - * 启动配置 - * - * @param id - * @return - */ - boolean enable(Long id); -} diff --git a/src/main/java/org/springblade/modules/develop/service/IDatasourceService.java b/src/main/java/org/springblade/modules/develop/service/IDatasourceService.java deleted file mode 100644 index dc3a8b7..0000000 --- a/src/main/java/org/springblade/modules/develop/service/IDatasourceService.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service; - -import org.springblade.core.mp.base.BaseService; -import org.springblade.modules.develop.pojo.entity.Datasource; - -/** - * 数据源配置表 服务类 - * - * @author Chill - */ -public interface IDatasourceService extends BaseService { - -} diff --git a/src/main/java/org/springblade/modules/develop/service/IGenerateService.java b/src/main/java/org/springblade/modules/develop/service/IGenerateService.java deleted file mode 100644 index aee54e8..0000000 --- a/src/main/java/org/springblade/modules/develop/service/IGenerateService.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service; - - -import org.springblade.modules.develop.pojo.dto.GeneratorDTO; - -import java.util.List; - -/** - * 服务类 - * - * @author Chill - */ -public interface IGenerateService { - - /** - * 生成代码 - * - * @param ids 主键集合 - * @return boolean - */ - boolean code(List ids); - - /** - * 快速生成代码 - * - * @param dto 配置参数 - * @return boolean - */ - boolean codeFast(GeneratorDTO dto); - -} diff --git a/src/main/java/org/springblade/modules/develop/service/IModelPrototypeService.java b/src/main/java/org/springblade/modules/develop/service/IModelPrototypeService.java deleted file mode 100644 index b55d2d9..0000000 --- a/src/main/java/org/springblade/modules/develop/service/IModelPrototypeService.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service; - -import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder; -import com.baomidou.mybatisplus.generator.config.po.TableInfo; -import org.springblade.core.mp.base.BaseService; -import org.springblade.modules.develop.pojo.entity.Datasource; -import org.springblade.modules.develop.pojo.entity.ModelPrototype; - -import java.util.List; - -/** - * 数据原型表 服务类 - * - * @author Chill - */ -public interface IModelPrototypeService extends BaseService { - - /** - * 批量提交 - * - * @param modelPrototypes 原型集合 - * @return boolean - */ - boolean submitList(List modelPrototypes); - - /** - * 原型列表 - * - * @param modelId 模型ID - * @return List - */ - List prototypeList(Long modelId); - - /** - * 获取表信息 - * - * @param tableName 表名 - * @param datasourceId 数据源主键 - */ - TableInfo getTableInfo(String tableName, Long datasourceId); - - /** - * 获取表配置信息 - * - * @param datasource 数据源信息 - */ - default ConfigBuilder getConfigBuilder(Datasource datasource) { - return getConfigBuilder(datasource, null); - } - - /** - * 获取表配置信息 - * - * @param datasource 数据源信息 - * @param tableName 表名 - */ - ConfigBuilder getConfigBuilder(Datasource datasource, String tableName); - -} diff --git a/src/main/java/org/springblade/modules/develop/service/IModelService.java b/src/main/java/org/springblade/modules/develop/service/IModelService.java deleted file mode 100644 index 8474868..0000000 --- a/src/main/java/org/springblade/modules/develop/service/IModelService.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service; - -import org.springblade.core.mp.base.BaseService; -import org.springblade.modules.develop.pojo.entity.Model; - -import java.util.List; - -/** - * 数据模型表 服务类 - * - * @author Chill - */ -public interface IModelService extends BaseService { - - /** - * 删除模型 - * - * @param ids 主键集合 - * @return boolean - */ - boolean delete(List ids); - -} diff --git a/src/main/java/org/springblade/modules/develop/service/impl/CodeServiceImpl.java b/src/main/java/org/springblade/modules/develop/service/impl/CodeServiceImpl.java deleted file mode 100644 index 19d1bd2..0000000 --- a/src/main/java/org/springblade/modules/develop/service/impl/CodeServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.tool.constant.BladeConstant; -import org.springblade.modules.develop.pojo.entity.Code; -import org.springblade.modules.develop.mapper.CodeMapper; -import org.springblade.modules.develop.service.ICodeService; -import org.springframework.stereotype.Service; - -/** - * 服务实现类 - * - * @author Chill - */ -@Service -public class CodeServiceImpl extends ServiceImpl implements ICodeService { - - @Override - public boolean submit(Code code) { - code.setIsDeleted(BladeConstant.DB_NOT_DELETED); - return saveOrUpdate(code); - } - -} diff --git a/src/main/java/org/springblade/modules/develop/service/impl/CodeSettingServiceImpl.java b/src/main/java/org/springblade/modules/develop/service/impl/CodeSettingServiceImpl.java deleted file mode 100644 index b825efb..0000000 --- a/src/main/java/org/springblade/modules/develop/service/impl/CodeSettingServiceImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service.impl; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springblade.core.tool.constant.BladeConstant; -import org.springblade.modules.develop.mapper.CodeSettingMapper; -import org.springblade.modules.develop.pojo.entity.CodeSetting; -import org.springblade.modules.develop.service.ICodeSettingService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * 代码生成器配置表 服务实现类 - * - * @author BladeX - */ -@Service -public class CodeSettingServiceImpl extends ServiceImpl implements ICodeSettingService { - @Override - @Transactional(rollbackFor = Exception.class) - public boolean enable(Long id) { - // 先禁用 - boolean temp1 = this.update(Wrappers.update().lambda().set(CodeSetting::getStatus, BladeConstant.DB_STATUS_1)); - // 在启用 - boolean temp2 = this.update(Wrappers.update().lambda().set(CodeSetting::getStatus, BladeConstant.DB_STATUS_2).eq(CodeSetting::getId, id)); - return temp1 && temp2; - } -} diff --git a/src/main/java/org/springblade/modules/develop/service/impl/DatasourceServiceImpl.java b/src/main/java/org/springblade/modules/develop/service/impl/DatasourceServiceImpl.java deleted file mode 100644 index d538b40..0000000 --- a/src/main/java/org/springblade/modules/develop/service/impl/DatasourceServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service.impl; - -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.modules.develop.pojo.entity.Datasource; -import org.springblade.modules.develop.mapper.DatasourceMapper; -import org.springblade.modules.develop.service.IDatasourceService; -import org.springframework.stereotype.Service; - -/** - * 数据源配置表 服务实现类 - * - * @author Chill - */ -@Service -public class DatasourceServiceImpl extends BaseServiceImpl implements IDatasourceService { - -} diff --git a/src/main/java/org/springblade/modules/develop/service/impl/GenerateServiceImpl.java b/src/main/java/org/springblade/modules/develop/service/impl/GenerateServiceImpl.java deleted file mode 100644 index 2284550..0000000 --- a/src/main/java/org/springblade/modules/develop/service/impl/GenerateServiceImpl.java +++ /dev/null @@ -1,190 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service.impl; - -import com.baomidou.mybatisplus.generator.config.po.TableField; -import com.baomidou.mybatisplus.generator.config.po.TableInfo; -import lombok.RequiredArgsConstructor; -import org.springblade.core.tool.jackson.JsonUtil; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.develop.constant.DevelopConstant; -import org.springblade.develop.support.BladeCodeGenerator; -import org.springblade.modules.develop.pojo.dto.GeneratorDTO; -import org.springblade.modules.develop.pojo.entity.Code; -import org.springblade.modules.develop.pojo.entity.Datasource; -import org.springblade.modules.develop.pojo.entity.Model; -import org.springblade.modules.develop.pojo.entity.ModelPrototype; -import org.springblade.modules.develop.service.*; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * 服务实现类 - * - * @author Chill - */ -@Service -@RequiredArgsConstructor -public class GenerateServiceImpl implements IGenerateService { - - private final ICodeService codeService; - private final IDatasourceService datasourceService; - private final IModelService modelService; - private final IModelPrototypeService modelPrototypeService; - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean code(List ids) { - Collection codes = codeService.listByIds(ids); - codes.forEach(code -> { - // 创建代码生成器 - BladeCodeGenerator generator = new BladeCodeGenerator(); - // 设置菜单数据 - this.generateMenu(generator, code); - // 设置配置信息 - this.generateTemplate(generator, code); - // 设置基础模型 - Model model = modelService.getById(code.getModelId()); - this.generateModel(generator, code, model); - // 设置数据源 - this.generateDatasource(generator, model); - // 启动代码生成 - generator.run(); - }); - return true; - } - - @Override - public boolean codeFast(GeneratorDTO dto) { - // 创建代码生成器 - BladeCodeGenerator generator = new BladeCodeGenerator(); - Code code = Objects.requireNonNull(BeanUtil.copyProperties(dto, Code.class)); - Model model = Objects.requireNonNull(BeanUtil.copyProperties(dto, Model.class)); - // 设置菜单数据 - this.generateMenu(generator, code); - // 设置配置信息 - this.generateTemplate(generator, code); - this.generateModel(generator, code, model); - // 设置数据源 - this.generateDatasource(generator, model); - // 启动代码生成 - generator.run(); - return true; - } - - private void generateMenu(BladeCodeGenerator generator, Code code) { - // 设置上级菜单id - generator.setMenuId(String.valueOf(code.getMenuId())); - // 设置是否生成菜单sql - generator.setHasMenuSql(Boolean.TRUE); - } - - private void generateTemplate(BladeCodeGenerator generator, Code code) {// 设置基础配置 - generator.setCodeStyle(code.getCodeStyle()); - generator.setCodeName(code.getCodeName()); - generator.setServiceName(code.getServiceName()); - generator.setPackageName(code.getPackageName()); - generator.setPackageDir(code.getApiPath()); - generator.setPackageWebDir(code.getWebPath()); - generator.setTablePrefix(Func.toStrArray(code.getTablePrefix())); - generator.setIncludeTables(Func.toStrArray(code.getTableName())); - // 设置模版信息 - generator.setTemplateType(Func.toStr(code.getTemplateType(), DevelopConstant.TEMPLATE_CRUD)); - generator.setAuthor(code.getAuthor()); - generator.setSubModelId(code.getSubModelId()); - generator.setSubFkId(code.getSubFkId()); - generator.setTreeId(code.getTreeId()); - generator.setTreePid(code.getTreePid()); - generator.setTreeName(code.getTreeName()); - // 设置是否继承基础业务字段 - generator.setHasSuperEntity(code.getBaseMode() == 2); - // 设置是否开启包装器模式 - generator.setHasWrapper(code.getWrapMode() == 2); - // 设置是否开启远程调用模式 - generator.setHasFeign(code.getFeignMode() == 2); - // 设置控制器服务名前缀 - generator.setHasServiceName(Boolean.TRUE); - } - - private void generateModel(BladeCodeGenerator generator, Code code, Model model) { - generator.setModelCode(model.getModelCode()); - generator.setModelClass(model.getModelClass()); - generator.setModel(JsonUtil.readMap(JsonUtil.toJson(model))); - - // 设置模型集合 - if (Func.isNotEmpty(model.getId())) { - List prototypes = modelPrototypeService.prototypeList(model.getId()); - generator.setPrototypes(JsonUtil.readListMap(JsonUtil.toJson(prototypes))); - if (StringUtil.isNotBlank(code.getSubModelId()) && StringUtil.equals(code.getTemplateType(), DevelopConstant.TEMPLATE_SUB)) { - Model subModel = modelService.getById(Func.toLong(code.getSubModelId())); - List subPrototypes = modelPrototypeService.prototypeList(subModel.getId()); - generator.setSubModel(JsonUtil.readMap(JsonUtil.toJson(subModel))); - generator.setSubPrototypes(JsonUtil.readListMap(JsonUtil.toJson(subPrototypes))); - } - } else { - TableInfo tableInfo = modelPrototypeService.getTableInfo(model.getModelTable(), model.getDatasourceId()); - List fields = tableInfo.getFields(); - List prototypes = convertPrototypes(fields); - generator.setPrototypes(JsonUtil.readListMap(JsonUtil.toJson(prototypes))); - } - } - - private void generateDatasource(BladeCodeGenerator generator, Model model) { - Datasource datasource = datasourceService.getById(model.getDatasourceId()); - generator.setDriverName(datasource.getDriverClass()); - generator.setUrl(datasource.getUrl()); - generator.setUsername(datasource.getUsername()); - generator.setPassword(datasource.getPassword()); - } - - /** - * 将 TableField 列表转换为 ModelPrototype 列表 - * - * @param tableFields 输入的 TableField 列表 - * @return 转换后的 ModelPrototype 列表 - */ - public static List convertPrototypes(List tableFields) { - return tableFields.stream().map(tableField -> { - ModelPrototype prototype = new ModelPrototype(); - prototype.setJdbcName(tableField.getName()); - if (tableField.getColumnType() != null) { - prototype.setJdbcType(tableField.getColumnType().getType()); - prototype.setPropertyType(tableField.getColumnType().getType()); - } - prototype.setJdbcComment(tableField.getComment()); - prototype.setPropertyName(tableField.getPropertyName()); - prototype.setComponentType("input"); - return prototype; - }).collect(Collectors.toList()); - } -} diff --git a/src/main/java/org/springblade/modules/develop/service/impl/ModelPrototypeServiceImpl.java b/src/main/java/org/springblade/modules/develop/service/impl/ModelPrototypeServiceImpl.java deleted file mode 100644 index 7f3aeed..0000000 --- a/src/main/java/org/springblade/modules/develop/service/impl/ModelPrototypeServiceImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service.impl; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.generator.config.DataSourceConfig; -import com.baomidou.mybatisplus.generator.config.StrategyConfig; -import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder; -import com.baomidou.mybatisplus.generator.config.po.TableInfo; -import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; -import lombok.RequiredArgsConstructor; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.tool.utils.StringPool; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.modules.develop.pojo.entity.Datasource; -import org.springblade.modules.develop.pojo.entity.ModelPrototype; -import org.springblade.modules.develop.mapper.ModelPrototypeMapper; -import org.springblade.modules.develop.service.IDatasourceService; -import org.springblade.modules.develop.service.IModelPrototypeService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Iterator; -import java.util.List; - -/** - * 数据原型表 服务实现类 - * - * @author Chill - */ -@Service -@RequiredArgsConstructor -public class ModelPrototypeServiceImpl extends BaseServiceImpl implements IModelPrototypeService { - - private final IDatasourceService datasourceService; - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean submitList(List modelPrototypes) { - modelPrototypes.forEach(modelPrototype -> { - if (modelPrototype.getId() == null) { - this.save(modelPrototype); - } else { - this.updateById(modelPrototype); - } - }); - return true; - } - - @Override - public List prototypeList(Long modelId) { - return this.list(Wrappers.lambdaQuery().eq(ModelPrototype::getModelId, modelId)); - } - - @Override - public TableInfo getTableInfo(String tableName, Long datasourceId) { - Datasource datasource = datasourceService.getById(datasourceId); - ConfigBuilder config = getConfigBuilder(datasource, tableName); - List tableInfoList = config.getTableInfoList(); - TableInfo tableInfo = null; - Iterator iterator = tableInfoList.stream().filter(table -> table.getName().equals(tableName)).toList().iterator(); - if (iterator.hasNext()) { - tableInfo = iterator.next(); - if (tableName.contains(StringPool.UNDERSCORE)) { - String entityPrefix = StringUtil.firstCharToUpper(tableName.split(StringPool.UNDERSCORE)[0]); - String entityName = StringUtil.removePrefix(tableInfo.getEntityName(), entityPrefix); - tableInfo.setEntityName(entityName); - } else { - tableInfo.setEntityName(StringUtil.firstCharToUpper(tableName)); - } - } - return tableInfo; - } - - @Override - public ConfigBuilder getConfigBuilder(Datasource datasource, String tableName) { - StrategyConfig.Builder builder = new StrategyConfig.Builder(); - //表前缀过滤,目前官方仅支持一个前缀,可自行修改为sys_或tb_或其他业务表前缀 - //builder.likeTable(new LikeTable("blade_", SqlLike.RIGHT)); - if (StringUtil.isNotBlank(tableName)) { - builder.addInclude(tableName); - } - StrategyConfig strategyConfig = builder.entityBuilder() - .naming(NamingStrategy.underline_to_camel) - .columnNaming(NamingStrategy.underline_to_camel).build(); - DataSourceConfig datasourceConfig = new DataSourceConfig.Builder( - datasource.getUrl(), datasource.getUsername(), datasource.getPassword() - ).build(); - return new ConfigBuilder(null, datasourceConfig, strategyConfig, null, null, null); - } - -} diff --git a/src/main/java/org/springblade/modules/develop/service/impl/ModelServiceImpl.java b/src/main/java/org/springblade/modules/develop/service/impl/ModelServiceImpl.java deleted file mode 100644 index 56049df..0000000 --- a/src/main/java/org/springblade/modules/develop/service/impl/ModelServiceImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ -package org.springblade.modules.develop.service.impl; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import lombok.RequiredArgsConstructor; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.modules.develop.pojo.entity.Code; -import org.springblade.modules.develop.pojo.entity.Model; -import org.springblade.modules.develop.pojo.entity.ModelPrototype; -import org.springblade.modules.develop.mapper.ModelMapper; -import org.springblade.modules.develop.service.ICodeService; -import org.springblade.modules.develop.service.IModelPrototypeService; -import org.springblade.modules.develop.service.IModelService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -/** - * 数据模型表 服务实现类 - * - * @author Chill - */ -@Service -@RequiredArgsConstructor -public class ModelServiceImpl extends BaseServiceImpl implements IModelService { - - private final IModelPrototypeService modelPrototypeService; - private final ICodeService codeService; - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean delete(List ids) { - boolean modelTemp = this.deleteLogic(ids); - if (modelTemp) { - if (modelPrototypeService.count(Wrappers.lambdaQuery().in(ModelPrototype::getModelId, ids)) > 0) { - boolean prototypeTemp = modelPrototypeService.remove(Wrappers.lambdaQuery().in(ModelPrototype::getModelId, ids)); - if (!prototypeTemp) { - throw new ServiceException("删除数据模型成功,关联数据原型删除失败"); - } - } - if (codeService.count(Wrappers.lambdaQuery().in(Code::getModelId, ids)) > 0) { - boolean codeTemp = codeService.remove(Wrappers.lambdaQuery().in(Code::getModelId, ids)); - if (!codeTemp) { - throw new ServiceException("删除数据模型成功,关联代码生成配置删除失败"); - } - } - } - return true; - } -}