Tenant and project list paging queries are displayed in reverse order of creation time (#433)

* Thread pool monitoring page chart UI optimization (#358)

* Tenant and project list paging queries are displayed in reverse order of creation time (#426)
pull/436/head
小马哥 2 years ago committed by GitHub
parent 0e0631126b
commit e3ac4f9ab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,23 +30,27 @@ import lombok.Data;
public class ItemQueryReqDTO extends Page { public class ItemQueryReqDTO extends Page {
/** /**
* tenantId * Tenant id
*/ */
private String tenantId; private String tenantId;
/** /**
* itemId * Item id
*/ */
private String itemId; private String itemId;
/** /**
* itemName * Item name
*/ */
private String itemName; private String itemName;
/** /**
* owner * Owner
*/ */
private String owner; private String owner;
/**
* Desc
*/
private Boolean desc;
} }

@ -30,18 +30,22 @@ import lombok.Data;
public class TenantQueryReqDTO extends Page { public class TenantQueryReqDTO extends Page {
/** /**
* tenantId * Tenant id
*/ */
private String tenantId; private String tenantId;
/** /**
* tenantName * Tenant name
*/ */
private String tenantName; private String tenantName;
/** /**
* owner * Owner
*/ */
private String owner; private String owner;
/**
* Desc
*/
private Boolean desc;
} }

@ -61,8 +61,8 @@ public class ItemServiceImpl implements ItemService {
.eq(!StringUtils.isEmpty(reqDTO.getItemId()), ItemInfo::getItemId, reqDTO.getItemId()) .eq(!StringUtils.isEmpty(reqDTO.getItemId()), ItemInfo::getItemId, reqDTO.getItemId())
.eq(!StringUtils.isEmpty(reqDTO.getItemName()), ItemInfo::getItemName, reqDTO.getItemName()) .eq(!StringUtils.isEmpty(reqDTO.getItemName()), ItemInfo::getItemName, reqDTO.getItemName())
.eq(!StringUtils.isEmpty(reqDTO.getTenantId()), ItemInfo::getTenantId, reqDTO.getTenantId()) .eq(!StringUtils.isEmpty(reqDTO.getTenantId()), ItemInfo::getTenantId, reqDTO.getTenantId())
.eq(!StringUtils.isEmpty(reqDTO.getOwner()), ItemInfo::getOwner, reqDTO.getOwner()); .eq(!StringUtils.isEmpty(reqDTO.getOwner()), ItemInfo::getOwner, reqDTO.getOwner())
.orderByDesc(reqDTO.getDesc() != null, ItemInfo::getGmtCreate);
Page<ItemInfo> resultPage = itemInfoMapper.selectPage(reqDTO, wrapper); Page<ItemInfo> resultPage = itemInfoMapper.selectPage(reqDTO, wrapper);
return resultPage.convert(each -> BeanUtil.convert(each, ItemRespDTO.class)); return resultPage.convert(each -> BeanUtil.convert(each, ItemRespDTO.class));
} }

@ -66,7 +66,6 @@ public class TenantServiceImpl implements TenantService {
public TenantRespDTO getTenantByTenantId(String tenantId) { public TenantRespDTO getTenantByTenantId(String tenantId) {
LambdaQueryWrapper<TenantInfo> queryWrapper = Wrappers LambdaQueryWrapper<TenantInfo> queryWrapper = Wrappers
.lambdaQuery(TenantInfo.class).eq(TenantInfo::getTenantId, tenantId); .lambdaQuery(TenantInfo.class).eq(TenantInfo::getTenantId, tenantId);
TenantInfo tenantInfo = tenantInfoMapper.selectOne(queryWrapper); TenantInfo tenantInfo = tenantInfoMapper.selectOne(queryWrapper);
TenantRespDTO result = BeanUtil.convert(tenantInfo, TenantRespDTO.class); TenantRespDTO result = BeanUtil.convert(tenantInfo, TenantRespDTO.class);
return result; return result;
@ -77,8 +76,8 @@ public class TenantServiceImpl implements TenantService {
LambdaQueryWrapper<TenantInfo> wrapper = Wrappers.lambdaQuery(TenantInfo.class) LambdaQueryWrapper<TenantInfo> wrapper = Wrappers.lambdaQuery(TenantInfo.class)
.eq(!StringUtils.isEmpty(reqDTO.getTenantId()), TenantInfo::getTenantId, reqDTO.getTenantId()) .eq(!StringUtils.isEmpty(reqDTO.getTenantId()), TenantInfo::getTenantId, reqDTO.getTenantId())
.eq(!StringUtils.isEmpty(reqDTO.getTenantName()), TenantInfo::getTenantName, reqDTO.getTenantName()) .eq(!StringUtils.isEmpty(reqDTO.getTenantName()), TenantInfo::getTenantName, reqDTO.getTenantName())
.eq(!StringUtils.isEmpty(reqDTO.getOwner()), TenantInfo::getOwner, reqDTO.getOwner()); .eq(!StringUtils.isEmpty(reqDTO.getOwner()), TenantInfo::getOwner, reqDTO.getOwner())
.orderByDesc(reqDTO.getDesc() != null, TenantInfo::getGmtCreate);
Page resultPage = tenantInfoMapper.selectPage(reqDTO, wrapper); Page resultPage = tenantInfoMapper.selectPage(reqDTO, wrapper);
return resultPage.convert(each -> BeanUtil.convert(each, TenantRespDTO.class)); return resultPage.convert(each -> BeanUtil.convert(each, TenantRespDTO.class));
} }
@ -87,8 +86,7 @@ public class TenantServiceImpl implements TenantService {
public void saveTenant(TenantSaveReqDTO reqDTO) { public void saveTenant(TenantSaveReqDTO reqDTO) {
LambdaQueryWrapper<TenantInfo> queryWrapper = Wrappers.lambdaQuery(TenantInfo.class) LambdaQueryWrapper<TenantInfo> queryWrapper = Wrappers.lambdaQuery(TenantInfo.class)
.eq(TenantInfo::getTenantId, reqDTO.getTenantId()); .eq(TenantInfo::getTenantId, reqDTO.getTenantId());
// Currently it is a single application, and it supports switching distributed locks during cluster deployment in the future.
// 当前为单体应用, 后续支持集群部署时切换分布式锁.
synchronized (TenantService.class) { synchronized (TenantService.class) {
TenantInfo existTenantInfo = tenantInfoMapper.selectOne(queryWrapper); TenantInfo existTenantInfo = tenantInfoMapper.selectOne(queryWrapper);
Assert.isNull(existTenantInfo, "租户配置已存在."); Assert.isNull(existTenantInfo, "租户配置已存在.");
@ -109,7 +107,6 @@ public class TenantServiceImpl implements TenantService {
TenantInfo tenantInfo = BeanUtil.convert(reqDTO, TenantInfo.class); TenantInfo tenantInfo = BeanUtil.convert(reqDTO, TenantInfo.class);
int updateResult = tenantInfoMapper.update(tenantInfo, Wrappers int updateResult = tenantInfoMapper.update(tenantInfo, Wrappers
.lambdaUpdate(TenantInfo.class).eq(TenantInfo::getTenantId, reqDTO.getTenantId())); .lambdaUpdate(TenantInfo.class).eq(TenantInfo::getTenantId, reqDTO.getTenantId()));
boolean retBool = SqlHelper.retBool(updateResult); boolean retBool = SqlHelper.retBool(updateResult);
if (!retBool) { if (!retBool) {
throw new RuntimeException("Update Error."); throw new RuntimeException("Update Error.");
@ -124,7 +121,6 @@ public class TenantServiceImpl implements TenantService {
if (CollectionUtils.isNotEmpty(itemList)) { if (CollectionUtils.isNotEmpty(itemList)) {
throw new RuntimeException("租户包含项目引用, 删除失败."); throw new RuntimeException("租户包含项目引用, 删除失败.");
} }
int updateResult = tenantInfoMapper.update(new TenantInfo(), int updateResult = tenantInfoMapper.update(new TenantInfo(),
Wrappers.lambdaUpdate(TenantInfo.class) Wrappers.lambdaUpdate(TenantInfo.class)
.eq(TenantInfo::getTenantId, tenantId) .eq(TenantInfo::getTenantId, tenantId)

Loading…
Cancel
Save