12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package com.gyee.table.controller;
- import com.alibaba.fastjson2.JSONObject;
- import com.gyee.table.entity.SysUser;
- import com.gyee.table.result.Result;
- import com.gyee.table.service.ISysUserService;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import javax.annotation.Resource;
- @Slf4j
- @RestController
- @RequestMapping("/suc")
- public class SysUserController {
- @Resource
- private ISysUserService userService;
-
- @PostMapping("/changePassword")
- public JSONObject changePassword(@RequestParam(value = "id") String id,
- @RequestParam(value = "originalPassword") String originalPassword,
- @RequestParam(value = "newPassword") String newPassword) {
- SysUser user = userService.getById(id);
- if (!originalPassword.equals(user.getPassword())){
- return Result.error();
- }
- user.setPassword(newPassword);
- userService.updateById(user);
- return Result.success();
- }
- }
|