diff --git a/pom.xml b/pom.xml
index f8fe87a1..3fbb5d49 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.ruoyi
RuoYi
- 2.2.0
+ 2.3.0
jar
RuoYi
diff --git a/src/main/java/com/ruoyi/common/constant/UserConstants.java b/src/main/java/com/ruoyi/common/constant/UserConstants.java
index 51141843..40a551b5 100644
--- a/src/main/java/com/ruoyi/common/constant/UserConstants.java
+++ b/src/main/java/com/ruoyi/common/constant/UserConstants.java
@@ -48,11 +48,19 @@ public class UserConstants
/** 角色名称是否唯一的返回结果码 */
public final static String ROLE_NAME_UNIQUE = "0";
public final static String ROLE_NAME_NOT_UNIQUE = "1";
-
+
+ /** 岗位名称是否唯一的返回结果码 */
+ public final static String POST_NAME_UNIQUE = "0";
+ public final static String POST_NAME_NOT_UNIQUE = "1";
+
/** 角色权限是否唯一的返回结果码 */
public final static String ROLE_KEY_UNIQUE = "0";
public final static String ROLE_KEY_NOT_UNIQUE = "1";
+ /** 岗位编码是否唯一的返回结果码 */
+ public final static String POST_CODE_UNIQUE = "0";
+ public final static String POST_CODE_NOT_UNIQUE = "1";
+
/** 菜单名称是否唯一的返回结果码 */
public final static String MENU_NAME_UNIQUE = "0";
public final static String MENU_NAME_NOT_UNIQUE = "1";
diff --git a/src/main/java/com/ruoyi/project/system/post/controller/PostController.java b/src/main/java/com/ruoyi/project/system/post/controller/PostController.java
index 71460419..8e4ed328 100644
--- a/src/main/java/com/ruoyi/project/system/post/controller/PostController.java
+++ b/src/main/java/com/ruoyi/project/system/post/controller/PostController.java
@@ -1,6 +1,7 @@
package com.ruoyi.project.system.post.controller;
import java.util.List;
+
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -10,6 +11,8 @@ 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;
@@ -127,4 +130,34 @@ public class PostController extends BaseController
return toAjax(postService.updatePost(post));
}
+ /**
+ * 校验岗位名称
+ */
+ @PostMapping("/checkPostNameUnique")
+ @ResponseBody
+ public String checkPostNameUnique(Post post)
+ {
+ String uniqueFlag = "0";
+ if (StringUtils.isNotNull(post))
+ {
+ uniqueFlag = postService.checkPostNameUnique(post);
+ }
+ return uniqueFlag;
+ }
+
+ /**
+ * 校验岗位编码
+ */
+ @PostMapping("/checkPostCodeUnique")
+ @ResponseBody
+ public String checkPostCodeUnique(Post post)
+ {
+ String uniqueFlag = "0";
+ if (StringUtils.isNotNull(post))
+ {
+ uniqueFlag = postService.checkPostCodeUnique(post);
+ }
+ return uniqueFlag;
+ }
+
}
diff --git a/src/main/java/com/ruoyi/project/system/post/mapper/PostMapper.java b/src/main/java/com/ruoyi/project/system/post/mapper/PostMapper.java
index ffeeb865..7b71d281 100644
--- a/src/main/java/com/ruoyi/project/system/post/mapper/PostMapper.java
+++ b/src/main/java/com/ruoyi/project/system/post/mapper/PostMapper.java
@@ -66,4 +66,20 @@ public interface PostMapper
*/
public int insertPost(Post post);
+ /**
+ * 校验岗位名称
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public Post checkPostNameUnique(String postName);
+
+ /**
+ * 校验岗位编码
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public Post checkPostCodeUnique(String postCode);
+
}
diff --git a/src/main/java/com/ruoyi/project/system/post/service/IPostService.java b/src/main/java/com/ruoyi/project/system/post/service/IPostService.java
index 2c5c84ff..93edd60c 100644
--- a/src/main/java/com/ruoyi/project/system/post/service/IPostService.java
+++ b/src/main/java/com/ruoyi/project/system/post/service/IPostService.java
@@ -73,4 +73,20 @@ public interface IPostService
* @return 结果
*/
public int countUserPostById(Long postId);
+
+ /**
+ * 校验岗位名称
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public String checkPostNameUnique(Post post);
+
+ /**
+ * 校验岗位编码
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public String checkPostCodeUnique(Post post);
}
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 06af7151..9f1c868d 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
@@ -3,7 +3,9 @@ package com.ruoyi.project.system.post.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.support.Convert;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.system.post.domain.Post;
import com.ruoyi.project.system.post.mapper.PostMapper;
@@ -142,4 +144,40 @@ public class PostServiceImpl implements IPostService
return userPostMapper.countUserPostById(postId);
}
+ /**
+ * 校验岗位名称是否唯一
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ @Override
+ public String checkPostNameUnique(Post post)
+ {
+ Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
+ Post info = postMapper.checkPostNameUnique(post.getPostName());
+ if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
+ {
+ return UserConstants.POST_NAME_NOT_UNIQUE;
+ }
+ return UserConstants.POST_NAME_UNIQUE;
+ }
+
+ /**
+ * 校验岗位编码是否唯一
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ @Override
+ public String checkPostCodeUnique(Post post)
+ {
+ Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
+ Post info = postMapper.checkPostCodeUnique(post.getPostCode());
+ if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
+ {
+ return UserConstants.POST_CODE_NOT_UNIQUE;
+ }
+ return UserConstants.POST_CODE_UNIQUE;
+ }
+
}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index a9cd9161..5ca98dfe 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -3,7 +3,7 @@ ruoyi:
#名称
name: RuoYi
#版本
- version: 2.2.0
+ version: 2.3.0
#版权年份
copyrightYear: 2018
#头像上传路径
diff --git a/src/main/resources/mybatis/system/PostMapper.xml b/src/main/resources/mybatis/system/PostMapper.xml
index b5d44ff8..7634fddb 100644
--- a/src/main/resources/mybatis/system/PostMapper.xml
+++ b/src/main/resources/mybatis/system/PostMapper.xml
@@ -53,6 +53,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where post_id = #{postId}
+
+
+
+
delete from sys_post where post_id in
diff --git a/src/main/resources/templates/include.html b/src/main/resources/templates/include.html
index 5f17fae2..a9fb90a6 100644
--- a/src/main/resources/templates/include.html
+++ b/src/main/resources/templates/include.html
@@ -38,8 +38,8 @@
-
-
+
+
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
index 6692923f..bfc46acb 100644
--- a/src/main/resources/templates/index.html
+++ b/src/main/resources/templates/index.html
@@ -15,7 +15,7 @@
-
+
@@ -136,7 +136,7 @@
-
+