fix import; update .gradle; add ISpecificQuery

This commit is contained in:
2022-07-29 15:28:14 +08:00
parent 29ad3073a8
commit b7cfd0a7f9
9 changed files with 61 additions and 66 deletions

View File

@@ -15,16 +15,10 @@ buildscript {
}
}
allprojects {
ext {
version '2.0'
}
group 'com.synebula'
version version
}
subprojects {
group 'com.synebula'
version '1.0.0'
buildscript {
repositories {
mavenLocal()

View File

@@ -15,16 +15,12 @@ dependencies {
api group: 'net.sf.dozer', name: 'dozer', version: '5.5.1'
api group: 'org.apache.poi', name: 'poi-ooxml', version: '5.0.0'
api group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
api group: 'com.google.guava', name: 'guava', version: '31.1-jre'
api group: 'com.auth0', name: 'java-jwt', version: '3.14.0'
}
publishing {
publications {
publish(MavenPublication) {
group 'com.synebula'
artifactId 'gaea.app'
version "$version"
from components.java
}
}

View File

@@ -1,10 +1,8 @@
package com.synebula.gaea.app
import com.google.common.reflect.TypeToken
import com.synebula.gaea.app.cmd.ISimpleCommandApp
import com.synebula.gaea.app.query.IQueryApp
import com.synebula.gaea.data.serialization.json.IJsonSerializer
import com.synebula.gaea.domain.model.AggregateRoot
import com.synebula.gaea.domain.model.IAggregateRoot
import com.synebula.gaea.domain.service.ISimpleService
import com.synebula.gaea.log.ILogger
@@ -31,8 +29,3 @@ open class SimpleApplication<TRoot : IAggregateRoot<ID>, ID>(
@Resource
override var jsonSerializer: IJsonSerializer? = null
}
fun main() {
val rawType = TypeToken.of(AggregateRoot::class.java).types.rawTypes()
println(rawType)
}

View File

@@ -1,42 +1,8 @@
package com.synebula.gaea.app.component.bus
import com.google.common.eventbus.AsyncEventBus
import com.google.common.eventbus.EventBus
import com.synebula.gaea.bus.IMessage
import com.synebula.gaea.bus.IMessageBus
import com.synebula.gaea.bus.Bus
import org.springframework.stereotype.Component
import java.util.concurrent.Executors
@Component
class EventBus : IMessageBus {
/**
* 同步事件总线
*/
var eventBus = EventBus()
/**
* 异步事件总线
*/
var asyncEventBus = AsyncEventBus(Executors.newFixedThreadPool(2))
override fun register(obj: Any) {
eventBus.register(obj)
asyncEventBus.register(obj)
}
override fun unregister(obj: Any) {
eventBus.unregister(obj)
asyncEventBus.unregister(obj)
}
override fun publish(message: IMessage) {
eventBus.post(message)
}
override fun publishAsync(message: IMessage) {
asyncEventBus.post(message)
}
}
class EventBus : Bus()

View File

@@ -1,7 +1,7 @@
package com.synebula.gaea.app.component.bus
import com.google.common.eventbus.Subscribe
import com.synebula.gaea.bus.IMessageBus
import com.synebula.gaea.bus.IBus
import com.synebula.gaea.bus.Subscribe
import org.springframework.beans.BeansException
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.config.BeanPostProcessor
@@ -14,7 +14,7 @@ class EventBusSubscriberProcessor : BeanPostProcessor {
// 事件总线bean由Spring IoC容器负责创建这里只需要通过@Autowired注解注入该bean即可使用事件总线
@Autowired
var messageBus: IMessageBus? = null
var messageBus: IBus<Any>? = null
@Throws(BeansException::class)
override fun postProcessBeforeInitialization(bean: Any, beanName: String): Any {

View File

@@ -6,9 +6,6 @@ dependencies {
publishing {
publications {
publish(MavenPublication) {
group 'com.synebula'
artifactId 'gaea.mongo'
version "$version"
from components.java
}
}

View File

@@ -1,8 +1,8 @@
publishing {
publications {
publish(MavenPublication) {
group 'com.synebula'
artifactId 'gaea'
group "${project.group}"
artifactId "${project.name}"
version "$version"
from components.java
}

View File

@@ -5,9 +5,9 @@ import com.synebula.gaea.domain.model.IAggregateRoot
/**
* 继承本接口表示对象为仓储类。
* 定义了提供增删改的仓储接口。
* 本接口泛型定义在类上不需要显式提供聚合根的class对象class对象作为类的成员变量声明。
* 本接口泛型定义在类上,方法中不需要显式提供聚合根的class对象class对象作为类的成员变量声明。
*
* @param <TAggregateRoot> this T is the parameter
* @param TAggregateRoot 聚合根类型
* @author alex
*/
interface ISpecificRepository<TAggregateRoot : IAggregateRoot<ID>, ID> {

View File

@@ -0,0 +1,49 @@
package com.synebula.gaea.query
/**
* 查询基接口。
* 本接口泛型定义在类上方法中不需要显式提供聚合根的class对象class对象作为类的成员变量声明。
* @author alex
*/
interface ISpecificQuery<TView> {
/**
* 根据Key获取对象。
*
* @param id 对象Key。
* @return 视图结果
*/
fun <TView, ID> get(id: ID): TView?
/**
* 根据实体类条件查询所有符合条件记录
*
* @param params 查询条件。
* @return 视图列表
*/
fun <TView> list(params: Map<String, Any>?): List<TView>
/**
* 根据条件查询符合条件记录的数量
*
* @param params 查询条件。
* @return 数量
*/
fun <TView> count(params: Map<String, Any>?): Int
/**
* 根据实体类条件查询所有符合条件记录(分页查询)
*
* @param params 分页条件
* @return 分页数据
*/
fun <TView> paging(params: Params): Page<TView>
/**
* 查询条件范围内数据。
* @param field 查询字段
* @param params 查询条件
*
* @return 视图列表
*/
fun <TView> range(field: String, params: List<Any>): List<TView>
}