fix import; update .gradle; add ISpecificQuery
This commit is contained in:
12
build.gradle
12
build.gradle
@@ -15,16 +15,10 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
|
||||||
ext {
|
|
||||||
version '2.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
group 'com.synebula'
|
|
||||||
version version
|
|
||||||
}
|
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
|
group 'com.synebula'
|
||||||
|
version '1.0.0'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|||||||
@@ -15,16 +15,12 @@ dependencies {
|
|||||||
api group: 'net.sf.dozer', name: 'dozer', version: '5.5.1'
|
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: '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.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'
|
api group: 'com.auth0', name: 'java-jwt', version: '3.14.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
publish(MavenPublication) {
|
publish(MavenPublication) {
|
||||||
group 'com.synebula'
|
|
||||||
artifactId 'gaea.app'
|
|
||||||
version "$version"
|
|
||||||
from components.java
|
from components.java
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package com.synebula.gaea.app
|
package com.synebula.gaea.app
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken
|
|
||||||
import com.synebula.gaea.app.cmd.ISimpleCommandApp
|
import com.synebula.gaea.app.cmd.ISimpleCommandApp
|
||||||
import com.synebula.gaea.app.query.IQueryApp
|
import com.synebula.gaea.app.query.IQueryApp
|
||||||
import com.synebula.gaea.data.serialization.json.IJsonSerializer
|
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.model.IAggregateRoot
|
||||||
import com.synebula.gaea.domain.service.ISimpleService
|
import com.synebula.gaea.domain.service.ISimpleService
|
||||||
import com.synebula.gaea.log.ILogger
|
import com.synebula.gaea.log.ILogger
|
||||||
@@ -31,8 +29,3 @@ open class SimpleApplication<TRoot : IAggregateRoot<ID>, ID>(
|
|||||||
@Resource
|
@Resource
|
||||||
override var jsonSerializer: IJsonSerializer? = null
|
override var jsonSerializer: IJsonSerializer? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
|
||||||
val rawType = TypeToken.of(AggregateRoot::class.java).types.rawTypes()
|
|
||||||
println(rawType)
|
|
||||||
}
|
|
||||||
@@ -1,42 +1,8 @@
|
|||||||
package com.synebula.gaea.app.component.bus
|
package com.synebula.gaea.app.component.bus
|
||||||
|
|
||||||
import com.google.common.eventbus.AsyncEventBus
|
import com.synebula.gaea.bus.Bus
|
||||||
import com.google.common.eventbus.EventBus
|
|
||||||
import com.synebula.gaea.bus.IMessage
|
|
||||||
import com.synebula.gaea.bus.IMessageBus
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.util.concurrent.Executors
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
class EventBus : IMessageBus {
|
class EventBus : Bus()
|
||||||
|
|
||||||
/**
|
|
||||||
* 同步事件总线
|
|
||||||
*/
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.synebula.gaea.app.component.bus
|
package com.synebula.gaea.app.component.bus
|
||||||
|
|
||||||
import com.google.common.eventbus.Subscribe
|
import com.synebula.gaea.bus.IBus
|
||||||
import com.synebula.gaea.bus.IMessageBus
|
import com.synebula.gaea.bus.Subscribe
|
||||||
import org.springframework.beans.BeansException
|
import org.springframework.beans.BeansException
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.beans.factory.config.BeanPostProcessor
|
import org.springframework.beans.factory.config.BeanPostProcessor
|
||||||
@@ -14,7 +14,7 @@ class EventBusSubscriberProcessor : BeanPostProcessor {
|
|||||||
|
|
||||||
// 事件总线bean由Spring IoC容器负责创建,这里只需要通过@Autowired注解注入该bean即可使用事件总线
|
// 事件总线bean由Spring IoC容器负责创建,这里只需要通过@Autowired注解注入该bean即可使用事件总线
|
||||||
@Autowired
|
@Autowired
|
||||||
var messageBus: IMessageBus? = null
|
var messageBus: IBus<Any>? = null
|
||||||
|
|
||||||
@Throws(BeansException::class)
|
@Throws(BeansException::class)
|
||||||
override fun postProcessBeforeInitialization(bean: Any, beanName: String): Any {
|
override fun postProcessBeforeInitialization(bean: Any, beanName: String): Any {
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ dependencies {
|
|||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
publish(MavenPublication) {
|
publish(MavenPublication) {
|
||||||
group 'com.synebula'
|
|
||||||
artifactId 'gaea.mongo'
|
|
||||||
version "$version"
|
|
||||||
from components.java
|
from components.java
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
publish(MavenPublication) {
|
publish(MavenPublication) {
|
||||||
group 'com.synebula'
|
group "${project.group}"
|
||||||
artifactId 'gaea'
|
artifactId "${project.name}"
|
||||||
version "$version"
|
version "$version"
|
||||||
from components.java
|
from components.java
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* @author alex
|
||||||
*/
|
*/
|
||||||
interface ISpecificRepository<TAggregateRoot : IAggregateRoot<ID>, ID> {
|
interface ISpecificRepository<TAggregateRoot : IAggregateRoot<ID>, ID> {
|
||||||
|
|||||||
@@ -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>
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user