拆分query typed两种类型
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
rootProject.name = 'greek.gaea'
|
||||
rootProject.name = 'myths.gaea'
|
||||
include 'src:gaea'
|
||||
include 'src:gaea.app'
|
||||
include 'src:gaea.mongo'
|
||||
|
||||
@@ -28,8 +28,7 @@ interface IApplication {
|
||||
} catch (ex: Exception) {
|
||||
msg.status = Status.Error
|
||||
msg.message = if (error.isEmpty()) ex.message ?: "" else error
|
||||
msg.data = ex.message
|
||||
logger.error(this, "$error: ${ex.message}")
|
||||
logger.error(this, ex, "$error: ${ex.message}")
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
|
||||
/**
|
||||
* 应用类接口,提供向Query服务的接口
|
||||
* 应用类接口,提供实现Query服务的接口
|
||||
* 依赖查询接口 @see IQuery
|
||||
*
|
||||
* @author alex
|
||||
* @version 0.1
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.synebula.gaea.app
|
||||
|
||||
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.IQueryTyped
|
||||
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服务的接口.
|
||||
* 依赖查询接口 @see IQueryTyped
|
||||
*
|
||||
* @author alex
|
||||
* @version 0.1
|
||||
* @since 2018 18-2-8
|
||||
*/
|
||||
interface IQueryTypedApp<TView, TKey> : IApplication {
|
||||
/**
|
||||
* 查询服务
|
||||
*/
|
||||
var query: IQueryTyped?
|
||||
|
||||
var viewClass: Class<TView>
|
||||
|
||||
@GetMapping("/{key:.+}")
|
||||
fun get(@PathVariable key: TKey): HttpMessage {
|
||||
return this.safeExecute("${this.name}获取数据失败") {
|
||||
if (this.query != null)
|
||||
it.data = this.query!!.get(key, viewClass)
|
||||
else {
|
||||
it.status = Status.Error
|
||||
it.message = "没有对应服务,无法执行该操作"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
fun list(@RequestParam parameters: MutableMap<String, Any>): HttpMessage {
|
||||
return this.safeExecute("${this.name}获取数据失败") {
|
||||
if (this.query != null)
|
||||
it.data = this.query!!.list<TView, TKey>(parameters, viewClass)
|
||||
else {
|
||||
it.status = Status.Error
|
||||
it.message = "没有对应服务,无法执行该操作"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/split/{size}/pages/{page}")
|
||||
fun paging(@PathVariable page: Int, @PathVariable size: Int, @RequestParam parameters: MutableMap<String, Any>): HttpMessage {
|
||||
return this.safeExecute("${this.name}获取分页数据失败") {
|
||||
if (this.query != null) {
|
||||
val params = PagingParam(page, size)
|
||||
params.parameters = parameters
|
||||
it.data = this.query!!.paging<TView, TKey>(params, viewClass)
|
||||
} else {
|
||||
it.status = Status.Error
|
||||
it.message = "没有对应服务,无法执行该操作"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.synebula.gaea.app
|
||||
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.query.IQuery
|
||||
import com.synebula.gaea.query.IQueryTyped
|
||||
|
||||
/**
|
||||
* 联合服务,同时实现了ICommandApp和IQueryApp接口
|
||||
*
|
||||
* @param name 业务名称
|
||||
* @param query 业务查询服务
|
||||
* @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> {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.synebula.gaea.app
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* 联合服务,同时实现了ICommandApp和IQueryApp接口
|
||||
*
|
||||
* @param name 业务名称
|
||||
* @param service 业务domain服务
|
||||
* @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> {
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.lang.reflect.Field
|
||||
/**
|
||||
* 声明了Mongo查询的特有方法
|
||||
*/
|
||||
interface IMongoQuery<TView> {
|
||||
interface IMongoQuery {
|
||||
/**
|
||||
* 日志组件
|
||||
*/
|
||||
@@ -34,14 +34,14 @@ interface IMongoQuery<TView> {
|
||||
*
|
||||
* @param id 业务ID
|
||||
*/
|
||||
fun idQuery(id: String): Query = Query(Criteria("_id").isEqualTo(id))
|
||||
fun <TKey> idQuery(id: TKey): Query = Query(Criteria("_id").isEqualTo(id))
|
||||
|
||||
/**
|
||||
* 获取视图对象的字段列表
|
||||
*
|
||||
* @param clazz 视图对象类型
|
||||
*/
|
||||
fun fields(clazz: Class<TView>): List<String> {
|
||||
fun <TView> fields(clazz: Class<TView>): List<String> {
|
||||
return analyseFields(clazz.declaredFields)
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ interface IMongoQuery<TView> {
|
||||
* @param params 参数列表
|
||||
* @param clazz 视图类对象
|
||||
*/
|
||||
fun where(query: Query, params: Map<String, Any>?, clazz: Class<TView>): Query {
|
||||
fun <TView> where(query: Query, params: Map<String, Any>?, clazz: Class<TView>): Query {
|
||||
val criteria = Criteria()
|
||||
if (params != null) {
|
||||
for (param in params) {
|
||||
@@ -83,7 +83,7 @@ interface IMongoQuery<TView> {
|
||||
*/
|
||||
fun order(orders: Map<String, OrderType>?): Sort {
|
||||
val orderList = mutableListOf<Sort.Order>()
|
||||
orders?.forEach() {
|
||||
orders?.forEach {
|
||||
orderList.add(Sort.Order(Sort.Direction.valueOf(it.value.name), it.key))
|
||||
}
|
||||
return if (orderList.size == 0)
|
||||
@@ -116,7 +116,7 @@ interface IMongoQuery<TView> {
|
||||
* @param value 字段值
|
||||
* @param clazz 视图类对象
|
||||
*/
|
||||
fun changeFieldType(key: String, value: Any, clazz: Class<TView>): Any? {
|
||||
fun <TView> changeFieldType(key: String, value: Any, clazz: Class<TView>): Any? {
|
||||
val getter = clazz.getMethod("get${key.substring(0, 1).toUpperCase()}${key.substring(1)}")
|
||||
return this.convertType(value.toString(), getter.returnType)
|
||||
}
|
||||
@@ -150,4 +150,4 @@ interface IMongoQuery<TView> {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
package com.synebula.gaea.query.mongo
|
||||
|
||||
import com.synebula.gaea.extension.firstCharLowerCase
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.query.IQuery
|
||||
import com.synebula.gaea.query.PagingData
|
||||
import com.synebula.gaea.query.PagingParam
|
||||
import org.springframework.data.mongodb.core.MongoTemplate
|
||||
import org.springframework.data.mongodb.core.query.Query
|
||||
import com.synebula.gaea.extension.*
|
||||
|
||||
/**
|
||||
* 实现IQuery的Mongo查询类
|
||||
* @param repo MongoRepo对象
|
||||
*/
|
||||
open class MongoQuery<TView>(var repo: MongoTemplate, override var logger: ILogger? = null) : IQuery<TView, String>, IMongoQuery<TView> {
|
||||
open class MongoQuery<TView>(var repo: MongoTemplate, override var logger: ILogger? = null) :
|
||||
IQuery<TView, String>, IMongoQuery {
|
||||
/**
|
||||
* 查询的对象类
|
||||
*/
|
||||
var clazz: Class<TView>? = null
|
||||
|
||||
private var _collection = ""
|
||||
|
||||
/**
|
||||
* 查询的集合名称
|
||||
*/
|
||||
var collection: String = ""
|
||||
var collection: String
|
||||
set(value) {
|
||||
field = value
|
||||
this._collection = value
|
||||
}
|
||||
get() = if (this._collection.isNotEmpty())
|
||||
this._collection
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
package com.synebula.gaea.query.mongo
|
||||
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.query.*
|
||||
import org.springframework.data.domain.Sort
|
||||
import com.synebula.gaea.query.IQueryTyped
|
||||
import com.synebula.gaea.query.PagingData
|
||||
import com.synebula.gaea.query.PagingParam
|
||||
import org.springframework.data.mongodb.core.MongoTemplate
|
||||
import org.springframework.data.mongodb.core.query.Criteria
|
||||
import org.springframework.data.mongodb.core.query.Query
|
||||
import org.springframework.data.mongodb.core.query.isEqualTo
|
||||
import java.lang.reflect.Field
|
||||
|
||||
/**
|
||||
* 实现IQuery的Mongo查询类
|
||||
* @param repo MongoRepo对象
|
||||
*/
|
||||
|
||||
open class MongoTypedQuery<TView>(var repo: MongoTemplate) : ITypedQuery<TView, String>, IMongoQuery<TView> {
|
||||
override var logger: ILogger? = null
|
||||
open class MongoQueryTyped(var repo: MongoTemplate, override var logger: ILogger? = null) : IQueryTyped, IMongoQuery {
|
||||
|
||||
override fun list(params: Map<String, Any>?, clazz: Class<TView>): List<TView> {
|
||||
override fun <TView, TKey> list(params: Map<String, Any>?, clazz: Class<TView>): List<TView> {
|
||||
val viewFields = this.fields(clazz)
|
||||
val query = Query()
|
||||
this.where(query, params, clazz)
|
||||
@@ -25,12 +22,12 @@ open class MongoTypedQuery<TView>(var repo: MongoTemplate) : ITypedQuery<TView,
|
||||
return this.repo.find(query, clazz, clazz.simpleName)
|
||||
}
|
||||
|
||||
override fun count(params: Map<String, Any>?, clazz: Class<TView>): Int {
|
||||
override fun <TView, TKey> count(params: Map<String, Any>?, clazz: Class<TView>): Int {
|
||||
val query = Query()
|
||||
return this.repo.count(this.where(query, params, clazz), clazz.simpleName).toInt()
|
||||
}
|
||||
|
||||
override fun paging(params: PagingParam, clazz: Class<TView>): PagingData<TView> {
|
||||
override fun <TView, TKey> paging(params: PagingParam, clazz: Class<TView>): PagingData<TView> {
|
||||
val viewFields = this.fields(clazz)
|
||||
val result = PagingData<TView>(1, 10)
|
||||
result.size = params.size
|
||||
@@ -45,8 +42,7 @@ open class MongoTypedQuery<TView>(var repo: MongoTemplate) : ITypedQuery<TView,
|
||||
return result
|
||||
}
|
||||
|
||||
override fun get(key: String, clazz: Class<TView>): TView? {
|
||||
override fun <TView, TKey> get(key: TKey, clazz: Class<TView>): TView? {
|
||||
return this.repo.findOne(idQuery(key), clazz, clazz.simpleName)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.synebula.gaea.repository.mongo
|
||||
|
||||
import org.springframework.data.mongodb.core.query.Criteria
|
||||
import org.springframework.data.mongodb.core.query.Query
|
||||
import org.springframework.data.mongodb.core.query.isEqualTo
|
||||
|
||||
interface IMongoRepository {
|
||||
/**
|
||||
* 获取ID查询条件
|
||||
*
|
||||
* @param id 业务ID
|
||||
*/
|
||||
fun <TKey> idQuery(id: TKey): Query = Query(Criteria("_id").isEqualTo(id))
|
||||
}
|
||||
@@ -12,46 +12,39 @@ import org.springframework.data.mongodb.core.query.isEqualTo
|
||||
* @param repo MongoRepo对象
|
||||
*/
|
||||
class MongoRepository<TAggregateRoot : IAggregateRoot<String>>(private var repo: MongoTemplate)
|
||||
: IRepository<TAggregateRoot, String> {
|
||||
: IRepository<TAggregateRoot, String>, IMongoRepository {
|
||||
|
||||
/**
|
||||
* 仓储的对象类
|
||||
*/
|
||||
override var clazz: Class<TAggregateRoot>? = null
|
||||
/**
|
||||
* 仓储的对象类
|
||||
*/
|
||||
override var clazz: Class<TAggregateRoot>? = null
|
||||
|
||||
/**
|
||||
* 构造
|
||||
* @param clazz 仓储Domain对象
|
||||
* @param repo MongoRepo对象
|
||||
*/
|
||||
constructor(clazz: Class<TAggregateRoot>, repo: MongoTemplate) : this(repo) {
|
||||
this.clazz = clazz
|
||||
}
|
||||
/**
|
||||
* 构造
|
||||
* @param clazz 仓储Domain对象
|
||||
* @param repo MongoRepo对象
|
||||
*/
|
||||
constructor(clazz: Class<TAggregateRoot>, repo: MongoTemplate) : this(repo) {
|
||||
this.clazz = clazz
|
||||
}
|
||||
|
||||
override fun add(obj: TAggregateRoot) {
|
||||
this.repo.save(obj)
|
||||
}
|
||||
override fun add(obj: TAggregateRoot) {
|
||||
this.repo.save(obj)
|
||||
}
|
||||
|
||||
override fun update(obj: TAggregateRoot) {
|
||||
this.repo.save(obj)
|
||||
}
|
||||
override fun update(obj: TAggregateRoot) {
|
||||
this.repo.save(obj)
|
||||
}
|
||||
|
||||
override fun remove(id: String) {
|
||||
this.repo.remove(idQuery(id), this.clazz!!)
|
||||
}
|
||||
override fun remove(id: String) {
|
||||
this.repo.remove(idQuery(id), this.clazz!!)
|
||||
}
|
||||
|
||||
override fun get(id: String): TAggregateRoot {
|
||||
return this.repo.findOne(idQuery(id), clazz!!) as TAggregateRoot
|
||||
}
|
||||
override fun get(id: String): TAggregateRoot {
|
||||
return this.repo.findOne(idQuery(id), clazz!!) as TAggregateRoot
|
||||
}
|
||||
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> get(id: TKey, clazz: Class<TAggregateRoot>): TAggregateRoot {
|
||||
return this.repo.findOne(idQuery(id.toString()), clazz) as TAggregateRoot
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ID查询条件
|
||||
*
|
||||
* @param id 业务ID
|
||||
*/
|
||||
fun idQuery(id: String): Query = Query(Criteria("_id").isEqualTo(id))
|
||||
}
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> get(id: TKey, clazz: Class<TAggregateRoot>): TAggregateRoot {
|
||||
return this.repo.findOne(idQuery(id.toString()), clazz) as TAggregateRoot
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,28 +12,23 @@ import org.springframework.data.mongodb.core.query.isEqualTo
|
||||
* @param repo MongoRepo对象
|
||||
*/
|
||||
open class MongoRepositoryTyped(private var repo: MongoTemplate)
|
||||
: IRepositoryTyped {
|
||||
: IRepositoryTyped, IMongoRepository {
|
||||
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> remove(id: TKey, clazz: Class<TAggregateRoot>) {
|
||||
this.repo.remove(idQuery(id), clazz)
|
||||
}
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> remove(id: TKey, clazz: Class<TAggregateRoot>) {
|
||||
this.repo.remove(idQuery(id), clazz)
|
||||
}
|
||||
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> get(id: TKey, clazz: Class<TAggregateRoot>): TAggregateRoot {
|
||||
return this.repo.findOne(idQuery(id), clazz) as TAggregateRoot
|
||||
}
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> get(id: TKey, clazz: Class<TAggregateRoot>): TAggregateRoot {
|
||||
return this.repo.findOne(idQuery(id), clazz) as TAggregateRoot
|
||||
}
|
||||
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> update(obj: TAggregateRoot, clazz: Class<TAggregateRoot>) {
|
||||
this.repo.save(obj)
|
||||
}
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> update(obj: TAggregateRoot, clazz: Class<TAggregateRoot>) {
|
||||
this.repo.save(obj)
|
||||
}
|
||||
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> add(obj: TAggregateRoot, clazz: Class<TAggregateRoot>) {
|
||||
this.repo.save(obj)
|
||||
}
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>, TKey> add(obj: TAggregateRoot, clazz: Class<TAggregateRoot>) {
|
||||
this.repo.save(obj)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ID查询条件
|
||||
*
|
||||
* @param id 业务ID
|
||||
*/
|
||||
fun <TKey> idQuery(id: TKey): Query = Query(Criteria("_id").isEqualTo(id))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.synebula.gaea.domain.model.IAggregateRoot
|
||||
|
||||
/**
|
||||
* 继承本接口表示对象为仓储类。
|
||||
* 定义了提供增删改的仓储接口。
|
||||
* 本接口泛型定义在类上,不需要显式提供聚合根的class对象,class对象作为类的成员变量声明。
|
||||
*
|
||||
* @param <TAggregateRoot> this T is the parameter
|
||||
* @author alex
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.synebula.gaea.domain.repository
|
||||
|
||||
import com.synebula.gaea.domain.model.IAggregateRoot
|
||||
|
||||
/**
|
||||
* 定义了提供增删改的仓储接口。
|
||||
* 本接口泛型放置到方法上,并需要显式提供聚合根的class对象
|
||||
*/
|
||||
interface IRepositoryTyped {
|
||||
/**
|
||||
* 插入单个对象。
|
||||
|
||||
@@ -22,6 +22,4 @@ interface IService<TKey> {
|
||||
fun update(key: TKey, command: ICommand)
|
||||
|
||||
fun remove(key: TKey)
|
||||
|
||||
fun <TAggregateRoot : IAggregateRoot<TKey>> get(key: TKey, clazz: Class<TAggregateRoot>): TAggregateRoot
|
||||
}
|
||||
|
||||
@@ -50,10 +50,6 @@ open class Service<TAggregateRoot : IAggregateRoot<TKey>, TKey>(
|
||||
return this.repository.get(key)
|
||||
}
|
||||
|
||||
override fun <T : IAggregateRoot<TKey>> get(key: TKey, clazz: Class<T>): T {
|
||||
return this.repository.get(key, clazz)
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换ICommand类型到聚合根类型,默认实现,根据需要进行覆写。
|
||||
*
|
||||
|
||||
@@ -8,7 +8,8 @@ import com.synebula.gaea.log.ILogger
|
||||
|
||||
|
||||
/**
|
||||
* class FlatService
|
||||
* 依赖了IRepositoryTyped仓储借口的服务实现类 ServiceTyped
|
||||
* 该类依赖仓储接口 @see IRepositoryTyped ,需要显式提供聚合根的class对象
|
||||
*
|
||||
* @param repository 仓储对象
|
||||
* @param rootClass 聚合根类对象
|
||||
@@ -16,7 +17,7 @@ import com.synebula.gaea.log.ILogger
|
||||
* @param logger 日志组件
|
||||
* @author alex
|
||||
* @version 0.1
|
||||
* @since 2018 18-2-8
|
||||
* @since 2020-05-17
|
||||
*/
|
||||
open class ServiceTyped<TAggregateRoot : IAggregateRoot<TKey>, TKey>(
|
||||
protected var rootClass: Class<TAggregateRoot>,
|
||||
@@ -42,15 +43,11 @@ open class ServiceTyped<TAggregateRoot : IAggregateRoot<TKey>, TKey>(
|
||||
this.repository.remove(key, rootClass)
|
||||
}
|
||||
|
||||
override fun <TAggregateRoot : IAggregateRoot<TKey>> get(key: TKey, clazz: Class<TAggregateRoot>): TAggregateRoot {
|
||||
return this.repository.get(key, clazz)
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换ICommand类型到聚合根类型,默认实现,根据需要进行覆写。
|
||||
*
|
||||
* @param command
|
||||
* @return
|
||||
* @param command 需要转换的命令
|
||||
* @return 聚合根
|
||||
*/
|
||||
protected fun convert(command: ICommand): TAggregateRoot {
|
||||
try {
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.synebula.gaea.query
|
||||
*
|
||||
* @author wxf
|
||||
*/
|
||||
interface IComplexQuery<TView, TKey, TSecond> {
|
||||
interface IQueryComplex<TView, TKey, TSecond> {
|
||||
|
||||
|
||||
/**
|
||||
@@ -1,20 +1,18 @@
|
||||
package com.synebula.gaea.query
|
||||
|
||||
/**
|
||||
* 查询基接口。
|
||||
* 查询基接口, 其中方法都指定了查询的视图类型。
|
||||
*
|
||||
* @author alex
|
||||
*/
|
||||
interface ITypedQuery<TView, TKey> {
|
||||
|
||||
|
||||
interface IQueryTyped {
|
||||
/**
|
||||
* 根据Key获取对象。
|
||||
*
|
||||
* @param key 对象Key。
|
||||
* @return
|
||||
*/
|
||||
fun get(key: TKey, clazz: Class<TView>): TView?
|
||||
fun <TView, TKey> get(key: TKey, clazz: Class<TView>): TView?
|
||||
|
||||
/**
|
||||
* 根据实体类条件查询所有符合条件记录
|
||||
@@ -22,7 +20,7 @@ interface ITypedQuery<TView, TKey> {
|
||||
* @param params 查询条件。
|
||||
* @return list
|
||||
*/
|
||||
fun list(params: Map<String, Any>?, clazz: Class<TView>): List<TView>
|
||||
fun <TView, TKey> list(params: Map<String, Any>?, clazz: Class<TView>): List<TView>
|
||||
|
||||
/**
|
||||
* 根据条件查询符合条件记录的数量
|
||||
@@ -30,7 +28,7 @@ interface ITypedQuery<TView, TKey> {
|
||||
* @param params 查询条件。
|
||||
* @return int
|
||||
*/
|
||||
fun count(params: Map<String, Any>?, clazz: Class<TView>): Int
|
||||
fun <TView, TKey> count(params: Map<String, Any>?, clazz: Class<TView>): Int
|
||||
|
||||
/**
|
||||
* 根据实体类条件查询所有符合条件记录(分页查询)
|
||||
@@ -38,5 +36,5 @@ interface ITypedQuery<TView, TKey> {
|
||||
* @param params 分页条件
|
||||
* @return 分页数据
|
||||
*/
|
||||
fun paging(params: PagingParam, clazz: Class<TView>): PagingData<TView>
|
||||
fun <TView, TKey> paging(params: PagingParam, clazz: Class<TView>): PagingData<TView>
|
||||
}
|
||||
Reference in New Issue
Block a user