update 使用 MP 分页工具 重构业务

This commit is contained in:
疯狂的狮子li
2021-05-13 21:25:51 +08:00
parent b0417338cc
commit f01bb5966a
46 changed files with 445 additions and 162 deletions

View File

@ -1,32 +1,26 @@
package com.ruoyi.generator.controller;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.convert.Convert;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import cn.hutool.core.convert.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn;
import com.ruoyi.generator.service.IGenTableColumnService;
import com.ruoyi.generator.service.IGenTableService;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 代码生成 操作处理
@ -50,9 +44,7 @@ public class GenController extends BaseController
@GetMapping("/list")
public TableDataInfo genList(GenTable genTable)
{
startPage();
List<GenTable> list = genTableService.selectGenTableList(genTable);
return getDataTable(list);
return genTableService.selectPageGenTableList(genTable);
}
/**
@ -79,9 +71,7 @@ public class GenController extends BaseController
@GetMapping("/db/list")
public TableDataInfo dataList(GenTable genTable)
{
startPage();
List<GenTable> list = genTableService.selectDbTableList(genTable);
return getDataTable(list);
return genTableService.selectPageDbTableList(genTable);
}
/**

View File

@ -1,6 +1,7 @@
package com.ruoyi.generator.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.generator.domain.GenTable;
import java.util.List;
@ -11,6 +12,12 @@ import java.util.List;
* @author ruoyi
*/
public interface GenTableMapper extends BaseMapper<GenTable> {
Page<GenTable> selectPageGenTableList(Page<GenTable> page, GenTable genTable);
Page<GenTable> selectPageDbTableList(Page<GenTable> page, GenTable genTable);
/**
* 查询业务列表
*

View File

@ -10,7 +10,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.generator.domain.GenTable;
@ -66,6 +68,16 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
return genTable;
}
@Override
public TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable) {
return PageUtils.buildDataInfo(baseMapper.selectPageGenTableList(PageUtils.buildPage(), genTable));
}
@Override
public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable) {
return PageUtils.buildDataInfo(baseMapper.selectPageDbTableList(PageUtils.buildPage(), genTable));
}
/**
* 查询业务列表
*

View File

@ -1,6 +1,6 @@
package com.ruoyi.generator.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.page.IServicePlus;
import com.ruoyi.generator.domain.GenTableColumn;
import java.util.List;
@ -10,7 +10,7 @@ import java.util.List;
*
* @author ruoyi
*/
public interface IGenTableColumnService extends IService<GenTableColumn> {
public interface IGenTableColumnService extends IServicePlus<GenTableColumn> {
/**
* 查询业务字段列表
*

View File

@ -1,6 +1,7 @@
package com.ruoyi.generator.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.page.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.generator.domain.GenTable;
import java.util.List;
@ -11,7 +12,14 @@ import java.util.Map;
*
* @author ruoyi
*/
public interface IGenTableService extends IService<GenTable> {
public interface IGenTableService extends IServicePlus<GenTable> {
TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable);
TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable);
/**
* 查询业务列表
*