update 优化 全业务分页查询增加排序规则避免因where条件导致乱序问题

2.X
疯狂的狮子Li 1 year ago
parent af2f1820f6
commit 9c22b6e0c2

@ -65,6 +65,7 @@ public class TestDemoServiceImpl implements ITestDemoService {
lqw.eq(StringUtils.isNotBlank(bo.getValue()), TestDemo::getValue, bo.getValue());
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
TestDemo::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
lqw.orderByAsc(TestDemo::getId);
return lqw;
}

@ -47,6 +47,7 @@ public class TestTreeServiceImpl implements ITestTreeService {
lqw.like(StringUtils.isNotBlank(bo.getTreeName()), TestTree::getTreeName, bo.getTreeName());
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
TestTree::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
lqw.orderByAsc(TestTree::getId);
return lqw;
}

@ -92,6 +92,7 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
lqw.eq(StringUtils.isNotBlank(bo.getConfigKey()), SysOssConfig::getConfigKey, bo.getConfigKey());
lqw.like(StringUtils.isNotBlank(bo.getBucketName()), SysOssConfig::getBucketName, bo.getBucketName());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysOssConfig::getStatus, bo.getStatus());
lqw.orderByAsc(SysOssConfig::getOssConfigId);
return lqw;
}

@ -95,6 +95,7 @@ public class SysOssServiceImpl implements ISysOssService {
SysOss::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
lqw.eq(ObjectUtil.isNotNull(bo.getCreateBy()), SysOss::getCreateBy, bo.getCreateBy());
lqw.eq(StringUtils.isNotBlank(bo.getService()), SysOss::getService, bo.getService());
lqw.orderByAsc(SysOss::getOssId);
return lqw;
}

@ -20,7 +20,6 @@ import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* Service
@ -74,12 +73,12 @@ public class SysClientServiceImpl implements ISysClientService {
}
private LambdaQueryWrapper<SysClient> buildQueryWrapper(SysClientBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SysClient> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotBlank(bo.getClientId()), SysClient::getClientId, bo.getClientId());
lqw.eq(StringUtils.isNotBlank(bo.getClientKey()), SysClient::getClientKey, bo.getClientKey());
lqw.eq(StringUtils.isNotBlank(bo.getClientSecret()), SysClient::getClientSecret, bo.getClientSecret());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysClient::getStatus, bo.getStatus());
lqw.orderByAsc(SysClient::getId);
return lqw;
}

@ -112,6 +112,7 @@ public class SysConfigServiceImpl implements ISysConfigService {
lqw.like(StringUtils.isNotBlank(bo.getConfigKey()), SysConfig::getConfigKey, bo.getConfigKey());
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
lqw.orderByAsc(SysConfig::getConfigId);
return lqw;
}

@ -82,6 +82,7 @@ public class SysDeptServiceImpl implements ISysDeptService{
lqw.eq(ObjectUtil.isNotNull(bo.getParentId()), SysDept::getParentId, bo.getParentId());
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), SysDept::getDeptName, bo.getDeptName());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
lqw.orderByAsc(SysDept::getDeptId);
lqw.orderByAsc(SysDept::getParentId);
lqw.orderByAsc(SysDept::getOrderNum);
return lqw;

@ -70,6 +70,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
lqw.like(StringUtils.isNotBlank(bo.getDictType()), SysDictType::getDictType, bo.getDictType());
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
SysDictType::getCreateTime, params.get("beginTime"), params.get("endTime"));
lqw.orderByAsc(SysDictType::getDictId);
return lqw;
}

@ -71,6 +71,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
SysUserVo sysUser = userMapper.selectUserByUserName(bo.getCreateByName());
lqw.eq(SysNotice::getCreateBy, ObjectUtil.isNotNull(sysUser) ? sysUser.getUserId() : null);
}
lqw.orderByAsc(SysNotice::getNoticeId);
return lqw;
}

@ -24,7 +24,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* Service
@ -72,10 +71,10 @@ public class SysTenantPackageServiceImpl implements ISysTenantPackageService {
}
private LambdaQueryWrapper<SysTenantPackage> buildQueryWrapper(SysTenantPackageBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SysTenantPackage> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getPackageName()), SysTenantPackage::getPackageName, bo.getPackageName());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysTenantPackage::getStatus, bo.getStatus());
lqw.orderByAsc(SysTenantPackage::getPackageId);
return lqw;
}

@ -103,6 +103,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
lqw.eq(bo.getExpireTime() != null, SysTenant::getExpireTime, bo.getExpireTime());
lqw.eq(bo.getAccountCount() != null, SysTenant::getAccountCount, bo.getAccountCount());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysTenant::getStatus, bo.getStatus());
lqw.orderByAsc(SysTenant::getId);
return lqw;
}

@ -90,7 +90,7 @@ public class SysUserServiceImpl implements ISysUserService {
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
ids.add(user.getDeptId());
w.in("u.dept_id", ids);
});
}).orderByAsc("u.user_id");
return wrapper;
}
@ -107,7 +107,8 @@ public class SysUserServiceImpl implements ISysUserService {
.eq(ObjectUtil.isNotNull(user.getRoleId()), "r.role_id", user.getRoleId())
.like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
.eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus())
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber());
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
.orderByAsc("u.user_id");
Page<SysUserVo> page = baseMapper.selectAllocatedList(pageQuery.build(), wrapper);
return TableDataInfo.build(page);
}
@ -126,7 +127,8 @@ public class SysUserServiceImpl implements ISysUserService {
.and(w -> w.ne("r.role_id", user.getRoleId()).or().isNull("r.role_id"))
.notIn(CollUtil.isNotEmpty(userIds), "u.user_id", userIds)
.like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber());
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
.orderByAsc("u.user_id");
Page<SysUserVo> page = baseMapper.selectUnallocatedList(pageQuery.build(), wrapper);
return TableDataInfo.build(page);
}
@ -523,6 +525,7 @@ public class SysUserServiceImpl implements ISysUserService {
public List<SysUserVo> selectUserListByDept(Long deptId) {
LambdaQueryWrapper<SysUser> lqw = Wrappers.lambdaQuery();
lqw.eq(SysUser::getDeptId, deptId);
lqw.orderByAsc(SysUser::getUserId);
return baseMapper.selectVoList(lqw);
}

Loading…
Cancel
Save