Commit ab2df3cc authored by zengchao's avatar zengchao
Browse files

预备自定义Beanprocessor的算法测试初期工作

也许无法成功
parent e8e8dfd5
......@@ -8,15 +8,15 @@ import org.springframework.cache.annotation.EnableCaching;
@SpringBootApplication
@EnableCaching
public class CosonleApplication extends SpringBootServletInitializer {
public class ConsoleApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(CosonleApplication.class);
return application.sources(ConsoleApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(CosonleApplication.class, args);
SpringApplication.run(ConsoleApplication.class, args);
}
}
import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.ibeetl.admin.ConsoleApplication;
import com.ibeetl.admin.core.dao.CoreFunctionDao;
import com.ibeetl.admin.core.entity.CoreRoute;
import com.ibeetl.admin.core.entity.CoreRouteMeta;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ConsoleApplication.class)
public class BeanProcessor {
@Autowired CoreFunctionDao coreFunctionDao;
static JSONObject resultMap;
@BeforeClass
public static void init() {
resultMap = new JSONObject();
resultMap.put("id", "resultmap");
JSONObject mapping = new JSONObject();
mapping.put("id", "id");
mapping.put("parentId", "parent_id");
mapping.put("path", "path");
mapping.put("name", "name");
mapping.put("seq", "seq");
JSONObject objMap = new JSONObject();
objMap.put("title", "title");
objMap.put("icon", "icon");
objMap.put("resultType", CoreRouteMeta.class.getCanonicalName());
mapping.put("obj_mapping" + IdUtil.fastSimpleUUID(), objMap);
JSONArray listMap = new JSONArray();
JSONObject listInnerMap = new JSONObject();
listInnerMap.put("id", "role_id");
listMap.add(listInnerMap);
mapping.put("list_mapping" + IdUtil.fastSimpleUUID(), listMap);
resultMap.put("map", mapping);
}
@Test
public void maptest() {
List<CoreRoute> routesList = coreFunctionDao.getAllRoutes();
System.out.println(JSONUtil.toJsonStr(resultMap));
}
}
......@@ -78,6 +78,7 @@ public class BeetlConf {
@Bean
public WebSimulate getWebSimulate(GroupTemplate gt, ObjectMapper objectMapper) {
return new WebSimulate(gt, new ObjectMapperJsonUtil(objectMapper)) {
@Override
protected String getRenderPath(HttpServletRequest request) {
String defaultRenderPath = request.getServletPath();
return defaultRenderPath.replace(".do", ".html");
......@@ -88,7 +89,6 @@ public class BeetlConf {
@Bean
public SQLManager sqlManager(
@Qualifier("baseDataSourceSqlManagerFactoryBean") SQLManager sqlManager) {
Map<Class, JavaSqlTypeHandler> typeHandlerMap = sqlManager.getDefaultBeanProcessors().getHandlers();
/*Java bean的属性类型处理器,从数据库类型转化到属性Date类型*/
typeHandlerMap.remove(Date.class);
......@@ -171,6 +171,7 @@ public class BeetlConf {
}
static class StarterDebugInterceptor extends DebugInterceptor {
@Override
protected boolean isSimple(String sqlId) {
if (sqlId.indexOf("_gen_") != -1) {
return true;
......@@ -179,6 +180,7 @@ public class BeetlConf {
}
}
@Override
protected void simpleOut(InterceptorContext ctx) {
return;
}
......
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