浏览代码

修复问题

tianyabing 2 年之前
父节点
当前提交
8c5a83845f

+ 1 - 1
src/main/java/com/sky/ioc/controller/index/IndexController.java

@@ -26,7 +26,7 @@ public class IndexController {
 
     @ApiOperation("查询所有菜单")
     @GetMapping("/get_system_menus_list")
-    public ReturnMsg getSystemMenusList(@RequestParam Integer parentId) {
+    public ReturnMsg getSystemMenusList(@RequestParam(required = false) Integer parentId) {
         return indexService.getSystemMenusList(parentId);
     }
 

+ 1 - 2
src/main/java/com/sky/ioc/controller/user/LoginController.java

@@ -8,7 +8,6 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 @Api(tags = "系统--登录")
@@ -21,7 +20,7 @@ public class LoginController {
 
     @ApiOperation("系统登录")
     @PostMapping("/login")
-    public JSONObject login(@RequestBody LoginParam loginParam) {
+    public JSONObject login(LoginParam loginParam) {
         return userService.login(loginParam.getUsername(), loginParam.getPassword());
     }
 

+ 0 - 3
src/main/java/com/sky/ioc/entity/domain/system/Users.java

@@ -2,14 +2,11 @@ package com.sky.ioc.entity.domain.system;
 
 import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
 import lombok.Data;
 
 @Data
 public class Users {
 
-    @TableId(type = IdType.AUTO)
     @ExcelProperty("ID")
     private Integer id;
     /** 用户名 */

+ 8 - 6
src/main/java/com/sky/ioc/entity/dto/LoginUserVo.java

@@ -4,14 +4,16 @@ import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import java.io.Serializable;
+
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
-public class LoginUserVo {
+public class LoginUserVo implements Serializable {
 
     private long id;
     /** 用户名 */
-    private String userName;
+    private String user_name;
     /** 头像 */
     private String photograph;
     /** 昵称 */
@@ -25,15 +27,15 @@ public class LoginUserVo {
     /** 部门ID */
     private String department;
     /** 在职状态 0-在职 */
-    private String onJobStatus;
+    private String on_job_status;
     private String duty;
     /** 账户状态 0-在职 */
-    private String accountStatus;
+    private String account_status;
     private String nationality;
     /** 创建时间 */
-    private String registerTime;
+    private String register_time;
     /**
      * 常用功能ID,例如 1,5,6
      */
-    private  String commonMenus;
+    private  String common_menus;
 }

+ 15 - 14
src/main/java/com/sky/ioc/service/index/impl/IndexServiceImpl.java

@@ -9,9 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
-
-import java.util.HashMap;
-import java.util.Map;
+import org.springframework.web.util.UriComponentsBuilder;
 
 @Service
 public class IndexServiceImpl implements IndexService {
@@ -25,29 +23,32 @@ public class IndexServiceImpl implements IndexService {
     @Override
     public ReturnMsg editIndex(String data) {
         RestTemplate restTemplate = restTemplateConfig.build();
-        Map params = new HashMap<>();
-        params.put("data", JSON.parse(data));
-        JSONObject forObject = restTemplate.postForObject(iocServerUrl + "/system_index/editIndex", null, JSONObject.class, params);
+        String url = iocServerUrl + "/system_index/editIndex";
+        UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url)
+                .queryParam("data", JSON.parse(data));
+        JSONObject forObject = restTemplate.postForObject(builder.build().toString(), null, JSONObject.class);
         return ReturnMsg.ok(forObject);
     }
 
     @Override
     public ReturnMsg getSystemMenusList(Integer parentId) {
         RestTemplate restTemplate = restTemplateConfig.build();
-        Map params = new HashMap<>();
-        params.put("parentId", parentId);
-        JSONObject forObject = restTemplate.getForObject(iocServerUrl + "/system_index/getSystemMenusList", JSONObject.class, params);
+        String url = iocServerUrl + "/system_index/getSystemMenusList";
+        UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url)
+                .queryParam("parentId", parentId);
+        JSONObject forObject = restTemplate.getForObject(builder.build().toString(), JSONObject.class);
         return ReturnMsg.ok(forObject);
     }
 
     @Override
     public ReturnMsg getIndexList(Integer page, Integer pageSize, Integer parentId) {
         RestTemplate restTemplate = restTemplateConfig.build();
-        Map params = new HashMap<>();
-        params.put("parentId", parentId);
-        params.put("page", page);
-        params.put("pageSize", pageSize);
-        JSONObject forObject = restTemplate.getForObject(iocServerUrl + "/system_index/getIndexList", JSONObject.class, params);
+        String url = iocServerUrl + "/system_index/getIndexList";
+        UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url)
+                .queryParam("parentId", parentId)
+                .queryParam("pageSize", pageSize)
+                .queryParam("page", page);
+        JSONObject forObject = restTemplate.getForObject(builder.build().toString(), JSONObject.class);
         return ReturnMsg.ok(forObject);
     }
 

+ 4 - 2
src/main/java/com/sky/ioc/service/user/impl/UserServiceImpl.java

@@ -1,6 +1,7 @@
 package com.sky.ioc.service.user.impl;
 
 import com.alibaba.excel.EasyExcel;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.github.pagehelper.PageHelper;
@@ -52,7 +53,7 @@ public class UserServiceImpl implements UserService {
         String token = JwtUtil.genJwtToken(users);
 
         // 将用户信息存入redis
-        redisUtil.put("login:"+loginUser.getUserName(), loginUser);
+        redisUtil.put("login:"+loginUser.getUser_name(), JSON.toJSONString(loginUser));
 
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("code", 0);
@@ -67,6 +68,7 @@ public class UserServiceImpl implements UserService {
         if (!Objects.isNull(u)){
             throw new RuntimeException("用户名已存在");
         }
+        users.setAccount_status("0");
         int insert = userMapper.insert(users);
         if (insert<1) {
             throw  new RuntimeException("添加失败");
@@ -104,7 +106,7 @@ public class UserServiceImpl implements UserService {
     @Override
     public ReturnMsg getUserList(String status, String filter, String page, String pageSize) {
         LambdaQueryWrapper<Users> queryWrapper = new LambdaQueryWrapper<>();
-        if (StringUtils.isNotBlank(status)) {
+        if (StringUtils.isNotBlank(status) && status.equals("0")) {
             queryWrapper.eq(Users::getAccount_status, status);
         }
         if (StringUtils.isNotBlank(filter)) {

+ 3 - 1
src/main/resources/application.yml

@@ -89,8 +89,10 @@ mybatis-plus:
     # 启动时logo输出
     banner: false
     db-config:
-      capital-mode: true
+#      capital-mode: true
       column-format: "\"%s\""
+      insert-strategy: not_empty
+      update-strategy: not_empty
 
 # PageHelper分页插件
 pagehelper: