diff --git a/ebts/ebts-generator/pom.xml b/ebts/ebts-generator/pom.xml deleted file mode 100644 index dd3560c..0000000 --- a/ebts/ebts-generator/pom.xml +++ /dev/null @@ -1,243 +0,0 @@ - - - - ebts - com.ebts - 1.0.0 - - 4.0.0 - - ebts-generator - - - generator代码生成 - - - - - - org.apache.velocity - velocity - - - - commons-net - commons-net - 3.7 - - - - - org.springframework - spring-context-support - - - - - org.springframework - spring-web - - - - - org.springframework.boot - spring-boot-starter-security - - - - - com.github.pagehelper - pagehelper-spring-boot-starter - - - - - javax.validation - validation-api - - - - - org.apache.commons - commons-lang3 - - - - - com.fasterxml.jackson.core - jackson-databind - - - - - com.alibaba - fastjson - - - - - commons-io - commons-io - - - - - commons-fileupload - commons-fileupload - - - - - org.apache.poi - poi-ooxml - - - - - org.yaml - snakeyaml - - - - - io.jsonwebtoken - jjwt - - - - - org.springframework.boot - spring-boot-starter-data-redis - - - - - org.apache.commons - commons-pool2 - - - - - eu.bitwalker - UserAgentUtils - - - - - javax.servlet - javax.servlet-api - - - - io.springfox - springfox-swagger2 - - - - - io.swagger - swagger-annotations - 1.5.21 - - - - io.swagger - swagger-models - 1.5.21 - - - - - io.springfox - springfox-swagger-ui - - - - com.ebts - ebts-common - - - com.github.wvengen - proguard-maven-plugin - 2.0.14 - - - - - - - - com.github.wvengen - proguard-maven-plugin - 2.0.14 - - - package - - proguard - - - - - - true - pg - - - log4j-api - org.apache.logging.log4j - - - - - - - - - - - - - - - - - - - - - - - - - - - D:/Java/jdk1.8/lib/rt.jar - D:/Java/jdk1.8/lib/jce.jar - - - - ebts-generator-1.0.0.jar - ebts-generator.jar - - - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/config/Config.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/config/Config.java deleted file mode 100644 index 7d28c77..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/config/Config.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ebts.generator.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * @Author 18209 - * @Date 2021/2/23 15:48 - * @Version 1.0 - */ - -@Component -@ConfigurationProperties(prefix = "ebts") -public class Config { - - - - /** - * 上传路径 - */ - private static String profile; - - - public static String getProfile() { - return profile; - } - - /** - * 获取下载路径 - */ - public static String getDownloadPath() { - return getProfile() + "/download/"; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/config/GenConfig.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/config/GenConfig.java deleted file mode 100644 index eb8dc3c..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/config/GenConfig.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ebts.generator.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.PropertySource; -import org.springframework.stereotype.Component; - -/** - * 读取代码生成相关配置 - * - * @author binlin - */ -@Component -@ConfigurationProperties(prefix = "gen") -@PropertySource(value = {"classpath:generator.yml"}) -public class GenConfig { - /** - * 作者 - */ - public static String author; - - /** - * 生成包路径 - */ - public static String packageName; - - /** - * 自动去除表前缀,默认是false - */ - public static boolean autoRemovePre; - - /** - * 表前缀(类名不会包含表前缀) - */ - public static String tablePrefix; - - public static String getAuthor() { - return author; - } - - @Value("${author}") - public void setAuthor(String author) { - GenConfig.author = author; - } - - public static String getPackageName() { - return packageName; - } - - @Value("${packageName}") - public void setPackageName(String packageName) { - GenConfig.packageName = packageName; - } - - public static boolean getAutoRemovePre() { - return autoRemovePre; - } - - @Value("${autoRemovePre}") - public void setAutoRemovePre(boolean autoRemovePre) { - GenConfig.autoRemovePre = autoRemovePre; - } - - public static String getTablePrefix() { - return tablePrefix; - } - - @Value("${tablePrefix}") - public void setTablePrefix(String tablePrefix) { - GenConfig.tablePrefix = tablePrefix; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/ApiClassController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/ApiClassController.java deleted file mode 100644 index ce5d4b7..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/ApiClassController.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.ebts.generator.controller; - -import java.io.Serializable; -import java.util.List; - -import com.ebts.common.annotation.Log; -import com.ebts.common.core.controller.BaseController; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.enums.BusinessType; -import com.ebts.common.utils.ServerResult; -import com.ebts.common.utils.poi.ExcelUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ebts.generator.entity.ApiClass; -import com.ebts.generator.service.ApiClassService; - -/** - * 接口类名Controller - * - * @author binlin - * @date 2021-01-24 - */ -@RestController -@RequestMapping("/tool/apiclass") -public class ApiClassController extends BaseController { - protected final Logger logger = LoggerFactory.getLogger(ApiClassController.class); - - @Autowired - private ApiClassService apiClassService; - - - /** - * 获取到api类的select选项 - * - * @return - */ - @PreAuthorize("@ebts.hasAnyPermi('tool:apiclass:querylist')") - @GetMapping("querylist") - public AjaxResult queryList() { - ServerResult> ServerResult = apiClassService.selectApiclassList(new ApiClass()); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 查询接口类名列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:apiclass:list')") - @GetMapping("/list") - public Serializable list(ApiClass apiclass) { - startPage(); - ServerResult> ServerResult = apiClassService.selectApiclassList(apiclass); - if (ServerResult.isStart()) { - return getDataTable(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 导出接口类名列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:apiclass:export')") - @Log(title = "接口类名", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ApiClass apiclass) { - ServerResult> ServerResult = apiClassService.selectApiclassList(apiclass); - ExcelUtil util = new ExcelUtil<>(ApiClass.class); - if (ServerResult.isStart()) { - return util.exportExcel(ServerResult.getData(), "apiclass"); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 获取接口类名详细信息 - */ - @PreAuthorize("@ebts.hasPermi('tool:apiclass:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - ServerResult ServerResult = apiClassService.selectApiclassById(id); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 新增接口类名 - */ - @PreAuthorize("@ebts.hasPermi('tool:apiclass:add')") - @Log(title = "接口类名", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ApiClass apiclass) { - if (apiclass.getmId() == null || apiclass.getmId() < 0) { - return AjaxResult.error("模块id不能为空!"); - } - if (apiclass.getcName() == null || apiclass.getcName().equals("")) { - return AjaxResult.error("类名不能为空!"); - } - if (apiclass.getcDescribe() == null || apiclass.getcDescribe().equals("")) { - return AjaxResult.error("类描述不能为空!"); - } - ServerResult ServerResult = apiClassService.insertApiclass(apiclass); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 修改接口类名 - */ - @PreAuthorize("@ebts.hasPermi('tool:apiclass:edit')") - @Log(title = "接口类名", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ApiClass apiclass) { - if (apiclass.getmId() == null || apiclass.getmId() < 0) { - return AjaxResult.error("模块id不能为空!"); - } - if (apiclass.getcName() == null || apiclass.getcName().equals("")) { - return AjaxResult.error("类名不能为空!"); - } - if (apiclass.getcDescribe() == null || apiclass.getcDescribe().equals("")) { - return AjaxResult.error("类描述不能为空!"); - } - ServerResult ServerResult = apiClassService.updateApiclass(apiclass); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 删除接口类名 - */ - @PreAuthorize("@ebts.hasPermi('tool:apiclass:remove')") - @Log(title = "接口类名", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - if (ids.length < 0) { - return AjaxResult.error("id不能为空!"); - } - ServerResult ServerResult = apiClassService.deleteApiclassByIds(ids); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/GenController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/GenController.java deleted file mode 100644 index d9960df..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/GenController.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.ebts.generator.controller; - -import java.io.*; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.servlet.http.HttpServletResponse; - -import com.ebts.common.annotation.Log; -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.core.controller.BaseController; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.core.page.TableDataInfo; -import com.ebts.common.core.text.Convert; -import com.ebts.common.enums.BusinessType; -import com.ebts.common.utils.ServerResult; -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ebts.generator.entity.GenTable; -import com.ebts.generator.entity.GenTableColumn; -import com.ebts.generator.service.GenTableColumnService; -import com.ebts.generator.service.GenTableService; - -/** - * 代码生成 操作处理 - * - * @author binlin - */ -@RestController -@RequestMapping("/tool/gen") -public class GenController extends BaseController { - private Logger logger = LoggerFactory.getLogger(GenController.class); - - @Autowired - private GenTableService genTableService; - - @Autowired - private GenTableColumnService genTableColumnService; - - /** - * 查询代码生成列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:list')") - @GetMapping("/list") - public Serializable genList(GenTable genTable) { - startPage(); - List list = genTableService.selectGenTableList(genTable); - return getDataTable(list); - } - - /** - * 修改代码生成业务 - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:query')") - @GetMapping(value = "/{talbleId}") - public AjaxResult getInfo(@PathVariable Long talbleId) { - GenTable table = genTableService.selectGenTableById(talbleId); - List tables = genTableService.selectGenTableAll(); - List list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); - Map map = new HashMap(); - map.put("info", table); - map.put("rows", list); - map.put("tables", tables); - return AjaxResult.success(map); - } - - /** - * 查询数据库列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:list')") - @GetMapping("/db/list") - public Serializable dataList(GenTable genTable) { - startPage(); - List list = genTableService.selectDbTableList(genTable); - return getDataTable(list); - } - - /** - * 查询数据表字段列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:list')") - @GetMapping(value = "/column/{talbleId}") - public Serializable columnList(Long tableId) { - TableDataInfo dataInfo = new TableDataInfo(); - List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); - dataInfo.setRows(list); - dataInfo.setTotal(list.size()); - return dataInfo; - } - - /** - * 导入表结构(保存) - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:list')") - @Log(title = "代码生成", businessType = BusinessType.IMPORT) - @PostMapping("/importTable") - public AjaxResult importTableSave(String tables) { - String[] tableNames = Convert.toStrArray(tables); - // 查询表信息 - List tableList = genTableService.selectDbTableListByNames(tableNames); - genTableService.importGenTable(tableList); - return AjaxResult.success(); - } - - /** - * todo - * 修改保存代码生成业务 - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:edit')") - @Log(title = "代码生成", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult editSave(@Validated @RequestBody GenTable genTable) { - genTableService.validateEdit(genTable); - genTableService.updateGenTable(genTable); - return AjaxResult.success(); - } - - /** - * 删除代码生成 - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:remove')") - @Log(title = "代码生成", businessType = BusinessType.DELETE) - @DeleteMapping("/{tableIds}") - public AjaxResult remove(@PathVariable Long[] tableIds) { - try { - ServerResult ServerResult = genTableService.deleteGenTableByIds(tableIds); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - return AjaxResult.error(ReturnConstants.SYS_ERROR); - } - } - - /** - * 预览代码 - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:preview')") - @GetMapping("/preview/{tableId}") - public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException { - Map dataMap = genTableService.previewCode(tableId); - return AjaxResult.success(dataMap); - } - - /** - * 生成代码(下载方式) - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:code')") - @Log(title = "代码生成", businessType = BusinessType.GENCODE) - @GetMapping("/download/{tableName}") - public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException { - byte[] data = genTableService.downloadCode(tableName); - genCode(response, data); - } - - /** - * 生成代码(自定义路径) - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:code')") - @Log(title = "代码生成", businessType = BusinessType.GENCODE) - @GetMapping("/genCode/{tableName}") - public AjaxResult genCode(@PathVariable("tableName") String tableName) { - boolean start = genTableService.generatorCode(tableName); - if (start) { - return AjaxResult.success(); - } else { - return AjaxResult.error("模板渲染失败!"); - } - } - - /** - * 同步数据库 - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:edit')") - @Log(title = "代码生成", businessType = BusinessType.UPDATE) - @GetMapping("/synchDb/{tableName}") - public AjaxResult synchDb(@PathVariable("tableName") String tableName) { - genTableService.synchDb(tableName); - return AjaxResult.success(); - } - - /** - * 批量生成代码 - */ - @PreAuthorize("@ebts.hasPermi('tool:gen:code')") - @Log(title = "代码生成", businessType = BusinessType.GENCODE) - @GetMapping("/batchGenCode") - public void batchGenCode(HttpServletResponse response, String tables) throws IOException { - String[] tableNames = Convert.toStrArray(tables); - byte[] data = genTableService.downloadCode(tableNames); - genCode(response, data); -// if (compress(data)){ -// return AjaxResult.success("ebts.zip"); -// }else { -// return AjaxResult.error(); -// } - } - - /** - * 生成zip文件 - */ - private void genCode(HttpServletResponse response, byte[] data) throws IOException { - response.reset(); - response.addHeader("Access-Control-Allow-Origin", "*"); - response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); - response.setHeader("Content-Disposition", "attachment; filename=\"ebts.zip\""); - response.addHeader("Content-Length", "" + data.length); - response.setContentType("application/octet-stream; charset=UTF-8"); - IOUtils.write(data, response.getOutputStream()); - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/InterTableController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/InterTableController.java deleted file mode 100644 index 9b09804..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/InterTableController.java +++ /dev/null @@ -1,254 +0,0 @@ -package com.ebts.generator.controller; - -import java.io.IOException; -import java.io.Serializable; -import java.util.Map; - - -import com.ebts.common.annotation.Log; -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.core.controller.BaseController; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.enums.BusinessType; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dto.InterTableDto; -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ebts.generator.entity.InterTable; -import com.ebts.generator.service.InterTableService; - -import javax.servlet.http.HttpServletResponse; - -/** - * 接口信息Controller - * - * @author binlin - * @date 2021-01-25 - */ - -@RestController -@RequestMapping("/generator/intertable") -public class InterTableController extends BaseController { - protected final Logger logger = LoggerFactory.getLogger(InterTableController.class); - - @Autowired - private InterTableService interTableService; - - /** - * 查询接口信息列表 - */ - @PreAuthorize("@ebts.hasPermi('generator:intertable:list')") - @GetMapping("/list") - public Serializable list(InterTable interTable) { - ServerResult> ServerResult = interTableService.selectInterTableList(interTable); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 预览代码(工作流) - */ - - @PreAuthorize("@ebts.hasPermi('generator:intertable:classpreview')") - @Log(title = "预览代码(工作流)", businessType = BusinessType.GENCODE) - @GetMapping("/classpreview/{id}") - public AjaxResult classPreview(@PathVariable("id") Long id) { - ServerResult> ServerResult = interTableService.previewCodeCalss(id); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 预览代码(工作台) - */ - @PreAuthorize("@ebts.hasPermi('generator:intertable:modulepreview')") - @Log(title = "预览代码(工作台)", businessType = BusinessType.GENCODE) - @GetMapping("/modulepreview/{id}") - public AjaxResult modulePreview(@PathVariable("id") Long id) { - ServerResult> ServerResult = interTableService.previewCodeMoudle(id); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - - /** - * 生成代码(工作流) - * - * @param id - * @return - */ - @PreAuthorize("@ebts.hasPermi('generator:intertable:classgen')") - @Log(title = "生成代码(工作流)", businessType = BusinessType.GENCODE) - @GetMapping("/classgen/{id}") - public AjaxResult classGenerator(@PathVariable("id") Long id, HttpServletResponse response) { - try { - ServerResult ServerResult = interTableService.generatorCodeClass(id); - if (ServerResult.isStart()) { - genCode(response, ServerResult.getData()); - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } catch (IOException e) { - e.printStackTrace(); - return AjaxResult.error(); - } - } - - /** - * 生成代码(工作台) - * - * @param id - * @param response - * @return - */ - @PreAuthorize("@ebts.hasPermi('generator:intertable:moudlegen')") - @Log(title = "生成代码(工作台)", businessType = BusinessType.GENCODE) - @GetMapping("/moudlegen/{id}") - public AjaxResult moudleGenerator(@PathVariable("id") Long id, HttpServletResponse response) { - try { - ServerResult ServerResult = interTableService.generatorCodeMoudle(id); - if (ServerResult.isStart()) { - genCode(response, ServerResult.getData()); - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } catch (RuntimeException | IOException e) { - logger.error(e.getMessage()); - return AjaxResult.error(ReturnConstants.SYS_ERROR); - } - } - - - /** - * 修改接口信息 - */ - @PreAuthorize("@ebts.hasPermi('generator:intertable:edit')") - @Log(title = "接口信息", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@Validated @RequestBody InterTableDto interTableDto) { - ServerResult ServerResult = interTableService.updateInterTable(interTableDto); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 生成zip文件 - */ - private void genCode(HttpServletResponse response, byte[] data) throws IOException { - response.reset(); - response.addHeader("Access-Control-Allow-Origin", "*"); - response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); - response.setHeader("Content-Disposition", "attachment; filename=\"ebts.zip\""); - response.addHeader("Content-Length", "" + data.length); - response.setContentType("application/octet-stream; charset=UTF-8"); - IOUtils.write(data, response.getOutputStream()); - } - - -// /** -// * 导出接口信息列表 -// */ -// @PreAuthorize("@ebts.hasPermi('generator:intertable:export')") -// @Log(title = "接口信息", businessType = BusinessType.EXPORT) -// @GetMapping("/export") -// public GenResult export(InterTable interTable) { -// try { -// ServerResult> serverResult = interTableService.selectInterTableList(interTable); -// GenExcelUtil util = new GenExcelUtil(InterTable. class); -// if (serverResult.isStart()) { -// return util.exportExcel(serverResult.getData(), "intertable"); -// } else { -// return GenResult.error(serverResult.getMsg()); -// } -// } catch (RuntimeException e) { -// logger.error(e.getMessage()); -// return GenResult.error(ReturnConstants.SYS_ERROR); -// } -// } - -// /** -// * 获取接口信息详细信息 -// */ -// @PreAuthorize("@ebts.hasPermi('generator:intertable:query')") -// @GetMapping(value = "/{id}") -// public GenResult Info(@PathVariable("id") Long id) { -// try { -// ServerResult serverResult = interTableService.selectInterTableById(id); -// if (serverResult.isStart()) { -// return GenResult.success(serverResult.getData()); -// } else { -// return GenResult.info(serverResult.getMsg()); -// } -// } catch (RuntimeException e) { -// logger.error(e.getMessage()); -// return GenResult.error(ReturnConstants.SYS_ERROR); -// } -// } -// -// /** -// * 新增接口信息 -// */ -// @PreAuthorize("@ebts.hasPermi('generator:intertable:add')") -// @Log(title = "接口信息", businessType = BusinessType.INSERT) -// @PostMapping -// public GenResult add(@RequestBody InterTable interTable) { -// try { -// ServerResult serverResult = interTableService.insertInterTable(interTable); -// if (serverResult.isStart()) { -// return GenResult.success(); -// } else { -// return GenResult.error(serverResult.getMsg()); -// } -// } catch (RuntimeException e) { -// logger.error(e.getMessage()); -// return GenResult.error(ReturnConstants.SYS_ERROR); -// } -// } -// -// /** -// * 删除接口信息 -// */ -// @PreAuthorize("@ebts.hasPermi('generator:intertable:remove')") -// @Log(title = "接口信息", businessType = BusinessType.DELETE) -// @DeleteMapping("/{ids}") -// public GenResult remove(@PathVariable Long[] ids) { -// try { -// if (ids.length<0){ -// return GenResult.error("id不能为空!"); -// } -// ServerResult serverResult = interTableService.deleteInterTableByIds(ids); -// if (serverResult.isStart()) { -// return GenResult.success(); -// } else { -// return GenResult.error(serverResult.getMsg()); -// } -// }catch (RuntimeException e){ -// logger.error(e.getMessage()); -// return GenResult.error(ReturnConstants.SYS_ERROR); -// } -// } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/ModuleController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/ModuleController.java deleted file mode 100644 index f766adb..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/ModuleController.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.ebts.generator.controller; - -import java.io.Serializable; -import java.util.List; - - -import com.ebts.common.annotation.Log; -import com.ebts.common.core.controller.BaseController; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.enums.BusinessType; -import com.ebts.common.utils.ServerResult; -import com.ebts.common.utils.poi.ExcelUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ebts.generator.entity.Module; -import com.ebts.generator.service.ModuleService; - -/** - * 模块管理Controller - * - * @author binlin - * @date 2021-01-24 - */ -@RestController -@RequestMapping("/tool/module") -public class ModuleController extends BaseController { - protected final Logger logger = LoggerFactory.getLogger(ModuleController.class); - - @Autowired - private ModuleService moduleService; - - - /** - * 获取到api类的select选项 - * - * @return - */ - @PreAuthorize("@ebts.hasAnyPermi('tool:module:querylist')") - @GetMapping("querylist") - public AjaxResult queryList() { - ServerResult> ServerResult = moduleService.selectModuleList(new Module()); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - - /** - * 查询模块管理列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:module:list')") - @GetMapping("/list") - public Serializable list(Module module) { - startPage(); - ServerResult> ServerResult = moduleService.selectModuleList(module); - if (ServerResult.isStart()) { - return getDataTable(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 导出模块管理列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:module:export')") - @Log(title = "模块管理", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(Module module) { - ServerResult> ServerResult = moduleService.selectModuleList(module); - ExcelUtil util = new ExcelUtil(Module.class); - if (ServerResult.isStart()) { - return util.exportExcel(ServerResult.getData(), "module"); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 获取模块管理详细信息 - */ - @PreAuthorize("@ebts.hasPermi('tool:module:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - ServerResult ServerResult = moduleService.selectModuleById(id); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 新增模块管理 - */ - @PreAuthorize("@ebts.hasPermi('tool:module:add')") - @Log(title = "模块管理", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody Module module) { - if (module.getmName() == null || module.getmName().equals("")) { - return AjaxResult.error("模块名称不能为空!"); - } - if (module.getmDescribe() == null || module.getmDescribe().equals("")) { - return AjaxResult.error("模块描述不能为空!"); - } - ServerResult ServerResult = moduleService.insertModule(module); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 修改模块管理 - */ - @PreAuthorize("@ebts.hasPermi('tool:module:edit')") - @Log(title = "模块管理", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody Module module) { - if (module.getmName() == null || module.getmName().equals("")) { - return AjaxResult.error("模块名称不能为空!"); - } - if (module.getmDescribe() == null || module.getmDescribe().equals("")) { - return AjaxResult.error("模块描述不能为空!"); - } - ServerResult ServerResult = moduleService.updateModule(module); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 删除模块管理 - */ - @PreAuthorize("@ebts.hasPermi('tool:module:remove')") - @Log(title = "模块管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - if (ids.length < 0) { - return AjaxResult.error("id不能为空!"); - } - ServerResult ServerResult = moduleService.deleteModuleByIds(ids); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/QueryController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/QueryController.java deleted file mode 100644 index 59339d9..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/QueryController.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.ebts.generator.controller; - -import com.ebts.common.core.controller.BaseController; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.utils.MapExcelUtil; -import com.ebts.common.utils.ServerResult; -import com.ebts.common.utils.StringUtils; -import com.ebts.generator.utils.sql.GenSqlUtil; -import com.github.pagehelper.PageHelper; -import com.ebts.generator.entity.UniCon; -import com.ebts.generator.entity.UniQuery; -import com.ebts.generator.service.QueryService; -import com.ebts.generator.utils.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * Author 18209 - * Date 2021/1/30 18:25 - * Version 1.0 - */ -@RestController -@RequestMapping("/query") -public class QueryController extends BaseController { - private Logger logger = LoggerFactory.getLogger(QueryController.class); - - - @Autowired - private QueryService queryService; - - /** - * todo 获取编辑sql的基本信息 - * - * @param id - * @return - */ - @PreAuthorize("@ebts.hasPermi('query:list')") - @GetMapping("/{id}") - public AjaxResult Info(@PathVariable("id") Long id) { - ServerResult ServerResult = queryService.selectQueryById(id); - if (ServerResult.isStart()) { - UniQuery uniQuery = ServerResult.getData(); - Map modeMap = new HashMap<>(); - List uniCons = uniQuery.getUniCons(); - uniQuery.setUniCons(null); - modeMap.put("info", uniQuery); - modeMap.put("list", uniCons); - return AjaxResult.success(modeMap); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 更新万能查询编辑信息 info 和查询信息 - * - * @param uniQuery - * @return - */ - @PreAuthorize("@ebts.hasPermi('query:edit')") - @PutMapping - public AjaxResult edit(@Validated @RequestBody UniQuery uniQuery) { - ServerResult ServerResult = queryService.updateQueryInfo(uniQuery); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 导出预览数据 - * - * @param uniQuery - * @return - */ - @PreAuthorize("@ebts.hasAnyPermi('query:export')") - @PutMapping("export") - public AjaxResult export(@Validated @RequestBody UniQuery uniQuery) { - ServerResult>> ServerResult = queryService.previewQuery(uniQuery); - if (ServerResult.isStart()) { - return new MapExcelUtil().exportExcel(ServerResult.getData(), uniQuery.getUqName()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 返回预览信息 - * - * @param uniQuery - * @return - */ - @PreAuthorize("@ebts.hasPermi('query:preview')") - @PutMapping("preview") - public Serializable Preview(@Validated @RequestBody UniQuery uniQuery) { - startPage(uniQuery); - ServerResult>> ServerResult = queryService.previewQuery(uniQuery); - if (ServerResult.isStart()) { - return getDataTable(ServerResult.getData()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 发布上线 - * - * @param uniQuery - * @return - */ - @PreAuthorize("@ebts.hasPermi('query:release')") - @PutMapping("/release") - public AjaxResult Release(@RequestBody UniQuery uniQuery) { - if (uniQuery.getId() == null) { - return AjaxResult.error("id不能为空!"); - } else { - if (uniQuery.getIsRelease() == 1 || uniQuery.getIsRelease() == 2) { - ServerResult ServerResult = queryService.Release(uniQuery); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } else { - return AjaxResult.error("状态输入错误!"); - } - } - } - - /** - * 设置请求分页数据 - */ - protected void startPage(UniQuery uniQuery) { - Integer pageNum = uniQuery.getPageNum(); - Integer pageSize = uniQuery.getPageSize(); - if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { - String orderBy = GenSqlUtil.escapeOrderBySql(""); - PageHelper.startPage(pageNum, pageSize, orderBy); - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/RegularController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/RegularController.java deleted file mode 100644 index ee26f3c..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/RegularController.java +++ /dev/null @@ -1,197 +0,0 @@ -package com.ebts.generator.controller; - -import java.io.Serializable; -import java.util.List; -import java.util.regex.Pattern; - -import com.ebts.common.annotation.Log; -import com.ebts.common.core.controller.BaseController; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.enums.BusinessType; -import com.ebts.common.utils.ServerResult; -import com.ebts.common.utils.poi.ExcelUtil; -import com.ebts.generator.entity.Regular; -import com.ebts.generator.service.RegularService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * 校验规则Controller - * - * @author binlin - * @date 2021-01-18 - */ -@RestController -@RequestMapping("/tool/regular") -public class RegularController extends BaseController { - protected final Logger logger = LoggerFactory.getLogger(RegularController.class); - - @Autowired - private RegularService regularService; - - /** - * 查询校验规则列表 - * - * @param regular - * @return - */ - @PreAuthorize("@ebts.hasPermi('tool:regular:list')") - @GetMapping("/list") - public Serializable list(Regular regular) { - startPage(); - ServerResult> ServerResult = regularService.selectRegularList(regular); - if (ServerResult.isStart()) { - return getDataTable(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 查询校验规则列表 - * - * @return - */ - @PreAuthorize("@ebts.hasPermi('tool:regular:option')") - @GetMapping("/option") - public Serializable option() { - startPage(); - ServerResult> ServerResult = regularService.selectRegularOption(); - if (ServerResult.isStart()) { - return getDataTable(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 导出校验规则列表 - * - * @param regular - * @return - */ - @PreAuthorize("@ebts.hasPermi('tool:regular:export')") - @Log(title = "校验规则", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(Regular regular) { - ServerResult> ServerResult = regularService.selectRegularList(regular); - ExcelUtil util = new ExcelUtil(Regular.class); - if (ServerResult.isStart()) { - return util.exportExcel(ServerResult.getData(), "regular"); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 获取校验规则详细信息 - * - * @param id - * @return - */ - @PreAuthorize("@ebts.hasPermi('tool:regular:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - ServerResult ServerResult = regularService.selectRegularById(id); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 新增校验规则 - * - * @param regular - * @return - */ - @PreAuthorize("@ebts.hasPermi('tool:regular:add')") - @Log(title = "校验规则", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody Regular regular) { - if (regular.getName() == null || regular.getName().equals("")) { - return AjaxResult.error("正则名称不能为空!"); - } - if (regular.getRegular() == null || regular.getRegular().equals("")) { - return AjaxResult.error("正则内容不能为空!"); - } - if (regular.getEnable() == null || regular.getEnable() < 0) { - return AjaxResult.error("是否启用不能为空!"); - } - if (!verifyRegular(regular)) { - return AjaxResult.error("正则表达式校验不通过!"); - } - ServerResult ServerResult = regularService.insertRegular(regular); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 修改校验规则 - * - * @param regular - * @return - */ - @PreAuthorize("@ebts.hasPermi('tool:regular:edit')") - @Log(title = "校验规则", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody Regular regular) { - if (regular.getName() == null || regular.getName().equals("")) { - return AjaxResult.error("正则名称不能为空!"); - } - if (regular.getRegular() == null || regular.getRegular().equals("")) { - return AjaxResult.error("正则内容不能为空!"); - } - if (regular.getEnable() == null || regular.getEnable() < 0) { - return AjaxResult.error("是否启用不能为空!"); - } - if (!verifyRegular(regular)) { - return AjaxResult.error("正则表达式校验不通过!"); - } - ServerResult ServerResult = regularService.updateRegular(regular); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 删除校验规则 - * - * @param ids - * @return - */ - @PreAuthorize("@ebts.hasPermi('tool:regular:remove')") - @Log(title = "校验规则", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - if (ids.length == 0) { - return AjaxResult.error("需要删除id数不能为空!"); - } - ServerResult ServerResult = regularService.deleteRegularByIds(ids); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - public boolean verifyRegular(Regular regular) { - return Pattern.matches(regular.getRegular(), regular.getValidation()); - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/RelController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/RelController.java deleted file mode 100644 index b63bd66..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/RelController.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.ebts.generator.controller; - -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.RelColumn; -import com.ebts.generator.entity.RelTable; -import com.ebts.generator.service.RelService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; -import java.util.Map; - -/** - * @Author 18209 - * @Date 2021/2/24 16:22 - * @Version 1.0 - */ -@RestController -@RequestMapping("/rel") -public class RelController { - private Logger logger = LoggerFactory.getLogger(RelController.class); - @Autowired - private RelService relService; - - /** - * 获取表的基础信息 - * - * @return - */ - @PreAuthorize("@ebts.hasAnyPermi('rel:tableinfo')") - @GetMapping("/tableinfo") - public AjaxResult tableinfos() { - ServerResult>> ServerResult = relService.tableInfos(); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 获取表的字段信息 - * - * @param tableName - * @param relId - * @return - */ - @PreAuthorize("@ebts.hasAnyPermi('rel:tableinfo')") - @GetMapping("/{tableName}/{relId}") - public AjaxResult relColumns(@PathVariable("tableName") String tableName, @PathVariable("relId") Long relId) { - ServerResult> ServerResult = relService.relColumns(tableName, relId); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - @PreAuthorize("@ebts.hasAnyPermi('rel:colums')") - @GetMapping("/{tableName}") - public AjaxResult tableColumns(@PathVariable("tableName") String tableName) { - ServerResult>> ServerResult = relService.tableColumns(tableName); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - @PreAuthorize("@ebts.hasAnyPermi('rel:colums')") - @GetMapping("/colums/{tableId}") - public AjaxResult relTableByTableId(@PathVariable("tableId") Long tableId) { - ServerResult> ServerResult = relService.relTableByTableId(tableId); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/TopQueryController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/TopQueryController.java deleted file mode 100644 index 2681a3a..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/TopQueryController.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.ebts.generator.controller; - -import com.ebts.common.annotation.Log; -import com.ebts.common.core.controller.BaseController; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.enums.BusinessType; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import com.ebts.common.utils.StringUtils; -import com.ebts.generator.dto.TopResult; -import com.ebts.generator.entity.UniQuery; -import com.ebts.generator.service.TopQueryService; -import com.ebts.generator.service.UniQueryService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import java.io.Serializable; -import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; - - -/** - * @author: Clay - * @date: 2021/7/23 21:36 - * @description:TopQueryController - * @email: clay@hchyun.com - */ -@RestController -@RequestMapping("/top") -public class TopQueryController extends BaseController { - - @Autowired - private UniQueryService uniQueryService; - - @Autowired - private TopQueryService topQueryService; - - /** - * 获取基本信息 - * - * @param id - * @return - */ - @PreAuthorize("@ebts.hasPermi('top:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - ServerResult ServerResult = uniQueryService.selectUniQueryById(id); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - @GetMapping("/online/{id}") - public AjaxResult online(@PathVariable("id") Long id){ - // ServerResult ServerResult = queryService.updateQueryInfo(uniQuery); - // if (ServerResult.isStart()) { - // return AjaxResult.success(ServerResult.getData()); - // } else { - // return AjaxResult.info(ServerResult.getMsg()); - // } - return AjaxResult.success(); - } - - - /** - * 获取基本信息 - * - * @param - * @return - */ - @PreAuthorize("@ebts.hasPermi('top:table')") - @GetMapping("/table") - public AjaxResult table() { - return AjaxResult.success(topQueryService.selectTopSearchTables()); - } - - /** - * 简单修改top万能能查询 - */ - @PreAuthorize("@ebts.hasPermi('top:edit')") - @Log(title = "top万能查询", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody UniQuery uniQuery) { - if (uniQuery.getId()<0){ - return AjaxResult.error("缺少关键字段"); - } - if (StringUtils.isNull(uniQuery.getTopJson())){ - return AjaxResult.error("缺少关键字段"); - } - ServerResult ServerResult = uniQueryService.updateUniQuery(uniQuery); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - /** - * 简单修改top万能能查询 - */ - @PreAuthorize("@ebts.hasPermi('top:preview')") - @Log(title = "top预览", businessType = BusinessType.OTHER) - @PostMapping("/preview") - public Serializable preview(@RequestBody Map params){ - if (StringUtils.isNull(params.get("jsonData"))){ - return AjaxResult.error("缺少必要参数!"); - } - ServerResult serverResult = topQueryService.preview(params.get("jsonData"),params.get("id")); - if (serverResult.isStart()){ - return getDataTable(serverResult.getData().getDataMap(),serverResult.getData().getUniCons()); - }else { - return AjaxResult.error(serverResult.getMsg()); - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/TopSearchTableController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/TopSearchTableController.java deleted file mode 100644 index 832ed1c..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/TopSearchTableController.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.ebts.generator.controller; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -import com.ebts.common.core.controller.EBTSController; -import com.ebts.common.core.text.Convert; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.GenTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import com.ebts.common.annotation.Log; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.enums.BusinessType; -import com.ebts.generator.entity.TopSearchTable; -import com.ebts.generator.service.TopSearchTableService; -import com.ebts.common.utils.poi.ExcelUtil; - -/** - * top万能查询主Controller - * - * @author clay - * @date 2021-07-20 - */ - -@RestController -@RequestMapping("/tool/table") -public class TopSearchTableController extends EBTSController { - protected final Logger logger = LoggerFactory.getLogger(TopSearchTableController.class); - - @Autowired - private TopSearchTableService topSearchTableService; - - /** - * 查询top万能查询主列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:table:list')") - @PostMapping("/list") - public Serializable list(@Validated @RequestBody TopSearchTable topSearchTable) { - startPage(topSearchTable.getPageInfo()); - ServerResult> genServerResult = topSearchTableService.selectTopSearchTableList(topSearchTable); - if (genServerResult.isStart()) { - return getDataTable(genServerResult.getData()); - } else { - return AjaxResult.info(genServerResult.getMsg()); - } - } - @PreAuthorize("@ebts.hasPermi('tool:table:cloumns')") - @GetMapping("/columns/{id}") - public AjaxResult columns(@PathVariable("id") Long id){ - return AjaxResult.success(topSearchTableService.selectTableColumns(id)); - } - - - /** - * 查询top万能查询主列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:table:info')") - @PostMapping("/info") - public Serializable info() { - ServerResult> genServerResult = topSearchTableService.selectTopSearchTableInfo(); - if (genServerResult.isStart()) { - return getDataTable(genServerResult.getData()); - } else { - return AjaxResult.info(genServerResult.getMsg()); - } - } - - /** - * 导出top万能查询主列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:table:export')") - @Log(title = "top万能查询主", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public AjaxResult export(@Validated @RequestBody TopSearchTable topSearchTable) { - ServerResult> genServerResult = topSearchTableService.selectTopSearchTableList(topSearchTable); - ExcelUtil util = new ExcelUtil(TopSearchTable. class); - if (genServerResult.isStart()) { - return util.exportExcel(genServerResult.getData(), "table"); - } else { - return AjaxResult.error(genServerResult.getMsg()); - } - } - - /** - * 获取top万能查询主详细信息 - */ - @PreAuthorize("@ebts.hasPermi('tool:table:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - ServerResult genServerResult = topSearchTableService.selectTopSearchTableById(id); - if (genServerResult.isStart()) { - return AjaxResult.success(genServerResult.getData()); - } else { - return AjaxResult.info(genServerResult.getMsg()); - } - } - - /** - * 新增top万能查询主 - */ - @PreAuthorize("@ebts.hasPermi('tool:table:add')") - @Log(title = "top万能查询主", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@Validated @RequestBody TopSearchTable topSearchTable) { - ServerResult genServerResult = topSearchTableService.insertTopSearchTable(topSearchTable); - if (genServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(genServerResult.getMsg()); - } - } - - /** - * 修改top万能查询主 - */ - @PreAuthorize("@ebts.hasPermi('tool:table:edit')") - @Log(title = "top万能查询主", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@Validated @RequestBody TopSearchTable topSearchTable) { - if (topSearchTable.getRoleIds().length==0){ - return AjaxResult.error("角色不能为空!"); - } - ServerResult genServerResult = topSearchTableService.updateTopSearchTable(topSearchTable); - if (genServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(genServerResult.getMsg()); - } - } - - /** - * 删除top万能查询主 - */ - @PreAuthorize("@ebts.hasPermi('tool:table:remove')") - @Log(title = "top万能查询主", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - if (ids.length<0){ - return AjaxResult.error("id不能为空!"); - } - ServerResult genServerResult = topSearchTableService.deleteTopSearchTableByIds(ids); - if (genServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(genServerResult.getMsg()); - } - } - /** - * 导入表结构(保存) - */ - @PreAuthorize("@ebts.hasPermi('tool:table:import')") - @Log(title = "代码生成", businessType = BusinessType.IMPORT) - @PostMapping("/importTopTable") - public AjaxResult importTableSave(String tables) { - String[] tableNames = Convert.toStrArray(tables); - // 查询表信息 - List tableList = topSearchTableService.selectDbTableListByNames(tableNames); - topSearchTableService.importGenTable(tableList); - return AjaxResult.success(); - } - - - /** - * 导入表结构(获取) - */ - @PreAuthorize("@ebts.hasPermi('tool:table:db:list')") - @PostMapping("/db/list") - public Serializable dbList(@RequestBody Map params){ - startPage(params); - List> list = topSearchTableService.selectDbTableList(params); - return getDataTable(list); - } - - - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/UniQueryController.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/UniQueryController.java deleted file mode 100644 index 734f3c3..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/controller/UniQueryController.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.ebts.generator.controller; - -import java.io.Serializable; -import java.util.List; - - -import com.ebts.common.annotation.Log; -import com.ebts.common.core.controller.BaseController; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.enums.BusinessType; -import com.ebts.common.utils.ServerResult; -import com.ebts.common.utils.poi.ExcelUtil; -import com.ebts.generator.entity.UniQuery; -import com.ebts.generator.service.UniQueryService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * 万能查询Controller - * - * @author binlin - * @date 2021-01-30 - */ -@RestController -@RequestMapping("/tool/query") -public class UniQueryController extends BaseController { - protected final Logger logger = LoggerFactory.getLogger(UniQueryController.class); - - @Autowired - private UniQueryService uniQueryService; - - /** - * 查询万能查询列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:query:list')") - @GetMapping("/list") - public Serializable list(UniQuery uniQuery) { - startPage(); - ServerResult> ServerResult = uniQueryService.selectUniQueryList(uniQuery); - if (ServerResult.isStart()) { - return getDataTable(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 导出万能查询列表 - */ - @PreAuthorize("@ebts.hasPermi('tool:query:export')") - @Log(title = "万能查询", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(UniQuery uniQuery) { - ServerResult> ServerResult = uniQueryService.selectUniQueryList(uniQuery); - ExcelUtil util = new ExcelUtil(UniQuery.class); - if (ServerResult.isStart()) { - return util.exportExcel(ServerResult.getData(), "query"); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 获取万能查询详细信息 - */ - @PreAuthorize("@ebts.hasPermi('tool:query:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - ServerResult ServerResult = uniQueryService.selectUniQueryById(id); - if (ServerResult.isStart()) { - return AjaxResult.success(ServerResult.getData()); - } else { - return AjaxResult.info(ServerResult.getMsg()); - } - } - - /** - * 新增万能查询 - */ - @PreAuthorize("@ebts.hasPermi('tool:query:add')") - @Log(title = "万能查询", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody UniQuery uniQuery) { - if (uniQuery.getUqName() == null || uniQuery.getUqName().equals("")) { - return AjaxResult.error("名称不能为空!"); - } - if (uniQuery.getUqDescribe() == null || uniQuery.getUqDescribe().equals("")) { - return AjaxResult.error("描述不能为空!"); - } - ServerResult ServerResult = uniQueryService.insertUniQuery(uniQuery); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 简单修改万能能查询 - */ - @PreAuthorize("@ebts.hasPermi('tool:query:edit')") - @Log(title = "万能查询", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody UniQuery uniQuery) { - if (uniQuery.getUqName() == null || uniQuery.getUqName().equals("")) { - return AjaxResult.error("名称不能为空!"); - } - if (uniQuery.getUqDescribe() == null || uniQuery.getUqDescribe().equals("")) { - return AjaxResult.error("描述不能为空!"); - } - ServerResult ServerResult = uniQueryService.updateUniQuery(uniQuery); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } - - /** - * 删除万能查询 - */ - @PreAuthorize("@ebts.hasPermi('tool:query:remove')") - @Log(title = "万能查询", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - if (ids.length < 0) { - return AjaxResult.error("id不能为空!"); - } - ServerResult ServerResult = uniQueryService.deleteUniQueryByIds(ids); - if (ServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(ServerResult.getMsg()); - } - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/ApiClassDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/ApiClassDao.java deleted file mode 100644 index 396c151..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/ApiClassDao.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ebts.generator.dao; - -import com.ebts.generator.entity.ApiClass; - -import java.util.List; - - -/** - * 接口类名Mapper接口 - * - * @author binlin - * @date 2021-01-24 - */ -public interface ApiClassDao { - - /** - * 查询接口类名 - * - * @param id 接口类名ID - * @return 接口类名 - */ - ApiClass selectApiclassById(Long id); - - /** - * 查询接口类名列表 - * - * @param apiclass 接口类名 - * @return 接口类名集合 - */ - List selectApiclassList(ApiClass apiclass); - - /** - * 新增接口类名 - * - * @param apiclass 接口类名 - * @return 结果 - */ - int insertApiclass(ApiClass apiclass); - - /** - * 修改接口类名 - * - * @param apiclass 接口类名 - * @return 结果 - */ - int updateApiclass(ApiClass apiclass); - - /** - * 删除接口类名 - * - * @param id 接口类名ID - * @return 结果 - */ - int deleteApiclassById(Long id); - - /** - * 批量删除接口类名 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - int deleteApiclassByIds(Long[] ids); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/GenTableColumnDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/GenTableColumnDao.java deleted file mode 100644 index 1b7ae69..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/GenTableColumnDao.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ebts.generator.dao; - -import java.util.List; - -import com.ebts.generator.entity.GenTableColumn; - -/** - * 业务字段 数据层 - * - * @author binlin - */ -public interface GenTableColumnDao { - /** - * 根据表名称查询列信息 - * - * @param tableName 表名称 - * @return 列信息 - */ - public List selectDbTableColumnsByName(String tableName); - - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - public List selectGenTableColumnListByTableId(Long tableId); - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int insertGenTableColumn(GenTableColumn genTableColumn); - - /** - * 修改业务字段 - * - * @param genTableColumns 业务字段信息 - * @return 结果 - */ - public int updateGenTableColumn(List genTableColumns); - - /** - * 删除业务字段 - * - * @param genTableColumns 列数据 - * @return 结果 - */ - public int deleteGenTableColumns(List genTableColumns); - - /** - * 批量删除业务字段 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableColumnByIds(Long[] ids); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/GenTableDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/GenTableDao.java deleted file mode 100644 index 8504978..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/GenTableDao.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ebts.generator.dao; - -import java.util.List; - -import com.ebts.generator.entity.GenTable; -import org.apache.ibatis.annotations.Param; - -/** - * 业务 数据层 - * - * @author binlin - */ -public interface GenTableDao { - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - public List selectGenTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - public List selectDbTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - public List selectDbTableListByNames(String[] tableNames); - - /** - * 查询所有表信息 - * - * @return 表信息集合 - */ - public List selectGenTableAll(); - - /** - * 查询表ID业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - public GenTable selectGenTableById(Long id); - - /** - * 查询表名称业务信息 - * - * @param tableName 表名称 - * @return 业务信息 - */ - public GenTable selectGenTableByName(String tableName); - - /** - * 新增业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public int insertGenTable(GenTable genTable); - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public int updateGenTable(GenTable genTable); - - /** - * 批量删除业务 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableByIds(Long[] ids); - - int insertMenu(@Param("paramSQL") String sql); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/InterTableDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/InterTableDao.java deleted file mode 100644 index e36bb16..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/InterTableDao.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.ebts.generator.dao; - -import java.util.List; - -import com.ebts.generator.entity.ApiClass; -import com.ebts.generator.entity.InterTable; - -/** - * 接口信息Mapper接口 - * - * @author binlin - * @date 2021-01-25 - */ -public interface InterTableDao { - /** - * 查询接口信息 - * - * @param id 接口信息ID - * @return 接口信息 - */ - InterTable selectInterTableById(Long id); - - /** - * 查询接口信息列表 - * - * @param interTable 接口信息 - * @return 接口信息集合 - */ - List selectInterTableList(InterTable interTable); - - /** - * 新增接口信息 - * - * @param interTable 接口信息 - * @return 结果 - */ - int insertInterTable(InterTable interTable); - - /** - * 批量新增接口信息 - * - * @param interTables - * @return - */ - int insertInterTables(List interTables); - - /** - * 通过类id删除接口 - * - * @param cId - * @return - */ - int deleteInterTableByClassId(Long cId); - - /** - * 通过模块id删除接口 - * - * @param mId - * @return - */ - int deleteInterTableByModuleId(Long mId); - - /** - * 修改接口信息 - * - * @param interTable 接口信息 - * @return 结果 - */ - int updateInterTable(InterTable interTable); - - - /** - * 删除接口信息 - * - * @param id 接口信息ID - * @return 结果 - */ - int deleteInterTableById(Long id); - - /** - * 批量删除接口信息 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteInterTableByIds(Long[] ids); - - ApiClass selectInterTableClass(Long id); - - List selectInterTableModule(Long id); -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/ModuleDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/ModuleDao.java deleted file mode 100644 index 769fa56..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/ModuleDao.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ebts.generator.dao; - -import com.ebts.generator.entity.Module; - -import java.util.List; - -/** - * 模块管理Mapper接口 - * - * @author binlin - * @date 2021-01-24 - */ -public interface ModuleDao { - /** - * 查询模块管理 - * - * @param id 模块管理ID - * @return 模块管理 - */ - Module selectModuleById(Long id); - - /** - * 查询模块管理列表 - * - * @param module 模块管理 - * @return 模块管理集合 - */ - List selectModuleList(Module module); - - /** - * 新增模块管理 - * - * @param module 模块管理 - * @return 结果 - */ - int insertModule(Module module); - - /** - * 修改模块管理 - * - * @param module 模块管理 - * @return 结果 - */ - int updateModule(Module module); - - /** - * 删除模块管理 - * - * @param id 模块管理ID - * @return 结果 - */ - int deleteModuleById(Long id); - - /** - * 批量删除模块管理 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteModuleByIds(Long[] ids); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/QueryDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/QueryDao.java deleted file mode 100644 index 64c0e21..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/QueryDao.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ebts.generator.dao; - -import com.ebts.common.core.entity.entity.Menu; -import com.ebts.generator.entity.UniCon; -import com.ebts.generator.entity.UniQuery; - -import java.util.List; -import java.util.Map; - -/** - * @Author 18209 - * @Date 2021/1/30 18:52 - * @Version 1.0 - */ -public interface QueryDao { - - /** - * 通过id获取到万能查询的基本信息 - * @param id - * @return - */ - UniQuery selectQueryInfo(Long id); - - /** - * 删除万能查询 - * @param uqId - * @return - */ - Integer deleteUniCon(Long uqId); - - /** - * 新增万能查询 - * @param uniCons - * @return - */ - Integer insertUniCon(List uniCons); - - /** - * 获取查询信息 - * @param paramSQL - * @return - */ - List> UniQuery(String paramSQL); - - /** - * 查询是否发布 - * @param id - * @return - */ - Integer Release(Long id); - - /** - * 改变发布状态 - * @param uniQuery - * @return - */ - Integer changeRelease(UniQuery uniQuery); - - /** - * 插入到菜单 - * @param menu - * @return - */ - Integer insertMenu(Menu menu); - - /** - * 删除菜单 - * @param path - * @return - */ - Integer deleteMenu(String path); - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/RegularDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/RegularDao.java deleted file mode 100644 index c946d81..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/RegularDao.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.ebts.generator.dao; - -import java.util.List; - -import com.ebts.generator.entity.Regular; - -/** - * 校验规则Dao接口 - * - * @author binlin - * @date 2021-01-18 - */ -public interface RegularDao { - /** - * 查询校验规则 - * - * @param id 校验规则ID - * @return 校验规则 - */ - Regular selectRegularById(Long id); - - /** - * 查询校验规则列表 - * - * @param regular 校验规则 - * @return 校验规则集合 - */ - List selectRegularList(Regular regular); - /** - * 查询校验规则下拉框列表 - * - * @return 校验规则集合 - */ - List selectRegularOption(); - - /** - * 新增校验规则 - * - * @param regular 校验规则 - * @return 结果 - */ - int insertRegular(Regular regular); - - /** - * 修改校验规则 - * - * @param regular 校验规则 - * @return 结果 - */ - int updateRegular(Regular regular); - - /** - * 删除校验规则 - * - * @param id 校验规则ID - * @return 结果 - */ - int deleteRegularById(Long id); - - /** - * 批量删除校验规则 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - int deleteRegularByIds(Long[] ids); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/RelDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/RelDao.java deleted file mode 100644 index 1225d8f..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/RelDao.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ebts.generator.dao; - -import com.ebts.generator.entity.RelColumn; -import com.ebts.generator.entity.RelTable; - -import java.util.List; -import java.util.Map; - -/** - * @Author 18209 - * @Date 2021/2/24 16:21 - * @Version 1.0 - */ -public interface RelDao { - /** - * 获取表信息 - * - * @return - */ - List> tableInfos(); - - /** - * 获取表字段信息 - * - * @param tableName - * @return - */ - List selectTableColumn(String tableName); - - /** - * 批量增加字段信息 - * - * @param relColumns - * @return - */ - Integer insertRelColumns(List relColumns); - - /** - * 批量增加子表字段 - * @param relTables - * @return - */ - Integer insertRelTables(List relTables); - - /** - * 通过tableName获取到column信息 - * - * @param tableName - * @return - */ - List> tableColumns(String tableName); - - /** - * 通过主表id查询子表信息 - * @param tableId - * @return - */ - List relTableByTableId(Long tableId); - - /** - * 通过relId删除RelColumn信息 - * @param relId - * @return - */ - Integer deleteRelColumnByRelId(Long relId); - - /** - * 通过tableid删除RelTable信息 - * @param tableId - * @return - */ - Integer deleteRelTableByTableId(Long tableId); - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/RelationalMapDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/RelationalMapDao.java deleted file mode 100644 index 9377e68..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/RelationalMapDao.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ebts.generator.dao; - - -import java.util.List; -import com.ebts.generator.entity.RelationalMap; - -/** - * top万能查询关系映射Mapper接口 - * - * @author clay - * @date 2021-07-21 - */ -public interface RelationalMapDao { - /** - * 查询top万能查询关系映射 - * - * @param mainId top万能查询关系映射ID - * @return top万能查询关系映射 - */ - RelationalMap selectRelationalMapById(Long mainId); - - /** - * 查询top万能查询关系映射列表 - * - * @param relationalMap top万能查询关系映射 - * @return top万能查询关系映射集合 - */ - List selectRelationalMapList(RelationalMap relationalMap); - - /** - * 新增top万能查询关系映射 - * - * @param relationalMap top万能查询关系映射 - * @return 结果 - */ - int insertRelationalMap(RelationalMap relationalMap); - - /** - * 修改top万能查询关系映射 - * - * @param relationalMap top万能查询关系映射 - * @return 结果 - */ - int updateRelationalMap(RelationalMap relationalMap); - - /** - * 删除top万能查询关系映射 - * - * @param mainId top万能查询关系映射ID - * @return 结果 - */ - int deleteRelationalMapById(Long mainId); - - /** - * 批量删除top万能查询关系映射 - * - * @param mainIds 需要删除的数据ID - * @return 结果 - */ - int deleteRelationalMapByIds(Long[] mainIds); - int batchRelationalMap(List relationalMaps); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/SearchTableRoleDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/SearchTableRoleDao.java deleted file mode 100644 index 9654eb2..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/SearchTableRoleDao.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ebts.generator.dao; - -import java.util.List; -import com.ebts.generator.entity.SearchTableRole; - -/** - * top万能查询角色关系Mapper接口 - * - * @author clay - * @date 2021-07-21 - */ -public interface SearchTableRoleDao { - /** - * 查询top万能查询角色关系列表 - * - * @param searchTableRole top万能查询角色关系 - * @return top万能查询角色关系集合 - */ - List selectSearchTableRoleList(SearchTableRole searchTableRole); - - /** - * 删除top万能查询角色关系 - * - * @param searchTableId top万能查询角色关系ID - * @return 结果 - */ - int deleteSearchTableRoleById(Long searchTableId); - int deleteSearchTableRoleByIds(Long[] searchTableIds); - - /** - * 批量添加top万能查询角色关系 - * - * @param roleList - * @return 结果 - */ - int batchSearchTableRole(List roleList); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/TopSearchTableDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/TopSearchTableDao.java deleted file mode 100644 index f91c714..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/TopSearchTableDao.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.ebts.generator.dao; - -import java.util.List; -import java.util.Map; - -import com.ebts.generator.entity.GenTable; -import com.ebts.generator.entity.TopSearchTable; -import com.ebts.generator.entity.TopSearchColumn; - -/** - * top万能查询主Mapper接口 - * - * @author clay - * @date 2021-07-20 - */ -public interface TopSearchTableDao { - /** - * 查询top万能查询主 - * - * @param id top万能查询主ID - * @return top万能查询主 - */ - TopSearchTable selectTopSearchTableById(Long id); - - /** - * 查询top万能查询主列表 - * - * @param topSearchTable top万能查询主 - * @return top万能查询主集合 - */ - List selectTopSearchTableList(TopSearchTable topSearchTable); - - /** - * 获取top万能查询基础表格信息 - * @param roleIds - * @return - */ - List selectTopSearchTables(String[] roleIds); - - - List selectTableColumns(Long id); - /** - * - * @return - */ - List selectTopSearchTableInfo(); - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - List selectDbTableListByNames(String[] tableNames); - - - /** - * 获取数据库表信息 - * - * @param params 表名称组 - * @return 数据库表集合 - */ - List> selectDbTableList(Map params); - /** - * 根据表名查询列 - * @param tableName - * @return - */ - List selectDbTableColumnsByName(String tableName); - - - - /** - * 新增top万能查询主 - * - * @param topSearchTable top万能查询主 - * @return 结果 - */ - int insertTopSearchTable(TopSearchTable topSearchTable); - - /** - * 修改top万能查询主 - * - * @param topSearchTable top万能查询主 - * @return 结果 - */ - int updateTopSearchTable(TopSearchTable topSearchTable); - - /** - * 删除top万能查询主 - * - * @param id top万能查询主ID - * @return 结果 - */ - int deleteTopSearchTableById(Long id); - - /** - * 批量删除top万能查询主 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - int deleteTopSearchTableByIds(Long[] ids); - - /** - * 批量删除top万能查询字段 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - int deleteTopSearchColumnBySearchTableIds(Long[] ids); - - /** - * 批量新增top万能查询字段 - * - * @param topSearchColumnList top万能查询字段列表 - * @return 结果 - */ - int batchTopSearchColumn(List topSearchColumnList); - - - /** - * 通过top万能查询主ID删除top万能查询字段信息 - * - * @param id top万能查询主ID - * @return 结果 - */ - int deleteTopSearchColumnBySearchTableId(Long id); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/UniQueryDao.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/UniQueryDao.java deleted file mode 100644 index 6f2a56c..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dao/UniQueryDao.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ebts.generator.dao; - - -import com.ebts.generator.entity.UniQuery; - -import java.util.List; - -/** - * 万能查询Mapper接口 - * - * @author binlin - * @date 2021-01-30 - */ -public interface UniQueryDao { - /** - * 查询万能查询 - * - * @param id 万能查询ID - * @return 万能查询 - */ - UniQuery selectUniQueryById(Long id); - - /** - * 查询万能查询列表 - * - * @param uniQuery 万能查询 - * @return 万能查询集合 - */ - List selectUniQueryList(UniQuery uniQuery); - - /** - * 新增万能查询 - * - * @param uniQuery 万能查询 - * @return 结果 - */ - int insertUniQuery(UniQuery uniQuery); - - /** - * 修改万能查询 - * - * @param uniQuery 万能查询 - * @return 结果 - */ - int updateUniQuery(UniQuery uniQuery); - - /** - * 删除万能查询 - * - * @param id 万能查询ID - * @return 结果 - */ - int deleteUniQueryById(Long id); - - /** - * 批量删除万能查询 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteUniQueryByIds(Long[] ids); - - int deleteUniQueryByUqId(Long id); - - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dto/InterTableDto.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dto/InterTableDto.java deleted file mode 100644 index 7de735d..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dto/InterTableDto.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ebts.generator.dto; - -import com.ebts.generator.entity.ApiClass; -import com.ebts.generator.entity.InterTable; -import com.ebts.generator.entity.Module; - -import java.util.List; - -public class InterTableDto { - - private ApiClass apiclass; - - private Module module; - - private List interTables; - - public Module getModule() { - return module; - } - - public void setModule(Module module) { - this.module = module; - } - - public ApiClass getApiclass() { - return apiclass; - } - - public void setApiclass(ApiClass apiclass) { - this.apiclass = apiclass; - } - - public List getInterTables() { - return interTables; - } - - public void setInterTables(List interTables) { - this.interTables = interTables; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/dto/TopResult.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/dto/TopResult.java deleted file mode 100644 index d60d401..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/dto/TopResult.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ebts.generator.dto; - -import com.ebts.generator.entity.UniCon; - -import java.util.List; -import java.util.Map; - -/** - * @author: Clay - * @date: 2021/7/27 19:26 - * @description:TopResult - * @email: clay@hchyun.com - */ -public class TopResult { - private List> dataMap; - private List uniCons; - - - public TopResult(List> dataMap, List uniCons) { - this.dataMap = dataMap; - this.uniCons = uniCons; - } - - public List> getDataMap() { - return dataMap; - } - - public void setDataMap(List> dataMap) { - this.dataMap = dataMap; - } - - public List getUniCons() { - return uniCons; - } - - public void setUniCons(List uniCons) { - this.uniCons = uniCons; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/ApiClass.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/ApiClass.java deleted file mode 100644 index 61a29fb..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/ApiClass.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.ebts.generator.entity; - -import com.ebts.common.annotation.Excel; -import com.ebts.common.core.entity.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import java.util.ArrayList; -import java.util.List; - -/** - * 接口类名对象 sys_apiclass - * - * @author binlin - * @date 2021-01-24 - */ -public class ApiClass extends BaseEntity { - - - /** - * 类id - */ - private Long id; - - /** - * 模块id - */ - @Excel(name = "模块id") - private Long mId; - - /** - * 类名 - */ - @Excel(name = "类名") - private String cName; - - /** - * 类描述 - */ - @Excel(name = "类描述") - private String cDescribe; - - /** - * 包名 - */ - @Excel(name = "包名") - private String packageName; - - /** - * 前缀 - */ - @Excel(name = "前缀") - private String prefix; - /** - * 作者 - */ - @Excel(name = "作者") - private String author; - - /** - * 电子邮件 - */ - @Excel(name = "电子邮件") - private String email; - - /** - * 模块类 - */ - private Module module; - - private List interTables; - - public List getInterTables() { - return interTables; - } - - public void setInterTables(List interTables) { - if (interTables == null) { - interTables = new ArrayList(); - } - this.interTables = interTables; - } - - public String getPrefix() { - return prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public Module getModule() { - return module; - } - - public void setModule(Module module) { - this.module = module; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getId() { - return id; - } - - public void setmId(Long mId) { - this.mId = mId; - } - - public Long getmId() { - return mId; - } - - public void setcName(String cName) { - this.cName = cName; - } - - public String getcName() { - return cName; - } - - public void setcDescribe(String cDescribe) { - this.cDescribe = cDescribe; - } - - public String getcDescribe() { - return cDescribe; - } - - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("mId", getmId()) - .append("cName", getcName()) - .append("cDescribe", getcDescribe()) - .append("createTime", getCreateTime()) - .append("createBy", getCreateBy()) - .append("updateTime", getUpdateTime()) - .append("updateBy", getUpdateBy()) - .toString(); - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/GenTable.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/GenTable.java deleted file mode 100644 index 610a634..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/GenTable.java +++ /dev/null @@ -1,429 +0,0 @@ -package com.ebts.generator.entity; - -import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; - -import com.ebts.common.core.entity.BaseEntity; -import com.ebts.common.utils.StringUtils; -import com.ebts.generator.utils.constant.GenConstants; -import org.apache.commons.lang3.ArrayUtils; - -/** - * 业务表 gen_table - * - * @author binlin - */ -public class GenTable extends BaseEntity { - - - /** - * 编号 - */ - private Long tableId; - - /** - * 表名称 - */ - @NotBlank(message = "表名称不能为空") - private String tableName; - - /** - * 表描述 - */ - @NotBlank(message = "表描述不能为空") - private String tableComment; - - /** - * 关联父表的表名 - */ - private String subTableName; - - /** - * 本表关联父表的外键名 - */ - private String subTableFkName; - - /** - * 实体类名称(首字母大写) - */ - @NotBlank(message = "实体类名称不能为空") - private String className; - - /** - * 使用的模板(crud单表操作 tree树表操作 sub主子表操作 ass关联表操作) - */ - private String tplCategory; - - /** - * 生成包路径 - */ - @NotBlank(message = "生成包路径不能为空") - private String packageName; - - /** - * 生成模块名 - */ - @NotBlank(message = "生成模块名不能为空") - private String moduleName; - - /** - * 生成业务名 - */ - @NotBlank(message = "生成业务名不能为空") - private String businessName; - - /** - * 生成功能名 - */ - @NotBlank(message = "生成功能名不能为空") - private String functionName; - - /** - * 生成作者 - */ - @NotBlank(message = "作者不能为空") - private String functionAuthor; - - /** - * 生成代码方式(0zip压缩包 1自定义路径) - */ - private String genType; - - /** - * 生成路径(不填默认项目路径) - */ - private String genPath; - - /** - * 主键信息 - */ - private GenTableColumn pkColumn; - - /** - * 子表信息 - */ - private GenTable subTable; - - /** - * 表列信息 - */ - @Valid - private List columns; - - @Valid - private List relTables; - - - - - /** - * 其它生成选项 - */ - private String options; - - /** - * 树编码字段 - */ - private String treeCode; - - /** - * 树父编码字段 - */ - private String treeParentCode; - - /** - * 树名称字段 - */ - private String treeName; - - /** - * 上级菜单ID字段 - */ - private String parentMenuId; - - /** - * 上级菜单名称字段 - */ - private String parentMenuName; - - /** - * 关联表名 - */ - private String assTableName; - - /** - * 主表字段 - */ - private String assTableColumn; - - /** - * 关联表key - */ - private String assTableFkColumn; - - /** - * 关联查询方式 - */ - private String assQueryType; - - public List getRelTables() { - return relTables; - } - - public void setRelTables(List relTables) { - this.relTables = relTables; - } - - public String getAssQueryType() { - return assQueryType; - } - - public void setAssQueryType(String assQueryType) { - this.assQueryType = assQueryType; - } - - public String getAssTableName() { - return assTableName; - } - - public void setAssTableName(String assTableName) { - this.assTableName = assTableName; - } - - public String getAssTableColumn() { - return assTableColumn; - } - - public void setAssTableColumn(String assTableColumn) { - this.assTableColumn = assTableColumn; - } - - public String getAssTableFkColumn() { - return assTableFkColumn; - } - - public void setAssTableFkColumn(String assTableFkColumn) { - this.assTableFkColumn = assTableFkColumn; - } - - public Long getTableId() { - return tableId; - } - - public void setTableId(Long tableId) { - this.tableId = tableId; - } - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - public String getTableComment() { - return tableComment; - } - - public void setTableComment(String tableComment) { - this.tableComment = tableComment; - } - - public String getSubTableName() { - return subTableName; - } - - public void setSubTableName(String subTableName) { - this.subTableName = subTableName; - } - - public String getSubTableFkName() { - return subTableFkName; - } - - public void setSubTableFkName(String subTableFkName) { - this.subTableFkName = subTableFkName; - } - - public String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - - public String getTplCategory() { - return tplCategory; - } - - public void setTplCategory(String tplCategory) { - this.tplCategory = tplCategory; - } - - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - public String getModuleName() { - return moduleName; - } - - public void setModuleName(String moduleName) { - this.moduleName = moduleName; - } - - public String getBusinessName() { - return businessName; - } - - public void setBusinessName(String businessName) { - this.businessName = businessName; - } - - public String getFunctionName() { - return functionName; - } - - public void setFunctionName(String functionName) { - this.functionName = functionName; - } - - public String getFunctionAuthor() { - return functionAuthor; - } - - public void setFunctionAuthor(String functionAuthor) { - this.functionAuthor = functionAuthor; - } - - public String getGenType() { - return genType; - } - - public void setGenType(String genType) { - this.genType = genType; - } - - public String getGenPath() { - return genPath; - } - - public void setGenPath(String genPath) { - this.genPath = genPath; - } - - public GenTableColumn getPkColumn() { - return pkColumn; - } - - public void setPkColumn(GenTableColumn pkColumn) { - this.pkColumn = pkColumn; - } - - public GenTable getSubTable() { - return subTable; - } - - public void setSubTable(GenTable subTable) { - this.subTable = subTable; - } - - public List getColumns() { - return columns; - } - - public void setColumns(List columns) { - this.columns = columns; - } - - public String getOptions() { - return options; - } - - public void setOptions(String options) { - this.options = options; - } - - public String getTreeCode() { - return treeCode; - } - - public void setTreeCode(String treeCode) { - this.treeCode = treeCode; - } - - public String getTreeParentCode() { - return treeParentCode; - } - - public void setTreeParentCode(String treeParentCode) { - this.treeParentCode = treeParentCode; - } - - public String getTreeName() { - return treeName; - } - - public void setTreeName(String treeName) { - this.treeName = treeName; - } - - public String getParentMenuId() { - return parentMenuId; - } - - public void setParentMenuId(String parentMenuId) { - this.parentMenuId = parentMenuId; - } - - public String getParentMenuName() { - return parentMenuName; - } - - public void setParentMenuName(String parentMenuName) { - this.parentMenuName = parentMenuName; - } - - public boolean isSub() { - return isSub(this.tplCategory); - } - - public static boolean isSub(String tplCategory) { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory); - } - - public boolean isTree() { - return isTree(this.tplCategory); - } - - public static boolean isTree(String tplCategory) { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory); - } - - public boolean isCrud() { - return isCrud(this.tplCategory); - } - - public static boolean isCrud(String tplCategory) { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory); - } - - public boolean isSuperColumn(String javaField) { - return isSuperColumn(this.tplCategory, javaField); - } - - public static boolean isSuperColumn(String tplCategory, String javaField) { - if (isTree(tplCategory)) { - return StringUtils.equalsAnyIgnoreCase(javaField, - ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY)); - } - return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY); - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/GenTableColumn.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/GenTableColumn.java deleted file mode 100644 index 0b9f8cb..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/GenTableColumn.java +++ /dev/null @@ -1,376 +0,0 @@ -package com.ebts.generator.entity; - -import com.ebts.common.core.entity.BaseEntity; -import com.ebts.common.utils.StringUtils; - -import javax.validation.constraints.NotBlank; - - -/** - * 代码生成业务字段表 gen_table_column - * - * @author binlin - */ -public class GenTableColumn extends BaseEntity { - - - /** - * 编号 - */ - private Long columnId; - - /** - * 归属表编号 - */ - private Long tableId; - - /** - * 列名称 - */ - private String columnName; - - /** - * 列描述 - */ - private String columnComment; - - /** - * 列类型 - */ - private String columnType; - - /** - * JAVA类型 - */ - private String javaType; - - /** - * JAVA字段名 - */ - @NotBlank(message = "Java属性不能为空") - private String javaField; - - /** - * 是否主键(1是) - */ - private String isPk; - - /** - * 是否自增(1是) - */ - private String isIncrement; - - /** - * 是否必填(1是) - */ - private String isRequired; - - /** - * 是否为插入字段(1是) - */ - private String isInsert; - - /** - * 是否编辑字段(1是) - */ - private String isEdit; - - /** - * 是否列表字段(1是) - */ - private String isList; - - /** - * 是否查询字段(1是) - */ - private String isQuery; - - /** - * 是否正则(1否) - */ - private Long isRegular; - - /** - * 正则表达式内容 - */ - private String regular; - - /** - * 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) - */ - private String queryType; - - /** - * 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) - */ - private String htmlType; - - /** - * 字典类型 - */ - private String dictType; - - /** - * 排序 - */ - private Integer sort; - - - public Long getIsRegular() { - return isRegular; - } - - public void setIsRegular(Long isRegular) { - this.isRegular = isRegular; - } - - public String getRegular() { - return regular; - } - - public void setRegular(String regular) { - this.regular = regular; - } - - public void setColumnId(Long columnId) { - this.columnId = columnId; - } - - public Long getColumnId() { - return columnId; - } - - public void setTableId(Long tableId) { - this.tableId = tableId; - } - - public Long getTableId() { - return tableId; - } - - public void setColumnName(String columnName) { - this.columnName = columnName; - } - - public String getColumnName() { - return columnName; - } - - public void setColumnComment(String columnComment) { - this.columnComment = columnComment; - } - - public String getColumnComment() { - return columnComment; - } - - public void setColumnType(String columnType) { - this.columnType = columnType; - } - - public String getColumnType() { - return columnType; - } - - public void setJavaType(String javaType) { - this.javaType = javaType; - } - - public String getJavaType() { - return javaType; - } - - public void setJavaField(String javaField) { - this.javaField = javaField; - } - - public String getJavaField() { - return javaField; - } - - public String getCapJavaField() { - return StringUtils.capitalize(javaField); - } - - public void setIsPk(String isPk) { - this.isPk = isPk; - } - - public String getIsPk() { - return isPk; - } - - public boolean isPk() { - return isPk(this.isPk); - } - - public boolean isPk(String isPk) { - return isPk != null && StringUtils.equals("1", isPk); - } - - public String getIsIncrement() { - return isIncrement; - } - - public void setIsIncrement(String isIncrement) { - this.isIncrement = isIncrement; - } - - public boolean isIncrement() { - return isIncrement(this.isIncrement); - } - - public boolean isIncrement(String isIncrement) { - return isIncrement != null && StringUtils.equals("1", isIncrement); - } - - public void setIsRequired(String isRequired) { - this.isRequired = isRequired; - } - - public String getIsRequired() { - return isRequired; - } - - public boolean isRequired() { - return isRequired(this.isRequired); - } - - public boolean isRequired(String isRequired) { - return isRequired != null && StringUtils.equals("1", isRequired); - } - - public void setIsInsert(String isInsert) { - this.isInsert = isInsert; - } - - public String getIsInsert() { - return isInsert; - } - - public boolean isInsert() { - return isInsert(this.isInsert); - } - - public boolean isInsert(String isInsert) { - return isInsert != null && StringUtils.equals("1", isInsert); - } - - public void setIsEdit(String isEdit) { - this.isEdit = isEdit; - } - - public String getIsEdit() { - return isEdit; - } - - public boolean isEdit() { - return isInsert(this.isEdit); - } - - public boolean isEdit(String isEdit) { - return isEdit != null && StringUtils.equals("1", isEdit); - } - - public void setIsList(String isList) { - this.isList = isList; - } - - public String getIsList() { - return isList; - } - - public boolean isList() { - return isList(this.isList); - } - - public boolean isList(String isList) { - return isList != null && StringUtils.equals("1", isList); - } - - public void setIsQuery(String isQuery) { - this.isQuery = isQuery; - } - - public String getIsQuery() { - return isQuery; - } - - public boolean isQuery() { - return isQuery(this.isQuery); - } - - public boolean isQuery(String isQuery) { - return isQuery != null && StringUtils.equals("1", isQuery); - } - - public void setQueryType(String queryType) { - this.queryType = queryType; - } - - public String getQueryType() { - return queryType; - } - - public String getHtmlType() { - return htmlType; - } - - public void setHtmlType(String htmlType) { - this.htmlType = htmlType; - } - - public void setDictType(String dictType) { - this.dictType = dictType; - } - - public String getDictType() { - return dictType; - } - - public void setSort(Integer sort) { - this.sort = sort; - } - - public Integer getSort() { - return sort; - } - - public boolean isSuperColumn() { - return isSuperColumn(this.javaField); - } - - public static boolean isSuperColumn(String javaField) { - return StringUtils.equalsAnyIgnoreCase(javaField, - // BaseEntity - "createBy", "createTime", "updateBy", "updateTime", "remark", - // TreeEntity - "parentName", "parentId", "orderNum", "ancestors"); - } - - public boolean isUsableColumn() { - return isUsableColumn(javaField); - } - - public static boolean isUsableColumn(String javaField) { - // isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单 - return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark"); - } - - public String readConverterExp() { - String remarks = StringUtils.substringBetween(this.columnComment, "(", ")"); - StringBuffer sb = new StringBuffer(); - if (StringUtils.isNotEmpty(remarks)) { - for (String value : remarks.split(" ")) { - if (StringUtils.isNotEmpty(value)) { - Object startStr = value.subSequence(0, 1); - String endStr = value.substring(1); - sb.append("").append(startStr).append("=").append(endStr).append(","); - } - } - return sb.deleteCharAt(sb.length() - 1).toString(); - } else { - return this.columnComment; - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/InterTable.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/InterTable.java deleted file mode 100644 index 68d7a6e..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/InterTable.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.ebts.generator.entity; - -import com.ebts.common.annotation.Excel; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import java.util.Date; - -/** - * 接口信息对象 sys_inter_table - * - * @author binlin - * @date 2021-01-25 - */ -@ApiModel("接口信息") -public class InterTable { - - /** - * id - */ - private Long id; - - /** - * 模块id - */ - @Excel(name = "模块id") - private Long mId; - - /** - * 类id - */ - @Excel(name = "类id") - private Long cId; - - /** - * 接口名称 - */ - @Excel(name = "接口名称") - private String itName; - - /** - * 描述 - */ - @Excel(name = "描述") - private String itDescribe; - - /** - * 是否设置许可 - */ - @Excel(name = "是否设置许可") - private String isPermission; - - /** - * 请求路径 - */ - @Excel(name = "请求路径") - private String requrl; - - /** - * 请求方式 - */ - @Excel(name = "请求方式") - private String method; - - /** - * 是否生成 - */ - @Excel(name = "是否生成") - private String isGenerate; - /** - * 类型 - */ - private Integer type; - /** - * 创建时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** - * 创建者 - */ - private Long createBy; - - private String mName; - private ApiClass apiclass; - - public ApiClass getApiclass() { - return apiclass; - } - - public void setApiclass(ApiClass apiclass) { - this.apiclass = apiclass; - } - - public String getmName() { - return mName; - } - - public void setmName(String mName) { - this.mName = mName; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Long getCreateBy() { - return createBy; - } - - public void setCreateBy(Long createBy) { - this.createBy = createBy; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public String getItName() { - return itName; - } - - public void setItName(String itName) { - this.itName = itName; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getId() { - return id; - } - - public void setmId(Long mId) { - this.mId = mId; - } - - public Long getmId() { - return mId; - } - - public void setcId(Long cId) { - this.cId = cId; - } - - public Long getcId() { - return cId; - } - - public void setItDescribe(String itDescribe) { - this.itDescribe = itDescribe; - } - - public String getItDescribe() { - return itDescribe; - } - - public void setRequrl(String requrl) { - this.requrl = requrl; - } - - public String getRequrl() { - return requrl; - } - - public void setMethod(String method) { - this.method = method; - } - - public String getIsPermission() { - return isPermission; - } - - public void setIsPermission(String isPermission) { - this.isPermission = isPermission; - } - - public String getIsGenerate() { - return isGenerate; - } - - public void setIsGenerate(String isGenerate) { - this.isGenerate = isGenerate; - } - - public String getMethod() { - return method; - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("mId", getmId()) - .append("cId", getcId()) - .append("itDescribe", getItDescribe()) - .append("requrl", getRequrl()) - .append("method", getMethod()) - .toString(); - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/Module.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/Module.java deleted file mode 100644 index 5f1b3a1..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/Module.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.ebts.generator.entity; - -import com.ebts.common.annotation.Excel; -import com.ebts.common.core.entity.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import java.util.List; - -/** - * 模块管理对象 sys_module - * - * @author binlin - * @date 2021-01-24 - */ -public class Module extends BaseEntity { - - - /** - * 模块id - */ - private Long id; - - /** - * 模块名称 - */ - @Excel(name = "模块名称") - private String mName; - - /** - * 模块描述 - */ - @Excel(name = "模块描述") - private String mDescribe; - - private List apiClassList; - - public List getApiclassList() { - return apiClassList; - } - - public void setApiclassList(List apiClassList) { - this.apiClassList = apiClassList; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getId() { - return id; - } - - public void setmName(String mName) { - this.mName = mName; - } - - public String getmName() { - return mName; - } - - public void setmDescribe(String mDescribe) { - this.mDescribe = mDescribe; - } - - public String getmDescribe() { - return mDescribe; - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("mName", getmName()) - .append("mDescribe", getmDescribe()) - .append("createTime", getCreateTime()) - .append("createBy", getCreateBy()) - .append("updateTime", getUpdateTime()) - .append("updateBy", getUpdateBy()) - .toString(); - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/Regular.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/Regular.java deleted file mode 100644 index 68dda9a..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/Regular.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.ebts.generator.entity; - -import com.ebts.common.annotation.Excel; -import com.ebts.common.core.entity.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * 校验规则对象 sys_regular - * - * @author binlin - * @date 2021-01-18 - */ -public class Regular extends BaseEntity { - - - /** - * id - */ - private Long id; - - /** - * 正则名称 - */ - @Excel(name = "正则名称") - private String name; - - /** - * 正则内容 - */ - @Excel(name = "正则内容") - private String regular; - - /** - * 验证内容 - */ - @Excel(name = "验证内容") - private String validation; - - /** - * 是否启用 1:启动 2:关闭 - */ - @Excel(name = "是否启用 1:启动 2:关闭") - private Integer enable; - - - public void setId(Long id) { - this.id = id; - } - - public Long getId() { - return id; - } - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setRegular(String regular) { - this.regular = regular; - } - - public String getRegular() { - return regular; - } - - public void setValidation(String validation) { - this.validation = validation; - } - - public String getValidation() { - return validation; - } - - public void setEnable(Integer enable) { - this.enable = enable; - } - - public Integer getEnable() { - return enable; - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("regular", getRegular()) - .append("validation", getValidation()) - .append("enable", getEnable()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .toString(); - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/RelColumn.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/RelColumn.java deleted file mode 100644 index 262a304..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/RelColumn.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.ebts.generator.entity; - -public class RelColumn { - - //表id - private long id; - //父表id - private long relId; - //列名称 - private String columnName; - //列描述 - private String columnComment; - //列类型 - private String columnType; - //java类型 - private String javaType; - //java字段名 - private String javaField; - //是否列表显示(1是) - private String isList; - //是否可查询(1可) - private String isQuery; - //查询方式(等于,不等于,小于,大于,区间) - private String queryType; - //控件显示类型 - private String htmlType; - //字典类型 - private String dictType; - //排序 - private Integer sort; - //创建时间 - private long createBy; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public long getRelId() { - return relId; - } - - public void setRelId(long relId) { - this.relId = relId; - } - - public String getColumnName() { - return columnName; - } - - public void setColumnName(String columnName) { - this.columnName = columnName; - } - - public String getColumnComment() { - return columnComment; - } - - public void setColumnComment(String columnComment) { - this.columnComment = columnComment; - } - - public String getColumnType() { - return columnType; - } - - public void setColumnType(String columnType) { - this.columnType = columnType; - } - - public String getJavaType() { - return javaType; - } - - public void setJavaType(String javaType) { - this.javaType = javaType; - } - - public String getJavaField() { - return javaField; - } - - public void setJavaField(String javaField) { - this.javaField = javaField; - } - - public String getIsList() { - return isList; - } - - public void setIsList(String isList) { - this.isList = isList; - } - - public String getIsQuery() { - return isQuery; - } - - public void setIsQuery(String isQuery) { - this.isQuery = isQuery; - } - - public String getQueryType() { - return queryType; - } - - public void setQueryType(String queryType) { - this.queryType = queryType; - } - - public String getHtmlType() { - return htmlType; - } - - public void setHtmlType(String htmlType) { - this.htmlType = htmlType; - } - - public String getDictType() { - if (dictType == null) { - dictType = ""; - } - return dictType; - } - - public void setDictType(String dictType) { - if (dictType == null) { - dictType = ""; - } - this.dictType = dictType; - } - - public Integer getSort() { - return sort; - } - - public void setSort(Integer sort) { - this.sort = sort; - } - - public long getCreateBy() { - return createBy; - } - - public void setCreateBy(long createBy) { - this.createBy = createBy; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/RelTable.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/RelTable.java deleted file mode 100644 index 67d09f6..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/RelTable.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.ebts.generator.entity; - -import java.util.List; - -public class RelTable { - - - //表id - private long id; - //主表id - private long tableId; - //关联子表表名 - private String relName; - //子表表名称简写 - private String relAs; - //父表名称 - private String tableName; - //父表名称简写 - private String tableAs; - //关联子表描述 - private String relComment; - //关联子表的字段 - private String relColumn; - //关联父表字段 - private String tableColumn; - //实体类名称(子表) - private String relClass; - //实体小写类名称(子表) - private String relclass; - //查询方式 - private String queryType; - //排序 - private Integer sort; - //创建者 - private long createBy; - - private List relColumns; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public long getTableId() { - return tableId; - } - - public void setTableId(long tableId) { - this.tableId = tableId; - } - - public String getRelName() { - return relName; - } - - public void setRelName(String relName) { - this.relName = relName; - } - - public String getRelAs() { - return relAs; - } - - public void setRelAs(String relAs) { - this.relAs = relAs; - } - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - public String getTableAs() { - return tableAs; - } - - public void setTableAs(String tableAs) { - this.tableAs = tableAs; - } - - public String getRelComment() { - return relComment; - } - - public void setRelComment(String relComment) { - this.relComment = relComment; - } - - public String getRelColumn() { - return relColumn; - } - - public void setRelColumn(String relColumn) { - this.relColumn = relColumn; - } - - public String getTableColumn() { - return tableColumn; - } - - public void setTableColumn(String tableColumn) { - this.tableColumn = tableColumn; - } - - public String getRelClass() { - return relClass; - } - - public void setRelClass(String relClass) { - this.relClass = relClass; - } - - public String getRelclass() { - return relclass; - } - - public void setRelclass(String relclass) { - this.relclass = relclass; - } - - public String getQueryType() { - return queryType; - } - - public void setQueryType(String queryType) { - this.queryType = queryType; - } - - public Integer getSort() { - return sort; - } - - public void setSort(Integer sort) { - this.sort = sort; - } - - public long getCreateBy() { - return createBy; - } - - public void setCreateBy(long createBy) { - this.createBy = createBy; - } - - public List getRelColumns() { - return relColumns; - } - - public void setRelColumns(List relColumns) { - this.relColumns = relColumns; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/RelationalMap.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/RelationalMap.java deleted file mode 100644 index e130565..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/RelationalMap.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ebts.generator.entity; - -import com.ebts.common.core.entity.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * top万能查询关系映射对象 gen_relational_mapping - * - * @author clay - * @date 2021-07-21 - */ -public class RelationalMap extends BaseEntity{ - - /** 主表id */ - private Long mainId; - - /** 字表id */ - private Long childId; - - /** 主表字段 */ - private String mainKey; - - /** 字表字段 */ - private String childKey; - - /** 关系 1:hasOne 2:hasMany 3: belongsTo */ - private String type; - - - public void setMainId(Long mainId){ - this.mainId = mainId; - } - - public Long getMainId(){ - return mainId; - } - public void setChildId(Long childId){ - this.childId = childId; - } - - public Long getChildId(){ - return childId; - } - public void setMainKey(String mainKey){ - this.mainKey = mainKey; - } - - public String getMainKey(){ - return mainKey; - } - public void setChildKey(String childKey){ - this.childKey = childKey; - } - - public String getChildKey(){ - return childKey; - } - public void setType(String type){ - this.type = type; - } - - public String getType(){ - return type; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("mainId", getMainId()) - .append("childId", getChildId()) - .append("mainKey", getMainKey()) - .append("childKey", getChildKey()) - .append("type", getType()) - .toString(); - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/SearchTableRole.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/SearchTableRole.java deleted file mode 100644 index d1cef80..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/SearchTableRole.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ebts.generator.entity; - -import com.ebts.common.core.entity.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * top万能查询角色关系对象 gen_search_table_role - * - * @author clay - * @date 2021-07-21 - */ -public class SearchTableRole extends BaseEntity{ - - /** 表格id */ - private Long searchTableId; - - /** 角色id */ - private Long roleId; - - public SearchTableRole(Long searchTableId, Long roleId) { - this.searchTableId = searchTableId; - this.roleId = roleId; - } - - public SearchTableRole() { - - } - - public void setSearchTableId(Long searchTableId){ - this.searchTableId = searchTableId; - } - - public Long getSearchTableId(){ - return searchTableId; - } - public void setRoleId(Long roleId){ - this.roleId = roleId; - } - - public Long getRoleId(){ - return roleId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("searchTableId", getSearchTableId()) - .append("roleId", getRoleId()) - .toString(); - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopEdge.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopEdge.java deleted file mode 100644 index f080b85..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopEdge.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ebts.generator.entity; - -import com.alibaba.fastjson.JSONObject; - -/** - * @author: Clay - * @date: 2021/7/26 16:04 - * @description:TopEdge - * @email: clay@hchyun.com - */ -public class TopEdge { - - - private String id; - private String source; - private String sourceEdge; - private String target; - private JSONObject appConfig; - - - - - public TopEdge() { - } - - public TopEdge(String id,String source, String target, JSONObject appConfig) { - this.id = id; - this.source = source; - this.target = target; - this.appConfig = appConfig; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getSourceEdge() { - return sourceEdge; - } - - public void setSourceEdge(String sourceEdge) { - this.sourceEdge = sourceEdge; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public JSONObject getAppConfig() { - return appConfig; - } - - public void setAppConfig(JSONObject appConfig) { - this.appConfig = appConfig; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopNode.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopNode.java deleted file mode 100644 index 511862d..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopNode.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.ebts.generator.entity; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.ebts.common.utils.StringUtils; - -/** - * @author: Clay - * @date: 2021/7/26 17:26 - * @description:TopNode - * @email: clay@hchyun.com - */ -public class TopNode { - private String id; - private String table; - private String relTable; - private StringBuffer tableSQL = new StringBuffer(" "); - private StringBuffer querySql = new StringBuffer(" "); - private JSONArray columns; - - public String getQuerySql() { - return querySql.toString(); - } - - public String getRelTable() { - return relTable; - } - - public String getTableSQL() { - return tableSQL.toString(); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getTable() { - return table; - } - - public void setTable(String table) { - this.table = table; - this.relTable = StringUtils.sqlFormat(table); - boolean start = false; - for (int i = 0; i < this.columns.size(); i++) { - JSONObject column = this.columns.getJSONObject(i); - if (column.getInteger("isUse") == 1) { - if (start) { - tableSQL.append(", "); - } - tableSQL.append(this.relTable).append(".").append(column.getString("columnName")); - if (StringUtils.isNotNull(column.getString("columnComment"))) { - tableSQL.append(" as ").append("'").append(column.getString("columnComment")).append("'"); - } - start = true; - } - - if (column.getInteger("isQuery") == 1 ) { - String sql = " and " + relTable + "." + column.getString("columnName"); - switch (column.getString("ucCon")) { - case "EQ": - sql += " = '" + column.getString("ucMock") + "'"; - break; - case "NE": - sql += " != '" + column.getString("ucMock") + "'"; - break; - case "GT": - sql += " > '" + column.getString("ucMock") + "'"; - break; - case "GTE": - sql += " >= '" + column.getString("ucMock") + "'"; - break; - case "LT": - sql += " < '" + column.getString("ucMock") + "'"; - break; - case "LTE": - sql += " <= '" + column.getString("ucMock") + "'"; - break; - case "LIKE": - sql += " like '%" + column.getString("ucMock") + "%'"; - break; - case "BETWEEN": - try { - JSONObject jsonObject = JSONObject.parseObject(column.getString("ucMock")); - if ("input".equals(column.getString("ucType"))) { - Object begin = jsonObject.get("begin"); - Object end = jsonObject.get("end"); - if (begin != null && end != null) { - sql += " between '" + begin + "' AND '" + end + "'"; - } else { - sql = ""; - } - } else if ("datetime".equals(column.getString("ucType"))) { - Object startTime = jsonObject.get("startTime"); - Object endTime = jsonObject.get("endTime"); - sql += " between '" + startTime + "' AND '" + endTime + "'"; - } - } catch (RuntimeException e) { - sql = ""; - } - break; - } - querySql.append(sql); - } - } - } - - public JSONArray getColumns() { - return columns; - } - - public void setColumns(JSONArray columns) { - this.columns = columns; - } - - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopSearchColumn.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopSearchColumn.java deleted file mode 100644 index 66979eb..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopSearchColumn.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.ebts.generator.entity; - -import com.ebts.common.annotation.Excel; -import com.ebts.common.core.entity.BaseEntity; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -/** - * top万能查询字段对象 gen_top_search_column - * - * @author clay - * @date 2021-07-20 - */ -public class TopSearchColumn extends BaseEntity{ - - /** 主键id */ - private Long id; - - /** top万能查询表格主键id */ - @Excel(name = "top万能查询表格主键id") - private Long searchTableId; - - /** 列名称 */ - @Excel(name = "列名称") - private String columnName; - - /** 列描述 */ - @Excel(name = "列描述") - private String columnComment; - - /** 列类型 */ - @Excel(name = "列类型") - private String columnType; - - /** 是否使用 */ - @Excel(name = "是否使用") - private Integer isUse; - private Integer isPk; - private Integer sort; - - public Integer getSort() { - return sort; - } - - public Integer getIsPk() { - return isPk; - } - - public void setIsPk(Integer isPk) { - this.isPk = isPk; - } - - public void setId(Long id){ - this.id = id; - } - - public Long getId(){ - return id; - } - public void setSearchTableId(Long searchTableId){ - this.searchTableId = searchTableId; - } - - public Long getSearchTableId(){ - return searchTableId; - } - public void setColumnName(String columnName){ - this.columnName = columnName; - } - - public String getColumnName(){ - return columnName; - } - public void setColumnComment(String columnComment){ - this.columnComment = columnComment; - } - - public String getColumnComment(){ - return columnComment; - } - public void setColumnType(String columnType){ - this.columnType = columnType; - } - - public String getColumnType(){ - return columnType; - } - public void setIsUse(Integer isUse){ - this.isUse = isUse; - } - - public Integer getIsUse(){ - return isUse; - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("searchTableId", getSearchTableId()) - .append("columnName", getColumnName()) - .append("columnComment", getColumnComment()) - .append("columnType", getColumnType()) - .append("isUse", getIsUse()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .toString(); - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopSearchTable.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopSearchTable.java deleted file mode 100644 index 8d54176..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/TopSearchTable.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.ebts.generator.entity; - -import java.util.List; -import com.ebts.common.core.entity.BaseEntity; -import com.ebts.common.annotation.Excel; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import javax.validation.constraints.NotNull; - -/** - * top万能查询主对象 gen_top_search_table - * - * @author clay - * @date 2021-07-20 - */ -public class TopSearchTable extends BaseEntity{ - - /** 主键id */ - private Long id; - - /** 表名 */ - private String tableName; - - /** 表描述 */ - private String tableComment; - - /** top万能查询字段信息 */ - private List topSearchColumnList; - - private Long[] roleIds; - - private List relationalMapList; - - public List getRelationalMapList() { - return relationalMapList; - } - - public void setRelationalMapList(List relationalMapList) { - this.relationalMapList = relationalMapList; - } - - public Long[] getRoleIds() { - return roleIds; - } - - public void setRoleIds(Long[] roleIds) { - this.roleIds = roleIds; - } - - public void setId(Long id){ - this.id = id; - } - - public Long getId(){ - return id; - } - public void setTableName(String tableName){ - this.tableName = tableName; - } - - public String getTableName(){ - return tableName; - } - public void setTableComment(String tableComment){ - this.tableComment = tableComment; - } - - public String getTableComment(){ - return tableComment; - } - - public List getTopSearchColumnList(){ - return topSearchColumnList; - } - - public void setTopSearchColumnList(List topSearchColumnList){ - this.topSearchColumnList = topSearchColumnList; - } - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("tableName", getTableName()) - .append("tableComment", getTableComment()) - .append("remark", getRemark()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("topSearchColumnList", getTopSearchColumnList()) - .toString(); - } - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/UniCon.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/UniCon.java deleted file mode 100644 index 4ed1727..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/UniCon.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.ebts.generator.entity; - - -/** - * 万能查询条件对象 sys_uni_con - * - * @author binlin - * @date 2021-01-30 - */ -public class UniCon { - - - /** - * id - */ - private Long id; - - /** - * 万能查询tableid - */ - private Long uqId; - - /** - * 名称(lable) - */ - private String ucName; - - /** - * 关键字 - */ - private String ucKey; - - /** - * 查询条件 - */ - private String ucCon; - - /** - * 模拟数据 - */ - private String ucMock; - - /** - * 真实数据 - */ - private Object ucReal; - - /** - * 描述 - */ - private String ucDescribe; - - /** - * 输入类型 - */ - private String ucType; - - /** - * 显示类型 - */ - private Integer type; - - public UniCon() { - } - - public UniCon(Long uqId, String ucName, String ucKey, String ucCon, String ucType, Integer type) { - this.uqId = uqId; - this.ucName = ucName; - this.ucKey = ucKey; - this.ucCon = ucCon; - this.ucType = ucType; - this.type = type; - } - - public String getUcType() { - return ucType; - } - - public void setUcType(String ucType) { - this.ucType = ucType; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getId() { - return id; - } - - public void setUqId(Long uqId) { - this.uqId = uqId; - } - - public Long getUqId() { - return uqId; - } - - public void setUcName(String ucName) { - this.ucName = ucName; - } - - public String getUcName() { - return ucName; - } - - public void setUcKey(String ucKey) { - this.ucKey = ucKey; - } - - public String getUcKey() { - return ucKey; - } - - public void setUcCon(String ucCon) { - this.ucCon = ucCon; - } - - public String getUcCon() { - return ucCon; - } - - public String getUcMock() { - return ucMock; - } - - public void setUcMock(String ucMock) { - this.ucMock = ucMock; - } - - public String getUcDescribe() { - return ucDescribe; - } - - public void setUcDescribe(String ucDescribe) { - this.ucDescribe = ucDescribe; - } - - public Object getUcReal() { - return ucReal; - } - - public void setUcReal(Object ucReal) { - this.ucReal = ucReal; - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/UniQuery.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/UniQuery.java deleted file mode 100644 index 6b48876..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/entity/UniQuery.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.ebts.generator.entity; - -import com.ebts.common.core.entity.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import java.util.ArrayList; -import java.util.List; - -/** - * 万能查询对象 sys_uni_query - * - * @author binlin - * @date 2021-01-30 - */ -public class UniQuery extends BaseEntity { - - /** - * id - */ - private Long id; - - /** - * 名称 - */ - private String uqName; - - /** - * sql语句 - */ - private String uqSql; - - /** - * 描述 - */ - private String uqDescribe; - - private String topJson; - - - private int type; - - /** - * 是否发布(0:否,1:发布) - */ - private Integer isRelease; - - private Integer isPreview; - - private List uniCons; - - private Integer pageNum; - - private Integer pageSize; - - public String getTopJson() { - return topJson; - } - - - public Integer getIsPreview() { - return isPreview; - } - - public void setIsPreview(Integer isPreview) { - this.isPreview = isPreview; - } - - public void setTopJson(String topJson) { - this.topJson = topJson; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public Integer getIsRelease() { - return isRelease; - } - - public void setIsRelease(Integer isRelease) { - this.isRelease = isRelease; - } - - public Integer getPageNum() { - return pageNum; - } - - public void setPageNum(Integer pageNum) { - this.pageNum = pageNum; - } - - public Integer getPageSize() { - return pageSize; - } - - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - } - - public List getUniCons() { - if (uniCons == null) { - return uniCons = new ArrayList(); - } else { - return uniCons; - } - } - - public void setUniCons(List uniCons) { - this.uniCons = uniCons; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getId() { - return id; - } - - public void setUqName(String uqName) { - this.uqName = uqName; - } - - public String getUqName() { - return uqName; - } - - public void setUqSql(String uqSql) { - this.uqSql = uqSql; - } - - public String getUqSql() { - return uqSql; - } - - public void setUqDescribe(String uqDescribe) { - this.uqDescribe = uqDescribe; - } - - public String getUqDescribe() { - return uqDescribe; - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("uqName", getUqName()) - .append("uqSql", getUqSql()) - .append("uqDescribe", getUqDescribe()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .toString(); - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/ApiClassService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/ApiClassService.java deleted file mode 100644 index 7e9f95b..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/ApiClassService.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ebts.generator.service; - -import java.util.List; - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.ApiClass; - -/** - * 接口类名Service接口 - * - * @author binlin - * @date 2021-01-24 - */ -public interface ApiClassService { - /** - * 查询接口类名 - * - * @param id 接口类名ID - * @return 接口类名 - */ - ServerResult selectApiclassById(Long id); - - /** - * 查询接口类名列表 - * - * @param apiclass 接口类名 - * @return 接口类名集合 - */ - ServerResult> selectApiclassList(ApiClass apiclass); - - /** - * 新增接口类名 - * - * @param apiclass 接口类名 - * @return 结果 - */ - ServerResult insertApiclass(ApiClass apiclass); - - /** - * 修改接口类名 - * - * @param apiclass 接口类名 - * @return 结果 - */ - ServerResult updateApiclass(ApiClass apiclass); - - /** - * 批量删除接口类名 - * - * @param ids 需要删除的接口类名ID - * @return 结果 - */ - ServerResult deleteApiclassByIds(Long[] ids); - - /** - * 删除接口类名信息 - * - * @param id 接口类名ID - * @return 结果 - */ - ServerResult deleteApiclassById(Long id); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/GenTableColumnService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/GenTableColumnService.java deleted file mode 100644 index 3af770f..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/GenTableColumnService.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ebts.generator.service; - -import java.util.List; - -import com.ebts.generator.entity.GenTableColumn; - -/** - * 业务字段 服务层 - * - * @author binlin - */ -public interface GenTableColumnService { - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - List selectGenTableColumnListByTableId(Long tableId); - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - int insertGenTableColumn(GenTableColumn genTableColumn); - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - int updateGenTableColumn(GenTableColumn genTableColumn); - - /** - * 删除业务字段信息 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - int deleteGenTableColumnByIds(String ids); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/GenTableService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/GenTableService.java deleted file mode 100644 index a930764..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/GenTableService.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.ebts.generator.service; - -import java.util.List; -import java.util.Map; - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.GenTable; - -/** - * 业务 服务层 - * - * @author binlin - */ -public interface GenTableService { - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - public List selectGenTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - public List selectDbTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - public List selectDbTableListByNames(String[] tableNames); - - /** - * 查询所有表信息 - * - * @return 表信息集合 - */ - public List selectGenTableAll(); - - /** - * 查询业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - public GenTable selectGenTableById(Long id); - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public void updateGenTable(GenTable genTable); - - /** - * 删除业务信息 - * - * @param tableIds 需要删除的表数据ID - * @return 结果 - */ - public ServerResult deleteGenTableByIds(Long[] tableIds); - - /** - * 导入表结构 - * - * @param tableList 导入表列表 - */ - public void importGenTable(List tableList); - - /** - * 预览代码 - * - * @param tableId 表编号 - * @return 预览数据列表 - */ - public Map previewCode(Long tableId); - - /** - * 生成代码(下载方式) - * - * @param tableName 表名称 - * @return 数据 - */ - public byte[] downloadCode(String tableName); - - /** - * 生成代码(自定义路径) - * - * @param tableName 表名称 - * @return 数据 - */ - public boolean generatorCode(String tableName); - - /** - * 同步数据库 - * - * @param tableName 表名称 - */ - public void synchDb(String tableName); - - /** - * 批量生成代码(下载方式) - * - * @param tableNames 表数组 - * @return 数据 - */ - public byte[] downloadCode(String[] tableNames); - - /** - * 修改保存参数校验 - * - * @param genTable 业务信息 - */ - public void validateEdit(GenTable genTable); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/InterTableService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/InterTableService.java deleted file mode 100644 index 702d450..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/InterTableService.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.ebts.generator.service; - -import java.util.Map; - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dto.InterTableDto; -import com.ebts.generator.entity.InterTable; - -/** - * 接口信息Service接口 - * - * @author binlin - * @date 2021-01-25 - */ -public interface InterTableService { - /** - * 查询接口信息 - * - * @param id 接口信息ID - * @return 接口信息 - */ - ServerResult selectInterTableById(Long id); - - /** - * 查询接口信息列表 - * - * @param interTable 接口信息 - * @return 接口信息集合 - */ - ServerResult> selectInterTableList(InterTable interTable); - - /** - * 新增接口信息 - * - * @param interTable 接口信息 - * @return 结果 - */ - ServerResult insertInterTable(InterTable interTable); - - /** - * 修改接口信息 - * - * @param interTableDto 接口信息 - * @return 结果 - */ - ServerResult updateInterTable(InterTableDto interTableDto); - - /** - * 批量删除接口信息 - * - * @param ids 需要删除的接口信息ID - * @return 结果 - */ - ServerResult deleteInterTableByIds(Long[] ids); - - /** - * 删除接口信息信息 - * - * @param id 接口信息ID - * @return 结果 - */ - ServerResult deleteInterTableById(Long id); - - /** - * 预览代码(工作流) - * - * @param cid - * @return - */ - ServerResult> previewCodeCalss(Long cid); - - /** - * 预览代码()工作台 - * - * @param mid - * @return - */ - ServerResult> previewCodeMoudle(Long mid); - - /** - * 生成代码(工作流) - * - * @param cid - * @return - */ - ServerResult generatorCodeClass(Long cid); - - /** - * 生成代码(工作台) - * - * @param mid - * @return - */ - ServerResult generatorCodeMoudle(Long mid); - -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/ModuleService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/ModuleService.java deleted file mode 100644 index 6eb8dcc..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/ModuleService.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ebts.generator.service; - - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.Module; - -import java.util.List; - -/** - * 模块管理Service接口 - * - * @author binlin - * @date 2021-01-24 - */ -public interface ModuleService { - /** - * 查询模块管理 - * - * @param id 模块管理ID - * @return 模块管理 - */ - ServerResult selectModuleById(Long id); - - /** - * 查询模块管理列表 - * - * @param module 模块管理 - * @return 模块管理集合 - */ - ServerResult> selectModuleList(Module module); - - /** - * 新增模块管理 - * - * @param module 模块管理 - * @return 结果 - */ - ServerResult insertModule(Module module); - - /** - * 修改模块管理 - * - * @param module 模块管理 - * @return 结果 - */ - ServerResult updateModule(Module module); - - /** - * 批量删除模块管理 - * - * @param ids 需要删除的模块管理ID - * @return 结果 - */ - ServerResult deleteModuleByIds(Long[] ids); - - /** - * 删除模块管理信息 - * - * @param id 模块管理ID - * @return 结果 - */ - ServerResult deleteModuleById(Long id); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/QueryService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/QueryService.java deleted file mode 100644 index d728160..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/QueryService.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ebts.generator.service; - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.UniQuery; - -import java.util.List; -import java.util.Map; - -/** - * @Author 18209 - * @Date 2021/1/30 18:54 - * @Version 1.0 - */ -public interface QueryService { - /** - * 通过id查询基础信息 - * - * @param id - * @return - */ - ServerResult selectQueryById(Long id); - - /** - * 修改基础信息 - * - * @param uniQuery - * @return - */ - ServerResult updateQueryInfo(UniQuery uniQuery); - - /** - * 预览万能查询数据 - * - * @param uniQuery - * @return - */ - ServerResult>> previewQuery(UniQuery uniQuery); - - /** - * @param uniQuery - * @return - */ - ServerResult Release(UniQuery uniQuery); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/RegularService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/RegularService.java deleted file mode 100644 index 2f06173..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/RegularService.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.ebts.generator.service; - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.Regular; - -import java.util.List; - -/** - * 校验规则Service接口 - * - * @author binlin - * @date 2021-01-18 - */ -public interface RegularService { - /** - * 查询校验规则 - * - * @param id 校验规则ID - * @return 校验规则 - */ - ServerResult selectRegularById(Long id); - - /** - * 查询校验规则列表 - * - * @param regular 校验规则 - * @return 校验规则集合 - */ - ServerResult> selectRegularList(Regular regular); - /** - * 查询校验规则下拉框列表 - * - * @return 校验规则集合 - */ - ServerResult> selectRegularOption(); - - /** - * 新增校验规则 - * - * @param regular 校验规则 - * @return 结果 - */ - ServerResult insertRegular(Regular regular); - - /** - * 修改校验规则 - * - * @param regular 校验规则 - * @return 结果 - */ - ServerResult updateRegular(Regular regular); - - /** - * 批量删除校验规则 - * - * @param ids 需要删除的校验规则ID - * @return 结果 - */ - ServerResult deleteRegularByIds(Long[] ids); - - /** - * 删除校验规则信息 - * - * @param id 校验规则ID - * @return 结果 - */ - ServerResult deleteRegularById(Long id); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/RelService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/RelService.java deleted file mode 100644 index 002cfce..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/RelService.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ebts.generator.service; - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.RelColumn; -import com.ebts.generator.entity.RelTable; - -import java.util.List; -import java.util.Map; - -/** - * @Author 18209 - * @Date 2021/2/24 16:21 - * @Version 1.0 - */ -public interface RelService { - - /** - * 获取到数据库表信息 - * - * @return - */ - ServerResult>> tableInfos(); - - /** - * 获取到关联边字段信息 - * - * @param tableName 关联表表名 - * @param relId 关联关系id - * @return - */ - ServerResult> relColumns(String tableName, Long relId); - - /** - * 通过tableName获取到字段信息 - * - * @param tableName - * @return - */ - ServerResult>> tableColumns(String tableName); - - /** - * 通过主表id查询子表信息 - * - * @param tableId - * @return - */ - ServerResult> relTableByTableId(Long tableId); - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/TopQueryService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/TopQueryService.java deleted file mode 100644 index 023151c..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/TopQueryService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ebts.generator.service; - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dto.TopResult; - -import java.util.Map; - -/** - * @author: Clay - * @date: 2021/7/23 21:51 - * @description:TopQueryService - * @email: clay@hchyun.com - */ -public interface TopQueryService { - - Map selectTopSearchTables(); - - ServerResult preview(String jsonData, String id); - - ServerResult online(Long id); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/TopSearchTableService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/TopSearchTableService.java deleted file mode 100644 index 8fb33c6..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/TopSearchTableService.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ebts.generator.service; - -import java.util.List; -import java.util.Map; - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.TopSearchColumn; -import com.ebts.generator.entity.TopSearchTable; - -/** - * top万能查询主Service接口 - * - * @author clay - * @date 2021-07-20 - */ -public interface TopSearchTableService { - /** - * 查询top万能查询主 - * - * @param id top万能查询主ID - * @return top万能查询主 - */ - ServerResult selectTopSearchTableById(Long id); - - /** - * 查询top万能查询主列表 - * - * @param topSearchTable top万能查询主 - * @return top万能查询主集合 - */ - ServerResult> selectTopSearchTableList(TopSearchTable topSearchTable); - - /** - * @return - */ - ServerResult> selectTopSearchTableInfo(); - - List selectTableColumns(Long id); - - /** - * 新增top万能查询主 - * - * @param topSearchTable top万能查询主 - * @return 结果 - */ - ServerResult insertTopSearchTable(TopSearchTable topSearchTable); - - /** - * 修改top万能查询主 - * - * @param topSearchTable top万能查询主 - * @return 结果 - */ - ServerResult updateTopSearchTable(TopSearchTable topSearchTable); - - List selectDbTableListByNames(String[] tableNames); - - List> selectDbTableList(Map params); - - void importGenTable(List tableList); - - /** - * 批量删除top万能查询主 - * - * @param ids 需要删除的top万能查询主ID - * @return 结果 - */ - ServerResult deleteTopSearchTableByIds(Long[] ids); - - /** - * 删除top万能查询主信息 - * - * @param id top万能查询主ID - * @return 结果 - */ - ServerResult deleteTopSearchTableById(Long id); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/UniQueryService.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/UniQueryService.java deleted file mode 100644 index 64618c8..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/UniQueryService.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ebts.generator.service; - -import java.util.List; - -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.entity.UniQuery; - -/** - * 万能查询Service接口 - * - * @author binlin - * @date 2021-01-30 - */ -public interface UniQueryService { - /** - * 查询万能查询 - * - * @param id 万能查询ID - * @return 万能查询 - */ - ServerResult selectUniQueryById(Long id); - - /** - * 查询万能查询列表 - * - * @param uniQuery 万能查询 - * @return 万能查询集合 - */ - ServerResult> selectUniQueryList(UniQuery uniQuery); - - /** - * 新增万能查询 - * - * @param uniQuery 万能查询 - * @return 结果 - */ - ServerResult insertUniQuery(UniQuery uniQuery); - - /** - * 修改万能查询 - * - * @param uniQuery 万能查询 - * @return 结果 - */ - ServerResult updateUniQuery(UniQuery uniQuery); - - /** - * 批量删除万能查询 - * - * @param ids 需要删除的万能查询ID - * @return 结果 - */ - ServerResult deleteUniQueryByIds(Long[] ids); - - /** - * 删除万能查询信息 - * - * @param id 万能查询ID - * @return 结果 - */ - ServerResult deleteUniQueryById(Long id); -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/ApiClassServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/ApiClassServiceImpl.java deleted file mode 100644 index 2412728..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/ApiClassServiceImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.ebts.generator.service.impl; - -import java.util.List; - -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.exception.EbtsException; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dao.ApiClassDao; -import com.ebts.generator.entity.ApiClass; -import com.ebts.generator.service.ApiClassService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * 接口类名Service业务层处理 - * - * @author binlin - * @date 2021-01-24 - */ -@Service -public class ApiClassServiceImpl implements ApiClassService { - private Logger logger = LoggerFactory.getLogger(ApiClassServiceImpl.class); - - @Autowired - private ApiClassDao apiclassDao; - - /** - * 查询接口类名 - * - * @param id 接口类名ID - * @return 接口类名 - */ - @Override - public ServerResult selectApiclassById(Long id) { - try { - ApiClass apiclass = apiclassDao.selectApiclassById(id); - if (apiclass != null) { - return new ServerResult<>(true, apiclass); - } else { - return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询接口类名列表 - * - * @param apiclass 接口类名 - * @return 接口类名 - */ - @Override - public ServerResult> selectApiclassList(ApiClass apiclass) { - try { - List apiClassList = apiclassDao.selectApiclassList(apiclass); - if (apiClassList.size() > 0) { - return new ServerResult<>(true, apiClassList); - } else { - return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 新增接口类名 - * - * @param apiclass 接口类名 - * @return 结果 - */ - @Override - public ServerResult insertApiclass(ApiClass apiclass) { - try { - apiclass.setCreateBy(SecurityUtils.getUserId()); - Integer renewal = apiclassDao.insertApiclass(apiclass); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.OP_ERROR); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 修改接口类名 - * - * @param apiclass 接口类名 - * @return 结果 - */ - @Override - public ServerResult updateApiclass(ApiClass apiclass) { - try { - apiclass.setUpdateBy(SecurityUtils.getUserId()); - Integer renewal = apiclassDao.updateApiclass(apiclass); - if (renewal > 0) { - return new ServerResult<>(true, renewal); - } else { - return new ServerResult<>(false, ReturnConstants.OP_ERROR); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 批量删除接口类名 - * - * @param ids 需要删除的接口类名ID - * @return 结果 - */ - @Override - public ServerResult deleteApiclassByIds(Long[] ids) { - try { - Integer renewal = apiclassDao.deleteApiclassByIds(ids); - if (renewal > 0) { - return new ServerResult<>(true, renewal); - } else { - return new ServerResult<>(false, ReturnConstants.OP_ERROR); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 删除接口类名信息 - * - * @param id 接口类名ID - * @return 结果 - */ - @Override - public ServerResult deleteApiclassById(Long id) { - try { - Integer renewal = apiclassDao.deleteApiclassById(id); - if (renewal > 0) { - return new ServerResult<>(true, renewal); - } else { - return new ServerResult<>(false, ReturnConstants.OP_ERROR); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/GenTableColumnServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/GenTableColumnServiceImpl.java deleted file mode 100644 index cbdd9a8..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/GenTableColumnServiceImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.ebts.generator.service.impl; - -import java.util.ArrayList; -import java.util.List; - -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.core.text.Convert; -import com.ebts.common.exception.EbtsException; -import com.ebts.generator.service.GenTableColumnService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ebts.generator.entity.GenTableColumn; -import com.ebts.generator.dao.GenTableColumnDao; - -/** - * 业务字段 服务层实现 - * - * @author binlin - */ -@Service -public class GenTableColumnServiceImpl implements GenTableColumnService { - private Logger logger = LoggerFactory.getLogger(GenTableColumnServiceImpl.class); - - @Autowired - private GenTableColumnDao genTableColumnDao; - - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - @Override - public List selectGenTableColumnListByTableId(Long tableId) { - try { - return genTableColumnDao.selectGenTableColumnListByTableId(tableId); - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int insertGenTableColumn(GenTableColumn genTableColumn) { - try { - return genTableColumnDao.insertGenTableColumn(genTableColumn); - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int updateGenTableColumn(GenTableColumn genTableColumn) { - try { - List genTableColumns = new ArrayList(); - genTableColumns.add(genTableColumn); - return genTableColumnDao.updateGenTableColumn(genTableColumns); - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 删除业务字段对象 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - @Override - public int deleteGenTableColumnByIds(String ids) { - try { - return genTableColumnDao.deleteGenTableColumnByIds(Convert.toLongArray(ids)); - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/GenTableServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/GenTableServiceImpl.java deleted file mode 100644 index e85b523..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/GenTableServiceImpl.java +++ /dev/null @@ -1,648 +0,0 @@ -package com.ebts.generator.service.impl; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.util.Comparator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import com.ebts.common.constant.Constants; -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.core.text.CharsetKit; -import com.ebts.common.exception.CustomException; -import com.ebts.common.exception.EbtsException; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import com.ebts.common.utils.StringUtils; -import com.ebts.generator.dao.RelDao; -import com.ebts.generator.entity.*; -import com.ebts.generator.service.GenTableService; -import com.ebts.generator.utils.*; -import com.ebts.generator.utils.constant.GenConstants; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.ebts.generator.dao.GenTableColumnDao; -import com.ebts.generator.dao.GenTableDao; -import org.springframework.transaction.interceptor.TransactionAspectSupport; - -/** - * 业务 服务层实现 - * - * @author binlin - */ -@Service -public class GenTableServiceImpl implements GenTableService { - private static final Logger logger = LoggerFactory.getLogger(GenTableServiceImpl.class); - - @Autowired - private GenTableDao genTableDao; - - @Autowired - private GenTableColumnDao genTableColumnDao; - - - @Autowired - private RelDao relDao; - - /** - * 查询业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - @Override - public GenTable selectGenTableById(Long id) { - try { - GenTable genTable = genTableDao.selectGenTableById(id); - setTableFromOptions(genTable); - return genTable; - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - @Override - public List selectGenTableList(GenTable genTable) { - try { - return genTableDao.selectGenTableList(genTable); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - @Override - public List selectDbTableList(GenTable genTable) { - try { - return genTableDao.selectDbTableList(genTable); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - @Override - public List selectDbTableListByNames(String[] tableNames) { - try { - return genTableDao.selectDbTableListByNames(tableNames); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询所有表信息 - * - * @return 表信息集合 - */ - @Override - public List selectGenTableAll() { - try { - return genTableDao.selectGenTableAll(); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * todo 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void updateGenTable(GenTable genTable) { - try { - String options = JSON.toJSONString(genTable.getParams()); - genTable.setOptions(options); - int row = genTableDao.updateGenTable(genTable); - if (row > 0) { - genTableColumnDao.updateGenTableColumn(genTable.getColumns()); - if (genTable.getTplCategory().equals("rel")){ - List relTables = relDao.relTableByTableId(genTable.getTableId()); - for (RelTable relTable : relTables) { - relDao.deleteRelColumnByRelId(relTable.getId()); - } - relDao.deleteRelTableByTableId(genTable.getTableId()); - relTables = genTable.getRelTables(); - for (int i = 0; i < relTables.size(); i++) { - RelTable relTable = relTables.get(i); - relTable.setTableAs(StringUtils.sqlFormat(relTable.getTableName())); - relTable.setRelAs(StringUtils.sqlFormat(relTable.getRelName())); - relTable.setRelClass(GenUtils.convertClassName(relTable.getRelName())); - relTable.setCreateBy(SecurityUtils.getUserId()); - relTable.setRelclass(StringUtils.uncapitalize(relTable.getRelClass())); - relTables.set(i,relTable); - } - if (relTables != null) { - relDao.insertRelTables(relTables); - for (RelTable relTable : relTables) { - relDao.insertRelColumns(relTable.getRelColumns()); - } - } - } - } - } catch (CustomException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 删除业务对象 - * - * @param tableIds 需要删除的数据ID - * @return 结果 - */ - @Override - @Transactional - public ServerResult deleteGenTableByIds(Long[] tableIds) { - try { - genTableDao.deleteGenTableByIds(tableIds); - genTableColumnDao.deleteGenTableColumnByIds(tableIds); - for (Long tableId : tableIds) { - List relTables = relDao.relTableByTableId(tableId); - if (relTables.size()>0){ - relDao.deleteRelTableByTableId(tableId); - for (RelTable relTable : relTables) { - relDao.deleteRelColumnByRelId(relTable.getId()); - } - } - } - return new ServerResult<>(true); - } catch (RuntimeException e) { - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 导入表结构 - * - * @param tableList 导入表列表 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void importGenTable(List tableList) { - Long operName = SecurityUtils.getUserId(); - try { - for (GenTable table : tableList) { - String tableName = table.getTableName(); - GenUtils.initTable(table, operName); - int row = genTableDao.insertGenTable(table); - if (row > 0) { - // 保存列信息 - List genTableColumns = genTableColumnDao.selectDbTableColumnsByName(tableName); - for (GenTableColumn column : genTableColumns) { - GenUtils.initColumnField(column, table); - genTableColumnDao.insertGenTableColumn(column); - } - } - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException("导入失败:" + e.getMessage(),e); - } - } - - /** - * 预览代码 - * - * @param tableId 表编号 - * @return 预览数据列表 - */ - @Override - public Map previewCode(Long tableId) { - try { - Map dataMap = new LinkedHashMap<>(); - // 查询表信息 - GenTable table = genTableDao.selectGenTableById(tableId); - if (table.getTplCategory().equals(GenConstants.TPL_SUB)) { - // 设置主子表信息 - setSubTable(table); - } - if (table.getTplCategory().equals(GenConstants.TPL_REL)) { - List relTables = relDao.relTableByTableId(tableId); - relTables = relTables.stream().sorted(Comparator.comparing(RelTable::getSort)).collect(Collectors.toList()); - table.setRelTables(relTables); - } - // 设置主键列信息 - setPkColumn(table); - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); - for (String template : templates) { - // 渲染模板 - if (template.equals("vm/java/rel-entity.java.vm")){ - List relTables = table.getRelTables(); - for (RelTable relTable : relTables) { - List relColumns = relTable.getRelColumns(); - relColumns = relColumns.stream().sorted(Comparator.comparing(RelColumn::getSort)).collect(Collectors.toList()); - relTable.setRelColumns(relColumns); - context.put("relTable",relTable); - StringWriter stringWriter = new StringWriter(); - Template temp = Velocity.getTemplate(template,Constants.UTF8); - temp.merge(context,stringWriter); - dataMap.put(VelocityUtils.getPreviewName(template,relTable.getRelClass()),stringWriter.toString()); - } - continue; - } - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - dataMap.put(VelocityUtils.getPreviewName(template,table.getClassName()), sw.toString()); - } - return dataMap; - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 生成代码(下载方式) - * - * @param tableName 表名称 - * @return 数据 - */ - @Override - public byte[] downloadCode(String tableName) { - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - generatorCode(tableName, zip); - IOUtils.closeQuietly(zip); - return outputStream.toByteArray(); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 生成代码(自定义路径) - * - * @param tableName 表名称 - * @return - */ - @Override - public boolean generatorCode(String tableName) { - try { - // 查询表信息 - GenTable table = genTableDao.selectGenTableByName(tableName); - // 设置主子表信息 - setSubTable(table); - // 设置主键列信息 - setPkColumn(table); - - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); - for (String template : templates) { - if (!StringUtils.containsAny(template, "table.sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) { - // 渲染模板 - if (template.equals("vm/java/rel-entity.java.vm")){ - List relTables = table.getRelTables(); - for (RelTable relTable : relTables) { - List relColumns = relTable.getRelColumns(); - relColumns = relColumns.stream().sorted(Comparator.comparing(RelColumn::getSort)).collect(Collectors.toList()); - relTable.setRelColumns(relColumns); - context.put("relTable",relTable); - StringWriter stringWriter = new StringWriter(); - Template temp = Velocity.getTemplate(template,Constants.UTF8); - temp.merge(context,stringWriter); - try { - String path = getGenPath(table, template); - FileUtils.writeStringToFile(new File(path), stringWriter.toString(), CharsetKit.UTF_8); - } catch (IOException e) { - logger.error("渲染模板失败,表名:" + table.getTableName()); - return false; - } - } - continue; - } - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - if (template.equals("vm/sql/table.sql.vm")) { - Boolean start = insertMenuItem(sw); - if (start) { - return false; - } - } else { - try { - String path = getGenPath(table, template); - FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8); - } catch (IOException e) { - logger.error("渲染模板失败,表名:" + table.getTableName()); - return false; - } - } - } - } - return true; - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 同步数据库 - * - * @param tableName 表名称 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void synchDb(String tableName) { - try { - GenTable table = genTableDao.selectGenTableByName(tableName); - List tableColumns = table.getColumns(); - List tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); - - List dbTableColumns = genTableColumnDao.selectDbTableColumnsByName(tableName); - if (StringUtils.isEmpty(dbTableColumns)) { - throw new CustomException("同步数据失败,原表结构不存在"); - } - List dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); - - dbTableColumns.forEach(column -> { - if (!tableColumnNames.contains(column.getColumnName())) { - GenUtils.initColumnField(column, table); - genTableColumnDao.insertGenTableColumn(column); - } - }); - - List delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); - if (StringUtils.isNotEmpty(delColumns)) { - genTableColumnDao.deleteGenTableColumns(delColumns); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 批量生成代码(下载方式) - * - * @param tableNames 表数组 - * @return 数据 - */ - @Override - public byte[] downloadCode(String[] tableNames) { - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - for (String tableName : tableNames) { - zip = generatorCode(tableName, zip); -// generatorCode(tableName, zip); - if (zip == null) { - return null; - } - } - IOUtils.closeQuietly(zip); - return outputStream.toByteArray(); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - @Transactional(rollbackFor = Exception.class) - boolean insertMenuItem(StringWriter stringWriter) { - try { - String sql = stringWriter.toString(); - int start = genTableDao.insertMenu(sql); - if (start > 0) { - return false; - } else { - return true; - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * todo 查询表信息并生成代码 - */ - private ZipOutputStream generatorCode(String tableName, ZipOutputStream zip) { - // 查询表信息 - GenTable table = genTableDao.selectGenTableByName(tableName); - // 设置主子表信息 - setSubTable(table); - // 设置主键列信息 - setPkColumn(table); - if (table.getTplCategory().equals(GenConstants.TPL_REL)) { - List relTables = relDao.relTableByTableId(table.getTableId()); - relTables = relTables.stream().sorted(Comparator.comparing(RelTable::getSort)).collect(Collectors.toList()); - table.setRelTables(relTables); - } - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); - for (String template : templates) { - - // 渲染模板 - if (template.equals("vm/java/rel-entity.java.vm")){ - List relTables = table.getRelTables(); - for (RelTable relTable : relTables) { - List relColumns = relTable.getRelColumns(); - relColumns = relColumns.stream().sorted(Comparator.comparing(RelColumn::getSort)).collect(Collectors.toList()); - relTable.setRelColumns(relColumns); - context.put("relTable",relTable); - StringWriter stringWriter = new StringWriter(); - Template temp = Velocity.getTemplate(template,Constants.UTF8); - temp.merge(context,stringWriter); - try { - // 添加到zip - zip.putNextEntry(new ZipEntry(VelocityUtils.getRelFileName(template, table,relTable))); - IOUtils.write(stringWriter.toString(), zip, Constants.UTF8); - IOUtils.closeQuietly(stringWriter); - zip.flush(); - zip.closeEntry(); - } catch (IOException e) { - logger.error("渲染模板失败,表名:" + table.getTableName(), e); - } - } - continue; - } - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - - if (template.equals("vm/sql/table.sql.vm")) { - Boolean start = insertMenuItem(sw); - if (start) { - return null; - } - } - try { - // 添加到zip - zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); - IOUtils.write(sw.toString(), zip, Constants.UTF8); - IOUtils.closeQuietly(sw); - zip.flush(); - zip.closeEntry(); - } catch (IOException e) { - logger.error("渲染模板失败,表名:" + table.getTableName(), e); - } - } - return zip; - } - - /** - * todo 修改保存参数校验 - * - * @param genTable 业务信息 - */ - @Override - public void validateEdit(GenTable genTable) { - if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { - String options = JSON.toJSONString(genTable.getParams()); - JSONObject paramsObj = JSONObject.parseObject(options); - if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) { - throw new CustomException("树编码字段不能为空"); - } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) { - throw new CustomException("树父编码字段不能为空"); - } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) { - throw new CustomException("树名称字段不能为空"); - } else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) { - if (StringUtils.isEmpty(genTable.getSubTableName())) { - throw new CustomException("关联子表的表名不能为空"); - } else if (StringUtils.isEmpty(genTable.getSubTableFkName())) { - throw new CustomException("子表关联的外键名不能为空"); - } - } else if (GenConstants.TPL_ASS.equals(genTable.getTplCategory())) { -// todo 规则校验 - } - } - } - - /** - * 设置主键列信息 - * - * @param table 业务表信息 - */ - public void setPkColumn(GenTable table) { - for (GenTableColumn column : table.getColumns()) { - if (column.isPk()) { - table.setPkColumn(column); - break; - } - } - if (StringUtils.isNull(table.getPkColumn())) { - table.setPkColumn(table.getColumns().get(0)); - } - if (GenConstants.TPL_SUB.equals(table.getTplCategory())) { - for (GenTableColumn column : table.getSubTable().getColumns()) { - if (column.isPk()) { - table.getSubTable().setPkColumn(column); - break; - } - } - if (StringUtils.isNull(table.getSubTable().getPkColumn())) { - table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0)); - } - } - } - - /** - * 设置主子表信息 - * - * @param table 业务表信息 - */ - public void setSubTable(GenTable table) { - String subTableName = table.getSubTableName(); - if (StringUtils.isNotEmpty(subTableName)) { - table.setSubTable(genTableDao.selectGenTableByName(subTableName)); - } - } - - /** - * 设置代码生成其他选项值 - * - * @param genTable 设置后的生成对象 - */ - public void setTableFromOptions(GenTable genTable) { - JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions()); - if (StringUtils.isNotNull(paramsObj)) { - String treeCode = paramsObj.getString(GenConstants.TREE_CODE); - String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE); - String treeName = paramsObj.getString(GenConstants.TREE_NAME); - String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID); - String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME); - - genTable.setTreeCode(treeCode); - genTable.setTreeParentCode(treeParentCode); - genTable.setTreeName(treeName); - genTable.setParentMenuId(parentMenuId); - genTable.setParentMenuName(parentMenuName); - } - } - - /** - * 获取代码生成地址 - * - * @param table 业务表信息 - * @param template 模板文件路径 - * @return 生成地址 - */ - public static String getGenPath(GenTable table, String template) { - String genPath = table.getGenPath(); - if (StringUtils.equals(genPath, "/")) { - return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table); - } - return genPath + File.separator + VelocityUtils.getFileName(template, table); - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/InterTableServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/InterTableServiceImpl.java deleted file mode 100644 index 3a9ea0b..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/InterTableServiceImpl.java +++ /dev/null @@ -1,364 +0,0 @@ -package com.ebts.generator.service.impl; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.StringWriter; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import com.ebts.common.constant.Constants; -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.exception.EbtsException; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dao.ApiClassDao; -import com.ebts.generator.dao.GenTableDao; -import com.ebts.generator.dao.ModuleDao; -import com.ebts.generator.dto.InterTableDto; -import com.ebts.generator.entity.ApiClass; -import com.ebts.generator.entity.Module; -import com.ebts.generator.utils.*; -import org.apache.commons.io.IOUtils; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ebts.generator.dao.InterTableDao; -import com.ebts.generator.entity.InterTable; -import com.ebts.generator.service.InterTableService; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.transaction.interceptor.TransactionAspectSupport; - -/** - * 接口信息Service业务层处理 - * - * @author binlin - * @date 2021-01-25 - */ -@Service -public class InterTableServiceImpl implements InterTableService { - private Logger logger = LoggerFactory.getLogger(InterTableServiceImpl.class); - - @Autowired - private InterTableDao interTableDao; - @Autowired - private ApiClassDao apiclassDao; - @Autowired - private ModuleDao moduleDao; - @Autowired - private GenTableDao genTableDao; - - /** - * 查询接口信息 - * - * @param id 接口信息ID - * @return 接口信息 - */ - @Override - public ServerResult selectInterTableById(Long id) { - try { - InterTable interTable = interTableDao.selectInterTableById(id); - if (interTable != null) { - return new ServerResult(true, interTable); - } else { - return new ServerResult(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询接口信息列表 - * - * @param interTable 接口信息 - * @return 接口信息 - */ - @Override - public ServerResult> selectInterTableList(InterTable interTable) { - try { - Map modeMap = new HashMap(); - if (interTable.getType() == 1) { - Module module = moduleDao.selectModuleById(interTable.getmId()); - modeMap.put("info", module); - } else if (interTable.getType() == 2) { - ApiClass apiclass = apiclassDao.selectApiclassById(interTable.getcId()); - modeMap.put("info", apiclass); - } - List interTableList = interTableDao.selectInterTableList(interTable); - modeMap.put("rows", interTableList); - return new ServerResult>(true, modeMap); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 新增接口信息 - * - * @param interTable 接口信息 - * @return 结果 - */ - @Override - public ServerResult insertInterTable(InterTable interTable) { - try { - interTable.setCreateBy(SecurityUtils.getUserId()); - Integer renewal = interTableDao.insertInterTable(interTable); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 修改接口信息 - * - * @param interTableDto 接口信息 - * @return 结果 - */ - @Override - @Transactional - public ServerResult updateInterTable(InterTableDto interTableDto) { - try { - List interTables = interTableDto.getInterTables(); - Integer renewal = 0; - if (interTableDto.getModule() == null) { - ApiClass apiclass = interTableDto.getApiclass(); - renewal = apiclassDao.updateApiclass(apiclass); - interTableDao.deleteInterTableByClassId(apiclass.getId()); - } else if (interTableDto.getApiclass() == null) { - Module module = interTableDto.getModule(); - renewal = moduleDao.updateModule(module); - interTableDao.deleteInterTableByModuleId(module.getId()); - } - Integer renewalTables = 0; - if (interTables.size() > 0) { - for (int i = 0; i < interTables.size(); i++) { - interTables.get(i).setCreateBy(SecurityUtils.getUserId()); - } - renewalTables = interTableDao.insertInterTables(interTables); - } - if (renewalTables > 0 || renewal > 0) { - return new ServerResult(true, renewalTables); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 批量删除接口信息 - * - * @param ids 需要删除的接口信息ID - * @return 结果 - */ - @Override - public ServerResult deleteInterTableByIds(Long[] ids) { - try { - Integer renewal = interTableDao.deleteInterTableByIds(ids); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 删除接口信息信息 - * - * @param id 接口信息ID - * @return 结果 - */ - @Override - public ServerResult deleteInterTableById(Long id) { - try { - Integer renewal = interTableDao.deleteInterTableById(id); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - @Override - public ServerResult> previewCodeCalss(Long cid) { - try { - Map dataMap = new LinkedHashMap(); - ApiClass apiclass = interTableDao.selectInterTableClass(cid); - if (apiclass == null) { - return new ServerResult>(false, ReturnConstants.INTER_NULL); - } - VelocityInitializer.initVelocity(); - VelocityContext context = InterTableUtils.prepareClassContext(apiclass); - Map templates = InterTableUtils.getTemplateList(2); - StringWriter sw = new StringWriter(); - Template template = Velocity.getTemplate(templates.get("java"), Constants.UTF8); - template.merge(context, sw); - dataMap.put(getJavaClassName(apiclass.getcName()), sw.toString()); - - sw = new StringWriter(); - template = Velocity.getTemplate(templates.get("sql"), Constants.UTF8); - template.merge(context, sw); - dataMap.put(getSqlName(apiclass.getcName()), sw.toString()); - return new ServerResult>(true, dataMap); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - @Override - public ServerResult> previewCodeMoudle(Long mid) { - try { - Map dataMap = new LinkedHashMap(); - List interTableList = interTableDao.selectInterTableModule(mid); - if (interTableList.size() == 0) { - return new ServerResult>(false, "该模块下接口为空,请先创建接口!"); - } - VelocityInitializer.initVelocity(); - List contextList = InterTableUtils.prepareMoudleContext(interTableList); - Map templates = InterTableUtils.getTemplateList(2); - StringWriter sqlsw = new StringWriter(); - Template sqltemplate = Velocity.getTemplate(templates.get("sql"), Constants.UTF8); - for (VelocityContext context : contextList) { - StringWriter sw = new StringWriter(); - Template template = Velocity.getTemplate(templates.get("java"), Constants.UTF8); - template.merge(context, sw); - sqltemplate.merge(context, sqlsw); - dataMap.put(getJavaClassName((String) context.get("ClassName")), sw.toString()); - } - dataMap.put(getSqlName("module"), sqlsw.toString()); - return new ServerResult>(true, dataMap); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - @Override - @Transactional - public ServerResult generatorCodeClass(Long cid) { - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - ApiClass apiclass = interTableDao.selectInterTableClass(cid); - VelocityInitializer.initVelocity(); - VelocityContext context = InterTableUtils.prepareClassContext(apiclass); - Map templates = InterTableUtils.getTemplateList(2); - StringWriter sw = new StringWriter(); - Template template = Velocity.getTemplate(templates.get("java"), Constants.UTF8); - template.merge(context, sw); - zip = genCode(getJavaClassName(apiclass.getcName()), zip, sw); - if (zip == null) { - return new ServerResult(false, "代码生成失败!"); - } - sw = new StringWriter(); - template = Velocity.getTemplate(templates.get("sql"), Constants.UTF8); - template.merge(context, sw); - - zip = genCode(getSqlName(apiclass.getcName()), zip, sw); - if (zip == null) { - return new ServerResult(false, "代码生成失败!"); - } - int start = genTableDao.insertMenu(sw.toString()); - if (!(start > 0)) { - return new ServerResult(false, ReturnConstants.DB_EX); - } - IOUtils.closeQuietly(zip); - return new ServerResult(true, outputStream.toByteArray()); - - } catch (RuntimeException e) { - logger.error(e.getMessage()); - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - throw new EbtsException("代码生成失败!",e); - } - } - - @Override - @Transactional - public ServerResult generatorCodeMoudle(Long mid) { - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - List interTableList = interTableDao.selectInterTableModule(mid); - if (interTableList.size() == 0) { - return new ServerResult(false, "该模块下接口为空,请先创建接口!"); - } - VelocityInitializer.initVelocity(); - List contextList = InterTableUtils.prepareMoudleContext(interTableList); - Map templates = InterTableUtils.getTemplateList(2); - StringWriter sqlsw = new StringWriter(); - Template sqltemplate = Velocity.getTemplate(templates.get("sql"), Constants.UTF8); - for (VelocityContext context : contextList) { - StringWriter sw = new StringWriter(); - Template template = Velocity.getTemplate(templates.get("java"), Constants.UTF8); - template.merge(context, sw); - sqltemplate.merge(context, sqlsw); - zip = genCode(getJavaClassName((String) context.get("ClassName")), zip, sw); - } - zip = genCode(getSqlName("module"), zip, sqlsw); - if (zip != null) { - int start = genTableDao.insertMenu(sqlsw.toString()); - if (!(start > 0)) { - return new ServerResult(false, ReturnConstants.DB_EX); - } - } - IOUtils.closeQuietly(zip); - return new ServerResult(true, outputStream.toByteArray()); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - throw new EbtsException("代码生成失败!",e); - } - } - - - public ZipOutputStream genCode(String className, ZipOutputStream zip, StringWriter sw) { - try { - zip.putNextEntry(new ZipEntry(className)); - IOUtils.write(sw.toString(), zip, Constants.UTF8); - IOUtils.closeQuietly(sw); - zip.flush(); - zip.closeEntry(); - return zip; - } catch (IOException e) { - logger.error(e.getMessage()); - return null; - } - } - - - public String getJavaClassName(String cName) { - return InterTableUtils.getUpperCase(cName) + "Controller.java"; - } - - public String getSqlName(String cName) { - return InterTableUtils.getUpperCase(cName) + ".sql"; - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/ModuleServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/ModuleServiceImpl.java deleted file mode 100644 index 89ff70a..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/ModuleServiceImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.ebts.generator.service.impl; - -import java.util.List; - -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.exception.EbtsException; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dao.ModuleDao; -import com.ebts.generator.entity.Module; -import com.ebts.generator.service.ModuleService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * 模块管理Service业务层处理 - * - * @author binlin - * @date 2021-01-24 - */ -@Service -public class ModuleServiceImpl implements ModuleService { - private Logger logger = LoggerFactory.getLogger(ModuleServiceImpl.class); - - @Autowired - private ModuleDao moduleDao; - - /** - * 查询模块管理 - * - * @param id 模块管理ID - * @return 模块管理 - */ - @Override - public ServerResult selectModuleById(Long id) { - try { - Module module = moduleDao.selectModuleById(id); - if (module != null) { - return new ServerResult(true, module); - } else { - return new ServerResult(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询模块管理列表 - * - * @param module 模块管理 - * @return 模块管理 - */ - @Override - public ServerResult> selectModuleList(Module module) { - try { - List moduleList = moduleDao.selectModuleList(module); - if (moduleList.size() > 0) { - return new ServerResult>(true, moduleList); - } else { - return new ServerResult>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 新增模块管理 - * - * @param module 模块管理 - * @return 结果 - */ - @Override - public ServerResult insertModule(Module module) { - try { - module.setCreateBy(SecurityUtils.getUserId()); - Integer renewal = moduleDao.insertModule(module); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 修改模块管理 - * - * @param module 模块管理 - * @return 结果 - */ - @Override - public ServerResult updateModule(Module module) { - try { - module.setUpdateBy(SecurityUtils.getUserId()); - Integer renewal = moduleDao.updateModule(module); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 批量删除模块管理 - * - * @param ids 需要删除的模块管理ID - * @return 结果 - */ - @Override - public ServerResult deleteModuleByIds(Long[] ids) { - try { - Integer renewal = moduleDao.deleteModuleByIds(ids); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 删除模块管理信息 - * - * @param id 模块管理ID - * @return 结果 - */ - @Override - public ServerResult deleteModuleById(Long id) { - try { - Integer renewal = moduleDao.deleteModuleById(id); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/QueryServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/QueryServiceImpl.java deleted file mode 100644 index 346a2c9..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/QueryServiceImpl.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.ebts.generator.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.core.entity.entity.Menu; -import com.ebts.common.exception.EbtsException; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dao.QueryDao; -import com.ebts.generator.dao.UniQueryDao; -import com.ebts.generator.entity.UniCon; -import com.ebts.generator.entity.UniQuery; -import com.ebts.generator.service.QueryService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.transaction.interceptor.TransactionAspectSupport; - -import java.util.List; -import java.util.Map; - -/** - * Author 18209 - * Date 2021/1/30 18:54 - * Version 1.0 - */ -@Service -public class QueryServiceImpl implements QueryService { - private final Logger logger = LoggerFactory.getLogger(QueryServiceImpl.class); - - @Autowired - private QueryDao queryDao; - - @Autowired - private UniQueryDao uniQueryDao; - - - /** - * 查询万能查询的基本信息和条件信息 - */ - @Override - public ServerResult selectQueryById(Long id) { - try { - UniQuery uniQuery = queryDao.selectQueryInfo(id); - if (uniQuery != null) { - return new ServerResult<>(true, uniQuery); - } else { - return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public ServerResult Release(UniQuery uniQuery) { - try { - Integer isRelease = queryDao.Release(uniQuery.getId()); - if ((isRelease == 1 && uniQuery.getIsRelease() == 2) || (isRelease == 2 && uniQuery.getIsRelease() == 1)) { - if (uniQuery.getIsRelease() == 1) { - UniQuery query = uniQueryDao.selectUniQueryById(uniQuery.getId()); - Menu Menu = new Menu(query.getId(), query.getUqName(), SecurityUtils.getUserId()); - Integer insermenu = queryDao.insertMenu(Menu); - if (insermenu == 0) { - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - return new ServerResult<>(false, ReturnConstants.OP_ERROR); - } - } else { - Integer deleteMenu = queryDao.deleteMenu("data/" + uniQuery.getId()); - if (deleteMenu == 0) { - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - return new ServerResult<>(false, ReturnConstants.OP_ERROR); - } - } - Integer release = queryDao.changeRelease(uniQuery); - if (release > 0) { - return new ServerResult<>(true); - } else { - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - return new ServerResult<>(false, ReturnConstants.OP_ERROR); - } - } else { - return new ServerResult<>(false, ReturnConstants.STATE_ERROR); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 更新万能查询基本信息和条件 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public ServerResult updateQueryInfo(UniQuery uniQuery) { - try { - int uqrenewal = uniQueryDao.updateUniQuery(uniQuery); - if (uqrenewal > 0) { - if (uniQuery.getUniCons() != null && uniQuery.getUniCons().size() > 0) { - queryDao.deleteUniCon(uniQuery.getId()); - Integer ucrenewal = queryDao.insertUniCon(uniQuery.getUniCons()); - if (ucrenewal == 0) { - return new ServerResult<>(false, ReturnConstants.OP_ERROR); - } - } - return new ServerResult<>(true); - } - return new ServerResult<>(false, ReturnConstants.OP_ERROR); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - @Override - public ServerResult>> previewQuery(UniQuery uniQuery) { - try { - StringBuilder sql = new StringBuilder(uniQuery.getUqSql().toLowerCase()); - List uniConList = uniQuery.getUniCons(); - if (sql.toString().contains("insert") || sql.toString().contains("delete ") || sql.toString().contains("update ") || - sql.toString().contains("drop ") || sql.toString().contains("database ") || sql.toString().contains("create ") || - sql.toString().contains("view ") || sql.toString().contains("alter ") || sql.toString().contains("gen_")) { - return new ServerResult<>(false, "sql语句含有insert,delete,update,drop,database,view,alter,gen_等特殊字符!"); - } - if (uniConList.size() > 0) { - sql.append(" where 1 = 1"); - for (UniCon uniCon : uniConList) { - if (!uniCon.getUcMock().equals("") && uniCon.getUcMock() != null) { - sql.append(conversionPreview(uniCon)); - } - } - } - List> dataMap = queryDao.UniQuery(sql.toString()); - return new ServerResult<>(true, dataMap); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - return new ServerResult<>(false, e.getMessage()); - } - } - - /** - * 预览模式下拼接sql - * - * @param uniCon - * @return - */ - public String conversionPreview(UniCon uniCon) { - String sql = " and "; - switch (uniCon.getUcCon()) { - case "EQ": - sql += uniCon.getUcKey() + " = '" + uniCon.getUcMock() + "'"; - break; - case "NE": - sql += uniCon.getUcKey() + " != '" + uniCon.getUcMock() + "'"; - break; - case "GT": - sql += uniCon.getUcKey() + " > '" + uniCon.getUcMock() + "'"; - break; - case "GTE": - sql += uniCon.getUcKey() + " >= '" + uniCon.getUcMock() + "'"; - break; - case "LT": - sql += uniCon.getUcKey() + " < '" + uniCon.getUcMock() + "'"; - break; - case "LTE": - sql += uniCon.getUcKey() + " <= '" + uniCon.getUcMock() + "'"; - break; - case "LIKE": - sql += uniCon.getUcKey() + " like '%" + uniCon.getUcMock() + "%'"; - break; - case "BETWEEN": - try { - JSONObject jsonObject = JSONObject.parseObject(uniCon.getUcMock()); - if (uniCon.getUcType().equals("input")) { - Object begin = jsonObject.get("begin"); - Object end = jsonObject.get("end"); - if (begin != null && end != null) { - sql += uniCon.getUcKey() + " between '" + begin + "' AND '" + end + "'"; - } else { - sql = ""; - } - } else if (uniCon.getUcType().equals("datetime")) { - Object startTime = jsonObject.get("startTime"); - Object endTime = jsonObject.get("endTime"); - sql += uniCon.getUcKey() + " between '" + startTime + "' AND '" + endTime + "'"; - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - sql = ""; - } - break; - } - return sql; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/RegularServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/RegularServiceImpl.java deleted file mode 100644 index ba21db1..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/RegularServiceImpl.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.ebts.generator.service.impl; - -import java.util.List; - -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.exception.EbtsException; -import com.ebts.common.utils.DateUtils; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dao.RegularDao; -import com.ebts.generator.entity.Regular; -import com.ebts.generator.service.RegularService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * 校验规则Service业务层处理 - * - * @author binlin - * @date 2021-01-18 - */ -@Service -public class RegularServiceImpl implements RegularService { - private Logger logger = LoggerFactory.getLogger(RegularServiceImpl.class); - - @Autowired - private RegularDao regularDao; - - /** - * 查询校验规则 - * - * @param id 校验规则ID - * @return 校验规则 - */ - @Override - public ServerResult selectRegularById(Long id) { - try { - Regular regular = regularDao.selectRegularById(id); - if (regular != null) { - return new ServerResult<>(true, regular); - } else { - return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询校验规则列表 - * - * @param regular 校验规则 - * @return 校验规则 - */ - @Override - public ServerResult> selectRegularList(Regular regular) { - try { - List regulars = regularDao.selectRegularList(regular); - if (regulars.size() > 0) { - return new ServerResult<>(true, regulars); - } else { - return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - /** - * 查询校验规则下拉框列表 - * - * @return 校验规则 - */ - @Override - public ServerResult> selectRegularOption() { - try { - List regulars = regularDao.selectRegularOption(); - if (regulars.size() > 0) { - return new ServerResult<>(true, regulars); - } else { - return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 新增校验规则 - * - * @param regular 校验规则 - * @return 结果 - */ - @Override - public ServerResult insertRegular(Regular regular) { - try { - regular.setCreateTime(DateUtils.getNowDate()); - regular.setCreateBy(SecurityUtils.getUserId()); - int renewal = regularDao.insertRegular(regular); - return new ServerResult<>(true, renewal); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 修改校验规则 - * - * @param regular 校验规则 - * @return 结果 - */ - @Override - public ServerResult updateRegular(Regular regular) { - try { - regular.setUpdateTime(DateUtils.getNowDate()); - regular.setUpdateBy(SecurityUtils.getUserId()); - int renewal = regularDao.updateRegular(regular); - return new ServerResult<>(true, renewal); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 批量删除校验规则 - * - * @param ids 需要删除的校验规则ID - * @return 结果 - */ - @Override - public ServerResult deleteRegularByIds(Long[] ids) { - try { - Integer renewals = regularDao.deleteRegularByIds(ids); - return new ServerResult<>(true, renewals); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 删除校验规则信息 - * - * @param id 校验规则ID - * @return 结果 - */ - @Override - public ServerResult deleteRegularById(Long id) { - try { - Integer renewal = regularDao.deleteRegularById(id); - return new ServerResult<>(true, renewal); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/RelServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/RelServiceImpl.java deleted file mode 100644 index c269c3b..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/RelServiceImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.ebts.generator.service.impl; - -import com.ebts.common.exception.EbtsException; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dao.RelDao; -import com.ebts.generator.entity.RelColumn; -import com.ebts.generator.entity.RelTable; -import com.ebts.generator.service.RelService; -import com.ebts.generator.utils.RelUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; - -/** - * @Author 18209 - * @Date 2021/2/24 16:21 - * @Version 1.0 - */ -@Service -public class RelServiceImpl implements RelService { - private Logger logger = LoggerFactory.getLogger(RelServiceImpl.class); - - @Autowired - private RelDao relDao; - - /** - * 获取到数据库表信息 - * - * @return - */ - @Override - public ServerResult>> tableInfos() { - try { - List> dataMap = relDao.tableInfos(); - return new ServerResult<>(dataMap); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException("获取数据库表信息错误",e); - } - } - - /** - * 获取到关联边字段信息 - * - * @param tableName 关联表表名 - * @param relId 关联关系id - * @return - */ - @Override - public ServerResult> relColumns(String tableName, Long relId) { - try { - List relColumns = relDao.selectTableColumn(tableName); - for (RelColumn relColumn : relColumns) { - RelUtil.initRelColumn(relColumn, relId); - } - return new ServerResult<>(relColumns); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException("获取关联边字段信息错误",e); - } - } - - @Override - public ServerResult>> tableColumns(String tableName) { - try { - List> columns = relDao.tableColumns(tableName); - return new ServerResult<>(columns); - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException("获取字段信息错误",e); - } - } - - @Override - public ServerResult> relTableByTableId(Long tableId) { - try { - List relTables = relDao.relTableByTableId(tableId); - return new ServerResult<>(relTables); - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException("获取关联数据错误",e); - } - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/TopQueryServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/TopQueryServiceImpl.java deleted file mode 100644 index 5cce30b..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/TopQueryServiceImpl.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.ebts.generator.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dao.QueryDao; -import com.ebts.generator.dao.RelationalMapDao; -import com.ebts.generator.dao.TopSearchTableDao; -import com.ebts.generator.dao.UniQueryDao; -import com.ebts.generator.dto.TopResult; -import com.ebts.generator.entity.*; -import com.ebts.generator.service.TopQueryService; -import com.github.pagehelper.PageHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; - -/** - * @author: Clay - * @date: 2021/7/23 21:51 - * @description:TopQueryServiceImpl - * @email: clay@hchyun.com - */ -@Service -public class TopQueryServiceImpl implements TopQueryService { - private final Logger logger = LoggerFactory.getLogger(TopQueryServiceImpl.class); - - @Autowired - private TopSearchTableDao topSearchTableDao; - @Autowired - private RelationalMapDao relationalMapDao; - @Autowired - private QueryDao queryDao; - @Autowired - private UniQueryDao uniQueryDao; - - @Override - public Map selectTopSearchTables() { - Map modeMap = new HashMap<>(); - //采用原子式获取到forEach中的值,原子式能够允许其他线程进行尝试性的修改值 - AtomicReference roleIds = new AtomicReference<>(""); - SecurityUtils.getLoginUser().getUser().getRoles().forEach(role->{ - roleIds.updateAndGet(v -> v + role.getRoleId()+","); - }); - modeMap.put("tables", topSearchTableDao.selectTopSearchTables(roleIds.get().substring(0,roleIds.get().length()-1).split(","))); - modeMap.put("relationalMap", relationalMapDao.selectRelationalMapList(new RelationalMap())); - return modeMap; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public ServerResult preview(String jsonData, String id) { - try { - - JSONObject graphData = JSON.parseObject(jsonData); - //将数据格式化为自定义的java类列表 - List topEdges = JSON.parseArray(graphData.getString("edges"), TopEdge.class); - List topNodes = JSON.parseArray(graphData.getString("nodes"), TopNode.class); - if (topNodes.size() == 0) { - return new ServerResult<>(false, "top图结构有误,请整理后在试"); - } - //整理连线的关系 - StringBuffer sql = new StringBuffer(""); - StringBuilder selectSql = new StringBuilder("select "); - StringBuilder selectQuery = new StringBuilder(" where 1=1 "); - TopNode mainNode = null; - if (topNodes.size() > 1) { - for (int i = 0; i < topEdges.size(); i++) { - for (int j = 0; j < topEdges.size(); j++) { - if (i != j) { - TopEdge topEdgeJ = topEdges.get(j); - if (topEdges.get(i).getSource().equals(topEdgeJ.getTarget())) { - topEdges.get(i).setSourceEdge(topEdgeJ.getId()); - } - } - } - } - // 解析出top图中与主表的连线,可能为多条 - List targets = new ArrayList<>(); - for (int i = 0; i < topEdges.size(); i++) { - if (topEdges.get(i).getSourceEdge() == null) { - targets.add(topEdges.get(i)); - } - } - - mainNode = getNode(topNodes, targets.get(0).getSource()); - // 组合查询字段信息 - ParseSelectSQL(mainNode, topNodes, selectSql, selectQuery); - - // 组合表与表之间得到关联关系sql - String relSql = ""; - for (int i = 0; i < targets.size(); i++) { - relSql += getRelSql(topNodes, topEdges, targets.get(i)); - } - - - sql.append(selectSql).append(" from ").append(mainNode.getTable()).append(" ") - .append(mainNode.getRelTable()).append(relSql); - - } else { - mainNode = topNodes.get(0); - selectSql.append(mainNode.getTableSQL()); - selectQuery.append(mainNode.getQuerySql()); - sql.append(selectSql).append(" from ").append(mainNode.getTable()).append(" ") - .append(mainNode.getRelTable()); - } - UniQuery uniQuery = new UniQuery(); - uniQuery.setId(Long.valueOf(id)); - uniQuery.setUqSql(sql.toString()); - uniQuery.setIsPreview(1); - List uniCons = uniQuery.getUniCons(); - for (TopNode node : topNodes) { - JSONArray columns = node.getColumns(); - for (int i = 0; i < columns.size(); i++) { - if (columns.getJSONObject(i).getInteger("isQuery") == 1) { - JSONObject column = columns.getJSONObject(i); - UniCon uniCon = new UniCon(uniQuery.getId(), column.getString("ucName"), node.getRelTable() + "." + column.getString("columnName"), column.getString("ucCon"), column.getString("ucType"), column.getInteger("type")); - uniCons.add(uniCon); - } - } - } - - int query = uniQueryDao.updateUniQuery(uniQuery); - if (query > 0) { - if (uniQuery.getUniCons() != null && uniQuery.getUniCons().size() > 0) { - queryDao.deleteUniCon(uniQuery.getId()); - queryDao.insertUniCon(uniCons); - } - } - - - sql.append(selectQuery); - PageHelper.startPage(1, 10, ""); - List> dataMap = queryDao.UniQuery(sql.toString()); - TopResult topResult = new TopResult(dataMap,uniCons); - return new ServerResult<>(true, topResult); - } catch (RuntimeException e) { - e.printStackTrace(); - logger.error(e.getMessage()); - return new ServerResult<>(false, e.getMessage()); - } - } - - @Override - public ServerResult online(Long id) { - return null; - } - - void ParseSelectSQL(TopNode mainNode, List topNodes, StringBuilder selectSql, StringBuilder selectQuery) { - selectSql.append(mainNode.getTableSQL()); - selectQuery.append(mainNode.getQuerySql()); - for (TopNode node : topNodes) { - if (node.getId().equals(mainNode.getId())) { - continue; - } - if (node.getTableSQL().trim().equals("")){ - continue; - } - selectSql.append(", ").append(node.getTableSQL()); - selectQuery.append(node.getQuerySql()); - } - } - - - TopNode getNode(List nodes, String id) { - for (int i = 0; i < nodes.size(); i++) { - if (nodes.get(i).getId().equals(id)) { - return nodes.get(i); - } - } - return null; - } - - List getEdgeListById(List edges, String id) { - List targetEdge = new ArrayList<>(); - for (TopEdge edge : edges) { - if (edge.getSource().equals(id)) { - targetEdge.add(edge); - } - } - return targetEdge; - } - - String getRelSql(List nodes, List edges, TopEdge edge) { - int i = 0; - // 定义sql 变量 - StringBuffer sql = new StringBuffer(""); - List targetEdge; - while (true) { - // 获取到连线的两个表 - TopNode source = getNode(nodes, edge.getSource()); - TopNode target = getNode(nodes, edge.getTarget()); - //进行sql拼接 - sql.append(" ").append(edge.getAppConfig().getString("associated")).append(" join ") - .append(target.getTable()).append(" ").append(target.getRelTable()).append(" on ") - .append(target.getRelTable()).append(".").append(edge.getAppConfig() - .getString("relComment")).append(" = ").append(source.getRelTable()) - .append(".").append(edge.getAppConfig().getString("tableComment")); - // 获取到target 连接表的连线 - targetEdge = getEdgeListById(edges, edge.getTarget()); - // 判断连线条数 - if (targetEdge.size() == 1) { - edge = targetEdge.get(0); - } else if (targetEdge.size() > 1) { - //多条则进行递归解析 - while (i < targetEdge.size()) { - sql.append(getRelSql(nodes, edges, targetEdge.get(i))); - i++; - } - break; - } else { - //没有则退出循环返回解析好的sql - break; - } - } - return sql.toString(); - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/TopSearchTableServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/TopSearchTableServiceImpl.java deleted file mode 100644 index b47629f..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/TopSearchTableServiceImpl.java +++ /dev/null @@ -1,320 +0,0 @@ -package com.ebts.generator.service.impl; - -import java.util.List; - -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.exception.EbtsException; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import com.ebts.generator.dao.RelationalMapDao; -import com.ebts.generator.dao.SearchTableRoleDao; -import com.ebts.generator.entity.RelationalMap; -import com.ebts.generator.entity.SearchTableRole; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.Map; - -import com.ebts.common.utils.StringUtils; -import org.springframework.transaction.annotation.Transactional; -import com.ebts.generator.entity.TopSearchColumn; -import com.ebts.generator.dao.TopSearchTableDao; -import com.ebts.generator.entity.TopSearchTable; -import com.ebts.generator.service.TopSearchTableService; - -/** - * top万能查询主Service业务层处理 - * - * @author clay - * @date 2021-07-20 - */ -@Service -public class TopSearchTableServiceImpl implements TopSearchTableService { - private Logger logger = LoggerFactory.getLogger(TopSearchTableServiceImpl.class); - - @Autowired - private TopSearchTableDao topSearchTableDao; - @Autowired - private SearchTableRoleDao searchTableRoleDao; - @Autowired - private RelationalMapDao relationalMapDao; - - /** - * 查询top万能查询主 - * - * @param id top万能查询主ID - * @return top万能查询主 - */ - @Override - public ServerResult selectTopSearchTableById(Long id) { - try { - TopSearchTable topSearchTable = topSearchTableDao.selectTopSearchTableById(id); - List roleList = searchTableRoleDao.selectSearchTableRoleList(new SearchTableRole(id, null)); - Long[] roles = new Long[roleList.size()]; - for (int i = 0; i < roleList.size(); i++) { - roles[i] = roleList.get(i).getRoleId(); - } - topSearchTable.setRoleIds(roles); - if (topSearchTable != null) { - return new ServerResult<>(true, topSearchTable); - } else { - return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR, e); - } - } - - /** - * 查询top万能查询主列表 - * - * @param topSearchTable top万能查询主 - * @return top万能查询主 - */ - @Override - public ServerResult> selectTopSearchTableList(TopSearchTable topSearchTable) { - try { - List topSearchTableList = topSearchTableDao.selectTopSearchTableList(topSearchTable); - if (topSearchTableList.size() > 0) { - return new ServerResult<>(true, topSearchTableList); - } else { - return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR, e); - } - } - - @Override - public ServerResult> selectTopSearchTableInfo() { - try { - List tableList = topSearchTableDao.selectTopSearchTableInfo(); - return new ServerResult<>(true, tableList); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR, e); - } - } - - public List selectTableColumns(Long id) { - return topSearchTableDao.selectTableColumns(id); - } - - /** - * 新增top万能查询主 - * - * @param topSearchTable top万能查询主 - * @return 结果 - */ - @Transactional - @Override - public ServerResult insertTopSearchTable(TopSearchTable topSearchTable) { - try { - topSearchTable.setCreateBy(SecurityUtils.getUserId()); - int renewal = topSearchTableDao.insertTopSearchTable(topSearchTable); - if (insertTopSearchColumn(topSearchTable)) { - return new ServerResult<>(false, ReturnConstants.DB_EX); - } - if (renewal > 0) { - return new ServerResult<>(true, renewal); - } else { - return new ServerResult<>(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR, e); - } - } - - /** - * 修改top万能查询主 - * - * @param topSearchTable top万能查询主 - * @return 结果 - */ - @Transactional - @Override - public ServerResult updateTopSearchTable(TopSearchTable topSearchTable) { - try { - topSearchTable.setUpdateBy(SecurityUtils.getUserId()); - topSearchTableDao.deleteTopSearchColumnBySearchTableId(topSearchTable.getId()); - if (insertTopSearchColumn(topSearchTable)) { - return new ServerResult<>(false, ReturnConstants.DB_EX); - } - List searchTableRoles = new ArrayList<>(); - for (Long roleId : topSearchTable.getRoleIds()) { - searchTableRoles.add(new SearchTableRole(topSearchTable.getId(), roleId)); - } - relationalMapDao.deleteRelationalMapById(topSearchTable.getId()); - List relationalMapList = topSearchTable.getRelationalMapList(); - for (RelationalMap relationalMap : relationalMapList) { - relationalMap.setMainId(topSearchTable.getId()); - } - insertRelationalMap(relationalMapList); - - - searchTableRoleDao.deleteSearchTableRoleById(topSearchTable.getId()); - boolean renewalRole = inserTopTableRole(searchTableRoles); - Integer renewal = topSearchTableDao.updateTopSearchTable(topSearchTable); - if (renewal > 0 && renewalRole) { - return new ServerResult<>(true, renewal); - } else { - return new ServerResult<>(false, ReturnConstants.OP_ERROR); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - e.printStackTrace(); - throw new EbtsException(ReturnConstants.OP_ERROR, e); - } - } -// void deleteSearchTableRoleById(Long id){ -// try { -// -// }catch (RuntimeException e){ -// logger.error("无数据"); -// } -// } - - @Override - public List selectDbTableListByNames(String[] tableNames) { - try { - return topSearchTableDao.selectDbTableListByNames(tableNames); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR, e); - } - } - - @Override - public List> selectDbTableList(Map params) { - try { - return topSearchTableDao.selectDbTableList(params); - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR, e); - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void importGenTable(List tableList) { - try { - Long createBy = SecurityUtils.getUserId(); - for (TopSearchTable table : tableList) { - String tableName = table.getTableName(); - table.setCreateBy(createBy); - int row = topSearchTableDao.insertTopSearchTable(table); - if (row > 0) { - List searchColumns = topSearchTableDao.selectDbTableColumnsByName(tableName); - for (TopSearchColumn searchColumn : searchColumns) { - searchColumn.setSearchTableId(table.getId()); - } - if (searchColumns.size() > 0) { - topSearchTableDao.batchTopSearchColumn(searchColumns); - } - } - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException("导入失败:" + e.getMessage(), e); - } - - } - - /** - * 批量删除top万能查询主 - * - * @param ids 需要删除的top万能查询主ID - * @return 结果 - */ - @Transactional - @Override - public ServerResult deleteTopSearchTableByIds(Long[] ids) { - try { - //批量删除子表数据 - topSearchTableDao.deleteTopSearchColumnBySearchTableIds(ids); - searchTableRoleDao.deleteSearchTableRoleByIds(ids); - Integer renewal = topSearchTableDao.deleteTopSearchTableByIds(ids); - if (renewal > 0) { - return new ServerResult<>(true, renewal); - } else { - return new ServerResult<>(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR, e); - } - } - - /** - * 删除top万能查询主信息 - * - * @param id top万能查询主ID - * @return 结果 - */ - @Override - public ServerResult deleteTopSearchTableById(Long id) { - try { - //删除子表数据 - topSearchTableDao.deleteTopSearchColumnBySearchTableId(id); - Integer renewal = topSearchTableDao.deleteTopSearchTableById(id); - if (renewal > 0) { - return new ServerResult<>(true, renewal); - } else { - return new ServerResult<>(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR, e); - } - } - - public boolean inserTopTableRole(List roleList) { - if (StringUtils.isNotNull(roleList)) { - Integer renewal = searchTableRoleDao.batchSearchTableRole(roleList); - if (renewal > 0) { - return true; - } - } - return false; - } - - public boolean insertRelationalMap(List relationalMaps) { - if (StringUtils.isNotNull(relationalMaps) && relationalMaps.size() > 0) { - Integer renewal = relationalMapDao.batchRelationalMap(relationalMaps); - if (renewal > 0) { - return true; - } - } - return false; - } - - /** - * 新增top万能查询字段信息 - * - * @param topSearchTable top万能查询主对象 - */ - public boolean insertTopSearchColumn(TopSearchTable topSearchTable) { - List topSearchColumnList = topSearchTable.getTopSearchColumnList(); - Long id = topSearchTable.getId(); - if (StringUtils.isNotNull(topSearchColumnList)) { - List list = new ArrayList(); - for (TopSearchColumn topSearchColumn : topSearchColumnList) { - topSearchColumn.setSearchTableId(id); - list.add(topSearchColumn); - } - if (list.size() > 0) { - Integer renewal = topSearchTableDao.batchTopSearchColumn(list); - if (renewal > 0) { - return false; - } - } - } - return true; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/UniQueryServiceImpl.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/UniQueryServiceImpl.java deleted file mode 100644 index 4db111e..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/service/impl/UniQueryServiceImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.ebts.generator.service.impl; - -import java.util.List; - -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.exception.EbtsException; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.ServerResult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ebts.generator.dao.UniQueryDao; -import com.ebts.generator.entity.UniQuery; -import com.ebts.generator.service.UniQueryService; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.transaction.interceptor.TransactionAspectSupport; - -/** - * 万能查询Service业务层处理 - * - * @author binlin - * @date 2021-01-30 - */ -@Service -public class UniQueryServiceImpl implements UniQueryService { - private Logger logger = LoggerFactory.getLogger(UniQueryServiceImpl.class); - - @Autowired - private UniQueryDao uniQueryDao; - - /** - * 查询万能查询 - * - * @param id 万能查询ID - * @return 万能查询 - */ - @Override - public ServerResult selectUniQueryById(Long id) { - try { - UniQuery uniQuery = uniQueryDao.selectUniQueryById(id); - if (uniQuery != null) { - return new ServerResult(true, uniQuery); - } else { - return new ServerResult(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询万能查询列表 - * - * @param uniQuery 万能查询 - * @return 万能查询 - */ - @Override - public ServerResult> selectUniQueryList(UniQuery uniQuery) { - try { - List uniQueryList = uniQueryDao.selectUniQueryList(uniQuery); - if (uniQueryList.size() > 0) { - return new ServerResult>(true, uniQueryList); - } else { - return new ServerResult>(false, ReturnConstants.RESULT_EMPTY); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 新增万能查询 - * - * @param uniQuery 万能查询 - * @return 结果 - */ - @Override - public ServerResult insertUniQuery(UniQuery uniQuery) { - try { - uniQuery.setCreateBy(SecurityUtils.getUserId()); - Integer renewal = uniQueryDao.insertUniQuery(uniQuery); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 修改万能查询 - * - * @param uniQuery 万能查询 - * @return 结果 - */ - @Override - public ServerResult updateUniQuery(UniQuery uniQuery) { - try { - uniQuery.setUpdateBy(SecurityUtils.getUserId()); - Integer renewal = uniQueryDao.updateUniQuery(uniQuery); - if (renewal > 0) { - return new ServerResult(true, renewal); - } else { - return new ServerResult(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 批量删除万能查询 - * - * @param ids 需要删除的万能查询ID - * @return 结果 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public ServerResult deleteUniQueryByIds(Long[] ids) { - try { - Integer renewal = uniQueryDao.deleteUniQueryByIds(ids); - for (Long id : ids) { - uniQueryDao.deleteUniQueryByUqId(id); - } - if (renewal > 0) { - return new ServerResult<>(true, renewal); - } else { - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - return new ServerResult<>(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 删除万能查询信息 - * - * @param id 万能查询ID - * @return 结果 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public ServerResult deleteUniQueryById(Long id) { - try { - Integer renewal = uniQueryDao.deleteUniQueryById(id); - uniQueryDao.deleteUniQueryByUqId(id); - if (renewal > 0) { - return new ServerResult<>(true, renewal); - } else { - return new ServerResult<>(false, ReturnConstants.SYS_FAILL); - } - } catch (RuntimeException e) { - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/GenInterApiUtils.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/GenInterApiUtils.java deleted file mode 100644 index 3401e51..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/GenInterApiUtils.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ebts.generator.utils; - -import com.ebts.generator.dto.InterTableDto; -import org.apache.velocity.VelocityContext; - -public class GenInterApiUtils { - - - public static VelocityContext prepareContext(InterTableDto interTableDto) { - return new VelocityContext(); - } - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/GenUtils.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/GenUtils.java deleted file mode 100644 index f2dbaa0..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/GenUtils.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.ebts.generator.utils; - -import java.util.Arrays; - -import com.ebts.common.utils.StringUtils; -import com.ebts.generator.utils.constant.GenConstants; -import org.apache.commons.lang3.RegExUtils; -import com.ebts.generator.config.GenConfig; -import com.ebts.generator.entity.GenTable; -import com.ebts.generator.entity.GenTableColumn; - -/** - * 代码生成器 工具类 - * - * @author binlin - */ -public class GenUtils { - /** - * 初始化表信息 - */ - public static void initTable(GenTable genTable, Long operName) { - genTable.setClassName(convertClassName(genTable.getTableName())); - genTable.setPackageName(GenConfig.getPackageName()); - genTable.setModuleName(getModuleName(GenConfig.getPackageName())); - genTable.setBusinessName(getBusinessName(genTable.getTableName())); - genTable.setFunctionName(replaceText(genTable.getTableComment())); - genTable.setFunctionAuthor(GenConfig.getAuthor()); - genTable.setCreateBy(operName); - } - - /** - * 初始化列属性字段 - */ - public static void initColumnField(GenTableColumn column, GenTable table) { - String dataType = getDbType(column.getColumnType()); - String columnName = column.getColumnName(); - column.setTableId(table.getTableId()); - column.setCreateBy(table.getCreateBy()); - // 设置java字段名 - column.setJavaField(StringUtils.toCamelCase(columnName)); - // 设置默认类型 - column.setJavaType(GenConstants.TYPE_STRING); - - if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) { - // 字符串长度超过500设置为文本域 - Integer columnLength = getColumnLength(column.getColumnType()); - String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; - column.setHtmlType(htmlType); - } else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) { - column.setJavaType(GenConstants.TYPE_DATE); - column.setHtmlType(GenConstants.HTML_DATETIME); - } else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) { - column.setHtmlType(GenConstants.HTML_INPUT); - - // 如果是浮点型 统一用BigDecimal - String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); - if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) { - column.setJavaType(GenConstants.TYPE_BIGDECIMAL); - } - // 如果是整形 - else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) { - column.setJavaType(GenConstants.TYPE_INTEGER); - } - // 长整形 - else { - column.setJavaType(GenConstants.TYPE_LONG); - } - } - - // 插入字段(默认所有字段都需要插入) - column.setIsInsert(GenConstants.REQUIRE); - - // 编辑字段 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk()) { - column.setIsEdit(GenConstants.REQUIRE); - } - // 列表字段 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk()) { - column.setIsList(GenConstants.REQUIRE); - } - // 查询字段 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) { - column.setIsQuery(GenConstants.REQUIRE); - } - - // 查询字段类型 - if (StringUtils.endsWithIgnoreCase(columnName, "name")) { - column.setQueryType(GenConstants.QUERY_LIKE); - } - // 状态字段设置单选框 - if (StringUtils.endsWithIgnoreCase(columnName, "status")) { - column.setHtmlType(GenConstants.HTML_RADIO); - } - // 类型&性别字段设置下拉框 - else if (StringUtils.endsWithIgnoreCase(columnName, "type") - || StringUtils.endsWithIgnoreCase(columnName, "sex")) { - column.setHtmlType(GenConstants.HTML_SELECT); - } - // 图片字段设置图片上传控件 - else if (StringUtils.endsWithIgnoreCase(columnName, "image")) { - column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); - } - // 文件字段设置文件上传控件 - else if (StringUtils.endsWithIgnoreCase(columnName, "file")) { - column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); - } - // 内容字段设置富文本控件 - else if (StringUtils.endsWithIgnoreCase(columnName, "content")) { - column.setHtmlType(GenConstants.HTML_EDITOR); - } - } - - /** - * 校验数组是否包含指定值 - * - * @param arr 数组 - * @param targetValue 值 - * @return 是否包含 - */ - public static boolean arraysContains(String[] arr, String targetValue) { - return Arrays.asList(arr).contains(targetValue); - } - - /** - * 获取模块名 - * - * @param packageName 包名 - * @return 模块名 - */ - public static String getModuleName(String packageName) { - int lastIndex = packageName.lastIndexOf("."); - int nameLength = packageName.length(); - String moduleName = StringUtils.substring(packageName, lastIndex + 1, nameLength); - return moduleName; - } - - /** - * 获取业务名 - * - * @param tableName 表名 - * @return 业务名 - */ - public static String getBusinessName(String tableName) { - int lastIndex = tableName.lastIndexOf("_"); - int nameLength = tableName.length(); - String businessName = StringUtils.substring(tableName, lastIndex + 1, nameLength); - return businessName; - } - - /** - * 表名转换成Java类名 - * - * @param tableName 表名称 - * @return 类名 - */ - public static String convertClassName(String tableName) { - boolean autoRemovePre = GenConfig.getAutoRemovePre(); - String tablePrefix = GenConfig.getTablePrefix(); - if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) { - String[] searchList = StringUtils.split(tablePrefix, ","); - tableName = replaceFirst(tableName, searchList); - } - return StringUtils.convertToCamelCase(tableName); - } - - /** - * 批量替换前缀 - * - * @param replacementm 替换值 - * @param searchList 替换列表 - * @return - */ - public static String replaceFirst(String replacementm, String[] searchList) { - String text = replacementm; - for (String searchString : searchList) { - if (replacementm.startsWith(searchString)) { - text = replacementm.replaceFirst(searchString, ""); - break; - } - } - return text; - } - - /** - * 关键字替换 - * - * @param text 需要被替换的名字 - * @return 替换后的名字 - */ - public static String replaceText(String text) { - return RegExUtils.replaceAll(text, "(?:表|若依)", ""); - } - - /** - * 获取数据库类型字段 - * - * @param columnType 列类型 - * @return 截取后的列类型 - */ - public static String getDbType(String columnType) { - if (StringUtils.indexOf(columnType, "(") > 0) { - return StringUtils.substringBefore(columnType, "("); - } else { - return columnType; - } - } - - /** - * 获取字段长度 - * - * @param columnType 列类型 - * @return 截取后的列类型 - */ - public static Integer getColumnLength(String columnType) { - if (StringUtils.indexOf(columnType, "(") > 0) { - String length = StringUtils.substringBetween(columnType, "(", ")"); - return Integer.valueOf(length); - } else { - return 0; - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/InterTableUtils.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/InterTableUtils.java deleted file mode 100644 index cf7c35c..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/InterTableUtils.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.ebts.generator.utils; - -import com.ebts.common.utils.DateUtils; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.generator.entity.ApiClass; -import com.ebts.generator.entity.InterTable; -import org.apache.velocity.VelocityContext; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author 18209 - */ -public class InterTableUtils { - public static List prepareMoudleContext(List interTableList) { - List apiClassList = new ArrayList(); - for (int i = 0; i < interTableList.size(); i++) { - InterTable interTable = interTableList.get(i); - if (apiClassList.size() == 0) { - ApiClass apiclass = interTable.getApiclass(); - List interTables = new ArrayList(); - interTable.setApiclass(null); - interTables.add(interTable); - apiclass.setInterTables(interTables); - apiClassList.add(apiclass); - } else { - boolean start = true; - for (int j = 0; j < apiClassList.size(); j++) { - ApiClass api = apiClassList.get(j); - if (interTable.getcId() == api.getId()) { - List interTableList1 = api.getInterTables(); - interTable.setApiclass(null); - interTableList1.add(interTable); - api.setInterTables(interTableList1); - apiClassList.set(j, api); - start = false; - break; - } - } - if (start) { - ApiClass apiclass = interTable.getApiclass(); - List interTables = new ArrayList(); - interTable.setApiclass(null); - interTables.add(interTable); - apiclass.setInterTables(interTables); - apiClassList.add(apiclass); - } - } - } - List contextList = new ArrayList(); - for (int i = 0; i < apiClassList.size(); i++) { - ApiClass apiclass = apiClassList.get(i); - VelocityContext velocityContext = new VelocityContext(); - String module = apiclass.getInterTables().get(0).getmName(); - String className = apiclass.getcName(); - boolean permission = false; - for (InterTable interTable : apiclass.getInterTables()) { - if (interTable.getIsPermission().equals("1")) { - permission = true; - } - } - velocityContext.put("createBy", SecurityUtils.getUserId()); - velocityContext.put("Permission", permission); - velocityContext.put("packageName", "com.huhyun." + module); - velocityContext.put("prefix", module + ":" + getLowerCase(className)); - velocityContext.put("ClassName", getUpperCase(className)); - velocityContext.put("columns", apiclass.getInterTables()); - velocityContext.put("reqMapping", "/" + module + "/" + getLowerCase(className)); - velocityContext.put("functionName", apiclass.getcDescribe()); - velocityContext.put("author", apiclass.getAuthor()); - velocityContext.put("emali", apiclass.getEmail()); - velocityContext.put("time", DateUtils.getTime()); - contextList.add(velocityContext); - - } - return contextList; - } - - public static VelocityContext prepareClassContext(ApiClass apiclass) { - VelocityContext velocityContext = new VelocityContext(); - boolean permission = false; - for (InterTable interTable : apiclass.getInterTables()) { - if (interTable.getIsPermission().equals("1")) { - permission = true; - } - } - velocityContext.put("createBy", SecurityUtils.getUserId()); - velocityContext.put("Permission", permission); - velocityContext.put("packageName", apiclass.getPackageName()); - velocityContext.put("ClassName", getUpperCase(apiclass.getcName())); - velocityContext.put("columns", apiclass.getInterTables()); - velocityContext.put("prefix", apiclass.getPrefix()); - velocityContext.put("reqMapping", getClassUrl(apiclass.getcName(), apiclass.getModule().getmName())); - velocityContext.put("functionName", apiclass.getcDescribe()); - velocityContext.put("author", apiclass.getAuthor()); - velocityContext.put("emali", apiclass.getEmail()); - velocityContext.put("time", DateUtils.getTime()); - return velocityContext; - } - - public static String getClassUrl(String cname, String mname) { - return "/" + getLowerCase(mname) + "/" + getLowerCase(cname); - } - - public static Map getTemplateList(Integer type) { - Map templates = new HashMap(); - templates.put("java", "vm/java/class.java.vm"); - templates.put("sql", "vm/sql/class.sql.vm"); - return templates; - } - - public static String getUpperCase(String str) { - return str.substring(0, 1).toUpperCase() + str.substring(1); - } - - public static String getLowerCase(String str) { - return str.toLowerCase(); - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/RelUtil.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/RelUtil.java deleted file mode 100644 index f3a6fd7..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/RelUtil.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ebts.generator.utils; - -import com.ebts.common.utils.StringUtils; -import com.ebts.generator.entity.RelColumn; -import com.ebts.generator.utils.constant.GenConstants; - -/** - * @Author 18209 - * @Date 2021/2/24 22:46 - * @Version 1.0 - */ -public class RelUtil { - - - public static void initRelColumn(RelColumn relColumn, Long relId) { - //获取数据库数据类型 - String dataType = GenUtils.getDbType(relColumn.getColumnType()); - //获取字段名称 - String columnName = relColumn.getColumnName(); - //设置tableid - relColumn.setRelId(relId); - //设置创建者id - relColumn.setCreateBy(1); - //转为设置java字段名称 - relColumn.setJavaField(StringUtils.toCamelCase(columnName)); - //默认类型 - relColumn.setJavaType(GenConstants.TYPE_STRING); - //默认查询条件 精确查询 - relColumn.setQueryType(GenConstants.QUERY_EQ); - - if (GenUtils.arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || GenUtils.arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) { - //字符串长度超500设置htmlType为文本域 - Integer columnLength = GenUtils.getColumnLength(relColumn.getColumnType()); - String htmlType = columnLength >= 500 || GenUtils.arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; - relColumn.setHtmlType(htmlType); - } else if (GenUtils.arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) { - relColumn.setJavaType(GenConstants.TYPE_DATE); - relColumn.setHtmlType(GenConstants.HTML_DATETIME); - } else if (GenUtils.arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) { - relColumn.setHtmlType(GenConstants.HTML_INPUT); - - // 如果是浮点型 统一用BigDecimal - String[] str = StringUtils.split(StringUtils.substringBetween(relColumn.getColumnType(), "(", ")"), ","); - if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) { - relColumn.setJavaType(GenConstants.TYPE_BIGDECIMAL); - } - // 如果是整形 - else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) { - relColumn.setJavaType(GenConstants.TYPE_INTEGER); - } - // 长整形 - else { - relColumn.setJavaType(GenConstants.TYPE_LONG); - } - } - // 列表字段 - relColumn.setIsList(GenConstants.REQUIRE); - // 查询字段 - relColumn.setIsQuery(GenConstants.NO_REQUIRE); - //初始化字典 - relColumn.setDictType(""); - // 查询字段类型 - if (StringUtils.endsWithIgnoreCase(columnName, "name")) { - relColumn.setQueryType(GenConstants.QUERY_LIKE); - } - // 状态字段设置单选框 - if (StringUtils.endsWithIgnoreCase(columnName, "status")) { - relColumn.setHtmlType(GenConstants.HTML_RADIO); - } - // 类型&性别字段设置下拉框 - else if (StringUtils.endsWithIgnoreCase(columnName, "type") - || StringUtils.endsWithIgnoreCase(columnName, "sex")) { - relColumn.setHtmlType(GenConstants.HTML_SELECT); - } - } - -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/VelocityInitializer.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/VelocityInitializer.java deleted file mode 100644 index eb4c58d..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/VelocityInitializer.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ebts.generator.utils; - -import java.util.Properties; - -import com.ebts.common.constant.Constants; -import org.apache.velocity.app.Velocity; - -/** - * VelocityEngine工厂 - * - * @author binlin - */ -public class VelocityInitializer { - /** - * 初始化vm方法 - */ - public static void initVelocity() { - Properties p = new Properties(); - try { - // 加载classpath目录下的vm文件 - p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - // 定义字符集 - p.setProperty(Velocity.ENCODING_DEFAULT, Constants.UTF8); - p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8); - // 初始化Velocity引擎,指定配置Properties - Velocity.init(p); - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/VelocityUtils.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/VelocityUtils.java deleted file mode 100644 index fc12a6f..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/VelocityUtils.java +++ /dev/null @@ -1,374 +0,0 @@ -package com.ebts.generator.utils; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import com.ebts.common.utils.DateUtils; -import com.ebts.common.utils.SecurityUtils; -import com.ebts.common.utils.StringUtils; -import com.ebts.generator.entity.RelTable; -import com.ebts.generator.utils.constant.GenConstants; -import org.apache.velocity.VelocityContext; -import com.alibaba.fastjson.JSONObject; -import com.ebts.generator.entity.GenTable; -import com.ebts.generator.entity.GenTableColumn; - -/** - * 模板处理工具类 - * - * @author binlin - */ -public class VelocityUtils { - /** - * 项目空间路径 - */ - private static final String PROJECT_PATH = "main/java"; - - /** - * mybatis空间路径 - */ - private static final String MYBATIS_PATH = "main/resources/mapper"; - - /** - * 默认上级菜单,系统工具 - */ - private static final String DEFAULT_PARENT_MENU_ID = "3"; - - /** - * 设置模板变量信息 - * - * @return 模板列表 - */ - public static VelocityContext prepareContext(GenTable genTable) { - String moduleName = genTable.getModuleName(); - String businessName = genTable.getBusinessName(); - String packageName = genTable.getPackageName(); - String tplCategory = genTable.getTplCategory(); - String functionName = genTable.getFunctionName(); - - VelocityContext velocityContext = new VelocityContext(); - velocityContext.put("tplCategory", genTable.getTplCategory()); - velocityContext.put("tableName", genTable.getTableName()); - velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】"); - velocityContext.put("ClassName", genTable.getClassName()); - velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); - velocityContext.put("moduleName", genTable.getModuleName()); - velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName())); - velocityContext.put("businessName", genTable.getBusinessName()); - velocityContext.put("basePackage", getPackagePrefix(packageName)); - velocityContext.put("packageName", packageName); - velocityContext.put("author", genTable.getFunctionAuthor()); - velocityContext.put("datetime", DateUtils.getDate()); - velocityContext.put("createBy", SecurityUtils.getUserId()); - velocityContext.put("pkColumn", genTable.getPkColumn()); - velocityContext.put("importList", getImportList(genTable)); - velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); - velocityContext.put("columns", genTable.getColumns()); - velocityContext.put("table", genTable); - setMenuVelocityContext(velocityContext, genTable); - if (GenConstants.TPL_TREE.equals(tplCategory)) { - setTreeVelocityContext(velocityContext, genTable); - } - if (GenConstants.TPL_SUB.equals(tplCategory)) { - setSubVelocityContext(velocityContext, genTable); - } - if (GenConstants.TPL_REL.equals(tplCategory)) { - setRelVelocityContext(velocityContext, genTable); - } - return velocityContext; - } - - public static void setRelVelocityContext(VelocityContext context, GenTable genTable) { - context.put("relTables", genTable.getRelTables()); - context.put("tableMapping", StringUtils.sqlFormat(genTable.getTableName())); - } - - public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) { - String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); - String parentMenuId = getParentMenuId(paramsObj); - context.put("parentMenuId", parentMenuId); - } - - public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) { - String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); - String treeCode = getTreecode(paramsObj); - String treeParentCode = getTreeParentCode(paramsObj); - String treeName = getTreeName(paramsObj); - - context.put("treeCode", treeCode); - context.put("treeParentCode", treeParentCode); - context.put("treeName", treeName); - context.put("expandColumn", getExpandColumn(genTable)); - if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) { - context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE)); - } - if (paramsObj.containsKey(GenConstants.TREE_NAME)) { - context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME)); - } - } - - public static void setSubVelocityContext(VelocityContext context, GenTable genTable) { - GenTable subTable = genTable.getSubTable(); - String subTableName = genTable.getSubTableName(); - String subTableFkName = genTable.getSubTableFkName(); - String subClassName = genTable.getSubTable().getClassName(); - String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName); - - context.put("tableMapping", StringUtils.sqlFormat(genTable.getTableName())); - context.put("subMapping", StringUtils.sqlFormat(subTable.getTableName())); - context.put("subTable", subTable); - context.put("subTableName", subTableName); - context.put("subTableFkName", subTableFkName); - context.put("subTableFkClassName", subTableFkClassName); - context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName)); - context.put("subClassName", subClassName); - context.put("subclassName", StringUtils.uncapitalize(subClassName)); - context.put("subImportList", getImportList(genTable.getSubTable())); - } - - /** - * 获取模板信息 - * - * @return 模板列表 - */ - public static List getTemplateList(String tplCategory) { - List templates = new ArrayList(); - templates.add("vm/java/entity.java.vm"); - templates.add("vm/java/dao.java.vm"); - templates.add("vm/java/service.java.vm"); - templates.add("vm/java/serviceImpl.java.vm"); - templates.add("vm/java/controller.java.vm"); - templates.add("vm/xml/mapper.xml.vm"); - templates.add("vm/sql/table.sql.vm"); - templates.add("vm/js/api.js.vm"); - if (GenConstants.TPL_CRUD.equals(tplCategory)) { - templates.add("vm/vue/index.vue.vm"); - } else if (GenConstants.TPL_TREE.equals(tplCategory)) { - templates.add("vm/vue/index-tree.vue.vm"); - } else if (GenConstants.TPL_SUB.equals(tplCategory)) { - templates.add("vm/vue/index.vue.vm"); - templates.add("vm/java/sub-entity.java.vm"); - } else if (GenConstants.TPL_REL.equals(tplCategory)) { - templates.add("vm/vue/index.vue.vm"); - templates.add("vm/java/rel-entity.java.vm"); - } - return templates; - } - public static String getRelFileName(String template, GenTable genTable, RelTable relTable){ - - // 文件名称 - String fileName = ""; - // 包路径 - String packageName = genTable.getPackageName(); - // 模块名 - String moduleName = genTable.getModuleName(); - - String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); - fileName = StringUtils.format("{}/entity/{}.java", javaPath, relTable.getRelClass()); - return fileName; - } - - public static String getPreviewName(String template, String ClassName) { - String fileName = ""; - if (template.contains("entity.java.vm")) { - fileName = StringUtils.format("{}.java", ClassName); - } - if (template.contains("sub-entity.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, ClassName)) { - fileName = StringUtils.format("{}.java", ClassName); - } else if (template.contains("rel-entity.java.vm")) { - fileName = StringUtils.format("{}.java", ClassName); - } else if (template.contains("dao.java.vm")) { - fileName = StringUtils.format("{}Dao.java", ClassName); - } else if (template.contains("service.java.vm")) { - fileName = StringUtils.format("{}Service.java", ClassName); - } else if (template.contains("serviceImpl.java.vm")) { - fileName = StringUtils.format("{}ServiceImpl.java", ClassName); - } else if (template.contains("controller.java.vm")) { - fileName = StringUtils.format("{}Controller.java",ClassName); - } else if (template.contains("mapper.xml.vm")) { - fileName = StringUtils.format("{}Mapper.xml",ClassName); - } else if (template.contains("table.sql.vm")) { - fileName = ClassName + "menu.sql"; - } else if (template.contains("api.js.vm")) { - fileName = StringUtils.format("{}.js", StringUtils.toLoad(ClassName)); - } else if (template.contains("index.vue.vm")) { - fileName = "index.vue"; - } else if (template.contains("index-tree.vue.vm")) { - fileName = "index.vue"; - } - return fileName; - } - - /** - * 获取文件名 - */ - public static String getFileName(String template, GenTable genTable) { - // 文件名称 - String fileName = ""; - // 包路径 - String packageName = genTable.getPackageName(); - // 模块名 - String moduleName = genTable.getModuleName(); - // 大写类名 - String className = genTable.getClassName(); - // 业务名称 - String businessName = genTable.getBusinessName(); - - String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); - String mybatisPath = MYBATIS_PATH + "/" + moduleName; - String vuePath = "vue"; - - if (template.contains("entity.java.vm")) { - fileName = StringUtils.format("{}/entity/{}.java", javaPath, className); - } - if (template.contains("sub-entity.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) { - fileName = StringUtils.format("{}/entity/{}.java", javaPath, genTable.getSubTable().getClassName()); - } else if (template.contains("ass-entity.java.vm")) { - fileName = StringUtils.format("{}/entity/{}.java", javaPath, GenUtils.convertClassName(genTable.getAssTableName())); - } else if (template.contains("dao.java.vm")) { - fileName = StringUtils.format("{}/dao/{}Dao.java", javaPath, className); - } else if (template.contains("service.java.vm")) { - fileName = StringUtils.format("{}/service/{}Service.java", javaPath, className); - } else if (template.contains("serviceImpl.java.vm")) { - fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className); - } else if (template.contains("controller.java.vm")) { - fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className); - } else if (template.contains("mapper.xml.vm")) { - fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className); - } else if (template.contains("table.sql.vm")) { - fileName = businessName + "menu.sql"; - } else if (template.contains("api.js.vm")) { - fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName); - } else if (template.contains("index.vue.vm")) { - fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); - } else if (template.contains("index-tree.vue.vm")) { - fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); - } - return fileName; - } - - /** - * 获取包前缀 - * - * @param packageName 包名称 - * @return 包前缀名称 - */ - public static String getPackagePrefix(String packageName) { - int lastIndex = packageName.lastIndexOf("."); - String basePackage = StringUtils.substring(packageName, 0, lastIndex); - return basePackage; - } - - /** - * 根据列类型获取导入包 - * - * @param genTable 业务表对象 - * @return 返回需要导入的包列表 - */ - public static HashSet getImportList(GenTable genTable) { - List columns = genTable.getColumns(); - GenTable subGenTable = genTable.getSubTable(); - HashSet importList = new HashSet(); - if (StringUtils.isNotNull(subGenTable)) { - importList.add("java.util.List"); - } - for (GenTableColumn column : columns) { - if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) { - importList.add("java.util.Date"); - importList.add("com.fasterxml.jackson.annotation.JsonFormat"); - } else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) { - importList.add("java.math.BigDecimal"); - } - } - return importList; - } - - /** - * 获取权限前缀 - * - * @param moduleName 模块名称 - * @param businessName 业务名称 - * @return 返回权限前缀 - */ - public static String getPermissionPrefix(String moduleName, String businessName) { - return StringUtils.format("{}:{}", moduleName, businessName); - } - - /** - * 获取上级菜单ID字段 - * - * @param paramsObj 生成其他选项 - * @return 上级菜单ID字段 - */ - public static String getParentMenuId(JSONObject paramsObj) { - if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID)) { - return paramsObj.getString(GenConstants.PARENT_MENU_ID); - } - return DEFAULT_PARENT_MENU_ID; - } - - /** - * 获取树编码 - * - * @param paramsObj 生成其他选项 - * @return 树编码 - */ - public static String getTreecode(JSONObject paramsObj) { - if (paramsObj.containsKey(GenConstants.TREE_CODE)) { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE)); - } - return StringUtils.EMPTY; - } - - /** - * 获取树父编码 - * - * @param paramsObj 生成其他选项 - * @return 树父编码 - */ - public static String getTreeParentCode(JSONObject paramsObj) { - if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE)); - } - return StringUtils.EMPTY; - } - - /** - * 获取树名称 - * - * @param paramsObj 生成其他选项 - * @return 树名称 - */ - public static String getTreeName(JSONObject paramsObj) { - if (paramsObj.containsKey(GenConstants.TREE_NAME)) { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME)); - } - return StringUtils.EMPTY; - } - - /** - * 获取需要在哪一列上面显示展开按钮 - * - * @param genTable 业务表对象 - * @return 展开按钮列序号 - */ - public static int getExpandColumn(GenTable genTable) { - String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); - String treeName = paramsObj.getString(GenConstants.TREE_NAME); - int num = 0; - for (GenTableColumn column : genTable.getColumns()) { - if (column.isList()) { - num++; - String columnName = column.getColumnName(); - if (columnName.equals(treeName)) { - break; - } - } - } - return num; - } -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/constant/GenConstants.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/constant/GenConstants.java deleted file mode 100644 index 5529e52..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/constant/GenConstants.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.ebts.generator.utils.constant; - -/** - * 代码生成通用常量 - * - * @author binlin - */ -public class GenConstants { - /** - * 单表(增删改查) - */ - public static final String TPL_CRUD = "crud"; - - /** - * 树表(增删改查) - */ - public static final String TPL_TREE = "tree"; - - /** - * 主子表(增删改查) - */ - public static final String TPL_SUB = "sub"; - - /** - * 关联查询(增删改查) - */ - public static final String TPL_ASS = "ass"; - /** - * 多表关联查询(增删改查) - */ - public static final String TPL_REL = "rel"; - - /** - * 树编码字段 - */ - public static final String TREE_CODE = "treeCode"; - - /** - * 树父编码字段 - */ - public static final String TREE_PARENT_CODE = "treeParentCode"; - - /** - * 树名称字段 - */ - public static final String TREE_NAME = "treeName"; - - /** - * 上级菜单ID字段 - */ - public static final String PARENT_MENU_ID = "parentMenuId"; - - /** - * 上级菜单名称字段 - */ - public static final String PARENT_MENU_NAME = "parentMenuName"; - - /** - * 数据库字符串类型 - */ - public static final String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2", "tinytext", "text", - "mediumtext", "longtext"}; - - /** - * 数据库文本类型 - */ - public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"}; - - /** - * 数据库时间类型 - */ - public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"}; - - /** - * 数据库数字类型 - */ - public static final String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "number", "integer", - "bit", "bigint", "float", "float", "double", "decimal"}; - - /** - * 页面不需要编辑字段 - */ - public static final String[] COLUMNNAME_NOT_EDIT = {"id", "create_by", "create_time", "del_flag"}; - - /** - * 页面不需要显示的列表字段 - */ - public static final String[] COLUMNNAME_NOT_LIST = {"id", "create_by", "create_time", "del_flag", "update_by", - "update_time"}; - - /** - * 页面不需要查询字段 - */ - public static final String[] COLUMNNAME_NOT_QUERY = {"id", "create_by", "create_time", "del_flag", "update_by", - "update_time", "remark"}; - - /** - * Entity基类字段 - */ - public static final String[] BASE_ENTITY = {"createBy", "createTime", "updateBy", "updateTime", "remark"}; - - /** - * Tree基类字段 - */ - public static final String[] TREE_ENTITY = {"parentName", "parentId", "orderNum", "ancestors", "children"}; - - /** - * 文本框 - */ - public static final String HTML_INPUT = "input"; - - /** - * 文本域 - */ - public static final String HTML_TEXTAREA = "textarea"; - - /** - * 下拉框 - */ - public static final String HTML_SELECT = "select"; - - /** - * 单选框 - */ - public static final String HTML_RADIO = "radio"; - - /** - * 复选框 - */ - public static final String HTML_CHECKBOX = "checkbox"; - - /** - * 日期控件 - */ - public static final String HTML_DATETIME = "datetime"; - - /** - * 图片上传控件 - */ - public static final String HTML_IMAGE_UPLOAD = "imageUpload"; - - /** - * 文件上传控件 - */ - public static final String HTML_FILE_UPLOAD = "fileUpload"; - - /** - * 富文本控件 - */ - public static final String HTML_EDITOR = "editor"; - - /** - * 字符串类型 - */ - public static final String TYPE_STRING = "String"; - - /** - * 整型 - */ - public static final String TYPE_INTEGER = "Integer"; - - /** - * 长整型 - */ - public static final String TYPE_LONG = "Long"; - - /** - * 浮点型 - */ - public static final String TYPE_DOUBLE = "Double"; - - /** - * 高精度计算类型 - */ - public static final String TYPE_BIGDECIMAL = "BigDecimal"; - - /** - * 时间类型 - */ - public static final String TYPE_DATE = "Date"; - - /** - * 模糊查询 - */ - public static final String QUERY_LIKE = "LIKE"; - /** - * 精确查询 - */ - public static final String QUERY_EQ = "EQ"; - - /** - * 需要 - */ - public static final String REQUIRE = "1"; - /** - * 不需要 - */ - public static final String NO_REQUIRE = "0"; -} diff --git a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/sql/GenSqlUtil.java b/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/sql/GenSqlUtil.java deleted file mode 100644 index 84de2da..0000000 --- a/ebts/ebts-generator/src/main/java/com/ebts/generator/utils/sql/GenSqlUtil.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ebts.generator.utils.sql; - -import com.ebts.common.exception.BaseException; -import com.ebts.common.utils.StringUtils; - -/** - * sql操作工具类 - * - * @author binlin - */ -public class GenSqlUtil { - /** - * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) - */ - public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; - - /** - * 检查字符,防止注入绕过 - */ - public static String escapeOrderBySql(String value) { - if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) { - throw new BaseException("参数不符合规范,不能进行查询"); - } - return value; - } - - /** - * 验证 order by 语法是否符合规范 - */ - public static boolean isValidOrderBySql(String value) { - return value.matches(SQL_PATTERN); - } -} diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/ApiclassMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/ApiclassMapper.xml deleted file mode 100644 index fdfbf2f..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/ApiclassMapper.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, m_id, c_name, c_describe, package_name, author, email, remark,prefix, create_time, create_by, update_time, update_by from gen_api_class - - - - - - - - insert into gen_api_class - - m_id, - c_name, - c_describe, - package_name, - author, - email, - remark, - prefix, - create_by, - update_by, - - - #{mId}, - #{cName}, - #{cDescribe}, - #{packageName}, - #{author}, - #{email}, - #{remark}, - #{prefix}, - #{createBy}, - #{updateBy}, - - - - - update gen_api_class - - m_id = #{mId}, - c_name = #{cName}, - c_describe = #{cDescribe}, - package_name = #{packageName}, - author = #{author}, - email = #{email}, - remark = #{remark}, - prefix = #{prefix}, - create_by = #{createBy}, - update_by = #{updateBy}, - - where id = #{id} - - - - delete from gen_api_class where id = #{id} - - - - delete from gen_api_class where id in - - #{id} - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml deleted file mode 100644 index 3382528..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time,is_regular from gen_table_column - - - - - - - - insert into gen_table_column ( - table_id, - column_name, - column_comment, - column_type, - java_type, - java_field, - is_pk, - is_increment, - is_required, - is_insert, - is_edit, - is_list, - is_query, - query_type, - html_type, - dict_type, - sort, - create_by, - create_time - )values( - #{tableId}, - #{columnName}, - #{columnComment}, - #{columnType}, - #{javaType}, - #{javaField}, - #{isPk}, - #{isIncrement}, - #{isRequired}, - #{isInsert}, - #{isEdit}, - #{isList}, - #{isQuery}, - #{queryType}, - #{htmlType}, - #{dictType}, - #{sort}, - #{createBy}, - sysdate() - ) - - - - - - update gen_table_column - - column_comment = #{item.columnComment}, - java_type = #{item.javaType}, - java_field = #{item.javaField}, - is_insert = #{item.isInsert}, - is_edit = #{item.isEdit}, - is_list = #{item.isList}, - is_query = #{item.isQuery}, - is_required = #{item.isRequired}, - is_regular = #{item.isRegular}, - query_type = #{item.queryType}, - html_type = #{item.htmlType}, - dict_type = #{item.dictType}, - sort = #{item.sort}, - update_by = #{item.updateBy}, - update_time = sysdate() - - where column_id = #{item.columnId} - - - - - delete from gen_table_column where table_id in - - #{tableId} - - - - - delete from gen_table_column where column_id in - - #{item.columnId} - - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/GenTableMapper.xml deleted file mode 100644 index 69a637c..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${paramSQL} - - - select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, - package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, - options, create_by, create_time, update_by, update_time, remark from gen_table - - - - - - - - - - - - - - - - - - - insert into gen_table ( - table_name, - table_comment, - class_name, - tpl_category, - package_name, - module_name, - business_name, - function_name, - function_author, - gen_type, - gen_path, - remark, - create_by, - create_time - )values( - #{tableName}, - #{tableComment}, - #{className}, - #{tplCategory}, - #{packageName}, - #{moduleName}, - #{businessName}, - #{functionName}, - #{functionAuthor}, - #{genType}, - #{genPath}, - #{remark}, - #{createBy}, - sysdate() - ) - - - - update gen_table - - table_name = #{tableName}, - table_comment = #{tableComment}, - sub_table_name = #{subTableName}, - sub_table_fk_name = #{subTableFkName}, - ass_table_name = #{assTableName}, - ass_table_column = #{assTableColumn}, - ass_table_fk_column = #{assTableFkColumn}, - ass_query_type = #{assQueryType}, - class_name = #{className}, - function_author = #{functionAuthor}, - gen_type = #{genType}, - gen_path = #{genPath}, - tpl_category = #{tplCategory}, - package_name = #{packageName}, - module_name = #{moduleName}, - business_name = #{businessName}, - function_name = #{functionName}, - options = #{options}, - update_by = #{updateBy}, - remark = #{remark}, - update_time = sysdate() - - where table_id = #{tableId} - - - - delete from gen_table where table_id in - - #{tableId} - - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/InterTableMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/InterTableMapper.xml deleted file mode 100644 index 1bd2c4a..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/InterTableMapper.xml +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, m_id, c_id, it_name, it_describe, is_permission, requrl, method, is_generate, type, create_time, create_by from gen_inter_table - - - - - - - - - - - insert into gen_inter_table (m_id, c_id, it_name, it_describe, is_permission, requrl, method, is_generate, type, create_by) VALUES - - (#{item.mId},#{item.cId},#{item.itName},#{item.itDescribe},#{item.isPermission},#{item.requrl},#{item.method},#{item.isGenerate},#{item.type},#{item.createBy}) - - - - delete from gen_inter_table where c_id = #{cId} and type = 2 - - - delete from gen_inter_table where c_id = #{cId} and type = 1 - - - - insert into gen_inter_table - - m_id, - c_id, - it_name, - it_describe, - is_permission, - requrl, - method, - type, - is_generate, - create_by, - - - #{mId}, - #{cId}, - #{itName}, - #{itDescribe}, - #{isPermission}, - #{requrl}, - #{method}, - #{type}, - #{isGenerate}, - #{createBy}, - - - - - update gen_inter_table - - m_id = #{mId}, - c_id = #{cId}, - it_name = #{itName}, - it_describe = #{itDescribe}, - is_permission = #{isPermission}, - requrl = #{requrl}, - method = #{method}, - type = #{type}, - is_generate = #{isGenerate}, - create_by = #{createBy}, - - where id = #{id} - - - - delete from gen_inter_table where id = #{id} - - - - delete from gen_inter_table where id in - - #{id} - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/ModuleMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/ModuleMapper.xml deleted file mode 100644 index 7e7bf63..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/ModuleMapper.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - select id, m_name, m_describe, remark, create_time, create_by, update_time, update_by from gen_module - - - - - - - - insert into gen_module - - m_name, - m_describe, - remark, - create_by, - update_by, - - - #{mName}, - #{mDescribe}, - #{remark}, - #{createBy}, - #{updateBy}, - - - - - update gen_module - - m_name = #{mName}, - m_describe = #{mDescribe}, - remark = #{remark}, - create_by = #{createBy}, - update_by = #{updateBy}, - - where id = #{id} - - - - delete from gen_module where id = #{id} - - - - delete from gen_module where id in - - #{id} - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/QueryMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/QueryMapper.xml deleted file mode 100644 index 536a74c..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/QueryMapper.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - delete from sys_menu where path = #{path} - - - insert into sys_menu( - menu_id, - parent_id, - menu_name, - order_num, - path, - component, - is_frame, - is_cache, - menu_type, - visible, - status, - perms, - icon, - remark, - create_by, - create_time - )values( - #{menuId}, - #{parentId}, - #{menuName}, - #{orderNum}, - #{path}, - #{component}, - #{isFrame}, - #{isCache}, - #{menuType}, - #{visible}, - #{status}, - #{perms}, - #{icon}, - #{remark}, - #{createBy}, - sysdate() - ) - - - - update gen_uni_query set is_release = #{isRelease} where id = #{id} - - - - - - delete from gen_uni_con where uq_id = #{uqId} - - - insert into gen_uni_con(uq_id,uc_name,uc_key,uc_con,uc_mock,uc_describe,uc_type,type) values - - (#{item.uqId},#{item.ucName},#{item.ucKey},#{item.ucCon},#{item.ucMock},#{item.ucDescribe},#{item.ucType},#{item.type}) - - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/RegularMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/RegularMapper.xml deleted file mode 100644 index 70f773c..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/RegularMapper.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - select id, name, regular, validation, enable, create_by, create_time, update_by, update_time from gen_regular - - - - - - - - - insert into gen_regular - - name, - regular, - validation, - enable, - create_by, - create_time, - update_by, - update_time, - - - #{name}, - #{regular}, - #{validation}, - #{enable}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - - - - - update gen_regular - - name = #{name}, - regular = #{regular}, - validation = #{validation}, - enable = #{enable}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - - where id = #{id} - - - - delete from gen_regular where id = #{id} - - - - delete from gen_regular where id in - - #{id} - - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/RelMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/RelMapper.xml deleted file mode 100644 index 94a9e99..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/RelMapper.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into gen_rel_table(id, table_id, rel_name,rel_as,table_name,table_as, rel_comment, - rel_column, table_column, rel_class, relclass, query_type, sort, create_by) - values - - (#{item.id},#{item.tableId},#{item.relName},#{item.relAs},#{item.tableName}, - #{item.tableAs},#{item.relComment},#{item.relColumn},#{item.tableColumn},#{item.relClass}, - #{item.relclass},#{item.queryType},#{item.sort},#{item.createBy}) - - - - - insert into gen_rel_column(rel_id, column_name, column_comment, column_type, java_type, java_field, is_list, - is_query, query_type, html_type, dict_type, sort, create_by) - values - - (#{item.relId},#{item.columnName},#{item.columnComment},#{item.columnType}, - #{item.javaType},#{item.javaField},#{item.isList},#{item.isQuery}, - #{item.queryType},#{item.htmlType},#{item.dictType},#{item.sort}, - #{item.createBy}) - - - - - - - - delete from gen_rel_column where rel_id = #{relId} - - - - delete from gen_rel_table where table_id = #{tableId} - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/RelationalMapMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/RelationalMapMapper.xml deleted file mode 100644 index 1fff509..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/RelationalMapMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - select main_id, child_id, main_key, child_key, type from gen_relational_mapping - - - - - - - - - insert into gen_relational_mapping - - main_id, - child_id, - main_key, - child_key, - type, - - - #{mainId}, - #{childId}, - #{mainKey}, - #{childKey}, - #{type}, - - - - - update gen_relational_mapping - - child_id = #{childId}, - main_key = #{mainKey}, - child_key = #{childKey}, - type = #{type}, - - where main_id = #{mainId} - - - - delete from gen_relational_mapping where main_id = #{mainId} - - - - delete from gen_relational_mapping where main_id in - - #{mainId} - - - - - insert into gen_relational_mapping(main_id, child_id, main_key, child_key, type) values - - (#{item.mainId},#{item.childId},#{item.mainKey},#{item.childKey},#{item.type}) - - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/SearchTableRoleMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/SearchTableRoleMapper.xml deleted file mode 100644 index 3a4d94d..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/SearchTableRoleMapper.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - delete from gen_search_table_role where search_table_id = #{searchTableId} - - - - delete from gen_search_table_role where search_table_id in - - #{searchTableId} - - - - insert into gen_search_table_role (search_table_id, role_id) values - - (#{item.searchTableId},#{item.roleId}) - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/TopSearchTableMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/TopSearchTableMapper.xml deleted file mode 100644 index f8679bf..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/TopSearchTableMapper.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, table_name, table_comment, remark, create_by, create_time, update_by, update_time from gen_top_search_table - - - - - - - - - - - - - - - - - - - - insert into gen_top_search_table - - table_name, - table_comment, - remark, - create_by, - - - #{tableName}, - #{tableComment}, - #{remark}, - #{createBy}, - - - - - update gen_top_search_table - - table_name = #{tableName}, - table_comment = #{tableComment}, - remark = #{remark}, - create_by = #{createBy}, - - where id = #{id} - - - - delete from gen_top_search_table where id = #{id} - - - - delete from gen_top_search_table where id in - - #{id} - - - - - delete from gen_top_search_column where search_table_id in - - #{searchTableId} - - - - - delete from gen_top_search_column where search_table_id = #{searchTableId} - - - - insert into gen_top_search_column(search_table_id,column_name,column_comment,column_type,is_use,create_by,create_time) values - - (#{item.searchTableId},#{item.columnName},#{item.columnComment},#{item.columnType},#{item.isUse},#{item.createBy},#{item.createTime}) - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/mapper/generator/UniQueryMapper.xml b/ebts/ebts-generator/src/main/resources/mapper/generator/UniQueryMapper.xml deleted file mode 100644 index 4d2e61d..0000000 --- a/ebts/ebts-generator/src/main/resources/mapper/generator/UniQueryMapper.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - select id, uq_name, uq_sql, uq_describe, type, is_release, create_by, create_time, update_by, update_time from gen_uni_query - - - - - - - - insert into gen_uni_query - - uq_name, - uq_sql, - uq_describe, - type, - top_json, - create_by, - update_by, - - - #{uqName}, - #{uqSql}, - #{uqDescribe}, - #{type}, - #{topJson}, - #{createBy}, - #{updateBy}, - - - - - update gen_uni_query - - uq_name = #{uqName}, - uq_sql = #{uqSql}, - is_preview = #{isPreview}, - uq_describe = #{uqDescribe}, - type = #{type}, - top_json = #{topJson}, - create_by = #{createBy}, - update_by = #{updateBy}, - - where id = #{id} - - - - delete from gen_uni_query where id = #{id} - - - - delete from gen_uni_con where uq_id = #{id} - - - - delete from gen_uni_query where id in - - #{id} - - - \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/vm/java/class.java.vm b/ebts/ebts-generator/src/main/resources/vm/java/class.java.vm deleted file mode 100644 index 2d7ede3..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/java/class.java.vm +++ /dev/null @@ -1,66 +0,0 @@ -package ${packageName}.controller; - -/** - * ${ClassName} ${functionName} - * - * Author ${author} - * Email ${emali} - * Date ${time} -*/ -import com.ebts.common.annotation.Log; -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.core.controller.BaseController; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.enums.BusinessType; -import com.ebts.common.exception.EbtsException; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Map; - - - -#if($Permission) -@Api(value = "${functionName}",tags = "${functionName}") -#end -@RestController -@RequestMapping("${reqMapping}") -public class ${ClassName}Controller extends BaseController{ - private final Logger logger = LoggerFactory.getLogger(${ClassName}Controller.class); - -#foreach($column in $columns) -#if($column.isGenerate.equals("1")) -#set($InterName = $column.itName.substring(0,1).toUpperCase() + ${column.itName.substring(1)}) - /** - * ${column.itDescribe} - */ - @ApiOperation("${column.itDescribe}") -#if($column.isPermission.equals("1")) - @PreAuthorize("@ebts.hasPermi('${prefix}:${column.requrl}')") - @Log(title = "${column.itDescribe}", businessType = BusinessType.OTHER) -#end - @${column.method}Mapping("/${column.requrl}") -#if($column.method.equals("Get")) - public AjaxResult ${InterName} ( Map parms){ -#else - public AjaxResult ${InterName} (@RequestBody Map parms){ -#end - try { - return AjaxResult.success("${column.itDescribe}测试!"); - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EBTSException(ReturnConstants.OP_ERROR,e); - } - } -#end -#end -} - - - diff --git a/ebts/ebts-generator/src/main/resources/vm/java/controller.java.vm b/ebts/ebts-generator/src/main/resources/vm/java/controller.java.vm deleted file mode 100644 index 9f8b5d5..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/java/controller.java.vm +++ /dev/null @@ -1,163 +0,0 @@ -package ${packageName}.controller; - -import java.io.Serializable; -import java.util.List; -import java.util.regex.Pattern; - - -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.core.controller.EBTSController; -import com.ebts.common.utils.ServerResult; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ebts.common.annotation.Log; -import com.ebts.common.core.entity.AjaxResult; -import com.ebts.common.enums.BusinessType; -import com.ebts.common.exception.EbtsException; -import ${packageName}.entity.${ClassName}; -import ${packageName}.service.${ClassName}Service; -import com.ebts.common.utils.poi.ExcelUtil; -#if($table.crud || $table.sub) -import com.ebts.common.core.page.TableDataInfo; -#elseif($table.tree) -#elseif($table.tplCategory.equals("rel")) -import org.springframework.validation.annotation.Validated; -#end - -/** - * ${functionName}Controller - * - * @author ${author} - * @date ${datetime} - */ - -@Api(value = "${functionName}管理",tags = "${functionName}管理") -@RestController -@RequestMapping("/${moduleName}/${businessName}") -public class ${ClassName}Controller extends EBTSController { - protected final Logger logger = LoggerFactory.getLogger(${ClassName}Controller.class); - - @Autowired - private ${ClassName}Service ${className}Service; - - /** - * 查询${functionName}列表 - */ - @ApiOperation("查询${functionName}列表") - @PreAuthorize("@ebts.hasPermi('${permissionPrefix}:list')") - @PostMapping("/list") - public Serializable list(@Validated @RequestBody ${ClassName} ${className}) { - startPage(${className}.getPageInfo()); - ServerResult> genServerResult = ${className}Service.select${ClassName}List(${className}); - if (genServerResult.isStart()) { -#if($table.crud || $table.sub || $tplCategory.equals("rel")) - return getDataTable(genServerResult.getData()); -#elseif($table.tree) - return AjaxResult.success(genServerResult.getData()); -#end - } else { - return AjaxResult.info(genServerResult.getMsg()); - } - } - - /** - * 导出${functionName}列表 - */ - @ApiOperation("导出${functionName}列表") - @PreAuthorize("@ebts.hasPermi('${permissionPrefix}:export')") - @Log(title = "${functionName}", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public AjaxResult export(@Validated @RequestBody ${ClassName} ${className}) { - ServerResult> genServerResult = ${className}Service.select${ClassName}List(${className}); - ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}. class); - if (genServerResult.isStart()) { - return util.exportExcel(genServerResult.getData(), "${businessName}"); - } else { - return AjaxResult.error(genServerResult.getMsg()); - } - } - - /** - * 获取${functionName}详细信息 - */ - @ApiOperation("获取${functionName}详细信息") - @ApiImplicitParam(name = "${pkColumn.javaField}" , value = "${functionName}${pkColumn.javaField}" , required = true, dataType = "${pkColumn.javaType}" , paramType = "path") - @PreAuthorize("@ebts.hasPermi('${permissionPrefix}:query')") - @GetMapping(value = "/{${pkColumn.javaField}}") - public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) { - ServerResult<${ClassName}> genServerResult = ${className}Service.select${ClassName}ById(${pkColumn.javaField}); - if (genServerResult.isStart()) { - return AjaxResult.success(genServerResult.getData()); - } else { - return AjaxResult.info(genServerResult.getMsg()); - } - } - - /** - * 新增${functionName} - */ - @ApiOperation("新增${functionName}") - @ApiImplicitParam(name = "${className}" , value = "新增${functionName}信息" , dataType = "${ClassName}") - @PreAuthorize("@ebts.hasPermi('${permissionPrefix}:add')") - @Log(title = "${functionName}", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@Validated @RequestBody ${ClassName} ${className}) { - ServerResult genServerResult = ${className}Service.insert${ClassName}(${className}); - if (genServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(genServerResult.getMsg()); - } - } - - /** - * 修改${functionName} - */ - @ApiOperation("修改${functionName}") - @ApiImplicitParam(name = "${className}" , value = "修改${functionName}信息" , dataType = "${ClassName}") - @PreAuthorize("@ebts.hasPermi('${permissionPrefix}:edit')") - @Log(title = "${functionName}", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@Validated @RequestBody ${ClassName} ${className}) { - ServerResult genServerResult = ${className}Service.update${ClassName}(${className}); - if (genServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(genServerResult.getMsg()); - } - } - - /** - * 删除${functionName} - */ - @ApiOperation("删除${functionName}") - @ApiImplicitParam(name = "${pkColumn.javaField}s" , value = "${functionName}${pkColumn.javaField}s" , required = true, dataType = "${pkColumn.javaType}" , paramType = "path") - @PreAuthorize("@ebts.hasPermi('${permissionPrefix}:remove')") - @Log(title = "${functionName}", businessType = BusinessType.DELETE) - @DeleteMapping("/{${pkColumn.javaField}s}") - public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) { - if (${pkColumn.javaField}s.length<0){ - return AjaxResult.error("id不能为空!"); - } - ServerResult genServerResult = ${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s); - if (genServerResult.isStart()) { - return AjaxResult.success(); - } else { - return AjaxResult.error(genServerResult.getMsg()); - } - } -} diff --git a/ebts/ebts-generator/src/main/resources/vm/java/dao.java.vm b/ebts/ebts-generator/src/main/resources/vm/java/dao.java.vm deleted file mode 100644 index c305e53..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/java/dao.java.vm +++ /dev/null @@ -1,90 +0,0 @@ -package ${packageName}.dao; - -import java.util.List; -import ${packageName}.entity.${ClassName}; -#if($table.sub) -import ${packageName}.entity.${subClassName}; -#end - -/** - * ${functionName}Mapper接口 - * - * @author ${author} - * @date ${datetime} - */ -public interface ${ClassName}Dao { - /** - * 查询${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return ${functionName} - */ - ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 查询${functionName}列表 - * - * @param ${className} ${functionName} - * @return ${functionName}集合 - */ - List<${ClassName}> select${ClassName}List(${ClassName} ${className}); - - /** - * 新增${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - int insert${ClassName}(${ClassName} ${className}); - - /** - * 修改${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - int update${ClassName}(${ClassName} ${className}); - - /** - * 删除${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 批量删除${functionName} - * - * @param ${pkColumn.javaField}s 需要删除的数据ID - * @return 结果 - */ - int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s); -#if($table.sub) - - /** - * 批量删除${subTable.functionName} - * - * @param ${pkColumn.javaField}s 需要删除的数据ID - * @return 结果 - */ - int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); - - /** - * 批量新增${subTable.functionName} - * - * @param ${subclassName}List ${subTable.functionName}列表 - * @return 结果 - */ - int batch${subClassName}(List<${subClassName}> ${subclassName}List); - - - /** - * 通过${functionName}ID删除${subTable.functionName}信息 - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); -#end -} diff --git a/ebts/ebts-generator/src/main/resources/vm/java/entity.java.vm b/ebts/ebts-generator/src/main/resources/vm/java/entity.java.vm deleted file mode 100644 index f91e14f..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/java/entity.java.vm +++ /dev/null @@ -1,162 +0,0 @@ -package ${packageName}.entity; - -#foreach ($import in $importList) -import ${import}; -#end -#if($table.crud || $table.sub || $tplCategory.equals("rel")) - #set($Entity="BaseEntity") -#elseif($table.tree) - #set($Entity="TreeEntity") -#end -#if($table.tplCategory.equals("rel")) -import com.ebts.common.annotation.Excels; -#elseif($table.tplCategory.equals("sub")) -import ${packageName}.entity.${subClassName}; -#end -import com.ebts.common.core.entity.${Entity}; -import com.ebts.common.annotation.Excel; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * ${functionName}对象 ${tableName} - * - * @author ${author} - * @date ${datetime} - */ -#if($table.crud || $table.sub) -#set($Entity="BaseEntity") -#elseif($table.tree) -#set($Entity="TreeEntity") -#end -@ApiModel("${functionName}") -public class ${ClassName} extends ${Entity}{ -#foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) - - /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end -#if($column.isRequired == 1) - @NotNull(message = "${column.columnComment}不能为空!") -#end -#if($column.isRegular != 1) - @Pattern(regexp = "${column.regular}",message = "${column.columnComment}格式错误!") -#end - @ApiModelProperty("${column.columnComment}") - private $column.javaType $column.javaField; -#end -#end - -#if($table.sub) - /** $table.subTable.functionName信息 */ - @ApiModelProperty("${table.subTable.functionName}信息") - private List<${subClassName}> ${subclassName}List; - -#elseif($tplCategory.equals("rel")) -#foreach($table in $relTables) -#foreach($column in $table.relColumns) -#if($column.isList.equals("1")) -#set($count = $count + 1) -#end -#end - #set($targetName = "") - #set($indexs = 0) -#foreach($column in $table.relColumns) -#if($column.isList.equals("1")) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($indexs = $indexs + 1) -#set($targetName = $targetName + '@Excel(name = "'+$comment+'",targetAttr = "'+$column.javaField+'")') -#if($indexs != $count) -#set($targetName = $targetName + ",") -#end -#end -#end - - /** ${table.relComment}信息 */ - @Excels({${targetName}}) - private ${table.relClass} ${table.relclass}; -#end - -#end - -#foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField){ - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}(){ - return $column.javaField; - } -#end -#end - -#if($table.sub) - public List<${subClassName}> get${subClassName}List(){ - return ${subclassName}List; - } - - public void set${subClassName}List(List<${subClassName}> ${subclassName}List){ - this.${subclassName}List = ${subclassName}List; - } -#elseif($table.tplCategory.equals("rel")) -#foreach($table in $relTables) - public ${table.relClass} get${table.relClass}(){ - return ${table.relclass}; - } - - public void set${table.relClass}(${table.relClass} ${table.relclass}){ - this.${table.relclass} = ${table.relclass}; - } -#end -#end - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - .append("${column.javaField}", get${AttrName}()) -#end -#if($table.sub) - .append("${subclassName}List", get${subClassName}List()) -#elseif($tplCategory.equals("rel")) -#foreach($table in $relTables) - .append("${table.relclass}",get${table.relClass}()) -#end -#end - .toString(); - } -} diff --git a/ebts/ebts-generator/src/main/resources/vm/java/rel-entity.java.vm b/ebts/ebts-generator/src/main/resources/vm/java/rel-entity.java.vm deleted file mode 100644 index 981590f..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/java/rel-entity.java.vm +++ /dev/null @@ -1,52 +0,0 @@ -package ${packageName}.entity; - -import com.ebts.common.annotation.Excel; -import com.ebts.common.core.entity.BaseEntity; - -/** - * - * @author ${author} - * @date ${datetime} - */ - -public class ${relTable.relClass} extends BaseEntity{ - -#foreach($column in $relTable.relColumns) -#if(!$table.isSuperColumn($column.javaField)) - /** $column.columnComment */ -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) - #set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else - #set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end - private $column.javaType $column.javaField; - -#end -#end - -#foreach ($column in $relTable.relColumns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField){ - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}(){ - return $column.javaField; - } -#end -#end -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/vm/java/service.java.vm b/ebts/ebts-generator/src/main/resources/vm/java/service.java.vm deleted file mode 100644 index 9707899..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/java/service.java.vm +++ /dev/null @@ -1,63 +0,0 @@ -package ${packageName}.service; - -import java.util.List; - -import com.ebts.common.utils.ServerResult; -import ${packageName}.entity.${ClassName}; - -/** - * ${functionName}Service接口 - * - * @author ${author} - * @date ${datetime} - */ -public interface ${ClassName}Service -{ - /** - * 查询${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return ${functionName} - */ - ServerResult<${ClassName}> select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 查询${functionName}列表 - * - * @param ${className} ${functionName} - * @return ${functionName}集合 - */ - ServerResult> select${ClassName}List(${ClassName} ${className}); - - /** - * 新增${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - ServerResult insert${ClassName}(${ClassName} ${className}); - - /** - * 修改${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - ServerResult update${ClassName}(${ClassName} ${className}); - - /** - * 批量删除${functionName} - * - * @param ${pkColumn.javaField}s 需要删除的${functionName}ID - * @return 结果 - */ - ServerResult delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s); - - /** - * 删除${functionName}信息 - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - ServerResult delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); -} diff --git a/ebts/ebts-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ebts/ebts-generator/src/main/resources/vm/java/serviceImpl.java.vm deleted file mode 100644 index 368f921..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/java/serviceImpl.java.vm +++ /dev/null @@ -1,234 +0,0 @@ -package ${packageName}.service.impl; - -import java.util.List; - -import com.ebts.common.constant.ReturnConstants; -import com.ebts.common.exception.EbtsException; -#foreach ($column in $columns) -#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') -import com.ebts.common.utils.DateUtils; -#end -#if($column.javaField == 'updateBy' || $column.javaField == 'createBy') -import com.ebts.common.utils.SecurityUtils; -#end -#end -import com.ebts.common.utils.ServerResult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -#if($table.sub) -import java.util.ArrayList; -import com.ebts.common.utils.StringUtils; -import org.springframework.transaction.annotation.Transactional; -import ${packageName}.entity.${subClassName}; -#end -import ${packageName}.dao.${ClassName}Dao; -import ${packageName}.entity.${ClassName}; -import ${packageName}.service.${ClassName}Service; - -/** - * ${functionName}Service业务层处理 - * - * @author ${author} - * @date ${datetime} - */ -@Service -public class ${ClassName}ServiceImpl implements ${ClassName}Service { - private Logger logger = LoggerFactory.getLogger(${ClassName}ServiceImpl.class); - - @Autowired - private ${ClassName}Dao ${className}Dao; - - /** - * 查询${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return ${functionName} - */ - @Override - public ServerResult<${ClassName}> select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}) { - try { - ${ClassName} ${className} = ${className}Dao.select${ClassName}ById(${pkColumn.javaField}); - if (${className} != null){ - return new ServerResult<>(true,${className}); - }else { - return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY); - } - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 查询${functionName}列表 - * - * @param ${className} ${functionName} - * @return ${functionName} - */ - @Override - public ServerResult> select${ClassName}List(${ClassName} ${className}) { - try { - List<${ClassName}> ${className}List = ${className}Dao.select${ClassName}List(${className}); - if (${className}List.size()>0){ - return new ServerResult<>(true,${className}List); - }else { - return new ServerResult<>(false,ReturnConstants.RESULT_EMPTY); - } - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 新增${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ -#if($table.sub) - @Transactional -#end - @Override - public ServerResult insert${ClassName}(${ClassName} ${className}) { - try { -#foreach ($column in $columns) -#if($column.javaField == 'createBy') - ${className}.setCreateBy(SecurityUtils.getUserId()); -#end -#end -#if($table.sub) - int renewal = ${className}Dao.insert${ClassName}(${className}); - if (insert${subClassName}(${className})){ - return new ServerResult<>(false,ReturnConstants.DB_EX); - } -#else - Integer renewal = ${className}Dao.insert${ClassName}(${className}); -#end - if (renewal >0){ - return new ServerResult<>(true,renewal); - }else { - return new ServerResult<>(false,ReturnConstants.SYS_FAILL); - } - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 修改${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ -#if($table.sub) - @Transactional -#end - @Override - public ServerResult update${ClassName}(${ClassName} ${className}) { - try { -#foreach ($column in $columns) -#if($column.javaField == 'updateBy') - ${className}.setUpdateBy(SecurityUtils.getUserId()); -#end -#end -#if($table.sub) - ${className}Dao.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}()); - if (insert${subClassName}(${className})){ - return new ServerResult<>(false,ReturnConstants.DB_EX); - } -#end - Integer renewal = ${className}Dao.update${ClassName}(${className}); - if (renewal >0){ - return new ServerResult<>(true,renewal); - }else { - return new ServerResult<>(false,ReturnConstants.SYS_FAILL); - } - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 批量删除${functionName} - * - * @param ${pkColumn.javaField}s 需要删除的${functionName}ID - * @return 结果 - */ -#if($table.sub) - @Transactional -#end - @Override - public ServerResult delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s) { - try { -#if($table.sub) - //批量删除子表数据 - ${className}Dao.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); -#end - Integer renewal = ${className}Dao.delete${ClassName}ByIds(${pkColumn.javaField}s); - if (renewal >0){ - return new ServerResult<>(true,renewal); - }else { - return new ServerResult<>(false,ReturnConstants.SYS_FAILL); - } - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } - - /** - * 删除${functionName}信息 - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - @Override - public ServerResult delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}) { - try { -#if($table.sub) - //删除子表数据 - ${className}Dao.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField}); -#end - Integer renewal = ${className}Dao.delete${ClassName}ById(${pkColumn.javaField}); - if (renewal >0){ - return new ServerResult<>(true,renewal); - }else { - return new ServerResult<>(false,ReturnConstants.SYS_FAILL); - } - }catch (RuntimeException e){ - logger.error(e.getMessage()); - throw new EbtsException(ReturnConstants.OP_ERROR,e); - } - } -#if($table.sub) - - /** - * 新增${subTable.functionName}信息 - * - * @param ${className} ${functionName}对象 - */ - public boolean insert${subClassName}(${ClassName} ${className}) { - List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List(); - Long ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}(); - if (StringUtils.isNotNull(${subclassName}List)) { - List<${subClassName}> list = new ArrayList<${subClassName}>(); - for (${subClassName} ${subclassName} : ${subclassName}List){ - ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField}); - list.add(${subclassName}); - } - if (list.size() > 0) { - Integer renewal = ${className}Dao.batch${subClassName}(list); - if (renewal>0){ - return false; - } - } - } - return true; - } -#end -} diff --git a/ebts/ebts-generator/src/main/resources/vm/java/sub-entity.java.vm b/ebts/ebts-generator/src/main/resources/vm/java/sub-entity.java.vm deleted file mode 100644 index 160a2e6..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/java/sub-entity.java.vm +++ /dev/null @@ -1,70 +0,0 @@ -package ${packageName}.entity; - -#foreach ($import in $subImportList) -import ${import}; -#end -import com.ebts.common.annotation.Excel; -import com.ebts.common.core.entity.BaseEntity; - -/** - * ${subTable.functionName}对象 ${subTableName} - * - * @author ${author} - * @date ${datetime} - */ -public class ${subClassName} extends BaseEntity{ - -#foreach ($column in $subTable.columns) -#if(!$table.isSuperColumn($column.javaField)) - /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end - private $column.javaType $column.javaField; - -#end -#end -#foreach ($column in $subTable.columns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField){ - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}(){ - return $column.javaField; - } -#end -#end - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $subTable.columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - .append("${column.javaField}", get${AttrName}()) -#end - .toString(); - } -} diff --git a/ebts/ebts-generator/src/main/resources/vm/js/api.js.vm b/ebts/ebts-generator/src/main/resources/vm/js/api.js.vm deleted file mode 100644 index 366a327..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/js/api.js.vm +++ /dev/null @@ -1,54 +0,0 @@ -import request from '@/utils/request' - - -// 查询${functionName}列表 -export function list${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}/list', - method: 'post', - data: data - }) -} - -// 导出${functionName} -export function export${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}/export', - method: 'post', - data: data - }) -} - -// 查询${functionName}详细 -export function get${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, - method: 'get' - }) -} - -// 新增${functionName} -export function add${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}', - method: 'post', - data: data - }) -} - -// 修改${functionName} -export function update${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}', - method: 'put', - data: data - }) -} - -// 删除${functionName} -export function del${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, - method: 'delete' - }) -} \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/vm/sql/class.sql.vm b/ebts/ebts-generator/src/main/resources/vm/sql/class.sql.vm deleted file mode 100644 index 52471a8..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/sql/class.sql.vm +++ /dev/null @@ -1,18 +0,0 @@ --- ${functionName}Controller - -delete from sys_menu where perms= '${prefix}'; - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}', 5, '1', '#','' ,1, 0, 'F', '0', '0', '${prefix}','#', ${createBy}, sysdate(), 0, null, '${functionName}接口管理'); - -SELECT @parentId := LAST_INSERT_ID(); -#foreach($column in $columns) -#if($column.isGenerate.equals("1")) - -delete from sys_menu where perms= '${prefix}:${column.requrl}'; - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${column.itDescribe}', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${prefix}:${column.requrl}', '#', ${createBy}, sysdate(), 0, null, ''); -#end -#end - diff --git a/ebts/ebts-generator/src/main/resources/vm/sql/table.sql.vm b/ebts/ebts-generator/src/main/resources/vm/sql/table.sql.vm deleted file mode 100644 index 8d4ed9a..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/sql/table.sql.vm +++ /dev/null @@ -1,35 +0,0 @@ --- 菜单 SQL - -delete from sys_menu where perms= '${permissionPrefix}:list'; - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', ${createBy}, sysdate(), 0, null, '${functionName}菜单'); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - -delete from sys_menu where perms= '${permissionPrefix}:query'; - --- 按钮 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', ${createBy}, sysdate(), 0, null, ''); - -delete from sys_menu where perms = '${permissionPrefix}:add'; - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', ${createBy}, sysdate(), 0, null, ''); - -delete from sys_menu where perms = '${permissionPrefix}:edit'; - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', ${createBy}, sysdate(), 0, null, ''); - -delete from sys_menu where perms = '${permissionPrefix}:remove'; - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', ${createBy}, sysdate(), 0, null, ''); - -delete from sys_menu where perms = '${permissionPrefix}:export'; - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', ${createBy}, sysdate(), 0, null, ''); \ No newline at end of file diff --git a/ebts/ebts-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ebts/ebts-generator/src/main/resources/vm/vue/index-tree.vue.vm deleted file mode 100644 index 3d96336..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ /dev/null @@ -1,526 +0,0 @@ - - - diff --git a/ebts/ebts-generator/src/main/resources/vm/vue/index.vue.vm b/ebts/ebts-generator/src/main/resources/vm/vue/index.vue.vm deleted file mode 100644 index 94093f2..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/vue/index.vue.vm +++ /dev/null @@ -1,810 +0,0 @@ - - - diff --git a/ebts/ebts-generator/src/main/resources/vm/xml/mapper.xml.vm b/ebts/ebts-generator/src/main/resources/vm/xml/mapper.xml.vm deleted file mode 100644 index e3f4126..0000000 --- a/ebts/ebts-generator/src/main/resources/vm/xml/mapper.xml.vm +++ /dev/null @@ -1,247 +0,0 @@ - - - - - -#foreach ($column in $columns) - -#end - -#if($table.sub) - - - - - - -#foreach ($column in $subTable.columns) - -#end - -#end -#if($table.tplCategory.equals("rel")) - -#foreach($table in $relTables) - -#end - -#foreach($table in $relTables) - -#foreach($column in $table.relColumns) - -#end - -#end - -#end - - select#foreach($column in $columns) $column.columnName#if($velocityCount != $columns.size()),#end#end from ${tableName} - - - -#if($tplCategory.equals("rel")) - - - -#foreach($column in $columns) -#set($queryType=$column.queryType) -#set($javaField=$column.javaField) -#set($javaType=$column.javaType) -#set($columnName=$column.columnName) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#if($column.isQuery.equals("1")) -#if($column.queryType == "EQ") - and $columnName = #{$javaField} -#elseif($queryType == "NE") - and $columnName != #{$javaField} -#elseif($queryType == "GT") - and $columnName > #{$javaField} -#elseif($queryType == "GTE") - and $columnName >= #{$javaField} -#elseif($queryType == "LT") - and $columnName < #{$javaField} -#elseif($queryType == "LTE") - and $columnName <= #{$javaField} -#elseif($queryType == "LIKE") - and $columnName like concat('%', #{$javaField}, '%') -#elseif($queryType == "BETWEEN") - and $columnName between #{params.begin$AttrName} and #{params.end$AttrName} -#end -#end -#end -#end - - - - -#if($tplCategory.equals("rel")) - -#end - - - insert into ${tableName} - -#foreach($column in $columns) -#if(($column.columnName != $pkColumn.columnName || !$pkColumn.increment) && $column.isInsert == 1) - $column.columnName, -#end -#end - - -#foreach($column in $columns) -#if(($column.columnName != $pkColumn.columnName || !$pkColumn.increment) && $column.isInsert == 1) - #{$column.javaField}, -#end -#end - - - - - update ${tableName} - -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName && $column.isInsert == 1) - $column.columnName = #{$column.javaField}, -#end -#end - - where ${pkColumn.columnName} = #{${pkColumn.javaField}} - - - - delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} - - - - delete from ${tableName} where ${pkColumn.columnName} in - - #{${pkColumn.javaField}} - - -#if($table.sub) - - - delete from ${subTableName} where ${subTableFkName} in - - #{${subTableFkclassName}} - - - - - delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} - - - - insert into ${subTableName}(#set($index = 0)#foreach($column in $subTable.columns)#if($column.isPk.equals("1"))#set($insex = 1)#else$column.columnName#if($velocityCount != ($subTable.columns.size()-$index)),#end#end#end) values - - (#foreach($column in $subTable.columns)#if($column.isPk.equals("1"))#set($index = 1)#else#{item.$column.javaField}#if($velocityCount != $subTable.columns.size()),#end#end#end) - - -#end - \ No newline at end of file