Merge remote-tracking branch 'origin/fix-bug-202303' into fix-bug-202303
This commit is contained in:
+49
-1
@@ -19,8 +19,10 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
import com.jero.codegenerate.database.util.CodeStringUtils;
|
import com.jero.codegenerate.database.util.CodeStringUtils;
|
||||||
import com.jero.codegenerate.generate.pojo.ColumnVo;
|
import com.jero.codegenerate.generate.pojo.ColumnVo;
|
||||||
import com.jero.codegenerate.generate.util.TableConvert;
|
import com.jero.codegenerate.generate.util.TableConvert;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@Component
|
||||||
public class DbReadTableUtil {
|
public class DbReadTableUtil {
|
||||||
|
|
||||||
private static Connection connection;
|
private static Connection connection;
|
||||||
@@ -32,7 +34,6 @@ public class DbReadTableUtil {
|
|||||||
private static final String CONNECT_DATABASE_NAME = " connect databaseName : ";
|
private static final String CONNECT_DATABASE_NAME = " connect databaseName : ";
|
||||||
private static final String COLUMN_GET_FIELD_NAME = "columnt.getFieldName() -------------";
|
private static final String COLUMN_GET_FIELD_NAME = "columnt.getFieldName() -------------";
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws SQLException {
|
public static void main(String[] args) throws SQLException {
|
||||||
try {
|
try {
|
||||||
List<ColumnVo> list = listColumns("demo");
|
List<ColumnVo> list = listColumns("demo");
|
||||||
@@ -526,4 +527,51 @@ public class DbReadTableUtil {
|
|||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取当前使用数据库名
|
||||||
|
public String database() throws Exception {
|
||||||
|
Class.forName(com.jero.codegenerate.properties.CodeConfigProperties.driverName);
|
||||||
|
connection = DriverManager.getConnection(com.jero.codegenerate.properties.CodeConfigProperties.databaseUrl, com.jero.codegenerate.properties.CodeConfigProperties.username, com.jero.codegenerate.properties.CodeConfigProperties.password);
|
||||||
|
statement = connection.createStatement(1005, 1007);
|
||||||
|
String sqlStr = "select database()";
|
||||||
|
ResultSet resultSet = statement.executeQuery(sqlStr);
|
||||||
|
while(resultSet.next()) {
|
||||||
|
String name = resultSet.getString(1);
|
||||||
|
this.release(connection,statement);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
this.release(connection,statement);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//通过表名获取表备注
|
||||||
|
public String remarks(String a) throws Exception {
|
||||||
|
String database = this.database();
|
||||||
|
|
||||||
|
Class.forName(com.jero.codegenerate.properties.CodeConfigProperties.driverName);
|
||||||
|
connection = DriverManager.getConnection(com.jero.codegenerate.properties.CodeConfigProperties.databaseUrl, com.jero.codegenerate.properties.CodeConfigProperties.username, com.jero.codegenerate.properties.CodeConfigProperties.password);
|
||||||
|
statement = connection.createStatement(1005, 1007);
|
||||||
|
|
||||||
|
String sqlStr = "SELECT table_comment FROM information_schema.TABLES WHERE table_schema = " + "'"+database+"'" + " AND table_name = " + "'"+a+"'";
|
||||||
|
ResultSet resultSet = statement.executeQuery(sqlStr);
|
||||||
|
while(resultSet.next()) {
|
||||||
|
String name = resultSet.getString(1);
|
||||||
|
this.release(connection,statement);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
this.release(connection,statement);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//释放连接资源
|
||||||
|
public void release(Connection connection, Statement statement) throws Exception {
|
||||||
|
if (statement != null) {
|
||||||
|
statement.close();
|
||||||
|
statement = null;
|
||||||
|
}
|
||||||
|
if (connection != null) {
|
||||||
|
connection.close();
|
||||||
|
connection = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-1
@@ -89,6 +89,8 @@ public class OnlCgformHeadServiceImpl extends ServiceImpl<OnlCgformHeadMapper, O
|
|||||||
private DataBaseConfig dataBaseConfig;
|
private DataBaseConfig dataBaseConfig;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOnlAuthPageService onlAuthPageService;
|
private IOnlAuthPageService onlAuthPageService;
|
||||||
|
@Autowired
|
||||||
|
private DbReadTableUtil dbReadTableUtil;
|
||||||
|
|
||||||
private static final String CONF_IS_NULL = "实体配置不存在";
|
private static final String CONF_IS_NULL = "实体配置不存在";
|
||||||
private static final String DB_ID = "数据库主表ID[";
|
private static final String DB_ID = "数据库主表ID[";
|
||||||
@@ -497,7 +499,13 @@ public class OnlCgformHeadServiceImpl extends ServiceImpl<OnlCgformHeadMapper, O
|
|||||||
var2.setIsPage("Y");
|
var2.setIsPage("Y");
|
||||||
var2.setQueryMode("group");
|
var2.setQueryMode("group");
|
||||||
var2.setTableName(tbname.toLowerCase());
|
var2.setTableName(tbname.toLowerCase());
|
||||||
var2.setTableTxt(tbname);
|
String remarks = "";
|
||||||
|
try {
|
||||||
|
remarks = dbReadTableUtil.remarks(tbname);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
var2.setTableTxt(remarks);
|
||||||
var2.setTableVersion(1);
|
var2.setTableVersion(1);
|
||||||
var2.setFormTemplate("1");
|
var2.setFormTemplate("1");
|
||||||
var2.setCopyType(0);
|
var2.setCopyType(0);
|
||||||
|
|||||||
+30
-25
@@ -36,45 +36,55 @@ public class GatewayRoutersConfiguration {
|
|||||||
|
|
||||||
public static String ROUTE_GROUP;
|
public static String ROUTE_GROUP;
|
||||||
|
|
||||||
public static String USERNAME;
|
|
||||||
|
|
||||||
public static String PASSWORD;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路由配置文件数据获取方式yml,nacos,database
|
* 路由配置文件数据获取方式yml,nacos,database
|
||||||
*/
|
*/
|
||||||
public static String DATA_TYPE;
|
public static String DATA_TYPE;
|
||||||
|
|
||||||
@Value("${spring.cloud.nacos.discovery.server-addr}")
|
@Value("${spring.cloud.nacos.discovery.server-addr}")
|
||||||
public static void setServerAddr(String serverAddr) {
|
public void setServerAddr(String serverAddr) {
|
||||||
SERVER_ADDR = serverAddr;
|
synchronized (GatewayRoutersConfiguration.class){
|
||||||
|
if(SERVER_ADDR == null){
|
||||||
|
SERVER_ADDR = serverAddr;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${spring.cloud.nacos.discovery.namespace}")
|
@Value("${spring.cloud.nacos.discovery.namespace}")
|
||||||
public static void setNamespace(String namespace) {
|
public void setNamespace(String namespace) {
|
||||||
NAMESPACE = namespace;
|
synchronized (GatewayRoutersConfiguration.class){
|
||||||
|
if(NAMESPACE == null){
|
||||||
|
NAMESPACE = namespace;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${jero.route.config.data-id:#{null}}")
|
@Value("${jero.route.config.data-id:#{null}}")
|
||||||
public static void setRouteDataId(String dataId) {
|
public void setRouteDataId(String dataId) {
|
||||||
DATA_ID = dataId + ".json";
|
synchronized (GatewayRoutersConfiguration.class){
|
||||||
|
if(DATA_ID == null){
|
||||||
|
DATA_ID = dataId + ".json";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${jero.route.config.group:DEFAULT_GROUP:#{null}}")
|
@Value("${jero.route.config.group:DEFAULT_GROUP:#{null}}")
|
||||||
public static void setRouteGroup(String routeGroup) {
|
public void setRouteGroup(String routeGroup) {
|
||||||
ROUTE_GROUP = routeGroup;
|
synchronized (GatewayRoutersConfiguration.class){
|
||||||
|
if(ROUTE_GROUP == null){
|
||||||
|
ROUTE_GROUP = routeGroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${jero.route.config.data-type}")
|
@Value("${jero.route.config.data-type}")
|
||||||
public static void setDataType(String dataType) { DATA_TYPE = dataType; }
|
public void setDataType(String dataType) {
|
||||||
|
synchronized (GatewayRoutersConfiguration.class){
|
||||||
|
if(DATA_TYPE == null){
|
||||||
|
DATA_TYPE = dataType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Value("${spring.cloud.nacos.config.username}")
|
|
||||||
public static void setUsername(String username) {
|
|
||||||
USERNAME = username;
|
|
||||||
}
|
|
||||||
@Value("${spring.cloud.nacos.config.password}")
|
|
||||||
public static void setPassword(String password) {
|
|
||||||
PASSWORD = password;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -89,11 +99,6 @@ public class GatewayRoutersConfiguration {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 映射接口文档默认地址(通过9999端口直接访问)
|
|
||||||
* @param indexHtml
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
@Bean
|
||||||
public RouterFunction<ServerResponse> indexRouter(@Value("classpath:/META-INF/resources/doc.html") final org.springframework.core.io.Resource indexHtml) {
|
public RouterFunction<ServerResponse> indexRouter(@Value("classpath:/META-INF/resources/doc.html") final org.springframework.core.io.Resource indexHtml) {
|
||||||
return route(GET("/"), request -> ok().contentType(MediaType.TEXT_HTML).syncBody(indexHtml));
|
return route(GET("/"), request -> ok().contentType(MediaType.TEXT_HTML).syncBody(indexHtml));
|
||||||
|
|||||||
@@ -42,3 +42,6 @@ jero:
|
|||||||
fileSuffixLimits: 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin
|
fileSuffixLimits: 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin
|
||||||
# 跨站白名单
|
# 跨站白名单
|
||||||
whiteUrls:
|
whiteUrls:
|
||||||
|
route:
|
||||||
|
config:
|
||||||
|
data-type: yml
|
||||||
|
|||||||
@@ -8099,7 +8099,7 @@
|
|||||||
return Object(r["a"])({
|
return Object(r["a"])({
|
||||||
url: e,
|
url: e,
|
||||||
method: "post",
|
method: "post",
|
||||||
params: t
|
data: t
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user