Commit c3eb9022b8bd3bf53267fd02706a3e8cb0490fcb

Authored by YunaiV
2 parents fa2977ae ee150702

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
Showing 188 changed files with 4127 additions and 2483 deletions

Too many changes.

To preserve performance only 100 of 188 files are displayed.

@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 <module>yudao-module-system</module> 17 <module>yudao-module-system</module>
18 <module>yudao-module-infra</module> 18 <module>yudao-module-infra</module>
19 <module>yudao-module-pay</module> 19 <module>yudao-module-pay</module>
20 -<!-- <module>yudao-module-bpm</module>--> 20 + <module>yudao-module-bpm</module>
21 <!-- <module>yudao-module-visualization</module>--> 21 <!-- <module>yudao-module-visualization</module>-->
22 <!-- <module>yudao-module-mp</module>--> 22 <!-- <module>yudao-module-mp</module>-->
23 <!-- <module>yudao-module-mall</module>--> 23 <!-- <module>yudao-module-mall</module>-->
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version> 39 <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
40 <!-- 看看咋放到 bom 里 --> 40 <!-- 看看咋放到 bom 里 -->
41 <lombok.version>1.18.24</lombok.version> 41 <lombok.version>1.18.24</lombok.version>
42 - <spring.boot.version>2.7.7</spring.boot.version> 42 + <spring.boot.version>2.7.8</spring.boot.version>
43 <mapstruct.version>1.5.3.Final</mapstruct.version> 43 <mapstruct.version>1.5.3.Final</mapstruct.version>
44 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 44 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
45 </properties> 45 </properties>
sql/mysql/ruoyi-vue-pro.sql
@@ -1895,76 +1895,76 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i @@ -1895,76 +1895,76 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
1895 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'); 1895 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');
1896 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'); 1896 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');
1897 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'); 1897 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');
1898 -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');  
1899 -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');  
1900 -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');  
1901 -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');  
1902 -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');  
1903 -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');  
1904 -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');  
1905 -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');  
1906 -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');  
1907 -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');  
1908 -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');  
1909 -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');  
1910 -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');  
1911 -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');  
1912 -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');  
1913 -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');  
1914 -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');  
1915 -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');  
1916 -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');  
1917 -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');  
1918 -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');  
1919 -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');  
1920 -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');  
1921 -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');  
1922 -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');  
1923 -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');  
1924 -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');  
1925 -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');  
1926 -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');  
1927 -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');  
1928 -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');  
1929 -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');  
1930 -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');  
1931 -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');  
1932 -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');  
1933 -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');  
1934 -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');  
1935 -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');  
1936 -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');  
1937 -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');  
1938 -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');  
1939 -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');  
1940 -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');  
1941 -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');  
1942 -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');  
1943 -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');  
1944 -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');  
1945 -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');  
1946 -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');  
1947 -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');  
1948 -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');  
1949 -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');  
1950 -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');  
1951 -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');  
1952 -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');  
1953 -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');  
1954 -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');  
1955 -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');  
1956 -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');  
1957 -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');  
1958 -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');  
1959 -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');  
1960 -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');  
1961 -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');  
1962 -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');  
1963 -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');  
1964 -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');  
1965 -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');  
1966 -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');  
1967 -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'); 1898 +# 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');
  1899 +# 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');
  1900 +# 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');
  1901 +# 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');
  1902 +# 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');
  1903 +# 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');
  1904 +# 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');
  1905 +# 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');
  1906 +# 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');
  1907 +# 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');
  1908 +# 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');
  1909 +# 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');
  1910 +# 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');
  1911 +# 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');
  1912 +# 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');
  1913 +# 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');
  1914 +# 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');
  1915 +# 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');
  1916 +# 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');
  1917 +# 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');
  1918 +# 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');
  1919 +# 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');
  1920 +# 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');
  1921 +# 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');
  1922 +# 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');
  1923 +# 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');
  1924 +# 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');
  1925 +# 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');
  1926 +# 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');
  1927 +# 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');
  1928 +# 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');
  1929 +# 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');
  1930 +# 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');
  1931 +# 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');
  1932 +# 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');
  1933 +# 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');
  1934 +# 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');
  1935 +# 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');
  1936 +# 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');
  1937 +# 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');
  1938 +# 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');
  1939 +# 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');
  1940 +# 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');
  1941 +# 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');
  1942 +# 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');
  1943 +# 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');
  1944 +# 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');
  1945 +# 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');
  1946 +# 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');
  1947 +# 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');
  1948 +# 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');
  1949 +# 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');
  1950 +# 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');
  1951 +# 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');
  1952 +# 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');
  1953 +# 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');
  1954 +# 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');
  1955 +# 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');
  1956 +# 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');
  1957 +# 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');
  1958 +# 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');
  1959 +# 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');
  1960 +# 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');
  1961 +# 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');
  1962 +# 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');
  1963 +# 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');
  1964 +# 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');
  1965 +# 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');
  1966 +# 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');
  1967 +# 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');
