Commit eacdbf63 authored by zengchao's avatar zengchao
Browse files

-重写路由

parent c6ec721d
...@@ -36,7 +36,7 @@ logging.level.org.springframework.web.servlet.mvc.method.annotation=warn ...@@ -36,7 +36,7 @@ logging.level.org.springframework.web.servlet.mvc.method.annotation=warn
#logging.file = my.log #logging.file = my.log
logging.pattern.console=%-4relative [%thread] %-5level %logger{256} %M %L - %msg%n logging.pattern.console=%-4relative [%thread] %-5level %logger{256} %M %L - %msg%n
#\u65E5\u5FD7\u6392\u9664 autoconfiguration \u8F93\u51FA #\u65E5\u5FD7\u6392\u9664 autoconfiguration \u8F93\u51FA
logging.level.org.springframework.boot.autoconfigure: ERROR logging.level.org.springframework.boot.autoconfigure=ERROR
#\u6587\u6863\u9884\u89C8\u670D\u52A1\u7684\u8C03\u7528\u5730\u5740\uFF0C\u53C2\u8003https://gitee.com/kekingcn/file-online-preview \u5B89\u88C5\uFF0C\u6CA1\u6709\u5982\u4E0B\u914D\u7F6E\u65E0\u6CD5\u4F7F\u7528\u9884\u89C8\u529F\u80FD #\u6587\u6863\u9884\u89C8\u670D\u52A1\u7684\u8C03\u7528\u5730\u5740\uFF0C\u53C2\u8003https://gitee.com/kekingcn/file-online-preview \u5B89\u88C5\uFF0C\u6CA1\u6709\u5982\u4E0B\u914D\u7F6E\u65E0\u6CD5\u4F7F\u7528\u9884\u89C8\u529F\u80FD
file.previewURL=http://localhost:8012/onlinePreview file.previewURL=http://localhost:8012/onlinePreview
DELIMITER_PLACEHOLDER_START=# DELIMITER_PLACEHOLDER_START=#
DELIMITER_PLACEHOLDER_END=# DELIMITER_PLACEHOLDER_END=#
DELIMITER_STATEMENT_START=>- DELIMITER_STATEMENT_START=@
DELIMITER_STATEMENT_END= DELIMITER_STATEMENT_END=
#\u51FD\u6570\u6CE8\u518C #\u51FD\u6570\u6CE8\u518C
FN.isEmpty=org.beetl.ext.fn.EmptyExpressionFunction FN.isEmpty=org.beetl.ext.fn.EmptyExpressionFunction
......
package com.ibeetl.admin.core.conf; package com.ibeetl.admin.core.conf;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import cn.hutool.setting.SettingUtil;
import cn.hutool.setting.dialect.Props;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.ibeetl.admin.core.conf.handler.DateTypeHandler; import com.ibeetl.admin.core.conf.handler.DateTypeHandler;
import com.ibeetl.admin.core.conf.handler.ZonedDateTimeTypeHandler; import com.ibeetl.admin.core.conf.handler.ZonedDateTimeTypeHandler;
...@@ -23,6 +25,7 @@ import com.ibeetl.admin.core.web.query.QueryParser; ...@@ -23,6 +25,7 @@ import com.ibeetl.admin.core.web.query.QueryParser;
import com.ibeetl.starter.BeetlSqlMutipleSourceCustomize; import com.ibeetl.starter.BeetlSqlMutipleSourceCustomize;
import com.ibeetl.starter.BeetlTemplateCustomize; import com.ibeetl.starter.BeetlTemplateCustomize;
import com.ibeetl.starter.ObjectMapperJsonUtil; import com.ibeetl.starter.ObjectMapperJsonUtil;
import java.io.File;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.Date; import java.util.Date;
...@@ -85,7 +88,7 @@ public class BeetlConf { ...@@ -85,7 +88,7 @@ public class BeetlConf {
} }
/** /**
* BeetlSql 多数据源 * BeetlSql 多数据源中每个数据源单独自定义配置
* *
* @return * @return
*/ */
...@@ -194,7 +197,7 @@ public class BeetlConf { ...@@ -194,7 +197,7 @@ public class BeetlConf {
@Override @Override
protected void println(String str) { protected void println(String str) {
logger.info(str); logger.info(System.lineSeparator()+str);
} }
} }
} }
package com.ibeetl.admin.core.conf; package com.ibeetl.admin.core.conf;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -23,11 +28,17 @@ public class JasonConfig { ...@@ -23,11 +28,17 @@ public class JasonConfig {
@ConditionalOnMissingBean(ObjectMapper.class) @ConditionalOnMissingBean(ObjectMapper.class)
public ObjectMapper getObjectMapper() { public ObjectMapper getObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true); objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
SimpleModule simpleModule = new SimpleModule("SimpleModule", Version.unknownVersion()); SimpleModule simpleModule = new SimpleModule("SimpleModule", Version.unknownVersion());
simpleModule.addSerializer(JsonResult.class, new CustomJsonResultSerializer()); simpleModule.addSerializer(JsonResult.class, new CustomJsonResultSerializer());
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
objectMapper.registerModule(simpleModule); objectMapper.registerModule(simpleModule);
return objectMapper; return objectMapper;
} }
/** /**
...@@ -48,7 +59,7 @@ public class JasonConfig { ...@@ -48,7 +59,7 @@ public class JasonConfig {
Object data = value.getData(); Object data = value.getData();
if (data instanceof PageQuery) { if (data instanceof PageQuery) {
PageQuery query = (PageQuery) (data); PageQuery query = (PageQuery) (data);
gen.writeObjectField("count", query.getTotalRow()); gen.writeNumberField("count", query.getTotalRow());
gen.writeObjectField("data", query.getList()); gen.writeObjectField("data", query.getList());
} else { } else {
gen.writeObjectField("data", data); gen.writeObjectField("data", data);
......
...@@ -95,6 +95,7 @@ public class JsonBeanProcessor extends BeanProcessor { ...@@ -95,6 +95,7 @@ public class JsonBeanProcessor extends BeanProcessor {
} else { } else {
/*复杂结果集映射,取消TailBean的便利性*/ /*复杂结果集映射,取消TailBean的便利性*/
rs.absolute(0); rs.absolute(0);
mapping.setNestedRows(null);
fillMappingRow(rs, mapping); fillMappingRow(rs, mapping);
results = convertMapping(mapping, type); results = convertMapping(mapping, type);
} }
...@@ -131,6 +132,7 @@ public class JsonBeanProcessor extends BeanProcessor { ...@@ -131,6 +132,7 @@ public class JsonBeanProcessor extends BeanProcessor {
} else { } else {
/*复杂结果集映射,取消TailBean的便利性*/ /*复杂结果集映射,取消TailBean的便利性*/
rs.absolute(0); rs.absolute(0);
mapping.getNestedRows().clear();
fillMappingRow(rs, mapping); fillMappingRow(rs, mapping);
results = convertMapping(mapping, type); results = convertMapping(mapping, type);
} }
......
...@@ -3,20 +3,22 @@ getAllRoutes ...@@ -3,20 +3,22 @@ getAllRoutes
=== ===
```sql ```sql
select router.id,
router.PARENT_ID, select menu.id,
ifnull(router.ACCESS_URL, '/error/404') path, menu.PARENT_MENU_ID PARENT_ID,
router.NAME, menu.NAME title,
menu.NAME title,
menu.ICON, menu.ICON,
ifnull(menu.SEQ, 999999) seq, ifnull(menu.SEQ, 999999) seq,
crm.ROLE_ID route.ACCESS_URL path,
from core_function router route.NAME,
left join core_menu menu on menu.FUNCTION_ID = router.ID role_menu.ROLE_ID
left join core_role_menu crm on crm.MENU_ID = menu.id from core_menu menu
order by router.ID left join core_function route on route.ID = menu.FUNCTION_ID
left join core_role_menu role_menu on role_menu.MENU_ID = menu.id
where menu.TYPE!='MENU_S'
``` ```
>- mapping("RouteMapping"); @ mapping("RouteMapping");
RouteMapping RouteMapping
=== ===
......
...@@ -36,15 +36,30 @@ SELECT router.id, ...@@ -36,15 +36,30 @@ SELECT router.id,
menu.NAME title, menu.NAME title,
menu.ICON, menu.ICON,
IFNULL(menu.SEQ, -9999) seq, IFNULL(menu.SEQ, -9999) seq,
crm.ROLE_ID (select from core_role_menu crm where crm.
FROM core_function router FROM core_function router
LEFT JOIN core_menu menu LEFT JOIN core_menu menu
ON menu.FUNCTION_ID = router.ID ON menu.FUNCTION_ID = router.ID;
LEFT JOIN core_role_menu crm
ON crm.MENU_ID = menu.id;
select * select router.id,
from core_function; router.PARENT_ID,
IFNULL(router.ACCESS_URL, '/error/404') path,
router.NAME,
menu.NAME title,
menu.ICON,
IFNULL(menu.SEQ, -9999) seq,
from core_menu cm left join core_function cf on cf.id=cm.function_id
union
select router.id,
router.PARENT_ID,
IFNULL(router.ACCESS_URL, '/error/404') path,
router.NAME,
menu.NAME title,
menu.ICON,
IFNULL(menu.SEQ, -9999) seq,
from core_menu cm right join core_function cf on cf.id=cm.function_id;
-- 分为系统,导航,菜单。系统是顶部菜单,导航就是父菜单,菜单是导航的子菜单 -- 分为系统,导航,菜单。系统是顶部菜单,导航就是父菜单,菜单是导航的子菜单
select cm.*, select cm.*,
......
This diff is collapsed.
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId> <artifactId>spring-boot-starter-undertow</artifactId>
</dependency> </dependency>
<dependency> <!-- <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment