| | |
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.R;
|
| | | import io.swagger.v3.oas.annotations.Operation;
|
| | | import io.swagger.v3.oas.annotations.Parameter;
|
| | | import io.swagger.v3.oas.annotations.Parameters;
|
| | | import io.swagger.v3.oas.annotations.media.Schema;
|
| | | import io.swagger.v3.oas.annotations.tags.Tag;
|
| | |
|
| | | /**
|
| | | * swagger 用户测试方法
|
| | |
| | | }
|
| | |
|
| | | @Operation(summary = "获取用户详细")
|
| | | @Parameter(name = "userId", description = "用户ID", required = true) |
| | | @GetMapping("/{userId}") |
| | | public R<UserEntity> getUser(@PathVariable Integer userId) |
| | | @Parameter(name = "userId", description = "用户ID", required = true)
|
| | | @GetMapping("/{userId}")
|
| | | public R<UserEntity> getUser(@PathVariable Integer userId)
|
| | | {
|
| | | if (!users.isEmpty() && users.containsKey(userId))
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Log(title = "测试接口新增用户", businessType = BusinessType.INSERT)
|
| | | @Operation(summary = "新增用户")
|
| | | @Parameters({ |
| | | @Parameter(name = "userId", description = "用户id"), |
| | | @Parameter(name = "username", description = "用户名称"), |
| | | @Parameter(name = "password", description = "用户密码"), |
| | | @Parameter(name = "mobile", description = "用户手机") |
| | | }) |
| | | @PostMapping("/save") |
| | | public R<String> save(UserEntity user) |
| | | @Parameters({
|
| | | @Parameter(name = "userId", description = "用户id"),
|
| | | @Parameter(name = "username", description = "用户名称"),
|
| | | @Parameter(name = "password", description = "用户密码"),
|
| | | @Parameter(name = "mobile", description = "用户手机")
|
| | | })
|
| | | @PostMapping("/save")
|
| | | public R<String> save(UserEntity user)
|
| | | {
|
| | | if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
| | | {
|
| | |
| | | return R.ok();
|
| | | }
|
| | |
|
| | | @Log(title = "测试接口更新用户", businessType = BusinessType.UPDATE)
|
| | | @Operation(summary = "更新用户")
|
| | | @PutMapping("/update")
|
| | | public R<String> update(@RequestBody UserEntity user)
|
| | |
| | | return R.ok();
|
| | | }
|
| | |
|
| | | @Log(title = "测试接口删除用户", businessType = BusinessType.DELETE)
|
| | | @Operation(summary = "删除用户信息")
|
| | | @Parameter(name = "userId", description = "用户ID", required = true) |
| | | @DeleteMapping("/{userId}") |
| | | public R<String> delete(@PathVariable Integer userId) |
| | | @Parameter(name = "userId", description = "用户ID", required = true)
|
| | | @DeleteMapping("/{userId}")
|
| | | public R<String> delete(@PathVariable Integer userId)
|
| | | {
|
| | | if (!users.isEmpty() && users.containsKey(userId))
|
| | | {
|