From ceb1dea2b24d5c3216816f42fd0e514613656416 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 08 十二月 2025 16:11:04 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override
---
north-glass-erp/src/main/java/com/example/erp/controller/userInfo/UserController.java | 77 ++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/userInfo/UserController.java b/north-glass-erp/src/main/java/com/example/erp/controller/userInfo/UserController.java
new file mode 100644
index 0000000..5269f53
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/userInfo/UserController.java
@@ -0,0 +1,77 @@
+package com.example.erp.controller.userInfo;
+
+import com.example.erp.common.CacheUtil;
+import com.example.erp.common.Constants;
+import com.example.erp.common.Result;
+import com.example.erp.controller.dto.UserDTO;
+import com.example.erp.entity.userInfo.User;
+import com.example.erp.exception.ServiceException;
+import com.example.erp.mapper.userInfo.UserMapper;
+import com.example.erp.service.userInfo.UserService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+@RestController //娉ㄨВuser鎺у埗鍣紝鎸傝浇鍒皊pringboot褰撲腑
+@RequestMapping("/user") //娉ㄨВ鍓嶇寮傛璇锋眰濡傦細localhost锛�8080/user
+public class UserController {
+ @Autowired
+ private UserMapper userMapper;
+ @Autowired
+ private UserService userService;
+ @Autowired
+ private CacheUtil cacheUtil;
+
+
+
+
+ @GetMapping
+ public List<User> getUser(){
+ return userMapper.findAll();
+ }
+ @ApiOperation("鐧诲綍")
+ @PostMapping("/login")
+ public Result login(@RequestBody UserDTO userDTO){
+ //UserDTO getUserCacheDTO = cacheUtil.getCacheData(userDTO.getUserId());
+ userService.deleteCache(userDTO.getUserId());
+ UserDTO getUserDTO=userService.login(userDTO);
+ if(getUserDTO!=null){
+ return Result.success(userDTO);
+ }else{
+ throw new ServiceException(Constants.Code_600,"鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒");
+ }
+ }
+ @ApiOperation("娉ㄥ唽")
+ @PostMapping("/register")
+ public Result register(@RequestBody User user){
+ User getUser= userService.register(user);
+ if(getUser == null){
+ throw new ServiceException(Constants.Code_500,"娉ㄥ唽澶辫触");
+ }else {
+ return Result.success(getUser);
+ }
+
+ //return
+ }
+ @ApiOperation("淇敼瀵嗙爜")
+ @PostMapping("/updatePassWord")
+ public Result updatePassWord(@RequestBody Map<String,Object> object){
+ return Result.success( userService.updatePassWord(object));
+ }
+
+ @ApiOperation("淇敼鐢ㄦ埛鍚�")
+ @PostMapping("/updateUserName")
+ public Result updateUserName(@RequestBody Map<String,Object> object){
+ return Result.success( userService.updateUserName(object));
+ }
+
+ @ApiOperation("鐢ㄦ埛鐧诲綍璁板綍")
+ @PostMapping("/getUserLog")
+ public Result getUserLog(){
+ return Result.success( userService.getUserLog());
+ }
+
+}
--
Gitblit v1.8.0