|
@@ -1,4 +1,5 @@
|
|
|
package com.smart.reader.controller;
|
|
package com.smart.reader.controller;
|
|
|
|
|
+
|
|
|
import com.smart.reader.common.Page;
|
|
import com.smart.reader.common.Page;
|
|
|
import com.smart.reader.common.R;
|
|
import com.smart.reader.common.R;
|
|
|
import com.smart.reader.enums.SuccessResultCode;
|
|
import com.smart.reader.enums.SuccessResultCode;
|
|
@@ -13,9 +14,11 @@ import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
import javax.validation.constraints.NotNull;
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
+
|
|
|
@RequestMapping("/api/v1/system/userInfo")
|
|
@RequestMapping("/api/v1/system/userInfo")
|
|
|
@RestController
|
|
@RestController
|
|
|
@Validated
|
|
@Validated
|
|
@@ -23,6 +26,7 @@ import javax.validation.constraints.NotNull;
|
|
|
public class SysUserInfoController {
|
|
public class SysUserInfoController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private SysUserInfoService sysUserInfoService;
|
|
private SysUserInfoService sysUserInfoService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 新增数据
|
|
* 新增数据
|
|
|
*
|
|
*
|
|
@@ -36,38 +40,42 @@ public class SysUserInfoController {
|
|
|
sysUserInfoService.add(sysUserInfo);
|
|
sysUserInfoService.add(sysUserInfo);
|
|
|
return R.success(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg());
|
|
return R.success(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@ApiOperation("删除数据")
|
|
@ApiOperation("删除数据")
|
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id", value = "⽤户ID", required = true)
|
|
@ApiImplicitParam(name = "id", value = "⽤户ID", required = true)
|
|
|
})
|
|
})
|
|
|
@DeleteMapping("/delete/{id}")
|
|
@DeleteMapping("/delete/{id}")
|
|
|
public R delete(@NotNull(message = "⽤户ID不能为空") @PathVariable("id") Long id) throws CustomException {
|
|
public R delete(@NotNull(message = "⽤户ID不能为空") @PathVariable("id") Long id) throws CustomException {
|
|
|
- sysUserInfoService.delete(id);
|
|
|
|
|
- return R.fail(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg());
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ sysUserInfoService.delete(id);
|
|
|
|
|
+ return R.fail(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@ApiOperation("修改数据")
|
|
@ApiOperation("修改数据")
|
|
|
@PostMapping("/edit")
|
|
@PostMapping("/edit")
|
|
|
public R edit(@RequestBody @Valid SysUserInfoUpdateBo sysUserInfo) throws CustomException {
|
|
public R edit(@RequestBody @Valid SysUserInfoUpdateBo sysUserInfo) throws CustomException {
|
|
|
sysUserInfoService.edit(sysUserInfo);
|
|
sysUserInfoService.edit(sysUserInfo);
|
|
|
return R.fail(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg());
|
|
return R.fail(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg());
|
|
|
- }
|
|
|
|
|
-@GetMapping("queryInfo")
|
|
|
|
|
-@ApiOperation("获取⽤户列表")
|
|
|
|
|
-@ApiImplicitParams({
|
|
|
|
|
- @ApiImplicitParam(name = "pageNum", value = "当前⻚", required = true, dataType = "int", defaultValue = "1"),
|
|
|
|
|
- @ApiImplicitParam(name = "pageSize", value = "⻚⼤⼩", required = true, dataType = "int", defaultValue = "10"),
|
|
|
|
|
-})
|
|
|
|
|
-public R<Page<SysUserInfoVo>> queryInfo(int pageNum, int pageSize) {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("queryInfo")
|
|
|
|
|
+ @ApiOperation("获取⽤户列表")
|
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
|
+ @ApiImplicitParam(name = "pageNum", value = "当前⻚", required = true, dataType = "int", defaultValue = "1"),
|
|
|
|
|
+ @ApiImplicitParam(name = "pageSize", value = "⻚⼤⼩", required = true, dataType = "int", defaultValue = "10"),
|
|
|
|
|
+ })
|
|
|
|
|
+ public R<Page<SysUserInfoVo>> queryInfo(int pageNum, int pageSize) {
|
|
|
Page<SysUserInfoVo> result = sysUserInfoService.queryInfo(pageNum, pageSize);
|
|
Page<SysUserInfoVo> result = sysUserInfoService.queryInfo(pageNum, pageSize);
|
|
|
return R.success(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg(), result);
|
|
return R.success(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg(), result);
|
|
|
- }
|
|
|
|
|
-@ApiOperation("根据⽤户ID查询⽤户详情")
|
|
|
|
|
-@ApiImplicitParams({
|
|
|
|
|
- @ApiImplicitParam(name = "id", value = "⽤户ID", required = true)
|
|
|
|
|
-})
|
|
|
|
|
-@GetMapping("/detail/{id}")
|
|
|
|
|
-public R detail(@NotNull(message = "⽤户ID不能为空") @PathVariable("id") Long id) {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation("根据⽤户ID查询⽤户详情")
|
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
|
+ @ApiImplicitParam(name = "id", value = "⽤户ID", required = true)
|
|
|
|
|
+ })
|
|
|
|
|
+ @GetMapping("/detail/{id}")
|
|
|
|
|
+ public R detail(@NotNull(message = "⽤户ID不能为空") @PathVariable("id") Long id) {
|
|
|
SysUserInfoVo sysUserInfoVo = sysUserInfoService.detail(id);
|
|
SysUserInfoVo sysUserInfoVo = sysUserInfoService.detail(id);
|
|
|
return R.success(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg(), sysUserInfoVo);
|
|
return R.success(SuccessResultCode.SUCCESS.getCode(), SuccessResultCode.SUCCESS.getMsg(), sysUserInfoVo);
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+}
|