add list anno

This commit is contained in:
东皇 2018-06-26 20:29:15 +08:00
parent dcbee28e48
commit c45293cb20
4 changed files with 123 additions and 1 deletions

View File

@ -198,7 +198,37 @@ public class Search implements Serializable {
* @return this
*/
public Search like(String col, String value, boolean wrapValue) {
return like(col, wrapValue ? "%" + value + "%" : value);
return wrapValue ? contains(col, value) : like(col, value);
}
/**
* col contains value
* @param col col name
* @param value value
* @return this
*/
public Search contains(final String col, final String value) {
return like(col, "%" + value + "%");
}
/**
* col starts with value
* @param col col name
* @param value value
* @return this
*/
public Search startsWith(final String col, final String value) {
return like(col, value + "%");
}
/**
* col ends with value
* @param col col name
* @param value value
* @return this
*/
public Search endsWith(final String col, final String value) {
return like(col, "%" + value);
}
/**

View File

@ -0,0 +1,33 @@
package me.chyxion.tigon.webmvc.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.Documented;
import java.lang.annotation.RetentionPolicy;
/**
* @author Shaun Chyxion <br>
* chyxion@163.com <br>
* Jun 26, 2018 17:58:20
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface CriterionCol {
/**
* http request param name
* @return http request param
*/
String param();
/**
* database table col
* @return database table col
*/
String col();
/**
* database table col java type
* @return database table col java type
*/
Class<?> type();
}

View File

@ -0,0 +1,32 @@
package me.chyxion.tigon.webmvc.annotation;
import java.lang.annotation.*;
/**
* @author Shaun Chyxion <br>
* chyxion@163.com <br>
* Jun 26, 2018 17:57:46
*/
@Documented
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ListApi {
/**
* search cols
* @return search cols
*/
String[] searchCols() default {};
/**
* order cols
* @return order cols
*/
OrderCol[] orderCols() default {};
/**
* criterion cols
* @return criterion cols
*/
CriterionCol[] criterionCols() default {};
}

View File

@ -0,0 +1,27 @@
package me.chyxion.tigon.webmvc.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.Documented;
import java.lang.annotation.RetentionPolicy;
/**
* @author Shaun Chyxion <br>
* chyxion@163.com <br>
* Jun 26, 2018 17:58:09
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface OrderCol {
/**
* http request param
* @return http request param
*/
String param();
/**
* database table col
* @return database table col
*/
String col();
}