From 5ca038d888922e93bf45c7bd37f3c6dce849dcff Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 24 十二月 2021 11:36:02 +0800 Subject: [PATCH] update 调整监控依赖 从 common 迁移到 framework --- ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 62fe67a..d571468 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -2,14 +2,16 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; +import cn.hutool.core.io.IoUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.GenConstants; +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; import com.ruoyi.common.utils.JsonUtils; -import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUtils; @@ -21,7 +23,7 @@ import com.ruoyi.generator.util.VelocityInitializer; import com.ruoyi.generator.util.VelocityUtils; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.io.IOUtils; +import org.apache.poi.util.IOUtils; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; @@ -33,6 +35,7 @@ import java.io.File; import java.io.IOException; import java.io.StringWriter; +import java.nio.charset.StandardCharsets; import java.util.*; import java.util.stream.Collectors; import java.util.zip.ZipEntry; @@ -64,13 +67,15 @@ } @Override - public TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable) { - return PageUtils.buildDataInfo(baseMapper.selectPageGenTableList(PageUtils.buildPage(), genTable)); + public TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery) { + Page<GenTable> page = baseMapper.selectPageGenTableList(pageQuery.build(), genTable); + return TableDataInfo.build(page); } @Override - public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable) { - return PageUtils.buildDataInfo(baseMapper.selectPageDbTableList(PageUtils.buildPage(), genTable)); + public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery) { + Page<GenTable> page = baseMapper.selectPageDbTableList(pageQuery.build(), genTable); + return TableDataInfo.build(page); } /** @@ -123,7 +128,7 @@ * @return 缁撴灉 */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void updateGenTable(GenTable genTable) { String options = JsonUtils.toJsonString(genTable.getParams()); genTable.setOptions(options); @@ -142,7 +147,7 @@ * @return 缁撴灉 */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void deleteGenTableByIds(Long[] tableIds) { List<Long> ids = Arrays.asList(tableIds); removeByIds(ids); @@ -155,7 +160,7 @@ * @param tableList 瀵煎叆琛ㄥ垪琛� */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void importGenTable(List<GenTable> tableList) { String operName = SecurityUtils.getUsername(); try { @@ -269,7 +274,7 @@ * @param tableName 琛ㄥ悕绉� */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void synchDb(String tableName) { GenTable table = baseMapper.selectGenTableByName(tableName); List<GenTableColumn> tableColumns = table.getColumns(); @@ -341,8 +346,8 @@ try { // 娣诲姞鍒皕ip zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); - IOUtils.write(sw.toString(), zip, Constants.UTF8); - IOUtils.closeQuietly(sw); + IoUtil.write(zip, StandardCharsets.UTF_8, false, sw.toString()); + IoUtil.close(sw); zip.flush(); zip.closeEntry(); } catch (IOException e) { -- Gitblit v1.9.3