重构query,拆分功能
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
publish(MavenPublication) {
|
||||
group 'com.synebula'
|
||||
artifactId 'gaea'
|
||||
version "$version"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.synebula.gaea.data.date
|
||||
|
||||
import com.synebula.gaea.data.type.TimeUnit
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@@ -73,8 +72,6 @@ class DateTime : Comparable<DateTime> {
|
||||
return DateTime(instance)
|
||||
}
|
||||
|
||||
constructor()
|
||||
|
||||
/**
|
||||
* 从Date格式转化
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.synebula.gaea.data.date
|
||||
|
||||
import com.synebula.gaea.data.type.TimeUnit
|
||||
|
||||
object TimeExchanger {
|
||||
/**
|
||||
* 转换率。分别对应:毫秒、秒、分、时、日
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.synebula.gaea.data.type
|
||||
package com.synebula.gaea.data.date
|
||||
|
||||
enum class TimeUnit {
|
||||
Millisecond,
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.synebula.gaea.data.type
|
||||
|
||||
/**
|
||||
* 数据操作类型。包括创建、更新和删除。
|
||||
* @author alex
|
||||
* @version 0.0.1
|
||||
* @since 2016年8月17日 下午2:48:29
|
||||
*/
|
||||
enum class DataOperateType {
|
||||
Create,
|
||||
|
||||
Update,
|
||||
|
||||
Remove
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.synebula.gaea.data.type
|
||||
|
||||
/*
|
||||
* 排序枚举
|
||||
*/
|
||||
enum class SortDirectionEnum {
|
||||
/*
|
||||
* 升序
|
||||
*/
|
||||
ASC,
|
||||
|
||||
/*
|
||||
* 降序
|
||||
*/
|
||||
DESC
|
||||
}
|
||||
@@ -9,6 +9,6 @@ import java.util.*
|
||||
* @version 0.1
|
||||
* @since 2020-05-15
|
||||
*/
|
||||
class Command : ICommand {
|
||||
open class Command : ICommand {
|
||||
override var timestamp = 0L
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.synebula.gaea.extension
|
||||
|
||||
import java.lang.reflect.Field
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* 系统类型
|
||||
*/
|
||||
val SystemClasses = arrayOf(
|
||||
"String",
|
||||
"Date",
|
||||
"Int",
|
||||
"Double",
|
||||
"Float",
|
||||
"BigDecimal",
|
||||
"Decimal")
|
||||
|
||||
/**
|
||||
* 深度获取所有字段信息字符串列表。
|
||||
* @param prefix 前缀字符串
|
||||
*/
|
||||
fun Class<*>.fields(prefix: String = ""): List<String> {
|
||||
val names = mutableListOf<String>()
|
||||
this.declaredFields.forEach { field ->
|
||||
val fullName = if (prefix.isNotEmpty()) "$prefix.${field.name}" else field.name
|
||||
names.add(fullName)
|
||||
if (!field.type.isPrimitive && !field.type.isArray && !SystemClasses.contains(field.type.simpleName)) {
|
||||
names.addAll(field.type.fields(fullName))
|
||||
}
|
||||
}
|
||||
return names
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.synebula.gaea.data.date
|
||||
package com.synebula.gaea.extension
|
||||
|
||||
import com.synebula.gaea.data.date.TimeSpan
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ interface IQueryTyped {
|
||||
* @param params 查询条件。
|
||||
* @return list
|
||||
*/
|
||||
fun <TView, TKey> list(params: Map<String, Any>?, clazz: Class<TView>): List<TView>
|
||||
fun <TView> list(params: Map<String, Any>?, clazz: Class<TView>): List<TView>
|
||||
|
||||
/**
|
||||
* 根据条件查询符合条件记录的数量
|
||||
@@ -28,7 +28,7 @@ interface IQueryTyped {
|
||||
* @param params 查询条件。
|
||||
* @return int
|
||||
*/
|
||||
fun <TView, TKey> count(params: Map<String, Any>?, clazz: Class<TView>): Int
|
||||
fun <TView> count(params: Map<String, Any>?, clazz: Class<TView>): Int
|
||||
|
||||
/**
|
||||
* 根据实体类条件查询所有符合条件记录(分页查询)
|
||||
@@ -36,5 +36,5 @@ interface IQueryTyped {
|
||||
* @param params 分页条件
|
||||
* @return 分页数据
|
||||
*/
|
||||
fun <TView, TKey> paging(params: PagingParam, clazz: Class<TView>): PagingData<TView>
|
||||
fun <TView> paging(params: PagingParam, clazz: Class<TView>): PagingData<TView>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user