From d61072f997839b4564ce35132d5902a1b6f7d54f Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 03 Aug 2020 17:39:10 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/modules/test/controller/TestUserController.java | 29 ++++++++++++++++++++++++-----
1 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/test/controller/TestUserController.java b/src/main/java/com/xcong/excoin/modules/test/controller/TestUserController.java
index 222910a..0be8a3b 100644
--- a/src/main/java/com/xcong/excoin/modules/test/controller/TestUserController.java
+++ b/src/main/java/com/xcong/excoin/modules/test/controller/TestUserController.java
@@ -11,10 +11,7 @@
import com.xcong.excoin.modules.test.service.TestUserService;
import com.xcong.excoin.modules.test.vo.TestUserVo;
import com.xcong.excoin.utils.MessageSourceUtils;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated;
@@ -63,6 +60,19 @@
return Result.fail("fail");
}
+ @ApiOperation(value = "修改测试用户", notes = "该接口用户修改测试用户")
+ @PostMapping(value = "/modify")
+ public Result modify(@RequestBody @Validated TestUserDto testUserDto) {
+ TestUserEntity testUserEntity = TestUserEntityMapper.INSTANCE.dtoToEntity(testUserDto);
+ log.info("#-------->{}#", testUserEntity);
+ boolean flag = testUserService.updateById(testUserEntity);
+ if (flag) {
+ return Result.ok("success");
+ }
+ return Result.fail("fail");
+ }
+
+
@ApiOperation(value = "根据ID删除用户", notes = "根据ID删除用户")
@GetMapping(value = "/del/{id}")
public Result del(@PathVariable(value = "id") Long id) {
@@ -75,9 +85,18 @@
@ApiOperation(value = "根据Id查询用户信息", notes = "根据Id查询用户信息")
@GetMapping(value = "/findById/{id}")
- public Result findById(@PathVariable(value = "id") Long id) {
+ public Result findById(@ApiParam(name = "id", value = "用户ID", required = true, example = "1") @PathVariable(value = "id") Long id) {
TestUserEntity testUserEntity = testUserService.getById(id);
TestUserVo testUserVo = TestUserEntityMapper.INSTANCE.entityToVo(testUserEntity);
return Result.ok("success", testUserVo);
}
+
+ @ApiOperation(value = "根据Id查询用户信息", notes = "根据Id查询用户信息")
+ @GetMapping(value = "/findByIdAndName/{id}/{name}")
+ public Result findByIdAndName(@ApiParam(name = "id", value="用户ID", required = true, example = "1") @PathVariable(value = "id") Long id,
+ @ApiParam(name = "name", value="用户姓名", required = true, example = "wzy") @PathVariable(value = "name") String name) {
+ log.info("---->{}", id);
+ log.info("----<{}", name);
+ return Result.ok("success");
+ }
}
--
Gitblit v1.9.1