From 553c29ab8a46c9a07e3657fdd36a81a6bfde1afe Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期四, 23 九月 2021 19:13:58 +0800
Subject: [PATCH] update 整合 satoken 权限、鉴权一体化框架

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
index 495c2e9..3a3cd0f 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
@@ -1,11 +1,10 @@
 package com.ruoyi.system.service.impl;
 
-import cn.hutool.core.lang.Validator;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.exception.CustomException;
+import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.PageUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.SysPost;
@@ -93,10 +92,10 @@
      */
     @Override
     public String checkPostNameUnique(SysPost post) {
-        Long postId = Validator.isNull(post.getPostId()) ? -1L : post.getPostId();
+        Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
         SysPost info = getOne(new LambdaQueryWrapper<SysPost>()
                 .eq(SysPost::getPostName, post.getPostName()).last("limit 1"));
-        if (Validator.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
+        if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -110,10 +109,10 @@
      */
     @Override
     public String checkPostCodeUnique(SysPost post) {
-        Long postId = Validator.isNull(post.getPostId()) ? -1L : post.getPostId();
+        Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
         SysPost info = getOne(new LambdaQueryWrapper<SysPost>()
                 .eq(SysPost::getPostCode, post.getPostCode()).last("limit 1"));
-        if (Validator.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
+        if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
             return UserConstants.NOT_UNIQUE;
         }
         return UserConstants.UNIQUE;
@@ -126,7 +125,7 @@
      * @return 缁撴灉
      */
     @Override
-    public int countUserPostById(Long postId) {
+    public long countUserPostById(Long postId) {
         return userPostMapper.selectCount(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getPostId,postId));
     }
 
@@ -153,7 +152,7 @@
         for (Long postId : postIds) {
             SysPost post = selectPostById(postId);
             if (countUserPostById(postId) > 0) {
-                throw new CustomException(String.format("%1$s宸插垎閰�,涓嶈兘鍒犻櫎", post.getPostName()));
+                throw new ServiceException(String.format("%1$s宸插垎閰�,涓嶈兘鍒犻櫎", post.getPostName()));
             }
         }
         return baseMapper.deleteBatchIds(Arrays.asList(postIds));

--
Gitblit v1.9.3