1968 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'); 1968 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');
1969 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'); 1969 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');
1970 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'); 1970 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 @@ -1981,7 +1981,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
1981 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'); 1981 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');
1982 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'); 1982 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');
1983 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'); 1983 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');
1984 -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'); 1984 +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');
1985 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'); 1985 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');
1986 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'); 1986 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');
1987 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'); 1987 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` ( @@ -3251,7 +3251,7 @@ CREATE TABLE `system_tenant` (
3251 `package_id` bigint NOT NULL COMMENT '租户套餐编号', 3251 `package_id` bigint NOT NULL COMMENT '租户套餐编号',
3252 `expire_time` datetime NOT NULL COMMENT '过期时间', 3252 `expire_time` datetime NOT NULL COMMENT '过期时间',
3253 `account_count` int NOT NULL COMMENT '账号数量', 3253 `account_count` int NOT NULL COMMENT '账号数量',
3254 - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '创建者', 3254 + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
3255 `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 3255 `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
3256 `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', 3256 `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
3257 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 3257 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
@@ -3282,7 +3282,7 @@ CREATE TABLE `system_tenant_package` ( @@ -3282,7 +3282,7 @@ CREATE TABLE `system_tenant_package` (
3282 `status` tinyint NOT NULL DEFAULT 0 COMMENT '租户状态(0正常 1停用)', 3282 `status` tinyint NOT NULL DEFAULT 0 COMMENT '租户状态(0正常 1停用)',
3283 `remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '备注', 3283 `remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '备注',
3284 `menu_ids` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '关联的菜单编号', 3284 `menu_ids` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '关联的菜单编号',
3285 - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '创建者', 3285 + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
3286 `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 3286 `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
3287 `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', 3287 `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
3288 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 3288 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
sql/postgresql/ruoyi-vue-pro.sql
@@ -3817,7 +3817,7 @@ CREATE TABLE &quot;system_tenant&quot; ( @@ -3817,7 +3817,7 @@ CREATE TABLE &quot;system_tenant&quot; (
3817 "package_id" int8 NOT NULL, 3817 "package_id" int8 NOT NULL,
3818 "expire_time" timestamp(6) NOT NULL, 3818 "expire_time" timestamp(6) NOT NULL,
3819 "account_count" int4 NOT NULL, 3819 "account_count" int4 NOT NULL,
3820 - "creator" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, 3820 + "creator" varchar(64) COLLATE "pg_catalog"."default",
3821 "create_time" timestamp(6) NOT NULL, 3821 "create_time" timestamp(6) NOT NULL,
3822 "updater" varchar(64) COLLATE "pg_catalog"."default", 3822 "updater" varchar(64) COLLATE "pg_catalog"."default",
3823 "update_time" timestamp(6) NOT NULL, 3823 "update_time" timestamp(6) NOT NULL,
@@ -3860,7 +3860,7 @@ CREATE TABLE &quot;system_tenant_package&quot; ( @@ -3860,7 +3860,7 @@ CREATE TABLE &quot;system_tenant_package&quot; (
3860 "status" int2 NOT NULL, 3860 "status" int2 NOT NULL,
3861 "remark" varchar(256) COLLATE "pg_catalog"."default", 3861 "remark" varchar(256) COLLATE "pg_catalog"."default",
3862 "menu_ids" varchar(2048) COLLATE "pg_catalog"."default" NOT NULL, 3862 "menu_ids" varchar(2048) COLLATE "pg_catalog"."default" NOT NULL,
3863 - "creator" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, 3863 + "creator" varchar(64) COLLATE "pg_catalog"."default",
3864 "create_time" timestamp(6) NOT NULL, 3864 "create_time" timestamp(6) NOT NULL,
3865 "updater" varchar(64) COLLATE "pg_catalog"."default", 3865 "updater" varchar(64) COLLATE "pg_catalog"."default",
3866 "update_time" timestamp(6) NOT NULL, 3866 "update_time" timestamp(6) NOT NULL,
sql/sqlserver/ruoyi-vue-pro.sql
@@ -10600,7 +10600,7 @@ CREATE TABLE [dbo].[system_tenant] ( @@ -10600,7 +10600,7 @@ CREATE TABLE [dbo].[system_tenant] (
10600 [package_id] bigint NOT NULL, 10600 [package_id] bigint NOT NULL,
10601 [expire_time] datetime2(7) NOT NULL, 10601 [expire_time] datetime2(7) NOT NULL,
10602 [account_count] int NOT NULL, 10602 [account_count] int NOT NULL,
10603 - [creator] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, 10603 + [creator] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
10604 [create_time] datetime2(7) NOT NULL, 10604 [create_time] datetime2(7) NOT NULL,
10605 [updater] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, 10605 [updater] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
10606 [update_time] datetime2(7) NOT NULL, 10606 [update_time] datetime2(7) NOT NULL,
@@ -10761,7 +10761,7 @@ CREATE TABLE [dbo].[system_tenant_package] ( @@ -10761,7 +10761,7 @@ CREATE TABLE [dbo].[system_tenant_package] (
10761 [status] tinyint NOT NULL, 10761 [status] tinyint NOT NULL,
10762 [remark] nvarchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, 10762 [remark] nvarchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
10763 [menu_ids] nvarchar(2048) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, 10763 [menu_ids] nvarchar(2048) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
10764 - [creator] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, 10764 + [creator] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
10765 [create_time] datetime2(7) NOT NULL, 10765 [create_time] datetime2(7) NOT NULL,
10766 [updater] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, 10766 [updater] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
10767 [update_time] datetime2(7) NOT NULL, 10767 [update_time] datetime2(7) NOT NULL,
yudao-dependencies/pom.xml
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <properties> 16 <properties>
17 <revision>1.7.0-snapshot</revision> 17 <revision>1.7.0-snapshot</revision>
18 <!-- 统一依赖管理 --> 18 <!-- 统一依赖管理 -->
19 - <spring.boot.version>2.7.7</spring.boot.version> 19 + <spring.boot.version>2.7.8</spring.boot.version>
20 <!-- Web 相关 --> 20 <!-- Web 相关 -->
21 <springdoc.version>1.6.14</springdoc.version> 21 <springdoc.version>1.6.14</springdoc.version>
22 <knife4j.version>4.0.0</knife4j.version> 22 <knife4j.version>4.0.0</knife4j.version>
@@ -41,12 +41,12 @@ @@ -41,12 +41,12 @@
41 <!-- Bpm 工作流相关 --> 41 <!-- Bpm 工作流相关 -->
42 <flowable.version>6.8.0</flowable.version> 42 <flowable.version>6.8.0</flowable.version>
43 <!-- 工具类相关 --> 43 <!-- 工具类相关 -->
44 - <captcha-plus.version>1.0.1</captcha-plus.version> 44 + <captcha-plus.version>1.0.2</captcha-plus.version>
45 <jsoup.version>1.15.3</jsoup.version> 45 <jsoup.version>1.15.3</jsoup.version>
46 <lombok.version>1.18.24</lombok.version> 46 <lombok.version>1.18.24</lombok.version>
47 <mapstruct.version>1.5.3.Final</mapstruct.version> 47 <mapstruct.version>1.5.3.Final</mapstruct.version>
48 <hutool.version>5.8.11</hutool.version> 48 <hutool.version>5.8.11</hutool.version>
49 - <easyexcel.verion>3.1.5</easyexcel.verion> 49 + <easyexcel.verion>3.2.0</easyexcel.verion>
50 <velocity.version>2.3</velocity.version> 50 <velocity.version>2.3</velocity.version>
51 <screw.version>1.0.5</screw.version> 51 <screw.version>1.0.5</screw.version>
52 <fastjson.version>1.2.83</fastjson.version> 52 <fastjson.version>1.2.83</fastjson.version>
yudao-example/yudao-sso-demo-by-code/pom.xml
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <maven.compiler.target>8</maven.compiler.target> 21 <maven.compiler.target>8</maven.compiler.target>
22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23 <!-- 统一依赖管理 --> 23 <!-- 统一依赖管理 -->
24 - <spring.boot.version>2.7.7</spring.boot.version> 24 + <spring.boot.version>2.7.8</spring.boot.version>
25 </properties> 25 </properties>
26 26
27 <dependencyManagement> 27 <dependencyManagement>
yudao-example/yudao-sso-demo-by-password/pom.xml
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <maven.compiler.target>8</maven.compiler.target> 21 <maven.compiler.target>8</maven.compiler.target>
22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23 <!-- 统一依赖管理 --> 23 <!-- 统一依赖管理 -->
24 - <spring.boot.version>2.7.7</spring.boot.version> 24 + <spring.boot.version>2.7.8</spring.boot.version>
25 </properties> 25 </properties>
26 26
27 <dependencyManagement> 27 <dependencyManagement>
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/util/DataPermissionUtils.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.datapermission.core.util;
  2 +
  3 +import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
  4 +import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder;
  5 +import lombok.SneakyThrows;
  6 +
  7 +/**
  8 + * 数据权限 Util
  9 + *
  10 + * @author 芋道源码
  11 + */
  12 +public class DataPermissionUtils {
  13 +
  14 + private static DataPermission DATA_PERMISSION_DISABLE;
  15 +
  16 + @DataPermission(enable = false)
  17 + @SneakyThrows
  18 + private static DataPermission getDisableDataPermissionDisable() {
  19 + if (DATA_PERMISSION_DISABLE == null) {
  20 + DATA_PERMISSION_DISABLE = DataPermissionUtils.class
  21 + .getDeclaredMethod("getDisableDataPermissionDisable")
  22 + .getAnnotation(DataPermission.class);
  23 + }
  24 + return DATA_PERMISSION_DISABLE;
  25 + }
  26 +
  27 + /**
  28 + * 忽略数据权限,执行对应的逻辑
  29 + *
  30 + * @param runnable 逻辑
  31 + */
  32 + public static void executeIgnore(Runnable runnable) {
  33 + DataPermission dataPermission = getDisableDataPermissionDisable();
  34 + DataPermissionContextHolder.add(dataPermission);
  35 + try {
  36 + // 执行 runnable
  37 + runnable.run();
  38 + } finally {
  39 + DataPermissionContextHolder.remove();
  40 + }
  41 + }
  42 +
  43 +}
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DataPermissionUtilsTest.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.datapermission.core.util;
  2 +
  3 +import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder;
  4 +import org.junit.jupiter.api.Test;
  5 +
  6 +import static org.junit.jupiter.api.Assertions.*;
  7 +
  8 +public class DataPermissionUtilsTest {
  9 +
  10 + @Test
  11 + public void testExecuteIgnore() {
  12 + DataPermissionUtils.executeIgnore(() -> assertFalse(DataPermissionContextHolder.get().enable()));
  13 + }
  14 +
  15 +}
yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/generator/ErrorCodeAutoGeneratorImpl.java
@@ -49,7 +49,7 @@ public class ErrorCodeAutoGeneratorImpl implements ErrorCodeAutoGenerator { @@ -49,7 +49,7 @@ public class ErrorCodeAutoGeneratorImpl implements ErrorCodeAutoGenerator {
49 log.info("[execute][解析到错误码数量为 ({}) 个]", autoGenerateDTOs.size()); 49 log.info("[execute][解析到错误码数量为 ({}) 个]", autoGenerateDTOs.size());
50 50
51 // 第二步,写入到 system 服务 51 // 第二步,写入到 system 服务
52 - errorCodeApi.autoGenerateErrorCodes(autoGenerateDTOs); 52 + errorCodeApi.autoGenerateErrorCodeList(autoGenerateDTOs);
53 log.info("[execute][写入到 system 组件完成]"); 53 log.info("[execute][写入到 system 组件完成]");
54 } 54 }
55 55
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/service/TenantFrameworkServiceImpl.java
@@ -32,7 +32,7 @@ public class TenantFrameworkServiceImpl implements TenantFrameworkService { @@ -32,7 +32,7 @@ public class TenantFrameworkServiceImpl implements TenantFrameworkService {
32 32
33 @Override 33 @Override
34 public List<Long> load(Object key) { 34 public List<Long> load(Object key) {
35 - return tenantApi.getTenantIds(); 35 + return tenantApi.getTenantIdList();
36 } 36 }
37 37
38 }); 38 });
@@ -47,7 +47,7 @@ public class TenantFrameworkServiceImpl implements TenantFrameworkService { @@ -47,7 +47,7 @@ public class TenantFrameworkServiceImpl implements TenantFrameworkService {
47 @Override 47 @Override
48 public ServiceException load(Long id) { 48 public ServiceException load(Long id) {
49 try { 49 try {
50 - tenantApi.validTenant(id); 50 + tenantApi.validateTenant(id);
51 return SERVICE_EXCEPTION_NULL; 51 return SERVICE_EXCEPTION_NULL;
52 } catch (ServiceException ex) { 52 } catch (ServiceException ex) {
53 return ex; 53 return ex;
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java
@@ -50,7 +50,7 @@ public class RandomUtils { @@ -50,7 +50,7 @@ public class RandomUtils {
50 } 50 }
51 // 如果是 type、status 结尾的字段,返回 tinyint 范围 51 // 如果是 type、status 结尾的字段,返回 tinyint 范围
52 if (StrUtil.endWithAnyIgnoreCase(attributeMetadata.getAttributeName(), 52 if (StrUtil.endWithAnyIgnoreCase(attributeMetadata.getAttributeName(),
53 - "type", "status", "category", "scope")) { 53 + "type", "status", "category", "scope", "result")) {
54 return RandomUtil.randomInt(0, TINYINT_MAX + 1); 54 return RandomUtil.randomInt(0, TINYINT_MAX + 1);
55 } 55 }
56 return RandomUtil.randomInt(); 56 return RandomUtil.randomInt();
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImpl.java
@@ -213,18 +213,18 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { @@ -213,18 +213,18 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
213 213
214 private void validTaskAssignRuleOptions(Integer type, Set<Long> options) { 214 private void validTaskAssignRuleOptions(Integer type, Set<Long> options) {
215 if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.ROLE.getType())) { 215 if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.ROLE.getType())) {
216 - roleApi.validRoles(options); 216 + roleApi.validRoleList(options);
217 } else if (ObjectUtils.equalsAny(type, BpmTaskAssignRuleTypeEnum.DEPT_MEMBER.getType(), 217 } else if (ObjectUtils.equalsAny(type, BpmTaskAssignRuleTypeEnum.DEPT_MEMBER.getType(),
218 BpmTaskAssignRuleTypeEnum.DEPT_LEADER.getType())) { 218 BpmTaskAssignRuleTypeEnum.DEPT_LEADER.getType())) {
219 - deptApi.validDepts(options); 219 + deptApi.validateDeptList(options);
220 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.POST.getType())) { 220 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.POST.getType())) {
221 - postApi.validPosts(options); 221 + postApi.validPostList(options);
222 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER.getType())) { 222 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER.getType())) {
223 - adminUserApi.validUsers(options); 223 + adminUserApi.validateUserList(options);
224 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER_GROUP.getType())) { 224 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER_GROUP.getType())) {
225 userGroupService.validUserGroups(options); 225 userGroupService.validUserGroups(options);
226 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.SCRIPT.getType())) { 226 } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.SCRIPT.getType())) {
227 - dictDataApi.validDictDatas(DictTypeConstants.TASK_ASSIGN_SCRIPT, 227 + dictDataApi.validateDictDataList(DictTypeConstants.TASK_ASSIGN_SCRIPT,
228 CollectionUtils.convertSet(options, String::valueOf)); 228 CollectionUtils.convertSet(options, String::valueOf));
229 } else { 229 } else {
230 throw new IllegalArgumentException(format("未知的规则类型({})", type)); 230 throw new IllegalArgumentException(format("未知的规则类型({})", type));
@@ -288,12 +288,12 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { @@ -288,12 +288,12 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
288 } 288 }
289 289
290 private Set<Long> calculateTaskCandidateUsersByDeptMember(BpmTaskAssignRuleDO rule) { 290 private Set<Long> calculateTaskCandidateUsersByDeptMember(BpmTaskAssignRuleDO rule) {
291 - List<AdminUserRespDTO> users = adminUserApi.getUsersByDeptIds(rule.getOptions()); 291 + List<AdminUserRespDTO> users = adminUserApi.getUserListByDeptIds(rule.getOptions());
292 return convertSet(users, AdminUserRespDTO::getId); 292 return convertSet(users, AdminUserRespDTO::getId);
293 } 293 }
294 294
295 private Set<Long> calculateTaskCandidateUsersByDeptLeader(BpmTaskAssignRuleDO rule) { 295 private Set<Long> calculateTaskCandidateUsersByDeptLeader(BpmTaskAssignRuleDO rule) {
296 - List<DeptRespDTO> depts = deptApi.getDepts(rule.getOptions()); 296 + List<DeptRespDTO> depts = deptApi.getDeptList(rule.getOptions());
297 return convertSet(depts, DeptRespDTO::getLeaderUserId); 297 return convertSet(depts, DeptRespDTO::getLeaderUserId);
298 } 298 }
299 299
yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImplTest.java
@@ -86,7 +86,7 @@ public class BpmTaskAssignRuleServiceImplTest extends BaseDbUnitTest { @@ -86,7 +86,7 @@ public class BpmTaskAssignRuleServiceImplTest extends BaseDbUnitTest {
86 // mock 方法 86 // mock 方法
87 List<AdminUserRespDTO> users = CollectionUtils.convertList(asSet(11L, 22L), 87 List<AdminUserRespDTO> users = CollectionUtils.convertList(asSet(11L, 22L),
88 id -> new AdminUserRespDTO().setId(id)); 88 id -> new AdminUserRespDTO().setId(id));
89 - when(adminUserApi.getUsersByDeptIds(eq(rule.getOptions()))).thenReturn(users); 89 + when(adminUserApi.getUserListByDeptIds(eq(rule.getOptions()))).thenReturn(users);
90 mockGetUserMap(asSet(11L, 22L)); 90 mockGetUserMap(asSet(11L, 22L));
91 91
92 // 调用 92 // 调用
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java
1 package cn.iocoder.yudao.module.infra.controller.admin.config; 1 package cn.iocoder.yudao.module.infra.controller.admin.config;
2 2
3 -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;  
4 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
5 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 5 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
@@ -8,7 +7,6 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; @@ -8,7 +7,6 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
8 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*; 7 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*;
9 import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert; 8 import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
10 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; 9 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
11 -import cn.iocoder.yudao.module.infra.service.config.ConfigService;  
12 import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants; 10 import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
13 import io.swagger.v3.oas.annotations.tags.Tag; 11 import io.swagger.v3.oas.annotations.tags.Tag;
14 import io.swagger.v3.oas.annotations.Parameter; 12 import io.swagger.v3.oas.annotations.Parameter;
@@ -23,6 +21,7 @@ import javax.validation.Valid; @@ -23,6 +21,7 @@ import javax.validation.Valid;
23 import java.io.IOException; 21 import java.io.IOException;
24 import java.util.List; 22 import java.util.List;
25 23
  24 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
26 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 25 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
27 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; 26 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
28 27
@@ -76,7 +75,7 @@ public class ConfigController { @@ -76,7 +75,7 @@ public class ConfigController {
76 return null; 75 return null;
77 } 76 }
78 if (!config.getVisible()) { 77 if (!config.getVisible()) {
79 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE); 78 + throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
80 } 79 }
81 return success(config.getValue()); 80 return success(config.getValue());
82 } 81 }
@@ -93,8 +92,8 @@ public class ConfigController { @@ -93,8 +92,8 @@ public class ConfigController {
93 @Operation(summary = "导出参数配置") 92 @Operation(summary = "导出参数配置")
94 @PreAuthorize("@ss.hasPermission('infra:config:export')") 93 @PreAuthorize("@ss.hasPermission('infra:config:export')")
95 @OperateLog(type = EXPORT) 94 @OperateLog(type = EXPORT)
96 - public void exportSysConfig(@Valid ConfigExportReqVO reqVO,  
97 - HttpServletResponse response) throws IOException { 95 + public void exportConfig(@Valid ConfigExportReqVO reqVO,
  96 + HttpServletResponse response) throws IOException {
98 List<ConfigDO> list = configService.getConfigList(reqVO); 97 List<ConfigDO> list = configService.getConfigList(reqVO);
99 // 拼接数据 98 // 拼接数据
100 List<ConfigExcelVO> datas = ConfigConvert.INSTANCE.convertList(list); 99 List<ConfigExcelVO> datas = ConfigConvert.INSTANCE.convertList(list);
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/codegen/CodegenColumnDO.java
@@ -39,27 +39,38 @@ public class CodegenColumnDO extends BaseDO { @@ -39,27 +39,38 @@ public class CodegenColumnDO extends BaseDO {
39 39
40 /** 40 /**
41 * 字段名 41 * 字段名
  42 + *
  43 + * 关联 {@link TableField#getName()}
42 */ 44 */
43 private String columnName; 45 private String columnName;
44 /** 46 /**
45 * 数据库字段类型 47 * 数据库字段类型
  48 + *
46 * 关联 {@link TableField.MetaInfo#getJdbcType()} 49 * 关联 {@link TableField.MetaInfo#getJdbcType()}
47 */ 50 */
48 private String dataType; 51 private String dataType;
49 /** 52 /**
50 * 字段描述 53 * 字段描述
  54 + *
  55 + * 关联 {@link TableField#getComment()}
51 */ 56 */
52 private String columnComment; 57 private String columnComment;
53 /** 58 /**
54 * 是否允许为空 59 * 是否允许为空
  60 + *
  61 + * 关联 {@link TableField.MetaInfo#isNullable()}
55 */ 62 */
56 private Boolean nullable; 63 private Boolean nullable;
57 /** 64 /**
58 * 是否主键 65 * 是否主键
  66 + *
  67 + * 关联 {@link TableField#isKeyFlag()}
59 */ 68 */
60 private Boolean primaryKey; 69 private Boolean primaryKey;
61 /** 70 /**
62 * 是否自增 71 * 是否自增
  72 + *
  73 + * 关联 {@link TableField#isKeyIdentityFlag()}
63 */ 74 */
64 private Boolean autoIncrement; 75 private Boolean autoIncrement;
65 /** 76 /**
@@ -71,12 +82,16 @@ public class CodegenColumnDO extends BaseDO { @@ -71,12 +82,16 @@ public class CodegenColumnDO extends BaseDO {
71 82
72 /** 83 /**
73 * Java 属性类型 84 * Java 属性类型
74 - * <p> 85 + *
75 * 例如说 String、Boolean 等等 86 * 例如说 String、Boolean 等等
  87 + *
  88 + * 关联 {@link TableField#getColumnType()}
76 */ 89 */
77 private String javaType; 90 private String javaType;
78 /** 91 /**
79 * Java 属性名 92 * Java 属性名
  93 + *
  94 + * 关联 {@link TableField#getPropertyName()}
80 */ 95 */
81 private String javaField; 96 private String javaField;
82 /** 97 /**
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/codegen/CodegenTableDO.java
@@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.codegen.CodegenSceneEnum; @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.codegen.CodegenSceneEnum;
6 import cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum; 6 import cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum;
7 import com.baomidou.mybatisplus.annotation.KeySequence; 7 import com.baomidou.mybatisplus.annotation.KeySequence;
8 import com.baomidou.mybatisplus.annotation.TableName; 8 import com.baomidou.mybatisplus.annotation.TableName;
  9 +import com.baomidou.mybatisplus.generator.config.po.TableInfo;
9 import lombok.Data; 10 import lombok.Data;
10 import lombok.EqualsAndHashCode; 11 import lombok.EqualsAndHashCode;
11 import lombok.experimental.Accessors; 12 import lombok.experimental.Accessors;
@@ -44,10 +45,14 @@ public class CodegenTableDO extends BaseDO { @@ -44,10 +45,14 @@ public class CodegenTableDO extends BaseDO {
44 45
45 /** 46 /**
46 * 表名称 47 * 表名称
  48 + *
  49 + * 关联 {@link TableInfo#getName()}
47 */ 50 */
48 private String tableName; 51 private String tableName;
49 /** 52 /**
50 * 表描述 53 * 表描述
  54 + *
  55 + * 关联 {@link TableInfo#getComment()}
51 */ 56 */
52 private String tableComment; 57 private String tableComment;
53 /** 58 /**
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job; @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; 5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
7 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; 7 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; 8 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
@@ -19,24 +19,24 @@ import java.util.List; @@ -19,24 +19,24 @@ import java.util.List;
19 public interface JobLogMapper extends BaseMapperX<JobLogDO> { 19 public interface JobLogMapper extends BaseMapperX<JobLogDO> {
20 20
21 default PageResult<JobLogDO> selectPage(JobLogPageReqVO reqVO) { 21 default PageResult<JobLogDO> selectPage(JobLogPageReqVO reqVO) {
22 - return selectPage(reqVO, new QueryWrapperX<JobLogDO>()  
23 - .eqIfPresent("job_id", reqVO.getJobId())  
24 - .likeIfPresent("handler_name", reqVO.getHandlerName())  
25 - .geIfPresent("begin_time", reqVO.getBeginTime())  
26 - .leIfPresent("end_time", reqVO.getEndTime())  
27 - .eqIfPresent("status", reqVO.getStatus())  
28 - .orderByDesc("id") // ID 倒序 22 + return selectPage(reqVO, new LambdaQueryWrapperX<JobLogDO>()
  23 + .eqIfPresent(JobLogDO::getJobId, reqVO.getJobId())
  24 + .likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName())
  25 + .geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime())
  26 + .leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime())
  27 + .eqIfPresent(JobLogDO::getStatus, reqVO.getStatus())
  28 + .orderByDesc(JobLogDO::getId) // ID 倒序
29 ); 29 );
30 } 30 }
31 31
32 default List<JobLogDO> selectList(JobLogExportReqVO reqVO) { 32 default List<JobLogDO> selectList(JobLogExportReqVO reqVO) {
33 - return selectList(new QueryWrapperX<JobLogDO>()  
34 - .eqIfPresent("job_id", reqVO.getJobId())  
35 - .likeIfPresent("handler_name", reqVO.getHandlerName())  
36 - .geIfPresent("begin_time", reqVO.getBeginTime())  
37 - .leIfPresent("end_time", reqVO.getEndTime())  
38 - .eqIfPresent("status", reqVO.getStatus())  
39 - .orderByDesc("id") // ID 倒序 33 + return selectList(new LambdaQueryWrapperX<JobLogDO>()
  34 + .eqIfPresent(JobLogDO::getJobId, reqVO.getJobId())
  35 + .likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName())
  36 + .geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime())
  37 + .leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime())
  38 + .eqIfPresent(JobLogDO::getStatus, reqVO.getStatus())
  39 + .orderByDesc(JobLogDO::getId) // ID 倒序
40 ); 40 );
41 } 41 }
42 42
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenServiceImpl.java
@@ -76,7 +76,7 @@ public class CodegenServiceImpl implements CodegenService { @@ -76,7 +76,7 @@ public class CodegenServiceImpl implements CodegenService {
76 76
77 private Long createCodegen0(Long userId, Long dataSourceConfigId, TableInfo tableInfo) { 77 private Long createCodegen0(Long userId, Long dataSourceConfigId, TableInfo tableInfo) {
78 // 校验导入的表和字段非空 78 // 校验导入的表和字段非空
79 - checkTableInfo(tableInfo); 79 + validateTableInfo(tableInfo);
80 // 校验是否已经存在 80 // 校验是否已经存在
81 if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(), 81 if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(),
82 dataSourceConfigId) != null) { 82 dataSourceConfigId) != null) {
@@ -100,7 +100,7 @@ public class CodegenServiceImpl implements CodegenService { @@ -100,7 +100,7 @@ public class CodegenServiceImpl implements CodegenService {
100 return table.getId(); 100 return table.getId();
101 } 101 }
102 102
103 - private void checkTableInfo(TableInfo tableInfo) { 103 + private void validateTableInfo(TableInfo tableInfo) {
104 if (tableInfo == null) { 104 if (tableInfo == null) {
105 throw exception(CODEGEN_IMPORT_TABLE_NULL); 105 throw exception(CODEGEN_IMPORT_TABLE_NULL);
106 } 106 }
@@ -149,7 +149,7 @@ public class CodegenServiceImpl implements CodegenService { @@ -149,7 +149,7 @@ public class CodegenServiceImpl implements CodegenService {
149 149
150 private void syncCodegen0(Long tableId, TableInfo tableInfo) { 150 private void syncCodegen0(Long tableId, TableInfo tableInfo) {
151 // 校验导入的表和字段非空 151 // 校验导入的表和字段非空
152 - checkTableInfo(tableInfo); 152 + validateTableInfo(tableInfo);
153 List<TableField> tableFields = tableInfo.getFields(); 153 List<TableField> tableFields = tableInfo.getFields();
154 154
155 // 构建 CodegenColumnDO 数组,只同步新增的字段 155 // 构建 CodegenColumnDO 数组,只同步新增的字段
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java
@@ -9,7 +9,6 @@ import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqV @@ -9,7 +9,6 @@ import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqV
9 import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert; 9 import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
10 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; 10 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
11 import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; 11 import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
12 -import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;  
13 import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; 12 import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum;
14 import com.google.common.annotations.VisibleForTesting; 13 import com.google.common.annotations.VisibleForTesting;
15 import lombok.extern.slf4j.Slf4j; 14 import lombok.extern.slf4j.Slf4j;
@@ -20,6 +19,7 @@ import javax.annotation.Resource; @@ -20,6 +19,7 @@ import javax.annotation.Resource;
20 import java.util.List; 19 import java.util.List;
21 20
22 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 21 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  22 +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
23 23
24 /** 24 /**
25 * 参数配置 Service 实现类 25 * 参数配置 Service 实现类
@@ -35,7 +35,7 @@ public class ConfigServiceImpl implements ConfigService { @@ -35,7 +35,7 @@ public class ConfigServiceImpl implements ConfigService {
35 @Override 35 @Override
36 public Long createConfig(ConfigCreateReqVO reqVO) { 36 public Long createConfig(ConfigCreateReqVO reqVO) {
37 // 校验正确性 37 // 校验正确性
38 - checkCreateOrUpdate(null, reqVO.getKey()); 38 + validateConfigForCreateOrUpdate(null, reqVO.getKey());
39 // 插入参数配置 39 // 插入参数配置
40 ConfigDO config = ConfigConvert.INSTANCE.convert(reqVO); 40 ConfigDO config = ConfigConvert.INSTANCE.convert(reqVO);
41 config.setType(ConfigTypeEnum.CUSTOM.getType()); 41 config.setType(ConfigTypeEnum.CUSTOM.getType());
@@ -46,19 +46,19 @@ public class ConfigServiceImpl implements ConfigService { @@ -46,19 +46,19 @@ public class ConfigServiceImpl implements ConfigService {
46 @Override 46 @Override
47 public void updateConfig(ConfigUpdateReqVO reqVO) { 47 public void updateConfig(ConfigUpdateReqVO reqVO) {
48 // 校验正确性 48 // 校验正确性
49 - checkCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key 49 + validateConfigForCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key
50 // 更新参数配置 50 // 更新参数配置
51 ConfigDO updateObj = ConfigConvert.INSTANCE.convert(reqVO); 51 ConfigDO updateObj = ConfigConvert.INSTANCE.convert(reqVO);
52 - configMapper.updateById(updateObj);; 52 + configMapper.updateById(updateObj);
53 } 53 }
54 54
55 @Override 55 @Override
56 public void deleteConfig(Long id) { 56 public void deleteConfig(Long id) {
57 // 校验配置存在 57 // 校验配置存在
58 - ConfigDO config = checkConfigExists(id); 58 + ConfigDO config = validateConfigExists(id);
59 // 内置配置,不允许删除 59 // 内置配置,不允许删除
60 if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) { 60 if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
61 - throw exception(ErrorCodeConstants.CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE); 61 + throw exception(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
62 } 62 }
63 // 删除 63 // 删除
64 configMapper.deleteById(id); 64 configMapper.deleteById(id);
@@ -84,39 +84,39 @@ public class ConfigServiceImpl implements ConfigService { @@ -84,39 +84,39 @@ public class ConfigServiceImpl implements ConfigService {
84 return configMapper.selectList(reqVO); 84 return configMapper.selectList(reqVO);
85 } 85 }
86 86
87 - private void checkCreateOrUpdate(Long id, String key) { 87 + private void validateConfigForCreateOrUpdate(Long id, String key) {
88 // 校验自己存在 88 // 校验自己存在
89 - checkConfigExists(id); 89 + validateConfigExists(id);
90 // 校验参数配置 key 的唯一性 90 // 校验参数配置 key 的唯一性
91 if (StrUtil.isNotEmpty(key)) { 91 if (StrUtil.isNotEmpty(key)) {
92 - checkConfigKeyUnique(id, key); 92 + validateConfigKeyUnique(id, key);
93 } 93 }
94 } 94 }
95 95
96 @VisibleForTesting 96 @VisibleForTesting
97 - public ConfigDO checkConfigExists(Long id) { 97 + public ConfigDO validateConfigExists(Long id) {
98 if (id == null) { 98 if (id == null) {
99 return null; 99 return null;
100 } 100 }
101 ConfigDO config = configMapper.selectById(id); 101 ConfigDO config = configMapper.selectById(id);
102 if (config == null) { 102 if (config == null) {
103 - throw exception(ErrorCodeConstants.CONFIG_NOT_EXISTS); 103 + throw exception(CONFIG_NOT_EXISTS);
104 } 104 }
105 return config; 105 return config;
106 } 106 }
107 107
108 @VisibleForTesting 108 @VisibleForTesting
109 - public void checkConfigKeyUnique(Long id, String key) { 109 + public void validateConfigKeyUnique(Long id, String key) {
110 ConfigDO config = configMapper.selectByKey(key); 110 ConfigDO config = configMapper.selectByKey(key);
111 if (config == null) { 111 if (config == null) {
112 return; 112 return;
113 } 113 }
114 // 如果 id 为空,说明不用比较是否为相同 id 的参数配置 114 // 如果 id 为空,说明不用比较是否为相同 id 的参数配置
115 if (id == null) { 115 if (id == null) {
116 - throw exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE); 116 + throw exception(CONFIG_KEY_DUPLICATE);
117 } 117 }
118 if (!config.getId().equals(id)) { 118 if (!config.getId().equals(id)) {
119 - throw exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE); 119 + throw exception(CONFIG_KEY_DUPLICATE);
120 } 120 }
121 } 121 }
122 122
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImpl.java
@@ -37,7 +37,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService { @@ -37,7 +37,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
37 @Override 37 @Override
38 public Long createDataSourceConfig(DataSourceConfigCreateReqVO createReqVO) { 38 public Long createDataSourceConfig(DataSourceConfigCreateReqVO createReqVO) {
39 DataSourceConfigDO dataSourceConfig = DataSourceConfigConvert.INSTANCE.convert(createReqVO); 39 DataSourceConfigDO dataSourceConfig = DataSourceConfigConvert.INSTANCE.convert(createReqVO);
40 - checkConnectionOK(dataSourceConfig); 40 + validateConnectionOK(dataSourceConfig);
41 41
42 // 插入 42 // 插入
43 dataSourceConfigMapper.insert(dataSourceConfig); 43 dataSourceConfigMapper.insert(dataSourceConfig);
@@ -50,7 +50,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService { @@ -50,7 +50,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
50 // 校验存在 50 // 校验存在
51 validateDataSourceConfigExists(updateReqVO.getId()); 51 validateDataSourceConfigExists(updateReqVO.getId());
52 DataSourceConfigDO updateObj = DataSourceConfigConvert.INSTANCE.convert(updateReqVO); 52 DataSourceConfigDO updateObj = DataSourceConfigConvert.INSTANCE.convert(updateReqVO);
53 - checkConnectionOK(updateObj); 53 + validateConnectionOK(updateObj);
54 54
55 // 更新 55 // 更新
56 dataSourceConfigMapper.updateById(updateObj); 56 dataSourceConfigMapper.updateById(updateObj);
@@ -88,7 +88,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService { @@ -88,7 +88,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
88 return result; 88 return result;
89 } 89 }
90 90
91 - private void checkConnectionOK(DataSourceConfigDO config) { 91 + private void validateConnectionOK(DataSourceConfigDO config) {
92 boolean success = JdbcUtils.isConnectionOK(config.getUrl(), config.getUsername(), config.getPassword()); 92 boolean success = JdbcUtils.isConnectionOK(config.getUrl(), config.getUsername(), config.getPassword());
93 if (!success) { 93 if (!success) {
94 throw exception(DATA_SOURCE_CONFIG_NOT_OK); 94 throw exception(DATA_SOURCE_CONFIG_NOT_OK);
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImpl.java
@@ -41,7 +41,7 @@ public class DatabaseTableServiceImpl implements DatabaseTableService { @@ -41,7 +41,7 @@ public class DatabaseTableServiceImpl implements DatabaseTableService {
41 return CollUtil.getFirst(getTableList0(dataSourceConfigId, name)); 41 return CollUtil.getFirst(getTableList0(dataSourceConfigId, name));
42 } 42 }
43 43
44 - public List<TableInfo> getTableList0(Long dataSourceConfigId, String name) { 44 + private List<TableInfo> getTableList0(Long dataSourceConfigId, String name) {
45 // 获得数据源配置 45 // 获得数据源配置
46 DataSourceConfigDO config = dataSourceConfigService.getDataSourceConfig(dataSourceConfigId); 46 DataSourceConfigDO config = dataSourceConfigService.getDataSourceConfig(dataSourceConfigId);
47 Assert.notNull(config, "数据源({}) 不存在!", dataSourceConfigId); 47 Assert.notNull(config, "数据源({}) 不存在!", dataSourceConfigId);
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java
@@ -8,8 +8,6 @@ import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigU @@ -8,8 +8,6 @@ import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigU
8 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; 8 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
9 9
10 import javax.validation.Valid; 10 import javax.validation.Valid;
11 -import java.util.Collection;  
12 -import java.util.List;  
13 11
14 /** 12 /**
15 * 文件配置 Service 接口 13 * 文件配置 Service 接口
@@ -61,14 +59,6 @@ public interface FileConfigService { @@ -61,14 +59,6 @@ public interface FileConfigService {
61 FileConfigDO getFileConfig(Long id); 59 FileConfigDO getFileConfig(Long id);
62 60
63 /** 61 /**
64 - * 获得文件配置列表  
65 - *  
66 - * @param ids 编号  
67 - * @return 文件配置列表  
68 - */  
69 - List<FileConfigDO> getFileConfigList(Collection<Long> ids);  
70 -  
71 - /**  
72 * 获得文件配置分页 62 * 获得文件配置分页
73 * 63 *
74 * @param pageReqVO 分页查询 64 * @param pageReqVO 分页查询
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java
@@ -27,7 +27,6 @@ import org.springframework.validation.annotation.Validated; @@ -27,7 +27,6 @@ import org.springframework.validation.annotation.Validated;
27 import javax.annotation.PostConstruct; 27 import javax.annotation.PostConstruct;
28 import javax.annotation.Resource; 28 import javax.annotation.Resource;
29 import javax.validation.Validator; 29 import javax.validation.Validator;
30 -import java.util.Collection;  
31 import java.util.List; 30 import java.util.List;
32 import java.util.Map; 31 import java.util.Map;
33 32
@@ -95,7 +94,7 @@ public class FileConfigServiceImpl implements FileConfigService { @@ -95,7 +94,7 @@ public class FileConfigServiceImpl implements FileConfigService {
95 @Override 94 @Override
96 public void updateFileConfig(FileConfigUpdateReqVO updateReqVO) { 95 public void updateFileConfig(FileConfigUpdateReqVO updateReqVO) {
97 // 校验存在 96 // 校验存在
98 - FileConfigDO config = this.validateFileConfigExists(updateReqVO.getId()); 97 + FileConfigDO config = validateFileConfigExists(updateReqVO.getId());
99 // 更新 98 // 更新
100 FileConfigDO updateObj = FileConfigConvert.INSTANCE.convert(updateReqVO) 99 FileConfigDO updateObj = FileConfigConvert.INSTANCE.convert(updateReqVO)
101 .setConfig(parseClientConfig(config.getStorage(), updateReqVO.getConfig())); 100 .setConfig(parseClientConfig(config.getStorage(), updateReqVO.getConfig()));
@@ -108,7 +107,7 @@ public class FileConfigServiceImpl implements FileConfigService { @@ -108,7 +107,7 @@ public class FileConfigServiceImpl implements FileConfigService {
108 @Transactional(rollbackFor = Exception.class) 107 @Transactional(rollbackFor = Exception.class)
109 public void updateFileConfigMaster(Long id) { 108 public void updateFileConfigMaster(Long id) {
110 // 校验存在 109 // 校验存在
111 - this.validateFileConfigExists(id); 110 + validateFileConfigExists(id);
112 // 更新其它为非 master 111 // 更新其它为非 master
113 fileConfigMapper.updateBatch(new FileConfigDO().setMaster(false)); 112 fileConfigMapper.updateBatch(new FileConfigDO().setMaster(false));
114 // 更新 113 // 更新
@@ -138,7 +137,7 @@ public class FileConfigServiceImpl implements FileConfigService { @@ -138,7 +137,7 @@ public class FileConfigServiceImpl implements FileConfigService {
138 @Override 137 @Override
139 public void deleteFileConfig(Long id) { 138 public void deleteFileConfig(Long id) {
140 // 校验存在 139 // 校验存在
141 - FileConfigDO config = this.validateFileConfigExists(id); 140 + FileConfigDO config = validateFileConfigExists(id);
142 if (Boolean.TRUE.equals(config.getMaster())) { 141 if (Boolean.TRUE.equals(config.getMaster())) {
143 throw exception(FILE_CONFIG_DELETE_FAIL_MASTER); 142 throw exception(FILE_CONFIG_DELETE_FAIL_MASTER);
144 } 143 }
@@ -162,11 +161,6 @@ public class FileConfigServiceImpl implements FileConfigService { @@ -162,11 +161,6 @@ public class FileConfigServiceImpl implements FileConfigService {
162 } 161 }
163 162
164 @Override 163 @Override
165 - public List<FileConfigDO> getFileConfigList(Collection<Long> ids) {  
166 - return fileConfigMapper.selectBatchIds(ids);  
167 - }  
168 -  
169 - @Override  
170 public PageResult<FileConfigDO> getFileConfigPage(FileConfigPageReqVO pageReqVO) { 164 public PageResult<FileConfigDO> getFileConfigPage(FileConfigPageReqVO pageReqVO) {
171 return fileConfigMapper.selectPage(pageReqVO); 165 return fileConfigMapper.selectPage(pageReqVO);
172 } 166 }
@@ -174,7 +168,7 @@ public class FileConfigServiceImpl implements FileConfigService { @@ -174,7 +168,7 @@ public class FileConfigServiceImpl implements FileConfigService {
174 @Override 168 @Override
175 public String testFileConfig(Long id) throws Exception { 169 public String testFileConfig(Long id) throws Exception {
176 // 校验存在 170 // 校验存在
177 - this.validateFileConfigExists(id); 171 + validateFileConfigExists(id);
178 // 上传文件 172 // 上传文件
179 byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); 173 byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
180 return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg", "image/jpeg"); 174 return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg", "image/jpeg");
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java
@@ -69,7 +69,7 @@ public class FileServiceImpl implements FileService { @@ -69,7 +69,7 @@ public class FileServiceImpl implements FileService {
69 @Override 69 @Override
70 public void deleteFile(Long id) throws Exception { 70 public void deleteFile(Long id) throws Exception {
71 // 校验存在 71 // 校验存在
72 - FileDO file = this.validateFileExists(id); 72 + FileDO file = validateFileExists(id);
73 73
74 // 从文件存储器中删除 74 // 从文件存储器中删除
75 FileClient client = fileConfigService.getFileClient(file.getConfigId()); 75 FileClient client = fileConfigService.getFileClient(file.getConfigId());
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java
@@ -69,7 +69,7 @@ public class JobServiceImpl implements JobService { @@ -69,7 +69,7 @@ public class JobServiceImpl implements JobService {
69 public void updateJob(JobUpdateReqVO updateReqVO) throws SchedulerException { 69 public void updateJob(JobUpdateReqVO updateReqVO) throws SchedulerException {
70 validateCronExpression(updateReqVO.getCronExpression()); 70 validateCronExpression(updateReqVO.getCronExpression());
71 // 校验存在 71 // 校验存在
72 - JobDO job = this.validateJobExists(updateReqVO.getId()); 72 + JobDO job = validateJobExists(updateReqVO.getId());
73 // 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行 73 // 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行
74 if (!job.getStatus().equals(JobStatusEnum.NORMAL.getStatus())) { 74 if (!job.getStatus().equals(JobStatusEnum.NORMAL.getStatus())) {
75 throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS); 75 throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS);
@@ -92,7 +92,7 @@ public class JobServiceImpl implements JobService { @@ -92,7 +92,7 @@ public class JobServiceImpl implements JobService {
92 throw exception(JOB_CHANGE_STATUS_INVALID); 92 throw exception(JOB_CHANGE_STATUS_INVALID);
93 } 93 }
94 // 校验存在 94 // 校验存在
95 - JobDO job = this.validateJobExists(id); 95 + JobDO job = validateJobExists(id);
96 // 校验是否已经为当前状态 96 // 校验是否已经为当前状态
97 if (job.getStatus().equals(status)) { 97 if (job.getStatus().equals(status)) {
98 throw exception(JOB_CHANGE_STATUS_EQUALS); 98 throw exception(JOB_CHANGE_STATUS_EQUALS);
@@ -112,7 +112,7 @@ public class JobServiceImpl implements JobService { @@ -112,7 +112,7 @@ public class JobServiceImpl implements JobService {
112 @Override 112 @Override
113 public void triggerJob(Long id) throws SchedulerException { 113 public void triggerJob(Long id) throws SchedulerException {
114 // 校验存在 114 // 校验存在
115 - JobDO job = this.validateJobExists(id); 115 + JobDO job = validateJobExists(id);
116 116
117 // 触发 Quartz 中的 Job 117 // 触发 Quartz 中的 Job
118 schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam()); 118 schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam());
@@ -122,7 +122,7 @@ public class JobServiceImpl implements JobService { @@ -122,7 +122,7 @@ public class JobServiceImpl implements JobService {
122 @Transactional(rollbackFor = Exception.class) 122 @Transactional(rollbackFor = Exception.class)
123 public void deleteJob(Long id) throws SchedulerException { 123 public void deleteJob(Long id) throws SchedulerException {
124 // 校验存在 124 // 校验存在
125 - JobDO job = this.validateJobExists(id); 125 + JobDO job = validateJobExists(id);
126 // 更新 126 // 更新
127 jobMapper.deleteById(id); 127 jobMapper.deleteById(id);
128 128
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.logger; 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;  
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; 4 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; 5 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 @@ -8,7 +7,6 @@ import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiE
8 import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert; 7 import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert;
9 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; 8 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
10 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper; 9 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
11 -import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;  
12 import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum; 10 import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
13 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
14 import org.springframework.validation.annotation.Validated; 12 import org.springframework.validation.annotation.Validated;
@@ -17,6 +15,10 @@ import javax.annotation.Resource; @@ -17,6 +15,10 @@ import javax.annotation.Resource;
17 import java.time.LocalDateTime; 15 import java.time.LocalDateTime;
18 import java.util.List; 16 import java.util.List;
19 17
  18 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  19 +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
  20 +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED;
  21 +
20 /** 22 /**
21 * API 错误日志 Service 实现类 23 * API 错误日志 Service 实现类
22 * 24 *
@@ -31,8 +33,8 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { @@ -31,8 +33,8 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
31 33
32 @Override 34 @Override
33 public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) { 35 public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
34 - ApiErrorLogDO apiErrorLog = ApiErrorLogConvert.INSTANCE.convert(createDTO);  
35 - apiErrorLog.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); 36 + ApiErrorLogDO apiErrorLog = ApiErrorLogConvert.INSTANCE.convert(createDTO)
  37 + .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
36 apiErrorLogMapper.insert(apiErrorLog); 38 apiErrorLogMapper.insert(apiErrorLog);
37 } 39 }
38 40
@@ -50,10 +52,10 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { @@ -50,10 +52,10 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
50 public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) { 52 public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) {
51 ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id); 53 ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id);
52 if (errorLog == null) { 54 if (errorLog == null) {
53 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND); 55 + throw exception(API_ERROR_LOG_NOT_FOUND);
54 } 56 }
55 if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) { 57 if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) {
56 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.API_ERROR_LOG_PROCESSED); 58 + throw exception(API_ERROR_LOG_PROCESSED);
57 } 59 }
58 // 标记处理 60 // 标记处理
59 apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus) 61 apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus)
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/test/TestDemoServiceImpl.java
@@ -45,7 +45,7 @@ public class TestDemoServiceImpl implements TestDemoService { @@ -45,7 +45,7 @@ public class TestDemoServiceImpl implements TestDemoService {
45 @CacheEvict(value = "test", key = "#updateReqVO.id") 45 @CacheEvict(value = "test", key = "#updateReqVO.id")
46 public void updateTestDemo(TestDemoUpdateReqVO updateReqVO) { 46 public void updateTestDemo(TestDemoUpdateReqVO updateReqVO) {
47 // 校验存在 47 // 校验存在
48 - this.validateTestDemoExists(updateReqVO.getId()); 48 + validateTestDemoExists(updateReqVO.getId());
49 // 更新 49 // 更新
50 TestDemoDO updateObj = TestDemoConvert.INSTANCE.convert(updateReqVO); 50 TestDemoDO updateObj = TestDemoConvert.INSTANCE.convert(updateReqVO);
51 testDemoMapper.updateById(updateObj); 51 testDemoMapper.updateById(updateObj);
@@ -55,7 +55,7 @@ public class TestDemoServiceImpl implements TestDemoService { @@ -55,7 +55,7 @@ public class TestDemoServiceImpl implements TestDemoService {
55 @CacheEvict(value = "test", key = "#id") 55 @CacheEvict(value = "test", key = "#id")
56 public void deleteTestDemo(Long id) { 56 public void deleteTestDemo(Long id) {
57 // 校验存在 57 // 校验存在
58 - this.validateTestDemoExists(id); 58 + validateTestDemoExists(id);
59 // 删除 59 // 删除
60 testDemoMapper.deleteById(id); 60 testDemoMapper.deleteById(id);
61 } 61 }
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/service/serviceImpl.vm
@@ -39,7 +39,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service @@ -39,7 +39,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
39 @Override 39 @Override
40 public void update${simpleClassName}(${sceneEnum.prefixClass}${table.className}UpdateReqVO updateReqVO) { 40 public void update${simpleClassName}(${sceneEnum.prefixClass}${table.className}UpdateReqVO updateReqVO) {
41 // 校验存在 41 // 校验存在
42 - this.validate${simpleClassName}Exists(updateReqVO.getId()); 42 + validate${simpleClassName}Exists(updateReqVO.getId());
43 // 更新 43 // 更新
44 ${table.className}DO updateObj = ${table.className}Convert.INSTANCE.convert(updateReqVO); 44 ${table.className}DO updateObj = ${table.className}Convert.INSTANCE.convert(updateReqVO);
45 ${classNameVar}Mapper.updateById(updateObj); 45 ${classNameVar}Mapper.updateById(updateObj);
@@ -48,7 +48,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service @@ -48,7 +48,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
48 @Override 48 @Override
49 public void delete${simpleClassName}(${primaryColumn.javaType} id) { 49 public void delete${simpleClassName}(${primaryColumn.javaType} id) {
50 // 校验存在 50 // 校验存在
51 - this.validate${simpleClassName}Exists(id); 51 + validate${simpleClassName}Exists(id);
52 // 删除 52 // 删除
53 ${classNameVar}Mapper.deleteById(id); 53 ${classNameVar}Mapper.deleteById(id);
54 } 54 }
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm
@@ -52,7 +52,7 @@ import static org.mockito.Mockito.*; @@ -52,7 +52,7 @@ import static org.mockito.Mockito.*;
52 #if (${column.listOperation}) 52 #if (${column.listOperation})
53 #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写 53 #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
54 #if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况 54 #if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况
55 - reqVO.set${JavaField}((new LocalDateTime[]{})); 55 + reqVO.set${JavaField}(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
56 #else 56 #else
57 reqVO.set$JavaField(null); 57 reqVO.set$JavaField(null);
58 #end 58 #end
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceTest.java renamed to yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImplTest.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.config; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.config;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; 4 import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
5 -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;  
6 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
7 import cn.iocoder.yudao.framework.test.core.util.RandomUtils; 6 import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
8 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; 7 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 @@ -12,17 +11,17 @@ import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqV
12 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; 11 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
13 import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; 12 import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
14 import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; 13 import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum;
15 -import org.junit.jupiter.api.Assertions;  
16 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.Test;
17 import org.springframework.context.annotation.Import; 15 import org.springframework.context.annotation.Import;
18 16
19 import javax.annotation.Resource; 17 import javax.annotation.Resource;
20 -import java.time.LocalDateTime;  
21 import java.util.List; 18 import java.util.List;
22 import java.util.function.Consumer; 19 import java.util.function.Consumer;
23 20
24 import static cn.hutool.core.util.RandomUtil.randomEle; 21 import static cn.hutool.core.util.RandomUtil.randomEle;
  22 +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
25 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; 23 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
  24 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
26 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 25 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
27 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; 26 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
28 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; 27 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@@ -30,7 +29,7 @@ import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; @@ -30,7 +29,7 @@ import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
30 import static org.junit.jupiter.api.Assertions.*; 29 import static org.junit.jupiter.api.Assertions.*;
31 30
32 @Import(ConfigServiceImpl.class) 31 @Import(ConfigServiceImpl.class)
33 -public class ConfigServiceTest extends BaseDbUnitTest { 32 +public class ConfigServiceImplTest extends BaseDbUnitTest {
34 33
35 @Resource 34 @Resource
36 private ConfigServiceImpl configService; 35 private ConfigServiceImpl configService;
@@ -50,7 +49,7 @@ public class ConfigServiceTest extends BaseDbUnitTest { @@ -50,7 +49,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
50 // 校验记录的属性是否正确 49 // 校验记录的属性是否正确
51 ConfigDO config = configMapper.selectById(configId); 50 ConfigDO config = configMapper.selectById(configId);
52 assertPojoEquals(reqVO, config); 51 assertPojoEquals(reqVO, config);
53 - Assertions.assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType()); 52 + assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType());
54 } 53 }
55 54
56 @Test 55 @Test
@@ -101,40 +100,40 @@ public class ConfigServiceTest extends BaseDbUnitTest { @@ -101,40 +100,40 @@ public class ConfigServiceTest extends BaseDbUnitTest {
101 } 100 }
102 101
103 @Test 102 @Test
104 - public void testCheckConfigExists_success() { 103 + public void testValidateConfigExists_success() {
105 // mock 数据 104 // mock 数据
106 ConfigDO dbConfigDO = randomConfigDO(); 105 ConfigDO dbConfigDO = randomConfigDO();
107 configMapper.insert(dbConfigDO);// @Sql: 先插入出一条存在的数据 106 configMapper.insert(dbConfigDO);// @Sql: 先插入出一条存在的数据
108 107
109 // 调用成功 108 // 调用成功
110 - configService.checkConfigExists(dbConfigDO.getId()); 109 + configService.validateConfigExists(dbConfigDO.getId());
111 } 110 }
112 111
113 @Test 112 @Test
114 - public void testCheckConfigExist_notExists() {  
115 - assertServiceException(() -> configService.checkConfigExists(randomLongId()), CONFIG_NOT_EXISTS); 113 + public void testValidateConfigExist_notExists() {
  114 + assertServiceException(() -> configService.validateConfigExists(randomLongId()), CONFIG_NOT_EXISTS);
116 } 115 }
117 116
118 @Test 117 @Test
119 - public void testCheckConfigKeyUnique_success() { 118 + public void testValidateConfigKeyUnique_success() {
120 // 调用,成功 119 // 调用,成功
121 - configService.checkConfigKeyUnique(randomLongId(), randomString()); 120 + configService.validateConfigKeyUnique(randomLongId(), randomString());
122 } 121 }
123 122
124 @Test 123 @Test
125 - public void testCheckConfigKeyUnique_keyDuplicateForCreate() { 124 + public void testValidateConfigKeyUnique_keyDuplicateForCreate() {
126 // 准备参数 125 // 准备参数
127 String key = randomString(); 126 String key = randomString();
128 // mock 数据 127 // mock 数据
129 configMapper.insert(randomConfigDO(o -> o.setConfigKey(key))); 128 configMapper.insert(randomConfigDO(o -> o.setConfigKey(key)));
130 129
131 // 调用,校验异常 130 // 调用,校验异常
132 - assertServiceException(() -> configService.checkConfigKeyUnique(null, key), 131 + assertServiceException(() -> configService.validateConfigKeyUnique(null, key),
133 CONFIG_KEY_DUPLICATE); 132 CONFIG_KEY_DUPLICATE);
134 } 133 }
135 134
136 @Test 135 @Test
137 - public void testCheckConfigKeyUnique_keyDuplicateForUpdate() { 136 + public void testValidateConfigKeyUnique_keyDuplicateForUpdate() {
138 // 准备参数 137 // 准备参数
139 Long id = randomLongId(); 138 Long id = randomLongId();
140 String key = randomString(); 139 String key = randomString();
@@ -142,7 +141,7 @@ public class ConfigServiceTest extends BaseDbUnitTest { @@ -142,7 +141,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
142 configMapper.insert(randomConfigDO(o -> o.setConfigKey(key))); 141 configMapper.insert(randomConfigDO(o -> o.setConfigKey(key)));
143 142
144 // 调用,校验异常 143 // 调用,校验异常
145 - assertServiceException(() -> configService.checkConfigKeyUnique(id, key), 144 + assertServiceException(() -> configService.validateConfigKeyUnique(id, key),
146 CONFIG_KEY_DUPLICATE); 145 CONFIG_KEY_DUPLICATE);
147 } 146 }
148 147
@@ -157,19 +156,19 @@ public class ConfigServiceTest extends BaseDbUnitTest { @@ -157,19 +156,19 @@ public class ConfigServiceTest extends BaseDbUnitTest {
157 }); 156 });
158 configMapper.insert(dbConfig); 157 configMapper.insert(dbConfig);
159 // 测试 name 不匹配 158 // 测试 name 不匹配
160 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setName("土豆"))); 159 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setName("土豆")));
161 // 测试 key 不匹配 160 // 测试 key 不匹配
162 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setConfigKey("tudou"))); 161 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setConfigKey("tudou")));
163 // 测试 type 不匹配 162 // 测试 type 不匹配
164 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType()))); 163 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
165 // 测试 createTime 不匹配 164 // 测试 createTime 不匹配
166 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); 165 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
167 // 准备参数 166 // 准备参数
168 ConfigPageReqVO reqVO = new ConfigPageReqVO(); 167 ConfigPageReqVO reqVO = new ConfigPageReqVO();
169 reqVO.setName("艿"); 168 reqVO.setName("艿");
170 reqVO.setKey("nai"); 169 reqVO.setKey("nai");
171 reqVO.setType(ConfigTypeEnum.SYSTEM.getType()); 170 reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
172 - reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)})); 171 + reqVO.setCreateTime(buildBetweenTime(2021, 1, 15, 2021, 2, 15));
173 172
174 // 调用 173 // 调用
175 PageResult<ConfigDO> pageResult = configService.getConfigPage(reqVO); 174 PageResult<ConfigDO> pageResult = configService.getConfigPage(reqVO);
@@ -190,19 +189,19 @@ public class ConfigServiceTest extends BaseDbUnitTest { @@ -190,19 +189,19 @@ public class ConfigServiceTest extends BaseDbUnitTest {
190 }); 189 });
191 configMapper.insert(dbConfig); 190 configMapper.insert(dbConfig);
192 // 测试 name 不匹配 191 // 测试 name 不匹配
193 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setName("土豆"))); 192 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setName("土豆")));
194 // 测试 key 不匹配 193 // 测试 key 不匹配
195 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setConfigKey("tudou"))); 194 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setConfigKey("tudou")));
196 // 测试 type 不匹配 195 // 测试 type 不匹配
197 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType()))); 196 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
198 // 测试 createTime 不匹配 197 // 测试 createTime 不匹配
199 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); 198 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
200 // 准备参数 199 // 准备参数
201 ConfigExportReqVO reqVO = new ConfigExportReqVO(); 200 ConfigExportReqVO reqVO = new ConfigExportReqVO();
202 reqVO.setName("艿"); 201 reqVO.setName("艿");
203 reqVO.setKey("nai"); 202 reqVO.setKey("nai");
204 reqVO.setType(ConfigTypeEnum.SYSTEM.getType()); 203 reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
205 - reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)})); 204 + reqVO.setCreateTime(buildBetweenTime(2021, 1, 15, 2021, 2, 15));
206 205
207 // 调用 206 // 调用
208 List<ConfigDO> list = configService.getConfigList(reqVO); 207 List<ConfigDO> list = configService.getConfigList(reqVO);
@@ -212,6 +211,21 @@ public class ConfigServiceTest extends BaseDbUnitTest { @@ -212,6 +211,21 @@ public class ConfigServiceTest extends BaseDbUnitTest {
212 } 211 }
213 212
214 @Test 213 @Test
  214 + public void testGetConfig() {
  215 + // mock 数据
  216 + ConfigDO dbConfig = randomConfigDO();
  217 + configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据
  218 + // 准备参数
  219 + Long id = dbConfig.getId();
  220 +
  221 + // 调用
  222 + ConfigDO config = configService.getConfig(id);
  223 + // 断言
  224 + assertNotNull(config);
  225 + assertPojoEquals(dbConfig, config);
  226 + }
  227 +
  228 + @Test
215 public void testGetConfigByKey() { 229 public void testGetConfigByKey() {
216 // mock 数据 230 // mock 数据
217 ConfigDO dbConfig = randomConfigDO(); 231 ConfigDO dbConfig = randomConfigDO();
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImplTest.java
1 package cn.iocoder.yudao.module.infra.service.db; 1 package cn.iocoder.yudao.module.infra.service.db;
2 2
  3 +import cn.hutool.core.map.MapUtil;
3 import cn.hutool.core.util.ReflectUtil; 4 import cn.hutool.core.util.ReflectUtil;
4 import cn.hutool.crypto.symmetric.AES; 5 import cn.hutool.crypto.symmetric.AES;
5 import cn.iocoder.yudao.framework.mybatis.core.type.EncryptTypeHandler; 6 import cn.iocoder.yudao.framework.mybatis.core.type.EncryptTypeHandler;
@@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigCrea @@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigCrea
9 import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO; 10 import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO;
10 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO; 11 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
11 import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper; 12 import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
  13 +import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
12 import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties; 14 import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
13 import org.junit.jupiter.api.BeforeEach; 15 import org.junit.jupiter.api.BeforeEach;
14 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.Test;
@@ -18,14 +20,14 @@ import org.springframework.boot.test.mock.mockito.MockBean; @@ -18,14 +20,14 @@ import org.springframework.boot.test.mock.mockito.MockBean;
18 import org.springframework.context.annotation.Import; 20 import org.springframework.context.annotation.Import;
19 21
20 import javax.annotation.Resource; 22 import javax.annotation.Resource;
  23 +import java.util.List;
21 24
22 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 25 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
23 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; 26 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
24 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; 27 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
25 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; 28 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
26 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS; 29 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS;
27 -import static org.junit.jupiter.api.Assertions.assertNotNull;  
28 -import static org.junit.jupiter.api.Assertions.assertNull; 30 +import static org.junit.jupiter.api.Assertions.*;
29 import static org.mockito.ArgumentMatchers.anyString; 31 import static org.mockito.ArgumentMatchers.anyString;
30 import static org.mockito.ArgumentMatchers.eq; 32 import static org.mockito.ArgumentMatchers.eq;
31 import static org.mockito.Mockito.mockStatic; 33 import static org.mockito.Mockito.mockStatic;
@@ -57,6 +59,11 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest { @@ -57,6 +59,11 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
57 ReflectUtil.setFieldValue(EncryptTypeHandler.class, "aes", aes); 59 ReflectUtil.setFieldValue(EncryptTypeHandler.class, "aes", aes);
58 when(aes.encryptBase64(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0)); 60 when(aes.encryptBase64(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
59 when(aes.decryptStr(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0)); 61 when(aes.decryptStr(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
  62 +
  63 + // mock DynamicDataSourceProperties
  64 + when(dynamicDataSourceProperties.getPrimary()).thenReturn("primary");
  65 + when(dynamicDataSourceProperties.getDatasource()).thenReturn(MapUtil.of("primary",
  66 + new DataSourceProperty().setUrl("http://localhost:3306").setUsername("yunai").setPassword("tudou")));
60 } 67 }
61 68
62 @Test 69 @Test
@@ -89,7 +96,6 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest { @@ -89,7 +96,6 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
89 o.setId(dbDataSourceConfig.getId()); // 设置更新的 ID 96 o.setId(dbDataSourceConfig.getId()); // 设置更新的 ID
90 }); 97 });
91 // mock 方法 98 // mock 方法
92 -// when(stringEncryptor.encrypt(eq(reqVO.getPassword()))).thenReturn("123456");  
93 databaseUtilsMock.when(() -> JdbcUtils.isConnectionOK(eq(reqVO.getUrl()), 99 databaseUtilsMock.when(() -> JdbcUtils.isConnectionOK(eq(reqVO.getUrl()),
94 eq(reqVO.getUsername()), eq(reqVO.getPassword()))).thenReturn(true); 100 eq(reqVO.getUsername()), eq(reqVO.getPassword()))).thenReturn(true);
95 101
@@ -142,7 +148,58 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest { @@ -142,7 +148,58 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
142 // 调用 148 // 调用
143 DataSourceConfigDO result = dataSourceConfigMapper.selectOne(DataSourceConfigDO::getPassword, 149 DataSourceConfigDO result = dataSourceConfigMapper.selectOne(DataSourceConfigDO::getPassword,
144 EncryptTypeHandler.encrypt(dbDataSourceConfig.getPassword())); 150 EncryptTypeHandler.encrypt(dbDataSourceConfig.getPassword()));
145 - System.out.println(result); 151 + assertPojoEquals(dbDataSourceConfig, result);
  152 + }
  153 +
  154 + @Test
  155 + public void testGetDataSourceConfig_master() {
  156 + // 准备参数
  157 + Long id = 0L;
  158 + // mock 方法
  159 +
  160 + // 调用
  161 + DataSourceConfigDO dataSourceConfig = dataSourceConfigService.getDataSourceConfig(id);
  162 + // 断言
  163 + assertEquals(id, dataSourceConfig.getId());
  164 + assertEquals("primary", dataSourceConfig.getName());
  165 + assertEquals("http://localhost:3306", dataSourceConfig.getUrl());
  166 + assertEquals("yunai", dataSourceConfig.getUsername());
  167 + assertEquals("tudou", dataSourceConfig.getPassword());
  168 + }
  169 +
  170 + @Test
  171 + public void testGetDataSourceConfig_normal() {
  172 + // mock 数据
  173 + DataSourceConfigDO dbDataSourceConfig = randomPojo(DataSourceConfigDO.class);
  174 + dataSourceConfigMapper.insert(dbDataSourceConfig);// @Sql: 先插入出一条存在的数据
  175 + // 准备参数
  176 + Long id = dbDataSourceConfig.getId();
  177 +
  178 + // 调用
  179 + DataSourceConfigDO dataSourceConfig = dataSourceConfigService.getDataSourceConfig(id);
  180 + // 断言
  181 + assertPojoEquals(dbDataSourceConfig, dataSourceConfig);
  182 + }
  183 +
  184 + @Test
  185 + public void testGetDataSourceConfigList() {
  186 + // mock 数据
  187 + DataSourceConfigDO dbDataSourceConfig = randomPojo(DataSourceConfigDO.class);
  188 + dataSourceConfigMapper.insert(dbDataSourceConfig);// @Sql: 先插入出一条存在的数据
  189 + // 准备参数
  190 +
  191 + // 调用
  192 + List<DataSourceConfigDO> dataSourceConfigList = dataSourceConfigService.getDataSourceConfigList();
  193 + // 断言
  194 + assertEquals(2, dataSourceConfigList.size());
  195 + // master
  196 + assertEquals(0L, dataSourceConfigList.get(0).getId());
  197 + assertEquals("primary", dataSourceConfigList.get(0).getName());
  198 + assertEquals("http://localhost:3306", dataSourceConfigList.get(0).getUrl());
  199 + assertEquals("yunai", dataSourceConfigList.get(0).getUsername());
  200 + assertEquals("tudou", dataSourceConfigList.get(0).getPassword());
  201 + // normal
  202 + assertPojoEquals(dbDataSourceConfig, dataSourceConfigList.get(1));
146 } 203 }
147 204
148 } 205 }
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImplTest.java 0 → 100644
  1 +package cn.iocoder.yudao.module.infra.service.db;
  2 +
  3 +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
  4 +import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
  5 +import com.baomidou.mybatisplus.generator.config.po.TableField;
  6 +import com.baomidou.mybatisplus.generator.config.po.TableInfo;
  7 +import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
  8 +import org.apache.ibatis.type.JdbcType;
  9 +import org.junit.jupiter.api.Test;
  10 +import org.springframework.boot.test.mock.mockito.MockBean;
  11 +import org.springframework.context.annotation.Import;
  12 +
  13 +import javax.annotation.Resource;
  14 +import java.util.List;
  15 +
  16 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
  17 +import static org.junit.jupiter.api.Assertions.*;
  18 +import static org.mockito.ArgumentMatchers.eq;
  19 +import static org.mockito.Mockito.when;
  20 +
  21 +@Import(DatabaseTableServiceImpl.class)
  22 +public class DatabaseTableServiceImplTest extends BaseDbUnitTest {
  23 +
  24 + @Resource
  25 + private DatabaseTableServiceImpl databaseTableService;
  26 +
  27 + @MockBean
  28 + private DataSourceConfigService dataSourceConfigService;
  29 +
  30 + @Test
  31 + public void testGetTableList() {
  32 + // 准备参数
  33 + Long dataSourceConfigId = randomLongId();
  34 + // mock 方法
  35 + DataSourceConfigDO dataSourceConfig = new DataSourceConfigDO().setUsername("sa").setPassword("")
  36 + .setUrl("jdbc:h2:mem:testdb");
  37 + when(dataSourceConfigService.getDataSourceConfig(eq(dataSourceConfigId)))
  38 + .thenReturn(dataSourceConfig);
  39 +
  40 + // 调用
  41 + List<TableInfo> tables = databaseTableService.getTableList(dataSourceConfigId,
  42 + "config", "参数");
  43 + // 断言
  44 + assertEquals(1, tables.size());
  45 + assertTableInfo(tables.get(0));
  46 + }
  47 +
  48 + @Test
  49 + public void testGetTable() {
  50 + // 准备参数
  51 + Long dataSourceConfigId = randomLongId();
  52 + // mock 方法
  53 + DataSourceConfigDO dataSourceConfig = new DataSourceConfigDO().setUsername("sa").setPassword("")
  54 + .setUrl("jdbc:h2:mem:testdb");
  55 + when(dataSourceConfigService.getDataSourceConfig(eq(dataSourceConfigId)))
  56 + .thenReturn(dataSourceConfig);
  57 +
  58 + // 调用
  59 + TableInfo tableInfo = databaseTableService.getTable(dataSourceConfigId, "infra_config");
  60 + // 断言
  61 + assertTableInfo(tableInfo);
  62 + }
  63 +
  64 + private void assertTableInfo(TableInfo tableInfo) {
  65 + assertEquals("infra_config", tableInfo.getName());
  66 + assertEquals("参数配置表", tableInfo.getComment());
  67 + assertEquals(13, tableInfo.getFields().size());
  68 + // id 字段
  69 + TableField idField = tableInfo.getFields().get(0);
  70 + assertEquals("id", idField.getName());
  71 + assertEquals(JdbcType.BIGINT, idField.getMetaInfo().getJdbcType());
  72 + assertEquals("编号", idField.getComment());
  73 + assertFalse(idField.getMetaInfo().isNullable());
  74 + assertTrue(idField.isKeyFlag());
  75 + assertTrue(idField.isKeyIdentityFlag());
  76 + assertEquals(DbColumnType.LONG, idField.getColumnType());
  77 + assertEquals("id", idField.getPropertyName());
  78 + // name 字段
  79 + TableField nameField = tableInfo.getFields().get(3);
  80 + assertEquals("name", nameField.getName());
  81 + assertEquals(JdbcType.VARCHAR, nameField.getMetaInfo().getJdbcType());
  82 + assertEquals("名字", nameField.getComment());
  83 + assertFalse(nameField.getMetaInfo().isNullable());
  84 + assertFalse(nameField.isKeyFlag());
  85 + assertFalse(nameField.isKeyIdentityFlag());
  86 + assertEquals(DbColumnType.STRING, nameField.getColumnType());
  87 + assertEquals("name", nameField.getPropertyName());
  88 + }
  89 +}
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
7 import cn.iocoder.yudao.framework.file.core.client.FileClient; 7 import cn.iocoder.yudao.framework.file.core.client.FileClient;
8 import cn.iocoder.yudao.framework.file.core.client.FileClientConfig; 8 import cn.iocoder.yudao.framework.file.core.client.FileClientConfig;
9 import cn.iocoder.yudao.framework.file.core.client.FileClientFactory; 9 import cn.iocoder.yudao.framework.file.core.client.FileClientFactory;
  10 +import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClient;
10 import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClientConfig; 11 import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClientConfig;
11 import cn.iocoder.yudao.framework.file.core.enums.FileStorageEnum; 12 import cn.iocoder.yudao.framework.file.core.enums.FileStorageEnum;
12 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 13 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
@@ -242,6 +243,30 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { @@ -242,6 +243,30 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
242 assertEquals("https://www.iocoder.cn", fileConfigService.testFileConfig(id)); 243 assertEquals("https://www.iocoder.cn", fileConfigService.testFileConfig(id));
243 } 244 }
244 245
  246 + @Test
  247 + public void testGetFileConfig() {
  248 + // mock 数据
  249 + FileConfigDO dbFileConfig = randomFileConfigDO().setMaster(false);
  250 + fileConfigMapper.insert(dbFileConfig);// @Sql: 先插入出一条存在的数据
  251 + // 准备参数
  252 + Long id = dbFileConfig.getId();
  253 +
  254 + // 调用,并断言
  255 + assertPojoEquals(dbFileConfig, fileConfigService.getFileConfig(id));
  256 + }
  257 +
  258 + @Test
  259 + public void testGetFileClient() {
  260 + // 准备参数
  261 + Long id = randomLongId();
  262 + // mock 获得 Client
  263 + FileClient fileClient = new LocalFileClient(id, new LocalFileClientConfig());
  264 + when(fileClientFactory.getFileClient(eq(id))).thenReturn(fileClient);
  265 +
  266 + // 调用,并断言
  267 + assertSame(fileClient, fileConfigService.getFileClient(id));
  268 + }
  269 +
245 private FileConfigDO randomFileConfigDO() { 270 private FileConfigDO randomFileConfigDO() {
246 return randomPojo(FileConfigDO.class).setStorage(randomEle(FileStorageEnum.values()).getStorage()) 271 return randomPojo(FileConfigDO.class).setStorage(randomEle(FileStorageEnum.values()).getStorage())
247 .setConfig(new EmptyFileClientConfig()); 272 .setConfig(new EmptyFileClientConfig());
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java renamed to yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImplTest.java
@@ -26,7 +26,7 @@ import static org.mockito.ArgumentMatchers.same; @@ -26,7 +26,7 @@ import static org.mockito.ArgumentMatchers.same;
26 import static org.mockito.Mockito.*; 26 import static org.mockito.Mockito.*;
27 27
28 @Import({FileServiceImpl.class}) 28 @Import({FileServiceImpl.class})
29 -public class FileServiceTest extends BaseDbUnitTest { 29 +public class FileServiceImplTest extends BaseDbUnitTest {
30 30
31 @Resource 31 @Resource
32 private FileService fileService; 32 private FileService fileService;
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceTest.java renamed to yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImplTest.java
1 package cn.iocoder.yudao.module.infra.service.job; 1 package cn.iocoder.yudao.module.infra.service.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;  
5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 4 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; 5 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
7 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
@@ -12,18 +11,20 @@ import org.junit.jupiter.api.Test; @@ -12,18 +11,20 @@ import org.junit.jupiter.api.Test;
12 import org.springframework.context.annotation.Import; 11 import org.springframework.context.annotation.Import;
13 12
14 import javax.annotation.Resource; 13 import javax.annotation.Resource;
15 -import java.util.ArrayList; 14 +import java.time.LocalDateTime;
  15 +import java.util.Collection;
16 import java.util.List; 16 import java.util.List;
17 17
18 -import static cn.hutool.core.util.RandomUtil.randomEle;  
19 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; 18 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
  19 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
20 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 20 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
21 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; 21 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
  22 +import static java.util.Collections.singleton;
22 import static org.junit.jupiter.api.Assertions.assertEquals; 23 import static org.junit.jupiter.api.Assertions.assertEquals;
23 import static org.junit.jupiter.api.Assertions.assertNotNull; 24 import static org.junit.jupiter.api.Assertions.assertNotNull;
24 25
25 @Import(JobLogServiceImpl.class) 26 @Import(JobLogServiceImpl.class)
26 -public class JobLogServiceTest extends BaseDbUnitTest { 27 +public class JobLogServiceImplTest extends BaseDbUnitTest {
27 28
28 @Resource 29 @Resource
29 private JobLogServiceImpl jobLogService; 30 private JobLogServiceImpl jobLogService;
@@ -31,66 +32,103 @@ public class JobLogServiceTest extends BaseDbUnitTest { @@ -31,66 +32,103 @@ public class JobLogServiceTest extends BaseDbUnitTest {
31 private JobLogMapper jobLogMapper; 32 private JobLogMapper jobLogMapper;
32 33
33 @Test 34 @Test
34 - public void testCreateJobLog_success() { 35 + public void testCreateJobLog() {
35 // 准备参数 36 // 准备参数
36 - JobLogDO reqVO = randomPojo(JobLogDO.class, o -> {  
37 - o.setExecuteIndex(1);  
38 - }); 37 + JobLogDO reqVO = randomPojo(JobLogDO.class, o -> o.setExecuteIndex(1));
  38 +
39 // 调用 39 // 调用
40 - Long jobLogId = jobLogService.createJobLog(reqVO.getJobId(), reqVO.getBeginTime(), reqVO.getHandlerName(), reqVO.getHandlerParam(), reqVO.getExecuteIndex()); 40 + Long id = jobLogService.createJobLog(reqVO.getJobId(), reqVO.getBeginTime(),
  41 + reqVO.getHandlerName(), reqVO.getHandlerParam(), reqVO.getExecuteIndex());
41 // 断言 42 // 断言
42 - assertNotNull(jobLogId); 43 + assertNotNull(id);
43 // 校验记录的属性是否正确 44 // 校验记录的属性是否正确
44 - JobLogDO job = jobLogMapper.selectById(jobLogId); 45 + JobLogDO job = jobLogMapper.selectById(id);
45 assertEquals(JobLogStatusEnum.RUNNING.getStatus(), job.getStatus()); 46 assertEquals(JobLogStatusEnum.RUNNING.getStatus(), job.getStatus());
46 } 47 }
47 48
48 @Test 49 @Test
49 public void testUpdateJobLogResultAsync_success() { 50 public void testUpdateJobLogResultAsync_success() {
50 - // 准备参数  
51 - JobLogDO reqVO = randomPojo(JobLogDO.class, o -> { 51 + // mock 数据
  52 + JobLogDO log = randomPojo(JobLogDO.class, o -> {
52 o.setExecuteIndex(1); 53 o.setExecuteIndex(1);
  54 + o.setStatus(JobLogStatusEnum.RUNNING.getStatus());
53 }); 55 });
54 - JobLogDO log = JobLogDO.builder().jobId(reqVO.getJobId()).handlerName(reqVO.getHandlerName()).handlerParam(reqVO.getHandlerParam()).executeIndex(reqVO.getExecuteIndex())  
55 - .beginTime(reqVO.getBeginTime()).status(JobLogStatusEnum.RUNNING.getStatus()).build();  
56 jobLogMapper.insert(log); 56 jobLogMapper.insert(log);
57 - // 调用  
58 - jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), true,reqVO.getResult());  
59 - // 校验记录的属性是否正确  
60 - JobLogDO job = jobLogMapper.selectById(log.getId());  
61 - assertEquals(JobLogStatusEnum.SUCCESS.getStatus(), job.getStatus()); 57 + // 准备参数
  58 + Long logId = log.getId();
  59 + LocalDateTime endTime = randomLocalDateTime();
  60 + Integer duration = randomInteger();
  61 + boolean success = true;
  62 + String result = randomString();
62 63
63 // 调用 64 // 调用
64 - jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), false,reqVO.getResult()); 65 + jobLogService.updateJobLogResultAsync(logId, endTime, duration, success, result);
65 // 校验记录的属性是否正确 66 // 校验记录的属性是否正确
66 - JobLogDO job2 = jobLogMapper.selectById(log.getId());  
67 - assertEquals(JobLogStatusEnum.FAILURE.getStatus(), job2.getStatus()); 67 + JobLogDO dbLog = jobLogMapper.selectById(log.getId());
  68 + assertEquals(endTime, dbLog.getEndTime());
  69 + assertEquals(duration, dbLog.getDuration());
  70 + assertEquals(JobLogStatusEnum.SUCCESS.getStatus(), dbLog.getStatus());
  71 + assertEquals(result, dbLog.getResult());
68 } 72 }
69 73
70 @Test 74 @Test
71 - public void testGetJobLogListByIds_success() { 75 + public void testUpdateJobLogResultAsync_failure() {
72 // mock 数据 76 // mock 数据
73 - JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { 77 + JobLogDO log = randomPojo(JobLogDO.class, o -> {
74 o.setExecuteIndex(1); 78 o.setExecuteIndex(1);
75 - o.setStatus(randomEle(JobLogStatusEnum.values()).getStatus()); // 保证 status 的范围 79 + o.setStatus(JobLogStatusEnum.RUNNING.getStatus());
76 }); 80 });
77 - JobLogDO cloneJobLog = ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())); 81 + jobLogMapper.insert(log);
  82 + // 准备参数
  83 + Long logId = log.getId();
  84 + LocalDateTime endTime = randomLocalDateTime();
  85 + Integer duration = randomInteger();
  86 + boolean success = false;
  87 + String result = randomString();
  88 +
  89 + // 调用
  90 + jobLogService.updateJobLogResultAsync(logId, endTime, duration, success, result);
  91 + // 校验记录的属性是否正确
  92 + JobLogDO dbLog = jobLogMapper.selectById(log.getId());
  93 + assertEquals(endTime, dbLog.getEndTime());
  94 + assertEquals(duration, dbLog.getDuration());
  95 + assertEquals(JobLogStatusEnum.FAILURE.getStatus(), dbLog.getStatus());
  96 + assertEquals(result, dbLog.getResult());
  97 + }
  98 +
  99 + @Test
  100 + public void testGetJobLog() {
  101 + // mock 数据
  102 + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> o.setExecuteIndex(1));
  103 + jobLogMapper.insert(dbJobLog);
  104 + // 准备参数
  105 + Long id = dbJobLog.getId();
  106 +
  107 + // 调用
  108 + JobLogDO jobLog = jobLogService.getJobLog(id);
  109 + // 断言
  110 + assertPojoEquals(dbJobLog, jobLog);
  111 + }
  112 +
  113 + @Test
  114 + public void testGetJobLogList() {
  115 + // mock 数据
  116 + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> o.setExecuteIndex(1));
78 jobLogMapper.insert(dbJobLog); 117 jobLogMapper.insert(dbJobLog);
79 // 测试 handlerName 不匹配 118 // 测试 handlerName 不匹配
80 - jobLogMapper.insert(cloneJobLog); 119 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> {}));
81 // 准备参数 120 // 准备参数
82 - ArrayList ids = new ArrayList<>();  
83 - ids.add(dbJobLog.getId());  
84 - ids.add(cloneJobLog.getId()); 121 + Collection<Long> ids = singleton(dbJobLog.getId());
  122 +
85 // 调用 123 // 调用
86 List<JobLogDO> list = jobLogService.getJobLogList(ids); 124 List<JobLogDO> list = jobLogService.getJobLogList(ids);
87 // 断言 125 // 断言
88 - assertEquals(2, list.size()); 126 + assertEquals(1, list.size());
89 assertPojoEquals(dbJobLog, list.get(0)); 127 assertPojoEquals(dbJobLog, list.get(0));
90 } 128 }
91 129
92 @Test 130 @Test
93 - public void testGetJobPage_success() { 131 + public void testGetJobPage() {
94 // mock 数据 132 // mock 数据
95 JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { 133 JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> {
96 o.setExecuteIndex(1); 134 o.setExecuteIndex(1);
@@ -101,15 +139,15 @@ public class JobLogServiceTest extends BaseDbUnitTest { @@ -101,15 +139,15 @@ public class JobLogServiceTest extends BaseDbUnitTest {
101 }); 139 });
102 jobLogMapper.insert(dbJobLog); 140 jobLogMapper.insert(dbJobLog);
103 // 测试 jobId 不匹配 141 // 测试 jobId 不匹配
104 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setJobId(randomLongId()))); 142 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setJobId(randomLongId())));
105 // 测试 handlerName 不匹配 143 // 测试 handlerName 不匹配
106 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString()))); 144 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
107 // 测试 beginTime 不匹配 145 // 测试 beginTime 不匹配
108 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7)))); 146 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
109 // 测试 endTime 不匹配 147 // 测试 endTime 不匹配
110 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); 148 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
111 // 测试 status 不匹配 149 // 测试 status 不匹配
112 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus()))); 150 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
113 // 准备参数 151 // 准备参数
114 JobLogPageReqVO reqVo = new JobLogPageReqVO(); 152 JobLogPageReqVO reqVo = new JobLogPageReqVO();
115 reqVo.setJobId(dbJobLog.getJobId()); 153 reqVo.setJobId(dbJobLog.getJobId());
@@ -117,6 +155,7 @@ public class JobLogServiceTest extends BaseDbUnitTest { @@ -117,6 +155,7 @@ public class JobLogServiceTest extends BaseDbUnitTest {
117 reqVo.setBeginTime(dbJobLog.getBeginTime()); 155 reqVo.setBeginTime(dbJobLog.getBeginTime());
118 reqVo.setEndTime(dbJobLog.getEndTime()); 156 reqVo.setEndTime(dbJobLog.getEndTime());
119 reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); 157 reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
  158 +
120 // 调用 159 // 调用
121 PageResult<JobLogDO> pageResult = jobLogService.getJobLogPage(reqVo); 160 PageResult<JobLogDO> pageResult = jobLogService.getJobLogPage(reqVo);
122 // 断言 161 // 断言
@@ -126,7 +165,7 @@ public class JobLogServiceTest extends BaseDbUnitTest { @@ -126,7 +165,7 @@ public class JobLogServiceTest extends BaseDbUnitTest {
126 } 165 }
127 166
128 @Test 167 @Test
129 - public void testGetJobListForExport_success() { 168 + public void testGetJobList_export() {
130 // mock 数据 169 // mock 数据
131 JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { 170 JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> {
132 o.setExecuteIndex(1); 171 o.setExecuteIndex(1);
@@ -137,15 +176,15 @@ public class JobLogServiceTest extends BaseDbUnitTest { @@ -137,15 +176,15 @@ public class JobLogServiceTest extends BaseDbUnitTest {
137 }); 176 });
138 jobLogMapper.insert(dbJobLog); 177 jobLogMapper.insert(dbJobLog);
139 // 测试 jobId 不匹配 178 // 测试 jobId 不匹配
140 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setJobId(randomLongId()))); 179 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setJobId(randomLongId())));
141 // 测试 handlerName 不匹配 180 // 测试 handlerName 不匹配
142 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString()))); 181 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
143 // 测试 beginTime 不匹配 182 // 测试 beginTime 不匹配
144 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7)))); 183 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
145 // 测试 endTime 不匹配 184 // 测试 endTime 不匹配
146 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); 185 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
147 // 测试 status 不匹配 186 // 测试 status 不匹配
148 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus()))); 187 + jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
149 // 准备参数 188 // 准备参数
150 JobLogExportReqVO reqVo = new JobLogExportReqVO(); 189 JobLogExportReqVO reqVo = new JobLogExportReqVO();
151 reqVo.setJobId(dbJobLog.getJobId()); 190 reqVo.setJobId(dbJobLog.getJobId());
@@ -153,6 +192,7 @@ public class JobLogServiceTest extends BaseDbUnitTest { @@ -153,6 +192,7 @@ public class JobLogServiceTest extends BaseDbUnitTest {
153 reqVo.setBeginTime(dbJobLog.getBeginTime()); 192 reqVo.setBeginTime(dbJobLog.getBeginTime());
154 reqVo.setEndTime(dbJobLog.getEndTime()); 193 reqVo.setEndTime(dbJobLog.getEndTime());
155 reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); 194 reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
  195 +
156 // 调用 196 // 调用
157 List<JobLogDO> list = jobLogService.getJobLogList(reqVo); 197 List<JobLogDO> list = jobLogService.getJobLogList(reqVo);
158 // 断言 198 // 断言
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobServiceTest.java renamed to yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImplTest.java
1 package cn.iocoder.yudao.module.infra.service.job; 1 package cn.iocoder.yudao.module.infra.service.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;  
5 import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; 4 import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager;
6 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
7 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;
8 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO; 7 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;
9 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; 8 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
10 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; 9 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO;
11 -import cn.iocoder.yudao.module.infra.convert.job.JobConvert;  
12 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; 10 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
13 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper; 11 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper;
14 import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; 12 import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum;
@@ -18,22 +16,23 @@ import org.springframework.boot.test.mock.mockito.MockBean; @@ -18,22 +16,23 @@ import org.springframework.boot.test.mock.mockito.MockBean;
18 import org.springframework.context.annotation.Import; 16 import org.springframework.context.annotation.Import;
19 17
20 import javax.annotation.Resource; 18 import javax.annotation.Resource;
21 -import java.util.ArrayList; 19 +import java.util.Collection;
22 import java.util.List; 20 import java.util.List;
23 21
24 import static cn.hutool.core.util.RandomUtil.randomEle; 22 import static cn.hutool.core.util.RandomUtil.randomEle;
  23 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
25 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 24 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
26 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; 25 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
27 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; 26 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
28 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; 27 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString;
29 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; 28 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
  29 +import static java.util.Collections.singletonList;
30 import static org.junit.jupiter.api.Assertions.*; 30 import static org.junit.jupiter.api.Assertions.*;
31 import static org.mockito.ArgumentMatchers.eq; 31 import static org.mockito.ArgumentMatchers.eq;
32 -import static org.mockito.Mockito.times;  
33 import static org.mockito.Mockito.verify; 32 import static org.mockito.Mockito.verify;
34 33
35 @Import(JobServiceImpl.class) 34 @Import(JobServiceImpl.class)
36 -public class JobServiceTest extends BaseDbUnitTest { 35 +public class JobServiceImplTest extends BaseDbUnitTest {
37 36
38 @Resource 37 @Resource
39 private JobServiceImpl jobService; 38 private JobServiceImpl jobService;
@@ -46,6 +45,7 @@ public class JobServiceTest extends BaseDbUnitTest { @@ -46,6 +45,7 @@ public class JobServiceTest extends BaseDbUnitTest {
46 public void testCreateJob_cronExpressionValid() { 45 public void testCreateJob_cronExpressionValid() {
47 // 准备参数。Cron 表达式为 String 类型,默认随机字符串。 46 // 准备参数。Cron 表达式为 String 类型,默认随机字符串。
48 JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class); 47 JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class);
  48 +
49 // 调用,并断言异常 49 // 调用,并断言异常
50 assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID); 50 assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID);
51 } 51 }
@@ -54,6 +54,7 @@ public class JobServiceTest extends BaseDbUnitTest { @@ -54,6 +54,7 @@ public class JobServiceTest extends BaseDbUnitTest {
54 public void testCreateJob_jobHandlerExists() throws SchedulerException { 54 public void testCreateJob_jobHandlerExists() throws SchedulerException {
55 // 准备参数 指定 Cron 表达式 55 // 准备参数 指定 Cron 表达式
56 JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); 56 JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
  57 +
57 // 调用 58 // 调用
58 jobService.createJob(reqVO); 59 jobService.createJob(reqVO);
59 // 调用,并断言异常 60 // 调用,并断言异常
@@ -64,6 +65,7 @@ public class JobServiceTest extends BaseDbUnitTest { @@ -64,6 +65,7 @@ public class JobServiceTest extends BaseDbUnitTest {
64 public void testCreateJob_success() throws SchedulerException { 65 public void testCreateJob_success() throws SchedulerException {
65 // 准备参数 指定 Cron 表达式 66 // 准备参数 指定 Cron 表达式
66 JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); 67 JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
  68 +
67 // 调用 69 // 调用
68 Long jobId = jobService.createJob(reqVO); 70 Long jobId = jobService.createJob(reqVO);
69 // 断言 71 // 断言
@@ -73,14 +75,15 @@ public class JobServiceTest extends BaseDbUnitTest { @@ -73,14 +75,15 @@ public class JobServiceTest extends BaseDbUnitTest {
73 assertPojoEquals(reqVO, job); 75 assertPojoEquals(reqVO, job);
74 assertEquals(JobStatusEnum.NORMAL.getStatus(), job.getStatus()); 76 assertEquals(JobStatusEnum.NORMAL.getStatus(), job.getStatus());
75 // 校验调用 77 // 校验调用
76 - verify(schedulerManager, times(1)).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()), eq(job.getCronExpression()),  
77 - eq(reqVO.getRetryCount()), eq(reqVO.getRetryInterval())); 78 + verify(schedulerManager).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()),
  79 + eq(job.getCronExpression()), eq(reqVO.getRetryCount()), eq(reqVO.getRetryInterval()));
78 } 80 }
79 81
80 @Test 82 @Test
81 public void testUpdateJob_jobNotExists(){ 83 public void testUpdateJob_jobNotExists(){
82 // 准备参数 84 // 准备参数
83 JobUpdateReqVO reqVO = randomPojo(JobUpdateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); 85 JobUpdateReqVO reqVO = randomPojo(JobUpdateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
  86 +
84 // 调用,并断言异常 87 // 调用,并断言异常
85 assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS); 88 assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS);
86 } 89 }
@@ -88,150 +91,136 @@ public class JobServiceTest extends BaseDbUnitTest { @@ -88,150 +91,136 @@ public class JobServiceTest extends BaseDbUnitTest {
88 @Test 91 @Test
89 public void testUpdateJob_onlyNormalStatus(){ 92 public void testUpdateJob_onlyNormalStatus(){
90 // mock 数据 93 // mock 数据
91 - JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));  
92 - JobDO job = JobConvert.INSTANCE.convert(createReqVO);  
93 - job.setStatus(JobStatusEnum.INIT.getStatus());  
94 - fillJobMonitorTimeoutEmpty(job); 94 + JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.INIT.getStatus()));
95 jobMapper.insert(job); 95 jobMapper.insert(job);
96 // 准备参数 96 // 准备参数
97 JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { 97 JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> {
98 o.setId(job.getId()); 98 o.setId(job.getId());
99 - o.setName(createReqVO.getName());  
100 - o.setCronExpression(createReqVO.getCronExpression()); 99 + o.setCronExpression("0 0/1 * * * ? *");
101 }); 100 });
  101 +
102 // 调用,并断言异常 102 // 调用,并断言异常
103 - assertServiceException(() -> jobService.updateJob(updateReqVO), JOB_UPDATE_ONLY_NORMAL_STATUS); 103 + assertServiceException(() -> jobService.updateJob(updateReqVO),
  104 + JOB_UPDATE_ONLY_NORMAL_STATUS);
104 } 105 }
105 106
106 @Test 107 @Test
107 public void testUpdateJob_success() throws SchedulerException { 108 public void testUpdateJob_success() throws SchedulerException {
108 // mock 数据 109 // mock 数据
109 - JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));  
110 - JobDO job = JobConvert.INSTANCE.convert(createReqVO);  
111 - job.setStatus(JobStatusEnum.NORMAL.getStatus());  
112 - fillJobMonitorTimeoutEmpty(job); 110 + JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()));
113 jobMapper.insert(job); 111 jobMapper.insert(job);
114 // 准备参数 112 // 准备参数
115 JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { 113 JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> {
116 o.setId(job.getId()); 114 o.setId(job.getId());
117 - o.setName(createReqVO.getName());  
118 - o.setCronExpression(createReqVO.getCronExpression()); 115 + o.setCronExpression("0 0/1 * * * ? *");
119 }); 116 });
  117 +
120 // 调用 118 // 调用
121 jobService.updateJob(updateReqVO); 119 jobService.updateJob(updateReqVO);
122 // 校验记录的属性是否正确 120 // 校验记录的属性是否正确
123 JobDO updateJob = jobMapper.selectById(updateReqVO.getId()); 121 JobDO updateJob = jobMapper.selectById(updateReqVO.getId());
124 assertPojoEquals(updateReqVO, updateJob); 122 assertPojoEquals(updateReqVO, updateJob);
125 // 校验调用 123 // 校验调用
126 - verify(schedulerManager, times(1)).updateJob(eq(job.getHandlerName()), eq(updateReqVO.getHandlerParam()), eq(updateReqVO.getCronExpression()),  
127 - eq(updateReqVO.getRetryCount()), eq(updateReqVO.getRetryInterval())); 124 + verify(schedulerManager).updateJob(eq(job.getHandlerName()), eq(updateReqVO.getHandlerParam()),
  125 + eq(updateReqVO.getCronExpression()), eq(updateReqVO.getRetryCount()), eq(updateReqVO.getRetryInterval()));
128 } 126 }
129 127
130 @Test 128 @Test
131 public void testUpdateJobStatus_changeStatusInvalid() { 129 public void testUpdateJobStatus_changeStatusInvalid() {
132 // 调用,并断言异常 130 // 调用,并断言异常
133 - assertServiceException(() -> jobService.updateJobStatus(1L, JobStatusEnum.INIT.getStatus()), JOB_CHANGE_STATUS_INVALID); 131 + assertServiceException(() -> jobService.updateJobStatus(1L, JobStatusEnum.INIT.getStatus()),
  132 + JOB_CHANGE_STATUS_INVALID);
134 } 133 }
135 134
136 @Test 135 @Test
137 public void testUpdateJobStatus_changeStatusEquals() { 136 public void testUpdateJobStatus_changeStatusEquals() {
138 // mock 数据 137 // mock 数据
139 - JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));  
140 - JobDO job = JobConvert.INSTANCE.convert(createReqVO);  
141 - job.setStatus(JobStatusEnum.NORMAL.getStatus());  
142 - fillJobMonitorTimeoutEmpty(job); 138 + JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()));
143 jobMapper.insert(job); 139 jobMapper.insert(job);
  140 +
144 // 调用,并断言异常 141 // 调用,并断言异常
145 - assertServiceException(() -> jobService.updateJobStatus(job.getId(), job.getStatus()), JOB_CHANGE_STATUS_EQUALS); 142 + assertServiceException(() -> jobService.updateJobStatus(job.getId(), job.getStatus()),
  143 + JOB_CHANGE_STATUS_EQUALS);
146 } 144 }
147 145
148 @Test 146 @Test
149 - public void testUpdateJobStatus_NormalToStop_success() throws SchedulerException { 147 + public void testUpdateJobStatus_stopSuccess() throws SchedulerException {
150 // mock 数据 148 // mock 数据
151 - JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));  
152 - JobDO job = JobConvert.INSTANCE.convert(createReqVO);  
153 - job.setStatus(JobStatusEnum.NORMAL.getStatus());  
154 - fillJobMonitorTimeoutEmpty(job); 149 + JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()));
155 jobMapper.insert(job); 150 jobMapper.insert(job);
  151 +
156 // 调用 152 // 调用
157 jobService.updateJobStatus(job.getId(), JobStatusEnum.STOP.getStatus()); 153 jobService.updateJobStatus(job.getId(), JobStatusEnum.STOP.getStatus());
158 // 校验记录的属性是否正确 154 // 校验记录的属性是否正确
159 - JobDO updateJob = jobMapper.selectById(job.getId());  
160 - assertEquals(JobStatusEnum.STOP.getStatus(), updateJob.getStatus()); 155 + JobDO dbJob = jobMapper.selectById(job.getId());
  156 + assertEquals(JobStatusEnum.STOP.getStatus(), dbJob.getStatus());
161 // 校验调用 157 // 校验调用
162 - verify(schedulerManager, times(1)).pauseJob(eq(job.getHandlerName())); 158 + verify(schedulerManager).pauseJob(eq(job.getHandlerName()));
163 } 159 }
164 160
165 @Test 161 @Test
166 - public void testUpdateJobStatus_StopToNormal_success() throws SchedulerException { 162 + public void testUpdateJobStatus_normalSuccess() throws SchedulerException {
167 // mock 数据 163 // mock 数据
168 - JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));  
169 - JobDO job = JobConvert.INSTANCE.convert(createReqVO);  
170 - job.setStatus(JobStatusEnum.STOP.getStatus());  
171 - fillJobMonitorTimeoutEmpty(job); 164 + JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.STOP.getStatus()));
172 jobMapper.insert(job); 165 jobMapper.insert(job);
  166 +
173 // 调用 167 // 调用
174 jobService.updateJobStatus(job.getId(), JobStatusEnum.NORMAL.getStatus()); 168 jobService.updateJobStatus(job.getId(), JobStatusEnum.NORMAL.getStatus());
175 // 校验记录的属性是否正确 169 // 校验记录的属性是否正确
176 - JobDO updateJob = jobMapper.selectById(job.getId());  
177 - assertEquals(JobStatusEnum.NORMAL.getStatus(), updateJob.getStatus()); 170 + JobDO dbJob = jobMapper.selectById(job.getId());
  171 + assertEquals(JobStatusEnum.NORMAL.getStatus(), dbJob.getStatus());
178 // 校验调用 172 // 校验调用
179 - verify(schedulerManager, times(1)).resumeJob(eq(job.getHandlerName())); 173 + verify(schedulerManager).resumeJob(eq(job.getHandlerName()));
180 } 174 }
181 175
182 @Test 176 @Test
183 public void testTriggerJob_success() throws SchedulerException { 177 public void testTriggerJob_success() throws SchedulerException {
184 // mock 数据 178 // mock 数据
185 - JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));  
186 - JobDO job = JobConvert.INSTANCE.convert(createReqVO);  
187 - job.setStatus(JobStatusEnum.NORMAL.getStatus());  
188 - fillJobMonitorTimeoutEmpty(job); 179 + JobDO job = randomPojo(JobDO.class);
189 jobMapper.insert(job); 180 jobMapper.insert(job);
  181 +
190 // 调用 182 // 调用
191 jobService.triggerJob(job.getId()); 183 jobService.triggerJob(job.getId());
192 // 校验调用 184 // 校验调用
193 - verify(schedulerManager, times(1)).triggerJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam())); 185 + verify(schedulerManager).triggerJob(eq(job.getId()),
  186 + eq(job.getHandlerName()), eq(job.getHandlerParam()));
194 } 187 }
195 188
196 @Test 189 @Test
197 public void testDeleteJob_success() throws SchedulerException { 190 public void testDeleteJob_success() throws SchedulerException {
198 // mock 数据 191 // mock 数据
199 - JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));  
200 - JobDO job = JobConvert.INSTANCE.convert(createReqVO);  
201 - job.setStatus(JobStatusEnum.NORMAL.getStatus());  
202 - fillJobMonitorTimeoutEmpty(job); 192 + JobDO job = randomPojo(JobDO.class);
203 jobMapper.insert(job); 193 jobMapper.insert(job);
204 - // 调用 UPDATE inf_job SET deleted=1 WHERE id=? AND deleted=0 194 +
  195 + // 调用
205 jobService.deleteJob(job.getId()); 196 jobService.deleteJob(job.getId());
206 - // 校验数据不存在了 WHERE id=? AND deleted=0 查询为空正常 197 + // 校验不存在
207 assertNull(jobMapper.selectById(job.getId())); 198 assertNull(jobMapper.selectById(job.getId()));
208 // 校验调用 199 // 校验调用
209 - verify(schedulerManager, times(1)).deleteJob(eq(job.getHandlerName())); 200 + verify(schedulerManager).deleteJob(eq(job.getHandlerName()));
210 } 201 }
211 202
212 @Test 203 @Test
213 - public void testGetJobListByIds_success() { 204 + public void testGetJobList() {
214 // mock 数据 205 // mock 数据
215 JobDO dbJob = randomPojo(JobDO.class, o -> { 206 JobDO dbJob = randomPojo(JobDO.class, o -> {
216 o.setStatus(randomEle(JobStatusEnum.values()).getStatus()); // 保证 status 的范围 207 o.setStatus(randomEle(JobStatusEnum.values()).getStatus()); // 保证 status 的范围
217 }); 208 });
218 - JobDO cloneJob = ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()));  
219 jobMapper.insert(dbJob); 209 jobMapper.insert(dbJob);
220 - // 测试 handlerName 不匹配  
221 - jobMapper.insert(cloneJob); 210 + // 测试 id 不匹配
  211 + jobMapper.insert(cloneIgnoreId(dbJob, o -> {}));
  212 +
222 // 准备参数 213 // 准备参数
223 - ArrayList<Long> ids = new ArrayList<>();  
224 - ids.add(dbJob.getId());  
225 - ids.add(cloneJob.getId()); 214 + Collection<Long> ids = singletonList(dbJob.getId());
226 // 调用 215 // 调用
227 List<JobDO> list = jobService.getJobList(ids); 216 List<JobDO> list = jobService.getJobList(ids);
228 // 断言 217 // 断言
229 - assertEquals(2, list.size()); 218 + assertEquals(1, list.size());
230 assertPojoEquals(dbJob, list.get(0)); 219 assertPojoEquals(dbJob, list.get(0));
231 } 220 }
232 221
233 @Test 222 @Test
234 - public void testGetJobPage_success() { 223 + public void testGetJobPage() {
235 // mock 数据 224 // mock 数据
236 JobDO dbJob = randomPojo(JobDO.class, o -> { 225 JobDO dbJob = randomPojo(JobDO.class, o -> {
237 o.setName("定时任务测试"); 226 o.setName("定时任务测试");
@@ -240,16 +229,17 @@ public class JobServiceTest extends BaseDbUnitTest { @@ -240,16 +229,17 @@ public class JobServiceTest extends BaseDbUnitTest {
240 }); 229 });
241 jobMapper.insert(dbJob); 230 jobMapper.insert(dbJob);
242 // 测试 name 不匹配 231 // 测试 name 不匹配
243 - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); 232 + jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setName("土豆")));
244 // 测试 status 不匹配 233 // 测试 status 不匹配
245 - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()))); 234 + jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus())));
246 // 测试 handlerName 不匹配 235 // 测试 handlerName 不匹配
247 - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); 236 + jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())));
248 // 准备参数 237 // 准备参数
249 JobPageReqVO reqVo = new JobPageReqVO(); 238 JobPageReqVO reqVo = new JobPageReqVO();
250 reqVo.setName("定时"); 239 reqVo.setName("定时");
251 reqVo.setStatus(JobStatusEnum.INIT.getStatus()); 240 reqVo.setStatus(JobStatusEnum.INIT.getStatus());
252 reqVo.setHandlerName("单元"); 241 reqVo.setHandlerName("单元");
  242 +
253 // 调用 243 // 调用
254 PageResult<JobDO> pageResult = jobService.getJobPage(reqVo); 244 PageResult<JobDO> pageResult = jobService.getJobPage(reqVo);
255 // 断言 245 // 断言
@@ -259,7 +249,7 @@ public class JobServiceTest extends BaseDbUnitTest { @@ -259,7 +249,7 @@ public class JobServiceTest extends BaseDbUnitTest {
259 } 249 }
260 250
261 @Test 251 @Test
262 - public void testGetJobListForExport_success() { 252 + public void testGetJobList_export() {
263 // mock 数据 253 // mock 数据
264 JobDO dbJob = randomPojo(JobDO.class, o -> { 254 JobDO dbJob = randomPojo(JobDO.class, o -> {
265 o.setName("定时任务测试"); 255 o.setName("定时任务测试");
@@ -268,16 +258,17 @@ public class JobServiceTest extends BaseDbUnitTest { @@ -268,16 +258,17 @@ public class JobServiceTest extends BaseDbUnitTest {
268 }); 258 });
269 jobMapper.insert(dbJob); 259 jobMapper.insert(dbJob);
270 // 测试 name 不匹配 260 // 测试 name 不匹配
271 - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); 261 + jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setName("土豆")));
272 // 测试 status 不匹配 262 // 测试 status 不匹配
273 - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()))); 263 + jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus())));
274 // 测试 handlerName 不匹配 264 // 测试 handlerName 不匹配
275 - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); 265 + jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())));
276 // 准备参数 266 // 准备参数
277 JobExportReqVO reqVo = new JobExportReqVO(); 267 JobExportReqVO reqVo = new JobExportReqVO();
278 reqVo.setName("定时"); 268 reqVo.setName("定时");
279 reqVo.setStatus(JobStatusEnum.INIT.getStatus()); 269 reqVo.setStatus(JobStatusEnum.INIT.getStatus());
280 reqVo.setHandlerName("单元"); 270 reqVo.setHandlerName("单元");
  271 +
281 // 调用 272 // 调用
282 List<JobDO> list = jobService.getJobList(reqVo); 273 List<JobDO> list = jobService.getJobList(reqVo);
283 // 断言 274 // 断言
@@ -285,10 +276,15 @@ public class JobServiceTest extends BaseDbUnitTest { @@ -285,10 +276,15 @@ public class JobServiceTest extends BaseDbUnitTest {
285 assertPojoEquals(dbJob, list.get(0)); 276 assertPojoEquals(dbJob, list.get(0));
286 } 277 }
287 278
288 - private static void fillJobMonitorTimeoutEmpty(JobDO job) {  
289 - if (job.getMonitorTimeout() == null) {  
290 - job.setMonitorTimeout(0);  
291 - } 279 + @Test
  280 + public void testGetJob() {
  281 + // mock 数据
  282 + JobDO dbJob = randomPojo(JobDO.class);
  283 + jobMapper.insert(dbJob);
  284 + // 调用
  285 + JobDO job = jobService.getJob(dbJob.getId());
  286 + // 断言
  287 + assertPojoEquals(dbJob, job);
292 } 288 }
293 289
294 } 290 }
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java
1 package cn.iocoder.yudao.module.infra.service.logger; 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 -import cn.hutool.core.util.RandomUtil;  
4 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 3 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
5 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; 4 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
6 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
7 -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;  
8 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 6 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
9 -import cn.iocoder.yudao.framework.test.core.util.RandomUtils;  
10 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; 7 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
11 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; 8 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
12 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; 9 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
@@ -16,149 +13,121 @@ import org.junit.jupiter.api.Test; @@ -16,149 +13,121 @@ import org.junit.jupiter.api.Test;
16 import org.springframework.context.annotation.Import; 13 import org.springframework.context.annotation.Import;
17 14
18 import javax.annotation.Resource; 15 import javax.annotation.Resource;
19 -import java.time.LocalDateTime;  
20 import java.util.List; 16 import java.util.List;
21 17
  18 +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
22 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; 19 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
  20 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
23 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 21 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
  22 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
24 import static org.junit.jupiter.api.Assertions.assertEquals; 23 import static org.junit.jupiter.api.Assertions.assertEquals;
25 -import static org.junit.jupiter.api.Assertions.assertNotNull;  
26 24
27 @Import(ApiAccessLogServiceImpl.class) 25 @Import(ApiAccessLogServiceImpl.class)
28 public class ApiAccessLogServiceImplTest extends BaseDbUnitTest { 26 public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
29 27
30 @Resource 28 @Resource
31 - private ApiAccessLogService apiAccessLogService; 29 + private ApiAccessLogServiceImpl apiAccessLogService;
32 30
33 @Resource 31 @Resource
34 private ApiAccessLogMapper apiAccessLogMapper; 32 private ApiAccessLogMapper apiAccessLogMapper;
35 33
36 @Test 34 @Test
37 public void testGetApiAccessLogPage() { 35 public void testGetApiAccessLogPage() {
38 - // 构造测试数据  
39 - long userId = 2233L;  
40 - int userType = UserTypeEnum.ADMIN.getValue();  
41 - String applicationName = "yudao-test";  
42 - String requestUrl = "foo";  
43 - LocalDateTime beginTime = buildTime(2021, 3, 13);  
44 - int duration = 1000;  
45 - int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode();  
46 -  
47 - ApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(ApiAccessLogDO.class, dto -> {  
48 - dto.setUserId(userId);  
49 - dto.setUserType(userType);  
50 - dto.setApplicationName(applicationName);  
51 - dto.setRequestUrl(requestUrl);  
52 - dto.setBeginTime(beginTime);  
53 - dto.setDuration(duration);  
54 - dto.setResultCode(resultCode); 36 + ApiAccessLogDO apiAccessLogDO = randomPojo(ApiAccessLogDO.class, o -> {
  37 + o.setUserId(2233L);
  38 + o.setUserType(UserTypeEnum.ADMIN.getValue());
  39 + o.setApplicationName("yudao-test");
  40 + o.setRequestUrl("foo");
  41 + o.setBeginTime(buildTime(2021, 3, 13));
  42 + o.setDuration(1000);
  43 + o.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
55 }); 44 });
56 - apiAccessLogMapper.insert(infApiAccessLogDO);  
57 -  
58 - // 下面几个都是不匹配的数据  
59 - // userId 不同的  
60 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L)));  
61 - // userType  
62 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));  
63 - // applicationName 不同的  
64 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test")));  
65 - // requestUrl 不同的  
66 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar")));  
67 - // 构造一个早期时间 2021-02-06 00:00:00  
68 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6))));  
69 - // duration 不同的  
70 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100)));  
71 - // resultCode 不同的  
72 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2)));  
73 -  
74 - // 构造调用参数 45 + apiAccessLogMapper.insert(apiAccessLogDO);
  46 + // 测试 userId 不匹配
  47 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserId(3344L)));
  48 + // 测试 userType 不匹配
  49 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
  50 + // 测试 applicationName 不匹配
  51 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setApplicationName("test")));
  52 + // 测试 requestUrl 不匹配
  53 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setRequestUrl("bar")));
  54 + // 测试 beginTime 不匹配:构造一个早期时间 2021-02-06 00:00:00
  55 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setBeginTime(buildTime(2021, 2, 6))));
  56 + // 测试 duration 不匹配
  57 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setDuration(100)));
  58 + // 测试 resultCode 不匹配
  59 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setResultCode(2)));
  60 + // 准备参数
75 ApiAccessLogPageReqVO reqVO = new ApiAccessLogPageReqVO(); 61 ApiAccessLogPageReqVO reqVO = new ApiAccessLogPageReqVO();
76 - reqVO.setUserId(userId);  
77 - reqVO.setUserType(userType);  
78 - reqVO.setApplicationName(applicationName);  
79 - reqVO.setRequestUrl(requestUrl);  
80 - reqVO.setBeginTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));  
81 - reqVO.setDuration(duration);  
82 - reqVO.setResultCode(resultCode); 62 + reqVO.setUserId(2233L);
  63 + reqVO.setUserType(UserTypeEnum.ADMIN.getValue());
  64 + reqVO.setApplicationName("yudao-test");
  65 + reqVO.setRequestUrl("foo");
  66 + reqVO.setBeginTime(buildBetweenTime(2021, 3, 13, 2021, 3, 13));
  67 + reqVO.setDuration(1000);
  68 + reqVO.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
83 69
84 - // 调用service方法 70 + // 调用
85 PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(reqVO); 71 PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(reqVO);
86 -  
87 // 断言,只查到了一条符合条件的 72 // 断言,只查到了一条符合条件的
88 assertEquals(1, pageResult.getTotal()); 73 assertEquals(1, pageResult.getTotal());
89 assertEquals(1, pageResult.getList().size()); 74 assertEquals(1, pageResult.getList().size());
90 - assertPojoEquals(infApiAccessLogDO, pageResult.getList().get(0)); 75 + assertPojoEquals(apiAccessLogDO, pageResult.getList().get(0));
91 } 76 }
92 77
93 @Test 78 @Test
94 public void testGetApiAccessLogList() { 79 public void testGetApiAccessLogList() {
95 - // 构造测试数据  
96 - long userId = 2233L;  
97 - int userType = UserTypeEnum.ADMIN.getValue();  
98 - String applicationName = "yudao-test";  
99 - String requestUrl = "foo";  
100 - LocalDateTime beginTime = buildTime(2021, 3, 13);  
101 - int duration = 1000;  
102 - int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode();  
103 -  
104 - ApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(ApiAccessLogDO.class, dto -> {  
105 - dto.setUserId(userId);  
106 - dto.setUserType(userType);  
107 - dto.setApplicationName(applicationName);  
108 - dto.setRequestUrl(requestUrl);  
109 - dto.setBeginTime(beginTime);  
110 - dto.setDuration(duration);  
111 - dto.setResultCode(resultCode); 80 + ApiAccessLogDO apiAccessLogDO = randomPojo(ApiAccessLogDO.class, o -> {
  81 + o.setUserId(2233L);
  82 + o.setUserType(UserTypeEnum.ADMIN.getValue());
  83 + o.setApplicationName("yudao-test");
  84 + o.setRequestUrl("foo");
  85 + o.setBeginTime(buildTime(2021, 3, 13));
  86 + o.setDuration(1000);
  87 + o.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
112 }); 88 });
113 - apiAccessLogMapper.insert(infApiAccessLogDO);  
114 -  
115 - // 下面几个都是不匹配的数据  
116 - // userId 不同的  
117 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L)));  
118 - // userType  
119 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));  
120 - // applicationName 不同的  
121 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test")));  
122 - // requestUrl 不同的  
123 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar")));  
124 - // 构造一个早期时间 2021-02-06 00:00:00  
125 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6))));  
126 - // duration 不同的  
127 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100)));  
128 - // resultCode 不同的  
129 - apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2)));  
130 -  
131 - // 构造调用参数 89 + apiAccessLogMapper.insert(apiAccessLogDO);
  90 + // 测试 userId 不匹配
  91 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserId(3344L)));
  92 + // 测试 userType 不匹配
  93 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
  94 + // 测试 applicationName 不匹配
  95 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setApplicationName("test")));
  96 + // 测试 requestUrl 不匹配
  97 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setRequestUrl("bar")));
  98 + // 测试 beginTime 不匹配:构造一个早期时间 2021-02-06 00:00:00
  99 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setBeginTime(buildTime(2021, 2, 6))));
  100 + // 测试 duration 不匹配
  101 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setDuration(100)));
  102 + // 测试 resultCode 不匹配
  103 + apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setResultCode(2)));
  104 + // 准备参数
132 ApiAccessLogExportReqVO reqVO = new ApiAccessLogExportReqVO(); 105 ApiAccessLogExportReqVO reqVO = new ApiAccessLogExportReqVO();
133 - reqVO.setUserId(userId);  
134 - reqVO.setUserType(userType);  
135 - reqVO.setApplicationName(applicationName);  
136 - reqVO.setRequestUrl(requestUrl);  
137 - reqVO.setBeginTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));  
138 - reqVO.setDuration(duration);  
139 - reqVO.setResultCode(resultCode); 106 + reqVO.setUserId(2233L);
  107 + reqVO.setUserType(UserTypeEnum.ADMIN.getValue());
  108 + reqVO.setApplicationName("yudao-test");
  109 + reqVO.setRequestUrl("foo");
  110 + reqVO.setBeginTime(buildBetweenTime(2021, 3, 13, 2021, 3, 13));
  111 + reqVO.setDuration(1000);
  112 + reqVO.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
140 113
141 - // 调用service方法 114 + // 调用
142 List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(reqVO); 115 List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(reqVO);
143 -  
144 // 断言,只查到了一条符合条件的 116 // 断言,只查到了一条符合条件的
145 assertEquals(1, list.size()); 117 assertEquals(1, list.size());
146 - assertPojoEquals(infApiAccessLogDO, list.get(0)); 118 + assertPojoEquals(apiAccessLogDO, list.get(0));
147 } 119 }
148 120
149 @Test 121 @Test
150 - public void testCreateApiAccessLogAsync() { 122 + public void testCreateApiAccessLog() {
151 // 准备参数 123 // 准备参数
152 - ApiAccessLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiAccessLogCreateReqDTO.class,  
153 - dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); 124 + ApiAccessLogCreateReqDTO createDTO = randomPojo(ApiAccessLogCreateReqDTO.class);
154 125
155 // 调用 126 // 调用
156 apiAccessLogService.createApiAccessLog(createDTO); 127 apiAccessLogService.createApiAccessLog(createDTO);
157 // 断言 128 // 断言
158 - ApiAccessLogDO infApiAccessLogDO = apiAccessLogMapper.selectOne(null);  
159 - assertNotNull(infApiAccessLogDO);  
160 - assertPojoEquals(createDTO, infApiAccessLogDO); 129 + ApiAccessLogDO apiAccessLogDO = apiAccessLogMapper.selectOne(null);
  130 + assertPojoEquals(createDTO, apiAccessLogDO);
161 } 131 }
162 132
163 -  
164 } 133 }
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java
1 package cn.iocoder.yudao.module.infra.service.logger; 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 -import cn.hutool.core.util.RandomUtil;  
4 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 3 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
5 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;  
7 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
8 -import cn.iocoder.yudao.framework.test.core.util.RandomUtils;  
9 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; 6 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
10 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; 7 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
11 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; 8 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
12 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; 9 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
13 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper; 10 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
14 import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum; 11 import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
15 -import org.junit.jupiter.api.Assertions;  
16 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.Test;
17 import org.springframework.context.annotation.Import; 13 import org.springframework.context.annotation.Import;
18 14
19 import javax.annotation.Resource; 15 import javax.annotation.Resource;
20 -import java.time.LocalDateTime;  
21 import java.util.List; 16 import java.util.List;
22 17
  18 +import static cn.hutool.core.util.RandomUtil.randomEle;
  19 +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
23 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; 20 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
  21 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
24 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 22 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
25 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; 23 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
  24 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
  25 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
26 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND; 26 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
27 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED; 27 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED;
28 import static org.junit.jupiter.api.Assertions.assertEquals; 28 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -35,161 +35,150 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest { @@ -35,161 +35,150 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
35 private ApiErrorLogServiceImpl apiErrorLogService; 35 private ApiErrorLogServiceImpl apiErrorLogService;
36 36
37 @Resource 37 @Resource
38 - private ApiErrorLogMapper infApiErrorLogMapper; 38 + private ApiErrorLogMapper apiErrorLogMapper;
39 39
40 @Test 40 @Test
41 public void testGetApiErrorLogPage() { 41 public void testGetApiErrorLogPage() {
42 - // 构造测试数据  
43 - long userId = 2233L;  
44 - int userType = UserTypeEnum.ADMIN.getValue();  
45 - String applicationName = "yudao-test";  
46 - String requestUrl = "foo";  
47 - LocalDateTime beginTime = buildTime(2021, 3, 13);  
48 - int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus();  
49 -  
50 - ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {  
51 - logDO.setUserId(userId);  
52 - logDO.setUserType(userType);  
53 - logDO.setApplicationName(applicationName);  
54 - logDO.setRequestUrl(requestUrl);  
55 - logDO.setExceptionTime(beginTime);  
56 - logDO.setProcessStatus(progressStatus); 42 + // mock 数据
  43 + ApiErrorLogDO apiErrorLogDO = randomPojo(ApiErrorLogDO.class, o -> {
  44 + o.setUserId(2233L);
  45 + o.setUserType(UserTypeEnum.ADMIN.getValue());
  46 + o.setApplicationName("yudao-test");
  47 + o.setRequestUrl("foo");
  48 + o.setExceptionTime(buildTime(2021, 3, 13));
  49 + o.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
57 }); 50 });
58 - infApiErrorLogMapper.insert(infApiErrorLogDO);  
59 -  
60 - // 下面几个都是不匹配的数据  
61 - // userId 不同的  
62 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setUserId(3344L)));  
63 - // userType  
64 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));  
65 - // applicationName 不同的  
66 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setApplicationName("test")));  
67 - // requestUrl 不同的  
68 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));  
69 - // 构造一个早期时间 2021-02-06 00:00:00  
70 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));  
71 - // progressStatus 不同的  
72 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));  
73 -  
74 - // 构造调用参数 51 + apiErrorLogMapper.insert(apiErrorLogDO);
  52 + // 测试 userId 不匹配
  53 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, o -> o.setUserId(3344L)));
  54 + // 测试 userType 不匹配
  55 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));
  56 + // 测试 applicationName 不匹配
  57 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setApplicationName("test")));
  58 + // 测试 requestUrl 不匹配
  59 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
  60 + // 测试 exceptionTime 不匹配:构造一个早期时间 2021-02-06 00:00:00
  61 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
  62 + // 测试 progressStatus 不匹配
  63 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
  64 + // 准备参数
75 ApiErrorLogPageReqVO reqVO = new ApiErrorLogPageReqVO(); 65 ApiErrorLogPageReqVO reqVO = new ApiErrorLogPageReqVO();
76 - reqVO.setUserId(userId);  
77 - reqVO.setUserType(userType);  
78 - reqVO.setApplicationName(applicationName);  
79 - reqVO.setRequestUrl(requestUrl);  
80 - reqVO.setExceptionTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));  
81 - reqVO.setProcessStatus(progressStatus);  
82 -  
83 - // 调用service方法  
84 - PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(reqVO); 66 + reqVO.setUserId(2233L);
  67 + reqVO.setUserType(UserTypeEnum.ADMIN.getValue());
  68 + reqVO.setApplicationName("yudao-test");
  69 + reqVO.setRequestUrl("foo");
  70 + reqVO.setExceptionTime(buildBetweenTime(2021, 3, 1, 2021, 3, 31));
  71 + reqVO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
85 72
  73 + // 调用
  74 + PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(reqVO);
86 // 断言,只查到了一条符合条件的 75 // 断言,只查到了一条符合条件的
87 assertEquals(1, pageResult.getTotal()); 76 assertEquals(1, pageResult.getTotal());
88 assertEquals(1, pageResult.getList().size()); 77 assertEquals(1, pageResult.getList().size());
89 - assertPojoEquals(infApiErrorLogDO, pageResult.getList().get(0)); 78 + assertPojoEquals(apiErrorLogDO, pageResult.getList().get(0));
90 } 79 }
91 80
92 @Test 81 @Test
93 public void testGetApiErrorLogList() { 82 public void testGetApiErrorLogList() {
94 - // 构造测试数据  
95 - long userId = 2233L;  
96 - int userType = UserTypeEnum.ADMIN.getValue();  
97 - String applicationName = "yudao-test";  
98 - String requestUrl = "foo";  
99 - LocalDateTime beginTime = buildTime(2021, 3, 13);  
100 - int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus();  
101 -  
102 - ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {  
103 - logDO.setUserId(userId);  
104 - logDO.setUserType(userType);  
105 - logDO.setApplicationName(applicationName);  
106 - logDO.setRequestUrl(requestUrl);  
107 - logDO.setExceptionTime(beginTime);  
108 - logDO.setProcessStatus(progressStatus); 83 + // mock 数据
  84 + ApiErrorLogDO apiErrorLogDO = randomPojo(ApiErrorLogDO.class, o -> {
  85 + o.setUserId(2233L);
  86 + o.setUserType(UserTypeEnum.ADMIN.getValue());
  87 + o.setApplicationName("yudao-test");
  88 + o.setRequestUrl("foo");
  89 + o.setExceptionTime(buildTime(2021, 3, 13));
  90 + o.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
109 }); 91 });
110 - infApiErrorLogMapper.insert(infApiErrorLogDO);  
111 -  
112 - // 下面几个都是不匹配的数据  
113 - // userId 不同的  
114 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setUserId(3344L)));  
115 - // userType  
116 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));  
117 - // applicationName 不同的  
118 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setApplicationName("test")));  
119 - // requestUrl 不同的  
120 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));  
121 - // 构造一个早期时间 2021-02-06 00:00:00  
122 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));  
123 - // progressStatus 不同的  
124 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));  
125 -  
126 - // 构造调用参数 92 + apiErrorLogMapper.insert(apiErrorLogDO);
  93 + // 测试 userId 不匹配
  94 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, o -> o.setUserId(3344L)));
  95 + // 测试 userType 不匹配
  96 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));
  97 + // 测试 applicationName 不匹配
  98 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setApplicationName("test")));
  99 + // 测试 requestUrl 不匹配
  100 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
  101 + // 测试 exceptionTime 不匹配:构造一个早期时间 2021-02-06 00:00:00
  102 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
  103 + // 测试 progressStatus 不匹配
  104 + apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
  105 + // 准备参数
127 ApiErrorLogExportReqVO reqVO = new ApiErrorLogExportReqVO(); 106 ApiErrorLogExportReqVO reqVO = new ApiErrorLogExportReqVO();
128 - reqVO.setUserId(userId);  
129 - reqVO.setUserType(userType);  
130 - reqVO.setApplicationName(applicationName);  
131 - reqVO.setRequestUrl(requestUrl);  
132 - reqVO.setExceptionTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));  
133 - reqVO.setProcessStatus(progressStatus);  
134 -  
135 - // 调用service方法  
136 - List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(reqVO); 107 + reqVO.setUserId(2233L);
  108 + reqVO.setUserType(UserTypeEnum.ADMIN.getValue());
  109 + reqVO.setApplicationName("yudao-test");
  110 + reqVO.setRequestUrl("foo");
  111 + reqVO.setExceptionTime(buildBetweenTime(2021, 3, 1, 2021, 3, 31));
  112 + reqVO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
137 113
  114 + // 调用
  115 + List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(reqVO);
138 // 断言,只查到了一条符合条件的 116 // 断言,只查到了一条符合条件的
139 assertEquals(1, list.size()); 117 assertEquals(1, list.size());
140 - assertPojoEquals(infApiErrorLogDO, list.get(0)); 118 + assertPojoEquals(apiErrorLogDO, list.get(0));
141 } 119 }
142 120
143 -  
144 - // TODO 芋艿:单元测试,可以拆小一点  
145 @Test 121 @Test
146 - public void testUpdateApiErrorLogProcess() {  
147 - // 先构造两条数据,第一条用于抛出异常,第二条用于正常的执行update操作  
148 - Long processUserId = 2233L;  
149 -  
150 - ApiErrorLogDO first = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {  
151 - logDO.setProcessUserId(processUserId);  
152 - logDO.setUserType(UserTypeEnum.ADMIN.getValue());  
153 - logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus());  
154 - });  
155 - infApiErrorLogMapper.insert(first); 122 + public void testCreateApiErrorLog() {
  123 + // 准备参数
  124 + ApiErrorLogCreateReqDTO createDTO = randomPojo(ApiErrorLogCreateReqDTO.class);
156 125
157 - ApiErrorLogDO second = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {  
158 - logDO.setProcessUserId(1122L);  
159 - logDO.setUserType(UserTypeEnum.ADMIN.getValue());  
160 - logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());  
161 - });  
162 - infApiErrorLogMapper.insert(second);  
163 -  
164 - Long firstId = first.getId();  
165 - Long secondId = second.getId();  
166 -  
167 - // 执行正常的 update 操作  
168 - apiErrorLogService.updateApiErrorLogProcess(secondId, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId);  
169 - ApiErrorLogDO secondSelect = infApiErrorLogMapper.selectOne("id", secondId);  
170 -  
171 - // id 为 0 查询不到,应该抛出异常 API_ERROR_LOG_NOT_FOUND  
172 - assertServiceException(() -> apiErrorLogService.updateApiErrorLogProcess(0L, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_NOT_FOUND);  
173 - // id 为 first 的 progressStatus 为 DONE ,应该抛出 API_ERROR_LOG_PROCESSED  
174 - assertServiceException(() -> apiErrorLogService.updateApiErrorLogProcess(firstId, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_PROCESSED);  
175 - // 验证 progressStatus 是否修改成功  
176 - Assertions.assertEquals(ApiErrorLogProcessStatusEnum.DONE.getStatus(), secondSelect.getProcessStatus());  
177 - // 验证 progressUserId 是否修改成功  
178 - Assertions.assertEquals(processUserId, secondSelect.getProcessUserId()); 126 + // 调用
  127 + apiErrorLogService.createApiErrorLog(createDTO);
  128 + // 断言
  129 + ApiErrorLogDO apiErrorLogDO = apiErrorLogMapper.selectOne(null);
  130 + assertPojoEquals(createDTO, apiErrorLogDO);
  131 + assertEquals(ApiErrorLogProcessStatusEnum.INIT.getStatus(), apiErrorLogDO.getProcessStatus());
179 } 132 }
180 133
181 @Test 134 @Test
182 - public void testCreateApiErrorLogAsync() { 135 + public void testUpdateApiErrorLogProcess_success() {
183 // 准备参数 136 // 准备参数
184 - ApiErrorLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiErrorLogCreateReqDTO.class,  
185 - dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); 137 + ApiErrorLogDO apiErrorLogDO = randomPojo(ApiErrorLogDO.class,
  138 + o -> o.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()));
  139 + apiErrorLogMapper.insert(apiErrorLogDO);
  140 + // 准备参数
  141 + Long id = apiErrorLogDO.getId();
  142 + Integer processStatus = randomEle(ApiErrorLogProcessStatusEnum.values()).getStatus();
  143 + Long processUserId = randomLongId();
186 144
187 // 调用 145 // 调用
188 - apiErrorLogService.createApiErrorLog(createDTO); 146 + apiErrorLogService.updateApiErrorLogProcess(id, processStatus, processUserId);
189 // 断言 147 // 断言
190 - ApiErrorLogDO infApiErrorLogDO = infApiErrorLogMapper.selectOne(null);  
191 - assertNotNull(infApiErrorLogDO);  
192 - assertPojoEquals(createDTO, infApiErrorLogDO); 148 + ApiErrorLogDO dbApiErrorLogDO = apiErrorLogMapper.selectById(apiErrorLogDO.getId());
  149 + assertEquals(processStatus, dbApiErrorLogDO.getProcessStatus());
  150 + assertEquals(processUserId, dbApiErrorLogDO.getProcessUserId());
  151 + assertNotNull(dbApiErrorLogDO.getProcessTime());
  152 + }
  153 +
  154 + @Test
  155 + public void testUpdateApiErrorLogProcess_processed() {
  156 + // 准备参数
  157 + ApiErrorLogDO apiErrorLogDO = randomPojo(ApiErrorLogDO.class,
  158 + o -> o.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus()));
  159 + apiErrorLogMapper.insert(apiErrorLogDO);
  160 + // 准备参数
  161 + Long id = apiErrorLogDO.getId();
  162 + Integer processStatus = randomEle(ApiErrorLogProcessStatusEnum.values()).getStatus();
  163 + Long processUserId = randomLongId();
  164 +
  165 + // 调用,并断言异常
  166 + assertServiceException(() ->
  167 + apiErrorLogService.updateApiErrorLogProcess(id, processStatus, processUserId),
  168 + API_ERROR_LOG_PROCESSED);
  169 + }
  170 +
  171 + @Test
  172 + public void testUpdateApiErrorLogProcess_notFound() {
  173 + // 准备参数
  174 + Long id = randomLongId();
  175 + Integer processStatus = randomEle(ApiErrorLogProcessStatusEnum.values()).getStatus();
  176 + Long processUserId = randomLongId();
  177 +
  178 + // 调用,并断言异常
  179 + assertServiceException(() ->
  180 + apiErrorLogService.updateApiErrorLogProcess(id, processStatus, processUserId),
  181 + API_ERROR_LOG_NOT_FOUND);
193 } 182 }
194 183
195 } 184 }
yudao-module-infra/yudao-module-infra-biz/src/test/resources/sql/clean.sql
1 DELETE FROM "infra_config"; 1 DELETE FROM "infra_config";
  2 +DELETE FROM "infra_file_config";
2 DELETE FROM "infra_file"; 3 DELETE FROM "infra_file";
3 DELETE FROM "infra_job"; 4 DELETE FROM "infra_job";
4 DELETE FROM "infra_job_log"; 5 DELETE FROM "infra_job_log";
5 DELETE FROM "infra_api_access_log"; 6 DELETE FROM "infra_api_access_log";
6 DELETE FROM "infra_api_error_log"; 7 DELETE FROM "infra_api_error_log";
7 -DELETE FROM "infra_api_access_log";  
8 -DELETE FROM "infra_file";  
9 -DELETE FROM "infra_api_error_log";  
10 -DELETE FROM "infra_test_demo";  
11 DELETE FROM "infra_file_config"; 8 DELETE FROM "infra_file_config";
  9 +DELETE FROM "infra_test_demo";
12 DELETE FROM "infra_data_source_config"; 10 DELETE FROM "infra_data_source_config";
yudao-module-infra/yudao-module-infra-biz/src/test/resources/sql/create_tables.sql
1 1
2 CREATE TABLE IF NOT EXISTS "infra_config" ( 2 CREATE TABLE IF NOT EXISTS "infra_config" (
3 - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY, 3 + "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
4 "category" varchar(50) NOT NULL, 4 "category" varchar(50) NOT NULL,
5 "type" tinyint NOT NULL, 5 "type" tinyint NOT NULL,
6 - "name" varchar(100) NOT NULL DEFAULT '', 6 + "name" varchar(100) NOT NULL DEFAULT '' COMMENT '名字',
7 "config_key" varchar(100) NOT NULL DEFAULT '', 7 "config_key" varchar(100) NOT NULL DEFAULT '',
8 "value" varchar(500) NOT NULL DEFAULT '', 8 "value" varchar(500) NOT NULL DEFAULT '',
9 "visible" bit NOT NULL, 9 "visible" bit NOT NULL,
@@ -85,19 +85,6 @@ CREATE TABLE IF NOT EXISTS &quot;infra_job_log&quot; ( @@ -85,19 +85,6 @@ CREATE TABLE IF NOT EXISTS &quot;infra_job_log&quot; (
85 PRIMARY KEY ("id") 85 PRIMARY KEY ("id")
86 )COMMENT='定时任务日志表'; 86 )COMMENT='定时任务日志表';
87 87
88 -CREATE TABLE IF NOT EXISTS "inf_file" (  
89 - "id" varchar(188) NOT NULL,  
90 - "type" varchar(63) DEFAULT NULL,  
91 - "content" blob NOT NULL,  
92 - "creator" varchar(64) DEFAULT '',  
93 - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,  
94 - "updater" varchar(64) DEFAULT '',  
95 - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,  
96 - "deleted" bit NOT NULL DEFAULT FALSE,  
97 - "tenant_id" bigint not null default '0',  
98 - PRIMARY KEY ("id")  
99 - ) COMMENT '文件表';  
100 -  
101 CREATE TABLE IF NOT EXISTS "infra_api_access_log" ( 88 CREATE TABLE IF NOT EXISTS "infra_api_access_log" (
102 "id" bigint not null GENERATED BY DEFAULT AS IDENTITY, 89 "id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
103 "trace_id" varchar(64) not null default '', 90 "trace_id" varchar(64) not null default '',
yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/clean.sql 0 → 100644
  1 +DELETE FROM "product_sku";
  2 +DELETE FROM "product_spu";
  3 +DELETE FROM "product_category";
  4 +
  5 +
  6 +
  7 +
yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/create_tables.sql 0 → 100644
  1 +CREATE TABLE IF NOT EXISTS `product_sku` (
  2 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  3 + `spu_id` bigint NOT NULL COMMENT 'spu编号',
  4 + `spu_name` varchar DEFAULT NULL COMMENT '商品 SPU 名字',
  5 + `properties` varchar DEFAULT NULL COMMENT '规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]',
  6 + `price` int NOT NULL DEFAULT '-1' COMMENT '销售价格,单位:分',
  7 + `market_price` int DEFAULT NULL COMMENT '市场价',
  8 + `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分',
  9 + `pic_url` varchar NOT NULL COMMENT '图片地址',
  10 + `stock` int DEFAULT NULL COMMENT '库存',
  11 + `warn_stock` int DEFAULT NULL COMMENT '预警库存',
  12 + `volume` double DEFAULT NULL COMMENT '商品体积',
  13 + `weight` double DEFAULT NULL COMMENT '商品重量',
  14 + `bar_code` varchar DEFAULT NULL COMMENT '条形码',
  15 + `status` tinyint DEFAULT NULL COMMENT '状态: 0-正常 1-禁用',
  16 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  17 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  18 + `creator` varchar DEFAULT NULL COMMENT '创建人',
  19 + `updater` varchar DEFAULT NULL COMMENT '更新人',
  20 + `deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
  21 + PRIMARY KEY (`id`)
  22 +) COMMENT '商品sku';
  23 +
  24 +CREATE TABLE IF NOT EXISTS `product_spu` (
  25 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  26 + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
  27 + `brand_id` bigint DEFAULT NULL COMMENT '商品品牌编号',
  28 + `category_id` bigint NOT NULL COMMENT '分类id',
  29 + `spec_type` int NOT NULL COMMENT '规格类型:0 单规格 1 多规格',
  30 + `code` varchar(128) DEFAULT NULL COMMENT '商品编码',
  31 + `name` varchar(128) NOT NULL COMMENT '商品名称',
  32 + `sell_point` varchar(128) DEFAULT NULL COMMENT '卖点',
  33 + `description` text COMMENT '描述',
  34 + `pic_urls` varchar(1024) DEFAULT '' COMMENT '商品轮播图地址数组,以逗号分隔最多上传15张',
  35 + `video_url` varchar(128) DEFAULT NULL COMMENT '商品视频',
  36 + `market_price` int DEFAULT NULL COMMENT '市场价,单位使用:分',
  37 + `min_price` int DEFAULT NULL COMMENT '最小价格,单位使用:分',
  38 + `max_price` int DEFAULT NULL COMMENT '最大价格,单位使用:分',
  39 + `total_stock` int NOT NULL DEFAULT '0' COMMENT '总库存',
  40 + `show_stock` int DEFAULT '0' COMMENT '是否展示库存',
  41 + `sales_count` int DEFAULT '0' COMMENT '商品销量',
  42 + `virtual_sales_count` int DEFAULT '0' COMMENT '虚拟销量',
  43 + `click_count` int DEFAULT '0' COMMENT '商品点击量',
  44 + `status` bit(1) DEFAULT NULL COMMENT '上下架状态: 0 上架(开启) 1 下架(禁用)-1 回收',
  45 + `sort` int NOT NULL DEFAULT '0' COMMENT '排序字段',
  46 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  47 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  48 + `creator` varchar DEFAULT NULL COMMENT '创建人',
  49 + `updater` varchar DEFAULT NULL COMMENT '更新人',
  50 + `deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
  51 +PRIMARY KEY (`id`)
  52 +) COMMENT '商品spu';
  53 +
  54 +CREATE TABLE IF NOT EXISTS `product_category` (
  55 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类编号',
  56 + `parent_id` bigint DEFAULT NULL COMMENT '父分类编号',
  57 + `name` varchar(128) NOT NULL COMMENT '分类名称',
  58 + `description` varchar(128) NOT NULL COMMENT '分类描述',
  59 + `pic_url` varchar DEFAULT NULL COMMENT '分类图片',
  60 + `sort` int NOT NULL DEFAULT '0' COMMENT '排序字段',
  61 + `status` bit(1) DEFAULT NULL COMMENT '状态',
  62 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  63 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  64 + `creator` varchar DEFAULT NULL COMMENT '创建人',
  65 + `updater` varchar DEFAULT NULL COMMENT '更新人',
  66 + `deleted` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
  67 + PRIMARY KEY (`id`)
  68 +) COMMENT '商品分类';
yudao-module-member/yudao-module-member-biz/src/test/resources/sql/create_tables.sql
@@ -17,19 +17,6 @@ CREATE TABLE IF NOT EXISTS &quot;member_user&quot; ( @@ -17,19 +17,6 @@ CREATE TABLE IF NOT EXISTS &quot;member_user&quot; (
17 PRIMARY KEY ("id") 17 PRIMARY KEY ("id")
18 ) COMMENT '会员表'; 18 ) COMMENT '会员表';
19 19
20 --- inf 开头的 DB  
21 -CREATE TABLE IF NOT EXISTS "inf_file" (  
22 - "id" varchar(188) NOT NULL,  
23 - "type" varchar(63) DEFAULT NULL,  
24 - "content" blob NOT NULL,  
25 - "creator" varchar(64) DEFAULT '',  
26 - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,  
27 - "updater" varchar(64) DEFAULT '',  
28 - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,  
29 - "deleted" bit NOT NULL DEFAULT FALSE,  
30 - PRIMARY KEY ("id")  
31 -) COMMENT '文件表';  
32 -  
33 CREATE TABLE IF NOT EXISTS "member_address" ( 20 CREATE TABLE IF NOT EXISTS "member_address" (
34 "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY, 21 "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
35 "user_id" bigint(20) NOT NULL, 22 "user_id" bigint(20) NOT NULL,
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApi.java
@@ -29,7 +29,7 @@ public interface DeptApi { @@ -29,7 +29,7 @@ public interface DeptApi {
29 * @param ids 部门编号数组 29 * @param ids 部门编号数组
30 * @return 部门信息数组 30 * @return 部门信息数组
31 */ 31 */
32 - List<DeptRespDTO> getDepts(Collection<Long> ids); 32 + List<DeptRespDTO> getDeptList(Collection<Long> ids);
33 33
34 /** 34 /**
35 * 校验部门们是否有效。如下情况,视为无效: 35 * 校验部门们是否有效。如下情况,视为无效:
@@ -38,7 +38,7 @@ public interface DeptApi { @@ -38,7 +38,7 @@ public interface DeptApi {
38 * 38 *
39 * @param ids 角色编号数组 39 * @param ids 角色编号数组
40 */ 40 */
41 - void validDepts(Collection<Long> ids); 41 + void validateDeptList(Collection<Long> ids);
42 42
43 /** 43 /**
44 * 获得指定编号的部门 Map 44 * 获得指定编号的部门 Map
@@ -47,7 +47,7 @@ public interface DeptApi { @@ -47,7 +47,7 @@ public interface DeptApi {
47 * @return 部门 Map 47 * @return 部门 Map
48 */ 48 */
49 default Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) { 49 default Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
50 - List<DeptRespDTO> list = getDepts(ids); 50 + List<DeptRespDTO> list = getDeptList(ids);
51 return CollectionUtils.convertMap(list, DeptRespDTO::getId); 51 return CollectionUtils.convertMap(list, DeptRespDTO::getId);
52 } 52 }
53 53
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/PostApi.java
@@ -16,6 +16,6 @@ public interface PostApi { @@ -16,6 +16,6 @@ public interface PostApi {
16 * 16 *
17 * @param ids 岗位编号数组 17 * @param ids 岗位编号数组
18 */ 18 */
19 - void validPosts(Collection<Long> ids); 19 + void validPostList(Collection<Long> ids);
20 20
21 } 21 }
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java
@@ -19,7 +19,7 @@ public interface DictDataApi { @@ -19,7 +19,7 @@ public interface DictDataApi {
19 * @param dictType 字典类型 19 * @param dictType 字典类型
20 * @param values 字典数据值的数组 20 * @param values 字典数据值的数组
21 */ 21 */
22 - void validDictDatas(String dictType, Collection<String> values); 22 + void validateDictDataList(String dictType, Collection<String> values);
23 23
24 /** 24 /**
25 * 获得指定的字典数据,从缓存中 25 * 获得指定的字典数据,从缓存中
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/errorcode/ErrorCodeApi.java
@@ -19,7 +19,7 @@ public interface ErrorCodeApi { @@ -19,7 +19,7 @@ public interface ErrorCodeApi {
19 * 19 *
20 * @param autoGenerateDTOs 错误码信息 20 * @param autoGenerateDTOs 错误码信息
21 */ 21 */
22 - void autoGenerateErrorCodes(@Valid List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs); 22 + void autoGenerateErrorCodeList(@Valid List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs);
23 23
24 /** 24 /**
25 * 增量获得错误码数组 25 * 增量获得错误码数组
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/permission/RoleApi.java
@@ -16,6 +16,6 @@ public interface RoleApi { @@ -16,6 +16,6 @@ public interface RoleApi {
16 * 16 *
17 * @param ids 角色编号数组 17 * @param ids 角色编号数组
18 */ 18 */
19 - void validRoles(Collection<Long> ids); 19 + void validRoleList(Collection<Long> ids);
20 20
21 } 21 }
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/sms/SmsCodeApi.java
1 package cn.iocoder.yudao.module.system.api.sms; 1 package cn.iocoder.yudao.module.system.api.sms;
2 2
3 import cn.iocoder.yudao.framework.common.exception.ServiceException; 3 import cn.iocoder.yudao.framework.common.exception.ServiceException;
4 -import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeCheckReqDTO; 4 +import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
5 import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO; 5 import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
6 import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO; 6 import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
7 7
@@ -35,6 +35,6 @@ public interface SmsCodeApi { @@ -35,6 +35,6 @@ public interface SmsCodeApi {
35 * 35 *
36 * @param reqDTO 校验请求 36 * @param reqDTO 校验请求
37 */ 37 */
38 - void checkSmsCode(@Valid SmsCodeCheckReqDTO reqDTO); 38 + void validateSmsCode(@Valid SmsCodeValidateReqDTO reqDTO);
39 39
40 } 40 }
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/sms/dto/code/SmsCodeCheckReqDTO.java renamed to yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/sms/dto/code/SmsCodeValidateReqDTO.java
@@ -14,7 +14,7 @@ import javax.validation.constraints.NotNull; @@ -14,7 +14,7 @@ import javax.validation.constraints.NotNull;
14 * @author 芋道源码 14 * @author 芋道源码
15 */ 15 */
16 @Data 16 @Data
17 -public class SmsCodeCheckReqDTO { 17 +public class SmsCodeValidateReqDTO {
18 18
19 /** 19 /**
20 * 手机号 20 * 手机号
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApi.java
@@ -14,13 +14,13 @@ public interface TenantApi { @@ -14,13 +14,13 @@ public interface TenantApi {
14 * 14 *
15 * @return 租户编号数组 15 * @return 租户编号数组
16 */ 16 */
17 - List<Long> getTenantIds(); 17 + List<Long> getTenantIdList();
18 18
19 /** 19 /**
20 * 校验租户是否合法 20 * 校验租户是否合法
21 * 21 *
22 * @param id 租户编号 22 * @param id 租户编号
23 */ 23 */
24 - void validTenant(Long id); 24 + void validateTenant(Long id);
25 25
26 } 26 }
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java
@@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; @@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
6 import java.util.Collection; 6 import java.util.Collection;
7 import java.util.List; 7 import java.util.List;
8 import java.util.Map; 8 import java.util.Map;
9 -import java.util.Set;  
10 9
11 /** 10 /**
12 * Admin 用户 API 接口 11 * Admin 用户 API 接口
@@ -29,7 +28,7 @@ public interface AdminUserApi { @@ -29,7 +28,7 @@ public interface AdminUserApi {
29 * @param ids 用户 ID 们 28 * @param ids 用户 ID 们
30 * @return 用户对象信息 29 * @return 用户对象信息
31 */ 30 */
32 - List<AdminUserRespDTO> getUsers(Collection<Long> ids); 31 + List<AdminUserRespDTO> getUserList(Collection<Long> ids);
33 32
34 /** 33 /**
35 * 获得指定部门的用户数组 34 * 获得指定部门的用户数组
@@ -37,7 +36,7 @@ public interface AdminUserApi { @@ -37,7 +36,7 @@ public interface AdminUserApi {
37 * @param deptIds 部门数组 36 * @param deptIds 部门数组
38 * @return 用户数组 37 * @return 用户数组
39 */ 38 */
40 - List<AdminUserRespDTO> getUsersByDeptIds(Collection<Long> deptIds); 39 + List<AdminUserRespDTO> getUserListByDeptIds(Collection<Long> deptIds);
41 40
42 /** 41 /**
43 * 获得指定岗位的用户数组 42 * 获得指定岗位的用户数组
@@ -54,7 +53,7 @@ public interface AdminUserApi { @@ -54,7 +53,7 @@ public interface AdminUserApi {
54 * @return 用户 Map 53 * @return 用户 Map
55 */ 54 */
56 default Map<Long, AdminUserRespDTO> getUserMap(Collection<Long> ids) { 55 default Map<Long, AdminUserRespDTO> getUserMap(Collection<Long> ids) {
57 - List<AdminUserRespDTO> users = getUsers(ids); 56 + List<AdminUserRespDTO> users = getUserList(ids);
58 return CollectionUtils.convertMap(users, AdminUserRespDTO::getId); 57 return CollectionUtils.convertMap(users, AdminUserRespDTO::getId);
59 } 58 }
60 59
@@ -65,6 +64,6 @@ public interface AdminUserApi { @@ -65,6 +64,6 @@ public interface AdminUserApi {
65 * 64 *
66 * @param ids 用户编号数组 65 * @param ids 用户编号数组
67 */ 66 */
68 - void validUsers(Set<Long> ids); 67 + void validateUserList(Collection<Long> ids);
69 68
70 } 69 }
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
@@ -50,7 +50,7 @@ public interface ErrorCodeConstants { @@ -50,7 +50,7 @@ public interface ErrorCodeConstants {
50 ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1002004003, "存在子部门,无法删除"); 50 ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1002004003, "存在子部门,无法删除");
51 ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1002004004, "不能设置自己为父部门"); 51 ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1002004004, "不能设置自己为父部门");
52 ErrorCode DEPT_EXISTS_USER = new ErrorCode(1002004005, "部门中存在员工,无法删除"); 52 ErrorCode DEPT_EXISTS_USER = new ErrorCode(1002004005, "部门中存在员工,无法删除");
53 - ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1002004006, "部门不处于开启状态,不允许选择"); 53 + ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1002004006, "部门({})不处于开启状态,不允许选择");
54 ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1002004007, "不能设置自己的子部门为父部门"); 54 ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1002004007, "不能设置自己的子部门为父部门");
55 55
56 // ========== 岗位模块 1002005000 ========== 56 // ========== 岗位模块 1002005000 ==========
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/permission/MenuIdEnum.java deleted
1 -package cn.iocoder.yudao.module.system.enums.permission;  
2 -  
3 -import lombok.AllArgsConstructor;  
4 -import lombok.Getter;  
5 -  
6 -/**  
7 - * Menu 编号枚举  
8 - */  
9 -@Getter  
10 -@AllArgsConstructor  
11 -public enum MenuIdEnum {  
12 -  
13 - /**  
14 - * 根节点  
15 - */  
16 - ROOT(0L);  
17 -  
18 - private final Long id;  
19 -  
20 -}  
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApiImpl.java
@@ -28,14 +28,14 @@ public class DeptApiImpl implements DeptApi { @@ -28,14 +28,14 @@ public class DeptApiImpl implements DeptApi {
28 } 28 }
29 29
30 @Override 30 @Override
31 - public List<DeptRespDTO> getDepts(Collection<Long> ids) {  
32 - List<DeptDO> depts = deptService.getDepts(ids); 31 + public List<DeptRespDTO> getDeptList(Collection<Long> ids) {
  32 + List<DeptDO> depts = deptService.getDeptList(ids);
33 return DeptConvert.INSTANCE.convertList03(depts); 33 return DeptConvert.INSTANCE.convertList03(depts);
34 } 34 }
35 35
36 @Override 36 @Override
37 - public void validDepts(Collection<Long> ids) {  
38 - deptService.validDepts(ids); 37 + public void validateDeptList(Collection<Long> ids) {
  38 + deptService.validateDeptList(ids);
39 } 39 }
40 40
41 } 41 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dept/PostApiImpl.java
@@ -18,7 +18,8 @@ public class PostApiImpl implements PostApi { @@ -18,7 +18,8 @@ public class PostApiImpl implements PostApi {
18 private PostService postService; 18 private PostService postService;
19 19
20 @Override 20 @Override
21 - public void validPosts(Collection<Long> ids) {  
22 - postService.validPosts(ids); 21 + public void validPostList(Collection<Long> ids) {
  22 + postService.validatePostList(ids);
23 } 23 }
  24 +
24 } 25 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java
@@ -21,8 +21,8 @@ public class DictDataApiImpl implements DictDataApi { @@ -21,8 +21,8 @@ public class DictDataApiImpl implements DictDataApi {
21 private DictDataService dictDataService; 21 private DictDataService dictDataService;
22 22
23 @Override 23 @Override
24 - public void validDictDatas(String dictType, Collection<String> values) {  
25 - dictDataService.validDictDatas(dictType, values); 24 + public void validateDictDataList(String dictType, Collection<String> values) {
  25 + dictDataService.validateDictDataList(dictType, values);
26 } 26 }
27 27
28 @Override 28 @Override
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/errorcode/ErrorCodeApiImpl.java
@@ -21,7 +21,7 @@ public class ErrorCodeApiImpl implements ErrorCodeApi { @@ -21,7 +21,7 @@ public class ErrorCodeApiImpl implements ErrorCodeApi {
21 private ErrorCodeService errorCodeService; 21 private ErrorCodeService errorCodeService;
22 22
23 @Override 23 @Override
24 - public void autoGenerateErrorCodes(List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs) { 24 + public void autoGenerateErrorCodeList(List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs) {
25 errorCodeService.autoGenerateErrorCodes(autoGenerateDTOs); 25 errorCodeService.autoGenerateErrorCodes(autoGenerateDTOs);
26 } 26 }
27 27
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/permission/RoleApiImpl.java
@@ -18,7 +18,7 @@ public class RoleApiImpl implements RoleApi { @@ -18,7 +18,7 @@ public class RoleApiImpl implements RoleApi {
18 private RoleService roleService; 18 private RoleService roleService;
19 19
20 @Override 20 @Override
21 - public void validRoles(Collection<Long> ids) {  
22 - roleService.validRoles(ids); 21 + public void validRoleList(Collection<Long> ids) {
  22 + roleService.validateRoleList(ids);
23 } 23 }
24 } 24 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/sms/SmsCodeApiImpl.java
1 package cn.iocoder.yudao.module.system.api.sms; 1 package cn.iocoder.yudao.module.system.api.sms;
2 2
3 -import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeCheckReqDTO; 3 +import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
4 import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO; 4 import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
5 import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO; 5 import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
6 import cn.iocoder.yudao.module.system.service.sms.SmsCodeService; 6 import cn.iocoder.yudao.module.system.service.sms.SmsCodeService;
@@ -32,8 +32,8 @@ public class SmsCodeApiImpl implements SmsCodeApi { @@ -32,8 +32,8 @@ public class SmsCodeApiImpl implements SmsCodeApi {
32 } 32 }
33 33
34 @Override 34 @Override
35 - public void checkSmsCode(SmsCodeCheckReqDTO reqDTO) {  
36 - smsCodeService.checkSmsCode(reqDTO); 35 + public void validateSmsCode(SmsCodeValidateReqDTO reqDTO) {
  36 + smsCodeService.validateSmsCode(reqDTO);
37 } 37 }
38 38
39 } 39 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApiImpl.java
@@ -18,12 +18,12 @@ public class TenantApiImpl implements TenantApi { @@ -18,12 +18,12 @@ public class TenantApiImpl implements TenantApi {
18 private TenantService tenantService; 18 private TenantService tenantService;
19 19
20 @Override 20 @Override
21 - public List<Long> getTenantIds() {  
22 - return tenantService.getTenantIds(); 21 + public List<Long> getTenantIdList() {
  22 + return tenantService.getTenantIdList();
23 } 23 }
24 24
25 @Override 25 @Override
26 - public void validTenant(Long id) { 26 + public void validateTenant(Long id) {
27 tenantService.validTenant(id); 27 tenantService.validTenant(id);
28 } 28 }
29 29
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java
@@ -9,7 +9,6 @@ import org.springframework.stereotype.Service; @@ -9,7 +9,6 @@ import org.springframework.stereotype.Service;
9 import javax.annotation.Resource; 9 import javax.annotation.Resource;
10 import java.util.Collection; 10 import java.util.Collection;
11 import java.util.List; 11 import java.util.List;
12 -import java.util.Set;  
13 12
14 /** 13 /**
15 * Admin 用户 API 实现类 14 * Admin 用户 API 实现类
@@ -29,26 +28,26 @@ public class AdminUserApiImpl implements AdminUserApi { @@ -29,26 +28,26 @@ public class AdminUserApiImpl implements AdminUserApi {
29 } 28 }
30 29
31 @Override 30 @Override
32 - public List<AdminUserRespDTO> getUsers(Collection<Long> ids) {  
33 - List<AdminUserDO> users = userService.getUsers(ids); 31 + public List<AdminUserRespDTO> getUserList(Collection<Long> ids) {
  32 + List<AdminUserDO> users = userService.getUserList(ids);
34 return UserConvert.INSTANCE.convertList4(users); 33 return UserConvert.INSTANCE.convertList4(users);
35 } 34 }
36 35
37 @Override 36 @Override
38 - public List<AdminUserRespDTO> getUsersByDeptIds(Collection<Long> deptIds) {  
39 - List<AdminUserDO> users = userService.getUsersByDeptIds(deptIds); 37 + public List<AdminUserRespDTO> getUserListByDeptIds(Collection<Long> deptIds) {
  38 + List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds);
40 return UserConvert.INSTANCE.convertList4(users); 39 return UserConvert.INSTANCE.convertList4(users);
41 } 40 }
42 41
43 @Override 42 @Override
44 public List<AdminUserRespDTO> getUsersByPostIds(Collection<Long> postIds) { 43 public List<AdminUserRespDTO> getUsersByPostIds(Collection<Long> postIds) {
45 - List<AdminUserDO> users = userService.getUsersByPostIds(postIds); 44 + List<AdminUserDO> users = userService.getUserListByPostIds(postIds);
46 return UserConvert.INSTANCE.convertList4(users); 45 return UserConvert.INSTANCE.convertList4(users);
47 } 46 }
48 47
49 @Override 48 @Override
50 - public void validUsers(Set<Long> ids) {  
51 - userService.validUsers(ids); 49 + public void validateUserList(Collection<Long> ids) {
  50 + userService.validateUserList(ids);
52 } 51 }
53 52
54 } 53 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java
@@ -97,7 +97,7 @@ public class AuthController { @@ -97,7 +97,7 @@ public class AuthController {
97 } 97 }
98 // 获得角色列表 98 // 获得角色列表
99 Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus())); 99 Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus()));
100 - List<RoleDO> roleList = roleService.getRolesFromCache(roleIds); 100 + List<RoleDO> roleList = roleService.getRoleListFromCache(roleIds);
101 // 获得菜单列表 101 // 获得菜单列表
102 List<MenuDO> menuList = permissionService.getRoleMenuListFromCache(roleIds, 102 List<MenuDO> menuList = permissionService.getRoleMenuListFromCache(roleIds,
103 SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType(), MenuTypeEnum.BUTTON.getType()), 103 SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType(), MenuTypeEnum.BUTTON.getType()),
@@ -108,7 +108,7 @@ public class AuthController { @@ -108,7 +108,7 @@ public class AuthController {
108 108
109 @GetMapping("/list-menus") 109 @GetMapping("/list-menus")
110 @Operation(summary = "获得登录用户的菜单列表") 110 @Operation(summary = "获得登录用户的菜单列表")
111 - public CommonResult<List<AuthMenuRespVO>> getMenus() { 111 + public CommonResult<List<AuthMenuRespVO>> getMenuList() {
112 // 获得角色列表 112 // 获得角色列表
113 Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus())); 113 Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus()));
114 // 获得用户拥有的菜单列表 114 // 获得用户拥有的菜单列表
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java
@@ -57,19 +57,19 @@ public class DeptController { @@ -57,19 +57,19 @@ public class DeptController {
57 @GetMapping("/list") 57 @GetMapping("/list")
58 @Operation(summary = "获取部门列表") 58 @Operation(summary = "获取部门列表")
59 @PreAuthorize("@ss.hasPermission('system:dept:query')") 59 @PreAuthorize("@ss.hasPermission('system:dept:query')")
60 - public CommonResult<List<DeptRespVO>> listDepts(DeptListReqVO reqVO) {  
61 - List<DeptDO> list = deptService.getSimpleDepts(reqVO); 60 + public CommonResult<List<DeptRespVO>> getDeptList(DeptListReqVO reqVO) {
  61 + List<DeptDO> list = deptService.getDeptList(reqVO);
62 list.sort(Comparator.comparing(DeptDO::getSort)); 62 list.sort(Comparator.comparing(DeptDO::getSort));
63 return success(DeptConvert.INSTANCE.convertList(list)); 63 return success(DeptConvert.INSTANCE.convertList(list));
64 } 64 }
65 65
66 @GetMapping("/list-all-simple") 66 @GetMapping("/list-all-simple")
67 @Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项") 67 @Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
68 - public CommonResult<List<DeptSimpleRespVO>> getSimpleDepts() { 68 + public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList() {
69 // 获得部门列表,只要开启状态的 69 // 获得部门列表,只要开启状态的
70 DeptListReqVO reqVO = new DeptListReqVO(); 70 DeptListReqVO reqVO = new DeptListReqVO();
71 reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); 71 reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
72 - List<DeptDO> list = deptService.getSimpleDepts(reqVO); 72 + List<DeptDO> list = deptService.getDeptList(reqVO);
73 // 排序后,返回给前端 73 // 排序后,返回给前端
74 list.sort(Comparator.comparing(DeptDO::getSort)); 74 list.sort(Comparator.comparing(DeptDO::getSort));
75 return success(DeptConvert.INSTANCE.convertList02(list)); 75 return success(DeptConvert.INSTANCE.convertList02(list));
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/PostController.java
@@ -70,9 +70,9 @@ public class PostController { @@ -70,9 +70,9 @@ public class PostController {
70 70
71 @GetMapping("/list-all-simple") 71 @GetMapping("/list-all-simple")
72 @Operation(summary = "获取岗位精简信息列表", description = "只包含被开启的岗位,主要用于前端的下拉选项") 72 @Operation(summary = "获取岗位精简信息列表", description = "只包含被开启的岗位,主要用于前端的下拉选项")
73 - public CommonResult<List<PostSimpleRespVO>> getSimplePosts() { 73 + public CommonResult<List<PostSimpleRespVO>> getSimplePostList() {
74 // 获得岗位列表,只要开启状态的 74 // 获得岗位列表,只要开启状态的
75 - List<PostDO> list = postService.getPosts(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus())); 75 + List<PostDO> list = postService.getPostList(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
76 // 排序后,返回给前端 76 // 排序后,返回给前端
77 list.sort(Comparator.comparing(PostDO::getSort)); 77 list.sort(Comparator.comparing(PostDO::getSort));
78 return success(PostConvert.INSTANCE.convertList02(list)); 78 return success(PostConvert.INSTANCE.convertList02(list));
@@ -90,7 +90,7 @@ public class PostController { @@ -90,7 +90,7 @@ public class PostController {
90 @PreAuthorize("@ss.hasPermission('system:post:export')") 90 @PreAuthorize("@ss.hasPermission('system:post:export')")
91 @OperateLog(type = EXPORT) 91 @OperateLog(type = EXPORT)
92 public void export(HttpServletResponse response, @Validated PostExportReqVO reqVO) throws IOException { 92 public void export(HttpServletResponse response, @Validated PostExportReqVO reqVO) throws IOException {
93 - List<PostDO> posts = postService.getPosts(reqVO); 93 + List<PostDO> posts = postService.getPostList(reqVO);
94 List<PostExcelVO> data = PostConvert.INSTANCE.convertList03(posts); 94 List<PostExcelVO> data = PostConvert.INSTANCE.convertList03(posts);
95 // 输出 95 // 输出
96 ExcelUtils.write(response, "岗位数据.xls", "岗位列表", PostExcelVO.class, data); 96 ExcelUtils.write(response, "岗位数据.xls", "岗位列表", PostExcelVO.class, data);
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java
@@ -61,8 +61,8 @@ public class DictDataController { @@ -61,8 +61,8 @@ public class DictDataController {
61 @GetMapping("/list-all-simple") 61 @GetMapping("/list-all-simple")
62 @Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地") 62 @Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地")
63 // 无需添加权限认证,因为前端全局都需要 63 // 无需添加权限认证,因为前端全局都需要
64 - public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDatas() {  
65 - List<DictDataDO> list = dictDataService.getDictDatas(); 64 + public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDataList() {
  65 + List<DictDataDO> list = dictDataService.getDictDataList();
66 return success(DictDataConvert.INSTANCE.convertList(list)); 66 return success(DictDataConvert.INSTANCE.convertList(list));
67 } 67 }
68 68
@@ -86,7 +86,7 @@ public class DictDataController { @@ -86,7 +86,7 @@ public class DictDataController {
86 @PreAuthorize("@ss.hasPermission('system:dict:export')") 86 @PreAuthorize("@ss.hasPermission('system:dict:export')")
87 @OperateLog(type = EXPORT) 87 @OperateLog(type = EXPORT)
88 public void export(HttpServletResponse response, @Valid DictDataExportReqVO reqVO) throws IOException { 88 public void export(HttpServletResponse response, @Valid DictDataExportReqVO reqVO) throws IOException {
89 - List<DictDataDO> list = dictDataService.getDictDatas(reqVO); 89 + List<DictDataDO> list = dictDataService.getDictDataList(reqVO);
90 List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list); 90 List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list);
91 // 输出 91 // 输出
92 ExcelUtils.write(response, "字典数据.xls", "数据列表", DictDataExcelVO.class, data); 92 ExcelUtils.write(response, "字典数据.xls", "数据列表", DictDataExcelVO.class, data);
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictTypeController.java
@@ -76,7 +76,7 @@ public class DictTypeController { @@ -76,7 +76,7 @@ public class DictTypeController {
76 @GetMapping("/list-all-simple") 76 @GetMapping("/list-all-simple")
77 @Operation(summary = "获得全部字典类型列表", description = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项") 77 @Operation(summary = "获得全部字典类型列表", description = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
78 // 无需添加权限认证,因为前端全局都需要 78 // 无需添加权限认证,因为前端全局都需要
79 - public CommonResult<List<DictTypeSimpleRespVO>> listSimpleDictTypes() { 79 + public CommonResult<List<DictTypeSimpleRespVO>> getSimpleDictTypeList() {
80 List<DictTypeDO> list = dictTypeService.getDictTypeList(); 80 List<DictTypeDO> list = dictTypeService.getDictTypeList();
81 return success(DictTypeConvert.INSTANCE.convertList(list)); 81 return success(DictTypeConvert.INSTANCE.convertList(list));
82 } 82 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/OperateLogController.java
@@ -71,7 +71,7 @@ public class OperateLogController { @@ -71,7 +71,7 @@ public class OperateLogController {
71 @PreAuthorize("@ss.hasPermission('system:operate-log:export')") 71 @PreAuthorize("@ss.hasPermission('system:operate-log:export')")
72 @OperateLog(type = EXPORT) 72 @OperateLog(type = EXPORT)
73 public void exportOperateLog(HttpServletResponse response, @Valid OperateLogExportReqVO reqVO) throws IOException { 73 public void exportOperateLog(HttpServletResponse response, @Valid OperateLogExportReqVO reqVO) throws IOException {
74 - List<OperateLogDO> list = operateLogService.getOperateLogs(reqVO); 74 + List<OperateLogDO> list = operateLogService.getOperateLogList(reqVO);
75 75
76 // 获得拼接需要的数据 76 // 获得拼接需要的数据
77 Collection<Long> userIds = CollectionUtils.convertList(list, OperateLogDO::getUserId); 77 Collection<Long> userIds = CollectionUtils.convertList(list, OperateLogDO::getUserId);
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notice/NoticeController.java
@@ -57,8 +57,8 @@ public class NoticeController { @@ -57,8 +57,8 @@ public class NoticeController {
57 @GetMapping("/page") 57 @GetMapping("/page")
58 @Operation(summary = "获取通知公告列表") 58 @Operation(summary = "获取通知公告列表")
59 @PreAuthorize("@ss.hasPermission('system:notice:query')") 59 @PreAuthorize("@ss.hasPermission('system:notice:query')")
60 - public CommonResult<PageResult<NoticeRespVO>> pageNotices(@Validated NoticePageReqVO reqVO) {  
61 - return success(NoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO))); 60 + public CommonResult<PageResult<NoticeRespVO>> getNoticePage(@Validated NoticePageReqVO reqVO) {
  61 + return success(NoticeConvert.INSTANCE.convertPage(noticeService.getNoticePage(reqVO)));
62 } 62 }
63 63
64 @GetMapping("/get") 64 @GetMapping("/get")
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oauth2/OAuth2UserController.java
@@ -61,7 +61,7 @@ public class OAuth2UserController { @@ -61,7 +61,7 @@ public class OAuth2UserController {
61 } 61 }
62 // 获得岗位信息 62 // 获得岗位信息
63 if (CollUtil.isNotEmpty(user.getPostIds())) { 63 if (CollUtil.isNotEmpty(user.getPostIds())) {
64 - List<PostDO> posts = postService.getPosts(user.getPostIds()); 64 + List<PostDO> posts = postService.getPostList(user.getPostIds());
65 resp.setPosts(OAuth2UserConvert.INSTANCE.convertList(posts)); 65 resp.setPosts(OAuth2UserConvert.INSTANCE.convertList(posts));
66 } 66 }
67 return success(resp); 67 return success(resp);
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/MenuController.java
@@ -57,8 +57,8 @@ public class MenuController { @@ -57,8 +57,8 @@ public class MenuController {
57 @GetMapping("/list") 57 @GetMapping("/list")
58 @Operation(summary = "获取菜单列表", description = "用于【菜单管理】界面") 58 @Operation(summary = "获取菜单列表", description = "用于【菜单管理】界面")
59 @PreAuthorize("@ss.hasPermission('system:menu:query')") 59 @PreAuthorize("@ss.hasPermission('system:menu:query')")
60 - public CommonResult<List<MenuRespVO>> getMenus(MenuListReqVO reqVO) {  
61 - List<MenuDO> list = menuService.getMenus(reqVO); 60 + public CommonResult<List<MenuRespVO>> getMenuList(MenuListReqVO reqVO) {
  61 + List<MenuDO> list = menuService.getMenuList(reqVO);
62 list.sort(Comparator.comparing(MenuDO::getSort)); 62 list.sort(Comparator.comparing(MenuDO::getSort));
63 return success(MenuConvert.INSTANCE.convertList(list)); 63 return success(MenuConvert.INSTANCE.convertList(list));
64 } 64 }
@@ -66,11 +66,11 @@ public class MenuController { @@ -66,11 +66,11 @@ public class MenuController {
66 @GetMapping("/list-all-simple") 66 @GetMapping("/list-all-simple")
67 @Operation(summary = "获取菜单精简信息列表", description = "只包含被开启的菜单,用于【角色分配菜单】功能的选项。" + 67 @Operation(summary = "获取菜单精简信息列表", description = "只包含被开启的菜单,用于【角色分配菜单】功能的选项。" +
68 "在多租户的场景下,会只返回租户所在套餐有的菜单") 68 "在多租户的场景下,会只返回租户所在套餐有的菜单")
69 - public CommonResult<List<MenuSimpleRespVO>> getSimpleMenus() { 69 + public CommonResult<List<MenuSimpleRespVO>> getSimpleMenuList() {
70 // 获得菜单列表,只要开启状态的 70 // 获得菜单列表,只要开启状态的
71 MenuListReqVO reqVO = new MenuListReqVO(); 71 MenuListReqVO reqVO = new MenuListReqVO();
72 reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); 72 reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
73 - List<MenuDO> list = menuService.getTenantMenus(reqVO); 73 + List<MenuDO> list = menuService.getMenuListByTenant(reqVO);
74 // 排序后,返回给前端 74 // 排序后,返回给前端
75 list.sort(Comparator.comparing(MenuDO::getSort)); 75 list.sort(Comparator.comparing(MenuDO::getSort));
76 return success(MenuConvert.INSTANCE.convertList02(list)); 76 return success(MenuConvert.INSTANCE.convertList02(list));
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java
@@ -20,12 +20,12 @@ import javax.annotation.Resource; @@ -20,12 +20,12 @@ import javax.annotation.Resource;
20 import javax.servlet.http.HttpServletResponse; 20 import javax.servlet.http.HttpServletResponse;
21 import javax.validation.Valid; 21 import javax.validation.Valid;
22 import java.io.IOException; 22 import java.io.IOException;
23 -import java.util.Collections;  
24 import java.util.Comparator; 23 import java.util.Comparator;
25 import java.util.List; 24 import java.util.List;
26 25
27 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 26 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
28 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; 27 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  28 +import static java.util.Collections.singleton;
29 29
30 @Tag(name = "管理后台 - 角色") 30 @Tag(name = "管理后台 - 角色")
31 @RestController 31 @RestController
@@ -85,9 +85,9 @@ public class RoleController { @@ -85,9 +85,9 @@ public class RoleController {
85 85
86 @GetMapping("/list-all-simple") 86 @GetMapping("/list-all-simple")
87 @Operation(summary = "获取角色精简信息列表", description = "只包含被开启的角色,主要用于前端的下拉选项") 87 @Operation(summary = "获取角色精简信息列表", description = "只包含被开启的角色,主要用于前端的下拉选项")
88 - public CommonResult<List<RoleSimpleRespVO>> getSimpleRoles() { 88 + public CommonResult<List<RoleSimpleRespVO>> getSimpleRoleList() {
89 // 获得角色列表,只要开启状态的 89 // 获得角色列表,只要开启状态的
90 - List<RoleDO> list = roleService.getRoles(Collections.singleton(CommonStatusEnum.ENABLE.getStatus())); 90 + List<RoleDO> list = roleService.getRoleListByStatus(singleton(CommonStatusEnum.ENABLE.getStatus()));
91 // 排序后,返回给前端 91 // 排序后,返回给前端
92 list.sort(Comparator.comparing(RoleDO::getSort)); 92 list.sort(Comparator.comparing(RoleDO::getSort));
93 return success(RoleConvert.INSTANCE.convertList02(list)); 93 return success(RoleConvert.INSTANCE.convertList02(list));
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/SensitiveWordController.java
@@ -90,8 +90,8 @@ public class SensitiveWordController { @@ -90,8 +90,8 @@ public class SensitiveWordController {
90 @GetMapping("/get-tags") 90 @GetMapping("/get-tags")
91 @Operation(summary = "获取所有敏感词的标签数组") 91 @Operation(summary = "获取所有敏感词的标签数组")
92 @PreAuthorize("@ss.hasPermission('system:sensitive-word:query')") 92 @PreAuthorize("@ss.hasPermission('system:sensitive-word:query')")
93 - public CommonResult<Set<String>> getSensitiveWordTags() throws IOException {  
94 - return success(sensitiveWordService.getSensitiveWordTags()); 93 + public CommonResult<Set<String>> getSensitiveWordTagSet() {
  94 + return success(sensitiveWordService.getSensitiveWordTagSet());
95 } 95 }
96 96
97 @GetMapping("/validate-text") 97 @GetMapping("/validate-text")
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsChannelController.java
@@ -70,7 +70,7 @@ public class SmsChannelController { @@ -70,7 +70,7 @@ public class SmsChannelController {
70 70
71 @GetMapping("/list-all-simple") 71 @GetMapping("/list-all-simple")
72 @Operation(summary = "获得短信渠道精简列表", description = "包含被禁用的短信渠道") 72 @Operation(summary = "获得短信渠道精简列表", description = "包含被禁用的短信渠道")
73 - public CommonResult<List<SmsChannelSimpleRespVO>> getSimpleSmsChannels() { 73 + public CommonResult<List<SmsChannelSimpleRespVO>> getSimpleSmsChannelList() {
74 List<SmsChannelDO> list = smsChannelService.getSmsChannelList(); 74 List<SmsChannelDO> list = smsChannelService.getSmsChannelList();
75 // 排序后,返回给前端 75 // 排序后,返回给前端
76 list.sort(Comparator.comparing(SmsChannelDO::getId)); 76 list.sort(Comparator.comparing(SmsChannelDO::getId));
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
@@ -111,9 +111,9 @@ public class UserController { @@ -111,9 +111,9 @@ public class UserController {
111 111
112 @GetMapping("/list-all-simple") 112 @GetMapping("/list-all-simple")
113 @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项") 113 @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
114 - public CommonResult<List<UserSimpleRespVO>> getSimpleUsers() { 114 + public CommonResult<List<UserSimpleRespVO>> getSimpleUserList() {
115 // 获用户列表,只要开启状态的 115 // 获用户列表,只要开启状态的
116 - List<AdminUserDO> list = userService.getUsersByStatus(CommonStatusEnum.ENABLE.getStatus()); 116 + List<AdminUserDO> list = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
117 // 排序后,返回给前端 117 // 排序后,返回给前端
118 return success(UserConvert.INSTANCE.convertList04(list)); 118 return success(UserConvert.INSTANCE.convertList04(list));
119 } 119 }
@@ -122,7 +122,7 @@ public class UserController { @@ -122,7 +122,7 @@ public class UserController {
122 @Operation(summary = "获得用户详情") 122 @Operation(summary = "获得用户详情")
123 @Parameter(name = "id", description = "编号", required = true, example = "1024") 123 @Parameter(name = "id", description = "编号", required = true, example = "1024")
124 @PreAuthorize("@ss.hasPermission('system:user:query')") 124 @PreAuthorize("@ss.hasPermission('system:user:query')")
125 - public CommonResult<UserRespVO> getInfo(@RequestParam("id") Long id) { 125 + public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
126 return success(UserConvert.INSTANCE.convert(userService.getUser(id))); 126 return success(UserConvert.INSTANCE.convert(userService.getUser(id)));
127 } 127 }
128 128
@@ -130,10 +130,10 @@ public class UserController { @@ -130,10 +130,10 @@ public class UserController {
130 @Operation(summary = "导出用户") 130 @Operation(summary = "导出用户")
131 @PreAuthorize("@ss.hasPermission('system:user:export')") 131 @PreAuthorize("@ss.hasPermission('system:user:export')")
132 @OperateLog(type = EXPORT) 132 @OperateLog(type = EXPORT)
133 - public void exportUsers(@Validated UserExportReqVO reqVO,  
134 - HttpServletResponse response) throws IOException { 133 + public void exportUserList(@Validated UserExportReqVO reqVO,
  134 + HttpServletResponse response) throws IOException {
135 // 获得用户列表 135 // 获得用户列表
136 - List<AdminUserDO> users = userService.getUsers(reqVO); 136 + List<AdminUserDO> users = userService.getUserList(reqVO);
137 137
138 // 获得拼接需要的数据 138 // 获得拼接需要的数据
139 Collection<Long> deptIds = convertList(users, AdminUserDO::getDeptId); 139 Collection<Long> deptIds = convertList(users, AdminUserDO::getDeptId);
@@ -183,7 +183,7 @@ public class UserController { @@ -183,7 +183,7 @@ public class UserController {
183 public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file, 183 public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
184 @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception { 184 @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
185 List<UserImportExcelVO> list = ExcelUtils.read(file, UserImportExcelVO.class); 185 List<UserImportExcelVO> list = ExcelUtils.read(file, UserImportExcelVO.class);
186 - return success(userService.importUsers(list, updateSupport)); 186 + return success(userService.importUserList(list, updateSupport));
187 } 187 }
188 188
189 } 189 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.system.controller.admin.user; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.system.controller.admin.user;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
4 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 4 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
5 -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;  
6 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 5 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
7 import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; 6 import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
8 import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileRespVO; 7 import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
@@ -31,6 +30,7 @@ import javax.annotation.Resource; @@ -31,6 +30,7 @@ import javax.annotation.Resource;
31 import javax.validation.Valid; 30 import javax.validation.Valid;
32 import java.util.List; 31 import java.util.List;
33 32
  33 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
34 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 34 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
35 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; 35 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
36 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY; 36 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
@@ -63,7 +63,7 @@ public class UserProfileController { @@ -63,7 +63,7 @@ public class UserProfileController {
63 AdminUserDO user = userService.getUser(getLoginUserId()); 63 AdminUserDO user = userService.getUser(getLoginUserId());
64 UserProfileRespVO resp = UserConvert.INSTANCE.convert03(user); 64 UserProfileRespVO resp = UserConvert.INSTANCE.convert03(user);
65 // 获得用户角色 65 // 获得用户角色
66 - List<RoleDO> userRoles = roleService.getRolesFromCache(permissionService.getUserRoleIdListByUserId(user.getId())); 66 + List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(user.getId()));
67 resp.setRoles(UserConvert.INSTANCE.convertList(userRoles)); 67 resp.setRoles(UserConvert.INSTANCE.convertList(userRoles));
68 // 获得部门信息 68 // 获得部门信息
69 if (user.getDeptId() != null) { 69 if (user.getDeptId() != null) {
@@ -72,7 +72,7 @@ public class UserProfileController { @@ -72,7 +72,7 @@ public class UserProfileController {
72 } 72 }
73 // 获得岗位信息 73 // 获得岗位信息
74 if (CollUtil.isNotEmpty(user.getPostIds())) { 74 if (CollUtil.isNotEmpty(user.getPostIds())) {
75 - List<PostDO> posts = postService.getPosts(user.getPostIds()); 75 + List<PostDO> posts = postService.getPostList(user.getPostIds());
76 resp.setPosts(UserConvert.INSTANCE.convertList02(posts)); 76 resp.setPosts(UserConvert.INSTANCE.convertList02(posts));
77 } 77 }
78 // 获得社交用户信息 78 // 获得社交用户信息
@@ -99,7 +99,7 @@ public class UserProfileController { @@ -99,7 +99,7 @@ public class UserProfileController {
99 @Operation(summary = "上传用户个人头像") 99 @Operation(summary = "上传用户个人头像")
100 public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception { 100 public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception {
101 if (file.isEmpty()) { 101 if (file.isEmpty()) {
102 - throw ServiceExceptionUtil.exception(FILE_IS_EMPTY); 102 + throw exception(FILE_IS_EMPTY);
103 } 103 }
104 String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream()); 104 String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
105 return success(avatar); 105 return success(avatar);
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java
@@ -9,13 +9,15 @@ import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO; @@ -9,13 +9,15 @@ import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
9 import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; 9 import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
10 import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; 10 import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
11 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; 11 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
12 -import cn.iocoder.yudao.module.system.enums.permission.MenuIdEnum;  
13 import org.mapstruct.Mapper; 12 import org.mapstruct.Mapper;
14 import org.mapstruct.factory.Mappers; 13 import org.mapstruct.factory.Mappers;
15 import org.slf4j.LoggerFactory; 14 import org.slf4j.LoggerFactory;
16 15
17 import java.util.*; 16 import java.util.*;
18 17
  18 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList;
  19 +import static cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO.ID_ROOT;
  20 +
19 @Mapper 21 @Mapper
20 public interface AuthConvert { 22 public interface AuthConvert {
21 23
@@ -47,7 +49,7 @@ public interface AuthConvert { @@ -47,7 +49,7 @@ public interface AuthConvert {
47 Map<Long, AuthMenuRespVO> treeNodeMap = new LinkedHashMap<>(); 49 Map<Long, AuthMenuRespVO> treeNodeMap = new LinkedHashMap<>();
48 menuList.forEach(menu -> treeNodeMap.put(menu.getId(), AuthConvert.INSTANCE.convertTreeNode(menu))); 50 menuList.forEach(menu -> treeNodeMap.put(menu.getId(), AuthConvert.INSTANCE.convertTreeNode(menu)));
49 // 处理父子关系 51 // 处理父子关系
50 - treeNodeMap.values().stream().filter(node -> !node.getParentId().equals(MenuIdEnum.ROOT.getId())).forEach(childNode -> { 52 + treeNodeMap.values().stream().filter(node -> !node.getParentId().equals(ID_ROOT)).forEach(childNode -> {
51 // 获得父节点 53 // 获得父节点
52 AuthMenuRespVO parentNode = treeNodeMap.get(childNode.getParentId()); 54 AuthMenuRespVO parentNode = treeNodeMap.get(childNode.getParentId());
53 if (parentNode == null) { 55 if (parentNode == null) {
@@ -62,7 +64,7 @@ public interface AuthConvert { @@ -62,7 +64,7 @@ public interface AuthConvert {
62 parentNode.getChildren().add(childNode); 64 parentNode.getChildren().add(childNode);
63 }); 65 });
64 // 获得到所有的根节点 66 // 获得到所有的根节点
65 - return CollectionUtils.filterList(treeNodeMap.values(), node -> MenuIdEnum.ROOT.getId().equals(node.getParentId())); 67 + return filterList(treeNodeMap.values(), node -> ID_ROOT.equals(node.getParentId()));
66 } 68 }
67 69
68 SocialUserBindReqDTO convert(Long userId, Integer userType, AuthSocialLoginReqVO reqVO); 70 SocialUserBindReqDTO convert(Long userId, Integer userType, AuthSocialLoginReqVO reqVO);
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/permission/MenuDO.java
@@ -21,7 +21,12 @@ import lombok.EqualsAndHashCode; @@ -21,7 +21,12 @@ import lombok.EqualsAndHashCode;
21 public class MenuDO extends BaseDO { 21 public class MenuDO extends BaseDO {
22 22
23 /** 23 /**
24 - * 菜单ID 24 + * 菜单编号 - 根节点
  25 + */
  26 + public static final Long ID_ROOT = 0L;
  27 +
  28 + /**
  29 + * 菜单编号
25 */ 30 */
26 @TableId 31 @TableId
27 private Long id; 32 private Long id;
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/DeptMapper.java
@@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; @@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
4 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
5 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO; 5 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
6 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; 6 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
7 -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;  
8 import org.apache.ibatis.annotations.Mapper; 7 import org.apache.ibatis.annotations.Mapper;
9 8
10 import java.util.List; 9 import java.util.List;
@@ -19,9 +18,7 @@ public interface DeptMapper extends BaseMapperX&lt;DeptDO&gt; { @@ -19,9 +18,7 @@ public interface DeptMapper extends BaseMapperX&lt;DeptDO&gt; {
19 } 18 }
20 19
21 default DeptDO selectByParentIdAndName(Long parentId, String name) { 20 default DeptDO selectByParentIdAndName(Long parentId, String name) {
22 - return selectOne(new LambdaQueryWrapper<DeptDO>()  
23 - .eq(DeptDO::getParentId, parentId)  
24 - .eq(DeptDO::getName, name)); 21 + return selectOne(DeptDO::getParentId, parentId, DeptDO::getName, name);
25 } 22 }
26 23
27 default Long selectCountByParentId(Long parentId) { 24 default Long selectCountByParentId(Long parentId) {
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/PostMapper.java
@@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.system.dal.mysql.dept; @@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.system.dal.mysql.dept;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; 5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO; 6 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO;
7 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostPageReqVO; 7 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostPageReqVO;
8 import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO; 8 import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
9 -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;  
10 import org.apache.ibatis.annotations.Mapper; 9 import org.apache.ibatis.annotations.Mapper;
11 10
12 import java.util.Collection; 11 import java.util.Collection;
@@ -16,31 +15,32 @@ import java.util.List; @@ -16,31 +15,32 @@ import java.util.List;
16 public interface PostMapper extends BaseMapperX<PostDO> { 15 public interface PostMapper extends BaseMapperX<PostDO> {
17 16
18 default List<PostDO> selectList(Collection<Long> ids, Collection<Integer> statuses) { 17 default List<PostDO> selectList(Collection<Long> ids, Collection<Integer> statuses) {
19 - return selectList(new QueryWrapperX<PostDO>().inIfPresent("id", ids)  
20 - .inIfPresent("status", statuses)); 18 + return selectList(new LambdaQueryWrapperX<PostDO>()
  19 + .inIfPresent(PostDO::getId, ids)
  20 + .inIfPresent(PostDO::getStatus, statuses));
21 } 21 }
22 22
23 default PageResult<PostDO> selectPage(PostPageReqVO reqVO) { 23 default PageResult<PostDO> selectPage(PostPageReqVO reqVO) {
24 - return selectPage(reqVO, new QueryWrapperX<PostDO>()  
25 - .likeIfPresent("code", reqVO.getCode())  
26 - .likeIfPresent("name", reqVO.getName())  
27 - .eqIfPresent("status", reqVO.getStatus())  
28 - .orderByDesc("id")); 24 + return selectPage(reqVO, new LambdaQueryWrapperX<PostDO>()
  25 + .likeIfPresent(PostDO::getCode, reqVO.getCode())
  26 + .likeIfPresent(PostDO::getName, reqVO.getName())
  27 + .eqIfPresent(PostDO::getStatus, reqVO.getStatus())
  28 + .orderByDesc(PostDO::getId));
29 } 29 }
30 30
31 default List<PostDO> selectList(PostExportReqVO reqVO) { 31 default List<PostDO> selectList(PostExportReqVO reqVO) {
32 - return selectList(new QueryWrapperX<PostDO>()  
33 - .likeIfPresent("code", reqVO.getCode())  
34 - .likeIfPresent("name", reqVO.getName())  
35 - .eqIfPresent("status", reqVO.getStatus())); 32 + return selectList(new LambdaQueryWrapperX<PostDO>()
  33 + .likeIfPresent(PostDO::getCode, reqVO.getCode())
  34 + .likeIfPresent(PostDO::getName, reqVO.getName())
  35 + .eqIfPresent(PostDO::getStatus, reqVO.getStatus()));
36 } 36 }
37 37
38 default PostDO selectByName(String name) { 38 default PostDO selectByName(String name) {
39 - return selectOne(new QueryWrapper<PostDO>().eq("name", name)); 39 + return selectOne(PostDO::getName, name);
40 } 40 }
41 41
42 default PostDO selectByCode(String code) { 42 default PostDO selectByCode(String code) {
43 - return selectOne(new QueryWrapper<PostDO>().eq("code", code)); 43 + return selectOne(PostDO::getCode, code);
44 } 44 }
45 45
46 } 46 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/UserPostMapper.java
@@ -13,8 +13,7 @@ import java.util.List; @@ -13,8 +13,7 @@ import java.util.List;
13 public interface UserPostMapper extends BaseMapperX<UserPostDO> { 13 public interface UserPostMapper extends BaseMapperX<UserPostDO> {
14 14
15 default List<UserPostDO> selectListByUserId(Long userId) { 15 default List<UserPostDO> selectListByUserId(Long userId) {
16 - return selectList(new LambdaQueryWrapperX<UserPostDO>()  
17 - .eq(UserPostDO::getUserId, userId)); 16 + return selectList(UserPostDO::getUserId, userId);
18 } 17 }
19 18
20 default void deleteByUserIdAndPostId(Long userId, Collection<Long> postIds) { 19 default void deleteByUserIdAndPostId(Long userId, Collection<Long> postIds) {
@@ -24,11 +23,10 @@ public interface UserPostMapper extends BaseMapperX&lt;UserPostDO&gt; { @@ -24,11 +23,10 @@ public interface UserPostMapper extends BaseMapperX&lt;UserPostDO&gt; {
24 } 23 }
25 24
26 default List<UserPostDO> selectListByPostIds(Collection<Long> postIds) { 25 default List<UserPostDO> selectListByPostIds(Collection<Long> postIds) {
27 - return selectList(new LambdaQueryWrapperX<UserPostDO>()  
28 - .in(UserPostDO::getPostId, postIds)); 26 + return selectList(UserPostDO::getPostId, postIds);
29 } 27 }
30 28
31 - default void deleteByUserId(Long userId){ 29 + default void deleteByUserId(Long userId) {
32 delete(Wrappers.lambdaUpdate(UserPostDO.class).eq(UserPostDO::getUserId, userId)); 30 delete(Wrappers.lambdaUpdate(UserPostDO.class).eq(UserPostDO::getUserId, userId));
33 } 31 }
34 } 32 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/DictDataMapper.java
@@ -17,13 +17,11 @@ import java.util.List; @@ -17,13 +17,11 @@ import java.util.List;
17 public interface DictDataMapper extends BaseMapperX<DictDataDO> { 17 public interface DictDataMapper extends BaseMapperX<DictDataDO> {
18 18
19 default DictDataDO selectByDictTypeAndValue(String dictType, String value) { 19 default DictDataDO selectByDictTypeAndValue(String dictType, String value) {
20 - return selectOne(new LambdaQueryWrapper<DictDataDO>().eq(DictDataDO::getDictType, dictType)  
21 - .eq(DictDataDO::getValue, value)); 20 + return selectOne(DictDataDO::getDictType, dictType, DictDataDO::getValue, value);
22 } 21 }
23 22
24 default DictDataDO selectByDictTypeAndLabel(String dictType, String label) { 23 default DictDataDO selectByDictTypeAndLabel(String dictType, String label) {
25 - return selectOne(new LambdaQueryWrapper<DictDataDO>().eq(DictDataDO::getDictType, dictType)  
26 - .eq(DictDataDO::getLabel, label)); 24 + return selectOne(DictDataDO::getDictType, dictType, DictDataDO::getLabel, label);
27 } 25 }
28 26
29 default List<DictDataDO> selectByDictTypeAndValues(String dictType, Collection<String> values) { 27 default List<DictDataDO> selectByDictTypeAndValues(String dictType, Collection<String> values) {
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/errorcode/ErrorCodeMapper.java
@@ -36,11 +36,11 @@ public interface ErrorCodeMapper extends BaseMapperX&lt;ErrorCodeDO&gt; { @@ -36,11 +36,11 @@ public interface ErrorCodeMapper extends BaseMapperX&lt;ErrorCodeDO&gt; {
36 } 36 }
37 37
38 default List<ErrorCodeDO> selectListByCodes(Collection<Integer> codes) { 38 default List<ErrorCodeDO> selectListByCodes(Collection<Integer> codes) {
39 - return selectList(new LambdaQueryWrapperX<ErrorCodeDO>().in(ErrorCodeDO::getCode, codes)); 39 + return selectList(ErrorCodeDO::getCode, codes);
40 } 40 }
41 41
42 default ErrorCodeDO selectByCode(Integer code) { 42 default ErrorCodeDO selectByCode(Integer code) {
43 - return selectOne(new LambdaQueryWrapperX<ErrorCodeDO>().eq(ErrorCodeDO::getCode, code)); 43 + return selectOne(ErrorCodeDO::getCode, code);
44 } 44 }
45 45
46 default List<ErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, LocalDateTime minUpdateTime) { 46 default List<ErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, LocalDateTime minUpdateTime) {
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/MenuMapper.java
@@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; @@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
4 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
5 import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuListReqVO; 5 import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuListReqVO;
6 import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; 6 import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
7 -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;  
8 import org.apache.ibatis.annotations.Mapper; 7 import org.apache.ibatis.annotations.Mapper;
9 8
10 import java.util.List; 9 import java.util.List;
@@ -13,8 +12,7 @@ import java.util.List; @@ -13,8 +12,7 @@ import java.util.List;
13 public interface MenuMapper extends BaseMapperX<MenuDO> { 12 public interface MenuMapper extends BaseMapperX<MenuDO> {
14 13
15 default MenuDO selectByParentIdAndName(Long parentId, String name) { 14 default MenuDO selectByParentIdAndName(Long parentId, String name) {
16 - return selectOne(new LambdaQueryWrapper<MenuDO>().eq(MenuDO::getParentId, parentId)  
17 - .eq(MenuDO::getName, name)); 15 + return selectOne(MenuDO::getParentId, parentId, MenuDO::getName, name);
18 } 16 }
19 17
20 default Long selectCountByParentId(Long parentId) { 18 default Long selectCountByParentId(Long parentId) {
@@ -22,7 +20,8 @@ public interface MenuMapper extends BaseMapperX&lt;MenuDO&gt; { @@ -22,7 +20,8 @@ public interface MenuMapper extends BaseMapperX&lt;MenuDO&gt; {
22 } 20 }
23 21
24 default List<MenuDO> selectList(MenuListReqVO reqVO) { 22 default List<MenuDO> selectList(MenuListReqVO reqVO) {
25 - return selectList(new LambdaQueryWrapperX<MenuDO>().likeIfPresent(MenuDO::getName, reqVO.getName()) 23 + return selectList(new LambdaQueryWrapperX<MenuDO>()
  24 + .likeIfPresent(MenuDO::getName, reqVO.getName())
26 .eqIfPresent(MenuDO::getStatus, reqVO.getStatus())); 25 .eqIfPresent(MenuDO::getStatus, reqVO.getStatus()));
27 } 26 }
28 27
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/social/SocialUserBindMapper.java
@@ -24,9 +24,8 @@ public interface SocialUserBindMapper extends BaseMapperX&lt;SocialUserBindDO&gt; { @@ -24,9 +24,8 @@ public interface SocialUserBindMapper extends BaseMapperX&lt;SocialUserBindDO&gt; {
24 } 24 }
25 25
26 default SocialUserBindDO selectByUserTypeAndSocialUserId(Integer userType, Long socialUserId) { 26 default SocialUserBindDO selectByUserTypeAndSocialUserId(Integer userType, Long socialUserId) {
27 - return selectOne(new LambdaQueryWrapperX<SocialUserBindDO>()  
28 - .eq(SocialUserBindDO::getUserType, userType)  
29 - .eq(SocialUserBindDO::getSocialUserId, socialUserId)); 27 + return selectOne(SocialUserBindDO::getUserType, userType,
  28 + SocialUserBindDO::getSocialUserId, socialUserId);
30 } 29 }
31 30
32 default List<SocialUserBindDO> selectListByUserIdAndUserType(Long userId, Integer userType) { 31 default List<SocialUserBindDO> selectListByUserIdAndUserType(Long userId, Integer userType) {
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java
@@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO; 6 import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO;
7 import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; 7 import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
8 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; 8 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
9 -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;  
10 import org.apache.ibatis.annotations.Mapper; 9 import org.apache.ibatis.annotations.Mapper;
11 10
12 import java.util.Collection; 11 import java.util.Collection;
@@ -16,15 +15,15 @@ import java.util.List; @@ -16,15 +15,15 @@ import java.util.List;
16 public interface AdminUserMapper extends BaseMapperX<AdminUserDO> { 15 public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
17 16
18 default AdminUserDO selectByUsername(String username) { 17 default AdminUserDO selectByUsername(String username) {
19 - return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getUsername, username)); 18 + return selectOne(AdminUserDO::getUsername, username);
20 } 19 }
21 20
22 default AdminUserDO selectByEmail(String email) { 21 default AdminUserDO selectByEmail(String email) {
23 - return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getEmail, email)); 22 + return selectOne(AdminUserDO::getEmail, email);
24 } 23 }
25 24
26 default AdminUserDO selectByMobile(String mobile) { 25 default AdminUserDO selectByMobile(String mobile) {
27 - return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getMobile, mobile)); 26 + return selectOne(AdminUserDO::getMobile, mobile);
28 } 27 }
29 28
30 default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) { 29 default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
@@ -50,10 +49,6 @@ public interface AdminUserMapper extends BaseMapperX&lt;AdminUserDO&gt; { @@ -50,10 +49,6 @@ public interface AdminUserMapper extends BaseMapperX&lt;AdminUserDO&gt; {
50 return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname)); 49 return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname));
51 } 50 }
52 51
53 - default List<AdminUserDO> selectListByUsername(String username) {  
54 - return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getUsername, username));  
55 - }  
56 -  
57 default List<AdminUserDO> selectListByStatus(Integer status) { 52 default List<AdminUserDO> selectListByStatus(Integer status) {
58 return selectList(AdminUserDO::getStatus, status); 53 return selectList(AdminUserDO::getStatus, status);
59 } 54 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java
@@ -94,7 +94,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { @@ -94,7 +94,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
94 @Override 94 @Override
95 public AuthLoginRespVO login(AuthLoginReqVO reqVO) { 95 public AuthLoginRespVO login(AuthLoginReqVO reqVO) {
96 // 校验验证码 96 // 校验验证码
97 - verifyCaptcha(reqVO); 97 + validateCaptcha(reqVO);
98 98
99 // 使用账号密码,进行登录 99 // 使用账号密码,进行登录
100 AdminUserDO user = authenticate(reqVO.getUsername(), reqVO.getPassword()); 100 AdminUserDO user = authenticate(reqVO.getUsername(), reqVO.getPassword());
@@ -171,14 +171,8 @@ public class AdminAuthServiceImpl implements AdminAuthService { @@ -171,14 +171,8 @@ public class AdminAuthServiceImpl implements AdminAuthService {
171 return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL); 171 return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
172 } 172 }
173 173
174 - @Override  
175 - public AuthLoginRespVO refreshToken(String refreshToken) {  
176 - OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, OAuth2ClientConstants.CLIENT_ID_DEFAULT);  
177 - return AuthConvert.INSTANCE.convert(accessTokenDO);  
178 - }  
179 -  
180 @VisibleForTesting 174 @VisibleForTesting
181 - void verifyCaptcha(AuthLoginReqVO reqVO) { 175 + void validateCaptcha(AuthLoginReqVO reqVO) {
182 // 如果验证码关闭,则不进行校验 176 // 如果验证码关闭,则不进行校验
183 if (!captchaEnable) { 177 if (!captchaEnable) {
184 return; 178 return;
@@ -207,6 +201,12 @@ public class AdminAuthServiceImpl implements AdminAuthService { @@ -207,6 +201,12 @@ public class AdminAuthServiceImpl implements AdminAuthService {
207 } 201 }
208 202
209 @Override 203 @Override
  204 + public AuthLoginRespVO refreshToken(String refreshToken) {
  205 + OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, OAuth2ClientConstants.CLIENT_ID_DEFAULT);
  206 + return AuthConvert.INSTANCE.convert(accessTokenDO);
  207 + }
  208 +
  209 + @Override
210 public void logout(String token, Integer logType) { 210 public void logout(String token, Integer logType) {
211 // 删除访问令牌 211 // 删除访问令牌
212 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.removeAccessToken(token); 212 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.removeAccessToken(token);
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java
@@ -52,7 +52,7 @@ public interface DeptService { @@ -52,7 +52,7 @@ public interface DeptService {
52 * @param reqVO 筛选条件请求 VO 52 * @param reqVO 筛选条件请求 VO
53 * @return 部门列表 53 * @return 部门列表
54 */ 54 */
55 - List<DeptDO> getSimpleDepts(DeptListReqVO reqVO); 55 + List<DeptDO> getDeptList(DeptListReqVO reqVO);
56 56
57 /** 57 /**
58 * 获得所有子部门,从缓存中 58 * 获得所有子部门,从缓存中
@@ -61,7 +61,7 @@ public interface DeptService { @@ -61,7 +61,7 @@ public interface DeptService {
61 * @param recursive 是否递归获取所有 61 * @param recursive 是否递归获取所有
62 * @return 子部门列表 62 * @return 子部门列表
63 */ 63 */
64 - List<DeptDO> getDeptsByParentIdFromCache(Long parentId, boolean recursive); 64 + List<DeptDO> getDeptListByParentIdFromCache(Long parentId, boolean recursive);
65 65
66 /** 66 /**
67 * 获得部门信息数组 67 * 获得部门信息数组
@@ -69,7 +69,21 @@ public interface DeptService { @@ -69,7 +69,21 @@ public interface DeptService {
69 * @param ids 部门编号数组 69 * @param ids 部门编号数组
70 * @return 部门信息数组 70 * @return 部门信息数组
71 */ 71 */
72 - List<DeptDO> getDepts(Collection<Long> ids); 72 + List<DeptDO> getDeptList(Collection<Long> ids);
  73 +
  74 + /**
  75 + * 获得指定编号的部门 Map
  76 + *
  77 + * @param ids 部门编号数组
  78 + * @return 部门 Map
  79 + */
  80 + default Map<Long, DeptDO> getDeptMap(Collection<Long> ids) {
  81 + if (CollUtil.isEmpty(ids)) {
  82 + return Collections.emptyMap();
  83 + }
  84 + List<DeptDO> list = getDeptList(ids);
  85 + return CollectionUtils.convertMap(list, DeptDO::getId);
  86 + }
73 87
74 /** 88 /**
75 * 获得部门信息 89 * 获得部门信息
@@ -86,27 +100,6 @@ public interface DeptService { @@ -86,27 +100,6 @@ public interface DeptService {
86 * 100 *
87 * @param ids 角色编号数组 101 * @param ids 角色编号数组
88 */ 102 */
89 - void validDepts(Collection<Long> ids); 103 + void validateDeptList(Collection<Long> ids);
90 104
91 - /**  
92 - * 获得指定编号的部门列表  
93 - *  
94 - * @param ids 部门编号数组  
95 - * @return 部门列表  
96 - */  
97 - List<DeptDO> getSimpleDepts(Collection<Long> ids);  
98 -  
99 - /**  
100 - * 获得指定编号的部门 Map  
101 - *  
102 - * @param ids 部门编号数组  
103 - * @return 部门 Map  
104 - */  
105 - default Map<Long, DeptDO> getDeptMap(Collection<Long> ids) {  
106 - if (CollUtil.isEmpty(ids)) {  
107 - return Collections.emptyMap();  
108 - }  
109 - List<DeptDO> list = getSimpleDepts(ids);  
110 - return CollectionUtils.convertMap(list, DeptDO::getId);  
111 - }  
112 } 105 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java
@@ -2,8 +2,6 @@ package cn.iocoder.yudao.module.system.service.dept; @@ -2,8 +2,6 @@ package cn.iocoder.yudao.module.system.service.dept;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
4 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 4 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
5 -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;  
6 -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;  
7 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; 5 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
8 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; 6 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
9 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO; 7 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO;
@@ -19,13 +17,11 @@ import com.google.common.collect.ImmutableMultimap; @@ -19,13 +17,11 @@ import com.google.common.collect.ImmutableMultimap;
19 import com.google.common.collect.Multimap; 17 import com.google.common.collect.Multimap;
20 import lombok.Getter; 18 import lombok.Getter;
21 import lombok.extern.slf4j.Slf4j; 19 import lombok.extern.slf4j.Slf4j;
22 -import org.springframework.scheduling.annotation.Scheduled;  
23 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
24 import org.springframework.validation.annotation.Validated; 21 import org.springframework.validation.annotation.Validated;
25 22
26 import javax.annotation.PostConstruct; 23 import javax.annotation.PostConstruct;
27 import javax.annotation.Resource; 24 import javax.annotation.Resource;
28 -import java.time.LocalDateTime;  
29 import java.util.*; 25 import java.util.*;
30 26
31 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 27 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -95,7 +91,7 @@ public class DeptServiceImpl implements DeptService { @@ -95,7 +91,7 @@ public class DeptServiceImpl implements DeptService {
95 if (reqVO.getParentId() == null) { 91 if (reqVO.getParentId() == null) {
96 reqVO.setParentId(DeptIdEnum.ROOT.getId()); 92 reqVO.setParentId(DeptIdEnum.ROOT.getId());
97 } 93 }
98 - checkCreateOrUpdate(null, reqVO.getParentId(), reqVO.getName()); 94 + validateForCreateOrUpdate(null, reqVO.getParentId(), reqVO.getName());
99 // 插入部门 95 // 插入部门
100 DeptDO dept = DeptConvert.INSTANCE.convert(reqVO); 96 DeptDO dept = DeptConvert.INSTANCE.convert(reqVO);
101 deptMapper.insert(dept); 97 deptMapper.insert(dept);
@@ -110,7 +106,7 @@ public class DeptServiceImpl implements DeptService { @@ -110,7 +106,7 @@ public class DeptServiceImpl implements DeptService {
110 if (reqVO.getParentId() == null) { 106 if (reqVO.getParentId() == null) {
111 reqVO.setParentId(DeptIdEnum.ROOT.getId()); 107 reqVO.setParentId(DeptIdEnum.ROOT.getId());
112 } 108 }
113 - checkCreateOrUpdate(reqVO.getId(), reqVO.getParentId(), reqVO.getName()); 109 + validateForCreateOrUpdate(reqVO.getId(), reqVO.getParentId(), reqVO.getName());
114 // 更新部门 110 // 更新部门
115 DeptDO updateObj = DeptConvert.INSTANCE.convert(reqVO); 111 DeptDO updateObj = DeptConvert.INSTANCE.convert(reqVO);
116 deptMapper.updateById(updateObj); 112 deptMapper.updateById(updateObj);
@@ -121,10 +117,10 @@ public class DeptServiceImpl implements DeptService { @@ -121,10 +117,10 @@ public class DeptServiceImpl implements DeptService {
121 @Override 117 @Override
122 public void deleteDept(Long id) { 118 public void deleteDept(Long id) {
123 // 校验是否存在 119 // 校验是否存在
124 - checkDeptExists(id); 120 + validateDeptExists(id);
125 // 校验是否有子部门 121 // 校验是否有子部门
126 if (deptMapper.selectCountByParentId(id) > 0) { 122 if (deptMapper.selectCountByParentId(id) > 0) {
127 - throw ServiceExceptionUtil.exception(DEPT_EXITS_CHILDREN); 123 + throw exception(DEPT_EXITS_CHILDREN);
128 } 124 }
129 // 删除部门 125 // 删除部门
130 deptMapper.deleteById(id); 126 deptMapper.deleteById(id);
@@ -133,20 +129,20 @@ public class DeptServiceImpl implements DeptService { @@ -133,20 +129,20 @@ public class DeptServiceImpl implements DeptService {
133 } 129 }
134 130
135 @Override 131 @Override
136 - public List<DeptDO> getSimpleDepts(DeptListReqVO reqVO) { 132 + public List<DeptDO> getDeptList(DeptListReqVO reqVO) {
137 return deptMapper.selectList(reqVO); 133 return deptMapper.selectList(reqVO);
138 } 134 }
139 135
140 @Override 136 @Override
141 - public List<DeptDO> getDeptsByParentIdFromCache(Long parentId, boolean recursive) { 137 + public List<DeptDO> getDeptListByParentIdFromCache(Long parentId, boolean recursive) {
142 if (parentId == null) { 138 if (parentId == null) {
143 return Collections.emptyList(); 139 return Collections.emptyList();
144 } 140 }
145 - List<DeptDO> result = new ArrayList<>(); // TODO 芋艿:待优化,新增缓存,避免每次遍历的计算 141 + List<DeptDO> result = new ArrayList<>();
146 // 递归,简单粗暴 142 // 递归,简单粗暴
147 - this.getDeptsByParentIdFromCache(result, parentId,  
148 - recursive ? Integer.MAX_VALUE : 1, // 如果递归获取,则无限;否则,只递归 1 次  
149 - parentDeptCache); 143 + getDeptsByParentIdFromCache(result, parentId,
  144 + recursive ? Integer.MAX_VALUE : 1, // 如果递归获取,则无限;否则,只递归 1 次
  145 + parentDeptCache);
150 return result; 146 return result;
151 } 147 }
152 148
@@ -182,65 +178,65 @@ public class DeptServiceImpl implements DeptService { @@ -182,65 +178,65 @@ public class DeptServiceImpl implements DeptService {
182 recursiveCount - 1, parentDeptMap)); 178 recursiveCount - 1, parentDeptMap));
183 } 179 }
184 180
185 - private void checkCreateOrUpdate(Long id, Long parentId, String name) { 181 + private void validateForCreateOrUpdate(Long id, Long parentId, String name) {
186 // 校验自己存在 182 // 校验自己存在
187 - checkDeptExists(id); 183 + validateDeptExists(id);
188 // 校验父部门的有效性 184 // 校验父部门的有效性
189 - checkParentDeptEnable(id, parentId); 185 + validateParentDeptEnable(id, parentId);
190 // 校验部门名的唯一性 186 // 校验部门名的唯一性
191 - checkDeptNameUnique(id, parentId, name); 187 + validateDeptNameUnique(id, parentId, name);
192 } 188 }
193 189
194 - private void checkParentDeptEnable(Long id, Long parentId) { 190 + private void validateParentDeptEnable(Long id, Long parentId) {
195 if (parentId == null || DeptIdEnum.ROOT.getId().equals(parentId)) { 191 if (parentId == null || DeptIdEnum.ROOT.getId().equals(parentId)) {
196 return; 192 return;
197 } 193 }
198 // 不能设置自己为父部门 194 // 不能设置自己为父部门
199 if (parentId.equals(id)) { 195 if (parentId.equals(id)) {
200 - throw ServiceExceptionUtil.exception(DEPT_PARENT_ERROR); 196 + throw exception(DEPT_PARENT_ERROR);
201 } 197 }
202 // 父岗位不存在 198 // 父岗位不存在
203 DeptDO dept = deptMapper.selectById(parentId); 199 DeptDO dept = deptMapper.selectById(parentId);
204 if (dept == null) { 200 if (dept == null) {
205 - throw ServiceExceptionUtil.exception(DEPT_PARENT_NOT_EXITS); 201 + throw exception(DEPT_PARENT_NOT_EXITS);
206 } 202 }
207 // 父部门被禁用 203 // 父部门被禁用
208 if (!CommonStatusEnum.ENABLE.getStatus().equals(dept.getStatus())) { 204 if (!CommonStatusEnum.ENABLE.getStatus().equals(dept.getStatus())) {
209 - throw ServiceExceptionUtil.exception(DEPT_NOT_ENABLE); 205 + throw exception(DEPT_NOT_ENABLE);
210 } 206 }
211 // 父部门不能是原来的子部门 207 // 父部门不能是原来的子部门
212 - List<DeptDO> children = this.getDeptsByParentIdFromCache(id, true); 208 + List<DeptDO> children = getDeptListByParentIdFromCache(id, true);
213 if (children.stream().anyMatch(dept1 -> dept1.getId().equals(parentId))) { 209 if (children.stream().anyMatch(dept1 -> dept1.getId().equals(parentId))) {
214 - throw ServiceExceptionUtil.exception(DEPT_PARENT_IS_CHILD); 210 + throw exception(DEPT_PARENT_IS_CHILD);
215 } 211 }
216 } 212 }
217 213
218 - private void checkDeptExists(Long id) { 214 + private void validateDeptExists(Long id) {
219 if (id == null) { 215 if (id == null) {
220 return; 216 return;
221 } 217 }
222 DeptDO dept = deptMapper.selectById(id); 218 DeptDO dept = deptMapper.selectById(id);
223 if (dept == null) { 219 if (dept == null) {
224 - throw ServiceExceptionUtil.exception(DEPT_NOT_FOUND); 220 + throw exception(DEPT_NOT_FOUND);
225 } 221 }
226 } 222 }
227 223
228 - private void checkDeptNameUnique(Long id, Long parentId, String name) { 224 + private void validateDeptNameUnique(Long id, Long parentId, String name) {
229 DeptDO menu = deptMapper.selectByParentIdAndName(parentId, name); 225 DeptDO menu = deptMapper.selectByParentIdAndName(parentId, name);
230 if (menu == null) { 226 if (menu == null) {
231 return; 227 return;
232 } 228 }
233 // 如果 id 为空,说明不用比较是否为相同 id 的岗位 229 // 如果 id 为空,说明不用比较是否为相同 id 的岗位
234 if (id == null) { 230 if (id == null) {
235 - throw ServiceExceptionUtil.exception(DEPT_NAME_DUPLICATE); 231 + throw exception(DEPT_NAME_DUPLICATE);
236 } 232 }
237 if (!menu.getId().equals(id)) { 233 if (!menu.getId().equals(id)) {
238 - throw ServiceExceptionUtil.exception(DEPT_NAME_DUPLICATE); 234 + throw exception(DEPT_NAME_DUPLICATE);
239 } 235 }
240 } 236 }
241 237
242 @Override 238 @Override
243 - public List<DeptDO> getDepts(Collection<Long> ids) { 239 + public List<DeptDO> getDeptList(Collection<Long> ids) {
244 return deptMapper.selectBatchIds(ids); 240 return deptMapper.selectBatchIds(ids);
245 } 241 }
246 242
@@ -250,13 +246,12 @@ public class DeptServiceImpl implements DeptService { @@ -250,13 +246,12 @@ public class DeptServiceImpl implements DeptService {
250 } 246 }
251 247
252 @Override 248 @Override
253 - public void validDepts(Collection<Long> ids) { 249 + public void validateDeptList(Collection<Long> ids) {
254 if (CollUtil.isEmpty(ids)) { 250 if (CollUtil.isEmpty(ids)) {
255 return; 251 return;
256 } 252 }
257 // 获得科室信息 253 // 获得科室信息
258 - List<DeptDO> depts = deptMapper.selectBatchIds(ids);  
259 - Map<Long, DeptDO> deptMap = CollectionUtils.convertMap(depts, DeptDO::getId); 254 + Map<Long, DeptDO> deptMap = getDeptMap(ids);
260 // 校验 255 // 校验
261 ids.forEach(id -> { 256 ids.forEach(id -> {
262 DeptDO dept = deptMap.get(id); 257 DeptDO dept = deptMap.get(id);
@@ -269,9 +264,4 @@ public class DeptServiceImpl implements DeptService { @@ -269,9 +264,4 @@ public class DeptServiceImpl implements DeptService {
269 }); 264 });
270 } 265 }
271 266
272 - @Override  
273 - public List<DeptDO> getSimpleDepts(Collection<Long> ids) {  
274 - return deptMapper.selectBatchIds(ids);  
275 - }  
276 -  
277 } 267 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostService.java
@@ -49,8 +49,8 @@ public interface PostService { @@ -49,8 +49,8 @@ public interface PostService {
49 * @param ids 岗位编号数组。如果为空,不进行筛选 49 * @param ids 岗位编号数组。如果为空,不进行筛选
50 * @return 部门列表 50 * @return 部门列表
51 */ 51 */
52 - default List<PostDO> getPosts(@Nullable Collection<Long> ids) {  
53 - return getPosts(ids, asSet(CommonStatusEnum.ENABLE.getStatus(), CommonStatusEnum.DISABLE.getStatus())); 52 + default List<PostDO> getPostList(@Nullable Collection<Long> ids) {
  53 + return getPostList(ids, asSet(CommonStatusEnum.ENABLE.getStatus(), CommonStatusEnum.DISABLE.getStatus()));
54 } 54 }
55 55
56 /** 56 /**
@@ -60,7 +60,7 @@ public interface PostService { @@ -60,7 +60,7 @@ public interface PostService {
60 * @param statuses 状态数组。如果为空,不进行筛选 60 * @param statuses 状态数组。如果为空,不进行筛选
61 * @return 部门列表 61 * @return 部门列表
62 */ 62 */
63 - List<PostDO> getPosts(@Nullable Collection<Long> ids, @Nullable Collection<Integer> statuses); 63 + List<PostDO> getPostList(@Nullable Collection<Long> ids, @Nullable Collection<Integer> statuses);
64 64
65 /** 65 /**
66 * 获得岗位分页列表 66 * 获得岗位分页列表
@@ -76,7 +76,7 @@ public interface PostService { @@ -76,7 +76,7 @@ public interface PostService {
76 * @param reqVO 查询条件 76 * @param reqVO 查询条件
77 * @return 部门列表 77 * @return 部门列表
78 */ 78 */
79 - List<PostDO> getPosts(PostExportReqVO reqVO); 79 + List<PostDO> getPostList(PostExportReqVO reqVO);
80 80
81 /** 81 /**
82 * 获得岗位信息 82 * 获得岗位信息
@@ -93,6 +93,6 @@ public interface PostService { @@ -93,6 +93,6 @@ public interface PostService {
93 * 93 *
94 * @param ids 岗位编号数组 94 * @param ids 岗位编号数组
95 */ 95 */
96 - void validPosts(Collection<Long> ids); 96 + void validatePostList(Collection<Long> ids);
97 97
98 } 98 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostServiceImpl.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.system.service.dept; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.system.service.dept;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
4 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 4 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
5 -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;  
6 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
7 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostCreateReqVO; 6 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostCreateReqVO;
8 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO; 7 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO;
@@ -38,7 +37,8 @@ public class PostServiceImpl implements PostService { @@ -38,7 +37,8 @@ public class PostServiceImpl implements PostService {
38 @Override 37 @Override
39 public Long createPost(PostCreateReqVO reqVO) { 38 public Long createPost(PostCreateReqVO reqVO) {
40 // 校验正确性 39 // 校验正确性
41 - this.checkCreateOrUpdate(null, reqVO.getName(), reqVO.getCode()); 40 + validatePostForCreateOrUpdate(null, reqVO.getName(), reqVO.getCode());
  41 +
42 // 插入岗位 42 // 插入岗位
43 PostDO post = PostConvert.INSTANCE.convert(reqVO); 43 PostDO post = PostConvert.INSTANCE.convert(reqVO);
44 postMapper.insert(post); 44 postMapper.insert(post);
@@ -48,7 +48,8 @@ public class PostServiceImpl implements PostService { @@ -48,7 +48,8 @@ public class PostServiceImpl implements PostService {
48 @Override 48 @Override
49 public void updatePost(PostUpdateReqVO reqVO) { 49 public void updatePost(PostUpdateReqVO reqVO) {
50 // 校验正确性 50 // 校验正确性
51 - this.checkCreateOrUpdate(reqVO.getId(), reqVO.getName(), reqVO.getCode()); 51 + validatePostForCreateOrUpdate(reqVO.getId(), reqVO.getName(), reqVO.getCode());
  52 +
52 // 更新岗位 53 // 更新岗位
53 PostDO updateObj = PostConvert.INSTANCE.convert(reqVO); 54 PostDO updateObj = PostConvert.INSTANCE.convert(reqVO);
54 postMapper.updateById(updateObj); 55 postMapper.updateById(updateObj);
@@ -57,80 +58,79 @@ public class PostServiceImpl implements PostService { @@ -57,80 +58,79 @@ public class PostServiceImpl implements PostService {
57 @Override 58 @Override
58 public void deletePost(Long id) { 59 public void deletePost(Long id) {
59 // 校验是否存在 60 // 校验是否存在
60 - this.checkPostExists(id); 61 + validatePostExists(id);
61 // 删除部门 62 // 删除部门
62 postMapper.deleteById(id); 63 postMapper.deleteById(id);
63 } 64 }
64 65
65 - @Override  
66 - public List<PostDO> getPosts(Collection<Long> ids, Collection<Integer> statuses) {  
67 - return postMapper.selectList(ids, statuses);  
68 - }  
69 -  
70 - @Override  
71 - public PageResult<PostDO> getPostPage(PostPageReqVO reqVO) {  
72 - return postMapper.selectPage(reqVO);  
73 - }  
74 -  
75 - @Override  
76 - public List<PostDO> getPosts(PostExportReqVO reqVO) {  
77 - return postMapper.selectList(reqVO);  
78 - }  
79 -  
80 - @Override  
81 - public PostDO getPost(Long id) {  
82 - return postMapper.selectById(id);  
83 - }  
84 -  
85 - private void checkCreateOrUpdate(Long id, String name, String code) { 66 + private void validatePostForCreateOrUpdate(Long id, String name, String code) {
86 // 校验自己存在 67 // 校验自己存在
87 - checkPostExists(id); 68 + validatePostExists(id);
88 // 校验岗位名的唯一性 69 // 校验岗位名的唯一性
89 - checkPostNameUnique(id, name); 70 + validatePostNameUnique(id, name);
90 // 校验岗位编码的唯一性 71 // 校验岗位编码的唯一性
91 - checkPostCodeUnique(id, code); 72 + validatePostCodeUnique(id, code);
92 } 73 }
93 74
94 - private void checkPostNameUnique(Long id, String name) { 75 + private void validatePostNameUnique(Long id, String name) {
95 PostDO post = postMapper.selectByName(name); 76 PostDO post = postMapper.selectByName(name);
96 if (post == null) { 77 if (post == null) {
97 return; 78 return;
98 } 79 }
99 // 如果 id 为空,说明不用比较是否为相同 id 的岗位 80 // 如果 id 为空,说明不用比较是否为相同 id 的岗位
100 if (id == null) { 81 if (id == null) {
101 - throw ServiceExceptionUtil.exception(POST_NAME_DUPLICATE); 82 + throw exception(POST_NAME_DUPLICATE);
102 } 83 }
103 if (!post.getId().equals(id)) { 84 if (!post.getId().equals(id)) {
104 - throw ServiceExceptionUtil.exception(POST_NAME_DUPLICATE); 85 + throw exception(POST_NAME_DUPLICATE);
105 } 86 }
106 } 87 }
107 88
108 - private void checkPostCodeUnique(Long id, String code) { 89 + private void validatePostCodeUnique(Long id, String code) {
109 PostDO post = postMapper.selectByCode(code); 90 PostDO post = postMapper.selectByCode(code);
110 if (post == null) { 91 if (post == null) {
111 return; 92 return;
112 } 93 }
113 // 如果 id 为空,说明不用比较是否为相同 id 的岗位 94 // 如果 id 为空,说明不用比较是否为相同 id 的岗位
114 if (id == null) { 95 if (id == null) {
115 - throw ServiceExceptionUtil.exception(POST_CODE_DUPLICATE); 96 + throw exception(POST_CODE_DUPLICATE);
116 } 97 }
117 if (!post.getId().equals(id)) { 98 if (!post.getId().equals(id)) {
118 - throw ServiceExceptionUtil.exception(POST_CODE_DUPLICATE); 99 + throw exception(POST_CODE_DUPLICATE);
119 } 100 }
120 } 101 }
121 102
122 - private void checkPostExists(Long id) { 103 + private void validatePostExists(Long id) {
123 if (id == null) { 104 if (id == null) {
124 return; 105 return;
125 } 106 }
126 - PostDO post = postMapper.selectById(id);  
127 - if (post == null) {  
128 - throw ServiceExceptionUtil.exception(POST_NOT_FOUND); 107 + if (postMapper.selectById(id) == null) {
  108 + throw exception(POST_NOT_FOUND);
129 } 109 }
130 } 110 }
131 111
132 @Override 112 @Override
133 - public void validPosts(Collection<Long> ids) { 113 + public List<PostDO> getPostList(Collection<Long> ids, Collection<Integer> statuses) {
  114 + return postMapper.selectList(ids, statuses);
  115 + }
  116 +
  117 + @Override
  118 + public PageResult<PostDO> getPostPage(PostPageReqVO reqVO) {
  119 + return postMapper.selectPage(reqVO);
  120 + }
  121 +
  122 + @Override
  123 + public List<PostDO> getPostList(PostExportReqVO reqVO) {
  124 + return postMapper.selectList(reqVO);
  125 + }
  126 +
  127 + @Override
  128 + public PostDO getPost(Long id) {
  129 + return postMapper.selectById(id);
  130 + }
  131 +
  132 + @Override
  133 + public void validatePostList(Collection<Long> ids) {
134 if (CollUtil.isEmpty(ids)) { 134 if (CollUtil.isEmpty(ids)) {
135 return; 135 return;
136 } 136 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java
@@ -44,7 +44,7 @@ public interface DictDataService { @@ -44,7 +44,7 @@ public interface DictDataService {
44 * 44 *
45 * @return 字典数据全列表 45 * @return 字典数据全列表
46 */ 46 */
47 - List<DictDataDO> getDictDatas(); 47 + List<DictDataDO> getDictDataList();
48 48
49 /** 49 /**
50 * 获得字典数据分页列表 50 * 获得字典数据分页列表
@@ -60,7 +60,7 @@ public interface DictDataService { @@ -60,7 +60,7 @@ public interface DictDataService {
60 * @param reqVO 列表请求 60 * @param reqVO 列表请求
61 * @return 字典数据列表 61 * @return 字典数据列表
62 */ 62 */
63 - List<DictDataDO> getDictDatas(DictDataExportReqVO reqVO); 63 + List<DictDataDO> getDictDataList(DictDataExportReqVO reqVO);
64 64
65 /** 65 /**
66 * 获得字典数据详情 66 * 获得字典数据详情
@@ -86,7 +86,7 @@ public interface DictDataService { @@ -86,7 +86,7 @@ public interface DictDataService {
86 * @param dictType 字典类型 86 * @param dictType 字典类型
87 * @param values 字典数据值的数组 87 * @param values 字典数据值的数组
88 */ 88 */
89 - void validDictDatas(String dictType, Collection<String> values); 89 + void validateDictDataList(String dictType, Collection<String> values);
90 90
91 /** 91 /**
92 * 获得指定的字典数据 92 * 获得指定的字典数据
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java
@@ -48,7 +48,7 @@ public class DictDataServiceImpl implements DictDataService { @@ -48,7 +48,7 @@ public class DictDataServiceImpl implements DictDataService {
48 private DictDataMapper dictDataMapper; 48 private DictDataMapper dictDataMapper;
49 49
50 @Override 50 @Override
51 - public List<DictDataDO> getDictDatas() { 51 + public List<DictDataDO> getDictDataList() {
52 List<DictDataDO> list = dictDataMapper.selectList(); 52 List<DictDataDO> list = dictDataMapper.selectList();
53 list.sort(COMPARATOR_TYPE_AND_SORT); 53 list.sort(COMPARATOR_TYPE_AND_SORT);
54 return list; 54 return list;
@@ -60,7 +60,7 @@ public class DictDataServiceImpl implements DictDataService { @@ -60,7 +60,7 @@ public class DictDataServiceImpl implements DictDataService {
60 } 60 }
61 61
62 @Override 62 @Override
63 - public List<DictDataDO> getDictDatas(DictDataExportReqVO reqVO) { 63 + public List<DictDataDO> getDictDataList(DictDataExportReqVO reqVO) {
64 List<DictDataDO> list = dictDataMapper.selectList(reqVO); 64 List<DictDataDO> list = dictDataMapper.selectList(reqVO);
65 list.sort(COMPARATOR_TYPE_AND_SORT); 65 list.sort(COMPARATOR_TYPE_AND_SORT);
66 return list; 66 return list;
@@ -74,7 +74,7 @@ public class DictDataServiceImpl implements DictDataService { @@ -74,7 +74,7 @@ public class DictDataServiceImpl implements DictDataService {
74 @Override 74 @Override
75 public Long createDictData(DictDataCreateReqVO reqVO) { 75 public Long createDictData(DictDataCreateReqVO reqVO) {
76 // 校验正确性 76 // 校验正确性
77 - checkCreateOrUpdate(null, reqVO.getValue(), reqVO.getDictType()); 77 + validateDictDataForCreateOrUpdate(null, reqVO.getValue(), reqVO.getDictType());
78 78
79 // 插入字典类型 79 // 插入字典类型
80 DictDataDO dictData = DictDataConvert.INSTANCE.convert(reqVO); 80 DictDataDO dictData = DictDataConvert.INSTANCE.convert(reqVO);
@@ -85,7 +85,7 @@ public class DictDataServiceImpl implements DictDataService { @@ -85,7 +85,7 @@ public class DictDataServiceImpl implements DictDataService {
85 @Override 85 @Override
86 public void updateDictData(DictDataUpdateReqVO reqVO) { 86 public void updateDictData(DictDataUpdateReqVO reqVO) {
87 // 校验正确性 87 // 校验正确性
88 - checkCreateOrUpdate(reqVO.getId(), reqVO.getValue(), reqVO.getDictType()); 88 + validateDictDataForCreateOrUpdate(reqVO.getId(), reqVO.getValue(), reqVO.getDictType());
89 89
90 // 更新字典类型 90 // 更新字典类型
91 DictDataDO updateObj = DictDataConvert.INSTANCE.convert(reqVO); 91 DictDataDO updateObj = DictDataConvert.INSTANCE.convert(reqVO);
@@ -95,7 +95,7 @@ public class DictDataServiceImpl implements DictDataService { @@ -95,7 +95,7 @@ public class DictDataServiceImpl implements DictDataService {
95 @Override 95 @Override
96 public void deleteDictData(Long id) { 96 public void deleteDictData(Long id) {
97 // 校验是否存在 97 // 校验是否存在
98 - checkDictDataExists(id); 98 + validateDictDataExists(id);
99 99
100 // 删除字典数据 100 // 删除字典数据
101 dictDataMapper.deleteById(id); 101 dictDataMapper.deleteById(id);
@@ -106,18 +106,17 @@ public class DictDataServiceImpl implements DictDataService { @@ -106,18 +106,17 @@ public class DictDataServiceImpl implements DictDataService {
106 return dictDataMapper.selectCountByDictType(dictType); 106 return dictDataMapper.selectCountByDictType(dictType);
107 } 107 }
108 108
109 -  
110 - private void checkCreateOrUpdate(Long id, String value, String dictType) { 109 + private void validateDictDataForCreateOrUpdate(Long id, String value, String dictType) {
111 // 校验自己存在 110 // 校验自己存在
112 - checkDictDataExists(id); 111 + validateDictDataExists(id);
113 // 校验字典类型有效 112 // 校验字典类型有效
114 - checkDictTypeValid(dictType); 113 + validateDictTypeExists(dictType);
115 // 校验字典数据的值的唯一性 114 // 校验字典数据的值的唯一性
116 - checkDictDataValueUnique(id, dictType, value); 115 + validateDictDataValueUnique(id, dictType, value);
117 } 116 }
118 117
119 @VisibleForTesting 118 @VisibleForTesting
120 - public void checkDictDataValueUnique(Long id, String dictType, String value) { 119 + public void validateDictDataValueUnique(Long id, String dictType, String value) {
121 DictDataDO dictData = dictDataMapper.selectByDictTypeAndValue(dictType, value); 120 DictDataDO dictData = dictDataMapper.selectByDictTypeAndValue(dictType, value);
122 if (dictData == null) { 121 if (dictData == null) {
123 return; 122 return;
@@ -132,7 +131,7 @@ public class DictDataServiceImpl implements DictDataService { @@ -132,7 +131,7 @@ public class DictDataServiceImpl implements DictDataService {
132 } 131 }
133 132
134 @VisibleForTesting 133 @VisibleForTesting
135 - public void checkDictDataExists(Long id) { 134 + public void validateDictDataExists(Long id) {
136 if (id == null) { 135 if (id == null) {
137 return; 136 return;
138 } 137 }
@@ -143,7 +142,7 @@ public class DictDataServiceImpl implements DictDataService { @@ -143,7 +142,7 @@ public class DictDataServiceImpl implements DictDataService {
143 } 142 }
144 143
145 @VisibleForTesting 144 @VisibleForTesting
146 - public void checkDictTypeValid(String type) { 145 + public void validateDictTypeExists(String type) {
147 DictTypeDO dictType = dictTypeService.getDictType(type); 146 DictTypeDO dictType = dictTypeService.getDictType(type);
148 if (dictType == null) { 147 if (dictType == null) {
149 throw exception(DICT_TYPE_NOT_EXISTS); 148 throw exception(DICT_TYPE_NOT_EXISTS);
@@ -154,7 +153,7 @@ public class DictDataServiceImpl implements DictDataService { @@ -154,7 +153,7 @@ public class DictDataServiceImpl implements DictDataService {
154 } 153 }
155 154
156 @Override 155 @Override
157 - public void validDictDatas(String dictType, Collection<String> values) { 156 + public void validateDictDataList(String dictType, Collection<String> values) {
158 if (CollUtil.isEmpty(values)) { 157 if (CollUtil.isEmpty(values)) {
159 return; 158 return;
160 } 159 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java
@@ -57,7 +57,8 @@ public class DictTypeServiceImpl implements DictTypeService { @@ -57,7 +57,8 @@ public class DictTypeServiceImpl implements DictTypeService {
57 @Override 57 @Override
58 public Long createDictType(DictTypeCreateReqVO reqVO) { 58 public Long createDictType(DictTypeCreateReqVO reqVO) {
59 // 校验正确性 59 // 校验正确性
60 - checkCreateOrUpdate(null, reqVO.getName(), reqVO.getType()); 60 + validateDictTypeForCreateOrUpdate(null, reqVO.getName(), reqVO.getType());
  61 +
61 // 插入字典类型 62 // 插入字典类型
62 DictTypeDO dictType = DictTypeConvert.INSTANCE.convert(reqVO) 63 DictTypeDO dictType = DictTypeConvert.INSTANCE.convert(reqVO)
63 .setDeletedTime(LocalDateTimeUtils.EMPTY); // 唯一索引,避免 null 值 64 .setDeletedTime(LocalDateTimeUtils.EMPTY); // 唯一索引,避免 null 值
@@ -68,7 +69,8 @@ public class DictTypeServiceImpl implements DictTypeService { @@ -68,7 +69,8 @@ public class DictTypeServiceImpl implements DictTypeService {
68 @Override 69 @Override
69 public void updateDictType(DictTypeUpdateReqVO reqVO) { 70 public void updateDictType(DictTypeUpdateReqVO reqVO) {
70 // 校验正确性 71 // 校验正确性
71 - checkCreateOrUpdate(reqVO.getId(), reqVO.getName(), null); 72 + validateDictTypeForCreateOrUpdate(reqVO.getId(), reqVO.getName(), null);
  73 +
72 // 更新字典类型 74 // 更新字典类型
73 DictTypeDO updateObj = DictTypeConvert.INSTANCE.convert(reqVO); 75 DictTypeDO updateObj = DictTypeConvert.INSTANCE.convert(reqVO);
74 dictTypeMapper.updateById(updateObj); 76 dictTypeMapper.updateById(updateObj);
@@ -77,7 +79,7 @@ public class DictTypeServiceImpl implements DictTypeService { @@ -77,7 +79,7 @@ public class DictTypeServiceImpl implements DictTypeService {
77 @Override 79 @Override
78 public void deleteDictType(Long id) { 80 public void deleteDictType(Long id) {
79 // 校验是否存在 81 // 校验是否存在
80 - DictTypeDO dictType = checkDictTypeExists(id); 82 + DictTypeDO dictType = validateDictTypeExists(id);
81 // 校验是否有字典数据 83 // 校验是否有字典数据
82 if (dictDataService.countByDictType(dictType.getType()) > 0) { 84 if (dictDataService.countByDictType(dictType.getType()) > 0) {
83 throw exception(DICT_TYPE_HAS_CHILDREN); 85 throw exception(DICT_TYPE_HAS_CHILDREN);
@@ -91,17 +93,17 @@ public class DictTypeServiceImpl implements DictTypeService { @@ -91,17 +93,17 @@ public class DictTypeServiceImpl implements DictTypeService {
91 return dictTypeMapper.selectList(); 93 return dictTypeMapper.selectList();
92 } 94 }
93 95
94 - private void checkCreateOrUpdate(Long id, String name, String type) { 96 + private void validateDictTypeForCreateOrUpdate(Long id, String name, String type) {
95 // 校验自己存在 97 // 校验自己存在
96 - checkDictTypeExists(id); 98 + validateDictTypeExists(id);
97 // 校验字典类型的名字的唯一性 99 // 校验字典类型的名字的唯一性
98 - checkDictTypeNameUnique(id, name); 100 + validateDictTypeNameUnique(id, name);
99 // 校验字典类型的类型的唯一性 101 // 校验字典类型的类型的唯一性
100 - checkDictTypeUnique(id, type); 102 + validateDictTypeUnique(id, type);
101 } 103 }
102 104
103 @VisibleForTesting 105 @VisibleForTesting
104 - public void checkDictTypeNameUnique(Long id, String name) { 106 + void validateDictTypeNameUnique(Long id, String name) {
105 DictTypeDO dictType = dictTypeMapper.selectByName(name); 107 DictTypeDO dictType = dictTypeMapper.selectByName(name);
106 if (dictType == null) { 108 if (dictType == null) {
107 return; 109 return;
@@ -116,7 +118,7 @@ public class DictTypeServiceImpl implements DictTypeService { @@ -116,7 +118,7 @@ public class DictTypeServiceImpl implements DictTypeService {
116 } 118 }
117 119
118 @VisibleForTesting 120 @VisibleForTesting
119 - public void checkDictTypeUnique(Long id, String type) { 121 + void validateDictTypeUnique(Long id, String type) {
120 if (StrUtil.isEmpty(type)) { 122 if (StrUtil.isEmpty(type)) {
121 return; 123 return;
122 } 124 }
@@ -134,7 +136,7 @@ public class DictTypeServiceImpl implements DictTypeService { @@ -134,7 +136,7 @@ public class DictTypeServiceImpl implements DictTypeService {
134 } 136 }
135 137
136 @VisibleForTesting 138 @VisibleForTesting
137 - public DictTypeDO checkDictTypeExists(Long id) { 139 + DictTypeDO validateDictTypeExists(Long id) {
138 if (id == null) { 140 if (id == null) {
139 return null; 141 return null;
140 } 142 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/errorcode/ErrorCodeServiceImpl.java
@@ -58,7 +58,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService { @@ -58,7 +58,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService {
58 @Override 58 @Override
59 public void updateErrorCode(ErrorCodeUpdateReqVO updateReqVO) { 59 public void updateErrorCode(ErrorCodeUpdateReqVO updateReqVO) {
60 // 校验存在 60 // 校验存在
61 - this.validateErrorCodeExists(updateReqVO.getId()); 61 + validateErrorCodeExists(updateReqVO.getId());
62 // 校验 code 重复 62 // 校验 code 重复
63 validateCodeDuplicate(updateReqVO.getCode(), updateReqVO.getId()); 63 validateCodeDuplicate(updateReqVO.getCode(), updateReqVO.getId());
64 64
@@ -71,7 +71,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService { @@ -71,7 +71,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService {
71 @Override 71 @Override
72 public void deleteErrorCode(Long id) { 72 public void deleteErrorCode(Long id) {
73 // 校验存在 73 // 校验存在
74 - this.validateErrorCodeExists(id); 74 + validateErrorCodeExists(id);
75 // 删除 75 // 删除
76 errorCodeMapper.deleteById(id); 76 errorCodeMapper.deleteById(id);
77 } 77 }
@@ -100,7 +100,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService { @@ -100,7 +100,7 @@ public class ErrorCodeServiceImpl implements ErrorCodeService {
100 } 100 }
101 101
102 @VisibleForTesting 102 @VisibleForTesting
103 - public void validateErrorCodeExists(Long id) { 103 + void validateErrorCodeExists(Long id) {
104 if (errorCodeMapper.selectById(id) == null) { 104 if (errorCodeMapper.selectById(id) == null) {
105 throw exception(ERROR_CODE_NOT_EXISTS); 105 throw exception(ERROR_CODE_NOT_EXISTS);
106 } 106 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogService.java
1 package cn.iocoder.yudao.module.system.service.logger; 1 package cn.iocoder.yudao.module.system.service.logger;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.framework.operatelog.core.service.OperateLog;  
5 -import cn.iocoder.yudao.framework.operatelog.core.service.OperateLogFrameworkService;  
6 import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO; 4 import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
7 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO; 5 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO;
8 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO; 6 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO;
@@ -38,6 +36,6 @@ public interface OperateLogService { @@ -38,6 +36,6 @@ public interface OperateLogService {
38 * @param reqVO 列表条件 36 * @param reqVO 列表条件
39 * @return 日志列表 37 * @return 日志列表
40 */ 38 */
41 - List<OperateLogDO> getOperateLogs(OperateLogExportReqVO reqVO); 39 + List<OperateLogDO> getOperateLogList(OperateLogExportReqVO reqVO);
42 40
43 } 41 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImpl.java
@@ -49,7 +49,7 @@ public class OperateLogServiceImpl implements OperateLogService { @@ -49,7 +49,7 @@ public class OperateLogServiceImpl implements OperateLogService {
49 // 处理基于用户昵称的查询 49 // 处理基于用户昵称的查询
50 Collection<Long> userIds = null; 50 Collection<Long> userIds = null;
51 if (StrUtil.isNotEmpty(reqVO.getUserNickname())) { 51 if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
52 - userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), AdminUserDO::getId); 52 + userIds = convertSet(userService.getUserListByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
53 if (CollUtil.isEmpty(userIds)) { 53 if (CollUtil.isEmpty(userIds)) {
54 return PageResult.empty(); 54 return PageResult.empty();
55 } 55 }
@@ -59,11 +59,11 @@ public class OperateLogServiceImpl implements OperateLogService { @@ -59,11 +59,11 @@ public class OperateLogServiceImpl implements OperateLogService {
59 } 59 }
60 60
61 @Override 61 @Override
62 - public List<OperateLogDO> getOperateLogs(OperateLogExportReqVO reqVO) { 62 + public List<OperateLogDO> getOperateLogList(OperateLogExportReqVO reqVO) {
63 // 处理基于用户昵称的查询 63 // 处理基于用户昵称的查询
64 Collection<Long> userIds = null; 64 Collection<Long> userIds = null;
65 if (StrUtil.isNotEmpty(reqVO.getUserNickname())) { 65 if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
66 - userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), AdminUserDO::getId); 66 + userIds = convertSet(userService.getUserListByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
67 if (CollUtil.isEmpty(userIds)) { 67 if (CollUtil.isEmpty(userIds)) {
68 return Collections.emptyList(); 68 return Collections.emptyList();
69 } 69 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailSendServiceImpl.java
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.mail; @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.mail;
3 import cn.hutool.core.util.StrUtil; 3 import cn.hutool.core.util.StrUtil;
4 import cn.hutool.extra.mail.MailAccount; 4 import cn.hutool.extra.mail.MailAccount;
5 import cn.hutool.extra.mail.MailUtil; 5 import cn.hutool.extra.mail.MailUtil;
6 -import cn.iocoder.yudao.framework.common.core.KeyValue;  
7 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 6 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
8 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 7 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
9 import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert; 8 import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert;
@@ -20,15 +19,13 @@ import org.springframework.stereotype.Service; @@ -20,15 +19,13 @@ import org.springframework.stereotype.Service;
20 import org.springframework.validation.annotation.Validated; 19 import org.springframework.validation.annotation.Validated;
21 20
22 import javax.annotation.Resource; 21 import javax.annotation.Resource;
23 -import java.util.List;  
24 import java.util.Map; 22 import java.util.Map;
25 -import java.util.stream.Collectors;  
26 23
27 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 24 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
28 import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; 25 import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
29 26
30 /** 27 /**
31 - * 邮箱模版 服务实现类 28 + * 邮箱发送 Service 实现类
32 * 29 *
33 * @author wangjingyi 30 * @author wangjingyi
34 * @since 2022-03-21 31 * @since 2022-03-21
@@ -82,13 +79,13 @@ public class MailSendServiceImpl implements MailSendService { @@ -82,13 +79,13 @@ public class MailSendServiceImpl implements MailSendService {
82 public Long sendSingleMail(String mail, Long userId, Integer userType, 79 public Long sendSingleMail(String mail, Long userId, Integer userType,
83 String templateCode, Map<String, Object> templateParams) { 80 String templateCode, Map<String, Object> templateParams) {
84 // 校验邮箱模版是否合法 81 // 校验邮箱模版是否合法
85 - MailTemplateDO template = checkMailTemplateValid(templateCode); 82 + MailTemplateDO template = validateMailTemplate(templateCode);
86 // 校验邮箱账号是否合法 83 // 校验邮箱账号是否合法
87 - MailAccountDO account = checkMailAccountValid(template.getAccountId()); 84 + MailAccountDO account = validateMailAccount(template.getAccountId());
88 85
89 // 校验邮箱是否存在 86 // 校验邮箱是否存在
90 - mail = checkMail(mail);  
91 - checkTemplateParams(template, templateParams); 87 + mail = validateMail(mail);
  88 + validateTemplateParams(template, templateParams);
92 89
93 // 创建发送日志。如果模板被禁用,则不发送短信,只记录日志 90 // 创建发送日志。如果模板被禁用,则不发送短信,只记录日志
94 Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus()); 91 Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus());
@@ -106,7 +103,7 @@ public class MailSendServiceImpl implements MailSendService { @@ -106,7 +103,7 @@ public class MailSendServiceImpl implements MailSendService {
106 @Override 103 @Override
107 public void doSendMail(MailSendMessage message) { 104 public void doSendMail(MailSendMessage message) {
108 // 1. 创建发送账号 105 // 1. 创建发送账号
109 - MailAccountDO account = checkMailAccountValid(message.getAccountId()); 106 + MailAccountDO account = validateMailAccount(message.getAccountId());
110 MailAccount mailAccount = MailAccountConvert.INSTANCE.convert(account, message.getNickname()); 107 MailAccount mailAccount = MailAccountConvert.INSTANCE.convert(account, message.getNickname());
111 // 2. 发送邮件 108 // 2. 发送邮件
112 try { 109 try {
@@ -121,7 +118,7 @@ public class MailSendServiceImpl implements MailSendService { @@ -121,7 +118,7 @@ public class MailSendServiceImpl implements MailSendService {
121 } 118 }
122 119
123 @VisibleForTesting 120 @VisibleForTesting
124 - public MailTemplateDO checkMailTemplateValid(String templateCode) { 121 + MailTemplateDO validateMailTemplate(String templateCode) {
125 // 获得邮件模板。考虑到效率,从缓存中获取 122 // 获得邮件模板。考虑到效率,从缓存中获取
126 MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode); 123 MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode);
127 // 邮件模板不存在 124 // 邮件模板不存在
@@ -132,7 +129,7 @@ public class MailSendServiceImpl implements MailSendService { @@ -132,7 +129,7 @@ public class MailSendServiceImpl implements MailSendService {
132 } 129 }
133 130
134 @VisibleForTesting 131 @VisibleForTesting
135 - public MailAccountDO checkMailAccountValid(Long accountId) { 132 + MailAccountDO validateMailAccount(Long accountId) {
136 // 获得邮箱账号。考虑到效率,从缓存中获取 133 // 获得邮箱账号。考虑到效率,从缓存中获取
137 MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId); 134 MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId);
138 // 邮箱账号不存在 135 // 邮箱账号不存在
@@ -143,7 +140,7 @@ public class MailSendServiceImpl implements MailSendService { @@ -143,7 +140,7 @@ public class MailSendServiceImpl implements MailSendService {
143 } 140 }
144 141
145 @VisibleForTesting 142 @VisibleForTesting
146 - public String checkMail(String mail) { 143 + String validateMail(String mail) {
147 if (StrUtil.isEmpty(mail)) { 144 if (StrUtil.isEmpty(mail)) {
148 throw exception(MAIL_SEND_MAIL_NOT_EXISTS); 145 throw exception(MAIL_SEND_MAIL_NOT_EXISTS);
149 } 146 }
@@ -157,7 +154,7 @@ public class MailSendServiceImpl implements MailSendService { @@ -157,7 +154,7 @@ public class MailSendServiceImpl implements MailSendService {
157 * @param templateParams 参数列表 154 * @param templateParams 参数列表
158 */ 155 */
159 @VisibleForTesting 156 @VisibleForTesting
160 - public void checkTemplateParams(MailTemplateDO template, Map<String, Object> templateParams) { 157 + void validateTemplateParams(MailTemplateDO template, Map<String, Object> templateParams) {
161 template.getParams().forEach(key -> { 158 template.getParams().forEach(key -> {
162 Object value = templateParams.get(key); 159 Object value = templateParams.get(key);
163 if (value == null) { 160 if (value == null) {
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notice/NoticeService.java
@@ -39,7 +39,7 @@ public interface NoticeService { @@ -39,7 +39,7 @@ public interface NoticeService {
39 * @param reqVO 分页条件 39 * @param reqVO 分页条件
40 * @return 部门分页列表 40 * @return 部门分页列表
41 */ 41 */
42 - PageResult<NoticeDO> pageNotices(NoticePageReqVO reqVO); 42 + PageResult<NoticeDO> getNoticePage(NoticePageReqVO reqVO);
43 43
44 /** 44 /**
45 * 获得岗位公告公告信息 45 * 获得岗位公告公告信息