疯狂的狮子li
2021-12-27 dd37247e65374dd4ef7e8e8b9212d8f29023e301
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
@@ -4,15 +4,14 @@
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.*;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
@@ -66,13 +65,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);
    }
    /**
@@ -125,7 +126,7 @@
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = { Exception.class })
    @Transactional(rollbackFor = Exception.class)
    public void updateGenTable(GenTable genTable) {
        String options = JsonUtils.toJsonString(genTable.getParams());
        genTable.setOptions(options);
@@ -144,7 +145,7 @@
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = { Exception.class })
    @Transactional(rollbackFor = Exception.class)
    public void deleteGenTableByIds(Long[] tableIds) {
        List<Long> ids = Arrays.asList(tableIds);
        removeByIds(ids);
@@ -157,9 +158,9 @@
     * @param tableList 导入表列表
     */
    @Override
    @Transactional(rollbackFor = { Exception.class })
    @Transactional(rollbackFor = Exception.class)
    public void importGenTable(List<GenTable> tableList) {
        String operName = SecurityUtils.getUsername();
        String operName = LoginUtils.getUsername();
        try {
            for (GenTable table : tableList) {
                String tableName = table.getTableName();
@@ -271,7 +272,7 @@
     * @param tableName 表名称
     */
    @Override
    @Transactional(rollbackFor = { Exception.class })
    @Transactional(rollbackFor = Exception.class)
    public void synchDb(String tableName) {
        GenTable table = baseMapper.selectGenTableByName(tableName);
        List<GenTableColumn> tableColumns = table.getColumns();