diff --git a/tigon-mybatis/pom.xml b/tigon-mybatis/pom.xml index 94cb4cd..3a94f57 100644 --- a/tigon-mybatis/pom.xml +++ b/tigon-mybatis/pom.xml @@ -87,5 +87,11 @@ javax.el-api test + + org.springframework.data + spring-data-commons + 1.13.1.RELEASE + test + diff --git a/tigon-mybatis/src/test/java/me/chyxion/tigon/mybatis/test/TestDriver.java b/tigon-mybatis/src/test/java/me/chyxion/tigon/mybatis/test/TestDriver.java index 32cf6ff..b955734 100644 --- a/tigon-mybatis/src/test/java/me/chyxion/tigon/mybatis/test/TestDriver.java +++ b/tigon-mybatis/src/test/java/me/chyxion/tigon/mybatis/test/TestDriver.java @@ -1,11 +1,15 @@ package me.chyxion.tigon.mybatis.test; import lombok.extern.slf4j.Slf4j; +import me.chyxion.tigon.mybatis.test.model.Activity; import org.junit.Test; +import org.springframework.data.repository.query.parser.Part; +import org.springframework.data.repository.query.parser.PartTree; import org.w3c.dom.Document; import org.xml.sax.SAXException; import javax.xml.parsers.*; import java.io.IOException; +import java.util.Iterator; import java.util.Map; import org.xml.sax.helpers.DefaultHandler; import me.chyxion.tigon.mybatis.BaseMapper; @@ -75,4 +79,19 @@ public class TestDriver { long timeElapse = System.currentTimeMillis() - timeStart; System.err.println("Time Elapse: " + timeElapse); } + + @Test + public void testParse() { + PartTree tree = new PartTree("findByIdAndHoldingDateOrderById", Activity.class); + Iterator iterator = tree.iterator(); + while (iterator.hasNext()) { + log.info("OrPart [{}].", iterator.next()); + } + for (Part part : tree.getParts()) { + System.err.println(part); + } + System.err.println(tree); + // tree = new PartTree("listByIdOrLastName", Customer.class); + // System.err.println(tree); + } } diff --git a/tigon-webmvc-core/src/main/java/me/chyxion/tigon/webmvc/TigonWebMvcConfiguration.java b/tigon-webmvc-core/src/main/java/me/chyxion/tigon/webmvc/TigonWebMvcConfiguration.java index 8890800..929380b 100644 --- a/tigon-webmvc-core/src/main/java/me/chyxion/tigon/webmvc/TigonWebMvcConfiguration.java +++ b/tigon-webmvc-core/src/main/java/me/chyxion/tigon/webmvc/TigonWebMvcConfiguration.java @@ -20,7 +20,6 @@ import org.springframework.web.servlet.config.annotation.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.web.servlet.i18n.CookieLocaleResolver; -import me.chyxion.tigon.webmvc.converter.StringToDateTypeConverter; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver; import me.chyxion.tigon.webmvc.formatter.TrimAnnotationFormatterFactory; @@ -52,8 +51,6 @@ public class TigonWebMvcConfiguration extends WebMvcConfigurationSupport { public void addFormatters(FormatterRegistry registry) { super.addFormatters(registry); // converters - registry.addConverter(new StringToDateTypeConverter()); - registry.addConverter(new StringToDateTypeConverter()); registry.addConverter(new StringToJSONObjectTypeConverter()); registry.addConverter(new StringToJSONArrayTypeConverter()); diff --git a/tigon-webmvc-core/src/main/java/me/chyxion/tigon/webmvc/converter/StringToDateTypeConverter.java b/tigon-webmvc-core/src/main/java/me/chyxion/tigon/webmvc/converter/StringToDateTypeConverter.java deleted file mode 100644 index b4d20df..0000000 --- a/tigon-webmvc-core/src/main/java/me/chyxion/tigon/webmvc/converter/StringToDateTypeConverter.java +++ /dev/null @@ -1,31 +0,0 @@ -package me.chyxion.tigon.webmvc.converter; - -import java.util.Date; -import org.apache.commons.lang3.StringUtils; -import org.springframework.core.convert.converter.Converter; - -/** - * @version 0.0.1 - * @since 0.0.1 - * @author Shaun Chyxion
- * chyxion@163.com
- * Oct 19, 2015 7:45:36 PM - */ -public class StringToDateTypeConverter - implements Converter { - - /** - * {@inheritDoc} - */ - @Override - public Date convert(String text) { - try { - return StringUtils.isNotBlank(text) ? - new Date(Long.parseLong(text.trim())) : null; - } - catch (NumberFormatException e) { - throw new IllegalArgumentException( - "Invalid Date [" + text + "] Param", e); - } - } -} diff --git a/tigon-webmvc-spring-boot/src/main/java/me/chyxion/tigon/webmvc/springboot/TigonWebMvcSpringBootConfiguration.java b/tigon-webmvc-spring-boot/src/main/java/me/chyxion/tigon/webmvc/springboot/TigonWebMvcSpringBootConfiguration.java index ae7561c..c11fdce 100644 --- a/tigon-webmvc-spring-boot/src/main/java/me/chyxion/tigon/webmvc/springboot/TigonWebMvcSpringBootConfiguration.java +++ b/tigon-webmvc-spring-boot/src/main/java/me/chyxion/tigon/webmvc/springboot/TigonWebMvcSpringBootConfiguration.java @@ -22,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.web.servlet.mvc.WebContentInterceptor; import org.springframework.web.servlet.i18n.CookieLocaleResolver; -import me.chyxion.tigon.webmvc.converter.StringToDateTypeConverter; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver; @@ -56,8 +55,6 @@ public class TigonWebMvcSpringBootConfiguration extends WebMvcConfigurerAdapter public void addFormatters(FormatterRegistry registry) { super.addFormatters(registry); // converters - registry.addConverter(new StringToDateTypeConverter()); - registry.addConverter(new StringToDateTypeConverter()); registry.addConverter(new StringToJSONObjectTypeConverter()); registry.addConverter(new StringToJSONArrayTypeConverter());