Skip to content

Commit 2a30150

Browse files
committed
java to kotlin
1 parent d1ed707 commit 2a30150

File tree

16 files changed

+638
-690
lines changed

16 files changed

+638
-690
lines changed

multipleSource/src/main/java/info/xiaomo/multiplesource/domain/User.java

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package info.xiaomo.multiplesource.domain
2+
3+
4+
/**
5+
* @author : xiaomo
6+
*/
7+
8+
class User {
9+
10+
private var id: Long? = null
11+
12+
private var name: String? = null
13+
14+
private var age: Int? = null
15+
16+
constructor(id: Long?, name: String, age: Int?) {
17+
this.id = id
18+
this.name = name
19+
this.age = age
20+
}
21+
22+
constructor(name: String, age: Int?) {
23+
this.name = name
24+
this.age = age
25+
}
26+
27+
}

redis/src/main/java/info/xiaomo/redis/controller/TestController.java

Lines changed: 0 additions & 58 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package info.xiaomo.redis.controller
2+
3+
import info.xiaomo.core.base.Result
4+
import info.xiaomo.redis.dao.CommonRedisDao
5+
import org.springframework.beans.factory.annotation.Autowired
6+
import org.springframework.web.bind.annotation.PathVariable
7+
import org.springframework.web.bind.annotation.RequestMapping
8+
import org.springframework.web.bind.annotation.RequestMethod
9+
import org.springframework.web.bind.annotation.RestController
10+
11+
/**
12+
* 把今天最好的表现当作明天最新的起点..~
13+
* いま 最高の表現 として 明日最新の始発..~
14+
* Today the best performance as tomorrow newest starter!
15+
* Created by IntelliJ IDEA.
16+
*
17+
* @author : xiaomo
18+
* github: https://github.com/xiaomoinfo
19+
20+
*
21+
* Date: 2016/11/14 17:25
22+
* Copyright(©) 2015 by xiaomo.
23+
*/
24+
25+
@RestController
26+
@RequestMapping("/redis")
27+
class TestController @Autowired
28+
constructor(private val dao: CommonRedisDao) {
29+
30+
@RequestMapping(value = "get/{key}", method = arrayOf(RequestMethod.GET))
31+
fun find(@PathVariable("key") key: String): Result<String> {
32+
val value = dao.getValue(key)
33+
return Result(value)
34+
}
35+
36+
@RequestMapping(value = "add/{key}/{value}", method = arrayOf(RequestMethod.GET))
37+
fun add(@PathVariable("value") value: String, @PathVariable("key") key: String): Result<Boolean> {
38+
return Result(dao.cacheValue(key, value))
39+
}
40+
41+
@RequestMapping(value = "del/{key}", method = arrayOf(RequestMethod.GET))
42+
fun del(@PathVariable("key") key: String): Result<Boolean> {
43+
return Result(dao.removeValue(key))
44+
}
45+
46+
@RequestMapping(value = "count/{key}", method = arrayOf(RequestMethod.GET))
47+
fun count(@PathVariable("key") key: String): Result<Long> {
48+
return Result(dao.getListSize(key))
49+
}
50+
51+
52+
}

0 commit comments

Comments
 (0)