重构业务名称
This commit is contained in:
@@ -13,11 +13,13 @@ dependencies {
|
||||
compile project(":src:zeus.query")
|
||||
compile "com.synebula:gaea.app:$gaea_version"
|
||||
compile "com.synebula:gaea.mongo:$gaea_version"
|
||||
|
||||
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
publish(MavenPublication) {
|
||||
group 'com.synebula'
|
||||
artifactId 'zeus.app'
|
||||
version "$version"
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.synebula.zeus.app.config
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.synebula.gaea.data.serialization.json.IJsonSerializer
|
||||
import com.synebula.gaea.domain.model.IAggregateRoot
|
||||
import com.synebula.gaea.domain.repository.IRepository
|
||||
import com.synebula.gaea.domain.repository.IRepositoryTyped
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.mongo.query.MongoQuery
|
||||
import com.synebula.gaea.mongo.query.MongoQueryTyped
|
||||
import com.synebula.gaea.mongo.repository.MongoRepository
|
||||
import com.synebula.gaea.mongo.repository.MongoRepositoryTyped
|
||||
import com.synebula.gaea.query.IQuery
|
||||
import com.synebula.gaea.query.IQueryTyped
|
||||
import com.synebula.gaea.query.mongo.MongoQuery
|
||||
import com.synebula.gaea.query.mongo.MongoQueryTyped
|
||||
import com.synebula.gaea.repository.mongo.MongoRepository
|
||||
import com.synebula.gaea.repository.mongo.MongoRepositoryTyped
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.data.mongodb.core.MongoTemplate
|
||||
@@ -25,19 +27,23 @@ open class ZeusBeans {
|
||||
: IRepositoryTyped = MongoRepositoryTyped(template)
|
||||
|
||||
@Bean
|
||||
open fun <T> typedQuery(template: MongoTemplate, logger: ILogger? = null)
|
||||
: IQueryTyped = MongoQueryTyped(template, logger)
|
||||
|
||||
@Bean
|
||||
open fun <T> query(template: MongoTemplate)
|
||||
open fun <T> mongoQuery(template: MongoTemplate)
|
||||
: IQuery<T, String> = MongoQuery(template)
|
||||
|
||||
@Bean
|
||||
open fun <T> mongoQuery(template: MongoTemplate)
|
||||
: MongoQuery<T> = MongoQuery(template)
|
||||
open fun <T> mongoTypedQuery(template: MongoTemplate, logger: ILogger? = null)
|
||||
: IQueryTyped = MongoQueryTyped(template, logger)
|
||||
|
||||
@Bean
|
||||
open fun <T> mongoTypedQuery(template: MongoTemplate, logger: ILogger? = null)
|
||||
: MongoQueryTyped = MongoQueryTyped(template, logger)
|
||||
open fun gson(): Gson = Gson()
|
||||
|
||||
@Bean
|
||||
open fun serializer(gson: Gson): IJsonSerializer {
|
||||
return object : IJsonSerializer {
|
||||
override fun <S> serialize(src: S): String {
|
||||
return gson.toJson(src)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.synebula.zeus.app.controller
|
||||
|
||||
import com.synebula.gaea.app.CommandApp
|
||||
import com.synebula.gaea.app.QueryApp
|
||||
import com.synebula.gaea.app.UnionApp
|
||||
import com.synebula.gaea.app.UnionTypedApp
|
||||
import com.synebula.gaea.app.component.HttpMessage
|
||||
import com.synebula.gaea.domain.service.IService
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.query.mongo.MongoQuery
|
||||
import com.synebula.gaea.query.mongo.MongoQueryTyped
|
||||
import com.synebula.zeus.domain.service.cmd.AccountCmd
|
||||
import com.synebula.zeus.domain.service.contr.rbac.IAccountService
|
||||
import com.synebula.zeus.query.view.AccountView
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/accounts")
|
||||
class AccountApp(
|
||||
service: IAccountService,
|
||||
query: MongoQueryTyped,
|
||||
logger: ILogger
|
||||
) : UnionTypedApp<AccountCmd, AccountView, String>("账户", AccountView::class.java,
|
||||
service, query, logger)
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.synebula.zeus.app.controller
|
||||
|
||||
import com.synebula.gaea.app.UnionTypedApp
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.gaea.query.IQueryTyped
|
||||
import com.synebula.zeus.domain.service.cmd.UserCmd
|
||||
import com.synebula.zeus.domain.service.contr.rbac.IUserService
|
||||
import com.synebula.zeus.query.view.UserView
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/users")
|
||||
class UserApp(
|
||||
service: IUserService,
|
||||
query: IQueryTyped,
|
||||
logger: ILogger
|
||||
) : UnionTypedApp<UserCmd, UserView, String>(
|
||||
"用户信息", UserView::class.java,
|
||||
service, query, logger
|
||||
)
|
||||
@@ -4,7 +4,7 @@ dependencies {
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
publish(MavenPublication) {
|
||||
group 'com.synebula'
|
||||
artifactId 'zeus.domain'
|
||||
version "$version"
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.synebula.zeus.domain.model.rbac
|
||||
|
||||
import com.synebula.gaea.domain.model.AggregateRoot
|
||||
|
||||
class Account(override var id: String? = null) : AggregateRoot<String>() {
|
||||
class User(override var id: String? = null) : AggregateRoot<String>() {
|
||||
var name: String = ""
|
||||
var password: String = ""
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.synebula.zeus.domain.service.cmd
|
||||
|
||||
import com.synebula.gaea.domain.service.ICommand
|
||||
import com.synebula.gaea.domain.service.Command
|
||||
|
||||
class AccountCmd : ICommand {
|
||||
class UserCmd : Command() {
|
||||
var id: String? = null
|
||||
var name = ""
|
||||
var password = ""
|
||||
override var timestamp = 0L
|
||||
}
|
||||
@@ -2,4 +2,4 @@ package com.synebula.zeus.domain.service.contr.rbac
|
||||
|
||||
import com.synebula.gaea.domain.service.IService
|
||||
|
||||
interface IAccountService : IService<String>
|
||||
interface IUserService : IService<String>
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.synebula.zeus.domain.service.impl.rbac
|
||||
|
||||
import com.synebula.gaea.data.IObjectConverter
|
||||
import com.synebula.gaea.domain.repository.IRepository
|
||||
import com.synebula.gaea.domain.service.Service
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.zeus.domain.model.rbac.Account
|
||||
import com.synebula.zeus.domain.service.contr.rbac.IAccountService
|
||||
|
||||
class AccountService(repository: IRepository<Account, String>, converter: IObjectConverter, logger: ILogger) :
|
||||
Service<Account, String>(Account::class.java, repository, converter, logger), IAccountService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.synebula.zeus.domain.service.impl.rbac
|
||||
|
||||
import com.synebula.gaea.data.IObjectConverter
|
||||
import com.synebula.gaea.domain.repository.IRepository
|
||||
import com.synebula.gaea.domain.service.Service
|
||||
import com.synebula.gaea.log.ILogger
|
||||
import com.synebula.zeus.domain.model.rbac.User
|
||||
import com.synebula.zeus.domain.service.contr.rbac.IUserService
|
||||
|
||||
class UserService(repository: IRepository<User, String>, converter: IObjectConverter, logger: ILogger) :
|
||||
Service<User, String>(User::class.java, repository, converter, logger), IUserService {
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ dependencies {
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
publish(MavenPublication) {
|
||||
group 'com.synebula'
|
||||
artifactId 'zeus.view'
|
||||
version "$version"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.synebula.zeus.query.view
|
||||
|
||||
class AccountView {
|
||||
class UserView {
|
||||
var id: String = ""
|
||||
|
||||
var name: String = ""
|
||||
Reference in New Issue
Block a user