Optimize: 代码格式优化.

pull/10/head
chen.ma 3 years ago
parent 39b7069736
commit 60cdfefbdd

@ -16,11 +16,10 @@ public class ConditionUtil {
} }
} }
public interface NoArgsConsumer { public interface NoArgsConsumer {
/** /**
* *
*/ */
void accept(); void accept();

@ -8,6 +8,7 @@ import com.github.dynamic.threadpool.config.model.ConfigAllInfo;
import com.github.dynamic.threadpool.config.model.ConfigInfoBase; import com.github.dynamic.threadpool.config.model.ConfigInfoBase;
import com.github.dynamic.threadpool.config.service.ConfigServletInner; import com.github.dynamic.threadpool.config.service.ConfigServletInner;
import com.github.dynamic.threadpool.config.toolkit.Md5ConfigUtil; import com.github.dynamic.threadpool.config.toolkit.Md5ConfigUtil;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@ -25,14 +26,13 @@ import java.util.Map;
* @date 2021/6/20 13:53 * @date 2021/6/20 13:53
*/ */
@RestController @RestController
@AllArgsConstructor
@RequestMapping(Constants.CONFIG_CONTROLLER_PATH) @RequestMapping(Constants.CONFIG_CONTROLLER_PATH)
public class ConfigController { public class ConfigController {
@Autowired private final ConfigService configService;
private ConfigService configService;
@Autowired private final ConfigServletInner configServletInner;
private ConfigServletInner configServletInner;
@GetMapping @GetMapping
public Result<ConfigInfoBase> detailConfigInfo( public Result<ConfigInfoBase> detailConfigInfo(

@ -131,4 +131,5 @@ public class DefaultPublisher extends Thread implements EventPublisher {
notifySubscriber(subscriber, event); notifySubscriber(subscriber, event);
} }
} }
} }

@ -70,6 +70,7 @@ public class ConfigServiceImpl implements ConfigService {
private Integer addConfigInfo(ConfigAllInfo config) { private Integer addConfigInfo(ConfigAllInfo config) {
config.setContent(ContentUtil.getPoolContent(config)); config.setContent(ContentUtil.getPoolContent(config));
config.setMd5(Md5Util.getTpContentMd5(config)); config.setMd5(Md5Util.getTpContentMd5(config));
try { try {
if (SqlHelper.retBool(configInfoMapper.insert(config))) { if (SqlHelper.retBool(configInfoMapper.insert(config))) {
return config.getId(); return config.getId();

@ -44,8 +44,8 @@ public class ItemServiceImpl implements ItemService {
.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());
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));
} }
@ -55,8 +55,8 @@ public class ItemServiceImpl implements ItemService {
.lambdaQuery(ItemInfo.class) .lambdaQuery(ItemInfo.class)
.eq(ItemInfo::getTenantId, tenantId) .eq(ItemInfo::getTenantId, tenantId)
.eq(ItemInfo::getItemId, itemId); .eq(ItemInfo::getItemId, itemId);
ItemInfo itemInfo = itemInfoMapper.selectOne(queryWrapper);
ItemInfo itemInfo = itemInfoMapper.selectOne(queryWrapper);
ItemRespDTO result = BeanUtil.convert(itemInfo, ItemRespDTO.class); ItemRespDTO result = BeanUtil.convert(itemInfo, ItemRespDTO.class);
return result; return result;
} }

@ -16,7 +16,7 @@ import org.springframework.stereotype.Service;
@AllArgsConstructor @AllArgsConstructor
public class LogRecordServiceImpl implements LogRecordService { public class LogRecordServiceImpl implements LogRecordService {
private LogRecordMapper logRecordMapper; private final LogRecordMapper logRecordMapper;
@Override @Override
public void record(LogRecordInfo logRecordInfo) { public void record(LogRecordInfo logRecordInfo) {

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.github.dynamic.threadpool.common.toolkit.Assert;
import com.github.dynamic.threadpool.config.enums.DelEnum; import com.github.dynamic.threadpool.config.enums.DelEnum;
import com.github.dynamic.threadpool.config.mapper.TenantInfoMapper; import com.github.dynamic.threadpool.config.mapper.TenantInfoMapper;
import com.github.dynamic.threadpool.config.model.TenantInfo; import com.github.dynamic.threadpool.config.model.TenantInfo;
@ -48,8 +49,8 @@ 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;
} }
@ -60,8 +61,8 @@ public class TenantServiceImpl implements TenantService {
.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());
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));
} }

@ -1,6 +1,7 @@
package com.github.dynamic.threadpool.config.service.biz.impl; package com.github.dynamic.threadpool.config.service.biz.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -39,6 +40,7 @@ public class ThreadPoolServiceImpl implements ThreadPoolService {
.eq(!StringUtils.isBlank(reqDTO.getItemId()), ConfigAllInfo::getItemId, reqDTO.getItemId()) .eq(!StringUtils.isBlank(reqDTO.getItemId()), ConfigAllInfo::getItemId, reqDTO.getItemId())
.eq(!StringUtils.isBlank(reqDTO.getTpId()), ConfigAllInfo::getTpId, reqDTO.getTpId()) .eq(!StringUtils.isBlank(reqDTO.getTpId()), ConfigAllInfo::getTpId, reqDTO.getTpId())
.eq(ConfigAllInfo::getDelFlag, DelEnum.NORMAL); .eq(ConfigAllInfo::getDelFlag, DelEnum.NORMAL);
return configInfoMapper.selectPage(reqDTO, wrapper).convert(each -> BeanUtil.convert(each, ThreadPoolRespDTO.class)); return configInfoMapper.selectPage(reqDTO, wrapper).convert(each -> BeanUtil.convert(each, ThreadPoolRespDTO.class));
} }
@ -50,8 +52,10 @@ public class ThreadPoolServiceImpl implements ThreadPoolService {
@Override @Override
public List<ThreadPoolRespDTO> getThreadPoolByItemId(String itemId) { public List<ThreadPoolRespDTO> getThreadPoolByItemId(String itemId) {
List<ConfigAllInfo> selectList = configInfoMapper LambdaQueryWrapper<ConfigAllInfo> queryWrapper = Wrappers.lambdaQuery(ConfigAllInfo.class)
.selectList(Wrappers.lambdaUpdate(ConfigAllInfo.class).eq(ConfigAllInfo::getItemId, itemId)); .eq(ConfigAllInfo::getItemId, itemId);
List<ConfigAllInfo> selectList = configInfoMapper.selectList(queryWrapper);
return BeanUtil.convert(selectList, ThreadPoolRespDTO.class); return BeanUtil.convert(selectList, ThreadPoolRespDTO.class);
} }

Loading…
Cancel
Save