From ad322f694876eb656aaffcf6eef11f6301b29607 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 1 Aug 2018 20:17:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9D=A1=E4=BB=B6=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/online/service/UserOnlineServiceImpl.java | 5 +++-- .../project/system/config/controller/ConfigController.java | 3 ++- .../project/system/dept/controller/DeptController.java | 3 ++- .../project/system/dict/controller/DictTypeController.java | 3 ++- .../project/system/dict/service/DictTypeServiceImpl.java | 2 +- .../project/system/menu/controller/MenuController.java | 3 ++- .../ruoyi/project/system/post/service/PostServiceImpl.java | 2 +- .../project/system/role/controller/RoleController.java | 5 +++-- .../ruoyi/project/system/role/service/RoleServiceImpl.java | 2 +- .../project/system/user/controller/LoginController.java | 2 +- .../project/system/user/controller/UserController.java | 6 +++--- 11 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java b/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java index a61b1748..0b3d9185 100644 --- a/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java @@ -6,6 +6,7 @@ import org.apache.shiro.session.Session; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.shiro.session.OnlineSessionDAO; import com.ruoyi.project.monitor.online.domain.UserOnline; import com.ruoyi.project.monitor.online.mapper.UserOnlineMapper; @@ -46,7 +47,7 @@ public class UserOnlineServiceImpl implements IUserOnlineService public void deleteOnlineById(String sessionId) { UserOnline userOnline = selectOnlineById(sessionId); - if (userOnline != null) + if (StringUtils.isNotNull(userOnline)) { userOnlineDao.deleteOnlineById(sessionId); } @@ -64,7 +65,7 @@ public class UserOnlineServiceImpl implements IUserOnlineService for (String sessionId : sessions) { UserOnline userOnline = selectOnlineById(sessionId); - if (userOnline != null) + if (StringUtils.isNotNull(userOnline)) { userOnlineDao.deleteOnlineById(sessionId); } diff --git a/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java b/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java index 0abd22b6..000bbdde 100644 --- a/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java +++ b/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.constant.BusinessType; @@ -134,7 +135,7 @@ public class ConfigController extends BaseController public String checkConfigKeyUnique(Config config) { String uniqueFlag = "0"; - if (config != null) + if (StringUtils.isNotNull(config)) { uniqueFlag = configService.checkConfigKeyUnique(config); } diff --git a/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java index 5b3ff6fc..9a4a4d41 100644 --- a/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java +++ b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.constant.BusinessType; import com.ruoyi.framework.web.controller.BaseController; @@ -120,7 +121,7 @@ public class DeptController extends BaseController public String checkDeptNameUnique(Dept dept) { String uniqueFlag = "0"; - if (dept != null) + if (StringUtils.isNotNull(dept)) { uniqueFlag = deptService.checkDeptNameUnique(dept); } diff --git a/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java b/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java index f790c448..4be5be02 100644 --- a/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java +++ b/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.constant.BusinessType; @@ -147,7 +148,7 @@ public class DictTypeController extends BaseController public String checkDictTypeUnique(DictType dictType) { String uniqueFlag = "0"; - if (dictType != null) + if (StringUtils.isNotNull(dictType)) { uniqueFlag = dictTypeService.checkDictTypeUnique(dictType); } diff --git a/src/main/java/com/ruoyi/project/system/dict/service/DictTypeServiceImpl.java b/src/main/java/com/ruoyi/project/system/dict/service/DictTypeServiceImpl.java index dc00edb0..8bf77919 100644 --- a/src/main/java/com/ruoyi/project/system/dict/service/DictTypeServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/dict/service/DictTypeServiceImpl.java @@ -133,7 +133,7 @@ public class DictTypeServiceImpl implements IDictTypeService { Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); DictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType()); - if (StringUtils.isNotNull(dictType) && dictType.getDictId() != dictId) + if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { return UserConstants.DICT_TYPE_NOT_UNIQUE; } diff --git a/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java b/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java index d5a7cf6d..857ce723 100644 --- a/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java +++ b/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.constant.BusinessType; import com.ruoyi.framework.web.controller.BaseController; @@ -142,7 +143,7 @@ public class MenuController extends BaseController public String checkMenuNameUnique(Menu menu) { String uniqueFlag = "0"; - if (menu != null) + if (StringUtils.isNotNull(menu)) { uniqueFlag = menuService.checkMenuNameUnique(menu); } diff --git a/src/main/java/com/ruoyi/project/system/post/service/PostServiceImpl.java b/src/main/java/com/ruoyi/project/system/post/service/PostServiceImpl.java index 70cf4777..06af7151 100644 --- a/src/main/java/com/ruoyi/project/system/post/service/PostServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/post/service/PostServiceImpl.java @@ -61,7 +61,7 @@ public class PostServiceImpl implements IPostService { for (Post userRole : userPosts) { - if (post.getPostId() == userRole.getPostId()) + if (post.getPostId().longValue() == userRole.getPostId().longValue()) { post.setFlag(true); break; diff --git a/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java b/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java index 6a333d5d..dee0e7cc 100644 --- a/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java +++ b/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.constant.BusinessType; @@ -140,7 +141,7 @@ public class RoleController extends BaseController public String checkRoleNameUnique(Role role) { String uniqueFlag = "0"; - if (role != null) + if (StringUtils.isNotNull(role)) { uniqueFlag = roleService.checkRoleNameUnique(role); } @@ -155,7 +156,7 @@ public class RoleController extends BaseController public String checkRoleKeyUnique(Role role) { String uniqueFlag = "0"; - if (role != null) + if (StringUtils.isNotNull(role)) { uniqueFlag = roleService.checkRoleKeyUnique(role); } diff --git a/src/main/java/com/ruoyi/project/system/role/service/RoleServiceImpl.java b/src/main/java/com/ruoyi/project/system/role/service/RoleServiceImpl.java index 36c2ea52..5b8cebf3 100644 --- a/src/main/java/com/ruoyi/project/system/role/service/RoleServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/role/service/RoleServiceImpl.java @@ -83,7 +83,7 @@ public class RoleServiceImpl implements IRoleService { for (Role userRole : userRoles) { - if (role.getRoleId() == userRole.getRoleId()) + if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) { role.setFlag(true); break; diff --git a/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java b/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java index 0eabb72c..8afa8b79 100644 --- a/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java +++ b/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java @@ -28,7 +28,7 @@ public class LoginController extends BaseController public String login(HttpServletRequest request, HttpServletResponse response) { // 如果是Ajax请求,返回Json字符串。 - if (ServletUtils.isAjaxRequest((HttpServletRequest) request)) + if (ServletUtils.isAjaxRequest(request)) { return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}"); } diff --git a/src/main/java/com/ruoyi/project/system/user/controller/UserController.java b/src/main/java/com/ruoyi/project/system/user/controller/UserController.java index a76ae0d7..0aecd2e4 100644 --- a/src/main/java/com/ruoyi/project/system/user/controller/UserController.java +++ b/src/main/java/com/ruoyi/project/system/user/controller/UserController.java @@ -177,7 +177,7 @@ public class UserController extends BaseController public String checkLoginNameUnique(User user) { String uniqueFlag = "0"; - if (user != null) + if (StringUtils.isNotNull(user)) { uniqueFlag = userService.checkLoginNameUnique(user.getLoginName()); } @@ -192,7 +192,7 @@ public class UserController extends BaseController public String checkPhoneUnique(User user) { String uniqueFlag = "0"; - if (user != null) + if (StringUtils.isNotNull(user)) { uniqueFlag = userService.checkPhoneUnique(user); } @@ -207,7 +207,7 @@ public class UserController extends BaseController public String checkEmailUnique(User user) { String uniqueFlag = "0"; - if (user != null) + if (StringUtils.isNotNull(user)) { uniqueFlag = userService.checkEmailUnique(user); }