dev-v2 #3
|
@ -1,18 +1,22 @@
|
|||
package com.atguigu.spzx.manger.controller;
|
||||
|
||||
import com.atguigu.context.BaseContext;
|
||||
import com.atguigu.spzx.manger.service.SysMenuService;
|
||||
import com.atguigu.spzx.manger.service.SysUserService;
|
||||
import com.atguigu.spzx.manger.service.ValidateCodeService;
|
||||
import com.atguigu.spzx.model.dto.system.LoginDto;
|
||||
import com.atguigu.spzx.model.entity.system.SysUser;
|
||||
import com.atguigu.spzx.model.vo.result.Result;
|
||||
import com.atguigu.spzx.model.vo.system.LoginVo;
|
||||
import com.atguigu.spzx.model.vo.system.SysMenuVo;
|
||||
import com.atguigu.spzx.model.vo.system.ValidateCodeVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "用户相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/system/index")
|
||||
|
@ -20,6 +24,8 @@ public class IndexController {
|
|||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private SysMenuService sysMenuService;
|
||||
@Autowired
|
||||
private ValidateCodeService validateCodeService;
|
||||
|
||||
@Operation(summary = "生成验证码", description = "生成验证码信息")
|
||||
|
@ -49,4 +55,11 @@ public class IndexController {
|
|||
sysUserService.logout(token);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "动态菜单", description = "动态菜单")
|
||||
@GetMapping("menus")
|
||||
public Result<List<SysMenuVo>> menus() {
|
||||
List<SysMenuVo> sysMenuVoList = sysMenuService.findUserMenuList();
|
||||
return Result.success(sysMenuVoList);
|
||||
}
|
||||
}
|
|
@ -28,21 +28,21 @@ public class SysUserController {
|
|||
|
||||
@Operation(summary = "添加用户", description = "添加用户信息")
|
||||
@PostMapping(value = "saveSysUser")
|
||||
public Result saveSysUser(@RequestBody SysUser sysUser) {
|
||||
public Result<SysUser> saveSysUser(@RequestBody SysUser sysUser) {
|
||||
sysUserService.saveSysUser(sysUser);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "修改用户", description = "修改用户信息")
|
||||
@PutMapping("updateSysUser")
|
||||
public Result updateSysUser(@RequestBody SysUser sysUser) {
|
||||
public Result<SysUser> updateSysUser(@RequestBody SysUser sysUser) {
|
||||
sysUserService.updateSysUser(sysUser);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id删除用户", description = "删除用户信息")
|
||||
@DeleteMapping(value = "deleteById/{userId}")
|
||||
public Result deleteById(@PathVariable(value = "userId") Long userId) {
|
||||
public Result<SysUser> deleteById(@PathVariable(value = "userId") Long userId) {
|
||||
sysUserService.deleteById(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
<update id="updateSysUser">
|
||||
update sys_user
|
||||
set
|
||||
<if test="avatar != null and avatar != ''">
|
||||
avatar = #{avatar},
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
username = #{userName},
|
||||
</if>
|
||||
|
|
Loading…
Reference in New Issue