1. 修复错误的sql
2. 添加创建库的sql 3. 修复mybatis-plus不能startpage分页的问题
This commit is contained in:
parent
896e88c8e1
commit
c74f2b1804
16
.vscode/settings.json
vendored
16
.vscode/settings.json
vendored
@ -25,4 +25,20 @@
|
|||||||
"maven.executable.preferMavenWrapper": true,
|
"maven.executable.preferMavenWrapper": true,
|
||||||
"java.import.maven.enabled": true,
|
"java.import.maven.enabled": true,
|
||||||
"java.dependency.packagePresentation": "hierarchical",
|
"java.dependency.packagePresentation": "hierarchical",
|
||||||
|
"sqltools.connections": [
|
||||||
|
{
|
||||||
|
"mysqlOptions": {
|
||||||
|
"authProtocol": "default",
|
||||||
|
"enableSsl": "Disabled"
|
||||||
|
},
|
||||||
|
"previewLimit": 50,
|
||||||
|
"server": "localhost",
|
||||||
|
"port": 3306,
|
||||||
|
"driver": "MySQL",
|
||||||
|
"name": "localhost",
|
||||||
|
"database": "ry",
|
||||||
|
"username": "root",
|
||||||
|
"password": "123456"
|
||||||
|
}
|
||||||
|
],
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ pagehelper:
|
|||||||
|
|
||||||
createSqlSessionFactory:
|
createSqlSessionFactory:
|
||||||
# 选择MyBatis配置方式,mybatis / mybatis-plus
|
# 选择MyBatis配置方式,mybatis / mybatis-plus
|
||||||
use: mybatis
|
use: mybatis-plus
|
||||||
|
|
||||||
# MyBatis配置
|
# MyBatis配置
|
||||||
mybatis:
|
mybatis:
|
||||||
|
@ -19,6 +19,8 @@ import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerIntercep
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||||
|
import com.github.pagehelper.PageInterceptor;
|
||||||
|
import com.github.pagehelper.autoconfigure.PageHelperStandardProperties;
|
||||||
import com.ruoyi.common.interceptor.mybatis.CreateSqlSessionFactory;
|
import com.ruoyi.common.interceptor.mybatis.CreateSqlSessionFactory;
|
||||||
import com.ruoyi.common.utils.MybatisUtils;
|
import com.ruoyi.common.utils.MybatisUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
@ -72,7 +74,7 @@ public class MybatisPlusConfig {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "createSqlSessionFactory", name = "use", havingValue = "mybatis-plus")
|
@ConditionalOnProperty(prefix = "createSqlSessionFactory", name = "use", havingValue = "mybatis-plus")
|
||||||
public CreateSqlSessionFactory createSqlSessionFactory() {
|
public CreateSqlSessionFactory createSqlSessionFactory(PageHelperStandardProperties packageHelperStandardProperties) {
|
||||||
return new CreateSqlSessionFactory() {
|
return new CreateSqlSessionFactory() {
|
||||||
public SqlSessionFactory createSqlSessionFactory(Environment env, DataSource dataSource) throws Exception {
|
public SqlSessionFactory createSqlSessionFactory(Environment env, DataSource dataSource) throws Exception {
|
||||||
String typeAliasesPackage = env.getProperty("mybatis-plus.typeAliasesPackage");
|
String typeAliasesPackage = env.getProperty("mybatis-plus.typeAliasesPackage");
|
||||||
@ -88,6 +90,9 @@ public class MybatisPlusConfig {
|
|||||||
sessionFactory.setMapperLocations(
|
sessionFactory.setMapperLocations(
|
||||||
MybatisUtils.resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
|
MybatisUtils.resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
|
||||||
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
|
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
|
||||||
|
PageInterceptor interceptor = new PageInterceptor();
|
||||||
|
interceptor.setProperties(packageHelperStandardProperties.getProperties());
|
||||||
|
sessionFactory.addPlugins(interceptor);
|
||||||
return sessionFactory.getObject();
|
return sessionFactory.getObject();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
3
sql/create_database.sql
Normal file
3
sql/create_database.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
CREATE DATABASE ry
|
||||||
|
CHARACTER SET utf8mb4
|
||||||
|
COLLATE utf8mb4_general_ci;
|
@ -39,11 +39,14 @@ CREATE TABLE `pay_invoice` (
|
|||||||
PRIMARY KEY (`invoice_id`)
|
PRIMARY KEY (`invoice_id`)
|
||||||
) ENGINE = InnoDB COMMENT = '发票';
|
) ENGINE = InnoDB COMMENT = '发票';
|
||||||
|
|
||||||
INSERT INTO sys_menu (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`,route_name, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2024, '支付管理', 0, 4, '/pay', '', NULL, NULL, '',1, 0, 'M', '0', '0', NULL, 'money', 'admin', '2024-02-15 22:40:23', '', NULL, '');
|
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query,route_name, is_frame, is_cache, menu_type, visible, `status`, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ('支付管理', 0, 4, '/pay', NULL, NULL, '',1, 0, 'M', '0', '0', NULL, 'money', 'admin', '2024-02-15 22:40:23', '', NULL, '');
|
||||||
|
|
||||||
|
-- 按钮父菜单ID
|
||||||
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
-- 菜单 SQL
|
-- 菜单 SQL
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('订单', '2024', '1', 'order', 'pay/order/index', '',1, 0, 'C', '0', '0', 'pay:order:list', '#', 'admin', sysdate(), '', null, '订单菜单');
|
values('订单', @parentId, '1', 'order', 'pay/order/index', '',1, 0, 'C', '0', '0', 'pay:order:list', '#', 'admin', sysdate(), '', null, '订单菜单');
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
-- 按钮父菜单ID
|
||||||
SELECT @parentId := LAST_INSERT_ID();
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
Loading…
Reference in New Issue
Block a user