| | |
| | | import com.ruoyi.company.api.model.UserDetail; |
| | | import com.ruoyi.company.service.UserService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import lombok.experimental.StandardException; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @RestController |
| | | @RequestMapping("/front/user") |
| | | @RequiredArgsConstructor |
| | | @RequiredArgsConstructor(onConstructor_ = {@Lazy}) |
| | | public class UserController { |
| | | private final UserService userService; |
| | | |
| | | @PostMapping("/register") |
| | | public R register(RegisterUser registerUser) { |
| | | public R register(@RequestBody RegisterUser registerUser) { |
| | | userService.register(registerUser); |
| | | return R.ok(); |
| | | } |
| | |
| | | return R.ok(userService.getOne(new LambdaQueryWrapper<User>() |
| | | .eq(User::getAccountName,accountName))); |
| | | } |
| | | |
| | | @GetMapping("/getUserByPhone") |
| | | @InnerAuth |
| | | public R<User> getUserByPhone(String phone){ |
| | | return R.ok(userService.getOne(new LambdaQueryWrapper<User>() |
| | | .eq(User::getPhone,phone))); |
| | | } |
| | | |
| | | @PutMapping("/updateUser") |
| | | public R<Void> updateUser(@RequestBody User user){ |
| | | user.setUpdateTime(LocalDateTime.now()); |
| | | userService.updateById(user); |
| | | return R.ok(); |
| | | } |
| | | } |