optimize: 优化 config 业务代码逻辑以及格式.

pull/161/head
chen.ma 3 years ago
parent 35dd34472a
commit 7c22923dff

@ -11,6 +11,11 @@ import lombok.Data;
@Data
public class TenantUpdateReqDTO {
/**
* id
*/
private Long id;
/**
* tenantId
*/

@ -17,10 +17,18 @@ public interface TenantService {
/**
* Get tenant by id.
*
* @param tenantIdId
* @param id
* @return
*/
TenantRespDTO getTenantById(String tenantIdId);
TenantRespDTO getTenantById(String id);
/**
* Get tenant by tenantId.
*
* @param tenantId
* @return
*/
TenantRespDTO getTenantByTenantId(String tenantId);
/**
* Query tenant page.

@ -1,4 +1,4 @@
package com.github.dynamic.threadpool.config.service.biz;
package com.github.dynamic.threadpool.config.service.biz.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -11,6 +11,7 @@ import com.github.dynamic.threadpool.config.event.LocalDataChangeEvent;
import com.github.dynamic.threadpool.config.mapper.ConfigInfoMapper;
import com.github.dynamic.threadpool.config.model.ConfigAllInfo;
import com.github.dynamic.threadpool.config.service.ConfigChangePublisher;
import com.github.dynamic.threadpool.config.service.biz.ConfigService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@ -1,4 +1,4 @@
package com.github.dynamic.threadpool.config.service.biz;
package com.github.dynamic.threadpool.config.service.biz.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -14,6 +14,8 @@ import com.github.dynamic.threadpool.config.model.biz.item.ItemRespDTO;
import com.github.dynamic.threadpool.config.model.biz.item.ItemSaveReqDTO;
import com.github.dynamic.threadpool.config.model.biz.item.ItemUpdateReqDTO;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolRespDTO;
import com.github.dynamic.threadpool.config.service.biz.ItemService;
import com.github.dynamic.threadpool.config.service.biz.ThreadPoolService;
import com.github.dynamic.threadpool.config.toolkit.BeanUtil;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
@ -83,10 +85,10 @@ public class ItemServiceImpl implements ItemService {
@Override
public void updateItem(ItemUpdateReqDTO reqDTO) {
ItemInfo itemInfo = BeanUtil.convert(reqDTO, ItemInfo.class);
int updateResult = itemInfoMapper.update(itemInfo, Wrappers
.lambdaUpdate(ItemInfo.class)
.eq(ItemInfo::getTenantId, reqDTO.getTenantId())
.eq(ItemInfo::getItemId, reqDTO.getItemId()));
int updateResult = itemInfoMapper.update(itemInfo,
Wrappers.lambdaUpdate(ItemInfo.class)
.eq(ItemInfo::getTenantId, reqDTO.getTenantId())
.eq(ItemInfo::getItemId, reqDTO.getItemId()));
boolean retBool = SqlHelper.retBool(updateResult);
if (!retBool) {

@ -1,4 +1,4 @@
package com.github.dynamic.threadpool.config.service.biz;
package com.github.dynamic.threadpool.config.service.biz.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -9,6 +9,8 @@ import com.github.dynamic.threadpool.config.model.ConfigAllInfo;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolQueryReqDTO;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolRespDTO;
import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolSaveOrUpdateReqDTO;
import com.github.dynamic.threadpool.config.service.biz.ConfigService;
import com.github.dynamic.threadpool.config.service.biz.ThreadPoolService;
import com.github.dynamic.threadpool.config.toolkit.BeanUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@ -32,7 +32,7 @@ public class TenantController {
@GetMapping("/query/{tenantId}")
public Result<TenantRespDTO> queryNameSpace(@PathVariable("tenantId") String tenantId) {
return Results.success(tenantService.getTenantById(tenantId));
return Results.success(tenantService.getTenantByTenantId(tenantId));
}
@PostMapping("/save")

@ -1,6 +1,8 @@
server:
port: 6691
tenant: hippo
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver

Loading…
Cancel
Save