mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-31 09:30:05 +08:00
Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/springdoc
# Conflicts: # yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java # yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/clean.sql # yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/create_tables.sql # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/PostController.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsChannelController.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java # yudao-server/pom.xml
This commit is contained in:
commit
c3eb9022b8
4
pom.xml
4
pom.xml
@ -17,7 +17,7 @@
|
|||||||
<module>yudao-module-system</module>
|
<module>yudao-module-system</module>
|
||||||
<module>yudao-module-infra</module>
|
<module>yudao-module-infra</module>
|
||||||
<module>yudao-module-pay</module>
|
<module>yudao-module-pay</module>
|
||||||
<!-- <module>yudao-module-bpm</module>-->
|
<module>yudao-module-bpm</module>
|
||||||
<!-- <module>yudao-module-visualization</module>-->
|
<!-- <module>yudao-module-visualization</module>-->
|
||||||
<!-- <module>yudao-module-mp</module>-->
|
<!-- <module>yudao-module-mp</module>-->
|
||||||
<!-- <module>yudao-module-mall</module>-->
|
<!-- <module>yudao-module-mall</module>-->
|
||||||
@ -39,7 +39,7 @@
|
|||||||
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
|
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
|
||||||
<!-- 看看咋放到 bom 里 -->
|
<!-- 看看咋放到 bom 里 -->
|
||||||
<lombok.version>1.18.24</lombok.version>
|
<lombok.version>1.18.24</lombok.version>
|
||||||
<spring.boot.version>2.7.7</spring.boot.version>
|
<spring.boot.version>2.7.8</spring.boot.version>
|
||||||
<mapstruct.version>1.5.3.Final</mapstruct.version>
|
<mapstruct.version>1.5.3.Final</mapstruct.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -1895,76 +1895,76 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
|
|||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1267, '客户端删除', 'system:oauth2-client:delete', 3, 4, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:33', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1267, '客户端删除', 'system:oauth2-client:delete', 3, 4, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:33', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1281, '报表管理', '', 1, 40, 0, '/visualization', 'chart', NULL, 0, b'1', b'1', '1', '2022-07-10 20:22:15', '1', '2022-12-10 16:33:13', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1281, '报表管理', '', 1, 40, 0, '/visualization', 'chart', NULL, 0, b'1', b'1', '1', '2022-07-10 20:22:15', '1', '2022-12-10 16:33:13', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1282, '报表设计器', '', 2, 1, 1281, 'jimu-report', 'example', 'visualization/jmreport/index', 0, b'1', b'1', '1', '2022-07-10 20:26:36', '1', '2022-07-29 12:48:05', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1282, '报表设计器', '', 2, 1, 1281, 'jimu-report', 'example', 'visualization/jmreport/index', 0, b'1', b'1', '1', '2022-07-10 20:26:36', '1', '2022-07-29 12:48:05', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, '商品中心', '', 1, 60, 0, '/product', 'merchant', NULL, 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:26:19', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, '商品中心', '', 1, 60, 0, '/product', 'merchant', NULL, 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:26:19', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2002, '商品分类', '', 2, 2, 2000, 'category', 'dict', 'mall/product/category/index', 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:23:37', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2002, '商品分类', '', 2, 2, 2000, 'category', 'dict', 'mall/product/category/index', 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:23:37', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2003, '分类查询', 'product:category:query', 3, 1, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2003, '分类查询', 'product:category:query', 3, 1, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2004, '分类创建', 'product:category:create', 3, 2, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2004, '分类创建', 'product:category:create', 3, 2, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2005, '分类更新', 'product:category:update', 3, 3, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2005, '分类更新', 'product:category:update', 3, 3, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2006, '分类删除', 'product:category:delete', 3, 4, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2006, '分类删除', 'product:category:delete', 3, 4, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2008, '商品品牌', '', 2, 3, 2000, 'brand', 'dashboard', 'mall/product/brand/index', 0, b'1', b'1', '', '2022-07-30 13:52:44', '1', '2022-10-24 22:29:30', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2008, '商品品牌', '', 2, 3, 2000, 'brand', 'dashboard', 'mall/product/brand/index', 0, b'1', b'1', '', '2022-07-30 13:52:44', '1', '2022-10-24 22:29:30', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2009, '品牌查询', 'product:brand:query', 3, 1, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2009, '品牌查询', 'product:brand:query', 3, 1, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2010, '品牌创建', 'product:brand:create', 3, 2, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2010, '品牌创建', 'product:brand:create', 3, 2, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2011, '品牌更新', 'product:brand:update', 3, 3, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2011, '品牌更新', 'product:brand:update', 3, 3, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2012, '品牌删除', 'product:brand:delete', 3, 4, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2012, '品牌删除', 'product:brand:delete', 3, 4, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2014, '商品列表', '', 2, 1, 2000, 'spu', 'list', 'mall/product/spu/index', 0, b'1', b'1', '', '2022-07-30 14:22:58', '1', '2022-10-24 22:29:25', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2014, '商品列表', '', 2, 1, 2000, 'spu', 'list', 'mall/product/spu/index', 0, b'1', b'1', '', '2022-07-30 14:22:58', '1', '2022-10-24 22:29:25', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2015, '商品查询', 'product:spu:query', 3, 1, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2015, '商品查询', 'product:spu:query', 3, 1, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2016, '商品创建', 'product:spu:create', 3, 2, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2016, '商品创建', 'product:spu:create', 3, 2, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2017, '商品更新', 'product:spu:update', 3, 3, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2017, '商品更新', 'product:spu:update', 3, 3, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, '商品删除', 'product:spu:delete', 3, 4, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, '商品删除', 'product:spu:delete', 3, 4, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2019, '商品属性', '', 2, 3, 2000, 'property', 'eye', 'mall/product/property/index', 0, b'1', b'1', '', '2022-08-01 14:55:35', '1', '2022-12-12 20:58:06', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2019, '商品属性', '', 2, 3, 2000, 'property', 'eye', 'mall/product/property/index', 0, b'1', b'1', '', '2022-08-01 14:55:35', '1', '2022-12-12 20:58:06', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2020, '规格查询', 'product:property:query', 3, 1, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:24', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2020, '规格查询', 'product:property:query', 3, 1, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:24', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, '规格创建', 'product:property:create', 3, 2, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:30', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, '规格创建', 'product:property:create', 3, 2, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:30', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, '规格更新', 'product:property:update', 3, 3, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:33', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, '规格更新', 'product:property:update', 3, 3, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:33', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, '规格删除', 'product:property:delete', 3, 4, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:37', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, '规格删除', 'product:property:delete', 3, 4, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:37', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 100, 2000, 'banner', '', 'mall/market/banner/index', 0, b'1', b'1', '', '2022-08-01 14:56:14', '1', '2022-10-24 22:29:39', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 100, 2000, 'banner', '', 'mall/market/banner/index', 0, b'1', b'1', '', '2022-08-01 14:56:14', '1', '2022-10-24 22:29:39', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 'Banner查询', 'market:banner:query', 3, 1, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 'Banner查询', 'market:banner:query', 3, 1, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 'Banner删除', 'market:banner:delete', 3, 4, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 'Banner删除', 'market:banner:delete', 3, 4, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2030, '营销中心', '', 1, 70, 0, '/promotion', 'rate', NULL, 0, b'1', b'1', '1', '2022-10-31 21:25:09', '1', '2022-10-31 21:25:09', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2030, '营销中心', '', 1, 70, 0, '/promotion', 'rate', NULL, 0, b'1', b'1', '1', '2022-10-31 21:25:09', '1', '2022-10-31 21:25:09', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2032, '优惠劵', '', 2, 2, 2030, 'coupon-template', 'textarea', 'mall/promotion/couponTemplate/index', 0, b'1', b'1', '', '2022-10-31 22:27:14', '1', '2022-11-05 12:27:34', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2032, '优惠劵', '', 2, 2, 2030, 'coupon-template', 'textarea', 'mall/promotion/couponTemplate/index', 0, b'1', b'1', '', '2022-10-31 22:27:14', '1', '2022-11-05 12:27:34', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2033, '优惠劵模板查询', 'promotion:coupon-template:query', 3, 1, 2032, '', '', '', 0, b'1', b'1', '', '2022-10-31 22:27:14', '', '2022-10-31 22:27:14', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2033, '优惠劵模板查询', 'promotion:coupon-template:query', 3, 1, 2032, '', '', '', 0, b'1', b'1', '', '2022-10-31 22:27:14', '', '2022-10-31 22:27:14', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2034, '优惠劵模板创建', 'promotion:coupon-template:create', 3, 2, 2032, '', '', '', 0, b'1', b'1', '', '2022-10-31 22:27:14', '', '2022-10-31 22:27:14', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2034, '优惠劵模板创建', 'promotion:coupon-template:create', 3, 2, 2032, '', '', '', 0, b'1', b'1', '', '2022-10-31 22:27:14', '', '2022-10-31 22:27:14', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2035, '优惠劵模板更新', 'promotion:coupon-template:update', 3, 3, 2032, '', '', '', 0, b'1', b'1', '', '2022-10-31 22:27:14', '', '2022-10-31 22:27:14', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2035, '优惠劵模板更新', 'promotion:coupon-template:update', 3, 3, 2032, '', '', '', 0, b'1', b'1', '', '2022-10-31 22:27:14', '', '2022-10-31 22:27:14', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2036, '优惠劵模板删除', 'promotion:coupon-template:delete', 3, 4, 2032, '', '', '', 0, b'1', b'1', '', '2022-10-31 22:27:14', '', '2022-10-31 22:27:14', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2036, '优惠劵模板删除', 'promotion:coupon-template:delete', 3, 4, 2032, '', '', '', 0, b'1', b'1', '', '2022-10-31 22:27:14', '', '2022-10-31 22:27:14', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2038, '会员优惠劵', '', 2, 2, 2030, 'coupon', '', 'mall/promotion/coupon/index', 0, b'0', b'1', '', '2022-11-03 23:21:31', '1', '2022-11-05 12:27:45', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2038, '会员优惠劵', '', 2, 2, 2030, 'coupon', '', 'mall/promotion/coupon/index', 0, b'0', b'1', '', '2022-11-03 23:21:31', '1', '2022-11-05 12:27:45', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2039, '优惠劵查询', 'promotion:coupon:query', 3, 1, 2038, '', '', '', 0, b'1', b'1', '', '2022-11-03 23:21:31', '', '2022-11-03 23:21:31', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2039, '优惠劵查询', 'promotion:coupon:query', 3, 1, 2038, '', '', '', 0, b'1', b'1', '', '2022-11-03 23:21:31', '', '2022-11-03 23:21:31', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2040, '优惠劵删除', 'promotion:coupon:delete', 3, 4, 2038, '', '', '', 0, b'1', b'1', '', '2022-11-03 23:21:31', '', '2022-11-03 23:21:31', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2040, '优惠劵删除', 'promotion:coupon:delete', 3, 4, 2038, '', '', '', 0, b'1', b'1', '', '2022-11-03 23:21:31', '', '2022-11-03 23:21:31', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2041, '满减送活动', '', 2, 10, 2030, 'reward-activity', 'radio', 'mall/promotion/rewardActivity/index', 0, b'1', b'1', '', '2022-11-04 23:47:49', '1', '2022-11-05 12:27:56', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2041, '满减送活动', '', 2, 10, 2030, 'reward-activity', 'radio', 'mall/promotion/rewardActivity/index', 0, b'1', b'1', '', '2022-11-04 23:47:49', '1', '2022-11-05 12:27:56', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2042, '满减送活动查询', 'promotion:reward-activity:query', 3, 1, 2041, '', '', '', 0, b'1', b'1', '', '2022-11-04 23:47:49', '', '2022-11-04 23:47:49', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2042, '满减送活动查询', 'promotion:reward-activity:query', 3, 1, 2041, '', '', '', 0, b'1', b'1', '', '2022-11-04 23:47:49', '', '2022-11-04 23:47:49', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2043, '满减送活动创建', 'promotion:reward-activity:create', 3, 2, 2041, '', '', '', 0, b'1', b'1', '', '2022-11-04 23:47:49', '', '2022-11-04 23:47:49', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2043, '满减送活动创建', 'promotion:reward-activity:create', 3, 2, 2041, '', '', '', 0, b'1', b'1', '', '2022-11-04 23:47:49', '', '2022-11-04 23:47:49', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2044, '满减送活动更新', 'promotion:reward-activity:update', 3, 3, 2041, '', '', '', 0, b'1', b'1', '', '2022-11-04 23:47:50', '', '2022-11-04 23:47:50', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2044, '满减送活动更新', 'promotion:reward-activity:update', 3, 3, 2041, '', '', '', 0, b'1', b'1', '', '2022-11-04 23:47:50', '', '2022-11-04 23:47:50', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2045, '满减送活动删除', 'promotion:reward-activity:delete', 3, 4, 2041, '', '', '', 0, b'1', b'1', '', '2022-11-04 23:47:50', '', '2022-11-04 23:47:50', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2045, '满减送活动删除', 'promotion:reward-activity:delete', 3, 4, 2041, '', '', '', 0, b'1', b'1', '', '2022-11-04 23:47:50', '', '2022-11-04 23:47:50', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2046, '满减送活动关闭', 'promotion:reward-activity:close', 3, 5, 2041, '', '', '', 0, b'1', b'1', '1', '2022-11-05 10:42:53', '1', '2022-11-05 10:42:53', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2046, '满减送活动关闭', 'promotion:reward-activity:close', 3, 5, 2041, '', '', '', 0, b'1', b'1', '1', '2022-11-05 10:42:53', '1', '2022-11-05 10:42:53', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2047, '限时折扣活动', '', 2, 7, 2030, 'discount-activity', 'time', 'mall/promotion/discountActivity/index', 0, b'1', b'1', '', '2022-11-05 17:12:15', '1', '2022-11-29 22:14:56', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2047, '限时折扣活动', '', 2, 7, 2030, 'discount-activity', 'time', 'mall/promotion/discountActivity/index', 0, b'1', b'1', '', '2022-11-05 17:12:15', '1', '2022-11-29 22:14:56', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2048, '限时折扣活动查询', 'promotion:discount-activity:query', 3, 1, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:15', '', '2022-11-05 17:12:15', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2048, '限时折扣活动查询', 'promotion:discount-activity:query', 3, 1, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:15', '', '2022-11-05 17:12:15', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2049, '限时折扣活动创建', 'promotion:discount-activity:create', 3, 2, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:15', '', '2022-11-05 17:12:15', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2049, '限时折扣活动创建', 'promotion:discount-activity:create', 3, 2, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:15', '', '2022-11-05 17:12:15', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2050, '限时折扣活动更新', 'promotion:discount-activity:update', 3, 3, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2050, '限时折扣活动更新', 'promotion:discount-activity:update', 3, 3, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2051, '限时折扣活动删除', 'promotion:discount-activity:delete', 3, 4, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2051, '限时折扣活动删除', 'promotion:discount-activity:delete', 3, 4, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2052, '限时折扣活动关闭', 'promotion:discount-activity:close', 3, 5, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2052, '限时折扣活动关闭', 'promotion:discount-activity:close', 3, 5, 2047, '', '', '', 0, b'1', b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2059, '秒杀活动管理', '', 2, 0, 2030, 'seckill-activity', 'time-range', 'mall/promotion/seckill/seckillActivity/index', 0, b'1', b'1', '', '2022-11-06 22:24:49', '1', '2022-11-29 22:24:39', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2059, '秒杀活动管理', '', 2, 0, 2030, 'seckill-activity', 'time-range', 'mall/promotion/seckill/seckillActivity/index', 0, b'1', b'1', '', '2022-11-06 22:24:49', '1', '2022-11-29 22:24:39', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2060, '秒杀活动查询', 'promotion:seckill-activity:query', 3, 1, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2060, '秒杀活动查询', 'promotion:seckill-activity:query', 3, 1, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2061, '秒杀活动创建', 'promotion:seckill-activity:create', 3, 2, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2061, '秒杀活动创建', 'promotion:seckill-activity:create', 3, 2, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2062, '秒杀活动更新', 'promotion:seckill-activity:update', 3, 3, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2062, '秒杀活动更新', 'promotion:seckill-activity:update', 3, 3, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2063, '秒杀活动删除', 'promotion:seckill-activity:delete', 3, 4, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2063, '秒杀活动删除', 'promotion:seckill-activity:delete', 3, 4, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2064, '秒杀活动导出', 'promotion:seckill-activity:export', 3, 5, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2064, '秒杀活动导出', 'promotion:seckill-activity:export', 3, 5, 2059, '', '', '', 0, b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2066, '秒杀时段管理', '', 2, 0, 2030, 'seckill-time', '', 'mall/promotion/seckill/seckillTime/index', 0, b'0', b'1', '', '2022-11-15 19:46:50', '1', '2022-11-29 22:09:03', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2066, '秒杀时段管理', '', 2, 0, 2030, 'seckill-time', '', 'mall/promotion/seckill/seckillTime/index', 0, b'0', b'1', '', '2022-11-15 19:46:50', '1', '2022-11-29 22:09:03', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2067, '秒杀时段查询', 'promotion:seckill-time:query', 3, 1, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2067, '秒杀时段查询', 'promotion:seckill-time:query', 3, 1, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2068, '秒杀时段创建', 'promotion:seckill-time:create', 3, 2, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2068, '秒杀时段创建', 'promotion:seckill-time:create', 3, 2, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2069, '秒杀时段更新', 'promotion:seckill-time:update', 3, 3, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2069, '秒杀时段更新', 'promotion:seckill-time:update', 3, 3, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2070, '秒杀时段删除', 'promotion:seckill-time:delete', 3, 4, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2070, '秒杀时段删除', 'promotion:seckill-time:delete', 3, 4, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2071, '秒杀时段导出', 'promotion:seckill-time:export', 3, 5, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2071, '秒杀时段导出', 'promotion:seckill-time:export', 3, 5, 2066, '', '', '', 0, b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2072, '订单中心', '', 1, 65, 0, '/trade', 'order', NULL, 0, b'1', b'1', '1', '2022-11-19 18:57:19', '1', '2022-12-10 16:32:57', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2072, '订单中心', '', 1, 65, 0, '/trade', 'order', NULL, 0, b'1', b'1', '1', '2022-11-19 18:57:19', '1', '2022-12-10 16:32:57', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2073, '售后退款', '', 2, 1, 2072, 'trade/after-sale', 'education', 'mall/trade/afterSale/index', 0, b'1', b'1', '', '2022-11-19 20:15:32', '1', '2022-12-10 21:11:02', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2073, '售后退款', '', 2, 1, 2072, 'trade/after-sale', 'education', 'mall/trade/afterSale/index', 0, b'1', b'1', '', '2022-11-19 20:15:32', '1', '2022-12-10 21:11:02', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2074, '售后查询', 'trade:after-sale:query', 3, 1, 2073, '', '', '', 0, b'1', b'1', '', '2022-11-19 20:15:33', '1', '2022-12-10 21:04:29', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2074, '售后查询', 'trade:after-sale:query', 3, 1, 2073, '', '', '', 0, b'1', b'1', '', '2022-11-19 20:15:33', '1', '2022-12-10 21:04:29', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2075, '秒杀活动关闭', 'promotion:sekill-activity:close', 3, 6, 2059, '', '', '', 0, b'1', b'1', '1', '2022-11-28 20:20:15', '1', '2022-11-28 20:20:15', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2075, '秒杀活动关闭', 'promotion:sekill-activity:close', 3, 6, 2059, '', '', '', 0, b'1', b'1', '1', '2022-11-28 20:20:15', '1', '2022-11-28 20:20:15', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2076, '订单列表', '', 2, 0, 2072, 'trade/order', 'list', 'mall/trade/order/index', 0, b'1', b'1', '1', '2022-12-10 21:05:44', '1', '2022-12-10 21:08:44', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2076, '订单列表', '', 2, 0, 2072, 'trade/order', 'list', 'mall/trade/order/index', 0, b'1', b'1', '1', '2022-12-10 21:05:44', '1', '2022-12-10 21:08:44', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2077, '物流公司管理管理', '', 2, 0, 2072, 'express-company', '', 'mall/trade/expressCompany/index', 0, b'1', b'1', '', '2022-12-20 23:27:55', '1', '2022-12-20 23:36:20', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2077, '物流公司管理管理', '', 2, 0, 2072, 'express-company', '', 'mall/trade/expressCompany/index', 0, b'1', b'1', '', '2022-12-20 23:27:55', '1', '2022-12-20 23:36:20', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2078, '物流公司管理查询', 'trade:express-company:query', 3, 1, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2078, '物流公司管理查询', 'trade:express-company:query', 3, 1, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2079, '物流公司管理创建', 'trade:express-company:create', 3, 2, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2079, '物流公司管理创建', 'trade:express-company:create', 3, 2, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2080, '物流公司管理更新', 'trade:express-company:update', 3, 3, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2080, '物流公司管理更新', 'trade:express-company:update', 3, 3, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2081, '物流公司管理删除', 'trade:express-company:delete', 3, 4, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2081, '物流公司管理删除', 'trade:express-company:delete', 3, 4, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2082, '物流公司管理导出', 'trade:express-company:export', 3, 5, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
# INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2082, '物流公司管理导出', 'trade:express-company:export', 3, 5, 2077, '', '', '', 0, b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2083, '地区管理', '', 2, 14, 1, 'area', 'row', 'system/area/index', 0, b'1', b'1', '1', '2022-12-23 17:35:05', '1', '2022-12-23 17:35:48', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2083, '地区管理', '', 2, 14, 1, 'area', 'row', 'system/area/index', 0, b'1', b'1', '1', '2022-12-23 17:35:05', '1', '2022-12-23 17:35:48', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2084, '公众号管理', '', 1, 100, 0, '/mp', 'wechat', NULL, 0, b'1', b'1', '1', '2023-01-01 20:11:04', '1', '2023-01-15 11:28:57', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2084, '公众号管理', '', 1, 100, 0, '/mp', 'wechat', NULL, 0, b'1', b'1', '1', '2023-01-01 20:11:04', '1', '2023-01-15 11:28:57', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2085, '账号管理', 'mp:account:query', 2, 1, 2084, 'account', 'phone', 'mp/account/index', 0, b'1', b'1', '1', '2023-01-01 20:13:31', '1', '2023-01-01 20:14:39', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2085, '账号管理', 'mp:account:query', 2, 1, 2084, 'account', 'phone', 'mp/account/index', 0, b'1', b'1', '1', '2023-01-01 20:13:31', '1', '2023-01-01 20:14:39', b'0');
|
||||||
@ -1981,7 +1981,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
|
|||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2096, '修改标签', 'mp:tag:update', 3, 2, 2093, '', '', '', 0, b'1', b'1', '1', '2023-01-08 11:59:41', '1', '2023-01-08 11:59:41', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2096, '修改标签', 'mp:tag:update', 3, 2, 2093, '', '', '', 0, b'1', b'1', '1', '2023-01-08 11:59:41', '1', '2023-01-08 11:59:41', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2097, '删除标签', 'mp:tag:delete', 3, 3, 2093, '', '', '', 0, b'1', b'1', '1', '2023-01-08 12:00:04', '1', '2023-01-08 12:00:13', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2097, '删除标签', 'mp:tag:delete', 3, 3, 2093, '', '', '', 0, b'1', b'1', '1', '2023-01-08 12:00:04', '1', '2023-01-08 12:00:13', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2098, '同步标签', 'mp:tag:sync', 3, 4, 2093, '', '', '', 0, b'1', b'1', '1', '2023-01-08 12:00:29', '1', '2023-01-08 12:00:29', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2098, '同步标签', 'mp:tag:sync', 3, 4, 2093, '', '', '', 0, b'1', b'1', '1', '2023-01-08 12:00:29', '1', '2023-01-08 12:00:29', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2099, '粉丝管理', '', 2, 4, 2084, 'user', 'people', 'mp/user/index', 0, b'1', b'1', '1', '2023-01-08 16:51:20', '1', '2023-01-08 16:56:19', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2099, '粉丝管理', '', 2, 4, 2084, 'mpuser', 'people', 'mp/mpuser/index', 0, b'1', b'1', '1', '2023-01-08 16:51:20', '1', '2023-01-08 16:56:19', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2100, '查询粉丝', 'mp:user:query', 3, 0, 2099, '', '', '', 0, b'1', b'1', '1', '2023-01-08 17:16:59', '1', '2023-01-08 17:17:23', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2100, '查询粉丝', 'mp:user:query', 3, 0, 2099, '', '', '', 0, b'1', b'1', '1', '2023-01-08 17:16:59', '1', '2023-01-08 17:17:23', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2101, '修改粉丝', 'mp:user:update', 3, 1, 2099, '', '', '', 0, b'1', b'1', '1', '2023-01-08 17:17:11', '1', '2023-01-08 17:17:11', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2101, '修改粉丝', 'mp:user:update', 3, 1, 2099, '', '', '', 0, b'1', b'1', '1', '2023-01-08 17:17:11', '1', '2023-01-08 17:17:11', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2102, '同步粉丝', 'mp:user:sync', 3, 2, 2099, '', '', '', 0, b'1', b'1', '1', '2023-01-08 17:17:40', '1', '2023-01-08 17:17:40', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2102, '同步粉丝', 'mp:user:sync', 3, 2, 2099, '', '', '', 0, b'1', b'1', '1', '2023-01-08 17:17:40', '1', '2023-01-08 17:17:40', b'0');
|
||||||
@ -3251,7 +3251,7 @@ CREATE TABLE `system_tenant` (
|
|||||||
`package_id` bigint NOT NULL COMMENT '租户套餐编号',
|
`package_id` bigint NOT NULL COMMENT '租户套餐编号',
|
||||||
`expire_time` datetime NOT NULL COMMENT '过期时间',
|
`expire_time` datetime NOT NULL COMMENT '过期时间',
|
||||||
`account_count` int NOT NULL COMMENT '账号数量',
|
`account_count` int NOT NULL COMMENT '账号数量',
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '创建者',
|
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
@ -3282,7 +3282,7 @@ CREATE TABLE `system_tenant_package` (
|
|||||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '租户状态(0正常 1停用)',
|
`status` tinyint NOT NULL DEFAULT 0 COMMENT '租户状态(0正常 1停用)',
|
||||||
`remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '备注',
|
`remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '备注',
|
||||||
`menu_ids` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '关联的菜单编号',
|
`menu_ids` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '关联的菜单编号',
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '创建者',
|
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
@ -3817,7 +3817,7 @@ CREATE TABLE "system_tenant" (
|
|||||||
"package_id" int8 NOT NULL,
|
"package_id" int8 NOT NULL,
|
||||||
"expire_time" timestamp(6) NOT NULL,
|
"expire_time" timestamp(6) NOT NULL,
|
||||||
"account_count" int4 NOT NULL,
|
"account_count" int4 NOT NULL,
|
||||||
"creator" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
|
"creator" varchar(64) COLLATE "pg_catalog"."default",
|
||||||
"create_time" timestamp(6) NOT NULL,
|
"create_time" timestamp(6) NOT NULL,
|
||||||
"updater" varchar(64) COLLATE "pg_catalog"."default",
|
"updater" varchar(64) COLLATE "pg_catalog"."default",
|
||||||
"update_time" timestamp(6) NOT NULL,
|
"update_time" timestamp(6) NOT NULL,
|
||||||
@ -3860,7 +3860,7 @@ CREATE TABLE "system_tenant_package" (
|
|||||||
"status" int2 NOT NULL,
|
"status" int2 NOT NULL,
|
||||||
"remark" varchar(256) COLLATE "pg_catalog"."default",
|
"remark" varchar(256) COLLATE "pg_catalog"."default",
|
||||||
"menu_ids" varchar(2048) COLLATE "pg_catalog"."default" NOT NULL,
|
"menu_ids" varchar(2048) COLLATE "pg_catalog"."default" NOT NULL,
|
||||||
"creator" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
|
"creator" varchar(64) COLLATE "pg_catalog"."default",
|
||||||
"create_time" timestamp(6) NOT NULL,
|
"create_time" timestamp(6) NOT NULL,
|
||||||
"updater" varchar(64) COLLATE "pg_catalog"."default",
|
"updater" varchar(64) COLLATE "pg_catalog"."default",
|
||||||
"update_time" timestamp(6) NOT NULL,
|
"update_time" timestamp(6) NOT NULL,
|
||||||
|
@ -10600,7 +10600,7 @@ CREATE TABLE [dbo].[system_tenant] (
|
|||||||
[package_id] bigint NOT NULL,
|
[package_id] bigint NOT NULL,
|
||||||
[expire_time] datetime2(7) NOT NULL,
|
[expire_time] datetime2(7) NOT NULL,
|
||||||
[account_count] int NOT NULL,
|
[account_count] int NOT NULL,
|
||||||
[creator] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
[creator] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||||
[create_time] datetime2(7) NOT NULL,
|
[create_time] datetime2(7) NOT NULL,
|
||||||
[updater] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
[updater] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||||
[update_time] datetime2(7) NOT NULL,
|
[update_time] datetime2(7) NOT NULL,
|
||||||
@ -10761,7 +10761,7 @@ CREATE TABLE [dbo].[system_tenant_package] (
|
|||||||
[status] tinyint NOT NULL,
|
[status] tinyint NOT NULL,
|
||||||
[remark] nvarchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
[remark] nvarchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||||
[menu_ids] nvarchar(2048) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
[menu_ids] nvarchar(2048) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||||
[creator] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
[creator] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||||
[create_time] datetime2(7) NOT NULL,
|
[create_time] datetime2(7) NOT NULL,
|
||||||
[updater] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
[updater] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
|
||||||
[update_time] datetime2(7) NOT NULL,
|
[update_time] datetime2(7) NOT NULL,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<revision>1.7.0-snapshot</revision>
|
<revision>1.7.0-snapshot</revision>
|
||||||
<!-- 统一依赖管理 -->
|
<!-- 统一依赖管理 -->
|
||||||
<spring.boot.version>2.7.7</spring.boot.version>
|
<spring.boot.version>2.7.8</spring.boot.version>
|
||||||
<!-- Web 相关 -->
|
<!-- Web 相关 -->
|
||||||
<springdoc.version>1.6.14</springdoc.version>
|
<springdoc.version>1.6.14</springdoc.version>
|
||||||
<knife4j.version>4.0.0</knife4j.version>
|
<knife4j.version>4.0.0</knife4j.version>
|
||||||
@ -41,12 +41,12 @@
|
|||||||
<!-- Bpm 工作流相关 -->
|
<!-- Bpm 工作流相关 -->
|
||||||
<flowable.version>6.8.0</flowable.version>
|
<flowable.version>6.8.0</flowable.version>
|
||||||
<!-- 工具类相关 -->
|
<!-- 工具类相关 -->
|
||||||
<captcha-plus.version>1.0.1</captcha-plus.version>
|
<captcha-plus.version>1.0.2</captcha-plus.version>
|
||||||
<jsoup.version>1.15.3</jsoup.version>
|
<jsoup.version>1.15.3</jsoup.version>
|
||||||
<lombok.version>1.18.24</lombok.version>
|
<lombok.version>1.18.24</lombok.version>
|
||||||
<mapstruct.version>1.5.3.Final</mapstruct.version>
|
<mapstruct.version>1.5.3.Final</mapstruct.version>
|
||||||
<hutool.version>5.8.11</hutool.version>
|
<hutool.version>5.8.11</hutool.version>
|
||||||
<easyexcel.verion>3.1.5</easyexcel.verion>
|
<easyexcel.verion>3.2.0</easyexcel.verion>
|
||||||
<velocity.version>2.3</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
<screw.version>1.0.5</screw.version>
|
<screw.version>1.0.5</screw.version>
|
||||||
<fastjson.version>1.2.83</fastjson.version>
|
<fastjson.version>1.2.83</fastjson.version>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<!-- 统一依赖管理 -->
|
<!-- 统一依赖管理 -->
|
||||||
<spring.boot.version>2.7.7</spring.boot.version>
|
<spring.boot.version>2.7.8</spring.boot.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<!-- 统一依赖管理 -->
|
<!-- 统一依赖管理 -->
|
||||||
<spring.boot.version>2.7.7</spring.boot.version>
|
<spring.boot.version>2.7.8</spring.boot.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package cn.iocoder.yudao.framework.datapermission.core.util;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||||
|
import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限 Util
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public class DataPermissionUtils {
|
||||||
|
|
||||||
|
private static DataPermission DATA_PERMISSION_DISABLE;
|
||||||
|
|
||||||
|
@DataPermission(enable = false)
|
||||||
|
@SneakyThrows
|
||||||
|
private static DataPermission getDisableDataPermissionDisable() {
|
||||||
|
if (DATA_PERMISSION_DISABLE == null) {
|
||||||
|
DATA_PERMISSION_DISABLE = DataPermissionUtils.class
|
||||||
|
.getDeclaredMethod("getDisableDataPermissionDisable")
|
||||||
|
.getAnnotation(DataPermission.class);
|
||||||
|
}
|
||||||
|
return DATA_PERMISSION_DISABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略数据权限,执行对应的逻辑
|
||||||
|
*
|
||||||
|
* @param runnable 逻辑
|
||||||
|
*/
|
||||||
|
public static void executeIgnore(Runnable runnable) {
|
||||||
|
DataPermission dataPermission = getDisableDataPermissionDisable();
|
||||||
|
DataPermissionContextHolder.add(dataPermission);
|
||||||
|
try {
|
||||||
|
// 执行 runnable
|
||||||
|
runnable.run();
|
||||||
|
} finally {
|
||||||
|
DataPermissionContextHolder.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package cn.iocoder.yudao.framework.datapermission.core.util;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
public class DataPermissionUtilsTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testExecuteIgnore() {
|
||||||
|
DataPermissionUtils.executeIgnore(() -> assertFalse(DataPermissionContextHolder.get().enable()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -49,7 +49,7 @@ public class ErrorCodeAutoGeneratorImpl implements ErrorCodeAutoGenerator {
|
|||||||
log.info("[execute][解析到错误码数量为 ({}) 个]", autoGenerateDTOs.size());
|
log.info("[execute][解析到错误码数量为 ({}) 个]", autoGenerateDTOs.size());
|
||||||
|
|
||||||
// 第二步,写入到 system 服务
|
// 第二步,写入到 system 服务
|
||||||
errorCodeApi.autoGenerateErrorCodes(autoGenerateDTOs);
|
errorCodeApi.autoGenerateErrorCodeList(autoGenerateDTOs);
|
||||||
log.info("[execute][写入到 system 组件完成]");
|
log.info("[execute][写入到 system 组件完成]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public class TenantFrameworkServiceImpl implements TenantFrameworkService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> load(Object key) {
|
public List<Long> load(Object key) {
|
||||||
return tenantApi.getTenantIds();
|
return tenantApi.getTenantIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -47,7 +47,7 @@ public class TenantFrameworkServiceImpl implements TenantFrameworkService {
|
|||||||
@Override
|
@Override
|
||||||
public ServiceException load(Long id) {
|
public ServiceException load(Long id) {
|
||||||
try {
|
try {
|
||||||
tenantApi.validTenant(id);
|
tenantApi.validateTenant(id);
|
||||||
return SERVICE_EXCEPTION_NULL;
|
return SERVICE_EXCEPTION_NULL;
|
||||||
} catch (ServiceException ex) {
|
} catch (ServiceException ex) {
|
||||||
return ex;
|
return ex;
|
||||||
|
@ -50,7 +50,7 @@ public class RandomUtils {
|
|||||||
}
|
}
|
||||||
// 如果是 type、status 结尾的字段,返回 tinyint 范围
|
// 如果是 type、status 结尾的字段,返回 tinyint 范围
|
||||||
if (StrUtil.endWithAnyIgnoreCase(attributeMetadata.getAttributeName(),
|
if (StrUtil.endWithAnyIgnoreCase(attributeMetadata.getAttributeName(),
|
||||||
"type", "status", "category", "scope")) {
|
"type", "status", "category", "scope", "result")) {
|
||||||
return RandomUtil.randomInt(0, TINYINT_MAX + 1);
|
return RandomUtil.randomInt(0, TINYINT_MAX + 1);
|
||||||
}
|
}
|
||||||
return RandomUtil.randomInt();
|
return RandomUtil.randomInt();
|
||||||
|
@ -213,18 +213,18 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
|
|||||||
|
|
||||||
private void validTaskAssignRuleOptions(Integer type, Set<Long> options) {
|
private void validTaskAssignRuleOptions(Integer type, Set<Long> options) {
|
||||||
if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.ROLE.getType())) {
|
if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.ROLE.getType())) {
|
||||||
roleApi.validRoles(options);
|
roleApi.validRoleList(options);
|
||||||
} else if (ObjectUtils.equalsAny(type, BpmTaskAssignRuleTypeEnum.DEPT_MEMBER.getType(),
|
} else if (ObjectUtils.equalsAny(type, BpmTaskAssignRuleTypeEnum.DEPT_MEMBER.getType(),
|
||||||
BpmTaskAssignRuleTypeEnum.DEPT_LEADER.getType())) {
|
BpmTaskAssignRuleTypeEnum.DEPT_LEADER.getType())) {
|
||||||
deptApi.validDepts(options);
|
deptApi.validateDeptList(options);
|
||||||
} else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.POST.getType())) {
|
} else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.POST.getType())) {
|
||||||
postApi.validPosts(options);
|
postApi.validPostList(options);
|
||||||
} else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER.getType())) {
|
} else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER.getType())) {
|
||||||
adminUserApi.validUsers(options);
|
adminUserApi.validateUserList(options);
|
||||||
} else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER_GROUP.getType())) {
|
} else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER_GROUP.getType())) {
|
||||||
userGroupService.validUserGroups(options);
|
userGroupService.validUserGroups(options);
|
||||||
} else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.SCRIPT.getType())) {
|
} else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.SCRIPT.getType())) {
|
||||||
dictDataApi.validDictDatas(DictTypeConstants.TASK_ASSIGN_SCRIPT,
|
dictDataApi.validateDictDataList(DictTypeConstants.TASK_ASSIGN_SCRIPT,
|
||||||
CollectionUtils.convertSet(options, String::valueOf));
|
CollectionUtils.convertSet(options, String::valueOf));
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(format("未知的规则类型({})", type));
|
throw new IllegalArgumentException(format("未知的规则类型({})", type));
|
||||||
@ -288,12 +288,12 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Set<Long> calculateTaskCandidateUsersByDeptMember(BpmTaskAssignRuleDO rule) {
|
private Set<Long> calculateTaskCandidateUsersByDeptMember(BpmTaskAssignRuleDO rule) {
|
||||||
List<AdminUserRespDTO> users = adminUserApi.getUsersByDeptIds(rule.getOptions());
|
List<AdminUserRespDTO> users = adminUserApi.getUserListByDeptIds(rule.getOptions());
|
||||||
return convertSet(users, AdminUserRespDTO::getId);
|
return convertSet(users, AdminUserRespDTO::getId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Long> calculateTaskCandidateUsersByDeptLeader(BpmTaskAssignRuleDO rule) {
|
private Set<Long> calculateTaskCandidateUsersByDeptLeader(BpmTaskAssignRuleDO rule) {
|
||||||
List<DeptRespDTO> depts = deptApi.getDepts(rule.getOptions());
|
List<DeptRespDTO> depts = deptApi.getDeptList(rule.getOptions());
|
||||||
return convertSet(depts, DeptRespDTO::getLeaderUserId);
|
return convertSet(depts, DeptRespDTO::getLeaderUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class BpmTaskAssignRuleServiceImplTest extends BaseDbUnitTest {
|
|||||||
// mock 方法
|
// mock 方法
|
||||||
List<AdminUserRespDTO> users = CollectionUtils.convertList(asSet(11L, 22L),
|
List<AdminUserRespDTO> users = CollectionUtils.convertList(asSet(11L, 22L),
|
||||||
id -> new AdminUserRespDTO().setId(id));
|
id -> new AdminUserRespDTO().setId(id));
|
||||||
when(adminUserApi.getUsersByDeptIds(eq(rule.getOptions()))).thenReturn(users);
|
when(adminUserApi.getUserListByDeptIds(eq(rule.getOptions()))).thenReturn(users);
|
||||||
mockGetUserMap(asSet(11L, 22L));
|
mockGetUserMap(asSet(11L, 22L));
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.infra.controller.admin.config;
|
package cn.iocoder.yudao.module.infra.controller.admin.config;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
@ -8,7 +7,6 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
|||||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*;
|
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*;
|
||||||
import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
|
import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||||
import cn.iocoder.yudao.module.infra.service.config.ConfigService;
|
|
||||||
import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
|
import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@ -23,6 +21,7 @@ import javax.validation.Valid;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
@ -76,7 +75,7 @@ public class ConfigController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!config.getVisible()) {
|
if (!config.getVisible()) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
|
throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
|
||||||
}
|
}
|
||||||
return success(config.getValue());
|
return success(config.getValue());
|
||||||
}
|
}
|
||||||
@ -93,7 +92,7 @@ public class ConfigController {
|
|||||||
@Operation(summary = "导出参数配置")
|
@Operation(summary = "导出参数配置")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:config:export')")
|
@PreAuthorize("@ss.hasPermission('infra:config:export')")
|
||||||
@OperateLog(type = EXPORT)
|
@OperateLog(type = EXPORT)
|
||||||
public void exportSysConfig(@Valid ConfigExportReqVO reqVO,
|
public void exportConfig(@Valid ConfigExportReqVO reqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
List<ConfigDO> list = configService.getConfigList(reqVO);
|
List<ConfigDO> list = configService.getConfigList(reqVO);
|
||||||
// 拼接数据
|
// 拼接数据
|
||||||
|
@ -39,27 +39,38 @@ public class CodegenColumnDO extends BaseDO {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段名
|
* 字段名
|
||||||
|
*
|
||||||
|
* 关联 {@link TableField#getName()}
|
||||||
*/
|
*/
|
||||||
private String columnName;
|
private String columnName;
|
||||||
/**
|
/**
|
||||||
* 数据库字段类型
|
* 数据库字段类型
|
||||||
|
*
|
||||||
* 关联 {@link TableField.MetaInfo#getJdbcType()}
|
* 关联 {@link TableField.MetaInfo#getJdbcType()}
|
||||||
*/
|
*/
|
||||||
private String dataType;
|
private String dataType;
|
||||||
/**
|
/**
|
||||||
* 字段描述
|
* 字段描述
|
||||||
|
*
|
||||||
|
* 关联 {@link TableField#getComment()}
|
||||||
*/
|
*/
|
||||||
private String columnComment;
|
private String columnComment;
|
||||||
/**
|
/**
|
||||||
* 是否允许为空
|
* 是否允许为空
|
||||||
|
*
|
||||||
|
* 关联 {@link TableField.MetaInfo#isNullable()}
|
||||||
*/
|
*/
|
||||||
private Boolean nullable;
|
private Boolean nullable;
|
||||||
/**
|
/**
|
||||||
* 是否主键
|
* 是否主键
|
||||||
|
*
|
||||||
|
* 关联 {@link TableField#isKeyFlag()}
|
||||||
*/
|
*/
|
||||||
private Boolean primaryKey;
|
private Boolean primaryKey;
|
||||||
/**
|
/**
|
||||||
* 是否自增
|
* 是否自增
|
||||||
|
*
|
||||||
|
* 关联 {@link TableField#isKeyIdentityFlag()}
|
||||||
*/
|
*/
|
||||||
private Boolean autoIncrement;
|
private Boolean autoIncrement;
|
||||||
/**
|
/**
|
||||||
@ -71,12 +82,16 @@ public class CodegenColumnDO extends BaseDO {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Java 属性类型
|
* Java 属性类型
|
||||||
* <p>
|
*
|
||||||
* 例如说 String、Boolean 等等
|
* 例如说 String、Boolean 等等
|
||||||
|
*
|
||||||
|
* 关联 {@link TableField#getColumnType()}
|
||||||
*/
|
*/
|
||||||
private String javaType;
|
private String javaType;
|
||||||
/**
|
/**
|
||||||
* Java 属性名
|
* Java 属性名
|
||||||
|
*
|
||||||
|
* 关联 {@link TableField#getPropertyName()}
|
||||||
*/
|
*/
|
||||||
private String javaField;
|
private String javaField;
|
||||||
/**
|
/**
|
||||||
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.codegen.CodegenSceneEnum;
|
|||||||
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum;
|
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@ -44,10 +45,14 @@ public class CodegenTableDO extends BaseDO {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 表名称
|
* 表名称
|
||||||
|
*
|
||||||
|
* 关联 {@link TableInfo#getName()}
|
||||||
*/
|
*/
|
||||||
private String tableName;
|
private String tableName;
|
||||||
/**
|
/**
|
||||||
* 表描述
|
* 表描述
|
||||||
|
*
|
||||||
|
* 关联 {@link TableInfo#getComment()}
|
||||||
*/
|
*/
|
||||||
private String tableComment;
|
private String tableComment;
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
|
||||||
@ -19,24 +19,24 @@ import java.util.List;
|
|||||||
public interface JobLogMapper extends BaseMapperX<JobLogDO> {
|
public interface JobLogMapper extends BaseMapperX<JobLogDO> {
|
||||||
|
|
||||||
default PageResult<JobLogDO> selectPage(JobLogPageReqVO reqVO) {
|
default PageResult<JobLogDO> selectPage(JobLogPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new QueryWrapperX<JobLogDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<JobLogDO>()
|
||||||
.eqIfPresent("job_id", reqVO.getJobId())
|
.eqIfPresent(JobLogDO::getJobId, reqVO.getJobId())
|
||||||
.likeIfPresent("handler_name", reqVO.getHandlerName())
|
.likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName())
|
||||||
.geIfPresent("begin_time", reqVO.getBeginTime())
|
.geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime())
|
||||||
.leIfPresent("end_time", reqVO.getEndTime())
|
.leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime())
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
.eqIfPresent(JobLogDO::getStatus, reqVO.getStatus())
|
||||||
.orderByDesc("id") // ID 倒序
|
.orderByDesc(JobLogDO::getId) // ID 倒序
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<JobLogDO> selectList(JobLogExportReqVO reqVO) {
|
default List<JobLogDO> selectList(JobLogExportReqVO reqVO) {
|
||||||
return selectList(new QueryWrapperX<JobLogDO>()
|
return selectList(new LambdaQueryWrapperX<JobLogDO>()
|
||||||
.eqIfPresent("job_id", reqVO.getJobId())
|
.eqIfPresent(JobLogDO::getJobId, reqVO.getJobId())
|
||||||
.likeIfPresent("handler_name", reqVO.getHandlerName())
|
.likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName())
|
||||||
.geIfPresent("begin_time", reqVO.getBeginTime())
|
.geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime())
|
||||||
.leIfPresent("end_time", reqVO.getEndTime())
|
.leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime())
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
.eqIfPresent(JobLogDO::getStatus, reqVO.getStatus())
|
||||||
.orderByDesc("id") // ID 倒序
|
.orderByDesc(JobLogDO::getId) // ID 倒序
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
|
|
||||||
private Long createCodegen0(Long userId, Long dataSourceConfigId, TableInfo tableInfo) {
|
private Long createCodegen0(Long userId, Long dataSourceConfigId, TableInfo tableInfo) {
|
||||||
// 校验导入的表和字段非空
|
// 校验导入的表和字段非空
|
||||||
checkTableInfo(tableInfo);
|
validateTableInfo(tableInfo);
|
||||||
// 校验是否已经存在
|
// 校验是否已经存在
|
||||||
if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(),
|
if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(),
|
||||||
dataSourceConfigId) != null) {
|
dataSourceConfigId) != null) {
|
||||||
@ -100,7 +100,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
return table.getId();
|
return table.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkTableInfo(TableInfo tableInfo) {
|
private void validateTableInfo(TableInfo tableInfo) {
|
||||||
if (tableInfo == null) {
|
if (tableInfo == null) {
|
||||||
throw exception(CODEGEN_IMPORT_TABLE_NULL);
|
throw exception(CODEGEN_IMPORT_TABLE_NULL);
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
|
|
||||||
private void syncCodegen0(Long tableId, TableInfo tableInfo) {
|
private void syncCodegen0(Long tableId, TableInfo tableInfo) {
|
||||||
// 校验导入的表和字段非空
|
// 校验导入的表和字段非空
|
||||||
checkTableInfo(tableInfo);
|
validateTableInfo(tableInfo);
|
||||||
List<TableField> tableFields = tableInfo.getFields();
|
List<TableField> tableFields = tableInfo.getFields();
|
||||||
|
|
||||||
// 构建 CodegenColumnDO 数组,只同步新增的字段
|
// 构建 CodegenColumnDO 数组,只同步新增的字段
|
||||||
|
@ -9,7 +9,6 @@ import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqV
|
|||||||
import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
|
import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
|
import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
|
||||||
import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
|
|
||||||
import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum;
|
import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -20,6 +19,7 @@ import javax.annotation.Resource;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置 Service 实现类
|
* 参数配置 Service 实现类
|
||||||
@ -35,7 +35,7 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public Long createConfig(ConfigCreateReqVO reqVO) {
|
public Long createConfig(ConfigCreateReqVO reqVO) {
|
||||||
// 校验正确性
|
// 校验正确性
|
||||||
checkCreateOrUpdate(null, reqVO.getKey());
|
validateConfigForCreateOrUpdate(null, reqVO.getKey());
|
||||||
// 插入参数配置
|
// 插入参数配置
|
||||||
ConfigDO config = ConfigConvert.INSTANCE.convert(reqVO);
|
ConfigDO config = ConfigConvert.INSTANCE.convert(reqVO);
|
||||||
config.setType(ConfigTypeEnum.CUSTOM.getType());
|
config.setType(ConfigTypeEnum.CUSTOM.getType());
|
||||||
@ -46,19 +46,19 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateConfig(ConfigUpdateReqVO reqVO) {
|
public void updateConfig(ConfigUpdateReqVO reqVO) {
|
||||||
// 校验正确性
|
// 校验正确性
|
||||||
checkCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key
|
validateConfigForCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key
|
||||||
// 更新参数配置
|
// 更新参数配置
|
||||||
ConfigDO updateObj = ConfigConvert.INSTANCE.convert(reqVO);
|
ConfigDO updateObj = ConfigConvert.INSTANCE.convert(reqVO);
|
||||||
configMapper.updateById(updateObj);;
|
configMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteConfig(Long id) {
|
public void deleteConfig(Long id) {
|
||||||
// 校验配置存在
|
// 校验配置存在
|
||||||
ConfigDO config = checkConfigExists(id);
|
ConfigDO config = validateConfigExists(id);
|
||||||
// 内置配置,不允许删除
|
// 内置配置,不允许删除
|
||||||
if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
|
if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
|
||||||
throw exception(ErrorCodeConstants.CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
|
throw exception(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
configMapper.deleteById(id);
|
configMapper.deleteById(id);
|
||||||
@ -84,39 +84,39 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
return configMapper.selectList(reqVO);
|
return configMapper.selectList(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkCreateOrUpdate(Long id, String key) {
|
private void validateConfigForCreateOrUpdate(Long id, String key) {
|
||||||
// 校验自己存在
|
// 校验自己存在
|
||||||
checkConfigExists(id);
|
validateConfigExists(id);
|
||||||
// 校验参数配置 key 的唯一性
|
// 校验参数配置 key 的唯一性
|
||||||
if (StrUtil.isNotEmpty(key)) {
|
if (StrUtil.isNotEmpty(key)) {
|
||||||
checkConfigKeyUnique(id, key);
|
validateConfigKeyUnique(id, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public ConfigDO checkConfigExists(Long id) {
|
public ConfigDO validateConfigExists(Long id) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ConfigDO config = configMapper.selectById(id);
|
ConfigDO config = configMapper.selectById(id);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
throw exception(ErrorCodeConstants.CONFIG_NOT_EXISTS);
|
throw exception(CONFIG_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void checkConfigKeyUnique(Long id, String key) {
|
public void validateConfigKeyUnique(Long id, String key) {
|
||||||
ConfigDO config = configMapper.selectByKey(key);
|
ConfigDO config = configMapper.selectByKey(key);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 如果 id 为空,说明不用比较是否为相同 id 的参数配置
|
// 如果 id 为空,说明不用比较是否为相同 id 的参数配置
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE);
|
throw exception(CONFIG_KEY_DUPLICATE);
|
||||||
}
|
}
|
||||||
if (!config.getId().equals(id)) {
|
if (!config.getId().equals(id)) {
|
||||||
throw exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE);
|
throw exception(CONFIG_KEY_DUPLICATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public Long createDataSourceConfig(DataSourceConfigCreateReqVO createReqVO) {
|
public Long createDataSourceConfig(DataSourceConfigCreateReqVO createReqVO) {
|
||||||
DataSourceConfigDO dataSourceConfig = DataSourceConfigConvert.INSTANCE.convert(createReqVO);
|
DataSourceConfigDO dataSourceConfig = DataSourceConfigConvert.INSTANCE.convert(createReqVO);
|
||||||
checkConnectionOK(dataSourceConfig);
|
validateConnectionOK(dataSourceConfig);
|
||||||
|
|
||||||
// 插入
|
// 插入
|
||||||
dataSourceConfigMapper.insert(dataSourceConfig);
|
dataSourceConfigMapper.insert(dataSourceConfig);
|
||||||
@ -50,7 +50,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
validateDataSourceConfigExists(updateReqVO.getId());
|
validateDataSourceConfigExists(updateReqVO.getId());
|
||||||
DataSourceConfigDO updateObj = DataSourceConfigConvert.INSTANCE.convert(updateReqVO);
|
DataSourceConfigDO updateObj = DataSourceConfigConvert.INSTANCE.convert(updateReqVO);
|
||||||
checkConnectionOK(updateObj);
|
validateConnectionOK(updateObj);
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
dataSourceConfigMapper.updateById(updateObj);
|
dataSourceConfigMapper.updateById(updateObj);
|
||||||
@ -88,7 +88,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkConnectionOK(DataSourceConfigDO config) {
|
private void validateConnectionOK(DataSourceConfigDO config) {
|
||||||
boolean success = JdbcUtils.isConnectionOK(config.getUrl(), config.getUsername(), config.getPassword());
|
boolean success = JdbcUtils.isConnectionOK(config.getUrl(), config.getUsername(), config.getPassword());
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw exception(DATA_SOURCE_CONFIG_NOT_OK);
|
throw exception(DATA_SOURCE_CONFIG_NOT_OK);
|
||||||
|
@ -41,7 +41,7 @@ public class DatabaseTableServiceImpl implements DatabaseTableService {
|
|||||||
return CollUtil.getFirst(getTableList0(dataSourceConfigId, name));
|
return CollUtil.getFirst(getTableList0(dataSourceConfigId, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TableInfo> getTableList0(Long dataSourceConfigId, String name) {
|
private List<TableInfo> getTableList0(Long dataSourceConfigId, String name) {
|
||||||
// 获得数据源配置
|
// 获得数据源配置
|
||||||
DataSourceConfigDO config = dataSourceConfigService.getDataSourceConfig(dataSourceConfigId);
|
DataSourceConfigDO config = dataSourceConfigService.getDataSourceConfig(dataSourceConfigId);
|
||||||
Assert.notNull(config, "数据源({}) 不存在!", dataSourceConfigId);
|
Assert.notNull(config, "数据源({}) 不存在!", dataSourceConfigId);
|
||||||
|
@ -8,8 +8,6 @@ import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigU
|
|||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件配置 Service 接口
|
* 文件配置 Service 接口
|
||||||
@ -60,14 +58,6 @@ public interface FileConfigService {
|
|||||||
*/
|
*/
|
||||||
FileConfigDO getFileConfig(Long id);
|
FileConfigDO getFileConfig(Long id);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得文件配置列表
|
|
||||||
*
|
|
||||||
* @param ids 编号
|
|
||||||
* @return 文件配置列表
|
|
||||||
*/
|
|
||||||
List<FileConfigDO> getFileConfigList(Collection<Long> ids);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得文件配置分页
|
* 获得文件配置分页
|
||||||
*
|
*
|
||||||
|
@ -27,7 +27,6 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ public class FileConfigServiceImpl implements FileConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateFileConfig(FileConfigUpdateReqVO updateReqVO) {
|
public void updateFileConfig(FileConfigUpdateReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
FileConfigDO config = this.validateFileConfigExists(updateReqVO.getId());
|
FileConfigDO config = validateFileConfigExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
FileConfigDO updateObj = FileConfigConvert.INSTANCE.convert(updateReqVO)
|
FileConfigDO updateObj = FileConfigConvert.INSTANCE.convert(updateReqVO)
|
||||||
.setConfig(parseClientConfig(config.getStorage(), updateReqVO.getConfig()));
|
.setConfig(parseClientConfig(config.getStorage(), updateReqVO.getConfig()));
|
||||||
@ -108,7 +107,7 @@ public class FileConfigServiceImpl implements FileConfigService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateFileConfigMaster(Long id) {
|
public void updateFileConfigMaster(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateFileConfigExists(id);
|
validateFileConfigExists(id);
|
||||||
// 更新其它为非 master
|
// 更新其它为非 master
|
||||||
fileConfigMapper.updateBatch(new FileConfigDO().setMaster(false));
|
fileConfigMapper.updateBatch(new FileConfigDO().setMaster(false));
|
||||||
// 更新
|
// 更新
|
||||||
@ -138,7 +137,7 @@ public class FileConfigServiceImpl implements FileConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteFileConfig(Long id) {
|
public void deleteFileConfig(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
FileConfigDO config = this.validateFileConfigExists(id);
|
FileConfigDO config = validateFileConfigExists(id);
|
||||||
if (Boolean.TRUE.equals(config.getMaster())) {
|
if (Boolean.TRUE.equals(config.getMaster())) {
|
||||||
throw exception(FILE_CONFIG_DELETE_FAIL_MASTER);
|
throw exception(FILE_CONFIG_DELETE_FAIL_MASTER);
|
||||||
}
|
}
|
||||||
@ -161,11 +160,6 @@ public class FileConfigServiceImpl implements FileConfigService {
|
|||||||
return fileConfigMapper.selectById(id);
|
return fileConfigMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<FileConfigDO> getFileConfigList(Collection<Long> ids) {
|
|
||||||
return fileConfigMapper.selectBatchIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<FileConfigDO> getFileConfigPage(FileConfigPageReqVO pageReqVO) {
|
public PageResult<FileConfigDO> getFileConfigPage(FileConfigPageReqVO pageReqVO) {
|
||||||
return fileConfigMapper.selectPage(pageReqVO);
|
return fileConfigMapper.selectPage(pageReqVO);
|
||||||
@ -174,7 +168,7 @@ public class FileConfigServiceImpl implements FileConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public String testFileConfig(Long id) throws Exception {
|
public String testFileConfig(Long id) throws Exception {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateFileConfigExists(id);
|
validateFileConfigExists(id);
|
||||||
// 上传文件
|
// 上传文件
|
||||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||||
return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg", "image/jpeg");
|
return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg", "image/jpeg");
|
||||||
|
@ -69,7 +69,7 @@ public class FileServiceImpl implements FileService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteFile(Long id) throws Exception {
|
public void deleteFile(Long id) throws Exception {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
FileDO file = this.validateFileExists(id);
|
FileDO file = validateFileExists(id);
|
||||||
|
|
||||||
// 从文件存储器中删除
|
// 从文件存储器中删除
|
||||||
FileClient client = fileConfigService.getFileClient(file.getConfigId());
|
FileClient client = fileConfigService.getFileClient(file.getConfigId());
|
||||||
|
@ -69,7 +69,7 @@ public class JobServiceImpl implements JobService {
|
|||||||
public void updateJob(JobUpdateReqVO updateReqVO) throws SchedulerException {
|
public void updateJob(JobUpdateReqVO updateReqVO) throws SchedulerException {
|
||||||
validateCronExpression(updateReqVO.getCronExpression());
|
validateCronExpression(updateReqVO.getCronExpression());
|
||||||
// 校验存在
|
// 校验存在
|
||||||
JobDO job = this.validateJobExists(updateReqVO.getId());
|
JobDO job = validateJobExists(updateReqVO.getId());
|
||||||
// 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行
|
// 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行
|
||||||
if (!job.getStatus().equals(JobStatusEnum.NORMAL.getStatus())) {
|
if (!job.getStatus().equals(JobStatusEnum.NORMAL.getStatus())) {
|
||||||
throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS);
|
throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS);
|
||||||
@ -92,7 +92,7 @@ public class JobServiceImpl implements JobService {
|
|||||||
throw exception(JOB_CHANGE_STATUS_INVALID);
|
throw exception(JOB_CHANGE_STATUS_INVALID);
|
||||||
}
|
}
|
||||||
// 校验存在
|
// 校验存在
|
||||||
JobDO job = this.validateJobExists(id);
|
JobDO job = validateJobExists(id);
|
||||||
// 校验是否已经为当前状态
|
// 校验是否已经为当前状态
|
||||||
if (job.getStatus().equals(status)) {
|
if (job.getStatus().equals(status)) {
|
||||||
throw exception(JOB_CHANGE_STATUS_EQUALS);
|
throw exception(JOB_CHANGE_STATUS_EQUALS);
|
||||||
@ -112,7 +112,7 @@ public class JobServiceImpl implements JobService {
|
|||||||
@Override
|
@Override
|
||||||
public void triggerJob(Long id) throws SchedulerException {
|
public void triggerJob(Long id) throws SchedulerException {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
JobDO job = this.validateJobExists(id);
|
JobDO job = validateJobExists(id);
|
||||||
|
|
||||||
// 触发 Quartz 中的 Job
|
// 触发 Quartz 中的 Job
|
||||||
schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam());
|
schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam());
|
||||||
@ -122,7 +122,7 @@ public class JobServiceImpl implements JobService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteJob(Long id) throws SchedulerException {
|
public void deleteJob(Long id) throws SchedulerException {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
JobDO job = this.validateJobExists(id);
|
JobDO job = validateJobExists(id);
|
||||||
// 更新
|
// 更新
|
||||||
jobMapper.deleteById(id);
|
jobMapper.deleteById(id);
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.logger;
|
package cn.iocoder.yudao.module.infra.service.logger;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
|
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
|
||||||
@ -8,7 +7,6 @@ import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiE
|
|||||||
import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert;
|
import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
|
import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
|
||||||
import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
|
|
||||||
import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
|
import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -17,6 +15,10 @@ import javax.annotation.Resource;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
|
||||||
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API 错误日志 Service 实现类
|
* API 错误日志 Service 实现类
|
||||||
*
|
*
|
||||||
@ -31,8 +33,8 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
|
public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
|
||||||
ApiErrorLogDO apiErrorLog = ApiErrorLogConvert.INSTANCE.convert(createDTO);
|
ApiErrorLogDO apiErrorLog = ApiErrorLogConvert.INSTANCE.convert(createDTO)
|
||||||
apiErrorLog.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
||||||
apiErrorLogMapper.insert(apiErrorLog);
|
apiErrorLogMapper.insert(apiErrorLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,10 +52,10 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
|
|||||||
public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) {
|
public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) {
|
||||||
ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id);
|
ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id);
|
||||||
if (errorLog == null) {
|
if (errorLog == null) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND);
|
throw exception(API_ERROR_LOG_NOT_FOUND);
|
||||||
}
|
}
|
||||||
if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) {
|
if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) {
|
||||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.API_ERROR_LOG_PROCESSED);
|
throw exception(API_ERROR_LOG_PROCESSED);
|
||||||
}
|
}
|
||||||
// 标记处理
|
// 标记处理
|
||||||
apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus)
|
apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus)
|
||||||
|
@ -45,7 +45,7 @@ public class TestDemoServiceImpl implements TestDemoService {
|
|||||||
@CacheEvict(value = "test", key = "#updateReqVO.id")
|
@CacheEvict(value = "test", key = "#updateReqVO.id")
|
||||||
public void updateTestDemo(TestDemoUpdateReqVO updateReqVO) {
|
public void updateTestDemo(TestDemoUpdateReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateTestDemoExists(updateReqVO.getId());
|
validateTestDemoExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
TestDemoDO updateObj = TestDemoConvert.INSTANCE.convert(updateReqVO);
|
TestDemoDO updateObj = TestDemoConvert.INSTANCE.convert(updateReqVO);
|
||||||
testDemoMapper.updateById(updateObj);
|
testDemoMapper.updateById(updateObj);
|
||||||
@ -55,7 +55,7 @@ public class TestDemoServiceImpl implements TestDemoService {
|
|||||||
@CacheEvict(value = "test", key = "#id")
|
@CacheEvict(value = "test", key = "#id")
|
||||||
public void deleteTestDemo(Long id) {
|
public void deleteTestDemo(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateTestDemoExists(id);
|
validateTestDemoExists(id);
|
||||||
// 删除
|
// 删除
|
||||||
testDemoMapper.deleteById(id);
|
testDemoMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
|||||||
@Override
|
@Override
|
||||||
public void update${simpleClassName}(${sceneEnum.prefixClass}${table.className}UpdateReqVO updateReqVO) {
|
public void update${simpleClassName}(${sceneEnum.prefixClass}${table.className}UpdateReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validate${simpleClassName}Exists(updateReqVO.getId());
|
validate${simpleClassName}Exists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
${table.className}DO updateObj = ${table.className}Convert.INSTANCE.convert(updateReqVO);
|
${table.className}DO updateObj = ${table.className}Convert.INSTANCE.convert(updateReqVO);
|
||||||
${classNameVar}Mapper.updateById(updateObj);
|
${classNameVar}Mapper.updateById(updateObj);
|
||||||
@ -48,7 +48,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
|||||||
@Override
|
@Override
|
||||||
public void delete${simpleClassName}(${primaryColumn.javaType} id) {
|
public void delete${simpleClassName}(${primaryColumn.javaType} id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validate${simpleClassName}Exists(id);
|
validate${simpleClassName}Exists(id);
|
||||||
// 删除
|
// 删除
|
||||||
${classNameVar}Mapper.deleteById(id);
|
${classNameVar}Mapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ import static org.mockito.Mockito.*;
|
|||||||
#if (${column.listOperation})
|
#if (${column.listOperation})
|
||||||
#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
|
#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
|
||||||
#if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况
|
#if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况
|
||||||
reqVO.set${JavaField}((new LocalDateTime[]{}));
|
reqVO.set${JavaField}(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||||
#else
|
#else
|
||||||
reqVO.set$JavaField(null);
|
reqVO.set$JavaField(null);
|
||||||
#end
|
#end
|
||||||
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.config;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
|
import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO;
|
||||||
@ -12,17 +11,17 @@ import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqV
|
|||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
|
import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
|
||||||
import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum;
|
import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum;
|
||||||
import org.junit.jupiter.api.Assertions;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static cn.hutool.core.util.RandomUtil.randomEle;
|
import static cn.hutool.core.util.RandomUtil.randomEle;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
@ -30,7 +29,7 @@ import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
|||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
@Import(ConfigServiceImpl.class)
|
@Import(ConfigServiceImpl.class)
|
||||||
public class ConfigServiceTest extends BaseDbUnitTest {
|
public class ConfigServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ConfigServiceImpl configService;
|
private ConfigServiceImpl configService;
|
||||||
@ -50,7 +49,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
|
|||||||
// 校验记录的属性是否正确
|
// 校验记录的属性是否正确
|
||||||
ConfigDO config = configMapper.selectById(configId);
|
ConfigDO config = configMapper.selectById(configId);
|
||||||
assertPojoEquals(reqVO, config);
|
assertPojoEquals(reqVO, config);
|
||||||
Assertions.assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType());
|
assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -101,40 +100,40 @@ public class ConfigServiceTest extends BaseDbUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCheckConfigExists_success() {
|
public void testValidateConfigExists_success() {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
ConfigDO dbConfigDO = randomConfigDO();
|
ConfigDO dbConfigDO = randomConfigDO();
|
||||||
configMapper.insert(dbConfigDO);// @Sql: 先插入出一条存在的数据
|
configMapper.insert(dbConfigDO);// @Sql: 先插入出一条存在的数据
|
||||||
|
|
||||||
// 调用成功
|
// 调用成功
|
||||||
configService.checkConfigExists(dbConfigDO.getId());
|
configService.validateConfigExists(dbConfigDO.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCheckConfigExist_notExists() {
|
public void testValidateConfigExist_notExists() {
|
||||||
assertServiceException(() -> configService.checkConfigExists(randomLongId()), CONFIG_NOT_EXISTS);
|
assertServiceException(() -> configService.validateConfigExists(randomLongId()), CONFIG_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCheckConfigKeyUnique_success() {
|
public void testValidateConfigKeyUnique_success() {
|
||||||
// 调用,成功
|
// 调用,成功
|
||||||
configService.checkConfigKeyUnique(randomLongId(), randomString());
|
configService.validateConfigKeyUnique(randomLongId(), randomString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCheckConfigKeyUnique_keyDuplicateForCreate() {
|
public void testValidateConfigKeyUnique_keyDuplicateForCreate() {
|
||||||
// 准备参数
|
// 准备参数
|
||||||
String key = randomString();
|
String key = randomString();
|
||||||
// mock 数据
|
// mock 数据
|
||||||
configMapper.insert(randomConfigDO(o -> o.setConfigKey(key)));
|
configMapper.insert(randomConfigDO(o -> o.setConfigKey(key)));
|
||||||
|
|
||||||
// 调用,校验异常
|
// 调用,校验异常
|
||||||
assertServiceException(() -> configService.checkConfigKeyUnique(null, key),
|
assertServiceException(() -> configService.validateConfigKeyUnique(null, key),
|
||||||
CONFIG_KEY_DUPLICATE);
|
CONFIG_KEY_DUPLICATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCheckConfigKeyUnique_keyDuplicateForUpdate() {
|
public void testValidateConfigKeyUnique_keyDuplicateForUpdate() {
|
||||||
// 准备参数
|
// 准备参数
|
||||||
Long id = randomLongId();
|
Long id = randomLongId();
|
||||||
String key = randomString();
|
String key = randomString();
|
||||||
@ -142,7 +141,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
|
|||||||
configMapper.insert(randomConfigDO(o -> o.setConfigKey(key)));
|
configMapper.insert(randomConfigDO(o -> o.setConfigKey(key)));
|
||||||
|
|
||||||
// 调用,校验异常
|
// 调用,校验异常
|
||||||
assertServiceException(() -> configService.checkConfigKeyUnique(id, key),
|
assertServiceException(() -> configService.validateConfigKeyUnique(id, key),
|
||||||
CONFIG_KEY_DUPLICATE);
|
CONFIG_KEY_DUPLICATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,19 +156,19 @@ public class ConfigServiceTest extends BaseDbUnitTest {
|
|||||||
});
|
});
|
||||||
configMapper.insert(dbConfig);
|
configMapper.insert(dbConfig);
|
||||||
// 测试 name 不匹配
|
// 测试 name 不匹配
|
||||||
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setName("土豆")));
|
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setName("土豆")));
|
||||||
// 测试 key 不匹配
|
// 测试 key 不匹配
|
||||||
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setConfigKey("tudou")));
|
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setConfigKey("tudou")));
|
||||||
// 测试 type 不匹配
|
// 测试 type 不匹配
|
||||||
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
|
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
|
||||||
// 测试 createTime 不匹配
|
// 测试 createTime 不匹配
|
||||||
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
|
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
ConfigPageReqVO reqVO = new ConfigPageReqVO();
|
ConfigPageReqVO reqVO = new ConfigPageReqVO();
|
||||||
reqVO.setName("艿");
|
reqVO.setName("艿");
|
||||||
reqVO.setKey("nai");
|
reqVO.setKey("nai");
|
||||||
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
|
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
|
||||||
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)}));
|
reqVO.setCreateTime(buildBetweenTime(2021, 1, 15, 2021, 2, 15));
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
PageResult<ConfigDO> pageResult = configService.getConfigPage(reqVO);
|
PageResult<ConfigDO> pageResult = configService.getConfigPage(reqVO);
|
||||||
@ -190,19 +189,19 @@ public class ConfigServiceTest extends BaseDbUnitTest {
|
|||||||
});
|
});
|
||||||
configMapper.insert(dbConfig);
|
configMapper.insert(dbConfig);
|
||||||
// 测试 name 不匹配
|
// 测试 name 不匹配
|
||||||
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setName("土豆")));
|
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setName("土豆")));
|
||||||
// 测试 key 不匹配
|
// 测试 key 不匹配
|
||||||
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setConfigKey("tudou")));
|
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setConfigKey("tudou")));
|
||||||
// 测试 type 不匹配
|
// 测试 type 不匹配
|
||||||
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
|
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
|
||||||
// 测试 createTime 不匹配
|
// 测试 createTime 不匹配
|
||||||
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
|
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
ConfigExportReqVO reqVO = new ConfigExportReqVO();
|
ConfigExportReqVO reqVO = new ConfigExportReqVO();
|
||||||
reqVO.setName("艿");
|
reqVO.setName("艿");
|
||||||
reqVO.setKey("nai");
|
reqVO.setKey("nai");
|
||||||
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
|
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
|
||||||
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)}));
|
reqVO.setCreateTime(buildBetweenTime(2021, 1, 15, 2021, 2, 15));
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
List<ConfigDO> list = configService.getConfigList(reqVO);
|
List<ConfigDO> list = configService.getConfigList(reqVO);
|
||||||
@ -211,6 +210,21 @@ public class ConfigServiceTest extends BaseDbUnitTest {
|
|||||||
assertPojoEquals(dbConfig, list.get(0));
|
assertPojoEquals(dbConfig, list.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetConfig() {
|
||||||
|
// mock 数据
|
||||||
|
ConfigDO dbConfig = randomConfigDO();
|
||||||
|
configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbConfig.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
ConfigDO config = configService.getConfig(id);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(config);
|
||||||
|
assertPojoEquals(dbConfig, config);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetConfigByKey() {
|
public void testGetConfigByKey() {
|
||||||
// mock 数据
|
// mock 数据
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.db;
|
package cn.iocoder.yudao.module.infra.service.db;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
import cn.hutool.crypto.symmetric.AES;
|
import cn.hutool.crypto.symmetric.AES;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.type.EncryptTypeHandler;
|
import cn.iocoder.yudao.framework.mybatis.core.type.EncryptTypeHandler;
|
||||||
@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigCrea
|
|||||||
import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
|
import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
|
||||||
|
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
|
||||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
|
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -18,14 +20,14 @@ import org.springframework.boot.test.mock.mockito.MockBean;
|
|||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.mockStatic;
|
import static org.mockito.Mockito.mockStatic;
|
||||||
@ -57,6 +59,11 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
|
|||||||
ReflectUtil.setFieldValue(EncryptTypeHandler.class, "aes", aes);
|
ReflectUtil.setFieldValue(EncryptTypeHandler.class, "aes", aes);
|
||||||
when(aes.encryptBase64(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
|
when(aes.encryptBase64(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
|
||||||
when(aes.decryptStr(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
|
when(aes.decryptStr(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
|
||||||
|
|
||||||
|
// mock DynamicDataSourceProperties
|
||||||
|
when(dynamicDataSourceProperties.getPrimary()).thenReturn("primary");
|
||||||
|
when(dynamicDataSourceProperties.getDatasource()).thenReturn(MapUtil.of("primary",
|
||||||
|
new DataSourceProperty().setUrl("http://localhost:3306").setUsername("yunai").setPassword("tudou")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -89,7 +96,6 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
|
|||||||
o.setId(dbDataSourceConfig.getId()); // 设置更新的 ID
|
o.setId(dbDataSourceConfig.getId()); // 设置更新的 ID
|
||||||
});
|
});
|
||||||
// mock 方法
|
// mock 方法
|
||||||
// when(stringEncryptor.encrypt(eq(reqVO.getPassword()))).thenReturn("123456");
|
|
||||||
databaseUtilsMock.when(() -> JdbcUtils.isConnectionOK(eq(reqVO.getUrl()),
|
databaseUtilsMock.when(() -> JdbcUtils.isConnectionOK(eq(reqVO.getUrl()),
|
||||||
eq(reqVO.getUsername()), eq(reqVO.getPassword()))).thenReturn(true);
|
eq(reqVO.getUsername()), eq(reqVO.getPassword()))).thenReturn(true);
|
||||||
|
|
||||||
@ -142,7 +148,58 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
|
|||||||
// 调用
|
// 调用
|
||||||
DataSourceConfigDO result = dataSourceConfigMapper.selectOne(DataSourceConfigDO::getPassword,
|
DataSourceConfigDO result = dataSourceConfigMapper.selectOne(DataSourceConfigDO::getPassword,
|
||||||
EncryptTypeHandler.encrypt(dbDataSourceConfig.getPassword()));
|
EncryptTypeHandler.encrypt(dbDataSourceConfig.getPassword()));
|
||||||
System.out.println(result);
|
assertPojoEquals(dbDataSourceConfig, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetDataSourceConfig_master() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = 0L;
|
||||||
|
// mock 方法
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
DataSourceConfigDO dataSourceConfig = dataSourceConfigService.getDataSourceConfig(id);
|
||||||
|
// 断言
|
||||||
|
assertEquals(id, dataSourceConfig.getId());
|
||||||
|
assertEquals("primary", dataSourceConfig.getName());
|
||||||
|
assertEquals("http://localhost:3306", dataSourceConfig.getUrl());
|
||||||
|
assertEquals("yunai", dataSourceConfig.getUsername());
|
||||||
|
assertEquals("tudou", dataSourceConfig.getPassword());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetDataSourceConfig_normal() {
|
||||||
|
// mock 数据
|
||||||
|
DataSourceConfigDO dbDataSourceConfig = randomPojo(DataSourceConfigDO.class);
|
||||||
|
dataSourceConfigMapper.insert(dbDataSourceConfig);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbDataSourceConfig.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
DataSourceConfigDO dataSourceConfig = dataSourceConfigService.getDataSourceConfig(id);
|
||||||
|
// 断言
|
||||||
|
assertPojoEquals(dbDataSourceConfig, dataSourceConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetDataSourceConfigList() {
|
||||||
|
// mock 数据
|
||||||
|
DataSourceConfigDO dbDataSourceConfig = randomPojo(DataSourceConfigDO.class);
|
||||||
|
dataSourceConfigMapper.insert(dbDataSourceConfig);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
List<DataSourceConfigDO> dataSourceConfigList = dataSourceConfigService.getDataSourceConfigList();
|
||||||
|
// 断言
|
||||||
|
assertEquals(2, dataSourceConfigList.size());
|
||||||
|
// master
|
||||||
|
assertEquals(0L, dataSourceConfigList.get(0).getId());
|
||||||
|
assertEquals("primary", dataSourceConfigList.get(0).getName());
|
||||||
|
assertEquals("http://localhost:3306", dataSourceConfigList.get(0).getUrl());
|
||||||
|
assertEquals("yunai", dataSourceConfigList.get(0).getUsername());
|
||||||
|
assertEquals("tudou", dataSourceConfigList.get(0).getPassword());
|
||||||
|
// normal
|
||||||
|
assertPojoEquals(dbDataSourceConfig, dataSourceConfigList.get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,89 @@
|
|||||||
|
package cn.iocoder.yudao.module.infra.service.db;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.po.TableField;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
|
||||||
|
import org.apache.ibatis.type.JdbcType;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
@Import(DatabaseTableServiceImpl.class)
|
||||||
|
public class DatabaseTableServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DatabaseTableServiceImpl databaseTableService;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private DataSourceConfigService dataSourceConfigService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetTableList() {
|
||||||
|
// 准备参数
|
||||||
|
Long dataSourceConfigId = randomLongId();
|
||||||
|
// mock 方法
|
||||||
|
DataSourceConfigDO dataSourceConfig = new DataSourceConfigDO().setUsername("sa").setPassword("")
|
||||||
|
.setUrl("jdbc:h2:mem:testdb");
|
||||||
|
when(dataSourceConfigService.getDataSourceConfig(eq(dataSourceConfigId)))
|
||||||
|
.thenReturn(dataSourceConfig);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
List<TableInfo> tables = databaseTableService.getTableList(dataSourceConfigId,
|
||||||
|
"config", "参数");
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, tables.size());
|
||||||
|
assertTableInfo(tables.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetTable() {
|
||||||
|
// 准备参数
|
||||||
|
Long dataSourceConfigId = randomLongId();
|
||||||
|
// mock 方法
|
||||||
|
DataSourceConfigDO dataSourceConfig = new DataSourceConfigDO().setUsername("sa").setPassword("")
|
||||||
|
.setUrl("jdbc:h2:mem:testdb");
|
||||||
|
when(dataSourceConfigService.getDataSourceConfig(eq(dataSourceConfigId)))
|
||||||
|
.thenReturn(dataSourceConfig);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
TableInfo tableInfo = databaseTableService.getTable(dataSourceConfigId, "infra_config");
|
||||||
|
// 断言
|
||||||
|
assertTableInfo(tableInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertTableInfo(TableInfo tableInfo) {
|
||||||
|
assertEquals("infra_config", tableInfo.getName());
|
||||||
|
assertEquals("参数配置表", tableInfo.getComment());
|
||||||
|
assertEquals(13, tableInfo.getFields().size());
|
||||||
|
// id 字段
|
||||||
|
TableField idField = tableInfo.getFields().get(0);
|
||||||
|
assertEquals("id", idField.getName());
|
||||||
|
assertEquals(JdbcType.BIGINT, idField.getMetaInfo().getJdbcType());
|
||||||
|
assertEquals("编号", idField.getComment());
|
||||||
|
assertFalse(idField.getMetaInfo().isNullable());
|
||||||
|
assertTrue(idField.isKeyFlag());
|
||||||
|
assertTrue(idField.isKeyIdentityFlag());
|
||||||
|
assertEquals(DbColumnType.LONG, idField.getColumnType());
|
||||||
|
assertEquals("id", idField.getPropertyName());
|
||||||
|
// name 字段
|
||||||
|
TableField nameField = tableInfo.getFields().get(3);
|
||||||
|
assertEquals("name", nameField.getName());
|
||||||
|
assertEquals(JdbcType.VARCHAR, nameField.getMetaInfo().getJdbcType());
|
||||||
|
assertEquals("名字", nameField.getComment());
|
||||||
|
assertFalse(nameField.getMetaInfo().isNullable());
|
||||||
|
assertFalse(nameField.isKeyFlag());
|
||||||
|
assertFalse(nameField.isKeyIdentityFlag());
|
||||||
|
assertEquals(DbColumnType.STRING, nameField.getColumnType());
|
||||||
|
assertEquals("name", nameField.getPropertyName());
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.framework.file.core.client.FileClient;
|
import cn.iocoder.yudao.framework.file.core.client.FileClient;
|
||||||
import cn.iocoder.yudao.framework.file.core.client.FileClientConfig;
|
import cn.iocoder.yudao.framework.file.core.client.FileClientConfig;
|
||||||
import cn.iocoder.yudao.framework.file.core.client.FileClientFactory;
|
import cn.iocoder.yudao.framework.file.core.client.FileClientFactory;
|
||||||
|
import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClient;
|
||||||
import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClientConfig;
|
import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClientConfig;
|
||||||
import cn.iocoder.yudao.framework.file.core.enums.FileStorageEnum;
|
import cn.iocoder.yudao.framework.file.core.enums.FileStorageEnum;
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
@ -242,6 +243,30 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
|
|||||||
assertEquals("https://www.iocoder.cn", fileConfigService.testFileConfig(id));
|
assertEquals("https://www.iocoder.cn", fileConfigService.testFileConfig(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetFileConfig() {
|
||||||
|
// mock 数据
|
||||||
|
FileConfigDO dbFileConfig = randomFileConfigDO().setMaster(false);
|
||||||
|
fileConfigMapper.insert(dbFileConfig);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbFileConfig.getId();
|
||||||
|
|
||||||
|
// 调用,并断言
|
||||||
|
assertPojoEquals(dbFileConfig, fileConfigService.getFileConfig(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetFileClient() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
// mock 获得 Client
|
||||||
|
FileClient fileClient = new LocalFileClient(id, new LocalFileClientConfig());
|
||||||
|
when(fileClientFactory.getFileClient(eq(id))).thenReturn(fileClient);
|
||||||
|
|
||||||
|
// 调用,并断言
|
||||||
|
assertSame(fileClient, fileConfigService.getFileClient(id));
|
||||||
|
}
|
||||||
|
|
||||||
private FileConfigDO randomFileConfigDO() {
|
private FileConfigDO randomFileConfigDO() {
|
||||||
return randomPojo(FileConfigDO.class).setStorage(randomEle(FileStorageEnum.values()).getStorage())
|
return randomPojo(FileConfigDO.class).setStorage(randomEle(FileStorageEnum.values()).getStorage())
|
||||||
.setConfig(new EmptyFileClientConfig());
|
.setConfig(new EmptyFileClientConfig());
|
||||||
|
@ -26,7 +26,7 @@ import static org.mockito.ArgumentMatchers.same;
|
|||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@Import({FileServiceImpl.class})
|
@Import({FileServiceImpl.class})
|
||||||
public class FileServiceTest extends BaseDbUnitTest {
|
public class FileServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FileService fileService;
|
private FileService fileService;
|
@ -1,7 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.job;
|
package cn.iocoder.yudao.module.infra.service.job;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
|
||||||
@ -12,18 +11,20 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.hutool.core.util.RandomUtil.randomEle;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static java.util.Collections.singleton;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
@Import(JobLogServiceImpl.class)
|
@Import(JobLogServiceImpl.class)
|
||||||
public class JobLogServiceTest extends BaseDbUnitTest {
|
public class JobLogServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private JobLogServiceImpl jobLogService;
|
private JobLogServiceImpl jobLogService;
|
||||||
@ -31,66 +32,103 @@ public class JobLogServiceTest extends BaseDbUnitTest {
|
|||||||
private JobLogMapper jobLogMapper;
|
private JobLogMapper jobLogMapper;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateJobLog_success() {
|
public void testCreateJobLog() {
|
||||||
// 准备参数
|
// 准备参数
|
||||||
JobLogDO reqVO = randomPojo(JobLogDO.class, o -> {
|
JobLogDO reqVO = randomPojo(JobLogDO.class, o -> o.setExecuteIndex(1));
|
||||||
o.setExecuteIndex(1);
|
|
||||||
});
|
|
||||||
// 调用
|
// 调用
|
||||||
Long jobLogId = jobLogService.createJobLog(reqVO.getJobId(), reqVO.getBeginTime(), reqVO.getHandlerName(), reqVO.getHandlerParam(), reqVO.getExecuteIndex());
|
Long id = jobLogService.createJobLog(reqVO.getJobId(), reqVO.getBeginTime(),
|
||||||
|
reqVO.getHandlerName(), reqVO.getHandlerParam(), reqVO.getExecuteIndex());
|
||||||
// 断言
|
// 断言
|
||||||
assertNotNull(jobLogId);
|
assertNotNull(id);
|
||||||
// 校验记录的属性是否正确
|
// 校验记录的属性是否正确
|
||||||
JobLogDO job = jobLogMapper.selectById(jobLogId);
|
JobLogDO job = jobLogMapper.selectById(id);
|
||||||
assertEquals(JobLogStatusEnum.RUNNING.getStatus(), job.getStatus());
|
assertEquals(JobLogStatusEnum.RUNNING.getStatus(), job.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateJobLogResultAsync_success() {
|
public void testUpdateJobLogResultAsync_success() {
|
||||||
// 准备参数
|
// mock 数据
|
||||||
JobLogDO reqVO = randomPojo(JobLogDO.class, o -> {
|
JobLogDO log = randomPojo(JobLogDO.class, o -> {
|
||||||
o.setExecuteIndex(1);
|
o.setExecuteIndex(1);
|
||||||
|
o.setStatus(JobLogStatusEnum.RUNNING.getStatus());
|
||||||
});
|
});
|
||||||
JobLogDO log = JobLogDO.builder().jobId(reqVO.getJobId()).handlerName(reqVO.getHandlerName()).handlerParam(reqVO.getHandlerParam()).executeIndex(reqVO.getExecuteIndex())
|
|
||||||
.beginTime(reqVO.getBeginTime()).status(JobLogStatusEnum.RUNNING.getStatus()).build();
|
|
||||||
jobLogMapper.insert(log);
|
jobLogMapper.insert(log);
|
||||||
// 调用
|
// 准备参数
|
||||||
jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), true,reqVO.getResult());
|
Long logId = log.getId();
|
||||||
// 校验记录的属性是否正确
|
LocalDateTime endTime = randomLocalDateTime();
|
||||||
JobLogDO job = jobLogMapper.selectById(log.getId());
|
Integer duration = randomInteger();
|
||||||
assertEquals(JobLogStatusEnum.SUCCESS.getStatus(), job.getStatus());
|
boolean success = true;
|
||||||
|
String result = randomString();
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), false,reqVO.getResult());
|
jobLogService.updateJobLogResultAsync(logId, endTime, duration, success, result);
|
||||||
// 校验记录的属性是否正确
|
// 校验记录的属性是否正确
|
||||||
JobLogDO job2 = jobLogMapper.selectById(log.getId());
|
JobLogDO dbLog = jobLogMapper.selectById(log.getId());
|
||||||
assertEquals(JobLogStatusEnum.FAILURE.getStatus(), job2.getStatus());
|
assertEquals(endTime, dbLog.getEndTime());
|
||||||
|
assertEquals(duration, dbLog.getDuration());
|
||||||
|
assertEquals(JobLogStatusEnum.SUCCESS.getStatus(), dbLog.getStatus());
|
||||||
|
assertEquals(result, dbLog.getResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetJobLogListByIds_success() {
|
public void testUpdateJobLogResultAsync_failure() {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> {
|
JobLogDO log = randomPojo(JobLogDO.class, o -> {
|
||||||
o.setExecuteIndex(1);
|
o.setExecuteIndex(1);
|
||||||
o.setStatus(randomEle(JobLogStatusEnum.values()).getStatus()); // 保证 status 的范围
|
o.setStatus(JobLogStatusEnum.RUNNING.getStatus());
|
||||||
});
|
});
|
||||||
JobLogDO cloneJobLog = ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString()));
|
jobLogMapper.insert(log);
|
||||||
|
// 准备参数
|
||||||
|
Long logId = log.getId();
|
||||||
|
LocalDateTime endTime = randomLocalDateTime();
|
||||||
|
Integer duration = randomInteger();
|
||||||
|
boolean success = false;
|
||||||
|
String result = randomString();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
jobLogService.updateJobLogResultAsync(logId, endTime, duration, success, result);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
JobLogDO dbLog = jobLogMapper.selectById(log.getId());
|
||||||
|
assertEquals(endTime, dbLog.getEndTime());
|
||||||
|
assertEquals(duration, dbLog.getDuration());
|
||||||
|
assertEquals(JobLogStatusEnum.FAILURE.getStatus(), dbLog.getStatus());
|
||||||
|
assertEquals(result, dbLog.getResult());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetJobLog() {
|
||||||
|
// mock 数据
|
||||||
|
JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> o.setExecuteIndex(1));
|
||||||
|
jobLogMapper.insert(dbJobLog);
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbJobLog.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
JobLogDO jobLog = jobLogService.getJobLog(id);
|
||||||
|
// 断言
|
||||||
|
assertPojoEquals(dbJobLog, jobLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetJobLogList() {
|
||||||
|
// mock 数据
|
||||||
|
JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> o.setExecuteIndex(1));
|
||||||
jobLogMapper.insert(dbJobLog);
|
jobLogMapper.insert(dbJobLog);
|
||||||
// 测试 handlerName 不匹配
|
// 测试 handlerName 不匹配
|
||||||
jobLogMapper.insert(cloneJobLog);
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> {}));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
ArrayList ids = new ArrayList<>();
|
Collection<Long> ids = singleton(dbJobLog.getId());
|
||||||
ids.add(dbJobLog.getId());
|
|
||||||
ids.add(cloneJobLog.getId());
|
|
||||||
// 调用
|
// 调用
|
||||||
List<JobLogDO> list = jobLogService.getJobLogList(ids);
|
List<JobLogDO> list = jobLogService.getJobLogList(ids);
|
||||||
// 断言
|
// 断言
|
||||||
assertEquals(2, list.size());
|
assertEquals(1, list.size());
|
||||||
assertPojoEquals(dbJobLog, list.get(0));
|
assertPojoEquals(dbJobLog, list.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetJobPage_success() {
|
public void testGetJobPage() {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> {
|
JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> {
|
||||||
o.setExecuteIndex(1);
|
o.setExecuteIndex(1);
|
||||||
@ -101,15 +139,15 @@ public class JobLogServiceTest extends BaseDbUnitTest {
|
|||||||
});
|
});
|
||||||
jobLogMapper.insert(dbJobLog);
|
jobLogMapper.insert(dbJobLog);
|
||||||
// 测试 jobId 不匹配
|
// 测试 jobId 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setJobId(randomLongId())));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setJobId(randomLongId())));
|
||||||
// 测试 handlerName 不匹配
|
// 测试 handlerName 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
|
||||||
// 测试 beginTime 不匹配
|
// 测试 beginTime 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
|
||||||
// 测试 endTime 不匹配
|
// 测试 endTime 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
|
||||||
// 测试 status 不匹配
|
// 测试 status 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
JobLogPageReqVO reqVo = new JobLogPageReqVO();
|
JobLogPageReqVO reqVo = new JobLogPageReqVO();
|
||||||
reqVo.setJobId(dbJobLog.getJobId());
|
reqVo.setJobId(dbJobLog.getJobId());
|
||||||
@ -117,6 +155,7 @@ public class JobLogServiceTest extends BaseDbUnitTest {
|
|||||||
reqVo.setBeginTime(dbJobLog.getBeginTime());
|
reqVo.setBeginTime(dbJobLog.getBeginTime());
|
||||||
reqVo.setEndTime(dbJobLog.getEndTime());
|
reqVo.setEndTime(dbJobLog.getEndTime());
|
||||||
reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
|
reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
PageResult<JobLogDO> pageResult = jobLogService.getJobLogPage(reqVo);
|
PageResult<JobLogDO> pageResult = jobLogService.getJobLogPage(reqVo);
|
||||||
// 断言
|
// 断言
|
||||||
@ -126,7 +165,7 @@ public class JobLogServiceTest extends BaseDbUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetJobListForExport_success() {
|
public void testGetJobList_export() {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> {
|
JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> {
|
||||||
o.setExecuteIndex(1);
|
o.setExecuteIndex(1);
|
||||||
@ -137,15 +176,15 @@ public class JobLogServiceTest extends BaseDbUnitTest {
|
|||||||
});
|
});
|
||||||
jobLogMapper.insert(dbJobLog);
|
jobLogMapper.insert(dbJobLog);
|
||||||
// 测试 jobId 不匹配
|
// 测试 jobId 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setJobId(randomLongId())));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setJobId(randomLongId())));
|
||||||
// 测试 handlerName 不匹配
|
// 测试 handlerName 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
|
||||||
// 测试 beginTime 不匹配
|
// 测试 beginTime 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
|
||||||
// 测试 endTime 不匹配
|
// 测试 endTime 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
|
||||||
// 测试 status 不匹配
|
// 测试 status 不匹配
|
||||||
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
|
jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
JobLogExportReqVO reqVo = new JobLogExportReqVO();
|
JobLogExportReqVO reqVo = new JobLogExportReqVO();
|
||||||
reqVo.setJobId(dbJobLog.getJobId());
|
reqVo.setJobId(dbJobLog.getJobId());
|
||||||
@ -153,6 +192,7 @@ public class JobLogServiceTest extends BaseDbUnitTest {
|
|||||||
reqVo.setBeginTime(dbJobLog.getBeginTime());
|
reqVo.setBeginTime(dbJobLog.getBeginTime());
|
||||||
reqVo.setEndTime(dbJobLog.getEndTime());
|
reqVo.setEndTime(dbJobLog.getEndTime());
|
||||||
reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
|
reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
List<JobLogDO> list = jobLogService.getJobLogList(reqVo);
|
List<JobLogDO> list = jobLogService.getJobLogList(reqVo);
|
||||||
// 断言
|
// 断言
|
@ -1,14 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.job;
|
package cn.iocoder.yudao.module.infra.service.job;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
|
||||||
import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager;
|
import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager;
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.convert.job.JobConvert;
|
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper;
|
import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper;
|
||||||
import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum;
|
import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum;
|
||||||
@ -18,22 +16,23 @@ import org.springframework.boot.test.mock.mockito.MockBean;
|
|||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.hutool.core.util.RandomUtil.randomEle;
|
import static cn.hutool.core.util.RandomUtil.randomEle;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString;
|
||||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||||
|
import static java.util.Collections.singletonList;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.times;
|
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
@Import(JobServiceImpl.class)
|
@Import(JobServiceImpl.class)
|
||||||
public class JobServiceTest extends BaseDbUnitTest {
|
public class JobServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private JobServiceImpl jobService;
|
private JobServiceImpl jobService;
|
||||||
@ -46,6 +45,7 @@ public class JobServiceTest extends BaseDbUnitTest {
|
|||||||
public void testCreateJob_cronExpressionValid() {
|
public void testCreateJob_cronExpressionValid() {
|
||||||
// 准备参数。Cron 表达式为 String 类型,默认随机字符串。
|
// 准备参数。Cron 表达式为 String 类型,默认随机字符串。
|
||||||
JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class);
|
JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class);
|
||||||
|
|
||||||
// 调用,并断言异常
|
// 调用,并断言异常
|
||||||
assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID);
|
assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID);
|
||||||
}
|
}
|
||||||
@ -54,6 +54,7 @@ public class JobServiceTest extends BaseDbUnitTest {
|
|||||||
public void testCreateJob_jobHandlerExists() throws SchedulerException {
|
public void testCreateJob_jobHandlerExists() throws SchedulerException {
|
||||||
// 准备参数 指定 Cron 表达式
|
// 准备参数 指定 Cron 表达式
|
||||||
JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
jobService.createJob(reqVO);
|
jobService.createJob(reqVO);
|
||||||
// 调用,并断言异常
|
// 调用,并断言异常
|
||||||
@ -64,6 +65,7 @@ public class JobServiceTest extends BaseDbUnitTest {
|
|||||||
public void testCreateJob_success() throws SchedulerException {
|
public void testCreateJob_success() throws SchedulerException {
|
||||||
// 准备参数 指定 Cron 表达式
|
// 准备参数 指定 Cron 表达式
|
||||||
JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
Long jobId = jobService.createJob(reqVO);
|
Long jobId = jobService.createJob(reqVO);
|
||||||
// 断言
|
// 断言
|
||||||
@ -73,14 +75,15 @@ public class JobServiceTest extends BaseDbUnitTest {
|
|||||||
assertPojoEquals(reqVO, job);
|
assertPojoEquals(reqVO, job);
|
||||||
assertEquals(JobStatusEnum.NORMAL.getStatus(), job.getStatus());
|
assertEquals(JobStatusEnum.NORMAL.getStatus(), job.getStatus());
|
||||||
// 校验调用
|
// 校验调用
|
||||||
verify(schedulerManager, times(1)).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()), eq(job.getCronExpression()),
|
verify(schedulerManager).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()),
|
||||||
eq(reqVO.getRetryCount()), eq(reqVO.getRetryInterval()));
|
eq(job.getCronExpression()), eq(reqVO.getRetryCount()), eq(reqVO.getRetryInterval()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateJob_jobNotExists(){
|
public void testUpdateJob_jobNotExists(){
|
||||||
// 准备参数
|
// 准备参数
|
||||||
JobUpdateReqVO reqVO = randomPojo(JobUpdateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobUpdateReqVO reqVO = randomPojo(JobUpdateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
||||||
|
|
||||||
// 调用,并断言异常
|
// 调用,并断言异常
|
||||||
assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS);
|
assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
@ -88,150 +91,136 @@ public class JobServiceTest extends BaseDbUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testUpdateJob_onlyNormalStatus(){
|
public void testUpdateJob_onlyNormalStatus(){
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.INIT.getStatus()));
|
||||||
JobDO job = JobConvert.INSTANCE.convert(createReqVO);
|
|
||||||
job.setStatus(JobStatusEnum.INIT.getStatus());
|
|
||||||
fillJobMonitorTimeoutEmpty(job);
|
|
||||||
jobMapper.insert(job);
|
jobMapper.insert(job);
|
||||||
// 准备参数
|
// 准备参数
|
||||||
JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> {
|
JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> {
|
||||||
o.setId(job.getId());
|
o.setId(job.getId());
|
||||||
o.setName(createReqVO.getName());
|
o.setCronExpression("0 0/1 * * * ? *");
|
||||||
o.setCronExpression(createReqVO.getCronExpression());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 调用,并断言异常
|
// 调用,并断言异常
|
||||||
assertServiceException(() -> jobService.updateJob(updateReqVO), JOB_UPDATE_ONLY_NORMAL_STATUS);
|
assertServiceException(() -> jobService.updateJob(updateReqVO),
|
||||||
|
JOB_UPDATE_ONLY_NORMAL_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateJob_success() throws SchedulerException {
|
public void testUpdateJob_success() throws SchedulerException {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()));
|
||||||
JobDO job = JobConvert.INSTANCE.convert(createReqVO);
|
|
||||||
job.setStatus(JobStatusEnum.NORMAL.getStatus());
|
|
||||||
fillJobMonitorTimeoutEmpty(job);
|
|
||||||
jobMapper.insert(job);
|
jobMapper.insert(job);
|
||||||
// 准备参数
|
// 准备参数
|
||||||
JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> {
|
JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> {
|
||||||
o.setId(job.getId());
|
o.setId(job.getId());
|
||||||
o.setName(createReqVO.getName());
|
o.setCronExpression("0 0/1 * * * ? *");
|
||||||
o.setCronExpression(createReqVO.getCronExpression());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
jobService.updateJob(updateReqVO);
|
jobService.updateJob(updateReqVO);
|
||||||
// 校验记录的属性是否正确
|
// 校验记录的属性是否正确
|
||||||
JobDO updateJob = jobMapper.selectById(updateReqVO.getId());
|
JobDO updateJob = jobMapper.selectById(updateReqVO.getId());
|
||||||
assertPojoEquals(updateReqVO, updateJob);
|
assertPojoEquals(updateReqVO, updateJob);
|
||||||
// 校验调用
|
// 校验调用
|
||||||
verify(schedulerManager, times(1)).updateJob(eq(job.getHandlerName()), eq(updateReqVO.getHandlerParam()), eq(updateReqVO.getCronExpression()),
|
verify(schedulerManager).updateJob(eq(job.getHandlerName()), eq(updateReqVO.getHandlerParam()),
|
||||||
eq(updateReqVO.getRetryCount()), eq(updateReqVO.getRetryInterval()));
|
eq(updateReqVO.getCronExpression()), eq(updateReqVO.getRetryCount()), eq(updateReqVO.getRetryInterval()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateJobStatus_changeStatusInvalid() {
|
public void testUpdateJobStatus_changeStatusInvalid() {
|
||||||
// 调用,并断言异常
|
// 调用,并断言异常
|
||||||
assertServiceException(() -> jobService.updateJobStatus(1L, JobStatusEnum.INIT.getStatus()), JOB_CHANGE_STATUS_INVALID);
|
assertServiceException(() -> jobService.updateJobStatus(1L, JobStatusEnum.INIT.getStatus()),
|
||||||
|
JOB_CHANGE_STATUS_INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateJobStatus_changeStatusEquals() {
|
public void testUpdateJobStatus_changeStatusEquals() {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()));
|
||||||
JobDO job = JobConvert.INSTANCE.convert(createReqVO);
|
|
||||||
job.setStatus(JobStatusEnum.NORMAL.getStatus());
|
|
||||||
fillJobMonitorTimeoutEmpty(job);
|
|
||||||
jobMapper.insert(job);
|
jobMapper.insert(job);
|
||||||
|
|
||||||
// 调用,并断言异常
|
// 调用,并断言异常
|
||||||
assertServiceException(() -> jobService.updateJobStatus(job.getId(), job.getStatus()), JOB_CHANGE_STATUS_EQUALS);
|
assertServiceException(() -> jobService.updateJobStatus(job.getId(), job.getStatus()),
|
||||||
|
JOB_CHANGE_STATUS_EQUALS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateJobStatus_NormalToStop_success() throws SchedulerException {
|
public void testUpdateJobStatus_stopSuccess() throws SchedulerException {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()));
|
||||||
JobDO job = JobConvert.INSTANCE.convert(createReqVO);
|
|
||||||
job.setStatus(JobStatusEnum.NORMAL.getStatus());
|
|
||||||
fillJobMonitorTimeoutEmpty(job);
|
|
||||||
jobMapper.insert(job);
|
jobMapper.insert(job);
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
jobService.updateJobStatus(job.getId(), JobStatusEnum.STOP.getStatus());
|
jobService.updateJobStatus(job.getId(), JobStatusEnum.STOP.getStatus());
|
||||||
// 校验记录的属性是否正确
|
// 校验记录的属性是否正确
|
||||||
JobDO updateJob = jobMapper.selectById(job.getId());
|
JobDO dbJob = jobMapper.selectById(job.getId());
|
||||||
assertEquals(JobStatusEnum.STOP.getStatus(), updateJob.getStatus());
|
assertEquals(JobStatusEnum.STOP.getStatus(), dbJob.getStatus());
|
||||||
// 校验调用
|
// 校验调用
|
||||||
verify(schedulerManager, times(1)).pauseJob(eq(job.getHandlerName()));
|
verify(schedulerManager).pauseJob(eq(job.getHandlerName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateJobStatus_StopToNormal_success() throws SchedulerException {
|
public void testUpdateJobStatus_normalSuccess() throws SchedulerException {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.STOP.getStatus()));
|
||||||
JobDO job = JobConvert.INSTANCE.convert(createReqVO);
|
|
||||||
job.setStatus(JobStatusEnum.STOP.getStatus());
|
|
||||||
fillJobMonitorTimeoutEmpty(job);
|
|
||||||
jobMapper.insert(job);
|
jobMapper.insert(job);
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
jobService.updateJobStatus(job.getId(), JobStatusEnum.NORMAL.getStatus());
|
jobService.updateJobStatus(job.getId(), JobStatusEnum.NORMAL.getStatus());
|
||||||
// 校验记录的属性是否正确
|
// 校验记录的属性是否正确
|
||||||
JobDO updateJob = jobMapper.selectById(job.getId());
|
JobDO dbJob = jobMapper.selectById(job.getId());
|
||||||
assertEquals(JobStatusEnum.NORMAL.getStatus(), updateJob.getStatus());
|
assertEquals(JobStatusEnum.NORMAL.getStatus(), dbJob.getStatus());
|
||||||
// 校验调用
|
// 校验调用
|
||||||
verify(schedulerManager, times(1)).resumeJob(eq(job.getHandlerName()));
|
verify(schedulerManager).resumeJob(eq(job.getHandlerName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTriggerJob_success() throws SchedulerException {
|
public void testTriggerJob_success() throws SchedulerException {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobDO job = randomPojo(JobDO.class);
|
||||||
JobDO job = JobConvert.INSTANCE.convert(createReqVO);
|
|
||||||
job.setStatus(JobStatusEnum.NORMAL.getStatus());
|
|
||||||
fillJobMonitorTimeoutEmpty(job);
|
|
||||||
jobMapper.insert(job);
|
jobMapper.insert(job);
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
jobService.triggerJob(job.getId());
|
jobService.triggerJob(job.getId());
|
||||||
// 校验调用
|
// 校验调用
|
||||||
verify(schedulerManager, times(1)).triggerJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()));
|
verify(schedulerManager).triggerJob(eq(job.getId()),
|
||||||
|
eq(job.getHandlerName()), eq(job.getHandlerParam()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteJob_success() throws SchedulerException {
|
public void testDeleteJob_success() throws SchedulerException {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
|
JobDO job = randomPojo(JobDO.class);
|
||||||
JobDO job = JobConvert.INSTANCE.convert(createReqVO);
|
|
||||||
job.setStatus(JobStatusEnum.NORMAL.getStatus());
|
|
||||||
fillJobMonitorTimeoutEmpty(job);
|
|
||||||
jobMapper.insert(job);
|
jobMapper.insert(job);
|
||||||
// 调用 UPDATE inf_job SET deleted=1 WHERE id=? AND deleted=0
|
|
||||||
|
// 调用
|
||||||
jobService.deleteJob(job.getId());
|
jobService.deleteJob(job.getId());
|
||||||
// 校验数据不存在了 WHERE id=? AND deleted=0 查询为空正常
|
// 校验不存在
|
||||||
assertNull(jobMapper.selectById(job.getId()));
|
assertNull(jobMapper.selectById(job.getId()));
|
||||||
// 校验调用
|
// 校验调用
|
||||||
verify(schedulerManager, times(1)).deleteJob(eq(job.getHandlerName()));
|
verify(schedulerManager).deleteJob(eq(job.getHandlerName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetJobListByIds_success() {
|
public void testGetJobList() {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobDO dbJob = randomPojo(JobDO.class, o -> {
|
JobDO dbJob = randomPojo(JobDO.class, o -> {
|
||||||
o.setStatus(randomEle(JobStatusEnum.values()).getStatus()); // 保证 status 的范围
|
o.setStatus(randomEle(JobStatusEnum.values()).getStatus()); // 保证 status 的范围
|
||||||
});
|
});
|
||||||
JobDO cloneJob = ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()));
|
|
||||||
jobMapper.insert(dbJob);
|
jobMapper.insert(dbJob);
|
||||||
// 测试 handlerName 不匹配
|
// 测试 id 不匹配
|
||||||
jobMapper.insert(cloneJob);
|
jobMapper.insert(cloneIgnoreId(dbJob, o -> {}));
|
||||||
|
|
||||||
// 准备参数
|
// 准备参数
|
||||||
ArrayList<Long> ids = new ArrayList<>();
|
Collection<Long> ids = singletonList(dbJob.getId());
|
||||||
ids.add(dbJob.getId());
|
|
||||||
ids.add(cloneJob.getId());
|
|
||||||
// 调用
|
// 调用
|
||||||
List<JobDO> list = jobService.getJobList(ids);
|
List<JobDO> list = jobService.getJobList(ids);
|
||||||
// 断言
|
// 断言
|
||||||
assertEquals(2, list.size());
|
assertEquals(1, list.size());
|
||||||
assertPojoEquals(dbJob, list.get(0));
|
assertPojoEquals(dbJob, list.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetJobPage_success() {
|
public void testGetJobPage() {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobDO dbJob = randomPojo(JobDO.class, o -> {
|
JobDO dbJob = randomPojo(JobDO.class, o -> {
|
||||||
o.setName("定时任务测试");
|
o.setName("定时任务测试");
|
||||||
@ -240,16 +229,17 @@ public class JobServiceTest extends BaseDbUnitTest {
|
|||||||
});
|
});
|
||||||
jobMapper.insert(dbJob);
|
jobMapper.insert(dbJob);
|
||||||
// 测试 name 不匹配
|
// 测试 name 不匹配
|
||||||
jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆")));
|
jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setName("土豆")));
|
||||||
// 测试 status 不匹配
|
// 测试 status 不匹配
|
||||||
jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus())));
|
jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus())));
|
||||||
// 测试 handlerName 不匹配
|
// 测试 handlerName 不匹配
|
||||||
jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())));
|
jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
JobPageReqVO reqVo = new JobPageReqVO();
|
JobPageReqVO reqVo = new JobPageReqVO();
|
||||||
reqVo.setName("定时");
|
reqVo.setName("定时");
|
||||||
reqVo.setStatus(JobStatusEnum.INIT.getStatus());
|
reqVo.setStatus(JobStatusEnum.INIT.getStatus());
|
||||||
reqVo.setHandlerName("单元");
|
reqVo.setHandlerName("单元");
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
PageResult<JobDO> pageResult = jobService.getJobPage(reqVo);
|
PageResult<JobDO> pageResult = jobService.getJobPage(reqVo);
|
||||||
// 断言
|
// 断言
|
||||||
@ -259,7 +249,7 @@ public class JobServiceTest extends BaseDbUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetJobListForExport_success() {
|
public void testGetJobList_export() {
|
||||||
// mock 数据
|
// mock 数据
|
||||||
JobDO dbJob = randomPojo(JobDO.class, o -> {
|
JobDO dbJob = randomPojo(JobDO.class, o -> {
|
||||||
o.setName("定时任务测试");
|
o.setName("定时任务测试");
|
||||||
@ -268,16 +258,17 @@ public class JobServiceTest extends BaseDbUnitTest {
|
|||||||
});
|
});
|
||||||
jobMapper.insert(dbJob);
|
jobMapper.insert(dbJob);
|
||||||
// 测试 name 不匹配
|
// 测试 name 不匹配
|
||||||
jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆")));
|
jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setName("土豆")));
|
||||||
// 测试 status 不匹配
|
// 测试 status 不匹配
|
||||||
jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus())));
|
jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus())));
|
||||||
// 测试 handlerName 不匹配
|
// 测试 handlerName 不匹配
|
||||||
jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())));
|
jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())));
|
||||||
// 准备参数
|
// 准备参数
|
||||||
JobExportReqVO reqVo = new JobExportReqVO();
|
JobExportReqVO reqVo = new JobExportReqVO();
|
||||||
reqVo.setName("定时");
|
reqVo.setName("定时");
|
||||||
reqVo.setStatus(JobStatusEnum.INIT.getStatus());
|
reqVo.setStatus(JobStatusEnum.INIT.getStatus());
|
||||||
reqVo.setHandlerName("单元");
|
reqVo.setHandlerName("单元");
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
List<JobDO> list = jobService.getJobList(reqVo);
|
List<JobDO> list = jobService.getJobList(reqVo);
|
||||||
// 断言
|
// 断言
|
||||||
@ -285,10 +276,15 @@ public class JobServiceTest extends BaseDbUnitTest {
|
|||||||
assertPojoEquals(dbJob, list.get(0));
|
assertPojoEquals(dbJob, list.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fillJobMonitorTimeoutEmpty(JobDO job) {
|
@Test
|
||||||
if (job.getMonitorTimeout() == null) {
|
public void testGetJob() {
|
||||||
job.setMonitorTimeout(0);
|
// mock 数据
|
||||||
}
|
JobDO dbJob = randomPojo(JobDO.class);
|
||||||
|
jobMapper.insert(dbJob);
|
||||||
|
// 调用
|
||||||
|
JobDO job = jobService.getJob(dbJob.getId());
|
||||||
|
// 断言
|
||||||
|
assertPojoEquals(dbJob, job);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,12 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.logger;
|
package cn.iocoder.yudao.module.infra.service.logger;
|
||||||
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
|
|
||||||
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
|
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
|
||||||
@ -16,149 +13,121 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
|
|
||||||
@Import(ApiAccessLogServiceImpl.class)
|
@Import(ApiAccessLogServiceImpl.class)
|
||||||
public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
|
public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ApiAccessLogService apiAccessLogService;
|
private ApiAccessLogServiceImpl apiAccessLogService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ApiAccessLogMapper apiAccessLogMapper;
|
private ApiAccessLogMapper apiAccessLogMapper;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetApiAccessLogPage() {
|
public void testGetApiAccessLogPage() {
|
||||||
// 构造测试数据
|
ApiAccessLogDO apiAccessLogDO = randomPojo(ApiAccessLogDO.class, o -> {
|
||||||
long userId = 2233L;
|
o.setUserId(2233L);
|
||||||
int userType = UserTypeEnum.ADMIN.getValue();
|
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
String applicationName = "yudao-test";
|
o.setApplicationName("yudao-test");
|
||||||
String requestUrl = "foo";
|
o.setRequestUrl("foo");
|
||||||
LocalDateTime beginTime = buildTime(2021, 3, 13);
|
o.setBeginTime(buildTime(2021, 3, 13));
|
||||||
int duration = 1000;
|
o.setDuration(1000);
|
||||||
int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode();
|
o.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
|
||||||
|
|
||||||
ApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(ApiAccessLogDO.class, dto -> {
|
|
||||||
dto.setUserId(userId);
|
|
||||||
dto.setUserType(userType);
|
|
||||||
dto.setApplicationName(applicationName);
|
|
||||||
dto.setRequestUrl(requestUrl);
|
|
||||||
dto.setBeginTime(beginTime);
|
|
||||||
dto.setDuration(duration);
|
|
||||||
dto.setResultCode(resultCode);
|
|
||||||
});
|
});
|
||||||
apiAccessLogMapper.insert(infApiAccessLogDO);
|
apiAccessLogMapper.insert(apiAccessLogDO);
|
||||||
|
// 测试 userId 不匹配
|
||||||
// 下面几个都是不匹配的数据
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserId(3344L)));
|
||||||
// userId 不同的
|
// 测试 userType 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L)));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||||
// userType
|
// 测试 applicationName 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setApplicationName("test")));
|
||||||
// applicationName 不同的
|
// 测试 requestUrl 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test")));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setRequestUrl("bar")));
|
||||||
// requestUrl 不同的
|
// 测试 beginTime 不匹配:构造一个早期时间 2021-02-06 00:00:00
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar")));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setBeginTime(buildTime(2021, 2, 6))));
|
||||||
// 构造一个早期时间 2021-02-06 00:00:00
|
// 测试 duration 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6))));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setDuration(100)));
|
||||||
// duration 不同的
|
// 测试 resultCode 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100)));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setResultCode(2)));
|
||||||
// resultCode 不同的
|
// 准备参数
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2)));
|
|
||||||
|
|
||||||
// 构造调用参数
|
|
||||||
ApiAccessLogPageReqVO reqVO = new ApiAccessLogPageReqVO();
|
ApiAccessLogPageReqVO reqVO = new ApiAccessLogPageReqVO();
|
||||||
reqVO.setUserId(userId);
|
reqVO.setUserId(2233L);
|
||||||
reqVO.setUserType(userType);
|
reqVO.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
reqVO.setApplicationName(applicationName);
|
reqVO.setApplicationName("yudao-test");
|
||||||
reqVO.setRequestUrl(requestUrl);
|
reqVO.setRequestUrl("foo");
|
||||||
reqVO.setBeginTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
|
reqVO.setBeginTime(buildBetweenTime(2021, 3, 13, 2021, 3, 13));
|
||||||
reqVO.setDuration(duration);
|
reqVO.setDuration(1000);
|
||||||
reqVO.setResultCode(resultCode);
|
reqVO.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
|
||||||
|
|
||||||
// 调用service方法
|
// 调用
|
||||||
PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(reqVO);
|
PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(reqVO);
|
||||||
|
|
||||||
// 断言,只查到了一条符合条件的
|
// 断言,只查到了一条符合条件的
|
||||||
assertEquals(1, pageResult.getTotal());
|
assertEquals(1, pageResult.getTotal());
|
||||||
assertEquals(1, pageResult.getList().size());
|
assertEquals(1, pageResult.getList().size());
|
||||||
assertPojoEquals(infApiAccessLogDO, pageResult.getList().get(0));
|
assertPojoEquals(apiAccessLogDO, pageResult.getList().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetApiAccessLogList() {
|
public void testGetApiAccessLogList() {
|
||||||
// 构造测试数据
|
ApiAccessLogDO apiAccessLogDO = randomPojo(ApiAccessLogDO.class, o -> {
|
||||||
long userId = 2233L;
|
o.setUserId(2233L);
|
||||||
int userType = UserTypeEnum.ADMIN.getValue();
|
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
String applicationName = "yudao-test";
|
o.setApplicationName("yudao-test");
|
||||||
String requestUrl = "foo";
|
o.setRequestUrl("foo");
|
||||||
LocalDateTime beginTime = buildTime(2021, 3, 13);
|
o.setBeginTime(buildTime(2021, 3, 13));
|
||||||
int duration = 1000;
|
o.setDuration(1000);
|
||||||
int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode();
|
o.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
|
||||||
|
|
||||||
ApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(ApiAccessLogDO.class, dto -> {
|
|
||||||
dto.setUserId(userId);
|
|
||||||
dto.setUserType(userType);
|
|
||||||
dto.setApplicationName(applicationName);
|
|
||||||
dto.setRequestUrl(requestUrl);
|
|
||||||
dto.setBeginTime(beginTime);
|
|
||||||
dto.setDuration(duration);
|
|
||||||
dto.setResultCode(resultCode);
|
|
||||||
});
|
});
|
||||||
apiAccessLogMapper.insert(infApiAccessLogDO);
|
apiAccessLogMapper.insert(apiAccessLogDO);
|
||||||
|
// 测试 userId 不匹配
|
||||||
// 下面几个都是不匹配的数据
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserId(3344L)));
|
||||||
// userId 不同的
|
// 测试 userType 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L)));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||||
// userType
|
// 测试 applicationName 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setApplicationName("test")));
|
||||||
// applicationName 不同的
|
// 测试 requestUrl 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test")));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setRequestUrl("bar")));
|
||||||
// requestUrl 不同的
|
// 测试 beginTime 不匹配:构造一个早期时间 2021-02-06 00:00:00
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar")));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setBeginTime(buildTime(2021, 2, 6))));
|
||||||
// 构造一个早期时间 2021-02-06 00:00:00
|
// 测试 duration 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6))));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setDuration(100)));
|
||||||
// duration 不同的
|
// 测试 resultCode 不匹配
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100)));
|
apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setResultCode(2)));
|
||||||
// resultCode 不同的
|
// 准备参数
|
||||||
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2)));
|
|
||||||
|
|
||||||
// 构造调用参数
|
|
||||||
ApiAccessLogExportReqVO reqVO = new ApiAccessLogExportReqVO();
|
ApiAccessLogExportReqVO reqVO = new ApiAccessLogExportReqVO();
|
||||||
reqVO.setUserId(userId);
|
reqVO.setUserId(2233L);
|
||||||
reqVO.setUserType(userType);
|
reqVO.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
reqVO.setApplicationName(applicationName);
|
reqVO.setApplicationName("yudao-test");
|
||||||
reqVO.setRequestUrl(requestUrl);
|
reqVO.setRequestUrl("foo");
|
||||||
reqVO.setBeginTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
|
reqVO.setBeginTime(buildBetweenTime(2021, 3, 13, 2021, 3, 13));
|
||||||
reqVO.setDuration(duration);
|
reqVO.setDuration(1000);
|
||||||
reqVO.setResultCode(resultCode);
|
reqVO.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
|
||||||
|
|
||||||
// 调用service方法
|
// 调用
|
||||||
List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(reqVO);
|
List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(reqVO);
|
||||||
|
|
||||||
// 断言,只查到了一条符合条件的
|
// 断言,只查到了一条符合条件的
|
||||||
assertEquals(1, list.size());
|
assertEquals(1, list.size());
|
||||||
assertPojoEquals(infApiAccessLogDO, list.get(0));
|
assertPojoEquals(apiAccessLogDO, list.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateApiAccessLogAsync() {
|
public void testCreateApiAccessLog() {
|
||||||
// 准备参数
|
// 准备参数
|
||||||
ApiAccessLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiAccessLogCreateReqDTO.class,
|
ApiAccessLogCreateReqDTO createDTO = randomPojo(ApiAccessLogCreateReqDTO.class);
|
||||||
dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue()));
|
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
apiAccessLogService.createApiAccessLog(createDTO);
|
apiAccessLogService.createApiAccessLog(createDTO);
|
||||||
// 断言
|
// 断言
|
||||||
ApiAccessLogDO infApiAccessLogDO = apiAccessLogMapper.selectOne(null);
|
ApiAccessLogDO apiAccessLogDO = apiAccessLogMapper.selectOne(null);
|
||||||
assertNotNull(infApiAccessLogDO);
|
assertPojoEquals(createDTO, apiAccessLogDO);
|
||||||
assertPojoEquals(createDTO, infApiAccessLogDO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.logger;
|
package cn.iocoder.yudao.module.infra.service.logger;
|
||||||
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
|
|
||||||
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
|
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
|
import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
|
||||||
import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
|
import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
|
||||||
import org.junit.jupiter.api.Assertions;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.RandomUtil.randomEle;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
|
||||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED;
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
@ -35,161 +35,150 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
|
|||||||
private ApiErrorLogServiceImpl apiErrorLogService;
|
private ApiErrorLogServiceImpl apiErrorLogService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ApiErrorLogMapper infApiErrorLogMapper;
|
private ApiErrorLogMapper apiErrorLogMapper;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetApiErrorLogPage() {
|
public void testGetApiErrorLogPage() {
|
||||||
// 构造测试数据
|
// mock 数据
|
||||||
long userId = 2233L;
|
ApiErrorLogDO apiErrorLogDO = randomPojo(ApiErrorLogDO.class, o -> {
|
||||||
int userType = UserTypeEnum.ADMIN.getValue();
|
o.setUserId(2233L);
|
||||||
String applicationName = "yudao-test";
|
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
String requestUrl = "foo";
|
o.setApplicationName("yudao-test");
|
||||||
LocalDateTime beginTime = buildTime(2021, 3, 13);
|
o.setRequestUrl("foo");
|
||||||
int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus();
|
o.setExceptionTime(buildTime(2021, 3, 13));
|
||||||
|
o.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
||||||
ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {
|
|
||||||
logDO.setUserId(userId);
|
|
||||||
logDO.setUserType(userType);
|
|
||||||
logDO.setApplicationName(applicationName);
|
|
||||||
logDO.setRequestUrl(requestUrl);
|
|
||||||
logDO.setExceptionTime(beginTime);
|
|
||||||
logDO.setProcessStatus(progressStatus);
|
|
||||||
});
|
});
|
||||||
infApiErrorLogMapper.insert(infApiErrorLogDO);
|
apiErrorLogMapper.insert(apiErrorLogDO);
|
||||||
|
// 测试 userId 不匹配
|
||||||
// 下面几个都是不匹配的数据
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, o -> o.setUserId(3344L)));
|
||||||
// userId 不同的
|
// 测试 userType 不匹配
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setUserId(3344L)));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||||
// userType
|
// 测试 applicationName 不匹配
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setApplicationName("test")));
|
||||||
// applicationName 不同的
|
// 测试 requestUrl 不匹配
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setApplicationName("test")));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
|
||||||
// requestUrl 不同的
|
// 测试 exceptionTime 不匹配:构造一个早期时间 2021-02-06 00:00:00
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
|
||||||
// 构造一个早期时间 2021-02-06 00:00:00
|
// 测试 progressStatus 不匹配
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
|
||||||
// progressStatus 不同的
|
// 准备参数
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
|
|
||||||
|
|
||||||
// 构造调用参数
|
|
||||||
ApiErrorLogPageReqVO reqVO = new ApiErrorLogPageReqVO();
|
ApiErrorLogPageReqVO reqVO = new ApiErrorLogPageReqVO();
|
||||||
reqVO.setUserId(userId);
|
reqVO.setUserId(2233L);
|
||||||
reqVO.setUserType(userType);
|
reqVO.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
reqVO.setApplicationName(applicationName);
|
reqVO.setApplicationName("yudao-test");
|
||||||
reqVO.setRequestUrl(requestUrl);
|
reqVO.setRequestUrl("foo");
|
||||||
reqVO.setExceptionTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
|
reqVO.setExceptionTime(buildBetweenTime(2021, 3, 1, 2021, 3, 31));
|
||||||
reqVO.setProcessStatus(progressStatus);
|
reqVO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
||||||
|
|
||||||
// 调用service方法
|
// 调用
|
||||||
PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(reqVO);
|
PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(reqVO);
|
||||||
|
|
||||||
// 断言,只查到了一条符合条件的
|
// 断言,只查到了一条符合条件的
|
||||||
assertEquals(1, pageResult.getTotal());
|
assertEquals(1, pageResult.getTotal());
|
||||||
assertEquals(1, pageResult.getList().size());
|
assertEquals(1, pageResult.getList().size());
|
||||||
assertPojoEquals(infApiErrorLogDO, pageResult.getList().get(0));
|
assertPojoEquals(apiErrorLogDO, pageResult.getList().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetApiErrorLogList() {
|
public void testGetApiErrorLogList() {
|
||||||
// 构造测试数据
|
// mock 数据
|
||||||
long userId = 2233L;
|
ApiErrorLogDO apiErrorLogDO = randomPojo(ApiErrorLogDO.class, o -> {
|
||||||
int userType = UserTypeEnum.ADMIN.getValue();
|
o.setUserId(2233L);
|
||||||
String applicationName = "yudao-test";
|
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
String requestUrl = "foo";
|
o.setApplicationName("yudao-test");
|
||||||
LocalDateTime beginTime = buildTime(2021, 3, 13);
|
o.setRequestUrl("foo");
|
||||||
int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus();
|
o.setExceptionTime(buildTime(2021, 3, 13));
|
||||||
|
o.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
||||||
ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {
|
|
||||||
logDO.setUserId(userId);
|
|
||||||
logDO.setUserType(userType);
|
|
||||||
logDO.setApplicationName(applicationName);
|
|
||||||
logDO.setRequestUrl(requestUrl);
|
|
||||||
logDO.setExceptionTime(beginTime);
|
|
||||||
logDO.setProcessStatus(progressStatus);
|
|
||||||
});
|
});
|
||||||
infApiErrorLogMapper.insert(infApiErrorLogDO);
|
apiErrorLogMapper.insert(apiErrorLogDO);
|
||||||
|
// 测试 userId 不匹配
|
||||||
// 下面几个都是不匹配的数据
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, o -> o.setUserId(3344L)));
|
||||||
// userId 不同的
|
// 测试 userType 不匹配
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setUserId(3344L)));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||||
// userType
|
// 测试 applicationName 不匹配
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setApplicationName("test")));
|
||||||
// applicationName 不同的
|
// 测试 requestUrl 不匹配
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setApplicationName("test")));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
|
||||||
// requestUrl 不同的
|
// 测试 exceptionTime 不匹配:构造一个早期时间 2021-02-06 00:00:00
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
|
||||||
// 构造一个早期时间 2021-02-06 00:00:00
|
// 测试 progressStatus 不匹配
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
|
apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
|
||||||
// progressStatus 不同的
|
// 准备参数
|
||||||
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
|
|
||||||
|
|
||||||
// 构造调用参数
|
|
||||||
ApiErrorLogExportReqVO reqVO = new ApiErrorLogExportReqVO();
|
ApiErrorLogExportReqVO reqVO = new ApiErrorLogExportReqVO();
|
||||||
reqVO.setUserId(userId);
|
reqVO.setUserId(2233L);
|
||||||
reqVO.setUserType(userType);
|
reqVO.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
reqVO.setApplicationName(applicationName);
|
reqVO.setApplicationName("yudao-test");
|
||||||
reqVO.setRequestUrl(requestUrl);
|
reqVO.setRequestUrl("foo");
|
||||||
reqVO.setExceptionTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
|
reqVO.setExceptionTime(buildBetweenTime(2021, 3, 1, 2021, 3, 31));
|
||||||
reqVO.setProcessStatus(progressStatus);
|
reqVO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
||||||
|
|
||||||
// 调用service方法
|
// 调用
|
||||||
List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(reqVO);
|
List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(reqVO);
|
||||||
|
|
||||||
// 断言,只查到了一条符合条件的
|
// 断言,只查到了一条符合条件的
|
||||||
assertEquals(1, list.size());
|
assertEquals(1, list.size());
|
||||||
assertPojoEquals(infApiErrorLogDO, list.get(0));
|
assertPojoEquals(apiErrorLogDO, list.get(0));
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// TODO 芋艿:单元测试,可以拆小一点
|
|
||||||
@Test
|
|
||||||
public void testUpdateApiErrorLogProcess() {
|
|
||||||
// 先构造两条数据,第一条用于抛出异常,第二条用于正常的执行update操作
|
|
||||||
Long processUserId = 2233L;
|
|
||||||
|
|
||||||
ApiErrorLogDO first = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {
|
|
||||||
logDO.setProcessUserId(processUserId);
|
|
||||||
logDO.setUserType(UserTypeEnum.ADMIN.getValue());
|
|
||||||
logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus());
|
|
||||||
});
|
|
||||||
infApiErrorLogMapper.insert(first);
|
|
||||||
|
|
||||||
ApiErrorLogDO second = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {
|
|
||||||
logDO.setProcessUserId(1122L);
|
|
||||||
logDO.setUserType(UserTypeEnum.ADMIN.getValue());
|
|
||||||
logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
|
||||||
});
|
|
||||||
infApiErrorLogMapper.insert(second);
|
|
||||||
|
|
||||||
Long firstId = first.getId();
|
|
||||||
Long secondId = second.getId();
|
|
||||||
|
|
||||||
// 执行正常的 update 操作
|
|
||||||
apiErrorLogService.updateApiErrorLogProcess(secondId, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId);
|
|
||||||
ApiErrorLogDO secondSelect = infApiErrorLogMapper.selectOne("id", secondId);
|
|
||||||
|
|
||||||
// id 为 0 查询不到,应该抛出异常 API_ERROR_LOG_NOT_FOUND
|
|
||||||
assertServiceException(() -> apiErrorLogService.updateApiErrorLogProcess(0L, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_NOT_FOUND);
|
|
||||||
// id 为 first 的 progressStatus 为 DONE ,应该抛出 API_ERROR_LOG_PROCESSED
|
|
||||||
assertServiceException(() -> apiErrorLogService.updateApiErrorLogProcess(firstId, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_PROCESSED);
|
|
||||||
// 验证 progressStatus 是否修改成功
|
|
||||||
Assertions.assertEquals(ApiErrorLogProcessStatusEnum.DONE.getStatus(), secondSelect.getProcessStatus());
|
|
||||||
// 验证 progressUserId 是否修改成功
|
|
||||||
Assertions.assertEquals(processUserId, secondSelect.getProcessUserId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateApiErrorLogAsync() {
|
public void testCreateApiErrorLog() {
|
||||||
// 准备参数
|
// 准备参数
|
||||||
ApiErrorLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiErrorLogCreateReqDTO.class,
|
ApiErrorLogCreateReqDTO createDTO = randomPojo(ApiErrorLogCreateReqDTO.class);
|
||||||
dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue()));
|
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
apiErrorLogService.createApiErrorLog(createDTO);
|
apiErrorLogService.createApiErrorLog(createDTO);
|
||||||
// 断言
|
// 断言
|
||||||
ApiErrorLogDO infApiErrorLogDO = infApiErrorLogMapper.selectOne(null);
|
ApiErrorLogDO apiErrorLogDO = apiErrorLogMapper.selectOne(null);
|
||||||
assertNotNull(infApiErrorLogDO);
|
assertPojoEquals(createDTO, apiErrorLogDO);
|
||||||
assertPojoEquals(createDTO, infApiErrorLogDO);
|
assertEquals(ApiErrorLogProcessStatusEnum.INIT.getStatus(), apiErrorLogDO.getProcessStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateApiErrorLogProcess_success() {
|
||||||
|
// 准备参数
|
||||||
|
ApiErrorLogDO apiErrorLogDO = randomPojo(ApiErrorLogDO.class,
|
||||||
|
o -> o.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()));
|
||||||
|
apiErrorLogMapper.insert(apiErrorLogDO);
|
||||||
|
// 准备参数
|
||||||
|
Long id = apiErrorLogDO.getId();
|
||||||
|
Integer processStatus = randomEle(ApiErrorLogProcessStatusEnum.values()).getStatus();
|
||||||
|
Long processUserId = randomLongId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
apiErrorLogService.updateApiErrorLogProcess(id, processStatus, processUserId);
|
||||||
|
// 断言
|
||||||
|
ApiErrorLogDO dbApiErrorLogDO = apiErrorLogMapper.selectById(apiErrorLogDO.getId());
|
||||||
|
assertEquals(processStatus, dbApiErrorLogDO.getProcessStatus());
|
||||||
|
assertEquals(processUserId, dbApiErrorLogDO.getProcessUserId());
|
||||||
|
assertNotNull(dbApiErrorLogDO.getProcessTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateApiErrorLogProcess_processed() {
|
||||||
|
// 准备参数
|
||||||
|
ApiErrorLogDO apiErrorLogDO = randomPojo(ApiErrorLogDO.class,
|
||||||
|
o -> o.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus()));
|
||||||
|
apiErrorLogMapper.insert(apiErrorLogDO);
|
||||||
|
// 准备参数
|
||||||
|
Long id = apiErrorLogDO.getId();
|
||||||
|
Integer processStatus = randomEle(ApiErrorLogProcessStatusEnum.values()).getStatus();
|
||||||
|
Long processUserId = randomLongId();
|
||||||
|
|
||||||
|
// 调用,并断言异常
|
||||||
|
assertServiceException(() ->
|
||||||
|
apiErrorLogService.updateApiErrorLogProcess(id, processStatus, processUserId),
|
||||||
|
API_ERROR_LOG_PROCESSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateApiErrorLogProcess_notFound() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
Integer processStatus = randomEle(ApiErrorLogProcessStatusEnum.values()).getStatus();
|
||||||
|
Long processUserId = randomLongId();
|
||||||
|
|
||||||
|
// 调用,并断言异常
|
||||||
|
assertServiceException(() ->
|
||||||
|
apiErrorLogService.updateApiErrorLogProcess(id, processStatus, processUserId),
|
||||||
|
API_ERROR_LOG_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
DELETE FROM "infra_config";
|
DELETE FROM "infra_config";
|
||||||
|
DELETE FROM "infra_file_config";
|
||||||
DELETE FROM "infra_file";
|
DELETE FROM "infra_file";
|
||||||
DELETE FROM "infra_job";
|
DELETE FROM "infra_job";
|
||||||
DELETE FROM "infra_job_log";
|
DELETE FROM "infra_job_log";
|
||||||
DELETE FROM "infra_api_access_log";
|
DELETE FROM "infra_api_access_log";
|
||||||
DELETE FROM "infra_api_error_log";
|
DELETE FROM "infra_api_error_log";
|
||||||
DELETE FROM "infra_api_access_log";
|
|
||||||
DELETE FROM "infra_file";
|
|
||||||
DELETE FROM "infra_api_error_log";
|
|
||||||
DELETE FROM "infra_test_demo";
|
|
||||||
DELETE FROM "infra_file_config";
|
DELETE FROM "infra_file_config";
|
||||||
|
DELETE FROM "infra_test_demo";
|
||||||
DELETE FROM "infra_data_source_config";
|
DELETE FROM "infra_data_source_config";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "infra_config" (
|
CREATE TABLE IF NOT EXISTS "infra_config" (
|
||||||
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
|
||||||
"category" varchar(50) NOT NULL,
|
"category" varchar(50) NOT NULL,
|
||||||
"type" tinyint NOT NULL,
|
"type" tinyint NOT NULL,
|
||||||
"name" varchar(100) NOT NULL DEFAULT '',
|
"name" varchar(100) NOT NULL DEFAULT '' COMMENT '名字',
|
||||||
"config_key" varchar(100) NOT NULL DEFAULT '',
|
"config_key" varchar(100) NOT NULL DEFAULT '',
|
||||||
"value" varchar(500) NOT NULL DEFAULT '',
|
"value" varchar(500) NOT NULL DEFAULT '',
|
||||||
"visible" bit NOT NULL,
|
"visible" bit NOT NULL,
|
||||||
@ -85,19 +85,6 @@ CREATE TABLE IF NOT EXISTS "infra_job_log" (
|
|||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
)COMMENT='定时任务日志表';
|
)COMMENT='定时任务日志表';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "inf_file" (
|
|
||||||
"id" varchar(188) NOT NULL,
|
|
||||||
"type" varchar(63) DEFAULT NULL,
|
|
||||||
"content" blob NOT NULL,
|
|
||||||
"creator" varchar(64) DEFAULT '',
|
|
||||||
"create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
"updater" varchar(64) DEFAULT '',
|
|
||||||
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
|
||||||
"tenant_id" bigint not null default '0',
|
|
||||||
PRIMARY KEY ("id")
|
|
||||||
) COMMENT '文件表';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "infra_api_access_log" (
|
CREATE TABLE IF NOT EXISTS "infra_api_access_log" (
|
||||||
"id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
|
"id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"trace_id" varchar(64) not null default '',
|
"trace_id" varchar(64) not null default '',
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
DELETE FROM "product_sku";
|
||||||
|
DELETE FROM "product_spu";
|
||||||
|
DELETE FROM "product_category";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS `product_sku` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`spu_id` bigint NOT NULL COMMENT 'spu编号',
|
||||||
|
`spu_name` varchar DEFAULT NULL COMMENT '商品 SPU 名字',
|
||||||
|
`properties` varchar DEFAULT NULL COMMENT '规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]',
|
||||||
|
`price` int NOT NULL DEFAULT '-1' COMMENT '销售价格,单位:分',
|
||||||
|
`market_price` int DEFAULT NULL COMMENT '市场价',
|
||||||
|
`cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分',
|
||||||
|
`pic_url` varchar NOT NULL COMMENT '图片地址',
|
||||||
|
`stock` int DEFAULT NULL COMMENT '库存',
|
||||||
|
`warn_stock` int DEFAULT NULL COMMENT '预警库存',
|
||||||
|
`volume` double DEFAULT NULL COMMENT '商品体积',
|
||||||
|
`weight` double DEFAULT NULL COMMENT '商品重量',
|
||||||
|
`bar_code` varchar DEFAULT NULL COMMENT '条形码',
|
||||||
|
`status` tinyint DEFAULT NULL COMMENT '状态: 0-正常 1-禁用',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`creator` varchar DEFAULT NULL COMMENT '创建人',
|
||||||
|
`updater` varchar DEFAULT NULL COMMENT '更新人',
|
||||||
|
`deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) COMMENT '商品sku';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `product_spu` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||||
|
`brand_id` bigint DEFAULT NULL COMMENT '商品品牌编号',
|
||||||
|
`category_id` bigint NOT NULL COMMENT '分类id',
|
||||||
|
`spec_type` int NOT NULL COMMENT '规格类型:0 单规格 1 多规格',
|
||||||
|
`code` varchar(128) DEFAULT NULL COMMENT '商品编码',
|
||||||
|
`name` varchar(128) NOT NULL COMMENT '商品名称',
|
||||||
|
`sell_point` varchar(128) DEFAULT NULL COMMENT '卖点',
|
||||||
|
`description` text COMMENT '描述',
|
||||||
|
`pic_urls` varchar(1024) DEFAULT '' COMMENT '商品轮播图地址数组,以逗号分隔最多上传15张',
|
||||||
|
`video_url` varchar(128) DEFAULT NULL COMMENT '商品视频',
|
||||||
|
`market_price` int DEFAULT NULL COMMENT '市场价,单位使用:分',
|
||||||
|
`min_price` int DEFAULT NULL COMMENT '最小价格,单位使用:分',
|
||||||
|
`max_price` int DEFAULT NULL COMMENT '最大价格,单位使用:分',
|
||||||
|
`total_stock` int NOT NULL DEFAULT '0' COMMENT '总库存',
|
||||||
|
`show_stock` int DEFAULT '0' COMMENT '是否展示库存',
|
||||||
|
`sales_count` int DEFAULT '0' COMMENT '商品销量',
|
||||||
|
`virtual_sales_count` int DEFAULT '0' COMMENT '虚拟销量',
|
||||||
|
`click_count` int DEFAULT '0' COMMENT '商品点击量',
|
||||||
|
`status` bit(1) DEFAULT NULL COMMENT '上下架状态: 0 上架(开启) 1 下架(禁用)-1 回收',
|
||||||
|
`sort` int NOT NULL DEFAULT '0' COMMENT '排序字段',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`creator` varchar DEFAULT NULL COMMENT '创建人',
|
||||||
|
`updater` varchar DEFAULT NULL COMMENT '更新人',
|
||||||
|
`deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) COMMENT '商品spu';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `product_category` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类编号',
|
||||||
|
`parent_id` bigint DEFAULT NULL COMMENT '父分类编号',
|
||||||
|
`name` varchar(128) NOT NULL COMMENT '分类名称',
|
||||||
|
`description` varchar(128) NOT NULL COMMENT '分类描述',
|
||||||
|
`pic_url` varchar DEFAULT NULL COMMENT '分类图片',
|
||||||
|
`sort` int NOT NULL DEFAULT '0' COMMENT '排序字段',
|
||||||
|
`status` bit(1) DEFAULT NULL COMMENT '状态',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`creator` varchar DEFAULT NULL COMMENT '创建人',
|
||||||
|
`updater` varchar DEFAULT NULL COMMENT '更新人',
|
||||||
|
`deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) COMMENT '商品分类';
|
@ -17,19 +17,6 @@ CREATE TABLE IF NOT EXISTS "member_user" (
|
|||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
) COMMENT '会员表';
|
) COMMENT '会员表';
|
||||||
|
|
||||||
-- inf 开头的 DB
|
|
||||||
CREATE TABLE IF NOT EXISTS "inf_file" (
|
|
||||||
"id" varchar(188) NOT NULL,
|
|
||||||
"type" varchar(63) DEFAULT NULL,
|
|
||||||
"content" blob NOT NULL,
|
|
||||||
"creator" varchar(64) DEFAULT '',
|
|
||||||
"create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
"updater" varchar(64) DEFAULT '',
|
|
||||||
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
|
||||||
PRIMARY KEY ("id")
|
|
||||||
) COMMENT '文件表';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS "member_address" (
|
CREATE TABLE IF NOT EXISTS "member_address" (
|
||||||
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"user_id" bigint(20) NOT NULL,
|
"user_id" bigint(20) NOT NULL,
|
||||||
|
@ -29,7 +29,7 @@ public interface DeptApi {
|
|||||||
* @param ids 部门编号数组
|
* @param ids 部门编号数组
|
||||||
* @return 部门信息数组
|
* @return 部门信息数组
|
||||||
*/
|
*/
|
||||||
List<DeptRespDTO> getDepts(Collection<Long> ids);
|
List<DeptRespDTO> getDeptList(Collection<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门们是否有效。如下情况,视为无效:
|
* 校验部门们是否有效。如下情况,视为无效:
|
||||||
@ -38,7 +38,7 @@ public interface DeptApi {
|
|||||||
*
|
*
|
||||||
* @param ids 角色编号数组
|
* @param ids 角色编号数组
|
||||||
*/
|
*/
|
||||||
void validDepts(Collection<Long> ids);
|
void validateDeptList(Collection<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定编号的部门 Map
|
* 获得指定编号的部门 Map
|
||||||
@ -47,7 +47,7 @@ public interface DeptApi {
|
|||||||
* @return 部门 Map
|
* @return 部门 Map
|
||||||
*/
|
*/
|
||||||
default Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
|
default Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
|
||||||
List<DeptRespDTO> list = getDepts(ids);
|
List<DeptRespDTO> list = getDeptList(ids);
|
||||||
return CollectionUtils.convertMap(list, DeptRespDTO::getId);
|
return CollectionUtils.convertMap(list, DeptRespDTO::getId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,6 @@ public interface PostApi {
|
|||||||
*
|
*
|
||||||
* @param ids 岗位编号数组
|
* @param ids 岗位编号数组
|
||||||
*/
|
*/
|
||||||
void validPosts(Collection<Long> ids);
|
void validPostList(Collection<Long> ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public interface DictDataApi {
|
|||||||
* @param dictType 字典类型
|
* @param dictType 字典类型
|
||||||
* @param values 字典数据值的数组
|
* @param values 字典数据值的数组
|
||||||
*/
|
*/
|
||||||
void validDictDatas(String dictType, Collection<String> values);
|
void validateDictDataList(String dictType, Collection<String> values);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定的字典数据,从缓存中
|
* 获得指定的字典数据,从缓存中
|
||||||
|
@ -19,7 +19,7 @@ public interface ErrorCodeApi {
|
|||||||
*
|
*
|
||||||
* @param autoGenerateDTOs 错误码信息
|
* @param autoGenerateDTOs 错误码信息
|
||||||
*/
|
*/
|
||||||
void autoGenerateErrorCodes(@Valid List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs);
|
void autoGenerateErrorCodeList(@Valid List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增量获得错误码数组
|
* 增量获得错误码数组
|
||||||
|
@ -16,6 +16,6 @@ public interface RoleApi {
|
|||||||
*
|
*
|
||||||
* @param ids 角色编号数组
|
* @param ids 角色编号数组
|
||||||
*/
|
*/
|
||||||
void validRoles(Collection<Long> ids);
|
void validRoleList(Collection<Long> ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.sms;
|
package cn.iocoder.yudao.module.system.api.sms;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeCheckReqDTO;
|
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||||
|
|
||||||
@ -35,6 +35,6 @@ public interface SmsCodeApi {
|
|||||||
*
|
*
|
||||||
* @param reqDTO 校验请求
|
* @param reqDTO 校验请求
|
||||||
*/
|
*/
|
||||||
void checkSmsCode(@Valid SmsCodeCheckReqDTO reqDTO);
|
void validateSmsCode(@Valid SmsCodeValidateReqDTO reqDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import javax.validation.constraints.NotNull;
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class SmsCodeCheckReqDTO {
|
public class SmsCodeValidateReqDTO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号
|
* 手机号
|
@ -14,13 +14,13 @@ public interface TenantApi {
|
|||||||
*
|
*
|
||||||
* @return 租户编号数组
|
* @return 租户编号数组
|
||||||
*/
|
*/
|
||||||
List<Long> getTenantIds();
|
List<Long> getTenantIdList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验租户是否合法
|
* 校验租户是否合法
|
||||||
*
|
*
|
||||||
* @param id 租户编号
|
* @param id 租户编号
|
||||||
*/
|
*/
|
||||||
void validTenant(Long id);
|
void validateTenant(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin 用户 API 接口
|
* Admin 用户 API 接口
|
||||||
@ -29,7 +28,7 @@ public interface AdminUserApi {
|
|||||||
* @param ids 用户 ID 们
|
* @param ids 用户 ID 们
|
||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
List<AdminUserRespDTO> getUsers(Collection<Long> ids);
|
List<AdminUserRespDTO> getUserList(Collection<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定部门的用户数组
|
* 获得指定部门的用户数组
|
||||||
@ -37,7 +36,7 @@ public interface AdminUserApi {
|
|||||||
* @param deptIds 部门数组
|
* @param deptIds 部门数组
|
||||||
* @return 用户数组
|
* @return 用户数组
|
||||||
*/
|
*/
|
||||||
List<AdminUserRespDTO> getUsersByDeptIds(Collection<Long> deptIds);
|
List<AdminUserRespDTO> getUserListByDeptIds(Collection<Long> deptIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定岗位的用户数组
|
* 获得指定岗位的用户数组
|
||||||
@ -54,7 +53,7 @@ public interface AdminUserApi {
|
|||||||
* @return 用户 Map
|
* @return 用户 Map
|
||||||
*/
|
*/
|
||||||
default Map<Long, AdminUserRespDTO> getUserMap(Collection<Long> ids) {
|
default Map<Long, AdminUserRespDTO> getUserMap(Collection<Long> ids) {
|
||||||
List<AdminUserRespDTO> users = getUsers(ids);
|
List<AdminUserRespDTO> users = getUserList(ids);
|
||||||
return CollectionUtils.convertMap(users, AdminUserRespDTO::getId);
|
return CollectionUtils.convertMap(users, AdminUserRespDTO::getId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +64,6 @@ public interface AdminUserApi {
|
|||||||
*
|
*
|
||||||
* @param ids 用户编号数组
|
* @param ids 用户编号数组
|
||||||
*/
|
*/
|
||||||
void validUsers(Set<Long> ids);
|
void validateUserList(Collection<Long> ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1002004003, "存在子部门,无法删除");
|
ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1002004003, "存在子部门,无法删除");
|
||||||
ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1002004004, "不能设置自己为父部门");
|
ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1002004004, "不能设置自己为父部门");
|
||||||
ErrorCode DEPT_EXISTS_USER = new ErrorCode(1002004005, "部门中存在员工,无法删除");
|
ErrorCode DEPT_EXISTS_USER = new ErrorCode(1002004005, "部门中存在员工,无法删除");
|
||||||
ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1002004006, "部门不处于开启状态,不允许选择");
|
ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1002004006, "部门({})不处于开启状态,不允许选择");
|
||||||
ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1002004007, "不能设置自己的子部门为父部门");
|
ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1002004007, "不能设置自己的子部门为父部门");
|
||||||
|
|
||||||
// ========== 岗位模块 1002005000 ==========
|
// ========== 岗位模块 1002005000 ==========
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.system.enums.permission;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Menu 编号枚举
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum MenuIdEnum {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根节点
|
|
||||||
*/
|
|
||||||
ROOT(0L);
|
|
||||||
|
|
||||||
private final Long id;
|
|
||||||
|
|
||||||
}
|
|
@ -28,14 +28,14 @@ public class DeptApiImpl implements DeptApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeptRespDTO> getDepts(Collection<Long> ids) {
|
public List<DeptRespDTO> getDeptList(Collection<Long> ids) {
|
||||||
List<DeptDO> depts = deptService.getDepts(ids);
|
List<DeptDO> depts = deptService.getDeptList(ids);
|
||||||
return DeptConvert.INSTANCE.convertList03(depts);
|
return DeptConvert.INSTANCE.convertList03(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validDepts(Collection<Long> ids) {
|
public void validateDeptList(Collection<Long> ids) {
|
||||||
deptService.validDepts(ids);
|
deptService.validateDeptList(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@ public class PostApiImpl implements PostApi {
|
|||||||
private PostService postService;
|
private PostService postService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validPosts(Collection<Long> ids) {
|
public void validPostList(Collection<Long> ids) {
|
||||||
postService.validPosts(ids);
|
postService.validatePostList(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ public class DictDataApiImpl implements DictDataApi {
|
|||||||
private DictDataService dictDataService;
|
private DictDataService dictDataService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validDictDatas(String dictType, Collection<String> values) {
|
public void validateDictDataList(String dictType, Collection<String> values) {
|
||||||
dictDataService.validDictDatas(dictType, values);
|
dictDataService.validateDictDataList(dictType, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,7 +21,7 @@ public class ErrorCodeApiImpl implements ErrorCodeApi {
|
|||||||
private ErrorCodeService errorCodeService;
|
private ErrorCodeService errorCodeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void autoGenerateErrorCodes(List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs) {
|
public void autoGenerateErrorCodeList(List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs) {
|
||||||
errorCodeService.autoGenerateErrorCodes(autoGenerateDTOs);
|
errorCodeService.autoGenerateErrorCodes(autoGenerateDTOs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class RoleApiImpl implements RoleApi {
|
|||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validRoles(Collection<Long> ids) {
|
public void validRoleList(Collection<Long> ids) {
|
||||||
roleService.validRoles(ids);
|
roleService.validateRoleList(ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.sms;
|
package cn.iocoder.yudao.module.system.api.sms;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeCheckReqDTO;
|
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.service.sms.SmsCodeService;
|
import cn.iocoder.yudao.module.system.service.sms.SmsCodeService;
|
||||||
@ -32,8 +32,8 @@ public class SmsCodeApiImpl implements SmsCodeApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkSmsCode(SmsCodeCheckReqDTO reqDTO) {
|
public void validateSmsCode(SmsCodeValidateReqDTO reqDTO) {
|
||||||
smsCodeService.checkSmsCode(reqDTO);
|
smsCodeService.validateSmsCode(reqDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,12 @@ public class TenantApiImpl implements TenantApi {
|
|||||||
private TenantService tenantService;
|
private TenantService tenantService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> getTenantIds() {
|
public List<Long> getTenantIdList() {
|
||||||
return tenantService.getTenantIds();
|
return tenantService.getTenantIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validTenant(Long id) {
|
public void validateTenant(Long id) {
|
||||||
tenantService.validTenant(id);
|
tenantService.validTenant(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin 用户 API 实现类
|
* Admin 用户 API 实现类
|
||||||
@ -29,26 +28,26 @@ public class AdminUserApiImpl implements AdminUserApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AdminUserRespDTO> getUsers(Collection<Long> ids) {
|
public List<AdminUserRespDTO> getUserList(Collection<Long> ids) {
|
||||||
List<AdminUserDO> users = userService.getUsers(ids);
|
List<AdminUserDO> users = userService.getUserList(ids);
|
||||||
return UserConvert.INSTANCE.convertList4(users);
|
return UserConvert.INSTANCE.convertList4(users);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AdminUserRespDTO> getUsersByDeptIds(Collection<Long> deptIds) {
|
public List<AdminUserRespDTO> getUserListByDeptIds(Collection<Long> deptIds) {
|
||||||
List<AdminUserDO> users = userService.getUsersByDeptIds(deptIds);
|
List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds);
|
||||||
return UserConvert.INSTANCE.convertList4(users);
|
return UserConvert.INSTANCE.convertList4(users);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AdminUserRespDTO> getUsersByPostIds(Collection<Long> postIds) {
|
public List<AdminUserRespDTO> getUsersByPostIds(Collection<Long> postIds) {
|
||||||
List<AdminUserDO> users = userService.getUsersByPostIds(postIds);
|
List<AdminUserDO> users = userService.getUserListByPostIds(postIds);
|
||||||
return UserConvert.INSTANCE.convertList4(users);
|
return UserConvert.INSTANCE.convertList4(users);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validUsers(Set<Long> ids) {
|
public void validateUserList(Collection<Long> ids) {
|
||||||
userService.validUsers(ids);
|
userService.validateUserList(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public class AuthController {
|
|||||||
}
|
}
|
||||||
// 获得角色列表
|
// 获得角色列表
|
||||||
Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus()));
|
Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||||
List<RoleDO> roleList = roleService.getRolesFromCache(roleIds);
|
List<RoleDO> roleList = roleService.getRoleListFromCache(roleIds);
|
||||||
// 获得菜单列表
|
// 获得菜单列表
|
||||||
List<MenuDO> menuList = permissionService.getRoleMenuListFromCache(roleIds,
|
List<MenuDO> menuList = permissionService.getRoleMenuListFromCache(roleIds,
|
||||||
SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType(), MenuTypeEnum.BUTTON.getType()),
|
SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType(), MenuTypeEnum.BUTTON.getType()),
|
||||||
@ -108,7 +108,7 @@ public class AuthController {
|
|||||||
|
|
||||||
@GetMapping("/list-menus")
|
@GetMapping("/list-menus")
|
||||||
@Operation(summary = "获得登录用户的菜单列表")
|
@Operation(summary = "获得登录用户的菜单列表")
|
||||||
public CommonResult<List<AuthMenuRespVO>> getMenus() {
|
public CommonResult<List<AuthMenuRespVO>> getMenuList() {
|
||||||
// 获得角色列表
|
// 获得角色列表
|
||||||
Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus()));
|
Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||||
// 获得用户拥有的菜单列表
|
// 获得用户拥有的菜单列表
|
||||||
|
@ -57,19 +57,19 @@ public class DeptController {
|
|||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获取部门列表")
|
@Operation(summary = "获取部门列表")
|
||||||
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
||||||
public CommonResult<List<DeptRespVO>> listDepts(DeptListReqVO reqVO) {
|
public CommonResult<List<DeptRespVO>> getDeptList(DeptListReqVO reqVO) {
|
||||||
List<DeptDO> list = deptService.getSimpleDepts(reqVO);
|
List<DeptDO> list = deptService.getDeptList(reqVO);
|
||||||
list.sort(Comparator.comparing(DeptDO::getSort));
|
list.sort(Comparator.comparing(DeptDO::getSort));
|
||||||
return success(DeptConvert.INSTANCE.convertList(list));
|
return success(DeptConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list-all-simple")
|
@GetMapping("/list-all-simple")
|
||||||
@Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
|
@Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
|
||||||
public CommonResult<List<DeptSimpleRespVO>> getSimpleDepts() {
|
public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList() {
|
||||||
// 获得部门列表,只要开启状态的
|
// 获得部门列表,只要开启状态的
|
||||||
DeptListReqVO reqVO = new DeptListReqVO();
|
DeptListReqVO reqVO = new DeptListReqVO();
|
||||||
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
List<DeptDO> list = deptService.getSimpleDepts(reqVO);
|
List<DeptDO> list = deptService.getDeptList(reqVO);
|
||||||
// 排序后,返回给前端
|
// 排序后,返回给前端
|
||||||
list.sort(Comparator.comparing(DeptDO::getSort));
|
list.sort(Comparator.comparing(DeptDO::getSort));
|
||||||
return success(DeptConvert.INSTANCE.convertList02(list));
|
return success(DeptConvert.INSTANCE.convertList02(list));
|
||||||
|
@ -70,9 +70,9 @@ public class PostController {
|
|||||||
|
|
||||||
@GetMapping("/list-all-simple")
|
@GetMapping("/list-all-simple")
|
||||||
@Operation(summary = "获取岗位精简信息列表", description = "只包含被开启的岗位,主要用于前端的下拉选项")
|
@Operation(summary = "获取岗位精简信息列表", description = "只包含被开启的岗位,主要用于前端的下拉选项")
|
||||||
public CommonResult<List<PostSimpleRespVO>> getSimplePosts() {
|
public CommonResult<List<PostSimpleRespVO>> getSimplePostList() {
|
||||||
// 获得岗位列表,只要开启状态的
|
// 获得岗位列表,只要开启状态的
|
||||||
List<PostDO> list = postService.getPosts(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
List<PostDO> list = postService.getPostList(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||||
// 排序后,返回给前端
|
// 排序后,返回给前端
|
||||||
list.sort(Comparator.comparing(PostDO::getSort));
|
list.sort(Comparator.comparing(PostDO::getSort));
|
||||||
return success(PostConvert.INSTANCE.convertList02(list));
|
return success(PostConvert.INSTANCE.convertList02(list));
|
||||||
@ -90,7 +90,7 @@ public class PostController {
|
|||||||
@PreAuthorize("@ss.hasPermission('system:post:export')")
|
@PreAuthorize("@ss.hasPermission('system:post:export')")
|
||||||
@OperateLog(type = EXPORT)
|
@OperateLog(type = EXPORT)
|
||||||
public void export(HttpServletResponse response, @Validated PostExportReqVO reqVO) throws IOException {
|
public void export(HttpServletResponse response, @Validated PostExportReqVO reqVO) throws IOException {
|
||||||
List<PostDO> posts = postService.getPosts(reqVO);
|
List<PostDO> posts = postService.getPostList(reqVO);
|
||||||
List<PostExcelVO> data = PostConvert.INSTANCE.convertList03(posts);
|
List<PostExcelVO> data = PostConvert.INSTANCE.convertList03(posts);
|
||||||
// 输出
|
// 输出
|
||||||
ExcelUtils.write(response, "岗位数据.xls", "岗位列表", PostExcelVO.class, data);
|
ExcelUtils.write(response, "岗位数据.xls", "岗位列表", PostExcelVO.class, data);
|
||||||
|
@ -61,8 +61,8 @@ public class DictDataController {
|
|||||||
@GetMapping("/list-all-simple")
|
@GetMapping("/list-all-simple")
|
||||||
@Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地")
|
@Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地")
|
||||||
// 无需添加权限认证,因为前端全局都需要
|
// 无需添加权限认证,因为前端全局都需要
|
||||||
public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDatas() {
|
public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDataList() {
|
||||||
List<DictDataDO> list = dictDataService.getDictDatas();
|
List<DictDataDO> list = dictDataService.getDictDataList();
|
||||||
return success(DictDataConvert.INSTANCE.convertList(list));
|
return success(DictDataConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public class DictDataController {
|
|||||||
@PreAuthorize("@ss.hasPermission('system:dict:export')")
|
@PreAuthorize("@ss.hasPermission('system:dict:export')")
|
||||||
@OperateLog(type = EXPORT)
|
@OperateLog(type = EXPORT)
|
||||||
public void export(HttpServletResponse response, @Valid DictDataExportReqVO reqVO) throws IOException {
|
public void export(HttpServletResponse response, @Valid DictDataExportReqVO reqVO) throws IOException {
|
||||||
List<DictDataDO> list = dictDataService.getDictDatas(reqVO);
|
List<DictDataDO> list = dictDataService.getDictDataList(reqVO);
|
||||||
List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list);
|
List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list);
|
||||||
// 输出
|
// 输出
|
||||||
ExcelUtils.write(response, "字典数据.xls", "数据列表", DictDataExcelVO.class, data);
|
ExcelUtils.write(response, "字典数据.xls", "数据列表", DictDataExcelVO.class, data);
|
||||||
|
@ -76,7 +76,7 @@ public class DictTypeController {
|
|||||||
@GetMapping("/list-all-simple")
|
@GetMapping("/list-all-simple")
|
||||||
@Operation(summary = "获得全部字典类型列表", description = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
|
@Operation(summary = "获得全部字典类型列表", description = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
|
||||||
// 无需添加权限认证,因为前端全局都需要
|
// 无需添加权限认证,因为前端全局都需要
|
||||||
public CommonResult<List<DictTypeSimpleRespVO>> listSimpleDictTypes() {
|
public CommonResult<List<DictTypeSimpleRespVO>> getSimpleDictTypeList() {
|
||||||
List<DictTypeDO> list = dictTypeService.getDictTypeList();
|
List<DictTypeDO> list = dictTypeService.getDictTypeList();
|
||||||
return success(DictTypeConvert.INSTANCE.convertList(list));
|
return success(DictTypeConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class OperateLogController {
|
|||||||
@PreAuthorize("@ss.hasPermission('system:operate-log:export')")
|
@PreAuthorize("@ss.hasPermission('system:operate-log:export')")
|
||||||
@OperateLog(type = EXPORT)
|
@OperateLog(type = EXPORT)
|
||||||
public void exportOperateLog(HttpServletResponse response, @Valid OperateLogExportReqVO reqVO) throws IOException {
|
public void exportOperateLog(HttpServletResponse response, @Valid OperateLogExportReqVO reqVO) throws IOException {
|
||||||
List<OperateLogDO> list = operateLogService.getOperateLogs(reqVO);
|
List<OperateLogDO> list = operateLogService.getOperateLogList(reqVO);
|
||||||
|
|
||||||
// 获得拼接需要的数据
|
// 获得拼接需要的数据
|
||||||
Collection<Long> userIds = CollectionUtils.convertList(list, OperateLogDO::getUserId);
|
Collection<Long> userIds = CollectionUtils.convertList(list, OperateLogDO::getUserId);
|
||||||
|
@ -57,8 +57,8 @@ public class NoticeController {
|
|||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获取通知公告列表")
|
@Operation(summary = "获取通知公告列表")
|
||||||
@PreAuthorize("@ss.hasPermission('system:notice:query')")
|
@PreAuthorize("@ss.hasPermission('system:notice:query')")
|
||||||
public CommonResult<PageResult<NoticeRespVO>> pageNotices(@Validated NoticePageReqVO reqVO) {
|
public CommonResult<PageResult<NoticeRespVO>> getNoticePage(@Validated NoticePageReqVO reqVO) {
|
||||||
return success(NoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO)));
|
return success(NoticeConvert.INSTANCE.convertPage(noticeService.getNoticePage(reqVO)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
|
@ -61,7 +61,7 @@ public class OAuth2UserController {
|
|||||||
}
|
}
|
||||||
// 获得岗位信息
|
// 获得岗位信息
|
||||||
if (CollUtil.isNotEmpty(user.getPostIds())) {
|
if (CollUtil.isNotEmpty(user.getPostIds())) {
|
||||||
List<PostDO> posts = postService.getPosts(user.getPostIds());
|
List<PostDO> posts = postService.getPostList(user.getPostIds());
|
||||||
resp.setPosts(OAuth2UserConvert.INSTANCE.convertList(posts));
|
resp.setPosts(OAuth2UserConvert.INSTANCE.convertList(posts));
|
||||||
}
|
}
|
||||||
return success(resp);
|
return success(resp);
|
||||||
|
@ -57,8 +57,8 @@ public class MenuController {
|
|||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获取菜单列表", description = "用于【菜单管理】界面")
|
@Operation(summary = "获取菜单列表", description = "用于【菜单管理】界面")
|
||||||
@PreAuthorize("@ss.hasPermission('system:menu:query')")
|
@PreAuthorize("@ss.hasPermission('system:menu:query')")
|
||||||
public CommonResult<List<MenuRespVO>> getMenus(MenuListReqVO reqVO) {
|
public CommonResult<List<MenuRespVO>> getMenuList(MenuListReqVO reqVO) {
|
||||||
List<MenuDO> list = menuService.getMenus(reqVO);
|
List<MenuDO> list = menuService.getMenuList(reqVO);
|
||||||
list.sort(Comparator.comparing(MenuDO::getSort));
|
list.sort(Comparator.comparing(MenuDO::getSort));
|
||||||
return success(MenuConvert.INSTANCE.convertList(list));
|
return success(MenuConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
@ -66,11 +66,11 @@ public class MenuController {
|
|||||||
@GetMapping("/list-all-simple")
|
@GetMapping("/list-all-simple")
|
||||||
@Operation(summary = "获取菜单精简信息列表", description = "只包含被开启的菜单,用于【角色分配菜单】功能的选项。" +
|
@Operation(summary = "获取菜单精简信息列表", description = "只包含被开启的菜单,用于【角色分配菜单】功能的选项。" +
|
||||||
"在多租户的场景下,会只返回租户所在套餐有的菜单")
|
"在多租户的场景下,会只返回租户所在套餐有的菜单")
|
||||||
public CommonResult<List<MenuSimpleRespVO>> getSimpleMenus() {
|
public CommonResult<List<MenuSimpleRespVO>> getSimpleMenuList() {
|
||||||
// 获得菜单列表,只要开启状态的
|
// 获得菜单列表,只要开启状态的
|
||||||
MenuListReqVO reqVO = new MenuListReqVO();
|
MenuListReqVO reqVO = new MenuListReqVO();
|
||||||
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
List<MenuDO> list = menuService.getTenantMenus(reqVO);
|
List<MenuDO> list = menuService.getMenuListByTenant(reqVO);
|
||||||
// 排序后,返回给前端
|
// 排序后,返回给前端
|
||||||
list.sort(Comparator.comparing(MenuDO::getSort));
|
list.sort(Comparator.comparing(MenuDO::getSort));
|
||||||
return success(MenuConvert.INSTANCE.convertList02(list));
|
return success(MenuConvert.INSTANCE.convertList02(list));
|
||||||
|
@ -20,12 +20,12 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static java.util.Collections.singleton;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 角色")
|
@Tag(name = "管理后台 - 角色")
|
||||||
@RestController
|
@RestController
|
||||||
@ -85,9 +85,9 @@ public class RoleController {
|
|||||||
|
|
||||||
@GetMapping("/list-all-simple")
|
@GetMapping("/list-all-simple")
|
||||||
@Operation(summary = "获取角色精简信息列表", description = "只包含被开启的角色,主要用于前端的下拉选项")
|
@Operation(summary = "获取角色精简信息列表", description = "只包含被开启的角色,主要用于前端的下拉选项")
|
||||||
public CommonResult<List<RoleSimpleRespVO>> getSimpleRoles() {
|
public CommonResult<List<RoleSimpleRespVO>> getSimpleRoleList() {
|
||||||
// 获得角色列表,只要开启状态的
|
// 获得角色列表,只要开启状态的
|
||||||
List<RoleDO> list = roleService.getRoles(Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
List<RoleDO> list = roleService.getRoleListByStatus(singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||||
// 排序后,返回给前端
|
// 排序后,返回给前端
|
||||||
list.sort(Comparator.comparing(RoleDO::getSort));
|
list.sort(Comparator.comparing(RoleDO::getSort));
|
||||||
return success(RoleConvert.INSTANCE.convertList02(list));
|
return success(RoleConvert.INSTANCE.convertList02(list));
|
||||||
|
@ -90,8 +90,8 @@ public class SensitiveWordController {
|
|||||||
@GetMapping("/get-tags")
|
@GetMapping("/get-tags")
|
||||||
@Operation(summary = "获取所有敏感词的标签数组")
|
@Operation(summary = "获取所有敏感词的标签数组")
|
||||||
@PreAuthorize("@ss.hasPermission('system:sensitive-word:query')")
|
@PreAuthorize("@ss.hasPermission('system:sensitive-word:query')")
|
||||||
public CommonResult<Set<String>> getSensitiveWordTags() throws IOException {
|
public CommonResult<Set<String>> getSensitiveWordTagSet() {
|
||||||
return success(sensitiveWordService.getSensitiveWordTags());
|
return success(sensitiveWordService.getSensitiveWordTagSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/validate-text")
|
@GetMapping("/validate-text")
|
||||||
|
@ -70,7 +70,7 @@ public class SmsChannelController {
|
|||||||
|
|
||||||
@GetMapping("/list-all-simple")
|
@GetMapping("/list-all-simple")
|
||||||
@Operation(summary = "获得短信渠道精简列表", description = "包含被禁用的短信渠道")
|
@Operation(summary = "获得短信渠道精简列表", description = "包含被禁用的短信渠道")
|
||||||
public CommonResult<List<SmsChannelSimpleRespVO>> getSimpleSmsChannels() {
|
public CommonResult<List<SmsChannelSimpleRespVO>> getSimpleSmsChannelList() {
|
||||||
List<SmsChannelDO> list = smsChannelService.getSmsChannelList();
|
List<SmsChannelDO> list = smsChannelService.getSmsChannelList();
|
||||||
// 排序后,返回给前端
|
// 排序后,返回给前端
|
||||||
list.sort(Comparator.comparing(SmsChannelDO::getId));
|
list.sort(Comparator.comparing(SmsChannelDO::getId));
|
||||||
|
@ -111,9 +111,9 @@ public class UserController {
|
|||||||
|
|
||||||
@GetMapping("/list-all-simple")
|
@GetMapping("/list-all-simple")
|
||||||
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
|
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
|
||||||
public CommonResult<List<UserSimpleRespVO>> getSimpleUsers() {
|
public CommonResult<List<UserSimpleRespVO>> getSimpleUserList() {
|
||||||
// 获用户列表,只要开启状态的
|
// 获用户列表,只要开启状态的
|
||||||
List<AdminUserDO> list = userService.getUsersByStatus(CommonStatusEnum.ENABLE.getStatus());
|
List<AdminUserDO> list = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
// 排序后,返回给前端
|
// 排序后,返回给前端
|
||||||
return success(UserConvert.INSTANCE.convertList04(list));
|
return success(UserConvert.INSTANCE.convertList04(list));
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ public class UserController {
|
|||||||
@Operation(summary = "获得用户详情")
|
@Operation(summary = "获得用户详情")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
||||||
public CommonResult<UserRespVO> getInfo(@RequestParam("id") Long id) {
|
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
|
||||||
return success(UserConvert.INSTANCE.convert(userService.getUser(id)));
|
return success(UserConvert.INSTANCE.convert(userService.getUser(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,10 +130,10 @@ public class UserController {
|
|||||||
@Operation(summary = "导出用户")
|
@Operation(summary = "导出用户")
|
||||||
@PreAuthorize("@ss.hasPermission('system:user:export')")
|
@PreAuthorize("@ss.hasPermission('system:user:export')")
|
||||||
@OperateLog(type = EXPORT)
|
@OperateLog(type = EXPORT)
|
||||||
public void exportUsers(@Validated UserExportReqVO reqVO,
|
public void exportUserList(@Validated UserExportReqVO reqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
// 获得用户列表
|
// 获得用户列表
|
||||||
List<AdminUserDO> users = userService.getUsers(reqVO);
|
List<AdminUserDO> users = userService.getUserList(reqVO);
|
||||||
|
|
||||||
// 获得拼接需要的数据
|
// 获得拼接需要的数据
|
||||||
Collection<Long> deptIds = convertList(users, AdminUserDO::getDeptId);
|
Collection<Long> deptIds = convertList(users, AdminUserDO::getDeptId);
|
||||||
@ -183,7 +183,7 @@ public class UserController {
|
|||||||
public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
|
public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
|
||||||
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
||||||
List<UserImportExcelVO> list = ExcelUtils.read(file, UserImportExcelVO.class);
|
List<UserImportExcelVO> list = ExcelUtils.read(file, UserImportExcelVO.class);
|
||||||
return success(userService.importUsers(list, updateSupport));
|
return success(userService.importUserList(list, updateSupport));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.system.controller.admin.user;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
|
||||||
@ -31,6 +30,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
|
||||||
@ -63,7 +63,7 @@ public class UserProfileController {
|
|||||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||||
UserProfileRespVO resp = UserConvert.INSTANCE.convert03(user);
|
UserProfileRespVO resp = UserConvert.INSTANCE.convert03(user);
|
||||||
// 获得用户角色
|
// 获得用户角色
|
||||||
List<RoleDO> userRoles = roleService.getRolesFromCache(permissionService.getUserRoleIdListByUserId(user.getId()));
|
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(user.getId()));
|
||||||
resp.setRoles(UserConvert.INSTANCE.convertList(userRoles));
|
resp.setRoles(UserConvert.INSTANCE.convertList(userRoles));
|
||||||
// 获得部门信息
|
// 获得部门信息
|
||||||
if (user.getDeptId() != null) {
|
if (user.getDeptId() != null) {
|
||||||
@ -72,7 +72,7 @@ public class UserProfileController {
|
|||||||
}
|
}
|
||||||
// 获得岗位信息
|
// 获得岗位信息
|
||||||
if (CollUtil.isNotEmpty(user.getPostIds())) {
|
if (CollUtil.isNotEmpty(user.getPostIds())) {
|
||||||
List<PostDO> posts = postService.getPosts(user.getPostIds());
|
List<PostDO> posts = postService.getPostList(user.getPostIds());
|
||||||
resp.setPosts(UserConvert.INSTANCE.convertList02(posts));
|
resp.setPosts(UserConvert.INSTANCE.convertList02(posts));
|
||||||
}
|
}
|
||||||
// 获得社交用户信息
|
// 获得社交用户信息
|
||||||
@ -99,7 +99,7 @@ public class UserProfileController {
|
|||||||
@Operation(summary = "上传用户个人头像")
|
@Operation(summary = "上传用户个人头像")
|
||||||
public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception {
|
public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception {
|
||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
throw ServiceExceptionUtil.exception(FILE_IS_EMPTY);
|
throw exception(FILE_IS_EMPTY);
|
||||||
}
|
}
|
||||||
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
||||||
return success(avatar);
|
return success(avatar);
|
||||||
|
@ -9,13 +9,15 @@ import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
import cn.iocoder.yudao.module.system.enums.permission.MenuIdEnum;
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList;
|
||||||
|
import static cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO.ID_ROOT;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface AuthConvert {
|
public interface AuthConvert {
|
||||||
|
|
||||||
@ -47,7 +49,7 @@ public interface AuthConvert {
|
|||||||
Map<Long, AuthMenuRespVO> treeNodeMap = new LinkedHashMap<>();
|
Map<Long, AuthMenuRespVO> treeNodeMap = new LinkedHashMap<>();
|
||||||
menuList.forEach(menu -> treeNodeMap.put(menu.getId(), AuthConvert.INSTANCE.convertTreeNode(menu)));
|
menuList.forEach(menu -> treeNodeMap.put(menu.getId(), AuthConvert.INSTANCE.convertTreeNode(menu)));
|
||||||
// 处理父子关系
|
// 处理父子关系
|
||||||
treeNodeMap.values().stream().filter(node -> !node.getParentId().equals(MenuIdEnum.ROOT.getId())).forEach(childNode -> {
|
treeNodeMap.values().stream().filter(node -> !node.getParentId().equals(ID_ROOT)).forEach(childNode -> {
|
||||||
// 获得父节点
|
// 获得父节点
|
||||||
AuthMenuRespVO parentNode = treeNodeMap.get(childNode.getParentId());
|
AuthMenuRespVO parentNode = treeNodeMap.get(childNode.getParentId());
|
||||||
if (parentNode == null) {
|
if (parentNode == null) {
|
||||||
@ -62,7 +64,7 @@ public interface AuthConvert {
|
|||||||
parentNode.getChildren().add(childNode);
|
parentNode.getChildren().add(childNode);
|
||||||
});
|
});
|
||||||
// 获得到所有的根节点
|
// 获得到所有的根节点
|
||||||
return CollectionUtils.filterList(treeNodeMap.values(), node -> MenuIdEnum.ROOT.getId().equals(node.getParentId()));
|
return filterList(treeNodeMap.values(), node -> ID_ROOT.equals(node.getParentId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
SocialUserBindReqDTO convert(Long userId, Integer userType, AuthSocialLoginReqVO reqVO);
|
SocialUserBindReqDTO convert(Long userId, Integer userType, AuthSocialLoginReqVO reqVO);
|
||||||
|
@ -21,7 +21,12 @@ import lombok.EqualsAndHashCode;
|
|||||||
public class MenuDO extends BaseDO {
|
public class MenuDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单ID
|
* 菜单编号 - 根节点
|
||||||
|
*/
|
||||||
|
public static final Long ID_ROOT = 0L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单编号
|
||||||
*/
|
*/
|
||||||
@TableId
|
@TableId
|
||||||
private Long id;
|
private Long id;
|
||||||
|
@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -19,9 +18,7 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default DeptDO selectByParentIdAndName(Long parentId, String name) {
|
default DeptDO selectByParentIdAndName(Long parentId, String name) {
|
||||||
return selectOne(new LambdaQueryWrapper<DeptDO>()
|
return selectOne(DeptDO::getParentId, parentId, DeptDO::getName, name);
|
||||||
.eq(DeptDO::getParentId, parentId)
|
|
||||||
.eq(DeptDO::getName, name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default Long selectCountByParentId(Long parentId) {
|
default Long selectCountByParentId(Long parentId) {
|
||||||
|
@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.system.dal.mysql.dept;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -16,31 +15,32 @@ import java.util.List;
|
|||||||
public interface PostMapper extends BaseMapperX<PostDO> {
|
public interface PostMapper extends BaseMapperX<PostDO> {
|
||||||
|
|
||||||
default List<PostDO> selectList(Collection<Long> ids, Collection<Integer> statuses) {
|
default List<PostDO> selectList(Collection<Long> ids, Collection<Integer> statuses) {
|
||||||
return selectList(new QueryWrapperX<PostDO>().inIfPresent("id", ids)
|
return selectList(new LambdaQueryWrapperX<PostDO>()
|
||||||
.inIfPresent("status", statuses));
|
.inIfPresent(PostDO::getId, ids)
|
||||||
|
.inIfPresent(PostDO::getStatus, statuses));
|
||||||
}
|
}
|
||||||
|
|
||||||
default PageResult<PostDO> selectPage(PostPageReqVO reqVO) {
|
default PageResult<PostDO> selectPage(PostPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new QueryWrapperX<PostDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<PostDO>()
|
||||||
.likeIfPresent("code", reqVO.getCode())
|
.likeIfPresent(PostDO::getCode, reqVO.getCode())
|
||||||
.likeIfPresent("name", reqVO.getName())
|
.likeIfPresent(PostDO::getName, reqVO.getName())
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
.eqIfPresent(PostDO::getStatus, reqVO.getStatus())
|
||||||
.orderByDesc("id"));
|
.orderByDesc(PostDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<PostDO> selectList(PostExportReqVO reqVO) {
|
default List<PostDO> selectList(PostExportReqVO reqVO) {
|
||||||
return selectList(new QueryWrapperX<PostDO>()
|
return selectList(new LambdaQueryWrapperX<PostDO>()
|
||||||
.likeIfPresent("code", reqVO.getCode())
|
.likeIfPresent(PostDO::getCode, reqVO.getCode())
|
||||||
.likeIfPresent("name", reqVO.getName())
|
.likeIfPresent(PostDO::getName, reqVO.getName())
|
||||||
.eqIfPresent("status", reqVO.getStatus()));
|
.eqIfPresent(PostDO::getStatus, reqVO.getStatus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
default PostDO selectByName(String name) {
|
default PostDO selectByName(String name) {
|
||||||
return selectOne(new QueryWrapper<PostDO>().eq("name", name));
|
return selectOne(PostDO::getName, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
default PostDO selectByCode(String code) {
|
default PostDO selectByCode(String code) {
|
||||||
return selectOne(new QueryWrapper<PostDO>().eq("code", code));
|
return selectOne(PostDO::getCode, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,7 @@ import java.util.List;
|
|||||||
public interface UserPostMapper extends BaseMapperX<UserPostDO> {
|
public interface UserPostMapper extends BaseMapperX<UserPostDO> {
|
||||||
|
|
||||||
default List<UserPostDO> selectListByUserId(Long userId) {
|
default List<UserPostDO> selectListByUserId(Long userId) {
|
||||||
return selectList(new LambdaQueryWrapperX<UserPostDO>()
|
return selectList(UserPostDO::getUserId, userId);
|
||||||
.eq(UserPostDO::getUserId, userId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default void deleteByUserIdAndPostId(Long userId, Collection<Long> postIds) {
|
default void deleteByUserIdAndPostId(Long userId, Collection<Long> postIds) {
|
||||||
@ -24,11 +23,10 @@ public interface UserPostMapper extends BaseMapperX<UserPostDO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default List<UserPostDO> selectListByPostIds(Collection<Long> postIds) {
|
default List<UserPostDO> selectListByPostIds(Collection<Long> postIds) {
|
||||||
return selectList(new LambdaQueryWrapperX<UserPostDO>()
|
return selectList(UserPostDO::getPostId, postIds);
|
||||||
.in(UserPostDO::getPostId, postIds));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default void deleteByUserId(Long userId){
|
default void deleteByUserId(Long userId) {
|
||||||
delete(Wrappers.lambdaUpdate(UserPostDO.class).eq(UserPostDO::getUserId, userId));
|
delete(Wrappers.lambdaUpdate(UserPostDO.class).eq(UserPostDO::getUserId, userId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,11 @@ import java.util.List;
|
|||||||
public interface DictDataMapper extends BaseMapperX<DictDataDO> {
|
public interface DictDataMapper extends BaseMapperX<DictDataDO> {
|
||||||
|
|
||||||
default DictDataDO selectByDictTypeAndValue(String dictType, String value) {
|
default DictDataDO selectByDictTypeAndValue(String dictType, String value) {
|
||||||
return selectOne(new LambdaQueryWrapper<DictDataDO>().eq(DictDataDO::getDictType, dictType)
|
return selectOne(DictDataDO::getDictType, dictType, DictDataDO::getValue, value);
|
||||||
.eq(DictDataDO::getValue, value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default DictDataDO selectByDictTypeAndLabel(String dictType, String label) {
|
default DictDataDO selectByDictTypeAndLabel(String dictType, String label) {
|
||||||
return selectOne(new LambdaQueryWrapper<DictDataDO>().eq(DictDataDO::getDictType, dictType)
|
return selectOne(DictDataDO::getDictType, dictType, DictDataDO::getLabel, label);
|
||||||
.eq(DictDataDO::getLabel, label));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<DictDataDO> selectByDictTypeAndValues(String dictType, Collection<String> values) {
|
default List<DictDataDO> selectByDictTypeAndValues(String dictType, Collection<String> values) {
|
||||||
|
@ -36,11 +36,11 @@ public interface ErrorCodeMapper extends BaseMapperX<ErrorCodeDO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default List<ErrorCodeDO> selectListByCodes(Collection<Integer> codes) {
|
default List<ErrorCodeDO> selectListByCodes(Collection<Integer> codes) {
|
||||||
return selectList(new LambdaQueryWrapperX<ErrorCodeDO>().in(ErrorCodeDO::getCode, codes));
|
return selectList(ErrorCodeDO::getCode, codes);
|
||||||
}
|
}
|
||||||
|
|
||||||
default ErrorCodeDO selectByCode(Integer code) {
|
default ErrorCodeDO selectByCode(Integer code) {
|
||||||
return selectOne(new LambdaQueryWrapperX<ErrorCodeDO>().eq(ErrorCodeDO::getCode, code));
|
return selectOne(ErrorCodeDO::getCode, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<ErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, LocalDateTime minUpdateTime) {
|
default List<ErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, LocalDateTime minUpdateTime) {
|
||||||
|
@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuListReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuListReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -13,8 +12,7 @@ import java.util.List;
|
|||||||
public interface MenuMapper extends BaseMapperX<MenuDO> {
|
public interface MenuMapper extends BaseMapperX<MenuDO> {
|
||||||
|
|
||||||
default MenuDO selectByParentIdAndName(Long parentId, String name) {
|
default MenuDO selectByParentIdAndName(Long parentId, String name) {
|
||||||
return selectOne(new LambdaQueryWrapper<MenuDO>().eq(MenuDO::getParentId, parentId)
|
return selectOne(MenuDO::getParentId, parentId, MenuDO::getName, name);
|
||||||
.eq(MenuDO::getName, name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default Long selectCountByParentId(Long parentId) {
|
default Long selectCountByParentId(Long parentId) {
|
||||||
@ -22,7 +20,8 @@ public interface MenuMapper extends BaseMapperX<MenuDO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default List<MenuDO> selectList(MenuListReqVO reqVO) {
|
default List<MenuDO> selectList(MenuListReqVO reqVO) {
|
||||||
return selectList(new LambdaQueryWrapperX<MenuDO>().likeIfPresent(MenuDO::getName, reqVO.getName())
|
return selectList(new LambdaQueryWrapperX<MenuDO>()
|
||||||
|
.likeIfPresent(MenuDO::getName, reqVO.getName())
|
||||||
.eqIfPresent(MenuDO::getStatus, reqVO.getStatus()));
|
.eqIfPresent(MenuDO::getStatus, reqVO.getStatus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,8 @@ public interface SocialUserBindMapper extends BaseMapperX<SocialUserBindDO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default SocialUserBindDO selectByUserTypeAndSocialUserId(Integer userType, Long socialUserId) {
|
default SocialUserBindDO selectByUserTypeAndSocialUserId(Integer userType, Long socialUserId) {
|
||||||
return selectOne(new LambdaQueryWrapperX<SocialUserBindDO>()
|
return selectOne(SocialUserBindDO::getUserType, userType,
|
||||||
.eq(SocialUserBindDO::getUserType, userType)
|
SocialUserBindDO::getSocialUserId, socialUserId);
|
||||||
.eq(SocialUserBindDO::getSocialUserId, socialUserId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<SocialUserBindDO> selectListByUserIdAndUserType(Long userId, Integer userType) {
|
default List<SocialUserBindDO> selectListByUserIdAndUserType(Long userId, Integer userType) {
|
||||||
|
@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -16,15 +15,15 @@ import java.util.List;
|
|||||||
public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||||
|
|
||||||
default AdminUserDO selectByUsername(String username) {
|
default AdminUserDO selectByUsername(String username) {
|
||||||
return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getUsername, username));
|
return selectOne(AdminUserDO::getUsername, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
default AdminUserDO selectByEmail(String email) {
|
default AdminUserDO selectByEmail(String email) {
|
||||||
return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getEmail, email));
|
return selectOne(AdminUserDO::getEmail, email);
|
||||||
}
|
}
|
||||||
|
|
||||||
default AdminUserDO selectByMobile(String mobile) {
|
default AdminUserDO selectByMobile(String mobile) {
|
||||||
return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getMobile, mobile));
|
return selectOne(AdminUserDO::getMobile, mobile);
|
||||||
}
|
}
|
||||||
|
|
||||||
default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
|
default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
|
||||||
@ -50,10 +49,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
|||||||
return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname));
|
return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname));
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<AdminUserDO> selectListByUsername(String username) {
|
|
||||||
return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getUsername, username));
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<AdminUserDO> selectListByStatus(Integer status) {
|
default List<AdminUserDO> selectListByStatus(Integer status) {
|
||||||
return selectList(AdminUserDO::getStatus, status);
|
return selectList(AdminUserDO::getStatus, status);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
@Override
|
@Override
|
||||||
public AuthLoginRespVO login(AuthLoginReqVO reqVO) {
|
public AuthLoginRespVO login(AuthLoginReqVO reqVO) {
|
||||||
// 校验验证码
|
// 校验验证码
|
||||||
verifyCaptcha(reqVO);
|
validateCaptcha(reqVO);
|
||||||
|
|
||||||
// 使用账号密码,进行登录
|
// 使用账号密码,进行登录
|
||||||
AdminUserDO user = authenticate(reqVO.getUsername(), reqVO.getPassword());
|
AdminUserDO user = authenticate(reqVO.getUsername(), reqVO.getPassword());
|
||||||
@ -171,14 +171,8 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
|
return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AuthLoginRespVO refreshToken(String refreshToken) {
|
|
||||||
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, OAuth2ClientConstants.CLIENT_ID_DEFAULT);
|
|
||||||
return AuthConvert.INSTANCE.convert(accessTokenDO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void verifyCaptcha(AuthLoginReqVO reqVO) {
|
void validateCaptcha(AuthLoginReqVO reqVO) {
|
||||||
// 如果验证码关闭,则不进行校验
|
// 如果验证码关闭,则不进行校验
|
||||||
if (!captchaEnable) {
|
if (!captchaEnable) {
|
||||||
return;
|
return;
|
||||||
@ -206,6 +200,12 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
return AuthConvert.INSTANCE.convert(accessTokenDO);
|
return AuthConvert.INSTANCE.convert(accessTokenDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AuthLoginRespVO refreshToken(String refreshToken) {
|
||||||
|
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, OAuth2ClientConstants.CLIENT_ID_DEFAULT);
|
||||||
|
return AuthConvert.INSTANCE.convert(accessTokenDO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void logout(String token, Integer logType) {
|
public void logout(String token, Integer logType) {
|
||||||
// 删除访问令牌
|
// 删除访问令牌
|
||||||
|
@ -52,7 +52,7 @@ public interface DeptService {
|
|||||||
* @param reqVO 筛选条件请求 VO
|
* @param reqVO 筛选条件请求 VO
|
||||||
* @return 部门列表
|
* @return 部门列表
|
||||||
*/
|
*/
|
||||||
List<DeptDO> getSimpleDepts(DeptListReqVO reqVO);
|
List<DeptDO> getDeptList(DeptListReqVO reqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得所有子部门,从缓存中
|
* 获得所有子部门,从缓存中
|
||||||
@ -61,7 +61,7 @@ public interface DeptService {
|
|||||||
* @param recursive 是否递归获取所有
|
* @param recursive 是否递归获取所有
|
||||||
* @return 子部门列表
|
* @return 子部门列表
|
||||||
*/
|
*/
|
||||||
List<DeptDO> getDeptsByParentIdFromCache(Long parentId, boolean recursive);
|
List<DeptDO> getDeptListByParentIdFromCache(Long parentId, boolean recursive);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得部门信息数组
|
* 获得部门信息数组
|
||||||
@ -69,7 +69,21 @@ public interface DeptService {
|
|||||||
* @param ids 部门编号数组
|
* @param ids 部门编号数组
|
||||||
* @return 部门信息数组
|
* @return 部门信息数组
|
||||||
*/
|
*/
|
||||||
List<DeptDO> getDepts(Collection<Long> ids);
|
List<DeptDO> getDeptList(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定编号的部门 Map
|
||||||
|
*
|
||||||
|
* @param ids 部门编号数组
|
||||||
|
* @return 部门 Map
|
||||||
|
*/
|
||||||
|
default Map<Long, DeptDO> getDeptMap(Collection<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
List<DeptDO> list = getDeptList(ids);
|
||||||
|
return CollectionUtils.convertMap(list, DeptDO::getId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得部门信息
|
* 获得部门信息
|
||||||
@ -86,27 +100,6 @@ public interface DeptService {
|
|||||||
*
|
*
|
||||||
* @param ids 角色编号数组
|
* @param ids 角色编号数组
|
||||||
*/
|
*/
|
||||||
void validDepts(Collection<Long> ids);
|
void validateDeptList(Collection<Long> ids);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得指定编号的部门列表
|
|
||||||
*
|
|
||||||
* @param ids 部门编号数组
|
|
||||||
* @return 部门列表
|
|
||||||
*/
|
|
||||||
List<DeptDO> getSimpleDepts(Collection<Long> ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得指定编号的部门 Map
|
|
||||||
*
|
|
||||||
* @param ids 部门编号数组
|
|
||||||
* @return 部门 Map
|
|
||||||
*/
|
|
||||||
default Map<Long, DeptDO> getDeptMap(Collection<Long> ids) {
|
|
||||||
if (CollUtil.isEmpty(ids)) {
|
|
||||||
return Collections.emptyMap();
|
|
||||||
}
|
|
||||||
List<DeptDO> list = getSimpleDepts(ids);
|
|
||||||
return CollectionUtils.convertMap(list, DeptDO::getId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@ package cn.iocoder.yudao.module.system.service.dept;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|
||||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO;
|
||||||
@ -19,13 +17,11 @@ import com.google.common.collect.ImmutableMultimap;
|
|||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
@ -95,7 +91,7 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
if (reqVO.getParentId() == null) {
|
if (reqVO.getParentId() == null) {
|
||||||
reqVO.setParentId(DeptIdEnum.ROOT.getId());
|
reqVO.setParentId(DeptIdEnum.ROOT.getId());
|
||||||
}
|
}
|
||||||
checkCreateOrUpdate(null, reqVO.getParentId(), reqVO.getName());
|
validateForCreateOrUpdate(null, reqVO.getParentId(), reqVO.getName());
|
||||||
// 插入部门
|
// 插入部门
|
||||||
DeptDO dept = DeptConvert.INSTANCE.convert(reqVO);
|
DeptDO dept = DeptConvert.INSTANCE.convert(reqVO);
|
||||||
deptMapper.insert(dept);
|
deptMapper.insert(dept);
|
||||||
@ -110,7 +106,7 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
if (reqVO.getParentId() == null) {
|
if (reqVO.getParentId() == null) {
|
||||||
reqVO.setParentId(DeptIdEnum.ROOT.getId());
|
reqVO.setParentId(DeptIdEnum.ROOT.getId());
|
||||||
}
|
}
|
||||||
checkCreateOrUpdate(reqVO.getId(), reqVO.getParentId(), reqVO.getName());
|
validateForCreateOrUpdate(reqVO.getId(), reqVO.getParentId(), reqVO.getName());
|
||||||
// 更新部门
|
// 更新部门
|
||||||
DeptDO updateObj = DeptConvert.INSTANCE.convert(reqVO);
|
DeptDO updateObj = DeptConvert.INSTANCE.convert(reqVO);
|
||||||
deptMapper.updateById(updateObj);
|
deptMapper.updateById(updateObj);
|
||||||
@ -121,10 +117,10 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteDept(Long id) {
|
public void deleteDept(Long id) {
|
||||||
// 校验是否存在
|
// 校验是否存在
|
||||||
checkDeptExists(id);
|
validateDeptExists(id);
|
||||||
// 校验是否有子部门
|
// 校验是否有子部门
|
||||||
if (deptMapper.selectCountByParentId(id) > 0) {
|
if (deptMapper.selectCountByParentId(id) > 0) {
|
||||||
throw ServiceExceptionUtil.exception(DEPT_EXITS_CHILDREN);
|
throw exception(DEPT_EXITS_CHILDREN);
|
||||||
}
|
}
|
||||||
// 删除部门
|
// 删除部门
|
||||||
deptMapper.deleteById(id);
|
deptMapper.deleteById(id);
|
||||||
@ -133,18 +129,18 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeptDO> getSimpleDepts(DeptListReqVO reqVO) {
|
public List<DeptDO> getDeptList(DeptListReqVO reqVO) {
|
||||||
return deptMapper.selectList(reqVO);
|
return deptMapper.selectList(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeptDO> getDeptsByParentIdFromCache(Long parentId, boolean recursive) {
|
public List<DeptDO> getDeptListByParentIdFromCache(Long parentId, boolean recursive) {
|
||||||
if (parentId == null) {
|
if (parentId == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<DeptDO> result = new ArrayList<>(); // TODO 芋艿:待优化,新增缓存,避免每次遍历的计算
|
List<DeptDO> result = new ArrayList<>();
|
||||||
// 递归,简单粗暴
|
// 递归,简单粗暴
|
||||||
this.getDeptsByParentIdFromCache(result, parentId,
|
getDeptsByParentIdFromCache(result, parentId,
|
||||||
recursive ? Integer.MAX_VALUE : 1, // 如果递归获取,则无限;否则,只递归 1 次
|
recursive ? Integer.MAX_VALUE : 1, // 如果递归获取,则无限;否则,只递归 1 次
|
||||||
parentDeptCache);
|
parentDeptCache);
|
||||||
return result;
|
return result;
|
||||||
@ -182,65 +178,65 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
recursiveCount - 1, parentDeptMap));
|
recursiveCount - 1, parentDeptMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkCreateOrUpdate(Long id, Long parentId, String name) {
|
private void validateForCreateOrUpdate(Long id, Long parentId, String name) {
|
||||||
// 校验自己存在
|
// 校验自己存在
|
||||||
checkDeptExists(id);
|
validateDeptExists(id);
|
||||||
// 校验父部门的有效性
|
// 校验父部门的有效性
|
||||||
checkParentDeptEnable(id, parentId);
|
validateParentDeptEnable(id, parentId);
|
||||||
// 校验部门名的唯一性
|
// 校验部门名的唯一性
|
||||||
checkDeptNameUnique(id, parentId, name);
|
validateDeptNameUnique(id, parentId, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkParentDeptEnable(Long id, Long parentId) {
|
private void validateParentDeptEnable(Long id, Long parentId) {
|
||||||
if (parentId == null || DeptIdEnum.ROOT.getId().equals(parentId)) {
|
if (parentId == null || DeptIdEnum.ROOT.getId().equals(parentId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 不能设置自己为父部门
|
// 不能设置自己为父部门
|
||||||
if (parentId.equals(id)) {
|
if (parentId.equals(id)) {
|
||||||
throw ServiceExceptionUtil.exception(DEPT_PARENT_ERROR);
|
throw exception(DEPT_PARENT_ERROR);
|
||||||
}
|
}
|
||||||
// 父岗位不存在
|
// 父岗位不存在
|
||||||
DeptDO dept = deptMapper.selectById(parentId);
|
DeptDO dept = deptMapper.selectById(parentId);
|
||||||
if (dept == null) {
|
if (dept == null) {
|
||||||
throw ServiceExceptionUtil.exception(DEPT_PARENT_NOT_EXITS);
|
throw exception(DEPT_PARENT_NOT_EXITS);
|
||||||
}
|
}
|
||||||
// 父部门被禁用
|
// 父部门被禁用
|
||||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(dept.getStatus())) {
|
if (!CommonStatusEnum.ENABLE.getStatus().equals(dept.getStatus())) {
|
||||||
throw ServiceExceptionUtil.exception(DEPT_NOT_ENABLE);
|
throw exception(DEPT_NOT_ENABLE);
|
||||||
}
|
}
|
||||||
// 父部门不能是原来的子部门
|
// 父部门不能是原来的子部门
|
||||||
List<DeptDO> children = this.getDeptsByParentIdFromCache(id, true);
|
List<DeptDO> children = getDeptListByParentIdFromCache(id, true);
|
||||||
if (children.stream().anyMatch(dept1 -> dept1.getId().equals(parentId))) {
|
if (children.stream().anyMatch(dept1 -> dept1.getId().equals(parentId))) {
|
||||||
throw ServiceExceptionUtil.exception(DEPT_PARENT_IS_CHILD);
|
throw exception(DEPT_PARENT_IS_CHILD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkDeptExists(Long id) {
|
private void validateDeptExists(Long id) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DeptDO dept = deptMapper.selectById(id);
|
DeptDO dept = deptMapper.selectById(id);
|
||||||
if (dept == null) {
|
if (dept == null) {
|
||||||
throw ServiceExceptionUtil.exception(DEPT_NOT_FOUND);
|
throw exception(DEPT_NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkDeptNameUnique(Long id, Long parentId, String name) {
|
private void validateDeptNameUnique(Long id, Long parentId, String name) {
|
||||||
DeptDO menu = deptMapper.selectByParentIdAndName(parentId, name);
|
DeptDO menu = deptMapper.selectByParentIdAndName(parentId, name);
|
||||||
if (menu == null) {
|
if (menu == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 如果 id 为空,说明不用比较是否为相同 id 的岗位
|
// 如果 id 为空,说明不用比较是否为相同 id 的岗位
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw ServiceExceptionUtil.exception(DEPT_NAME_DUPLICATE);
|
throw exception(DEPT_NAME_DUPLICATE);
|
||||||
}
|
}
|
||||||
if (!menu.getId().equals(id)) {
|
if (!menu.getId().equals(id)) {
|
||||||
throw ServiceExceptionUtil.exception(DEPT_NAME_DUPLICATE);
|
throw exception(DEPT_NAME_DUPLICATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeptDO> getDepts(Collection<Long> ids) {
|
public List<DeptDO> getDeptList(Collection<Long> ids) {
|
||||||
return deptMapper.selectBatchIds(ids);
|
return deptMapper.selectBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,13 +246,12 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validDepts(Collection<Long> ids) {
|
public void validateDeptList(Collection<Long> ids) {
|
||||||
if (CollUtil.isEmpty(ids)) {
|
if (CollUtil.isEmpty(ids)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 获得科室信息
|
// 获得科室信息
|
||||||
List<DeptDO> depts = deptMapper.selectBatchIds(ids);
|
Map<Long, DeptDO> deptMap = getDeptMap(ids);
|
||||||
Map<Long, DeptDO> deptMap = CollectionUtils.convertMap(depts, DeptDO::getId);
|
|
||||||
// 校验
|
// 校验
|
||||||
ids.forEach(id -> {
|
ids.forEach(id -> {
|
||||||
DeptDO dept = deptMap.get(id);
|
DeptDO dept = deptMap.get(id);
|
||||||
@ -269,9 +264,4 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DeptDO> getSimpleDepts(Collection<Long> ids) {
|
|
||||||
return deptMapper.selectBatchIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ public interface PostService {
|
|||||||
* @param ids 岗位编号数组。如果为空,不进行筛选
|
* @param ids 岗位编号数组。如果为空,不进行筛选
|
||||||
* @return 部门列表
|
* @return 部门列表
|
||||||
*/
|
*/
|
||||||
default List<PostDO> getPosts(@Nullable Collection<Long> ids) {
|
default List<PostDO> getPostList(@Nullable Collection<Long> ids) {
|
||||||
return getPosts(ids, asSet(CommonStatusEnum.ENABLE.getStatus(), CommonStatusEnum.DISABLE.getStatus()));
|
return getPostList(ids, asSet(CommonStatusEnum.ENABLE.getStatus(), CommonStatusEnum.DISABLE.getStatus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +60,7 @@ public interface PostService {
|
|||||||
* @param statuses 状态数组。如果为空,不进行筛选
|
* @param statuses 状态数组。如果为空,不进行筛选
|
||||||
* @return 部门列表
|
* @return 部门列表
|
||||||
*/
|
*/
|
||||||
List<PostDO> getPosts(@Nullable Collection<Long> ids, @Nullable Collection<Integer> statuses);
|
List<PostDO> getPostList(@Nullable Collection<Long> ids, @Nullable Collection<Integer> statuses);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得岗位分页列表
|
* 获得岗位分页列表
|
||||||
@ -76,7 +76,7 @@ public interface PostService {
|
|||||||
* @param reqVO 查询条件
|
* @param reqVO 查询条件
|
||||||
* @return 部门列表
|
* @return 部门列表
|
||||||
*/
|
*/
|
||||||
List<PostDO> getPosts(PostExportReqVO reqVO);
|
List<PostDO> getPostList(PostExportReqVO reqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得岗位信息
|
* 获得岗位信息
|
||||||
@ -93,6 +93,6 @@ public interface PostService {
|
|||||||
*
|
*
|
||||||
* @param ids 岗位编号数组
|
* @param ids 岗位编号数组
|
||||||
*/
|
*/
|
||||||
void validPosts(Collection<Long> ids);
|
void validatePostList(Collection<Long> ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.system.service.dept;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostCreateReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO;
|
||||||
@ -38,7 +37,8 @@ public class PostServiceImpl implements PostService {
|
|||||||
@Override
|
@Override
|
||||||
public Long createPost(PostCreateReqVO reqVO) {
|
public Long createPost(PostCreateReqVO reqVO) {
|
||||||
// 校验正确性
|
// 校验正确性
|
||||||
this.checkCreateOrUpdate(null, reqVO.getName(), reqVO.getCode());
|
validatePostForCreateOrUpdate(null, reqVO.getName(), reqVO.getCode());
|
||||||
|
|
||||||
// 插入岗位
|
// 插入岗位
|
||||||
PostDO post = PostConvert.INSTANCE.convert(reqVO);
|
PostDO post = PostConvert.INSTANCE.convert(reqVO);
|
||||||
postMapper.insert(post);
|
postMapper.insert(post);
|
||||||
@ -48,7 +48,8 @@ public class PostServiceImpl implements PostService {
|
|||||||
@Override
|
@Override
|
||||||
public void updatePost(PostUpdateReqVO reqVO) {
|
public void updatePost(PostUpdateReqVO reqVO) {
|
||||||
// 校验正确性
|
// 校验正确性
|
||||||
this.checkCreateOrUpdate(reqVO.getId(), reqVO.getName(), reqVO.getCode());
|
validatePostForCreateOrUpdate(reqVO.getId(), reqVO.getName(), reqVO.getCode());
|
||||||
|
|
||||||
// 更新岗位
|
// 更新岗位
|
||||||
PostDO updateObj = PostConvert.INSTANCE.convert(reqVO);
|
PostDO updateObj = PostConvert.INSTANCE.convert(reqVO);
|
||||||
postMapper.updateById(updateObj);
|
postMapper.updateById(updateObj);
|
||||||
@ -57,13 +58,59 @@ public class PostServiceImpl implements PostService {
|
|||||||
@Override
|
@Override
|
||||||
public void deletePost(Long id) {
|
public void deletePost(Long id) {
|
||||||
// 校验是否存在
|
// 校验是否存在
|
||||||
this.checkPostExists(id);
|
validatePostExists(id);
|
||||||
// 删除部门
|
// 删除部门
|
||||||
postMapper.deleteById(id);
|
postMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validatePostForCreateOrUpdate(Long id, String name, String code) {
|
||||||
|
// 校验自己存在
|
||||||
|
validatePostExists(id);
|
||||||
|
// 校验岗位名的唯一性
|
||||||
|
validatePostNameUnique(id, name);
|
||||||
|
// 校验岗位编码的唯一性
|
||||||
|
validatePostCodeUnique(id, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validatePostNameUnique(Long id, String name) {
|
||||||
|
PostDO post = postMapper.selectByName(name);
|
||||||
|
if (post == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果 id 为空,说明不用比较是否为相同 id 的岗位
|
||||||
|
if (id == null) {
|
||||||
|
throw exception(POST_NAME_DUPLICATE);
|
||||||
|
}
|
||||||
|
if (!post.getId().equals(id)) {
|
||||||
|
throw exception(POST_NAME_DUPLICATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validatePostCodeUnique(Long id, String code) {
|
||||||
|
PostDO post = postMapper.selectByCode(code);
|
||||||
|
if (post == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果 id 为空,说明不用比较是否为相同 id 的岗位
|
||||||
|
if (id == null) {
|
||||||
|
throw exception(POST_CODE_DUPLICATE);
|
||||||
|
}
|
||||||
|
if (!post.getId().equals(id)) {
|
||||||
|
throw exception(POST_CODE_DUPLICATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validatePostExists(Long id) {
|
||||||
|
if (id == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (postMapper.selectById(id) == null) {
|
||||||
|
throw exception(POST_NOT_FOUND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PostDO> getPosts(Collection<Long> ids, Collection<Integer> statuses) {
|
public List<PostDO> getPostList(Collection<Long> ids, Collection<Integer> statuses) {
|
||||||
return postMapper.selectList(ids, statuses);
|
return postMapper.selectList(ids, statuses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +120,7 @@ public class PostServiceImpl implements PostService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PostDO> getPosts(PostExportReqVO reqVO) {
|
public List<PostDO> getPostList(PostExportReqVO reqVO) {
|
||||||
return postMapper.selectList(reqVO);
|
return postMapper.selectList(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,55 +129,8 @@ public class PostServiceImpl implements PostService {
|
|||||||
return postMapper.selectById(id);
|
return postMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkCreateOrUpdate(Long id, String name, String code) {
|
|
||||||
// 校验自己存在
|
|
||||||
checkPostExists(id);
|
|
||||||
// 校验岗位名的唯一性
|
|
||||||
checkPostNameUnique(id, name);
|
|
||||||
// 校验岗位编码的唯一性
|
|
||||||
checkPostCodeUnique(id, code);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkPostNameUnique(Long id, String name) {
|
|
||||||
PostDO post = postMapper.selectByName(name);
|
|
||||||
if (post == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 如果 id 为空,说明不用比较是否为相同 id 的岗位
|
|
||||||
if (id == null) {
|
|
||||||
throw ServiceExceptionUtil.exception(POST_NAME_DUPLICATE);
|
|
||||||
}
|
|
||||||
if (!post.getId().equals(id)) {
|
|
||||||
throw ServiceExceptionUtil.exception(POST_NAME_DUPLICATE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkPostCodeUnique(Long id, String code) {
|
|
||||||
PostDO post = postMapper.selectByCode(code);
|
|
||||||
if (post == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 如果 id 为空,说明不用比较是否为相同 id 的岗位
|
|
||||||
if (id == null) {
|
|
||||||
throw ServiceExceptionUtil.exception(POST_CODE_DUPLICATE);
|
|
||||||
}
|
|
||||||
if (!post.getId().equals(id)) {
|
|
||||||
throw ServiceExceptionUtil.exception(POST_CODE_DUPLICATE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkPostExists(Long id) {
|
|
||||||
if (id == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PostDO post = postMapper.selectById(id);
|
|
||||||
if (post == null) {
|
|
||||||
throw ServiceExceptionUtil.exception(POST_NOT_FOUND);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validPosts(Collection<Long> ids) {
|
public void validatePostList(Collection<Long> ids) {
|
||||||
if (CollUtil.isEmpty(ids)) {
|
if (CollUtil.isEmpty(ids)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public interface DictDataService {
|
|||||||
*
|
*
|
||||||
* @return 字典数据全列表
|
* @return 字典数据全列表
|
||||||
*/
|
*/
|
||||||
List<DictDataDO> getDictDatas();
|
List<DictDataDO> getDictDataList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得字典数据分页列表
|
* 获得字典数据分页列表
|
||||||
@ -60,7 +60,7 @@ public interface DictDataService {
|
|||||||
* @param reqVO 列表请求
|
* @param reqVO 列表请求
|
||||||
* @return 字典数据列表
|
* @return 字典数据列表
|
||||||
*/
|
*/
|
||||||
List<DictDataDO> getDictDatas(DictDataExportReqVO reqVO);
|
List<DictDataDO> getDictDataList(DictDataExportReqVO reqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得字典数据详情
|
* 获得字典数据详情
|
||||||
@ -86,7 +86,7 @@ public interface DictDataService {
|
|||||||
* @param dictType 字典类型
|
* @param dictType 字典类型
|
||||||
* @param values 字典数据值的数组
|
* @param values 字典数据值的数组
|
||||||
*/
|
*/
|
||||||
void validDictDatas(String dictType, Collection<String> values);
|
void validateDictDataList(String dictType, Collection<String> values);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定的字典数据
|
* 获得指定的字典数据
|
||||||
|
@ -48,7 +48,7 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
private DictDataMapper dictDataMapper;
|
private DictDataMapper dictDataMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DictDataDO> getDictDatas() {
|
public List<DictDataDO> getDictDataList() {
|
||||||
List<DictDataDO> list = dictDataMapper.selectList();
|
List<DictDataDO> list = dictDataMapper.selectList();
|
||||||
list.sort(COMPARATOR_TYPE_AND_SORT);
|
list.sort(COMPARATOR_TYPE_AND_SORT);
|
||||||
return list;
|
return list;
|
||||||
@ -60,7 +60,7 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DictDataDO> getDictDatas(DictDataExportReqVO reqVO) {
|
public List<DictDataDO> getDictDataList(DictDataExportReqVO reqVO) {
|
||||||
List<DictDataDO> list = dictDataMapper.selectList(reqVO);
|
List<DictDataDO> list = dictDataMapper.selectList(reqVO);
|
||||||
list.sort(COMPARATOR_TYPE_AND_SORT);
|
list.sort(COMPARATOR_TYPE_AND_SORT);
|
||||||
return list;
|
return list;
|
||||||
@ -74,7 +74,7 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
@Override
|
@Override
|
||||||
public Long createDictData(DictDataCreateReqVO reqVO) {
|
public Long createDictData(DictDataCreateReqVO reqVO) {
|
||||||
// 校验正确性
|
// 校验正确性
|
||||||
checkCreateOrUpdate(null, reqVO.getValue(), reqVO.getDictType());
|
validateDictDataForCreateOrUpdate(null, reqVO.getValue(), reqVO.getDictType());
|
||||||
|
|
||||||
// 插入字典类型
|
// 插入字典类型
|
||||||
DictDataDO dictData = DictDataConvert.INSTANCE.convert(reqVO);
|
DictDataDO dictData = DictDataConvert.INSTANCE.convert(reqVO);
|
||||||
@ -85,7 +85,7 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateDictData(DictDataUpdateReqVO reqVO) {
|
public void updateDictData(DictDataUpdateReqVO reqVO) {
|
||||||
// 校验正确性
|
// 校验正确性
|
||||||
checkCreateOrUpdate(reqVO.getId(), reqVO.getValue(), reqVO.getDictType());
|
validateDictDataForCreateOrUpdate(reqVO.getId(), reqVO.getValue(), reqVO.getDictType());
|
||||||
|
|
||||||
// 更新字典类型
|
// 更新字典类型
|
||||||
DictDataDO updateObj = DictDataConvert.INSTANCE.convert(reqVO);
|
DictDataDO updateObj = DictDataConvert.INSTANCE.convert(reqVO);
|
||||||
@ -95,7 +95,7 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteDictData(Long id) {
|
public void deleteDictData(Long id) {
|
||||||
// 校验是否存在
|
// 校验是否存在
|
||||||
checkDictDataExists(id);
|
validateDictDataExists(id);
|
||||||
|
|
||||||
// 删除字典数据
|
// 删除字典数据
|
||||||
dictDataMapper.deleteById(id);
|
dictDataMapper.deleteById(id);
|
||||||
@ -106,18 +106,17 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
return dictDataMapper.selectCountByDictType(dictType);
|
return dictDataMapper.selectCountByDictType(dictType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateDictDataForCreateOrUpdate(Long id, String value, String dictType) {
|
||||||
private void checkCreateOrUpdate(Long id, String value, String dictType) {
|
|
||||||
// 校验自己存在
|
// 校验自己存在
|
||||||
checkDictDataExists(id);
|
validateDictDataExists(id);
|
||||||
// 校验字典类型有效
|
// 校验字典类型有效
|
||||||
checkDictTypeValid(dictType);
|
validateDictTypeExists(dictType);
|
||||||
// 校验字典数据的值的唯一性
|
// 校验字典数据的值的唯一性
|
||||||
checkDictDataValueUnique(id, dictType, value);
|
validateDictDataValueUnique(id, dictType, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void checkDictDataValueUnique(Long id, String dictType, String value) {
|
public void validateDictDataValueUnique(Long id, String dictType, String value) {
|
||||||
DictDataDO dictData = dictDataMapper.selectByDictTypeAndValue(dictType, value);
|
DictDataDO dictData = dictDataMapper.selectByDictTypeAndValue(dictType, value);
|
||||||
if (dictData == null) {
|
if (dictData == null) {
|
||||||
return;
|
return;
|
||||||
@ -132,7 +131,7 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void checkDictDataExists(Long id) {
|
public void validateDictDataExists(Long id) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -143,7 +142,7 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void checkDictTypeValid(String type) {
|
public void validateDictTypeExists(String type) {
|
||||||
DictTypeDO dictType = dictTypeService.getDictType(type);
|
DictTypeDO dictType = dictTypeService.getDictType(type);
|
||||||
if (dictType == null) {
|
if (dictType == null) {
|
||||||
throw exception(DICT_TYPE_NOT_EXISTS);
|
throw exception(DICT_TYPE_NOT_EXISTS);
|
||||||
@ -154,7 +153,7 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validDictDatas(String dictType, Collection<String> values) {
|
public void validateDictDataList(String dictType, Collection<String> values) {
|
||||||
if (CollUtil.isEmpty(values)) {
|
if (CollUtil.isEmpty(values)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,8 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||||||
@Override
|
@Override
|
||||||
public Long createDictType(DictTypeCreateReqVO reqVO) {
|
public Long createDictType(DictTypeCreateReqVO reqVO) {
|
||||||
// 校验正确性
|
// 校验正确性
|
||||||
checkCreateOrUpdate(null, reqVO.getName(), reqVO.getType());
|
validateDictTypeForCreateOrUpdate(null, reqVO.getName(), reqVO.getType());
|
||||||
|
|
||||||
// 插入字典类型
|
// 插入字典类型
|
||||||
DictTypeDO dictType = DictTypeConvert.INSTANCE.convert(reqVO)
|
DictTypeDO dictType = DictTypeConvert.INSTANCE.convert(reqVO)
|
||||||
.setDeletedTime(LocalDateTimeUtils.EMPTY); // 唯一索引,避免 null 值
|
.setDeletedTime(LocalDateTimeUtils.EMPTY); // 唯一索引,避免 null 值
|
||||||
@ -68,7 +69,8 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateDictType(DictTypeUpdateReqVO reqVO) {
|
public void updateDictType(DictTypeUpdateReqVO reqVO) {
|
||||||
// 校验正确性
|
// 校验正确性
|
||||||
checkCreateOrUpdate(reqVO.getId(), reqVO.getName(), null);
|
validateDictTypeForCreateOrUpdate(reqVO.getId(), reqVO.getName(), null);
|
||||||
|
|
||||||
// 更新字典类型
|
// 更新字典类型
|
||||||
DictTypeDO updateObj = DictTypeConvert.INSTANCE.convert(reqVO);
|
DictTypeDO updateObj = DictTypeConvert.INSTANCE.convert(reqVO);
|
||||||
dictTypeMapper.updateById(updateObj);
|
dictTypeMapper.updateById(updateObj);
|
||||||
@ -77,7 +79,7 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteDictType(Long id) {
|
public void deleteDictType(Long id) {
|
||||||
// 校验是否存在
|
// 校验是否存在
|
||||||
DictTypeDO dictType = checkDictTypeExists(id);
|
DictTypeDO dictType = validateDictTypeExists(id);
|
||||||
// 校验是否有字典数据
|
// 校验是否有字典数据
|
||||||
if (dictDataService.countByDictType(dictType.getType()) > 0) {
|
if (dictDataService.countByDictType(dictType.getType()) > 0) {
|
||||||
throw exception(DICT_TYPE_HAS_CHILDREN);
|
throw exception(DICT_TYPE_HAS_CHILDREN);
|
||||||
@ -91,17 +93,17 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||||||
return dictTypeMapper.selectList();
|
return dictTypeMapper.selectList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkCreateOrUpdate(Long id, String name, String type) {
|
private void validateDictTypeForCreateOrUpdate(Long id, String name, String type) {
|
||||||
// 校验自己存在
|
// 校验自己存在
|
||||||
checkDictTypeExists(id);
|
validateDictTypeExists(id);
|
||||||
// 校验字典类型的名字的唯一性
|
// 校验字典类型的名字的唯一性
|
||||||
checkDictTypeNameUnique(id, name);
|
validateDictTypeNameUnique(id, name);
|
||||||
// 校验字典类型的类型的唯一性
|
// 校验字典类型的类型的唯一性
|
||||||
checkDictTypeUnique(id, type);
|
validateDictTypeUnique(id, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void checkDictTypeNameUnique(Long id, String name) {
|
void validateDictTypeNameUnique(Long id, String name) {
|
||||||
DictTypeDO dictType = dictTypeMapper.selectByName(name);
|
DictTypeDO dictType = dictTypeMapper.selectByName(name);
|
||||||
if (dictType == null) {
|
if (dictType == null) {
|
||||||
return;
|
return;
|
||||||
@ -116,7 +118,7 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void checkDictTypeUnique(Long id, String type) {
|
void validateDictTypeUnique(Long id, String type) {
|
||||||
if (StrUtil.isEmpty(type)) {
|
if (StrUtil.isEmpty(type)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -134,7 +136,7 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public DictTypeDO checkDictTypeExists(Long id) {
|
DictTypeDO validateDictTypeExists(Long id) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateErrorCode(ErrorCodeUpdateReqVO updateReqVO) {
|
public void updateErrorCode(ErrorCodeUpdateReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateErrorCodeExists(updateReqVO.getId());
|
validateErrorCodeExists(updateReqVO.getId());
|
||||||
// 校验 code 重复
|
// 校验 code 重复
|
||||||
validateCodeDuplicate(updateReqVO.getCode(), updateReqVO.getId());
|
validateCodeDuplicate(updateReqVO.getCode(), updateReqVO.getId());
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteErrorCode(Long id) {
|
public void deleteErrorCode(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateErrorCodeExists(id);
|
validateErrorCodeExists(id);
|
||||||
// 删除
|
// 删除
|
||||||
errorCodeMapper.deleteById(id);
|
errorCodeMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void validateErrorCodeExists(Long id) {
|
void validateErrorCodeExists(Long id) {
|
||||||
if (errorCodeMapper.selectById(id) == null) {
|
if (errorCodeMapper.selectById(id) == null) {
|
||||||
throw exception(ERROR_CODE_NOT_EXISTS);
|
throw exception(ERROR_CODE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.logger;
|
package cn.iocoder.yudao.module.system.service.logger;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.service.OperateLog;
|
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.service.OperateLogFrameworkService;
|
|
||||||
import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
|
import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO;
|
||||||
@ -38,6 +36,6 @@ public interface OperateLogService {
|
|||||||
* @param reqVO 列表条件
|
* @param reqVO 列表条件
|
||||||
* @return 日志列表
|
* @return 日志列表
|
||||||
*/
|
*/
|
||||||
List<OperateLogDO> getOperateLogs(OperateLogExportReqVO reqVO);
|
List<OperateLogDO> getOperateLogList(OperateLogExportReqVO reqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class OperateLogServiceImpl implements OperateLogService {
|
|||||||
// 处理基于用户昵称的查询
|
// 处理基于用户昵称的查询
|
||||||
Collection<Long> userIds = null;
|
Collection<Long> userIds = null;
|
||||||
if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
|
if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
|
||||||
userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
|
userIds = convertSet(userService.getUserListByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
|
||||||
if (CollUtil.isEmpty(userIds)) {
|
if (CollUtil.isEmpty(userIds)) {
|
||||||
return PageResult.empty();
|
return PageResult.empty();
|
||||||
}
|
}
|
||||||
@ -59,11 +59,11 @@ public class OperateLogServiceImpl implements OperateLogService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OperateLogDO> getOperateLogs(OperateLogExportReqVO reqVO) {
|
public List<OperateLogDO> getOperateLogList(OperateLogExportReqVO reqVO) {
|
||||||
// 处理基于用户昵称的查询
|
// 处理基于用户昵称的查询
|
||||||
Collection<Long> userIds = null;
|
Collection<Long> userIds = null;
|
||||||
if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
|
if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
|
||||||
userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
|
userIds = convertSet(userService.getUserListByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
|
||||||
if (CollUtil.isEmpty(userIds)) {
|
if (CollUtil.isEmpty(userIds)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.mail;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.mail.MailAccount;
|
import cn.hutool.extra.mail.MailAccount;
|
||||||
import cn.hutool.extra.mail.MailUtil;
|
import cn.hutool.extra.mail.MailUtil;
|
||||||
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert;
|
import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert;
|
||||||
@ -20,15 +19,13 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮箱模版 服务实现类
|
* 邮箱发送 Service 实现类
|
||||||
*
|
*
|
||||||
* @author wangjingyi
|
* @author wangjingyi
|
||||||
* @since 2022-03-21
|
* @since 2022-03-21
|
||||||
@ -82,13 +79,13 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
public Long sendSingleMail(String mail, Long userId, Integer userType,
|
public Long sendSingleMail(String mail, Long userId, Integer userType,
|
||||||
String templateCode, Map<String, Object> templateParams) {
|
String templateCode, Map<String, Object> templateParams) {
|
||||||
// 校验邮箱模版是否合法
|
// 校验邮箱模版是否合法
|
||||||
MailTemplateDO template = checkMailTemplateValid(templateCode);
|
MailTemplateDO template = validateMailTemplate(templateCode);
|
||||||
// 校验邮箱账号是否合法
|
// 校验邮箱账号是否合法
|
||||||
MailAccountDO account = checkMailAccountValid(template.getAccountId());
|
MailAccountDO account = validateMailAccount(template.getAccountId());
|
||||||
|
|
||||||
// 校验邮箱是否存在
|
// 校验邮箱是否存在
|
||||||
mail = checkMail(mail);
|
mail = validateMail(mail);
|
||||||
checkTemplateParams(template, templateParams);
|
validateTemplateParams(template, templateParams);
|
||||||
|
|
||||||
// 创建发送日志。如果模板被禁用,则不发送短信,只记录日志
|
// 创建发送日志。如果模板被禁用,则不发送短信,只记录日志
|
||||||
Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus());
|
Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus());
|
||||||
@ -106,7 +103,7 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
@Override
|
@Override
|
||||||
public void doSendMail(MailSendMessage message) {
|
public void doSendMail(MailSendMessage message) {
|
||||||
// 1. 创建发送账号
|
// 1. 创建发送账号
|
||||||
MailAccountDO account = checkMailAccountValid(message.getAccountId());
|
MailAccountDO account = validateMailAccount(message.getAccountId());
|
||||||
MailAccount mailAccount = MailAccountConvert.INSTANCE.convert(account, message.getNickname());
|
MailAccount mailAccount = MailAccountConvert.INSTANCE.convert(account, message.getNickname());
|
||||||
// 2. 发送邮件
|
// 2. 发送邮件
|
||||||
try {
|
try {
|
||||||
@ -121,7 +118,7 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public MailTemplateDO checkMailTemplateValid(String templateCode) {
|
MailTemplateDO validateMailTemplate(String templateCode) {
|
||||||
// 获得邮件模板。考虑到效率,从缓存中获取
|
// 获得邮件模板。考虑到效率,从缓存中获取
|
||||||
MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode);
|
MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode);
|
||||||
// 邮件模板不存在
|
// 邮件模板不存在
|
||||||
@ -132,7 +129,7 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public MailAccountDO checkMailAccountValid(Long accountId) {
|
MailAccountDO validateMailAccount(Long accountId) {
|
||||||
// 获得邮箱账号。考虑到效率,从缓存中获取
|
// 获得邮箱账号。考虑到效率,从缓存中获取
|
||||||
MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId);
|
MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId);
|
||||||
// 邮箱账号不存在
|
// 邮箱账号不存在
|
||||||
@ -143,7 +140,7 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public String checkMail(String mail) {
|
String validateMail(String mail) {
|
||||||
if (StrUtil.isEmpty(mail)) {
|
if (StrUtil.isEmpty(mail)) {
|
||||||
throw exception(MAIL_SEND_MAIL_NOT_EXISTS);
|
throw exception(MAIL_SEND_MAIL_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
@ -157,7 +154,7 @@ public class MailSendServiceImpl implements MailSendService {
|
|||||||
* @param templateParams 参数列表
|
* @param templateParams 参数列表
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void checkTemplateParams(MailTemplateDO template, Map<String, Object> templateParams) {
|
void validateTemplateParams(MailTemplateDO template, Map<String, Object> templateParams) {
|
||||||
template.getParams().forEach(key -> {
|
template.getParams().forEach(key -> {
|
||||||
Object value = templateParams.get(key);
|
Object value = templateParams.get(key);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
@ -39,7 +39,7 @@ public interface NoticeService {
|
|||||||
* @param reqVO 分页条件
|
* @param reqVO 分页条件
|
||||||
* @return 部门分页列表
|
* @return 部门分页列表
|
||||||
*/
|
*/
|
||||||
PageResult<NoticeDO> pageNotices(NoticePageReqVO reqVO);
|
PageResult<NoticeDO> getNoticePage(NoticePageReqVO reqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得岗位公告公告信息
|
* 获得岗位公告公告信息
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user