| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff 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 | + } | ||
| Original file line number | Diff line number | Diff 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 | + * email: xiaomo@xiaomo.info | ||
| 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 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments