From e19bc800d668a05275371b1c7abc3dfa16470901 Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Sun, 5 Mar 2023 12:54:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=EF=BC=9B=20=E8=B5=84=E9=87=91=E8=B4=A6=E6=88=B7sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/core/web/CoreCodeGenController.java | 37 ++++++++++++-- .../resources/static/js/core/codeGen/index.js | 7 +++ .../templates/core/codeGen/index.html | 3 ++ .../{tianze-pro.sql => 1.tianze-pro.sql} | 0 ...pro-update.sql => 2.tianze-pro-update.sql} | 0 doc/sql/mysql/3.tianze-pro-account.sql | 51 +++++++++++++++++++ 6 files changed, 93 insertions(+), 5 deletions(-) rename doc/sql/mysql/{tianze-pro.sql => 1.tianze-pro.sql} (100%) rename doc/sql/mysql/{tianze-pro-update.sql => 2.tianze-pro-update.sql} (100%) create mode 100644 doc/sql/mysql/3.tianze-pro-account.sql diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/web/CoreCodeGenController.java b/admin-core/src/main/java/com/ibeetl/admin/core/web/CoreCodeGenController.java index a3c42ba6..5ce63f39 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/web/CoreCodeGenController.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/web/CoreCodeGenController.java @@ -1,5 +1,7 @@ package com.ibeetl.admin.core.web; +import cn.hutool.core.util.StrUtil; +import com.ibeetl.admin.core.annotation.Query; import com.ibeetl.admin.core.gen.*; import com.ibeetl.admin.core.gen.model.Attribute; import com.ibeetl.admin.core.gen.model.Entity; @@ -25,6 +27,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.stream.Collectors; @Controller public class CoreCodeGenController { @@ -34,9 +37,32 @@ public class CoreCodeGenController { @Autowired CoreCodeGenService codeGenService; + /** + * 前端显示字段控制 + */ + public class TableSearchQuery { + @Query(name = "表名称", display = true, fuzzy=true) + private String tableName; + @Query(name = "类名", display = true, fuzzy=true) + private String name; + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getTableName() { + return tableName; + } + public void setTableName(String tableName) { + this.tableName = tableName; + } + } + @GetMapping(MODEL + "/index.do") public ModelAndView index() { ModelAndView view = new ModelAndView("/core/codeGen/index.html"); + view.addObject("search", TableSearchQuery.class.getName()); return view; } @@ -154,15 +180,16 @@ public class CoreCodeGenController { } return target; } - - - @PostMapping(MODEL + "/table.json") @ResponseBody - public JsonResult> getTable() { + public JsonResult> getTable(TableSearchQuery tableSearchQuery) { List list = codeGenService.getAllEntityInfo(); - return JsonResult.success(list); + List result = list.stream().filter( + item -> (StrUtil.isNotBlank(tableSearchQuery.getName()) && item.getName().contains(tableSearchQuery.getName())) + || (StrUtil.isNotBlank(tableSearchQuery.getTableName()) && item.getTableName().contains(tableSearchQuery.getTableName()))) + .collect(Collectors.toList()); + return JsonResult.success(result); } @PostMapping(MODEL + "/tableDetail.json") diff --git a/admin-core/src/main/resources/static/js/core/codeGen/index.js b/admin-core/src/main/resources/static/js/core/codeGen/index.js index b1b0bfff..00886374 100644 --- a/admin-core/src/main/resources/static/js/core/codeGen/index.js +++ b/admin-core/src/main/resources/static/js/core/codeGen/index.js @@ -9,6 +9,10 @@ layui.define([ 'form', 'laydate', 'table','codeApi' ], function(exports) { init:function(){ this.initTable(); this.initToolBar(); + this.initSearchForm(); + window.dataReload = function(){ + Lib.doSearchForm($("#searchForm"), codeTable) + } }, initTable:function(){ codeTable = table.render({ @@ -41,6 +45,9 @@ layui.define([ 'form', 'laydate', 'table','codeApi' ], function(exports) { }); }, + initSearchForm() { + Lib.initSearchForm($("#searchForm"), codeTable, form); + }, initToolBar:function(){ toolbar = { edit : function() { //获取选中数目 diff --git a/admin-core/src/main/resources/templates/core/codeGen/index.html b/admin-core/src/main/resources/templates/core/codeGen/index.html index d99581de..34238ea6 100644 --- a/admin-core/src/main/resources/templates/core/codeGen/index.html +++ b/admin-core/src/main/resources/templates/core/codeGen/index.html @@ -1,9 +1,12 @@ + +
编辑 刷新
+