重新命名类型和泛型相关的repo/srv/query

This commit is contained in:
2020-05-22 16:31:26 +08:00
parent f4db771261
commit 2d0de09816
24 changed files with 423 additions and 412 deletions

View File

@@ -1,7 +1,7 @@
package com.synebula.gaea.app
import com.synebula.gaea.app.cmd.ICommandApp
import com.synebula.gaea.app.query.IQueryGenericApp
import com.synebula.gaea.app.query.IQueryTypedApp
import com.synebula.gaea.data.serialization.json.IJsonSerializer
import com.synebula.gaea.domain.service.ICommand
import com.synebula.gaea.domain.service.IService
@@ -18,11 +18,12 @@ import javax.annotation.Resource
* @param logger 日志组件
*/
open class UnionApp<TCommand : ICommand, TView, TKey>(
override var name: String,
override var service: IService<TKey>?,
override var query: IQuery<TView, TKey>?,
override var logger: ILogger)
: ICommandApp<TCommand, TKey>, IQueryGenericApp<TView, TKey> {
override var name: String,
override var clazz: Class<TView>,
override var service: IService<TKey>?,
override var query: IQuery?,
override var logger: ILogger)
: ICommandApp<TCommand, TKey>, IQueryTypedApp<TView, TKey> {
@Resource
override var jsonSerializer: IJsonSerializer? = null

View File

@@ -2,13 +2,11 @@ package com.synebula.gaea.app
import com.synebula.gaea.app.cmd.ICommandApp
import com.synebula.gaea.app.query.IQueryGenericApp
import com.synebula.gaea.app.query.IQueryTypedApp
import com.synebula.gaea.data.serialization.json.IJsonSerializer
import com.synebula.gaea.domain.service.ICommand
import com.synebula.gaea.domain.service.IService
import com.synebula.gaea.log.ILogger
import com.synebula.gaea.query.IQuery
import com.synebula.gaea.query.IQueryTyped
import com.synebula.gaea.query.IGenericQuery
import javax.annotation.Resource
/**
@@ -19,13 +17,12 @@ import javax.annotation.Resource
* @param query 业务查询服务
* @param logger 日志组件
*/
open class UnionTypedApp<TCommand : ICommand, TView, TKey>(
override var name: String,
override var viewClass: Class<TView>,
override var service: IService<TKey>?,
override var query: IQueryTyped?,
override var logger: ILogger)
: ICommandApp<TCommand, TKey>, IQueryTypedApp<TView, TKey> {
open class UnionGenericApp<TCommand : ICommand, TView, TKey>(
override var name: String,
override var service: IService<TKey>?,
override var query: IGenericQuery<TView, TKey>?,
override var logger: ILogger
) : ICommandApp<TCommand, TKey>, IQueryGenericApp<TView, TKey> {
@Resource
override var jsonSerializer: IJsonSerializer? = null

View File

@@ -1,13 +1,9 @@
package com.synebula.gaea.app.query
import com.synebula.gaea.app.IApplication
import com.synebula.gaea.app.component.HttpMessage
import com.synebula.gaea.data.message.Status
import com.synebula.gaea.query.IQuery
import com.synebula.gaea.query.IGenericQuery
import com.synebula.gaea.query.PagingParam
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestParam
/**
* 应用类接口提供实现Query服务的接口
@@ -21,7 +17,7 @@ interface IQueryGenericApp<TView, TKey> : IQueryApp<TView, TKey> {
/**
* 查询服务
*/
var query: IQuery<TView, TKey>?
var query: IGenericQuery<TView, TKey>?
/**

View File

@@ -1,9 +1,8 @@
package com.synebula.gaea.app.query
import com.synebula.gaea.app.IApplication
import com.synebula.gaea.app.component.HttpMessage
import com.synebula.gaea.data.message.Status
import com.synebula.gaea.query.IQueryTyped
import com.synebula.gaea.query.IQuery
import com.synebula.gaea.query.PagingParam
/**
@@ -14,26 +13,26 @@ import com.synebula.gaea.query.PagingParam
* @version 0.1
* @since 2020-05-15
*/
interface IQueryTypedApp<TView, TKey> : IApplication, IQueryApp<TView, TKey> {
interface IQueryTypedApp<TView, TKey> : IQueryApp<TView, TKey> {
/**
* 查询服务
*/
var query: IQueryTyped?
var query: IQuery?
/**
* 查询的View类型
*/
var viewClass: Class<TView>
var clazz: Class<TView>
override fun doGet(key: TKey): HttpMessage {
return this.doQuery("获取${this.name}数据失败") {
this.query!!.get(key, viewClass)
this.query!!.get(key, clazz)
}
}
override fun doList(params: Map<String, Any>): HttpMessage {
return this.doQuery("获取${this.name}列表数据失败") {
this.query!!.list(params, viewClass)
this.query!!.list(params, clazz)
}
}
@@ -41,7 +40,7 @@ interface IQueryTypedApp<TView, TKey> : IApplication, IQueryApp<TView, TKey> {
return this.doQuery("获取${this.name}分页数据[条数:$size,页码:$page]失败") {
val data = PagingParam(page, size)
data.parameters = params
this.query!!.paging(data, viewClass)
this.query!!.paging(data, clazz)
}
}

View File

@@ -1,17 +1,18 @@
package com.synebula.gaea.app.query
import com.synebula.gaea.log.ILogger
import com.synebula.gaea.query.IQuery
import com.synebula.gaea.query.IGenericQuery
/**
* 联合服务同时实现了ICommandApp和IQueryApp接口
*
* @param name 业务名称
* @param query 业务查询服务
* @param genericQuery 业务查询服务
* @param logger 日志组件
*/
open class QueryGenericApp<TView, TKey>(
override var name: String,
override var query: IQuery<TView, TKey>?,
override var logger: ILogger) : IQueryGenericApp<TView, TKey> {
override var name: String,
override var query: IGenericQuery<TView, TKey>?,
override var logger: ILogger
) : IQueryGenericApp<TView, TKey> {
}

View File

@@ -1,7 +1,7 @@
package com.synebula.gaea.app.query
import com.synebula.gaea.log.ILogger
import com.synebula.gaea.query.IQueryTyped
import com.synebula.gaea.query.IQuery
/**
* 联合服务同时实现了ICommandApp和IQueryApp接口
@@ -11,8 +11,8 @@ import com.synebula.gaea.query.IQueryTyped
* @param logger 日志组件
*/
open class QueryTypedApp<TView, TKey>(
override var name: String,
override var viewClass: Class<TView>,
override var query: IQueryTyped?,
override var logger: ILogger) : IQueryTypedApp<TView, TKey> {
override var name: String,
override var clazz: Class<TView>,
override var query: IQuery?,
override var logger: ILogger) : IQueryTypedApp<TView, TKey> {
}