From bf8bac2bcc3142affd3c05ebc1045b564b55e394 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期二, 07 十二月 2021 17:06:11 +0800
Subject: [PATCH] fix 关于 Undertow 的错误说明
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 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 9681b3d..9f9c257 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,7 +1,9 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.ServiceException;
@@ -30,12 +32,13 @@
private SysUserPostMapper userPostMapper;
@Override
- public TableDataInfo<SysPost> selectPagePostList(SysPost post) {
+ public TableDataInfo<SysPost> selectPagePostList(SysPost post, PageQuery pageQuery) {
LambdaQueryWrapper<SysPost> lqw = new LambdaQueryWrapper<SysPost>()
.like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode())
.eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus())
.like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName());
- return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw));
+ Page<SysPost> page = page(PageUtils.buildPage(pageQuery), lqw);
+ return PageUtils.buildDataInfo(page);
}
/**
@@ -80,7 +83,7 @@
* @return 閫変腑宀椾綅ID鍒楄〃
*/
@Override
- public List<Integer> selectPostListByUserId(Long userId) {
+ public List<Long> selectPostListByUserId(Long userId) {
return baseMapper.selectPostListByUserId(userId);
}
@@ -93,9 +96,10 @@
@Override
public String checkPostNameUnique(SysPost post) {
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
- SysPost info = getOne(new LambdaQueryWrapper<SysPost>()
- .eq(SysPost::getPostName, post.getPostName()).last("limit 1"));
- if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
+ long count = count(new LambdaQueryWrapper<SysPost>()
+ .eq(SysPost::getPostName, post.getPostName())
+ .ne(SysPost::getPostId, postId));
+ if (count > 0) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@@ -110,9 +114,10 @@
@Override
public String checkPostCodeUnique(SysPost post) {
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
- SysPost info = getOne(new LambdaQueryWrapper<SysPost>()
- .eq(SysPost::getPostCode, post.getPostCode()).last("limit 1"));
- if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
+ long count = count(new LambdaQueryWrapper<SysPost>()
+ .eq(SysPost::getPostCode, post.getPostCode())
+ .ne(SysPost::getPostId, postId));
+ if (count > 0) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
--
Gitblit v1.9.3