From ebdacd7123e42c76cd7cb43938574cfeb0706250 Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Mon, 22 Mar 2021 09:11:36 +0800
Subject: [PATCH] 角色菜单配置
---
screen-manage/src/main/java/com/moral/api/service/impl/ManageRoleServiceImpl.java | 41 +++++++++++++++++++++--------------------
1 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/screen-manage/src/main/java/com/moral/api/service/impl/ManageRoleServiceImpl.java b/screen-manage/src/main/java/com/moral/api/service/impl/ManageRoleServiceImpl.java
index c71e9ca..deb66a4 100644
--- a/screen-manage/src/main/java/com/moral/api/service/impl/ManageRoleServiceImpl.java
+++ b/screen-manage/src/main/java/com/moral/api/service/impl/ManageRoleServiceImpl.java
@@ -10,6 +10,7 @@
import com.moral.api.service.ManageRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moral.constant.Constants;
+import com.moral.constant.ResponseCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
@@ -67,20 +68,20 @@
public Map<String,Object> insertOne(ManageRole manageRole,List list) {
Map<String,Object> resultMap = new HashMap<>();
if (manageRole.getName()==null){
- resultMap.put("flag",false);
- resultMap.put("msg","���������������");
+ resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode());
+ resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
return resultMap;
}
if (manageRoleMapper.getManageRoleByName(manageRole.getName()) != null){
- resultMap.put("flag",false);
- resultMap.put("msg","���������������������");
+ resultMap.put("code",ResponseCodeEnum.ROLE_IS_EXPIRE.getCode());
+ resultMap.put("msg",ResponseCodeEnum.ROLE_IS_EXPIRE.getMsg());
}else {
manageRoleMapper.insertOne(manageRole);
- resultMap.put("flag",true);
- resultMap.put("msg","���������������");
+ resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode());
+ resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg());
}
- boolean flag = Boolean.parseBoolean(resultMap.get("flag").toString());
- if (flag){
+ Integer code = Integer.parseInt(resultMap.get("code").toString());
+ if (code.equals(ResponseCodeEnum.SUCCESS.getCode())){
ManageRole manageRoleIns = manageRoleMapper.getManageRoleByName(manageRole.getName());
int role_id = manageRoleIns.getId();
System.out.println(role_id);
@@ -102,17 +103,17 @@
public Map<String,Object> updateManageRole(Map map) {
Map<String,Object> resultMap = new HashMap<>();
if (!map.containsKey("id")){
- resultMap.put("flag",false);
- resultMap.put("msg","������������������������");
+ resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode());
+ resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
return resultMap;
}
if (manageRoleMapper.getManageRoleById(Integer.parseInt(map.get("id").toString())) == null){
- resultMap.put("flag",false);
- resultMap.put("msg","���������������������");
+ resultMap.put("code",ResponseCodeEnum.ROLE_IS_NULL.getCode());
+ resultMap.put("msg",ResponseCodeEnum.ROLE_IS_NULL.getMsg());
}else {
manageRoleMapper.updateManageRoleById(map);
- resultMap.put("flag",true);
- resultMap.put("msg","���������������");
+ resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode());
+ resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg());
}
return resultMap;
}
@@ -133,13 +134,13 @@
public Map<String, Object> deleteManageRole(Map map) {
Map<String,Object> resultMap = new HashMap<>();
if (!map.containsKey("id")){
- resultMap.put("flag",false);
- resultMap.put("msg","������������������������");
+ resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode());
+ resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
return resultMap;
}
if (manageRoleMapper.getManageRoleById(Integer.parseInt(map.get("id").toString())) == null){
- resultMap.put("flag",false);
- resultMap.put("msg","������������������������������������");
+ resultMap.put("code",ResponseCodeEnum.ROLE_IS_NULL.getCode());
+ resultMap.put("msg",ResponseCodeEnum.ROLE_IS_NULL.getMsg());
}else {
ManageRole manageRole = new ManageRole();
manageRole.setId(Integer.parseInt(map.get("id").toString()));
@@ -153,8 +154,8 @@
QueryWrapper<ManageAccountRole> wrapper = new QueryWrapper();
wrapper.eq("role_id",Integer.parseInt(map.get("id").toString()));
manageAccountRoleMapper.update(manageAccountRole,wrapper);
- resultMap.put("flag",true);
- resultMap.put("msg","���������������");
+ resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode());
+ resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg());
}
return resultMap;
}
--
Gitblit v1.8.0