mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 10:57:13 +08:00 
			
		
		
		
	style: 优化全局代码格式
This commit is contained in:
		| @@ -1,496 +1,380 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||
| <!-- 生成当前格式化配置文件,参照:https://github.com/diffplug/spotless/blob/main/ECLIPSE_SCREENSHOTS.md --> | ||||
| <profiles version="12"> | ||||
|     <profile kind="CodeFormatterProfile" name="P3C-CodeStyle" version="13"> | ||||
|         <!-- 可变参数的... IDEA 没有对应的配置项,强制 insert --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> | ||||
|         <!-- 枚举值之间 IDEA 没有对应的配置项,强制 insert --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=Java:SPACE_BEFORE_COMMA--> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=Java:SPACE_BEFORE_COMMA | ||||
|         由于 IDEA 只有一个 SPACE_BEFORE_COMMA 选项,所以统一设置 insert_space_before_comma 为 do not insert | ||||
|         --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> | ||||
|         <!--insert_space_before_comma end--> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=Java:SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> | ||||
|         <!-- IDEA 只有一个配置项 SPACE_AFTER_COMMA,insert_space_after_comma 统一设置成 insert --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> | ||||
|         <!--insert_space_after_comma end--> | ||||
| 
 | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=Java:SPACE_BEFORE_COLON--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=Java:SPACE_AFTER_COLON--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> | ||||
| 
 | ||||
|         <!-- IDEA 不支持配置,默认 do not insert--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> | ||||
|         <!-- 这个在 Eclipse 也没有找到配置的地方 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="do not insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_semicolon=Java:SPACE_BEFORE_SEMICOLON | ||||
|         程序导入的时候强制将 SPACE_BEFORE_SEMICOLON 设置为 false | ||||
|         --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> | ||||
| 
 | ||||
|         <!-- SPACE_AFTER_SEMICOLON=true --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/> | ||||
| 
 | ||||
|         <!-- IDEA不支持配置,do not insert --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> | ||||
| 
 | ||||
|         <!-- IDEA 不支持,使用默认 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=Java:<Programmatic>--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/> | ||||
| 
 | ||||
|         <!-- IDEA不支持配置,使用如下值,两者对应 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> | ||||
| 
 | ||||
|         <!-- Java:SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETER --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=Java:SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=Java:<Programmatic>--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> | ||||
| 
 | ||||
|         <!-- IDEA使用了对应的配置:Java:SPACE_WITHIN_ARRAY_INITIALIZER_BRACES,但感觉不太好,IDEA默认不插入,Eclipse也使用不插入 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/> | ||||
| 
 | ||||
|         <!--use default insert--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> | ||||
| 
 | ||||
|         <!--use default do not insert --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> | ||||
| 
 | ||||
| 
 | ||||
|         <!-- use default insert --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> | ||||
| 
 | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=Java:SPACE_BEFORE_SWITCH_LBRACE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=Java:SPACE_BEFORE_CLASS_LBRACE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=Java:<Programmatic>--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=Java:SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=Java:SPACE_BEFORE_METHOD_LBRACE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=Java:SPACE_AFTER_QUEST--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=Java:SPACE_BEFORE_QUEST--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=Java:SPACE_BEFORE_ANOTATION_PARAMETER_LIST--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> | ||||
| 
 | ||||
|         <!--use default do not insert--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> | ||||
| 
 | ||||
| 
 | ||||
|         <!-- 下面两个对应 IDEA 中的一个配置 Java:SPACE_AROUND_ASSIGNMENT_OPERATORS,使用 insert--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=Java:SPACE_BEFORE_CATCH_PARENTHESES--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=Java:SPACE_BEFORE_METHOD_CALL_PARENTHESES--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=Java:SPACE_BEFORE_TRY_PARENTHESES--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/> | ||||
| 
 | ||||
|         <!-- 下面两个对应 IDEA 中的一个配置 Java:SPACE_AROUND_UNARY_OPERATOR,使用 do not insert--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=Java:SPACE_BEFORE_IF_PARENTHESES--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=Java:SPACE_BEFORE_WHILE_PARENTHESES--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=Java:SPACE_AFTER_TYPE_CAST--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=Java:SPACE_BEFORE_METHOD_PARENTHESES--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=Java:SPACE_BEFORE_FOR_PARENTHESES--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=Java:SPACE_BEFORE_SYNCHRONIZED_PARENTHESES--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=Java:SPACE_BEFORE_SWITCH_PARENTHESES--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> | ||||
| 
 | ||||
|         <!--下面两个对应 IDEA 中的一个配置 Java:SPACE_AROUND_LAMBDA_ARROW,使用 insert--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/> | ||||
|         <!-- SPACE_WITHIN_EMPTY_ARRAY_INITIALIZER_BRACES --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> | ||||
| 
 | ||||
|         <!-- IDEA -> Wrapping And Braces -> Simple classes in one line --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="do not insert"/> | ||||
|         <!-- IDEA -> Wrapping And Braces -> Simple method in one line --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="do not insert"/> | ||||
|         <!--因为 IDEA 不支持配置,所以设置为 IDEA 默认值--> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="insert"/> | ||||
|         <!-- IDEA 可以通过 Wrap Always 实现--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/> | ||||
|         <!-- IDEA -> Wrapping And Braces -> Simple block in one line -> do not select --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> | ||||
| 
 | ||||
|         <!-- IDEA -> Wrapping And Braces -> try statement -> catch.... (Java:CATCH_ON_NEW_LINE) --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=<Programmatic>--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=Java:ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> | ||||
|         <!--#org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=Java:ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=Java:ELSE_ON_NEW_LINE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=Java:WHILE_ON_NEW_LINE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=Java:FINALLY_ON_NEW_LINE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/> | ||||
| 
 | ||||
|         <!-- comment start --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/> | ||||
|         <!-- ENABLE_JAVADOC_FORMATTING --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=<Programmatic>--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> | ||||
|         <!-- IDEA 无对应设置,所以关闭对 block comment 的格式化 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=Java:KEEP_FIRST_COLUMN_COMMENT--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.use_on_off_tags=FORMATTER_TAGS_ENABLED--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.disabling_tag=FORMATTER_OFF_TAG--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.enabling_tag=FORMATTER_ON_TAG--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/> | ||||
| 
 | ||||
|         <!-- 下面的没有 IDEA 对应项,在代码里面对 IDEA 中使用默认值即可,LINE_COMMENT_AT_FIRST_COLUMN BLOCK_COMMENT_AT_FIRST_COLUMN 设置为 false --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/> | ||||
| 
 | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/> | ||||
|         <!-- 和 IDEA 保持一致,注释换行 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> | ||||
| 
 | ||||
| 
 | ||||
|         <!-- comment end --> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.blank_lines_after_imports=Java:BLANK_LINES_AFTER_IMPORTS--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.blank_lines_before_imports=Java:BLANK_LINES_BEFORE_IMPORTS--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.blank_lines_after_package=Java:BLANK_LINES_AFTER_PACKAGE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=Java:BLANK_LINES_AROUND_CLASS--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=Java:BLANK_LINES_BEFORE_METHOD_BODY--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=Java:<Programmatic>--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.blank_lines_before_field=Java:BLANK_LINES_AROUND_FIELD--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.blank_lines_before_method=Java:BLANK_LINES_AROUND_METHOD--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.blank_lines_before_package=Java:BLANK_LINES_BEFORE_PACKAGE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> | ||||
| 
 | ||||
|         <!-- 下面 IDEA 没有对应设置,使用对应值即可 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.indentation.size=Java:IndentOptions:INDENT_SIZE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.continuation_indentation=Java:IndentOptions:<Programmatic>--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=Java:<Programmatic>--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=Java:IndentOptions:SMART_TABS--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=Java:INDENT_CASE_FROM_SWITCH--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/> | ||||
|         <!-- KEEP_INDENTS_ON_EMPTY_LINES --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.tabulation.size=Java:IndentOptions:<Programmatic>--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> | ||||
|         <!-- Java:IndentOptions:<Programmatic> --> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <profiles version="21"> | ||||
|     <profile kind="CodeFormatterProfile" name="P3C-CodeStyle" version="21"> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/> | ||||
| 
 | ||||
| 
 | ||||
|         <!-- 下面 IDEA 没有对应设置,使用对应值即可 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="1"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> | ||||
| 
 | ||||
| 
 | ||||
|         <!-- Java:<Programmatic> --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> | ||||
| 
 | ||||
|         <!-- 下面没有对应的 IDEA 设置,Eclipse 先使用对应值 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="16"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> | ||||
| 
 | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> | ||||
| 
 | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="16"/> | ||||
| 
 | ||||
|         <!-- IDEA 默认配置在同一行,Eclipse 使用对应值即可--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/> | ||||
| 
 | ||||
|         <!-- Java:BINARY_OPERATION_SIGN_ON_NEXT_LINE --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/> | ||||
| 
 | ||||
|         <!-- ASSIGNMENT_WRAP 需要设置为 WRAP_AS_NEEDED  WRAP_AS_NEEDED . Add in jdt.core-3.12,it's not work in previous version --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/> | ||||
| 
 | ||||
|         <!-- IDEA无配置项,Eclipse 使用对应值即可 --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=Java:KEEP_CONTROL_STATEMENT_IN_ONE_LINE--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> | ||||
|         <!--org.eclipse.jdt.core.formatter.compact_else_if=Java:SPECIAL_ELSE_IF_TREATMENT--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> | ||||
|         <!-- Java:ALIGN_GROUP_FIELD_DECLARATIONS --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> | ||||
|         <!-- Java:<Programmatic> --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> | ||||
| 
 | ||||
|         <!-- 统一为 end_of_lint,IDEA 默认一致--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> | ||||
| 
 | ||||
| 
 | ||||
|         <!--        <setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/> | ||||
|                 <setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/> | ||||
|                 <setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/> | ||||
|                         <setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/> | ||||
|                                 <setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/> | ||||
|                                         <setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/> | ||||
|                 --> | ||||
|         <!-- Java:KEEP_SIMPLE_BLOCKS_IN_ONE_LINE --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> | ||||
| 
 | ||||
|         <!-- Java:CLASS_BRACE_STYLE,统一使用end_of_line --> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/> | ||||
| 
 | ||||
|         <!--org.eclipse.jdt.core.formatter.lineSplit=RIGHT_MARGIN--> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_preserve"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_preserve"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_preserve"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_preserve"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_preserve"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_preserve"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_preserve"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="1"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="82"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="82"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="18"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="80"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="48"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="49"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="2"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="0"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/> | ||||
|         <setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> | ||||
|     </profile> | ||||
| </profiles> | ||||
| </profiles> | ||||
| @@ -74,7 +74,7 @@ ContiNew Admin(Continue New Admin)持续迭代优化的前后端分离中后 | ||||
| - 前后端统一异常拦截处理,统一输出异常信息,避免繁琐的异常判断 | ||||
| - 自动初始化数据:通过 Liquibase 管理数据库脚本版本记录,并在系统第一次启动时自动进行数据初始化,无须额外配置导入 | ||||
| - 提供多项实用基础配置,例如:Jackson 针对日期、通用枚举的序列化、反序列化配置,统一线程池配置等 | ||||
| - 良好的代码、配置文件结构和命名,完善的代码注释甚至包括 Git Commit 信息、接口文档参数示例,遵循阿里巴巴 <a href="https://github.com/Charles7c/continew-admin/blob/dev/code-style/Java%E5%BC%80%E5%8F%91%E6%89%8B%E5%86%8C(%E9%BB%84%E5%B1%B1%E7%89%88).pdf" target="_blank">《Java开发手册(黄山版)》</a> 的代码规范,保证代码质量和可维护性 | ||||
| - 良好的代码、配置文件结构和命名,完善的代码注释甚至包括 Git Commit 信息、接口文档参数示例,遵循阿里巴巴 <a href="https://github.com/Charles7c/continew-admin/blob/dev/.style/Java%E5%BC%80%E5%8F%91%E6%89%8B%E5%86%8C(%E9%BB%84%E5%B1%B1%E7%89%88).pdf" target="_blank">《Java开发手册(黄山版)》</a> 的代码规范,保证代码质量和可维护性 | ||||
| - 更多细节及实践,敬请探索与关注 | ||||
|  | ||||
| ##  系统功能 | ||||
| @@ -395,7 +395,7 @@ ContiNew Admin 的分支目前分为下个大版本的开发分支和上个大 | ||||
| > **IMPORTANT** | ||||
| > 欢迎大家为 ContiNew Admin 贡献代码,我们非常感谢您的支持!为了更好地管理项目,维护者有一些要求: | ||||
| > | ||||
| > 1. 请确保代码、配置文件的结构和命名规范良好,完善的代码注释甚至包括接口文档参数示例,并遵循阿里巴巴的 <a href="https://github.com/Charles7c/continew-admin/blob/dev/code-style/Java%E5%BC%80%E5%8F%91%E6%89%8B%E5%86%8C(%E9%BB%84%E5%B1%B1%E7%89%88).pdf" target="_blank">《Java开发手册(黄山版)》</a> 中的代码规范,保证代码质量和可维护性 | ||||
| > 1. 请确保代码、配置文件的结构和命名规范良好,完善的代码注释甚至包括接口文档参数示例,并遵循阿里巴巴的 <a href="https://github.com/Charles7c/continew-admin/blob/dev/.style/Java%E5%BC%80%E5%8F%91%E6%89%8B%E5%86%8C(%E9%BB%84%E5%B1%B1%E7%89%88).pdf" target="_blank">《Java开发手册(黄山版)》</a> 中的代码规范,保证代码质量和可维护性 | ||||
| > 2. 在提交代码前,请按照 [Angular 提交规范](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) 编写 commit 的 message(建议在 IntelliJ IDEA 中下载并安装 Git Commit Template 插件,以便按照规范进行 commit) | ||||
| > 3. 提交代码之前,请关闭所有代码窗口,执行 mvn compile 命令(项目已配置代码格式化插件,编译通过的同时也会自动进行代码格式化),编译通过后,不要再打开查看任何代码窗口,直接提交即可,以免不同的 IDE 配置会自动进行代码格式化 | ||||
|  | ||||
|   | ||||
| @@ -1,8 +0,0 @@ | ||||
| ## 统一代码风格 | ||||
|  | ||||
| 如果要编辑本项目,一定要统一代码风格 | ||||
|  | ||||
| ### 统一方案 | ||||
|  | ||||
| 本工程代码遵守阿里巴巴 [p3c](https://github.com/alibaba/p3c) 规范,在代码开发前建议: | ||||
| * 安装阿里巴巴规约插件,用于提早发现不规范代码,具体安装方法参照:[p3c](https://github.com/alibaba/p3c),里面有 Eclipse,IntelliJ IDEA 的安装方法 | ||||
| @@ -58,8 +58,8 @@ public class SpringCacheConfiguration extends CachingConfigurerSupport { | ||||
|     @Bean | ||||
|     public RedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties) { | ||||
|         ObjectMapper objectMapperCopy = objectMapper.copy(); | ||||
|         objectMapperCopy.activateDefaultTyping(objectMapperCopy.getPolymorphicTypeValidator(), | ||||
|             ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); | ||||
|         objectMapperCopy.activateDefaultTyping(objectMapperCopy | ||||
|             .getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); | ||||
|         RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig() | ||||
|             .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer())) | ||||
|             .serializeValuesWith(RedisSerializationContext.SerializationPair | ||||
|   | ||||
| @@ -52,8 +52,9 @@ public class ExcelBaseEnumConverter implements Converter<IBaseEnum<Integer>> { | ||||
|      * 转换为 Java 数据(读取 Excel) | ||||
|      */ | ||||
|     @Override | ||||
|     public IBaseEnum convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, | ||||
|         GlobalConfiguration globalConfiguration) { | ||||
|     public IBaseEnum convertToJavaData(ReadCellData<?> cellData, | ||||
|                                        ExcelContentProperty contentProperty, | ||||
|                                        GlobalConfiguration globalConfiguration) { | ||||
|         return this.getEnum(IBaseEnum.class, Convert.toStr(cellData.getData())); | ||||
|     } | ||||
|  | ||||
| @@ -61,8 +62,9 @@ public class ExcelBaseEnumConverter implements Converter<IBaseEnum<Integer>> { | ||||
|      * 转换为 Excel 数据(写入 Excel) | ||||
|      */ | ||||
|     @Override | ||||
|     public WriteCellData<String> convertToExcelData(IBaseEnum<Integer> value, ExcelContentProperty contentProperty, | ||||
|         GlobalConfiguration globalConfiguration) { | ||||
|     public WriteCellData<String> convertToExcelData(IBaseEnum<Integer> value, | ||||
|                                                     ExcelContentProperty contentProperty, | ||||
|                                                     GlobalConfiguration globalConfiguration) { | ||||
|         if (null == value) { | ||||
|             return new WriteCellData<>(StringConstants.EMPTY); | ||||
|         } | ||||
| @@ -72,10 +74,8 @@ public class ExcelBaseEnumConverter implements Converter<IBaseEnum<Integer>> { | ||||
|     /** | ||||
|      * 通过 value 获取枚举对象,获取不到时为 {@code null} | ||||
|      * | ||||
|      * @param enumType | ||||
|      *            枚举类型 | ||||
|      * @param description | ||||
|      *            描述 | ||||
|      * @param enumType    枚举类型 | ||||
|      * @param description 描述 | ||||
|      * @return 对应枚举 ,获取不到时为 {@code null} | ||||
|      */ | ||||
|     private IBaseEnum<Integer> getEnum(Class<?> enumType, String description) { | ||||
|   | ||||
| @@ -43,8 +43,8 @@ public class BaseEnumDeserializer extends JsonDeserializer<IBaseEnum> { | ||||
|     public static final BaseEnumDeserializer SERIALIZER_INSTANCE = new BaseEnumDeserializer(); | ||||
|  | ||||
|     @Override | ||||
|     public IBaseEnum deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) | ||||
|         throws IOException { | ||||
|     public IBaseEnum deserialize(JsonParser jsonParser, | ||||
|                                  DeserializationContext deserializationContext) throws IOException { | ||||
|         Class<?> targetClass = jsonParser.getCurrentValue().getClass(); | ||||
|         String fieldName = jsonParser.getCurrentName(); | ||||
|         String value = jsonParser.getText(); | ||||
| @@ -54,12 +54,9 @@ public class BaseEnumDeserializer extends JsonDeserializer<IBaseEnum> { | ||||
|     /** | ||||
|      * 通过某字段对应值获取枚举实例,获取不到时为 {@code null} | ||||
|      * | ||||
|      * @param targetClass | ||||
|      *            目标类型 | ||||
|      * @param value | ||||
|      *            字段值 | ||||
|      * @param fieldName | ||||
|      *            字段名 | ||||
|      * @param targetClass 目标类型 | ||||
|      * @param value       字段值 | ||||
|      * @param fieldName   字段名 | ||||
|      * @return 对应枚举实例 ,获取不到时为 {@code null} | ||||
|      */ | ||||
|     private IBaseEnum getEnum(Class<?> targetClass, String value, String fieldName) { | ||||
|   | ||||
| @@ -49,8 +49,9 @@ import com.fasterxml.jackson.databind.type.ClassKey; | ||||
| public class SimpleDeserializersWrapper extends SimpleDeserializers { | ||||
|  | ||||
|     @Override | ||||
|     public JsonDeserializer<?> findEnumDeserializer(Class<?> type, DeserializationConfig config, | ||||
|         BeanDescription beanDesc) throws JsonMappingException { | ||||
|     public JsonDeserializer<?> findEnumDeserializer(Class<?> type, | ||||
|                                                     DeserializationConfig config, | ||||
|                                                     BeanDescription beanDesc) throws JsonMappingException { | ||||
|         JsonDeserializer<?> deser = super.findEnumDeserializer(type, config, beanDesc); | ||||
|         if (null != deser) { | ||||
|             return deser; | ||||
|   | ||||
| @@ -49,9 +49,11 @@ public class DataPermissionFilterImpl implements DataPermissionFilter { | ||||
|         DataPermissionCurrentUser currentUser = new DataPermissionCurrentUser(); | ||||
|         currentUser.setUserId(Convert.toStr(loginUser.getId())); | ||||
|         currentUser.setDeptId(Convert.toStr(loginUser.getDeptId())); | ||||
|         currentUser.setRoles(loginUser.getRoles().stream() | ||||
|             .map(r -> new DataPermissionCurrentUser.CurrentUserRole(Convert.toStr(r.getId()), | ||||
|                 DataScope.valueOf(r.getDataScope().name()))) | ||||
|         currentUser.setRoles(loginUser.getRoles() | ||||
|             .stream() | ||||
|             .map(r -> new DataPermissionCurrentUser.CurrentUserRole(Convert.toStr(r.getId()), DataScope.valueOf(r | ||||
|                 .getDataScope() | ||||
|                 .name()))) | ||||
|             .collect(Collectors.toSet())); | ||||
|         return currentUser; | ||||
|     } | ||||
|   | ||||
| @@ -48,8 +48,7 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { | ||||
|     /** | ||||
|      * 插入数据时填充 | ||||
|      * | ||||
|      * @param metaObject | ||||
|      *            元对象 | ||||
|      * @param metaObject 元对象 | ||||
|      */ | ||||
|     @Override | ||||
|     public void insertFill(MetaObject metaObject) { | ||||
| @@ -77,8 +76,7 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { | ||||
|     /** | ||||
|      * 修改数据时填充 | ||||
|      * | ||||
|      * @param metaObject | ||||
|      *            元对象 | ||||
|      * @param metaObject 元对象 | ||||
|      */ | ||||
|     @Override | ||||
|     public void updateFill(MetaObject metaObject) { | ||||
| @@ -106,14 +104,10 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { | ||||
|     /** | ||||
|      * 填充字段值 | ||||
|      * | ||||
|      * @param metaObject | ||||
|      *            元数据对象 | ||||
|      * @param fieldName | ||||
|      *            要填充的字段名 | ||||
|      * @param fillFieldValue | ||||
|      *            要填充的字段值 | ||||
|      * @param isOverride | ||||
|      *            如果字段值不为空,是否覆盖(true:覆盖;false:不覆盖) | ||||
|      * @param metaObject     元数据对象 | ||||
|      * @param fieldName      要填充的字段名 | ||||
|      * @param fillFieldValue 要填充的字段值 | ||||
|      * @param isOverride     如果字段值不为空,是否覆盖(true:覆盖;false:不覆盖) | ||||
|      */ | ||||
|     private void fillFieldValue(MetaObject metaObject, String fieldName, Object fillFieldValue, boolean isOverride) { | ||||
|         if (metaObject.hasSetter(fieldName)) { | ||||
|   | ||||
| @@ -47,7 +47,6 @@ public class CaptchaResp implements Serializable { | ||||
|     /** | ||||
|      * 验证码图片(Base64编码,带图片格式:data:image/gif;base64) | ||||
|      */ | ||||
|     @Schema(description = "验证码图片(Base64编码,带图片格式:data:image/gif;base64)", | ||||
|         example = "data:image/png;base64,iVBORw0KGgoAAAAN...") | ||||
|     @Schema(description = "验证码图片(Base64编码,带图片格式:data:image/gif;base64)", example = "data:image/png;base64,iVBORw0KGgoAAAAN...") | ||||
|     private String img; | ||||
| } | ||||
|   | ||||
| @@ -38,10 +38,8 @@ public class SecureUtils { | ||||
|     /** | ||||
|      * 公钥加密 | ||||
|      * | ||||
|      * @param data | ||||
|      *            要加密的内容 | ||||
|      * @param publicKey | ||||
|      *            公钥 | ||||
|      * @param data      要加密的内容 | ||||
|      * @param publicKey 公钥 | ||||
|      * @return 公钥加密并 Base64 加密后的内容 | ||||
|      */ | ||||
|     public static String encryptByRsaPublicKey(String data, String publicKey) { | ||||
| @@ -51,8 +49,7 @@ public class SecureUtils { | ||||
|     /** | ||||
|      * 私钥解密 | ||||
|      * | ||||
|      * @param data | ||||
|      *            要解密的内容(Base64 加密过) | ||||
|      * @param data 要解密的内容(Base64 加密过) | ||||
|      * @return 解密后的内容 | ||||
|      */ | ||||
|     public static String decryptByRsaPrivateKey(String data) { | ||||
| @@ -64,10 +61,8 @@ public class SecureUtils { | ||||
|     /** | ||||
|      * 私钥解密 | ||||
|      * | ||||
|      * @param data | ||||
|      *            要解密的内容(Base64 加密过) | ||||
|      * @param privateKey | ||||
|      *            私钥 | ||||
|      * @param data       要解密的内容(Base64 加密过) | ||||
|      * @param privateKey 私钥 | ||||
|      * @return 解密后的内容 | ||||
|      */ | ||||
|     public static String decryptByRsaPrivateKey(String data, String privateKey) { | ||||
| @@ -77,10 +72,8 @@ public class SecureUtils { | ||||
|     /** | ||||
|      * MD5 加密 | ||||
|      * | ||||
|      * @param data | ||||
|      *            要加密的内容 | ||||
|      * @param salt | ||||
|      *            盐 | ||||
|      * @param data 要加密的内容 | ||||
|      * @param salt 盐 | ||||
|      * @return 加密后的内容 | ||||
|      */ | ||||
|     public static String md5Salt(String data, String salt) { | ||||
|   | ||||
| @@ -50,8 +50,7 @@ public class LoginHelper { | ||||
|     /** | ||||
|      * 用户登录并缓存用户信息 | ||||
|      * | ||||
|      * @param loginUser | ||||
|      *            登录用户信息 | ||||
|      * @param loginUser 登录用户信息 | ||||
|      * @return 令牌 | ||||
|      */ | ||||
|     public static String login(LoginUser loginUser) { | ||||
| @@ -93,8 +92,7 @@ public class LoginHelper { | ||||
|     /** | ||||
|      * 根据 Token 获取登录用户信息 | ||||
|      * | ||||
|      * @param token | ||||
|      *            用户 Token | ||||
|      * @param token 用户 Token | ||||
|      * @return 登录用户信息 | ||||
|      */ | ||||
|     public static LoginUser getLoginUser(String token) { | ||||
| @@ -135,8 +133,7 @@ public class LoginHelper { | ||||
|     /** | ||||
|      * 获取登录用户昵称 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            登录用户 ID | ||||
|      * @param userId 登录用户 ID | ||||
|      * @return 登录用户昵称 | ||||
|      */ | ||||
|     public static String getNickname(Long userId) { | ||||
|   | ||||
| @@ -66,8 +66,9 @@ public class LogDaoLocalImpl implements LogDao { | ||||
|         LogDO logDO = new LogDO(); | ||||
|         logDO.setDescription(logRecord.getDescription()); | ||||
|         String module = logRecord.getModule(); | ||||
|         logDO.setModule( | ||||
|             StrUtil.isNotBlank(module) ? logRecord.getModule().replace("API", StringConstants.EMPTY).trim() : null); | ||||
|         logDO.setModule(StrUtil.isNotBlank(module) | ||||
|             ? logRecord.getModule().replace("API", StringConstants.EMPTY).trim() | ||||
|             : null); | ||||
|         logDO.setCreateTime(LocalDateTime.ofInstant(logRecord.getTimestamp(), ZoneId.systemDefault())); | ||||
|         logDO.setTimeTaken(logRecord.getTimeTaken().toMillis()); | ||||
|         // 请求信息 | ||||
| @@ -105,16 +106,16 @@ public class LogDaoLocalImpl implements LogDao { | ||||
|                 logDO.setCreateUser(-1 != loginId ? loginId : null); | ||||
|             } else if (result.isSuccess() && requestUri.startsWith(SysConstants.LOGIN_URI)) { | ||||
|                 AccountLoginReq loginReq = JSONUtil.toBean(requestBody, AccountLoginReq.class); | ||||
|                 logDO.setCreateUser( | ||||
|                     ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()).getId())); | ||||
|                 logDO.setCreateUser(ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()) | ||||
|                     .getId())); | ||||
|             } | ||||
|         } | ||||
|         // 操作人 | ||||
|         if (!requestUri.startsWith(SysConstants.LOGOUT_URI) && MapUtil.isNotEmpty(requestHeaderMap) | ||||
|             && requestHeaderMap.containsKey(HttpHeaders.AUTHORIZATION)) { | ||||
|         if (!requestUri.startsWith(SysConstants.LOGOUT_URI) && MapUtil.isNotEmpty(requestHeaderMap) && requestHeaderMap | ||||
|             .containsKey(HttpHeaders.AUTHORIZATION)) { | ||||
|             String authorization = requestHeaderMap.get(HttpHeaders.AUTHORIZATION); | ||||
|             String token = authorization.replace(SaManager.getConfig().getTokenPrefix() + StringConstants.SPACE, | ||||
|                 StringConstants.EMPTY); | ||||
|             String token = authorization.replace(SaManager.getConfig() | ||||
|                 .getTokenPrefix() + StringConstants.SPACE, StringConstants.EMPTY); | ||||
|             logDO.setCreateUser(Convert.toLong(StpUtil.getLoginIdByToken(token))); | ||||
|         } | ||||
|         logMapper.insert(logDO); | ||||
|   | ||||
| @@ -45,8 +45,7 @@ public interface LogMapper extends BaseMapper<LogDO> { | ||||
|     /** | ||||
|      * 查询仪表盘访问趋势信息 | ||||
|      * | ||||
|      * @param days | ||||
|      *            日期数 | ||||
|      * @param days 日期数 | ||||
|      * | ||||
|      * @return 仪表盘访问趋势信息 | ||||
|      */ | ||||
|   | ||||
| @@ -47,7 +47,6 @@ public class DashboardGeoDistributionResp implements Serializable { | ||||
|     /** | ||||
|      * 地点 IP 统计信息 | ||||
|      */ | ||||
|     @Schema(description = "地点 IP 统计信息", | ||||
|         example = "[{\"name\":\"中国北京北京市\",\"value\":1000},{\"name\":\"中国广东省深圳市\",\"value\": 500}]") | ||||
|     @Schema(description = "地点 IP 统计信息", example = "[{\"name\":\"中国北京北京市\",\"value\":1000},{\"name\":\"中国广东省深圳市\",\"value\": 500}]") | ||||
|     private List<Map<String, Object>> locationIpStatistics; | ||||
| } | ||||
|   | ||||
| @@ -42,8 +42,7 @@ public interface DashboardService { | ||||
|     /** | ||||
|      * 查询访问趋势信息 | ||||
|      * | ||||
|      * @param days | ||||
|      *            日期数 | ||||
|      * @param days 日期数 | ||||
|      * @return 访问趋势信息 | ||||
|      */ | ||||
|     List<DashboardAccessTrendResp> listAccessTrend(Integer days); | ||||
|   | ||||
| @@ -37,10 +37,8 @@ public interface LogService { | ||||
|     /** | ||||
|      * 分页查询操作日志列表 | ||||
|      * | ||||
|      * @param query | ||||
|      *            查询条件 | ||||
|      * @param pageQuery | ||||
|      *            分页查询条件 | ||||
|      * @param query     查询条件 | ||||
|      * @param pageQuery 分页查询条件 | ||||
|      * @return 操作日志分页信息 | ||||
|      */ | ||||
|     PageResp<OperationLogResp> page(OperationLogQuery query, PageQuery pageQuery); | ||||
| @@ -48,10 +46,8 @@ public interface LogService { | ||||
|     /** | ||||
|      * 分页查询登录日志列表 | ||||
|      * | ||||
|      * @param query | ||||
|      *            查询条件 | ||||
|      * @param pageQuery | ||||
|      *            分页查询条件 | ||||
|      * @param query     查询条件 | ||||
|      * @param pageQuery 分页查询条件 | ||||
|      * @return 登录日志分页信息 | ||||
|      */ | ||||
|     PageResp<LoginLogResp> page(LoginLogQuery query, PageQuery pageQuery); | ||||
| @@ -59,10 +55,8 @@ public interface LogService { | ||||
|     /** | ||||
|      * 分页查询系统日志列表 | ||||
|      * | ||||
|      * @param query | ||||
|      *            查询条件 | ||||
|      * @param pageQuery | ||||
|      *            分页查询条件 | ||||
|      * @param query     查询条件 | ||||
|      * @param pageQuery 分页查询条件 | ||||
|      * @return 系统日志分页信息 | ||||
|      */ | ||||
|     PageResp<SystemLogResp> page(SystemLogQuery query, PageQuery pageQuery); | ||||
| @@ -70,8 +64,7 @@ public interface LogService { | ||||
|     /** | ||||
|      * 查看系统日志详情 | ||||
|      * | ||||
|      * @param logId | ||||
|      *            日志 ID | ||||
|      * @param logId 日志 ID | ||||
|      * @return 系统日志详情 | ||||
|      */ | ||||
|     SystemLogDetailResp get(Long logId); | ||||
|   | ||||
| @@ -59,7 +59,8 @@ public class DashboardServiceImpl implements DashboardService { | ||||
|         Long todayPvCount = totalResp.getTodayPvCount(); | ||||
|         Long yesterdayPvCount = totalResp.getYesterdayPvCount(); | ||||
|         BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount); | ||||
|         BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) ? BigDecimal.valueOf(100) | ||||
|         BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) | ||||
|             ? BigDecimal.valueOf(100) | ||||
|             : NumberUtil.round(NumberUtil.mul(NumberUtil.div(newPvCountFromYesterday, yesterdayPvCount), 100), 1); | ||||
|         totalResp.setNewPvFromYesterday(newPvFromYesterday); | ||||
|         return totalResp; | ||||
| @@ -78,7 +79,8 @@ public class DashboardServiceImpl implements DashboardService { | ||||
|             Long todayPvCount = popularModule.getTodayPvCount(); | ||||
|             Long yesterdayPvCount = popularModule.getYesterdayPvCount(); | ||||
|             BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount); | ||||
|             BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) ? BigDecimal.valueOf(100) | ||||
|             BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) | ||||
|                 ? BigDecimal.valueOf(100) | ||||
|                 : NumberUtil.round(NumberUtil.mul(NumberUtil.div(newPvCountFromYesterday, yesterdayPvCount), 100), 1); | ||||
|             popularModule.setNewPvFromYesterday(newPvFromYesterday); | ||||
|         } | ||||
|   | ||||
| @@ -66,9 +66,10 @@ public class LogServiceImpl implements LogService { | ||||
|         QueryWrapper<LogDO> queryWrapper = QueryHelper.build(query); | ||||
|         // 限定查询信息 | ||||
|         List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(OperationLogResp.class); | ||||
|         List<String> columnNameList = | ||||
|             fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) | ||||
|                 .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); | ||||
|         List<String> columnNameList = fieldNameList.stream() | ||||
|             .filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) | ||||
|             .map(StrUtil::toUnderlineCase) | ||||
|             .collect(Collectors.toList()); | ||||
|         queryWrapper.select(columnNameList); | ||||
|         // 分页查询 | ||||
|         IPage<LogDO> page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); | ||||
| @@ -89,9 +90,10 @@ public class LogServiceImpl implements LogService { | ||||
|         queryWrapper.eq("module", "登录"); | ||||
|         // 限定查询信息 | ||||
|         List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(LoginLogResp.class); | ||||
|         List<String> columnNameList = | ||||
|             fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) | ||||
|                 .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); | ||||
|         List<String> columnNameList = fieldNameList.stream() | ||||
|             .filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) | ||||
|             .map(StrUtil::toUnderlineCase) | ||||
|             .collect(Collectors.toList()); | ||||
|         queryWrapper.select(columnNameList); | ||||
|         // 分页查询 | ||||
|         IPage<LogDO> page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); | ||||
| @@ -106,9 +108,10 @@ public class LogServiceImpl implements LogService { | ||||
|         QueryWrapper<LogDO> queryWrapper = QueryHelper.build(query); | ||||
|         // 限定查询信息 | ||||
|         List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(SystemLogResp.class); | ||||
|         List<String> columnNameList = | ||||
|             fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) | ||||
|                 .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); | ||||
|         List<String> columnNameList = fieldNameList.stream() | ||||
|             .filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) | ||||
|             .map(StrUtil::toUnderlineCase) | ||||
|             .collect(Collectors.toList()); | ||||
|         queryWrapper.select(columnNameList); | ||||
|         // 分页查询 | ||||
|         IPage<LogDO> page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); | ||||
| @@ -150,8 +153,7 @@ public class LogServiceImpl implements LogService { | ||||
|     /** | ||||
|      * 填充数据 | ||||
|      * | ||||
|      * @param logResp | ||||
|      *            日志信息 | ||||
|      * @param logResp 日志信息 | ||||
|      */ | ||||
|     private void fill(LogResp logResp) { | ||||
|         Long createUser = logResp.getCreateUser(); | ||||
|   | ||||
| @@ -48,8 +48,7 @@ public class AccountLoginReq implements Serializable { | ||||
|     /** | ||||
|      * 密码(加密) | ||||
|      */ | ||||
|     @Schema(description = "密码(加密)", | ||||
|         example = "HHwZoiBwCfh0xLdWOAd0bHOkEZlIMMOQKJyeFUw9T3ArrhL57od2i42s1o0sSXKkeHPJXvQsninhPFH2lArDDQ==") | ||||
|     @Schema(description = "密码(加密)", example = "HHwZoiBwCfh0xLdWOAd0bHOkEZlIMMOQKJyeFUw9T3ArrhL57od2i42s1o0sSXKkeHPJXvQsninhPFH2lArDDQ==") | ||||
|     @NotBlank(message = "密码不能为空") | ||||
|     private String password; | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,6 @@ public class LoginResp implements Serializable { | ||||
|     /** | ||||
|      * 令牌 | ||||
|      */ | ||||
|     @Schema(description = "令牌", | ||||
|         example = "eyJ0eXAiOiJlV1QiLCJhbGciqiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb29pbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiSjd4SUljYnU5cmNwU09vQ3Uyc1ND1BYYTYycFRjcjAifQ.KUPOYm-2wfuLUSfEEAbpGE527fzmkAJG7sMNcQ0pUZ8") | ||||
|     @Schema(description = "令牌", example = "eyJ0eXAiOiJlV1QiLCJhbGciqiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb29pbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiSjd4SUljYnU5cmNwU09vQ3Uyc1ND1BYYTYycFRjcjAifQ.KUPOYm-2wfuLUSfEEAbpGE527fzmkAJG7sMNcQ0pUZ8") | ||||
|     private String token; | ||||
| } | ||||
|   | ||||
| @@ -46,8 +46,7 @@ public class OnlineUserResp implements Serializable { | ||||
|     /** | ||||
|      * 令牌 | ||||
|      */ | ||||
|     @Schema(description = "令牌", | ||||
|         example = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiTUd6djdyOVFoeHEwdVFqdFAzV3M5YjVJRzh4YjZPSEUifQ.7q7U3ouoN7WPhH2kUEM7vPe5KF3G_qavSG-vRgIxKvE") | ||||
|     @Schema(description = "令牌", example = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiTUd6djdyOVFoeHEwdVFqdFAzV3M5YjVJRzh4YjZPSEUifQ.7q7U3ouoN7WPhH2kUEM7vPe5KF3G_qavSG-vRgIxKvE") | ||||
|     private String token; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -84,8 +84,7 @@ public class UserInfoResp implements Serializable { | ||||
|     /** | ||||
|      * 头像地址 | ||||
|      */ | ||||
|     @Schema(description = "头像地址", | ||||
|         example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg") | ||||
|     @Schema(description = "头像地址", example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg") | ||||
|     private String avatar; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -33,10 +33,8 @@ public interface LoginService { | ||||
|     /** | ||||
|      * 账号登录 | ||||
|      * | ||||
|      * @param username | ||||
|      *            用户名 | ||||
|      * @param password | ||||
|      *            密码 | ||||
|      * @param username 用户名 | ||||
|      * @param password 密码 | ||||
|      * @return 令牌 | ||||
|      */ | ||||
|     String accountLogin(String username, String password); | ||||
| @@ -44,8 +42,7 @@ public interface LoginService { | ||||
|     /** | ||||
|      * 手机号登录 | ||||
|      * | ||||
|      * @param phone | ||||
|      *            手机号 | ||||
|      * @param phone 手机号 | ||||
|      * @return 令牌 | ||||
|      */ | ||||
|     String phoneLogin(String phone); | ||||
| @@ -53,8 +50,7 @@ public interface LoginService { | ||||
|     /** | ||||
|      * 邮箱登录 | ||||
|      * | ||||
|      * @param email | ||||
|      *            邮箱 | ||||
|      * @param email 邮箱 | ||||
|      * @return 令牌 | ||||
|      */ | ||||
|     String emailLogin(String email); | ||||
| @@ -62,8 +58,7 @@ public interface LoginService { | ||||
|     /** | ||||
|      * 三方账号登录 | ||||
|      * | ||||
|      * @param authUser | ||||
|      *            三方账号信息 | ||||
|      * @param authUser 三方账号信息 | ||||
|      * @return 令牌 | ||||
|      */ | ||||
|     String socialLogin(AuthUser authUser); | ||||
| @@ -71,8 +66,7 @@ public interface LoginService { | ||||
|     /** | ||||
|      * 构建路由树 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 路由树 | ||||
|      */ | ||||
|     List<RouteResp> buildRouteTree(Long userId); | ||||
|   | ||||
| @@ -35,10 +35,8 @@ public interface OnlineUserService { | ||||
|     /** | ||||
|      * 分页查询列表 | ||||
|      * | ||||
|      * @param query | ||||
|      *            查询条件 | ||||
|      * @param pageQuery | ||||
|      *            分页查询条件 | ||||
|      * @param query     查询条件 | ||||
|      * @param pageQuery 分页查询条件 | ||||
|      * @return 分页列表信息 | ||||
|      */ | ||||
|     PageResp<OnlineUserResp> page(OnlineUserQuery query, PageQuery pageQuery); | ||||
| @@ -46,8 +44,7 @@ public interface OnlineUserService { | ||||
|     /** | ||||
|      * 查询列表 | ||||
|      * | ||||
|      * @param query | ||||
|      *            查询条件 | ||||
|      * @param query 查询条件 | ||||
|      * @return 列表信息 | ||||
|      */ | ||||
|     List<LoginUser> list(OnlineUserQuery query); | ||||
| @@ -55,8 +52,7 @@ public interface OnlineUserService { | ||||
|     /** | ||||
|      * 根据角色 ID 清除 | ||||
|      * | ||||
|      * @param roleId | ||||
|      *            角色 ID | ||||
|      * @param roleId 角色 ID | ||||
|      */ | ||||
|     void cleanByRoleId(Long roleId); | ||||
| } | ||||
|   | ||||
| @@ -29,8 +29,7 @@ public interface PermissionService { | ||||
|     /** | ||||
|      * 根据用户 ID 查询权限码 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 权限码集合 | ||||
|      */ | ||||
|     Set<String> listPermissionByUserId(Long userId); | ||||
| @@ -38,8 +37,7 @@ public interface PermissionService { | ||||
|     /** | ||||
|      * 根据用户 ID 查询角色编码 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 角色编码集合 | ||||
|      */ | ||||
|     Set<String> listRoleCodeByUserId(Long userId); | ||||
|   | ||||
| @@ -162,8 +162,9 @@ public class LoginServiceImpl implements LoginService { | ||||
|         } else { | ||||
|             roleCodeSet.forEach(roleCode -> menuSet.addAll(menuService.listByRoleCode(roleCode))); | ||||
|         } | ||||
|         List<MenuResp> menuList = | ||||
|             menuSet.stream().filter(m -> !MenuTypeEnum.BUTTON.equals(m.getType())).collect(Collectors.toList()); | ||||
|         List<MenuResp> menuList = menuSet.stream() | ||||
|             .filter(m -> !MenuTypeEnum.BUTTON.equals(m.getType())) | ||||
|             .collect(Collectors.toList()); | ||||
|         // 构建路由树 | ||||
|         TreeField treeField = MenuResp.class.getDeclaredAnnotation(TreeField.class); | ||||
|         TreeNodeConfig treeNodeConfig = TreeUtils.genTreeNodeConfig(treeField); | ||||
| @@ -189,8 +190,7 @@ public class LoginServiceImpl implements LoginService { | ||||
|     /** | ||||
|      * 登录并缓存用户信息 | ||||
|      * | ||||
|      * @param user | ||||
|      *            用户信息 | ||||
|      * @param user 用户信息 | ||||
|      * @return 令牌 | ||||
|      */ | ||||
|     private String login(UserDO user) { | ||||
| @@ -205,8 +205,7 @@ public class LoginServiceImpl implements LoginService { | ||||
|     /** | ||||
|      * 检查用户状态 | ||||
|      * | ||||
|      * @param user | ||||
|      *            用户信息 | ||||
|      * @param user 用户信息 | ||||
|      */ | ||||
|     private void checkUserStatus(UserDO user) { | ||||
|         CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, user.getStatus(), "此账号已被禁用,如有疑问,请联系管理员"); | ||||
| @@ -217,8 +216,7 @@ public class LoginServiceImpl implements LoginService { | ||||
|     /** | ||||
|      * 发送系统消息 | ||||
|      *  | ||||
|      * @param user | ||||
|      *            用户信息 | ||||
|      * @param user 用户信息 | ||||
|      */ | ||||
|     private void sendSystemMsg(UserDO user) { | ||||
|         MessageReq req = new MessageReq(); | ||||
|   | ||||
| @@ -97,25 +97,23 @@ public class OnlineUserServiceImpl implements OnlineUserService { | ||||
|     /** | ||||
|      * 是否符合查询条件 | ||||
|      * | ||||
|      * @param query | ||||
|      *            查询条件 | ||||
|      * @param loginUser | ||||
|      *            登录用户信息 | ||||
|      * @param query     查询条件 | ||||
|      * @param loginUser 登录用户信息 | ||||
|      * @return 是否符合查询条件 | ||||
|      */ | ||||
|     private boolean isMatchQuery(OnlineUserQuery query, LoginUser loginUser) { | ||||
|         boolean flag1 = true; | ||||
|         String nickname = query.getNickname(); | ||||
|         if (StrUtil.isNotBlank(nickname)) { | ||||
|             flag1 = StrUtil.contains(loginUser.getUsername(), nickname) | ||||
|                 || StrUtil.contains(LoginHelper.getNickname(loginUser.getId()), nickname); | ||||
|             flag1 = StrUtil.contains(loginUser.getUsername(), nickname) || StrUtil.contains(LoginHelper | ||||
|                 .getNickname(loginUser.getId()), nickname); | ||||
|         } | ||||
|  | ||||
|         boolean flag2 = true; | ||||
|         List<Date> loginTime = query.getLoginTime(); | ||||
|         if (CollUtil.isNotEmpty(loginTime)) { | ||||
|             flag2 = | ||||
|                 DateUtil.isIn(DateUtil.date(loginUser.getLoginTime()).toJdkDate(), loginTime.get(0), loginTime.get(1)); | ||||
|             flag2 = DateUtil.isIn(DateUtil.date(loginUser.getLoginTime()).toJdkDate(), loginTime.get(0), loginTime | ||||
|                 .get(1)); | ||||
|         } | ||||
|         return flag1 && flag2; | ||||
|     } | ||||
|   | ||||
| @@ -56,7 +56,8 @@ public class FileRecorderImpl implements FileRecorder { | ||||
|         FileDO file = new FileDO(); | ||||
|         String originalFilename = EscapeUtil.unescape(fileInfo.getOriginalFilename()); | ||||
|         file.setName(StrUtil.contains(originalFilename, StringConstants.DOT) | ||||
|             ? StrUtil.subBefore(originalFilename, StringConstants.DOT, true) : originalFilename); | ||||
|             ? StrUtil.subBefore(originalFilename, StringConstants.DOT, true) | ||||
|             : originalFilename); | ||||
|         file.setSize(fileInfo.getSize()); | ||||
|         file.setUrl(fileInfo.getUrl()); | ||||
|         file.setExtension(fileInfo.getExt()); | ||||
| @@ -95,6 +96,8 @@ public class FileRecorderImpl implements FileRecorder { | ||||
|     private FileDO getFileByUrl(String url) { | ||||
|         Optional<FileDO> fileOptional = fileMapper.lambdaQuery().eq(FileDO::getUrl, url).oneOpt(); | ||||
|         return fileOptional.orElseGet(() -> fileMapper.lambdaQuery() | ||||
|             .eq(FileDO::getUrl, StrUtil.subAfter(url, StringConstants.SLASH, true)).oneOpt().orElse(null)); | ||||
|             .eq(FileDO::getUrl, StrUtil.subAfter(url, StringConstants.SLASH, true)) | ||||
|             .oneOpt() | ||||
|             .orElse(null)); | ||||
|     } | ||||
| } | ||||
| @@ -69,13 +69,13 @@ public enum FileTypeEnum implements IBaseEnum<Integer> { | ||||
|     /** | ||||
|      * 根据扩展名查询 | ||||
|      * | ||||
|      * @param extension | ||||
|      *            扩展名 | ||||
|      * @param extension 扩展名 | ||||
|      * @return 文件类型 | ||||
|      */ | ||||
|     public static FileTypeEnum getByExtension(String extension) { | ||||
|         return Arrays.stream(FileTypeEnum.values()) | ||||
|             .filter(t -> t.getExtensions().contains(StrUtil.emptyIfNull(extension).toLowerCase())).findFirst() | ||||
|             .filter(t -> t.getExtensions().contains(StrUtil.emptyIfNull(extension).toLowerCase())) | ||||
|             .findFirst() | ||||
|             .orElse(FileTypeEnum.UNKNOWN); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -35,8 +35,7 @@ public interface DictItemMapper extends BaseMapper<DictItemDO> { | ||||
|     /** | ||||
|      * 根据字典编码查询 | ||||
|      *  | ||||
|      * @param dictCode | ||||
|      *            字典编码 | ||||
|      * @param dictCode 字典编码 | ||||
|      * @return 字典项列表 | ||||
|      */ | ||||
|     List<LabelValueResp> listByDictCode(@Param("dictCode") String dictCode); | ||||
|   | ||||
| @@ -35,8 +35,7 @@ public interface MenuMapper extends BaseMapper<MenuDO> { | ||||
|     /** | ||||
|      * 根据用户 ID 查询权限码 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 权限码集合 | ||||
|      */ | ||||
|     Set<String> selectPermissionByUserId(@Param("userId") Long userId); | ||||
| @@ -44,8 +43,7 @@ public interface MenuMapper extends BaseMapper<MenuDO> { | ||||
|     /** | ||||
|      * 根据角色编码查询 | ||||
|      * | ||||
|      * @param roleCode | ||||
|      *            角色编码 | ||||
|      * @param roleCode 角色编码 | ||||
|      * @return 菜单列表 | ||||
|      */ | ||||
|     List<MenuDO> selectListByRoleCode(@Param("roleCode") String roleCode); | ||||
|   | ||||
| @@ -37,12 +37,10 @@ public interface MessageMapper extends BaseMapper<MessageDO> { | ||||
|     /** | ||||
|      * 分页查询列表 | ||||
|      * | ||||
|      * @param page | ||||
|      *            分页查询条件 | ||||
|      * @param queryWrapper | ||||
|      *            查询条件 | ||||
|      * @param page         分页查询条件 | ||||
|      * @param queryWrapper 查询条件 | ||||
|      * @return 分页信息 | ||||
|      */ | ||||
|     IPage<MessageResp> selectPageByUserId(@Param("page") IPage<Object> page, | ||||
|         @Param(Constants.WRAPPER) QueryWrapper<MessageDO> queryWrapper); | ||||
|                                           @Param(Constants.WRAPPER) QueryWrapper<MessageDO> queryWrapper); | ||||
| } | ||||
| @@ -32,10 +32,8 @@ public interface MessageUserMapper extends BaseMapper<MessageUserDO> { | ||||
|     /** | ||||
|      * 根据用户 ID 和消息类型查询未读消息数量 | ||||
|      *  | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param type | ||||
|      *            消息类型 | ||||
|      * @param userId 用户 ID | ||||
|      * @param type   消息类型 | ||||
|      * @return 未读消息信息 | ||||
|      */ | ||||
|     Long selectUnreadCountByUserIdAndType(@Param("userId") Long userId, @Param("type") Integer type); | ||||
|   | ||||
| @@ -35,8 +35,7 @@ public interface RoleDeptMapper extends BaseMapper<RoleDeptDO> { | ||||
|     /** | ||||
|      * 根据角色 ID 查询 | ||||
|      * | ||||
|      * @param roleId | ||||
|      *            角色 ID | ||||
|      * @param roleId 角色 ID | ||||
|      * @return 部门 ID 列表 | ||||
|      */ | ||||
|     @Select("SELECT `dept_id` FROM `sys_role_dept` WHERE `role_id` = #{roleId}") | ||||
|   | ||||
| @@ -32,8 +32,7 @@ public interface RoleMenuMapper extends BaseMapper<RoleMenuDO> { | ||||
|     /** | ||||
|      * 根据角色 ID 列表查询 | ||||
|      * | ||||
|      * @param roleIds | ||||
|      *            角色 ID 列表 | ||||
|      * @param roleIds 角色 ID 列表 | ||||
|      * @return 菜单 ID 列表 | ||||
|      */ | ||||
|     List<Long> selectMenuIdByRoleIds(List<Long> roleIds); | ||||
|   | ||||
| @@ -33,8 +33,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { | ||||
|     /** | ||||
|      * 根据用户名查询 | ||||
|      * | ||||
|      * @param username | ||||
|      *            用户名 | ||||
|      * @param username 用户名 | ||||
|      * @return 用户信息 | ||||
|      */ | ||||
|     @Select("SELECT * FROM `sys_user` WHERE `username` = #{username}") | ||||
| @@ -43,8 +42,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { | ||||
|     /** | ||||
|      * 根据手机号查询 | ||||
|      * | ||||
|      * @param phone | ||||
|      *            手机号 | ||||
|      * @param phone 手机号 | ||||
|      * @return 用户信息 | ||||
|      */ | ||||
|     @Select("SELECT * FROM `sys_user` WHERE `phone` = #{phone}") | ||||
| @@ -53,8 +51,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { | ||||
|     /** | ||||
|      * 根据邮箱查询 | ||||
|      * | ||||
|      * @param email | ||||
|      *            邮箱 | ||||
|      * @param email 邮箱 | ||||
|      * @return 用户信息 | ||||
|      */ | ||||
|     @Select("SELECT * FROM `sys_user` WHERE `email` = #{email}") | ||||
| @@ -63,8 +60,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { | ||||
|     /** | ||||
|      * 根据 ID 查询昵称 | ||||
|      * | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param id ID | ||||
|      * @return 昵称 | ||||
|      */ | ||||
|     @Select("SELECT `nickname` FROM `sys_user` WHERE `id` = #{id}") | ||||
|   | ||||
| @@ -35,8 +35,7 @@ public interface UserRoleMapper extends BaseMapper<UserRoleDO> { | ||||
|     /** | ||||
|      * 根据用户 ID 查询 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 角色 ID 列表 | ||||
|      */ | ||||
|     @Select("SELECT `role_id` FROM `sys_user_role` WHERE `user_id` = #{userId}") | ||||
|   | ||||
| @@ -32,10 +32,8 @@ public interface UserSocialMapper extends BaseMapper<UserSocialDO> { | ||||
|     /** | ||||
|      * 根据来源和开放 ID 查询 | ||||
|      *  | ||||
|      * @param source | ||||
|      *            来源 | ||||
|      * @param openId | ||||
|      *            开放 ID | ||||
|      * @param source 来源 | ||||
|      * @param openId 开放 ID | ||||
|      * @return 用户社会化关联信息 | ||||
|      */ | ||||
|     UserSocialDO selectBySourceAndOpenId(@Param("source") String source, @Param("openId") String openId); | ||||
|   | ||||
| @@ -80,21 +80,22 @@ public class FileDO extends BaseDO { | ||||
|     /** | ||||
|      * 转换为 X-File-Storage 文件信息对象 | ||||
|      * | ||||
|      * @param storageCode | ||||
|      *            存储库编码 | ||||
|      * @param storageCode 存储库编码 | ||||
|      * @return X-File-Storage 文件信息对象 | ||||
|      */ | ||||
|     public FileInfo toFileInfo(String storageCode) { | ||||
|         FileInfo fileInfo = new FileInfo(); | ||||
|         fileInfo.setOriginalFilename( | ||||
|             StrUtil.isNotBlank(this.extension) ? this.name + StringConstants.DOT + this.extension : this.name); | ||||
|         fileInfo.setOriginalFilename(StrUtil.isNotBlank(this.extension) | ||||
|             ? this.name + StringConstants.DOT + this.extension | ||||
|             : this.name); | ||||
|         fileInfo.setSize(this.size); | ||||
|         fileInfo.setUrl(this.url); | ||||
|         fileInfo.setExt(this.extension); | ||||
|         fileInfo.setBasePath(StringConstants.EMPTY); | ||||
|         fileInfo.setPath(StringConstants.EMPTY); | ||||
|         fileInfo.setFilename( | ||||
|             URLUtils.isHttpUrl(this.url) ? StrUtil.subAfter(this.url, StringConstants.SLASH, true) : this.url); | ||||
|         fileInfo.setFilename(URLUtils.isHttpUrl(this.url) | ||||
|             ? StrUtil.subAfter(this.url, StringConstants.SLASH, true) | ||||
|             : this.url); | ||||
|         fileInfo.setPlatform(storageCode); | ||||
|         return fileInfo; | ||||
|     } | ||||
|   | ||||
| @@ -87,8 +87,8 @@ public class RoleReq extends BaseReq { | ||||
|     /** | ||||
|      * 数据权限 | ||||
|      */ | ||||
|     @Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer", | ||||
|         allowableValues = {"1", "2", "3", "4", "5"}, example = "5") | ||||
|     @Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer", allowableValues = { | ||||
|         "1", "2", "3", "4", "5"}, example = "5") | ||||
|     private DataScopeEnum dataScope; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -62,8 +62,7 @@ public class UserEmailUpdateRequest implements Serializable { | ||||
|     /** | ||||
|      * 当前密码(加密后) | ||||
|      */ | ||||
|     @Schema(description = "当前密码(加密后)", | ||||
|         example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==") | ||||
|     @Schema(description = "当前密码(加密后)", example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==") | ||||
|     @NotBlank(message = "当前密码不能为空") | ||||
|     private String currentPassword; | ||||
| } | ||||
|   | ||||
| @@ -41,15 +41,13 @@ public class UserPasswordUpdateReq implements Serializable { | ||||
|     /** | ||||
|      * 当前密码(加密后) | ||||
|      */ | ||||
|     @Schema(description = "当前密码(加密后)", | ||||
|         example = "E7c72TH+LDxKTwavjM99W1MdI9Lljh79aPKiv3XB9MXcplhm7qJ1BJCj28yaflbdVbfc366klMtjLIWQGqb0qw==") | ||||
|     @Schema(description = "当前密码(加密后)", example = "E7c72TH+LDxKTwavjM99W1MdI9Lljh79aPKiv3XB9MXcplhm7qJ1BJCj28yaflbdVbfc366klMtjLIWQGqb0qw==") | ||||
|     private String oldPassword; | ||||
|  | ||||
|     /** | ||||
|      * 新密码(加密后) | ||||
|      */ | ||||
|     @Schema(description = "新密码(加密后)", | ||||
|         example = "Gzc78825P5baH190lRuZFb9KJxRt/psN2jiyOMPoc5WRcCvneCwqDm3Q33BZY56EzyyVy7vQu7jQwYTK4j1+5w==") | ||||
|     @Schema(description = "新密码(加密后)", example = "Gzc78825P5baH190lRuZFb9KJxRt/psN2jiyOMPoc5WRcCvneCwqDm3Q33BZY56EzyyVy7vQu7jQwYTK4j1+5w==") | ||||
|     @NotBlank(message = "新密码不能为空") | ||||
|     private String newPassword; | ||||
| } | ||||
|   | ||||
| @@ -62,8 +62,7 @@ public class UserPhoneUpdateReq implements Serializable { | ||||
|     /** | ||||
|      * 当前密码(加密后) | ||||
|      */ | ||||
|     @Schema(description = "当前密码(加密后)", | ||||
|         example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==") | ||||
|     @Schema(description = "当前密码(加密后)", example = "SYRLSszQGcMv4kP2Yolou9zf28B9GDakR9u91khxmR7V++i5A384kwnNZxqgvT6bjT4zqpIDuMFLWSt92hQJJA==") | ||||
|     @NotBlank(message = "当前密码不能为空") | ||||
|     private String currentPassword; | ||||
| } | ||||
|   | ||||
| @@ -41,7 +41,6 @@ public class AvatarResp implements Serializable { | ||||
|     /** | ||||
|      * 头像地址 | ||||
|      */ | ||||
|     @Schema(description = "头像地址", | ||||
|         example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg") | ||||
|     @Schema(description = "头像地址", example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg") | ||||
|     private String avatar; | ||||
| } | ||||
|   | ||||
| @@ -68,8 +68,8 @@ public class FileResp extends BaseDetailResp { | ||||
|     /** | ||||
|      * 类型 | ||||
|      */ | ||||
|     @Schema(description = "类型(1:其他;2:图片;3:文档;4:视频;5:音频)", type = "Integer", allowableValues = {"1", "2", "3", "4", "5"}, | ||||
|         example = "2") | ||||
|     @Schema(description = "类型(1:其他;2:图片;3:文档;4:视频;5:音频)", type = "Integer", allowableValues = {"1", "2", "3", "4", | ||||
|         "5"}, example = "2") | ||||
|     private FileTypeEnum type; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -62,8 +62,8 @@ public class RoleDetailResp extends BaseDetailResp { | ||||
|     /** | ||||
|      * 数据权限 | ||||
|      */ | ||||
|     @Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer", | ||||
|         allowableValues = {"1", "2", "3", "4", "5"}, example = "5") | ||||
|     @Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer", allowableValues = { | ||||
|         "1", "2", "3", "4", "5"}, example = "5") | ||||
|     @ExcelProperty(value = "数据权限", converter = ExcelBaseEnumConverter.class) | ||||
|     private DataScopeEnum dataScope; | ||||
|  | ||||
|   | ||||
| @@ -54,8 +54,8 @@ public class RoleResp extends BaseResp { | ||||
|     /** | ||||
|      * 数据权限 | ||||
|      */ | ||||
|     @Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer", | ||||
|         allowableValues = {"1", "2", "3", "4", "5"}, example = "5") | ||||
|     @Schema(description = "数据权限(1:全部数据权限;2:本部门及以下数据权限;3:本部门数据权限;4:仅本人数据权限;5:自定义数据权限)", type = "Integer", allowableValues = { | ||||
|         "1", "2", "3", "4", "5"}, example = "5") | ||||
|     private DataScopeEnum dataScope; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -86,8 +86,7 @@ public class UserDetailResp extends BaseDetailResp { | ||||
|     /** | ||||
|      * 头像地址 | ||||
|      */ | ||||
|     @Schema(description = "头像地址", | ||||
|         example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg") | ||||
|     @Schema(description = "头像地址", example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg") | ||||
|     @ExcelProperty(value = "头像地址") | ||||
|     private String avatar; | ||||
|  | ||||
|   | ||||
| @@ -64,8 +64,7 @@ public class UserResp extends BaseResp { | ||||
|     /** | ||||
|      * 头像地址 | ||||
|      */ | ||||
|     @Schema(description = "头像地址", | ||||
|         example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg") | ||||
|     @Schema(description = "头像地址", example = "https://himg.bdimg.com/sys/portrait/item/public.1.81ac9a9e.rf1ix17UfughLQjNo7XQ_w.jpg") | ||||
|     private String avatar; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -31,8 +31,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseService; | ||||
|  * @author Charles7c | ||||
|  * @since 2023/8/20 10:55 | ||||
|  */ | ||||
| public interface AnnouncementService | ||||
|     extends BaseService<AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> { | ||||
| public interface AnnouncementService extends BaseService<AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> { | ||||
|  | ||||
|     /** | ||||
|      * 查询仪表盘公告列表 | ||||
|   | ||||
| @@ -36,8 +36,7 @@ public interface DictItemService extends BaseService<DictItemResp, DictItemDetai | ||||
|     /** | ||||
|      * 根据字典 ID 查询 | ||||
|      * | ||||
|      * @param dictId | ||||
|      *            字典 ID | ||||
|      * @param dictId 字典 ID | ||||
|      * @return 字典项列表 | ||||
|      */ | ||||
|     List<DictItemDetailResp> listByDictId(Long dictId); | ||||
| @@ -45,8 +44,7 @@ public interface DictItemService extends BaseService<DictItemResp, DictItemDetai | ||||
|     /** | ||||
|      * 根据字典编码查询 | ||||
|      *  | ||||
|      * @param dictCode | ||||
|      *            字典编码 | ||||
|      * @param dictCode 字典编码 | ||||
|      * @return 字典项列表 | ||||
|      */ | ||||
|     List<LabelValueResp> listByDictCode(String dictCode); | ||||
| @@ -54,8 +52,7 @@ public interface DictItemService extends BaseService<DictItemResp, DictItemDetai | ||||
|     /** | ||||
|      * 根据字典 ID 列表删除 | ||||
|      * | ||||
|      * @param dictIds | ||||
|      *            字典 ID 列表 | ||||
|      * @param dictIds 字典 ID 列表 | ||||
|      */ | ||||
|     void deleteByDictIds(List<Long> dictIds); | ||||
| } | ||||
| @@ -37,8 +37,7 @@ public interface FileService extends BaseService<FileResp, FileResp, FileQuery, | ||||
|     /** | ||||
|      * 上传到默认存储库 | ||||
|      * | ||||
|      * @param file | ||||
|      *            文件信息 | ||||
|      * @param file 文件信息 | ||||
|      * @return 文件信息 | ||||
|      */ | ||||
|     default FileInfo upload(MultipartFile file) { | ||||
| @@ -48,10 +47,8 @@ public interface FileService extends BaseService<FileResp, FileResp, FileQuery, | ||||
|     /** | ||||
|      * 上传到指定存储库 | ||||
|      * | ||||
|      * @param file | ||||
|      *            文件信息 | ||||
|      * @param storageCode | ||||
|      *            存储库编码 | ||||
|      * @param file        文件信息 | ||||
|      * @param storageCode 存储库编码 | ||||
|      * @return 文件信息 | ||||
|      */ | ||||
|     FileInfo upload(MultipartFile file, String storageCode); | ||||
| @@ -59,8 +56,7 @@ public interface FileService extends BaseService<FileResp, FileResp, FileQuery, | ||||
|     /** | ||||
|      * 根据存储库 ID 列表查询 | ||||
|      * | ||||
|      * @param storageIds | ||||
|      *            存储库 ID 列表 | ||||
|      * @param storageIds 存储库 ID 列表 | ||||
|      * @return 文件数量 | ||||
|      */ | ||||
|     Long countByStorageIds(List<Long> storageIds); | ||||
|   | ||||
| @@ -35,8 +35,7 @@ public interface MenuService extends BaseService<MenuResp, MenuResp, MenuQuery, | ||||
|     /** | ||||
|      * 根据用户 ID 查询 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 权限码集合 | ||||
|      */ | ||||
|     Set<String> listPermissionByUserId(Long userId); | ||||
| @@ -44,8 +43,7 @@ public interface MenuService extends BaseService<MenuResp, MenuResp, MenuQuery, | ||||
|     /** | ||||
|      * 根据角色编码查询 | ||||
|      * | ||||
|      * @param roleCode | ||||
|      *            角色编码 | ||||
|      * @param roleCode 角色编码 | ||||
|      * @return 菜单列表 | ||||
|      */ | ||||
|     List<MenuResp> listByRoleCode(String roleCode); | ||||
|   | ||||
| @@ -35,10 +35,8 @@ public interface MessageService { | ||||
|     /** | ||||
|      * 分页查询列表 | ||||
|      * | ||||
|      * @param query | ||||
|      *            查询条件 | ||||
|      * @param pageQuery | ||||
|      *            分页查询条件 | ||||
|      * @param query     查询条件 | ||||
|      * @param pageQuery 分页查询条件 | ||||
|      * @return 分页列表信息 | ||||
|      */ | ||||
|     PageResp<MessageResp> page(MessageQuery query, PageQuery pageQuery); | ||||
| @@ -46,10 +44,8 @@ public interface MessageService { | ||||
|     /** | ||||
|      * 新增 | ||||
|      * | ||||
|      * @param req | ||||
|      *            新增信息 | ||||
|      * @param userIdList | ||||
|      *            接收人列表 | ||||
|      * @param req        新增信息 | ||||
|      * @param userIdList 接收人列表 | ||||
|      */ | ||||
|     void add(MessageReq req, List<Long> userIdList); | ||||
|  | ||||
|   | ||||
| @@ -31,10 +31,8 @@ public interface MessageUserService { | ||||
|     /** | ||||
|      * 根据用户 ID 查询未读消息数量 | ||||
|      *  | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param isDetail | ||||
|      *            是否查询详情 | ||||
|      * @param userId   用户 ID | ||||
|      * @param isDetail 是否查询详情 | ||||
|      * @return 未读消息信息 | ||||
|      */ | ||||
|     MessageUnreadResp countUnreadMessageByUserId(Long userId, Boolean isDetail); | ||||
| @@ -42,10 +40,8 @@ public interface MessageUserService { | ||||
|     /** | ||||
|      * 新增 | ||||
|      * | ||||
|      * @param messageId | ||||
|      *            消息 ID | ||||
|      * @param userIdList | ||||
|      *            用户 ID 列表 | ||||
|      * @param messageId  消息 ID | ||||
|      * @param userIdList 用户 ID 列表 | ||||
|      */ | ||||
|     void add(Long messageId, List<Long> userIdList); | ||||
|  | ||||
| @@ -60,8 +56,7 @@ public interface MessageUserService { | ||||
|     /** | ||||
|      * 根据消息 ID 删除 | ||||
|      * | ||||
|      * @param messageIds | ||||
|      *            消息 ID 列表 | ||||
|      * @param messageIds 消息 ID 列表 | ||||
|      */ | ||||
|     void deleteByMessageIds(List<Long> messageIds); | ||||
| } | ||||
| @@ -34,8 +34,7 @@ public interface OptionService { | ||||
|     /** | ||||
|      * 查询列表 | ||||
|      * | ||||
|      * @param query | ||||
|      *            查询条件 | ||||
|      * @param query 查询条件 | ||||
|      * @return 列表信息 | ||||
|      */ | ||||
|     List<OptionResp> list(OptionQuery query); | ||||
|   | ||||
| @@ -29,10 +29,8 @@ public interface RoleDeptService { | ||||
|     /** | ||||
|      * 新增 | ||||
|      * | ||||
|      * @param deptIds | ||||
|      *            部门 ID 列表 | ||||
|      * @param roleId | ||||
|      *            角色 ID | ||||
|      * @param deptIds 部门 ID 列表 | ||||
|      * @param roleId  角色 ID | ||||
|      * @return true:成功;false:无变更/失败 | ||||
|      */ | ||||
|     boolean add(List<Long> deptIds, Long roleId); | ||||
| @@ -40,24 +38,21 @@ public interface RoleDeptService { | ||||
|     /** | ||||
|      * 根据角色 ID 删除 | ||||
|      * | ||||
|      * @param roleIds | ||||
|      *            角色 ID 列表 | ||||
|      * @param roleIds 角色 ID 列表 | ||||
|      */ | ||||
|     void deleteByRoleIds(List<Long> roleIds); | ||||
|  | ||||
|     /** | ||||
|      * 根据部门 ID 删除 | ||||
|      * | ||||
|      * @param deptIds | ||||
|      *            部门 ID 列表 | ||||
|      * @param deptIds 部门 ID 列表 | ||||
|      */ | ||||
|     void deleteByDeptIds(List<Long> deptIds); | ||||
|  | ||||
|     /** | ||||
|      * 根据角色 ID 查询 | ||||
|      * | ||||
|      * @param roleId | ||||
|      *            角色 ID | ||||
|      * @param roleId 角色 ID | ||||
|      * @return 部门 ID 列表 | ||||
|      */ | ||||
|     List<Long> listDeptIdByRoleId(Long roleId); | ||||
|   | ||||
| @@ -29,10 +29,8 @@ public interface RoleMenuService { | ||||
|     /** | ||||
|      * 新增 | ||||
|      * | ||||
|      * @param menuIds | ||||
|      *            菜单 ID 列表 | ||||
|      * @param roleId | ||||
|      *            角色 ID | ||||
|      * @param menuIds 菜单 ID 列表 | ||||
|      * @param roleId  角色 ID | ||||
|      * @return true:成功;false:无变更/失败 | ||||
|      */ | ||||
|     boolean add(List<Long> menuIds, Long roleId); | ||||
| @@ -40,16 +38,14 @@ public interface RoleMenuService { | ||||
|     /** | ||||
|      * 根据角色 ID 删除 | ||||
|      * | ||||
|      * @param roleIds | ||||
|      *            角色 ID 列表 | ||||
|      * @param roleIds 角色 ID 列表 | ||||
|      */ | ||||
|     void deleteByRoleIds(List<Long> roleIds); | ||||
|  | ||||
|     /** | ||||
|      * 根据角色 ID 查询 | ||||
|      * | ||||
|      * @param roleIds | ||||
|      *            角色 ID 列表 | ||||
|      * @param roleIds 角色 ID 列表 | ||||
|      * @return 菜单 ID 列表 | ||||
|      */ | ||||
|     List<Long> listMenuIdByRoleIds(List<Long> roleIds); | ||||
|   | ||||
| @@ -39,8 +39,7 @@ public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQ | ||||
|     /** | ||||
|      * 构建字典 | ||||
|      * | ||||
|      * @param list | ||||
|      *            原始列表数据 | ||||
|      * @param list 原始列表数据 | ||||
|      * @return 字典列表 | ||||
|      */ | ||||
|     List<LabelValueResp<Long>> buildDict(List<RoleResp> list); | ||||
| @@ -57,8 +56,7 @@ public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQ | ||||
|     /** | ||||
|      * 根据用户 ID 查询角色编码 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 角色编码集合 | ||||
|      */ | ||||
|     Set<String> listCodeByUserId(Long userId); | ||||
| @@ -66,8 +64,7 @@ public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQ | ||||
|     /** | ||||
|      * 根据用户 ID 查询角色 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 角色集合 | ||||
|      */ | ||||
|     Set<RoleDTO> listByUserId(Long userId); | ||||
| @@ -75,8 +72,7 @@ public interface RoleService extends BaseService<RoleResp, RoleDetailResp, RoleQ | ||||
|     /** | ||||
|      * 根据角色编码查询 | ||||
|      *  | ||||
|      * @param code | ||||
|      *            角色编码 | ||||
|      * @param code 角色编码 | ||||
|      * @return 角色信息 | ||||
|      */ | ||||
|     RoleDO getByCode(String code); | ||||
|   | ||||
| @@ -41,8 +41,7 @@ public interface StorageService extends BaseService<StorageResp, StorageDetailRe | ||||
|     /** | ||||
|      * 根据编码查询 | ||||
|      * | ||||
|      * @param code | ||||
|      *            编码 | ||||
|      * @param code 编码 | ||||
|      * @return 存储库信息 | ||||
|      */ | ||||
|     StorageDO getByCode(String code); | ||||
|   | ||||
| @@ -29,10 +29,8 @@ public interface UserRoleService { | ||||
|     /** | ||||
|      * 新增 | ||||
|      * | ||||
|      * @param roleIds | ||||
|      *            角色 ID 列表 | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param roleIds 角色 ID 列表 | ||||
|      * @param userId  用户 ID | ||||
|      * @return true:成功;false:无变更/失败 | ||||
|      */ | ||||
|     boolean add(List<Long> roleIds, Long userId); | ||||
| @@ -40,16 +38,14 @@ public interface UserRoleService { | ||||
|     /** | ||||
|      * 根据用户 ID 删除 | ||||
|      * | ||||
|      * @param userIds | ||||
|      *            用户 ID 列表 | ||||
|      * @param userIds 用户 ID 列表 | ||||
|      */ | ||||
|     void deleteByUserIds(List<Long> userIds); | ||||
|  | ||||
|     /** | ||||
|      * 根据用户 ID 查询 | ||||
|      * | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 角色 ID 列表 | ||||
|      */ | ||||
|     List<Long> listRoleIdByUserId(Long userId); | ||||
| @@ -57,8 +53,7 @@ public interface UserRoleService { | ||||
|     /** | ||||
|      * 根据角色 ID 列表查询 | ||||
|      * | ||||
|      * @param roleIds | ||||
|      *            角色 ID 列表 | ||||
|      * @param roleIds 角色 ID 列表 | ||||
|      * @return 总记录数 | ||||
|      */ | ||||
|     Long countByRoleIds(List<Long> roleIds); | ||||
|   | ||||
| @@ -40,8 +40,7 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ | ||||
|     /** | ||||
|      * 新增 | ||||
|      *  | ||||
|      * @param user | ||||
|      *            用户信息 | ||||
|      * @param user 用户信息 | ||||
|      * @return ID | ||||
|      */ | ||||
|     Long add(UserDO user); | ||||
| @@ -49,10 +48,8 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ | ||||
|     /** | ||||
|      * 上传头像 | ||||
|      * | ||||
|      * @param avatar | ||||
|      *            头像文件 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param avatar 头像文件 | ||||
|      * @param id     ID | ||||
|      * @return 新头像路径 | ||||
|      */ | ||||
|     String uploadAvatar(MultipartFile avatar, Long id); | ||||
| @@ -60,72 +57,57 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ | ||||
|     /** | ||||
|      * 修改基础信息 | ||||
|      * | ||||
|      * @param updateReq | ||||
|      *            修改信息 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param updateReq 修改信息 | ||||
|      * @param id        ID | ||||
|      */ | ||||
|     void updateBasicInfo(UserBasicInfoUpdateReq updateReq, Long id); | ||||
|  | ||||
|     /** | ||||
|      * 修改密码 | ||||
|      * | ||||
|      * @param oldPassword | ||||
|      *            当前密码 | ||||
|      * @param newPassword | ||||
|      *            新密码 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param oldPassword 当前密码 | ||||
|      * @param newPassword 新密码 | ||||
|      * @param id          ID | ||||
|      */ | ||||
|     void updatePassword(String oldPassword, String newPassword, Long id); | ||||
|  | ||||
|     /** | ||||
|      * 修改手机号 | ||||
|      * | ||||
|      * @param newPhone | ||||
|      *            新手机号 | ||||
|      * @param currentPassword | ||||
|      *            当前密码 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param newPhone        新手机号 | ||||
|      * @param currentPassword 当前密码 | ||||
|      * @param id              ID | ||||
|      */ | ||||
|     void updatePhone(String newPhone, String currentPassword, Long id); | ||||
|  | ||||
|     /** | ||||
|      * 修改邮箱 | ||||
|      * | ||||
|      * @param newEmail | ||||
|      *            新邮箱 | ||||
|      * @param currentPassword | ||||
|      *            当前密码 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param newEmail        新邮箱 | ||||
|      * @param currentPassword 当前密码 | ||||
|      * @param id              ID | ||||
|      */ | ||||
|     void updateEmail(String newEmail, String currentPassword, Long id); | ||||
|  | ||||
|     /** | ||||
|      * 重置密码 | ||||
|      * | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param id ID | ||||
|      */ | ||||
|     void resetPassword(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 修改角色 | ||||
|      * | ||||
|      * @param updateReq | ||||
|      *            修改信息 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param updateReq 修改信息 | ||||
|      * @param id        ID | ||||
|      */ | ||||
|     void updateRole(UserRoleUpdateReq updateReq, Long id); | ||||
|  | ||||
|     /** | ||||
|      * 根据用户名查询 | ||||
|      * | ||||
|      * @param username | ||||
|      *            用户名 | ||||
|      * @param username 用户名 | ||||
|      * @return 用户信息 | ||||
|      */ | ||||
|     UserDO getByUsername(String username); | ||||
| @@ -133,8 +115,7 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ | ||||
|     /** | ||||
|      * 根据手机号查询 | ||||
|      * | ||||
|      * @param phone | ||||
|      *            手机号 | ||||
|      * @param phone 手机号 | ||||
|      * @return 用户信息 | ||||
|      */ | ||||
|     UserDO getByPhone(String phone); | ||||
| @@ -142,8 +123,7 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ | ||||
|     /** | ||||
|      * 根据邮箱查询 | ||||
|      * | ||||
|      * @param email | ||||
|      *            邮箱 | ||||
|      * @param email 邮箱 | ||||
|      * @return 用户信息 | ||||
|      */ | ||||
|     UserDO getByEmail(String email); | ||||
| @@ -151,8 +131,7 @@ public interface UserService extends BaseService<UserResp, UserDetailResp, UserQ | ||||
|     /** | ||||
|      * 根据部门 ID 列表查询 | ||||
|      * | ||||
|      * @param deptIds | ||||
|      *            部门 ID 列表 | ||||
|      * @param deptIds 部门 ID 列表 | ||||
|      * @return 用户数量 | ||||
|      */ | ||||
|     Long countByDeptIds(List<Long> deptIds); | ||||
|   | ||||
| @@ -33,10 +33,8 @@ public interface UserSocialService { | ||||
|     /** | ||||
|      * 根据来源和开放 ID 查询 | ||||
|      *  | ||||
|      * @param source | ||||
|      *            来源 | ||||
|      * @param openId | ||||
|      *            开放 ID | ||||
|      * @param source 来源 | ||||
|      * @param openId 开放 ID | ||||
|      * @return 用户社会化关联信息 | ||||
|      */ | ||||
|     UserSocialDO getBySourceAndOpenId(String source, String openId); | ||||
| @@ -44,16 +42,14 @@ public interface UserSocialService { | ||||
|     /** | ||||
|      * 保存 | ||||
|      * | ||||
|      * @param userSocial | ||||
|      *            用户社会化关联信息 | ||||
|      * @param userSocial 用户社会化关联信息 | ||||
|      */ | ||||
|     void saveOrUpdate(UserSocialDO userSocial); | ||||
|  | ||||
|     /** | ||||
|      * 根据用户 ID 查询 | ||||
|      *  | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param userId 用户 ID | ||||
|      * @return 用户社会化关联信息 | ||||
|      */ | ||||
|     List<UserSocialDO> listByUserId(Long userId); | ||||
| @@ -61,20 +57,16 @@ public interface UserSocialService { | ||||
|     /** | ||||
|      * 绑定 | ||||
|      *  | ||||
|      * @param authUser | ||||
|      *            三方账号信息 | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param authUser 三方账号信息 | ||||
|      * @param userId   用户 ID | ||||
|      */ | ||||
|     void bind(AuthUser authUser, Long userId); | ||||
|  | ||||
|     /** | ||||
|      * 根据来源和用户 ID 删除 | ||||
|      *  | ||||
|      * @param source | ||||
|      *            来源 | ||||
|      * @param userId | ||||
|      *            用户 ID | ||||
|      * @param source 来源 | ||||
|      * @param userId 用户 ID | ||||
|      */ | ||||
|     void deleteBySourceAndUserId(String source, Long userId); | ||||
| } | ||||
| @@ -40,8 +40,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; | ||||
|  */ | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| public class AnnouncementServiceImpl extends BaseServiceImpl<AnnouncementMapper, AnnouncementDO, AnnouncementResp, | ||||
|     AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> implements AnnouncementService { | ||||
| public class AnnouncementServiceImpl extends BaseServiceImpl<AnnouncementMapper, AnnouncementDO, AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> implements AnnouncementService { | ||||
|  | ||||
|     @Override | ||||
|     public List<DashboardAnnouncementResp> listDashboard() { | ||||
|   | ||||
| @@ -54,8 +54,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; | ||||
|  */ | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptResp, DeptDetailResp, DeptQuery, DeptReq> | ||||
|     implements DeptService { | ||||
| public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptResp, DeptDetailResp, DeptQuery, DeptReq> implements DeptService { | ||||
|  | ||||
|     @Resource | ||||
|     private UserService userService; | ||||
| @@ -88,13 +87,14 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | ||||
|         // 启用/禁用部门 | ||||
|         if (ObjectUtil.notEqual(newStatus, oldDept.getStatus())) { | ||||
|             List<DeptDO> children = this.listChildren(id); | ||||
|             long enabledChildrenCount = | ||||
|                 children.stream().filter(d -> DisEnableStatusEnum.ENABLE.equals(d.getStatus())).count(); | ||||
|             CheckUtils.throwIf(DisEnableStatusEnum.DISABLE.equals(newStatus) && enabledChildrenCount > 0, | ||||
|                 "禁用 [{}] 前,请先禁用其所有下级部门", oldName); | ||||
|             long enabledChildrenCount = children.stream() | ||||
|                 .filter(d -> DisEnableStatusEnum.ENABLE.equals(d.getStatus())) | ||||
|                 .count(); | ||||
|             CheckUtils.throwIf(DisEnableStatusEnum.DISABLE | ||||
|                 .equals(newStatus) && enabledChildrenCount > 0, "禁用 [{}] 前,请先禁用其所有下级部门", oldName); | ||||
|             DeptDO oldParentDept = this.getByParentId(oldParentId); | ||||
|             CheckUtils.throwIf(DisEnableStatusEnum.ENABLE.equals(newStatus) | ||||
|                 && DisEnableStatusEnum.DISABLE.equals(oldParentDept.getStatus()), "启用 [{}] 前,请先启用其所有上级部门", oldName); | ||||
|             CheckUtils.throwIf(DisEnableStatusEnum.ENABLE.equals(newStatus) && DisEnableStatusEnum.DISABLE | ||||
|                 .equals(oldParentDept.getStatus()), "启用 [{}] 前,请先启用其所有上级部门", oldName); | ||||
|         } | ||||
|         // 变更上级部门 | ||||
|         if (ObjectUtil.notEqual(req.getParentId(), oldParentId)) { | ||||
| @@ -110,11 +110,13 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void delete(List<Long> ids) { | ||||
|         List<DeptDO> list = | ||||
|             baseMapper.lambdaQuery().select(DeptDO::getName, DeptDO::getIsSystem).in(DeptDO::getId, ids).list(); | ||||
|         List<DeptDO> list = baseMapper.lambdaQuery() | ||||
|             .select(DeptDO::getName, DeptDO::getIsSystem) | ||||
|             .in(DeptDO::getId, ids) | ||||
|             .list(); | ||||
|         Optional<DeptDO> isSystemData = list.stream().filter(DeptDO::getIsSystem).findFirst(); | ||||
|         CheckUtils.throwIf(isSystemData::isPresent, "所选部门 [{}] 是系统内置部门,不允许删除", | ||||
|             isSystemData.orElseGet(DeptDO::new).getName()); | ||||
|         CheckUtils.throwIf(isSystemData::isPresent, "所选部门 [{}] 是系统内置部门,不允许删除", isSystemData.orElseGet(DeptDO::new) | ||||
|             .getName()); | ||||
|         CheckUtils.throwIf(this.countChildren(ids) > 0, "所选部门存在下级部门,不允许删除"); | ||||
|         CheckUtils.throwIf(userService.countByDeptIds(ids) > 0, "所选部门存在用户关联,请解除关联后重试"); | ||||
|         // 删除角色和部门关联 | ||||
| @@ -137,24 +139,23 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | ||||
|     /** | ||||
|      * 名称是否存在 | ||||
|      * | ||||
|      * @param name | ||||
|      *            名称 | ||||
|      * @param parentId | ||||
|      *            上级 ID | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param name     名称 | ||||
|      * @param parentId 上级 ID | ||||
|      * @param id       ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isNameExists(String name, Long parentId, Long id) { | ||||
|         return baseMapper.lambdaQuery().eq(DeptDO::getName, name).eq(DeptDO::getParentId, parentId) | ||||
|             .ne(null != id, DeptDO::getId, id).exists(); | ||||
|         return baseMapper.lambdaQuery() | ||||
|             .eq(DeptDO::getName, name) | ||||
|             .eq(DeptDO::getParentId, parentId) | ||||
|             .ne(null != id, DeptDO::getId, id) | ||||
|             .exists(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取祖级列表 | ||||
|      * | ||||
|      * @param parentId | ||||
|      *            上级部门 | ||||
|      * @param parentId 上级部门 | ||||
|      * @return 祖级列表 | ||||
|      */ | ||||
|     private String getAncestors(Long parentId) { | ||||
| @@ -165,8 +166,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | ||||
|     /** | ||||
|      * 根据上级部门 ID 查询 | ||||
|      * | ||||
|      * @param parentId | ||||
|      *            上级部门 ID | ||||
|      * @param parentId 上级部门 ID | ||||
|      * @return 上级部门信息 | ||||
|      */ | ||||
|     private DeptDO getByParentId(Long parentId) { | ||||
| @@ -178,8 +178,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | ||||
|     /** | ||||
|      * 查询子部门列表 | ||||
|      * | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param id ID | ||||
|      * @return 子部门列表 | ||||
|      */ | ||||
|     private List<DeptDO> listChildren(Long id) { | ||||
| @@ -205,12 +204,9 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | ||||
|     /** | ||||
|      * 更新子部门祖级列表 | ||||
|      * | ||||
|      * @param newAncestors | ||||
|      *            新祖级列表 | ||||
|      * @param oldAncestors | ||||
|      *            原祖级列表 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param newAncestors 新祖级列表 | ||||
|      * @param oldAncestors 原祖级列表 | ||||
|      * @param id           ID | ||||
|      */ | ||||
|     private void updateChildrenAncestors(String newAncestors, String oldAncestors, Long id) { | ||||
|         List<DeptDO> children = this.listChildren(id); | ||||
|   | ||||
| @@ -46,9 +46,7 @@ import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| @CacheConfig(cacheNames = CacheConstants.DICT_KEY_PREFIX) | ||||
| public class DictItemServiceImpl | ||||
|     extends BaseServiceImpl<DictItemMapper, DictItemDO, DictItemResp, DictItemDetailResp, DictItemQuery, DictItemReq> | ||||
|     implements DictItemService { | ||||
| public class DictItemServiceImpl extends BaseServiceImpl<DictItemMapper, DictItemDO, DictItemResp, DictItemDetailResp, DictItemQuery, DictItemReq> implements DictItemService { | ||||
|  | ||||
|     @Override | ||||
|     @CacheEvict(allEntries = true) | ||||
| @@ -91,16 +89,16 @@ public class DictItemServiceImpl | ||||
|     /** | ||||
|      * 字典值是否存在 | ||||
|      * | ||||
|      * @param value | ||||
|      *            字典值 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param dictId | ||||
|      *            字典 ID | ||||
|      * @param value  字典值 | ||||
|      * @param id     ID | ||||
|      * @param dictId 字典 ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isValueExists(String value, Long id, Long dictId) { | ||||
|         return baseMapper.lambdaQuery().eq(DictItemDO::getValue, value).eq(DictItemDO::getDictId, dictId) | ||||
|             .ne(null != id, DictItemDO::getId, id).exists(); | ||||
|         return baseMapper.lambdaQuery() | ||||
|             .eq(DictItemDO::getValue, value) | ||||
|             .eq(DictItemDO::getDictId, dictId) | ||||
|             .ne(null != id, DictItemDO::getId, id) | ||||
|             .exists(); | ||||
|     } | ||||
| } | ||||
| @@ -49,8 +49,7 @@ import top.charles7c.continew.starter.file.excel.util.ExcelUtils; | ||||
|  */ | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictResp, DictDetailResp, DictQuery, DictReq> | ||||
|     implements DictService { | ||||
| public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictResp, DictDetailResp, DictQuery, DictReq> implements DictService { | ||||
|  | ||||
|     private final DictItemService dictItemService; | ||||
|  | ||||
| @@ -79,11 +78,13 @@ public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictRes | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void delete(List<Long> ids) { | ||||
|         List<DictDO> list = | ||||
|             baseMapper.lambdaQuery().select(DictDO::getName, DictDO::getIsSystem).in(DictDO::getId, ids).list(); | ||||
|         List<DictDO> list = baseMapper.lambdaQuery() | ||||
|             .select(DictDO::getName, DictDO::getIsSystem) | ||||
|             .in(DictDO::getId, ids) | ||||
|             .list(); | ||||
|         Optional<DictDO> isSystemData = list.stream().filter(DictDO::getIsSystem).findFirst(); | ||||
|         CheckUtils.throwIf(isSystemData::isPresent, "所选字典 [{}] 是系统内置字典,不允许删除", | ||||
|             isSystemData.orElseGet(DictDO::new).getName()); | ||||
|         CheckUtils.throwIf(isSystemData::isPresent, "所选字典 [{}] 是系统内置字典,不允许删除", isSystemData.orElseGet(DictDO::new) | ||||
|             .getName()); | ||||
|         dictItemService.deleteByDictIds(ids); | ||||
|         super.delete(ids); | ||||
|     } | ||||
| @@ -106,10 +107,8 @@ public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictRes | ||||
|     /** | ||||
|      * 名称是否存在 | ||||
|      * | ||||
|      * @param name | ||||
|      *            名称 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param name 名称 | ||||
|      * @param id   ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isNameExists(String name, Long id) { | ||||
| @@ -119,10 +118,8 @@ public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictRes | ||||
|     /** | ||||
|      * 编码是否存在 | ||||
|      * | ||||
|      * @param code | ||||
|      *            编码 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param code 编码 | ||||
|      * @param id   ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isCodeExists(String code, Long id) { | ||||
|   | ||||
| @@ -56,8 +56,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; | ||||
| @Slf4j | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileResp, FileResp, FileQuery, FileReq> | ||||
|     implements FileService { | ||||
| public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileResp, FileResp, FileQuery, FileReq> implements FileService { | ||||
|  | ||||
|     @Resource | ||||
|     private StorageService storageService; | ||||
| @@ -107,7 +106,8 @@ public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileRes | ||||
|         // 处理本地存储文件 URL | ||||
|         FileInfo fileInfo = uploadPretreatment.upload(); | ||||
|         fileInfo.setUrl(StorageTypeEnum.LOCAL.equals(storage.getType()) | ||||
|             ? URLUtil.normalize(storage.getDomain() + StringConstants.SLASH + fileInfo.getUrl()) : fileInfo.getUrl()); | ||||
|             ? URLUtil.normalize(storage.getDomain() + StringConstants.SLASH + fileInfo.getUrl()) | ||||
|             : fileInfo.getUrl()); | ||||
|         return fileInfo; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -48,8 +48,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| @CacheConfig(cacheNames = CacheConstants.MENU_KEY_PREFIX) | ||||
| public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuResp, MenuResp, MenuQuery, MenuReq> | ||||
|     implements MenuService { | ||||
| public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuResp, MenuResp, MenuQuery, MenuReq> implements MenuService { | ||||
|  | ||||
|     @Override | ||||
|     @CacheEvict(allEntries = true) | ||||
| @@ -101,16 +100,16 @@ public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuRes | ||||
|     /** | ||||
|      * 名称是否存在 | ||||
|      * | ||||
|      * @param name | ||||
|      *            名称 | ||||
|      * @param parentId | ||||
|      *            上级 ID | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param name     名称 | ||||
|      * @param parentId 上级 ID | ||||
|      * @param id       ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isNameExists(String name, Long parentId, Long id) { | ||||
|         return baseMapper.lambdaQuery().eq(MenuDO::getTitle, name).eq(MenuDO::getParentId, parentId) | ||||
|             .ne(null != id, MenuDO::getId, id).exists(); | ||||
|         return baseMapper.lambdaQuery() | ||||
|             .eq(MenuDO::getTitle, name) | ||||
|             .eq(MenuDO::getParentId, parentId) | ||||
|             .ne(null != id, MenuDO::getId, id) | ||||
|             .exists(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -86,8 +86,7 @@ public class MessageServiceImpl implements MessageService { | ||||
|     /** | ||||
|      * 填充数据 | ||||
|      * | ||||
|      * @param message | ||||
|      *            待填充信息 | ||||
|      * @param message 待填充信息 | ||||
|      */ | ||||
|     private void fill(MessageResp message) { | ||||
|         Long createUser = message.getCreateUser(); | ||||
|   | ||||
| @@ -84,9 +84,12 @@ public class MessageUserServiceImpl implements MessageUserService { | ||||
|  | ||||
|     @Override | ||||
|     public void readMessage(List<Long> ids) { | ||||
|         baseMapper.lambdaUpdate().set(MessageUserDO::getIsRead, true) | ||||
|             .set(MessageUserDO::getReadTime, LocalDateTime.now()).eq(MessageUserDO::getIsRead, false) | ||||
|             .in(CollUtil.isNotEmpty(ids), MessageUserDO::getMessageId, ids).update(); | ||||
|         baseMapper.lambdaUpdate() | ||||
|             .set(MessageUserDO::getIsRead, true) | ||||
|             .set(MessageUserDO::getReadTime, LocalDateTime.now()) | ||||
|             .eq(MessageUserDO::getIsRead, false) | ||||
|             .in(CollUtil.isNotEmpty(ids), MessageUserDO::getMessageId, ids) | ||||
|             .update(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -46,16 +46,22 @@ public class RoleDeptServiceImpl implements RoleDeptService { | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public boolean add(List<Long> deptIds, Long roleId) { | ||||
|         // 检查是否有变更 | ||||
|         List<Long> oldDeptIdList = roleDeptMapper.lambdaQuery().select(RoleDeptDO::getDeptId) | ||||
|             .eq(RoleDeptDO::getRoleId, roleId).list().stream().map(RoleDeptDO::getDeptId).collect(Collectors.toList()); | ||||
|         List<Long> oldDeptIdList = roleDeptMapper.lambdaQuery() | ||||
|             .select(RoleDeptDO::getDeptId) | ||||
|             .eq(RoleDeptDO::getRoleId, roleId) | ||||
|             .list() | ||||
|             .stream() | ||||
|             .map(RoleDeptDO::getDeptId) | ||||
|             .collect(Collectors.toList()); | ||||
|         if (CollUtil.isEmpty(CollUtil.disjunction(deptIds, oldDeptIdList))) { | ||||
|             return false; | ||||
|         } | ||||
|         // 删除原有关联 | ||||
|         roleDeptMapper.lambdaUpdate().eq(RoleDeptDO::getRoleId, roleId).remove(); | ||||
|         // 保存最新关联 | ||||
|         List<RoleDeptDO> roleDeptList = | ||||
|             deptIds.stream().map(deptId -> new RoleDeptDO(roleId, deptId)).collect(Collectors.toList()); | ||||
|         List<RoleDeptDO> roleDeptList = deptIds.stream() | ||||
|             .map(deptId -> new RoleDeptDO(roleId, deptId)) | ||||
|             .collect(Collectors.toList()); | ||||
|         return roleDeptMapper.insertBatch(roleDeptList); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -47,16 +47,22 @@ public class RoleMenuServiceImpl implements RoleMenuService { | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public boolean add(List<Long> menuIds, Long roleId) { | ||||
|         // 检查是否有变更 | ||||
|         List<Long> oldMenuIdList = roleMenuMapper.lambdaQuery().select(RoleMenuDO::getMenuId) | ||||
|             .eq(RoleMenuDO::getRoleId, roleId).list().stream().map(RoleMenuDO::getMenuId).collect(Collectors.toList()); | ||||
|         List<Long> oldMenuIdList = roleMenuMapper.lambdaQuery() | ||||
|             .select(RoleMenuDO::getMenuId) | ||||
|             .eq(RoleMenuDO::getRoleId, roleId) | ||||
|             .list() | ||||
|             .stream() | ||||
|             .map(RoleMenuDO::getMenuId) | ||||
|             .collect(Collectors.toList()); | ||||
|         if (CollUtil.isEmpty(CollUtil.disjunction(menuIds, oldMenuIdList))) { | ||||
|             return false; | ||||
|         } | ||||
|         // 删除原有关联 | ||||
|         roleMenuMapper.lambdaUpdate().eq(RoleMenuDO::getRoleId, roleId).remove(); | ||||
|         // 保存最新关联 | ||||
|         List<RoleMenuDO> roleMenuList = | ||||
|             menuIds.stream().map(menuId -> new RoleMenuDO(roleId, menuId)).collect(Collectors.toList()); | ||||
|         List<RoleMenuDO> roleMenuList = menuIds.stream() | ||||
|             .map(menuId -> new RoleMenuDO(roleId, menuId)) | ||||
|             .collect(Collectors.toList()); | ||||
|         return roleMenuMapper.insertBatch(roleMenuList); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -55,8 +55,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; | ||||
|  */ | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleResp, RoleDetailResp, RoleQuery, RoleReq> | ||||
|     implements RoleService { | ||||
| public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleResp, RoleDetailResp, RoleQuery, RoleReq> implements RoleService { | ||||
|  | ||||
|     private final MenuService menuService; | ||||
|     private final OnlineUserService onlineUserService; | ||||
| @@ -93,8 +92,8 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes | ||||
|         DataScopeEnum oldDataScope = oldRole.getDataScope(); | ||||
|         String oldCode = oldRole.getCode(); | ||||
|         if (Boolean.TRUE.equals(oldRole.getIsSystem())) { | ||||
|             CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, req.getStatus(), "[{}] 是系统内置角色,不允许禁用", | ||||
|                 oldRole.getName()); | ||||
|             CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, req.getStatus(), "[{}] 是系统内置角色,不允许禁用", oldRole | ||||
|                 .getName()); | ||||
|             CheckUtils.throwIfNotEqual(req.getCode(), oldCode, "[{}] 是系统内置角色,不允许修改角色编码", oldRole.getName()); | ||||
|             CheckUtils.throwIfNotEqual(req.getDataScope(), oldDataScope, "[{}] 是系统内置角色,不允许修改角色数据权限", oldRole.getName()); | ||||
|         } | ||||
| @@ -107,8 +106,8 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes | ||||
|             // 保存角色和部门关联 | ||||
|             boolean isSaveDeptSuccess = roleDeptService.add(req.getDeptIds(), id); | ||||
|             // 如果角色编码、功能权限或数据权限有变更,则清除关联的在线用户(重新登录以获取最新角色权限) | ||||
|             if (ObjectUtil.notEqual(req.getCode(), oldCode) || ObjectUtil.notEqual(req.getDataScope(), oldDataScope) | ||||
|                 || isSaveMenuSuccess || isSaveDeptSuccess) { | ||||
|             if (ObjectUtil.notEqual(req.getCode(), oldCode) || ObjectUtil.notEqual(req | ||||
|                 .getDataScope(), oldDataScope) || isSaveMenuSuccess || isSaveDeptSuccess) { | ||||
|                 onlineUserService.cleanByRoleId(id); | ||||
|             } | ||||
|         } | ||||
| @@ -117,11 +116,13 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void delete(List<Long> ids) { | ||||
|         List<RoleDO> list = | ||||
|             baseMapper.lambdaQuery().select(RoleDO::getName, RoleDO::getIsSystem).in(RoleDO::getId, ids).list(); | ||||
|         List<RoleDO> list = baseMapper.lambdaQuery() | ||||
|             .select(RoleDO::getName, RoleDO::getIsSystem) | ||||
|             .in(RoleDO::getId, ids) | ||||
|             .list(); | ||||
|         Optional<RoleDO> isSystemData = list.stream().filter(RoleDO::getIsSystem).findFirst(); | ||||
|         CheckUtils.throwIf(isSystemData::isPresent, "所选角色 [{}] 是系统内置角色,不允许删除", | ||||
|             isSystemData.orElseGet(RoleDO::new).getName()); | ||||
|         CheckUtils.throwIf(isSystemData::isPresent, "所选角色 [{}] 是系统内置角色,不允许删除", isSystemData.orElseGet(RoleDO::new) | ||||
|             .getName()); | ||||
|         CheckUtils.throwIf(userRoleService.countByRoleIds(ids) > 0, "所选角色存在用户关联,请解除关联后重试"); | ||||
|         // 删除角色和菜单关联 | ||||
|         roleMenuService.deleteByRoleIds(ids); | ||||
| @@ -183,10 +184,8 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes | ||||
|     /** | ||||
|      * 名称是否存在 | ||||
|      * | ||||
|      * @param name | ||||
|      *            名称 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param name 名称 | ||||
|      * @param id   ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isNameExists(String name, Long id) { | ||||
| @@ -196,10 +195,8 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes | ||||
|     /** | ||||
|      * 编码是否存在 | ||||
|      * | ||||
|      * @param code | ||||
|      *            编码 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param code 编码 | ||||
|      * @param id   ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isCodeExists(String code, Long id) { | ||||
|   | ||||
| @@ -60,9 +60,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; | ||||
|  */ | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| public class StorageServiceImpl | ||||
|     extends BaseServiceImpl<StorageMapper, StorageDO, StorageResp, StorageDetailResp, StorageQuery, StorageReq> | ||||
|     implements StorageService { | ||||
| public class StorageServiceImpl extends BaseServiceImpl<StorageMapper, StorageDO, StorageResp, StorageDetailResp, StorageQuery, StorageReq> implements StorageService { | ||||
|  | ||||
|     @Resource | ||||
|     private FileService fileService; | ||||
| @@ -84,9 +82,8 @@ public class StorageServiceImpl | ||||
|         CheckUtils.throwIf(this.isCodeExists(code, id), "修改失败,[{}] 已存在", code); | ||||
|         DisEnableStatusEnum newStatus = req.getStatus(); | ||||
|         StorageDO oldStorage = super.getById(id); | ||||
|         CheckUtils.throwIf( | ||||
|             Boolean.TRUE.equals(oldStorage.getIsDefault()) && DisEnableStatusEnum.DISABLE.equals(newStatus), | ||||
|             "[{}] 是默认存储库,不允许禁用", oldStorage.getName()); | ||||
|         CheckUtils.throwIf(Boolean.TRUE.equals(oldStorage.getIsDefault()) && DisEnableStatusEnum.DISABLE | ||||
|             .equals(newStatus), "[{}] 是默认存储库,不允许禁用", oldStorage.getName()); | ||||
|         DisEnableStatusEnum oldStatus = oldStorage.getStatus(); | ||||
|         if (DisEnableStatusEnum.ENABLE.equals(oldStatus) || DisEnableStatusEnum.DISABLE.equals(newStatus)) { | ||||
|             this.unload(BeanUtil.copyProperties(oldStorage, StorageReq.class)); | ||||
| @@ -133,13 +130,13 @@ public class StorageServiceImpl | ||||
|                 ValidationUtils.throwIfBlank(bucketName, "存储路径不能为空"); | ||||
|                 ValidationUtils.throwIfBlank(domain, "自定义域名不能为空"); | ||||
|                 ValidationUtils.throwIf(!URLUtils.isHttpUrl(domain), "自定义域名格式错误"); | ||||
|                 req.setBucketName(StrUtil.appendIfMissing( | ||||
|                     bucketName.replace(StringConstants.BACKSLASH, StringConstants.SLASH), StringConstants.SLASH)); | ||||
|                 req.setBucketName(StrUtil.appendIfMissing(bucketName | ||||
|                     .replace(StringConstants.BACKSLASH, StringConstants.SLASH), StringConstants.SLASH)); | ||||
|                 FileStorageProperties.LocalPlusConfig config = new FileStorageProperties.LocalPlusConfig(); | ||||
|                 config.setPlatform(req.getCode()); | ||||
|                 config.setStoragePath(bucketName); | ||||
|                 fileStorageList | ||||
|                     .addAll(FileStorageServiceBuilder.buildLocalPlusFileStorage(Collections.singletonList(config))); | ||||
|                 fileStorageList.addAll(FileStorageServiceBuilder.buildLocalPlusFileStorage(Collections | ||||
|                     .singletonList(config))); | ||||
|                 SpringUtils.registerResourceHandler(MapUtil.of(URLUtil.url(req.getDomain()).getPath(), bucketName)); | ||||
|             } | ||||
|             case S3 -> { | ||||
| @@ -157,8 +154,8 @@ public class StorageServiceImpl | ||||
|                 config.setEndPoint(endpoint); | ||||
|                 config.setBucketName(bucketName); | ||||
|                 config.setDomain(domain); | ||||
|                 fileStorageList.addAll( | ||||
|                     FileStorageServiceBuilder.buildAmazonS3FileStorage(Collections.singletonList(config), null)); | ||||
|                 fileStorageList.addAll(FileStorageServiceBuilder.buildAmazonS3FileStorage(Collections | ||||
|                     .singletonList(config), null)); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| @@ -175,22 +172,21 @@ public class StorageServiceImpl | ||||
|     /** | ||||
|      * 默认存储库是否存在 | ||||
|      * | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param id ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isDefaultExists(Long id) { | ||||
|         return baseMapper.lambdaQuery().eq(StorageDO::getIsDefault, Boolean.TRUE).ne(null != id, StorageDO::getId, id) | ||||
|         return baseMapper.lambdaQuery() | ||||
|             .eq(StorageDO::getIsDefault, Boolean.TRUE) | ||||
|             .ne(null != id, StorageDO::getId, id) | ||||
|             .exists(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 编码是否存在 | ||||
|      * | ||||
|      * @param code | ||||
|      *            编码 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param code 编码 | ||||
|      * @param id   ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isCodeExists(String code, Long id) { | ||||
|   | ||||
| @@ -46,16 +46,22 @@ public class UserRoleServiceImpl implements UserRoleService { | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public boolean add(List<Long> roleIds, Long userId) { | ||||
|         // 检查是否有变更 | ||||
|         List<Long> oldRoleIdList = userRoleMapper.lambdaQuery().select(UserRoleDO::getRoleId) | ||||
|             .eq(UserRoleDO::getUserId, userId).list().stream().map(UserRoleDO::getRoleId).collect(Collectors.toList()); | ||||
|         List<Long> oldRoleIdList = userRoleMapper.lambdaQuery() | ||||
|             .select(UserRoleDO::getRoleId) | ||||
|             .eq(UserRoleDO::getUserId, userId) | ||||
|             .list() | ||||
|             .stream() | ||||
|             .map(UserRoleDO::getRoleId) | ||||
|             .collect(Collectors.toList()); | ||||
|         if (CollUtil.isEmpty(CollUtil.disjunction(roleIds, oldRoleIdList))) { | ||||
|             return false; | ||||
|         } | ||||
|         // 删除原有关联 | ||||
|         userRoleMapper.lambdaUpdate().eq(UserRoleDO::getUserId, userId).remove(); | ||||
|         // 保存最新关联 | ||||
|         List<UserRoleDO> userRoleList = | ||||
|             roleIds.stream().map(roleId -> new UserRoleDO(userId, roleId)).collect(Collectors.toList()); | ||||
|         List<UserRoleDO> userRoleList = roleIds.stream() | ||||
|             .map(roleId -> new UserRoleDO(userId, roleId)) | ||||
|             .collect(Collectors.toList()); | ||||
|         return userRoleMapper.insertBatch(userRoleList); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -66,8 +66,7 @@ import top.charles7c.continew.starter.extension.crud.base.CommonUserService; | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| @CacheConfig(cacheNames = CacheConstants.USER_KEY_PREFIX) | ||||
| public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserResp, UserDetailResp, UserQuery, UserReq> | ||||
|     implements UserService, CommonUserService { | ||||
| public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserResp, UserDetailResp, UserQuery, UserReq> implements UserService, CommonUserService { | ||||
|  | ||||
|     @Resource | ||||
|     private DeptService deptService; | ||||
| @@ -97,7 +96,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|         Long userId = super.add(req); | ||||
|         baseMapper.lambdaUpdate() | ||||
|             .set(UserDO::getPassword, SecureUtils.md5Salt(SysConstants.DEFAULT_PASSWORD, userId.toString())) | ||||
|             .set(UserDO::getPwdResetTime, LocalDateTime.now()).eq(UserDO::getId, userId).update(); | ||||
|             .set(UserDO::getPwdResetTime, LocalDateTime.now()) | ||||
|             .eq(UserDO::getId, userId) | ||||
|             .update(); | ||||
|         // 保存用户和角色关联 | ||||
|         userRoleService.add(req.getRoleIds(), userId); | ||||
|         return userId; | ||||
| @@ -113,15 +114,14 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|         String phone = req.getPhone(); | ||||
|         CheckUtils.throwIf(StrUtil.isNotBlank(phone) && this.isPhoneExists(phone, id), "修改失败,[{}] 已存在", phone); | ||||
|         DisEnableStatusEnum newStatus = req.getStatus(); | ||||
|         CheckUtils.throwIf( | ||||
|             DisEnableStatusEnum.DISABLE.equals(newStatus) && ObjectUtil.equal(id, LoginHelper.getUserId()), | ||||
|             "不允许禁用当前用户"); | ||||
|         CheckUtils.throwIf(DisEnableStatusEnum.DISABLE.equals(newStatus) && ObjectUtil.equal(id, LoginHelper | ||||
|             .getUserId()), "不允许禁用当前用户"); | ||||
|         UserDO oldUser = super.getById(id); | ||||
|         if (oldUser.getIsSystem()) { | ||||
|             CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, newStatus, "[{}] 是系统内置用户,不允许禁用", | ||||
|                 oldUser.getNickname()); | ||||
|             Collection<Long> disjunctionRoleIds = | ||||
|                 CollUtil.disjunction(req.getRoleIds(), userRoleService.listRoleIdByUserId(id)); | ||||
|             CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, newStatus, "[{}] 是系统内置用户,不允许禁用", oldUser | ||||
|                 .getNickname()); | ||||
|             Collection<Long> disjunctionRoleIds = CollUtil.disjunction(req.getRoleIds(), userRoleService | ||||
|                 .listRoleIdByUserId(id)); | ||||
|             CheckUtils.throwIfNotEmpty(disjunctionRoleIds, "[{}] 是系统内置用户,不允许变更所属角色", oldUser.getNickname()); | ||||
|         } | ||||
|         // 更新信息 | ||||
| @@ -134,11 +134,13 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void delete(List<Long> ids) { | ||||
|         CheckUtils.throwIf(CollUtil.contains(ids, LoginHelper.getUserId()), "不允许删除当前用户"); | ||||
|         List<UserDO> list = | ||||
|             baseMapper.lambdaQuery().select(UserDO::getNickname, UserDO::getIsSystem).in(UserDO::getId, ids).list(); | ||||
|         List<UserDO> list = baseMapper.lambdaQuery() | ||||
|             .select(UserDO::getNickname, UserDO::getIsSystem) | ||||
|             .in(UserDO::getId, ids) | ||||
|             .list(); | ||||
|         Optional<UserDO> isSystemData = list.stream().filter(UserDO::getIsSystem).findFirst(); | ||||
|         CheckUtils.throwIf(isSystemData::isPresent, "所选用户 [{}] 是系统内置用户,不允许删除", | ||||
|             isSystemData.orElseGet(UserDO::new).getNickname()); | ||||
|         CheckUtils.throwIf(isSystemData::isPresent, "所选用户 [{}] 是系统内置用户,不允许删除", isSystemData.orElseGet(UserDO::new) | ||||
|             .getNickname()); | ||||
|         // 删除用户和角色关联 | ||||
|         userRoleService.deleteByUserIds(ids); | ||||
|         // 删除用户 | ||||
| @@ -161,8 +163,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|     public String uploadAvatar(MultipartFile avatarFile, Long id) { | ||||
|         String avatarImageType = FileNameUtil.extName(avatarFile.getOriginalFilename()); | ||||
|         String[] avatarSupportImgTypes = FileConstants.AVATAR_SUPPORTED_IMG_TYPES; | ||||
|         CheckUtils.throwIf(!StrUtil.equalsAnyIgnoreCase(avatarImageType, avatarSupportImgTypes), "头像仅支持 {} 格式的图片", | ||||
|             String.join(StringConstants.CHINESE_COMMA, avatarSupportImgTypes)); | ||||
|         CheckUtils.throwIf(!StrUtil | ||||
|             .equalsAnyIgnoreCase(avatarImageType, avatarSupportImgTypes), "头像仅支持 {} 格式的图片", String | ||||
|                 .join(StringConstants.CHINESE_COMMA, avatarSupportImgTypes)); | ||||
|         // 上传新头像 | ||||
|         UserDO user = super.getById(id); | ||||
|         FileInfo fileInfo = fileService.upload(avatarFile); | ||||
| @@ -180,8 +183,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|     @Override | ||||
|     public void updateBasicInfo(UserBasicInfoUpdateReq updateReq, Long id) { | ||||
|         super.getById(id); | ||||
|         baseMapper.lambdaUpdate().set(UserDO::getNickname, updateReq.getNickname()) | ||||
|             .set(UserDO::getGender, updateReq.getGender()).eq(UserDO::getId, id).update(); | ||||
|         baseMapper.lambdaUpdate() | ||||
|             .set(UserDO::getNickname, updateReq.getNickname()) | ||||
|             .set(UserDO::getGender, updateReq.getGender()) | ||||
|             .eq(UserDO::getId, id) | ||||
|             .update(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -194,8 +200,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|         } | ||||
|         // 更新密码和密码重置时间 | ||||
|         LocalDateTime now = LocalDateTime.now(); | ||||
|         baseMapper.lambdaUpdate().set(UserDO::getPassword, SecureUtils.md5Salt(newPassword, id.toString())) | ||||
|             .set(UserDO::getPwdResetTime, now).eq(UserDO::getId, id).update(); | ||||
|         baseMapper.lambdaUpdate() | ||||
|             .set(UserDO::getPassword, SecureUtils.md5Salt(newPassword, id.toString())) | ||||
|             .set(UserDO::getPwdResetTime, now) | ||||
|             .eq(UserDO::getId, id) | ||||
|             .update(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -265,10 +274,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|     /** | ||||
|      * 名称是否存在 | ||||
|      * | ||||
|      * @param name | ||||
|      *            名称 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param name 名称 | ||||
|      * @param id   ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isNameExists(String name, Long id) { | ||||
| @@ -278,10 +285,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|     /** | ||||
|      * 邮箱是否存在 | ||||
|      * | ||||
|      * @param email | ||||
|      *            邮箱 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param email 邮箱 | ||||
|      * @param id    ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isEmailExists(String email, Long id) { | ||||
| @@ -291,10 +296,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|     /** | ||||
|      * 手机号码是否存在 | ||||
|      * | ||||
|      * @param phone | ||||
|      *            手机号码 | ||||
|      * @param id | ||||
|      *            ID | ||||
|      * @param phone 手机号码 | ||||
|      * @param id    ID | ||||
|      * @return 是否存在 | ||||
|      */ | ||||
|     private boolean isPhoneExists(String phone, Long id) { | ||||
|   | ||||
| @@ -57,9 +57,11 @@ public class UserSocialServiceImpl implements UserSocialService { | ||||
|         if (null == userSocial.getCreateTime()) { | ||||
|             baseMapper.insert(userSocial); | ||||
|         } else { | ||||
|             baseMapper.lambdaUpdate().set(UserSocialDO::getMetaJson, userSocial.getMetaJson()) | ||||
|             baseMapper.lambdaUpdate() | ||||
|                 .set(UserSocialDO::getMetaJson, userSocial.getMetaJson()) | ||||
|                 .set(UserSocialDO::getLastLoginTime, userSocial.getLastLoginTime()) | ||||
|                 .eq(UserSocialDO::getSource, userSocial.getSource()).eq(UserSocialDO::getOpenId, userSocial.getOpenId()) | ||||
|                 .eq(UserSocialDO::getSource, userSocial.getSource()) | ||||
|                 .eq(UserSocialDO::getOpenId, userSocial.getOpenId()) | ||||
|                 .update(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -35,8 +35,7 @@ public interface FieldConfigMapper extends BaseMapper<FieldConfigDO> { | ||||
|     /** | ||||
|      * 根据表名称查询 | ||||
|      *  | ||||
|      * @param tableName | ||||
|      *            表名称 | ||||
|      * @param tableName 表名称 | ||||
|      * @return 字段配置信息 | ||||
|      */ | ||||
|     @Select("SELECT * FROM `gen_field_config` WHERE `table_name` = #{tableName}") | ||||
|   | ||||
| @@ -136,8 +136,8 @@ public class FieldConfigDO implements Serializable { | ||||
|     /** | ||||
|      * 查询方式 | ||||
|      */ | ||||
|     @Schema(description = "查询方式", type = "Integer", | ||||
|         allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"}, example = "1") | ||||
|     @Schema(description = "查询方式", type = "Integer", allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9", | ||||
|         "10", "11", "12", "13", "14"}, example = "1") | ||||
|     private QueryTypeEnum queryType; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -144,7 +144,8 @@ public class GenConfigDO implements Serializable { | ||||
|  | ||||
|     public String getClassNamePrefix() { | ||||
|         String rawClassName = StrUtil.isNotBlank(this.tablePrefix) | ||||
|             ? StrUtil.removePrefix(this.tableName, this.tablePrefix) : this.tableName; | ||||
|             ? StrUtil.removePrefix(this.tableName, this.tablePrefix) | ||||
|             : this.tableName; | ||||
|         return StrUtil.upperFirst(StrUtil.toCamelCase(rawClassName)); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -39,34 +39,27 @@ public interface GeneratorService { | ||||
|     /** | ||||
|      * 分页查询表信息列表 | ||||
|      * | ||||
|      * @param query | ||||
|      *            查询条件 | ||||
|      * @param pageQuery | ||||
|      *            分页查询条件 | ||||
|      * @param query     查询条件 | ||||
|      * @param pageQuery 分页查询条件 | ||||
|      * @return 表信息分页列表 | ||||
|      * @throws SQLException | ||||
|      *             / | ||||
|      * @throws SQLException / | ||||
|      */ | ||||
|     PageResp<TableResp> pageTable(TableQuery query, PageQuery pageQuery) throws SQLException; | ||||
|  | ||||
|     /** | ||||
|      * 查询生成配置信息 | ||||
|      * | ||||
|      * @param tableName | ||||
|      *            表名称 | ||||
|      * @param tableName 表名称 | ||||
|      * @return 生成配置信息 | ||||
|      * @throws SQLException | ||||
|      *             / | ||||
|      * @throws SQLException / | ||||
|      */ | ||||
|     GenConfigDO getGenConfig(String tableName) throws SQLException; | ||||
|  | ||||
|     /** | ||||
|      * 查询字段配置列表 | ||||
|      * | ||||
|      * @param tableName | ||||
|      *            表名称 | ||||
|      * @param requireSync | ||||
|      *            是否需要同步 | ||||
|      * @param tableName   表名称 | ||||
|      * @param requireSync 是否需要同步 | ||||
|      * @return 字段配置列表 | ||||
|      */ | ||||
|     List<FieldConfigDO> listFieldConfig(String tableName, Boolean requireSync); | ||||
| @@ -74,18 +67,15 @@ public interface GeneratorService { | ||||
|     /** | ||||
|      * 保存代码生成配置信息 | ||||
|      * | ||||
|      * @param req | ||||
|      *            代码生成配置信息 | ||||
|      * @param tableName | ||||
|      *            表名称 | ||||
|      * @param req       代码生成配置信息 | ||||
|      * @param tableName 表名称 | ||||
|      */ | ||||
|     void saveConfig(GenConfigReq req, String tableName); | ||||
|  | ||||
|     /** | ||||
|      * 生成预览 | ||||
|      * | ||||
|      * @param tableName | ||||
|      *            表名称 | ||||
|      * @param tableName 表名称 | ||||
|      * @return 预览信息 | ||||
|      */ | ||||
|     List<GeneratePreviewResp> preview(String tableName); | ||||
| @@ -93,8 +83,7 @@ public interface GeneratorService { | ||||
|     /** | ||||
|      * 生成代码 | ||||
|      * | ||||
|      * @param tableName | ||||
|      *            表名称 | ||||
|      * @param tableName 表名称 | ||||
|      */ | ||||
|     void generate(String tableName); | ||||
| } | ||||
|   | ||||
| @@ -86,17 +86,16 @@ public class GeneratorServiceImpl implements GeneratorService { | ||||
|         if (StrUtil.isNotBlank(tableName)) { | ||||
|             tableList.removeIf(table -> !StrUtil.containsAny(table.getTableName(), tableName)); | ||||
|         } | ||||
|         tableList.removeIf( | ||||
|             table -> StrUtil.equalsAnyIgnoreCase(table.getTableName(), generatorProperties.getExcludeTables())); | ||||
|         CollUtil.sort(tableList, | ||||
|             Comparator.comparing(Table::getCreateTime) | ||||
|                 .thenComparing(table -> Optional.ofNullable(table.getUpdateTime()).orElse(table.getCreateTime())) | ||||
|                 .reversed()); | ||||
|         tableList.removeIf(table -> StrUtil.equalsAnyIgnoreCase(table.getTableName(), generatorProperties | ||||
|             .getExcludeTables())); | ||||
|         CollUtil.sort(tableList, Comparator.comparing(Table::getCreateTime) | ||||
|             .thenComparing(table -> Optional.ofNullable(table.getUpdateTime()).orElse(table.getCreateTime())) | ||||
|             .reversed()); | ||||
|         List<TableResp> tableRespList = BeanUtil.copyToList(tableList, TableResp.class); | ||||
|         PageResp<TableResp> pageResp = PageResp.build(pageQuery.getPage(), pageQuery.getSize(), tableRespList); | ||||
|         for (TableResp tableResp : pageResp.getList()) { | ||||
|             long count = genConfigMapper.selectCount( | ||||
|                 Wrappers.lambdaQuery(GenConfigDO.class).eq(GenConfigDO::getTableName, tableResp.getTableName())); | ||||
|             long count = genConfigMapper.selectCount(Wrappers.lambdaQuery(GenConfigDO.class) | ||||
|                 .eq(GenConfigDO::getTableName, tableResp.getTableName())); | ||||
|             tableResp.setIsConfiged(count > 0); | ||||
|         } | ||||
|         return pageResp; | ||||
| @@ -117,8 +116,9 @@ public class GeneratorServiceImpl implements GeneratorService { | ||||
|                 genConfig.setBusinessName(StrUtil.replace(table.getComment(), "表", StringConstants.EMPTY)); | ||||
|             } | ||||
|             // 默认作者名称(上次保存使用的作者名称) | ||||
|             GenConfigDO lastGenConfig = genConfigMapper.selectOne( | ||||
|                 Wrappers.lambdaQuery(GenConfigDO.class).orderByDesc(GenConfigDO::getCreateTime).last("LIMIT 1")); | ||||
|             GenConfigDO lastGenConfig = genConfigMapper.selectOne(Wrappers.lambdaQuery(GenConfigDO.class) | ||||
|                 .orderByDesc(GenConfigDO::getCreateTime) | ||||
|                 .last("LIMIT 1")); | ||||
|             if (null != lastGenConfig) { | ||||
|                 genConfig.setAuthor(lastGenConfig.getAuthor()); | ||||
|             } | ||||
| @@ -151,8 +151,8 @@ public class GeneratorServiceImpl implements GeneratorService { | ||||
|                 FieldConfigDO fieldConfig = fieldConfigMap.get(column.getName()); | ||||
|                 if (null != fieldConfig) { | ||||
|                     // 更新已有字段配置 | ||||
|                     String columnType = | ||||
|                         StrUtil.splitToArray(column.getTypeName(), StringConstants.SPACE)[0].toLowerCase(); | ||||
|                     String columnType = StrUtil.splitToArray(column.getTypeName(), StringConstants.SPACE)[0] | ||||
|                         .toLowerCase(); | ||||
|                     fieldConfig.setColumnType(columnType); | ||||
|                     fieldConfig.setColumnSize(column.getSize()); | ||||
|                     fieldConfig.setComment(column.getComment()); | ||||
| @@ -219,8 +219,8 @@ public class GeneratorServiceImpl implements GeneratorService { | ||||
|         Map<String, Object> genConfigMap = BeanUtil.beanToMap(genConfig); | ||||
|         genConfigMap.put("date", DateUtil.date().toString("yyyy/MM/dd HH:mm")); | ||||
|         String packageName = genConfig.getPackageName(); | ||||
|         String apiModuleName = | ||||
|             StrUtil.subSuf(packageName, StrUtil.lastIndexOfIgnoreCase(packageName, StringConstants.DOT) + 1); | ||||
|         String apiModuleName = StrUtil.subSuf(packageName, StrUtil | ||||
|             .lastIndexOfIgnoreCase(packageName, StringConstants.DOT) + 1); | ||||
|         genConfigMap.put("apiModuleName", apiModuleName); | ||||
|         genConfigMap.put("apiName", StrUtil.lowerFirst(genConfig.getClassNamePrefix())); | ||||
|         // 渲染后端代码 | ||||
| @@ -274,19 +274,20 @@ public class GeneratorServiceImpl implements GeneratorService { | ||||
|             // 例如:D:/continew-admin/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool | ||||
|             List<String> backendModuleChildPathList = CollUtil.newArrayList("src", "main", "java"); | ||||
|             backendModuleChildPathList.addAll(StrUtil.split(packageName, StringConstants.DOT)); | ||||
|             File backendParentFile = | ||||
|                 FileUtil.file(backendModuleFile, backendModuleChildPathList.toArray(new String[0])); | ||||
|             File backendParentFile = FileUtil.file(backendModuleFile, backendModuleChildPathList | ||||
|                 .toArray(new String[0])); | ||||
|             // 2.生成代码 | ||||
|             List<GeneratePreviewResp> backendCodePreviewList = | ||||
|                 generatePreviewList.stream().filter(GeneratePreviewResp::isBackend).collect(Collectors.toList()); | ||||
|             List<GeneratePreviewResp> backendCodePreviewList = generatePreviewList.stream() | ||||
|                 .filter(GeneratePreviewResp::isBackend) | ||||
|                 .collect(Collectors.toList()); | ||||
|             Map<String, TemplateConfig> templateConfigMap = generatorProperties.getTemplateConfigs(); | ||||
|             for (GeneratePreviewResp codePreview : backendCodePreviewList) { | ||||
|                 // 例如:D:/continew-admin/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/XxxServiceImpl.java | ||||
|                 TemplateConfig templateConfig = | ||||
|                     templateConfigMap.get(codePreview.getFileName().replace(classNamePrefix, StringConstants.EMPTY) | ||||
|                         .replace(FileNameUtil.EXT_JAVA, StringConstants.EMPTY)); | ||||
|                 File classParentFile = FileUtil.file(backendParentFile, | ||||
|                     StrUtil.splitToArray(templateConfig.getPackageName(), StringConstants.DOT)); | ||||
|                 TemplateConfig templateConfig = templateConfigMap.get(codePreview.getFileName() | ||||
|                     .replace(classNamePrefix, StringConstants.EMPTY) | ||||
|                     .replace(FileNameUtil.EXT_JAVA, StringConstants.EMPTY)); | ||||
|                 File classParentFile = FileUtil.file(backendParentFile, StrUtil.splitToArray(templateConfig | ||||
|                     .getPackageName(), StringConstants.DOT)); | ||||
|                 File classFile = new File(classParentFile, codePreview.getFileName()); | ||||
|                 // 如果已经存在,且不允许覆盖,则跳过 | ||||
|                 if (classFile.exists() && !isOverride) { | ||||
| @@ -299,11 +300,12 @@ public class GeneratorServiceImpl implements GeneratorService { | ||||
|             if (StrUtil.isBlank(frontendPath)) { | ||||
|                 return; | ||||
|             } | ||||
|             List<GeneratePreviewResp> frontendCodePreviewList = | ||||
|                 generatePreviewList.stream().filter(p -> !p.isBackend()).collect(Collectors.toList()); | ||||
|             List<GeneratePreviewResp> frontendCodePreviewList = generatePreviewList.stream() | ||||
|                 .filter(p -> !p.isBackend()) | ||||
|                 .collect(Collectors.toList()); | ||||
|             // 1.生成 api 代码 | ||||
|             String apiModuleName = | ||||
|                 StrUtil.subSuf(packageName, StrUtil.lastIndexOfIgnoreCase(packageName, StringConstants.DOT) + 1); | ||||
|             String apiModuleName = StrUtil.subSuf(packageName, StrUtil | ||||
|                 .lastIndexOfIgnoreCase(packageName, StringConstants.DOT) + 1); | ||||
|             GeneratePreviewResp apiCodePreview = frontendCodePreviewList.get(0); | ||||
|             // 例如:D:/continew-admin-ui | ||||
|             List<String> frontendSubPathList = StrUtil.split(frontendPath, "src"); | ||||
| @@ -318,8 +320,8 @@ public class GeneratorServiceImpl implements GeneratorService { | ||||
|             // 2.生成 view 代码 | ||||
|             GeneratePreviewResp viewCodePreview = frontendCodePreviewList.get(1); | ||||
|             // 例如:D:/continew-admin-ui/src/views/tool/xxx/index.vue | ||||
|             File indexFile = | ||||
|                 FileUtil.file(frontendPath, apiModuleName, StrUtil.lowerFirst(classNamePrefix), "index.vue"); | ||||
|             File indexFile = FileUtil.file(frontendPath, apiModuleName, StrUtil | ||||
|                 .lowerFirst(classNamePrefix), "index.vue"); | ||||
|             if (indexFile.exists() && !isOverride) { | ||||
|                 return; | ||||
|             } | ||||
| @@ -333,15 +335,13 @@ public class GeneratorServiceImpl implements GeneratorService { | ||||
|     /** | ||||
|      * 预处理生成配置 | ||||
|      * | ||||
|      * @param genConfigMap | ||||
|      *            生成配置 | ||||
|      * @param originFieldConfigList | ||||
|      *            原始字段配置列表 | ||||
|      * @param templateConfigEntry | ||||
|      *            模板配置 | ||||
|      * @param genConfigMap          生成配置 | ||||
|      * @param originFieldConfigList 原始字段配置列表 | ||||
|      * @param templateConfigEntry   模板配置 | ||||
|      */ | ||||
|     private void pretreatment(Map<String, Object> genConfigMap, List<FieldConfigDO> originFieldConfigList, | ||||
|         Map.Entry<String, TemplateConfig> templateConfigEntry) { | ||||
|     private void pretreatment(Map<String, Object> genConfigMap, | ||||
|                               List<FieldConfigDO> originFieldConfigList, | ||||
|                               Map.Entry<String, TemplateConfig> templateConfigEntry) { | ||||
|         TemplateConfig templateConfig = templateConfigEntry.getValue(); | ||||
|         // 移除需要忽略的字段 | ||||
|         List<FieldConfigDO> fieldConfigList = originFieldConfigList.stream() | ||||
| @@ -365,8 +365,8 @@ public class GeneratorServiceImpl implements GeneratorService { | ||||
|                 genConfigMap.put("hasRequiredField", true); | ||||
|             } | ||||
|             QueryTypeEnum queryType = fieldConfig.getQueryType(); | ||||
|             if (null != queryType && StrUtil.equalsAny(queryType.name(), QueryTypeEnum.IN.name(), | ||||
|                 QueryTypeEnum.NOT_IN.name(), QueryTypeEnum.BETWEEN.name())) { | ||||
|             if (null != queryType && StrUtil.equalsAny(queryType.name(), QueryTypeEnum.IN.name(), QueryTypeEnum.NOT_IN | ||||
|                 .name(), QueryTypeEnum.BETWEEN.name())) { | ||||
|                 genConfigMap.put("hasListQueryField", true); | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -112,8 +112,7 @@ public class AuthController { | ||||
|     } | ||||
|  | ||||
|     @Operation(summary = "用户退出", description = "注销用户的当前登录") | ||||
|     @Parameter(name = "Authorization", description = "令牌", required = true, example = "Bearer xxxx-xxxx-xxxx-xxxx", | ||||
|         in = ParameterIn.HEADER) | ||||
|     @Parameter(name = "Authorization", description = "令牌", required = true, example = "Bearer xxxx-xxxx-xxxx-xxxx", in = ParameterIn.HEADER) | ||||
|     @PostMapping("/logout") | ||||
|     public R<Object> logout() { | ||||
|         Object loginId = StpUtil.getLoginId(-1L); | ||||
|   | ||||
| @@ -113,9 +113,7 @@ public class CaptchaController { | ||||
|  | ||||
|     @Operation(summary = "获取邮箱验证码", description = "发送验证码到指定邮箱") | ||||
|     @GetMapping("/mail") | ||||
|     public R getMailCaptcha( | ||||
|         @NotBlank(message = "邮箱不能为空") @Pattern(regexp = RegexConstants.EMAIL, message = "邮箱格式错误") String email) | ||||
|         throws MessagingException { | ||||
|     public R getMailCaptcha(@NotBlank(message = "邮箱不能为空") @Pattern(regexp = RegexConstants.EMAIL, message = "邮箱格式错误") String email) throws MessagingException { | ||||
|         String limitKeyPrefix = CacheConstants.LIMIT_KEY_PREFIX; | ||||
|         String captchaKeyPrefix = CacheConstants.CAPTCHA_KEY_PREFIX; | ||||
|         String limitCaptchaKey = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, email); | ||||
| @@ -126,8 +124,9 @@ public class CaptchaController { | ||||
|         String captcha = RandomUtil.randomNumbers(captchaMail.getLength()); | ||||
|         // 发送验证码 | ||||
|         Long expirationInMinutes = captchaMail.getExpirationInMinutes(); | ||||
|         String content = TemplateUtils.render(captchaMail.getTemplatePath(), | ||||
|             Dict.create().set("captcha", captcha).set("expiration", expirationInMinutes)); | ||||
|         String content = TemplateUtils.render(captchaMail.getTemplatePath(), Dict.create() | ||||
|             .set("captcha", captcha) | ||||
|             .set("expiration", expirationInMinutes)); | ||||
|         MailUtils.sendHtml(email, String.format("【%s】邮箱验证码", projectProperties.getName()), content); | ||||
|         // 保存验证码 | ||||
|         String captchaKey = RedisUtils.formatKey(captchaKeyPrefix, email); | ||||
| @@ -138,13 +137,13 @@ public class CaptchaController { | ||||
|  | ||||
|     @Operation(summary = "获取短信验证码", description = "发送验证码到指定手机号") | ||||
|     @GetMapping("/sms") | ||||
|     public R getSmsCaptcha( | ||||
|         @NotBlank(message = "手机号不能为空") @Pattern(regexp = RegexConstants.MOBILE, message = "手机号格式错误") String phone, | ||||
|         CaptchaVO captchaReq, HttpServletRequest request) { | ||||
|     public R getSmsCaptcha(@NotBlank(message = "手机号不能为空") @Pattern(regexp = RegexConstants.MOBILE, message = "手机号格式错误") String phone, | ||||
|                            CaptchaVO captchaReq, | ||||
|                            HttpServletRequest request) { | ||||
|         // 行为验证码校验 | ||||
|         ResponseModel verificationRes = captchaService.verification(captchaReq); | ||||
|         ValidationUtils.throwIfNotEqual(verificationRes.getRepCode(), RepCodeEnum.SUCCESS.getCode(), | ||||
|             verificationRes.getRepMsg()); | ||||
|         ValidationUtils.throwIfNotEqual(verificationRes.getRepCode(), RepCodeEnum.SUCCESS.getCode(), verificationRes | ||||
|             .getRepMsg()); | ||||
|         CaptchaProperties.CaptchaSms captchaSms = captchaProperties.getSms(); | ||||
|         String templateId = captchaSms.getTemplateId(); | ||||
|         String limitKeyPrefix = CacheConstants.LIMIT_KEY_PREFIX; | ||||
| @@ -152,20 +151,19 @@ public class CaptchaController { | ||||
|         String limitTemplateKeyPrefix = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix); | ||||
|         // 限制短信发送频率 | ||||
|         // 1.同一号码同一短信模板,1分钟2条,1小时8条,24小时20条,e.g. LIMIT:CAPTCHA:XXX:188xxxxx:1 | ||||
|         CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils.formatKey(limitTemplateKeyPrefix, "MIN", phone, templateId), | ||||
|             RateType.OVERALL, 2, 60), "验证码发送过于频繁,请稍后后再试"); | ||||
|         CheckUtils | ||||
|             .throwIf(!RedisUtils.rateLimit(RedisUtils.formatKey(limitTemplateKeyPrefix, "HOUR", phone, templateId), | ||||
|                 RateType.OVERALL, 8, 60 * 60), "验证码发送过于频繁,请稍后后再试"); | ||||
|         CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils.formatKey(limitTemplateKeyPrefix, "DAY", phone, templateId), | ||||
|             RateType.OVERALL, 20, 60 * 60 * 24), "验证码发送过于频繁,请稍后后再试"); | ||||
|         CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils | ||||
|             .formatKey(limitTemplateKeyPrefix, "MIN", phone, templateId), RateType.OVERALL, 2, 60), "验证码发送过于频繁,请稍后后再试"); | ||||
|         CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils | ||||
|             .formatKey(limitTemplateKeyPrefix, "HOUR", phone, templateId), RateType.OVERALL, 8, 60 * 60), "验证码发送过于频繁,请稍后后再试"); | ||||
|         CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils | ||||
|             .formatKey(limitTemplateKeyPrefix, "DAY", phone, templateId), RateType.OVERALL, 20, 60 * 60 * 24), "验证码发送过于频繁,请稍后后再试"); | ||||
|         // 2.同一号码所有短信模板 24 小时 100 条,e.g. LIMIT:CAPTCHA:188xxxxx | ||||
|         String limitPhoneKey = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, phone); | ||||
|         CheckUtils.throwIf(!RedisUtils.rateLimit(limitPhoneKey, RateType.OVERALL, 100, 60 * 60 * 24), | ||||
|             "验证码发送过于频繁,请稍后后再试"); | ||||
|         CheckUtils.throwIf(!RedisUtils | ||||
|             .rateLimit(limitPhoneKey, RateType.OVERALL, 100, 60 * 60 * 24), "验证码发送过于频繁,请稍后后再试"); | ||||
|         // 3.同一 IP 每分钟限制发送 30 条,e.g. LIMIT:CAPTCHA:PHONE:1xx.1xx.1xx.1xx | ||||
|         String limitIpKey = | ||||
|             RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, "PHONE", JakartaServletUtil.getClientIP(request)); | ||||
|         String limitIpKey = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, "PHONE", JakartaServletUtil | ||||
|             .getClientIP(request)); | ||||
|         CheckUtils.throwIf(!RedisUtils.rateLimit(limitIpKey, RateType.OVERALL, 30, 60), "验证码发送过于频繁,请稍后后再试"); | ||||
|         // 生成验证码 | ||||
|         String captcha = RandomUtil.randomNumbers(captchaSms.getLength()); | ||||
| @@ -175,8 +173,8 @@ public class CaptchaController { | ||||
|         Map<String, String> messageMap = MapUtil.newHashMap(2, true); | ||||
|         messageMap.put("captcha", captcha); | ||||
|         messageMap.put("expirationInMinutes", String.valueOf(expirationInMinutes)); | ||||
|         SmsResponse smsResponse = | ||||
|             smsBlend.sendMessage(phone, captchaSms.getTemplateId(), (LinkedHashMap<String, String>)messageMap); | ||||
|         SmsResponse smsResponse = smsBlend.sendMessage(phone, captchaSms | ||||
|             .getTemplateId(), (LinkedHashMap<String, String>)messageMap); | ||||
|         CheckUtils.throwIf(!smsResponse.isSuccess(), "验证码发送失败"); | ||||
|         // 保存验证码 | ||||
|         String captchaKey = RedisUtils.formatKey(captchaKeyPrefix, phone); | ||||
|   | ||||
| @@ -124,30 +124,31 @@ public class CommonController { | ||||
|     @GetMapping("/option") | ||||
|     @Cacheable(cacheNames = CacheConstants.OPTION_KEY_PREFIX) | ||||
|     public R<List<LabelValueResp>> listOption(@Validated OptionQuery query) { | ||||
|         return R.ok(optionService.list(query).stream().map(option -> new LabelValueResp(option.getCode(), | ||||
|             StrUtil.nullToDefault(option.getValue(), option.getDefaultValue()))).collect(Collectors.toList())); | ||||
|         return R.ok(optionService.list(query) | ||||
|             .stream() | ||||
|             .map(option -> new LabelValueResp(option.getCode(), StrUtil.nullToDefault(option.getValue(), option | ||||
|                 .getDefaultValue()))) | ||||
|             .collect(Collectors.toList())); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据枚举类名查询 | ||||
|      * | ||||
|      * @param enumClassName | ||||
|      *            枚举类名 | ||||
|      * @param enumClassName 枚举类名 | ||||
|      * @return 枚举类型 | ||||
|      */ | ||||
|     private Optional<Class<?>> getEnumClassByName(String enumClassName) { | ||||
|         Set<Class<?>> classSet = ClassUtil.scanPackageBySuper(projectProperties.getBasePackage(), IBaseEnum.class); | ||||
|         return classSet.stream() | ||||
|             .filter( | ||||
|                 c -> StrUtil.equalsAnyIgnoreCase(c.getSimpleName(), enumClassName, StrUtil.toCamelCase(enumClassName))) | ||||
|             .filter(c -> StrUtil.equalsAnyIgnoreCase(c.getSimpleName(), enumClassName, StrUtil | ||||
|                 .toCamelCase(enumClassName))) | ||||
|             .findFirst(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 查询枚举字典 | ||||
|      * | ||||
|      * @param enumClass | ||||
|      *            枚举类型 | ||||
|      * @param enumClass 枚举类型 | ||||
|      * @return 枚举字典 | ||||
|      */ | ||||
|     private List<LabelValueResp> listEnumDict(Class<?> enumClass) { | ||||
|   | ||||
| @@ -60,9 +60,7 @@ public class OnlineUserController { | ||||
|     } | ||||
|  | ||||
|     @Operation(summary = "强退在线用户", description = "强退在线用户") | ||||
|     @Parameter(name = "token", description = "令牌", | ||||
|         example = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiTUd6djdyOVFoeHEwdVFqdFAzV3M5YjVJRzh4YjZPSEUifQ.7q7U3ouoN7WPhH2kUEM7vPe5KF3G_qavSG-vRgIxKvE", | ||||
|         in = ParameterIn.PATH) | ||||
|     @Parameter(name = "token", description = "令牌", example = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEsInJuU3RyIjoiTUd6djdyOVFoeHEwdVFqdFAzV3M5YjVJRzh4YjZPSEUifQ.7q7U3ouoN7WPhH2kUEM7vPe5KF3G_qavSG-vRgIxKvE", in = ParameterIn.PATH) | ||||
|     @SaCheckPermission("monitor:online:user:delete") | ||||
|     @DeleteMapping("/{token}") | ||||
|     public R kickout(@PathVariable String token) { | ||||
|   | ||||
| @@ -45,8 +45,7 @@ import top.charles7c.continew.starter.extension.crud.model.resp.R; | ||||
| @Tag(name = "公告管理 API") | ||||
| @RestController | ||||
| @CrudRequestMapping("/system/announcement") | ||||
| public class AnnouncementController extends | ||||
|     BaseController<AnnouncementService, AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> { | ||||
| public class AnnouncementController extends BaseController<AnnouncementService, AnnouncementResp, AnnouncementDetailResp, AnnouncementQuery, AnnouncementReq> { | ||||
|  | ||||
|     @Override | ||||
|     @SaCheckPermission("system:announcement:add") | ||||
| @@ -58,7 +57,7 @@ public class AnnouncementController extends | ||||
|     @Override | ||||
|     @SaCheckPermission("system:announcement:update") | ||||
|     public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody AnnouncementReq req, | ||||
|         @PathVariable Long id) { | ||||
|                     @PathVariable Long id) { | ||||
|         this.checkTime(req); | ||||
|         return super.update(req, id); | ||||
|     } | ||||
|   | ||||
| @@ -38,5 +38,4 @@ import top.charles7c.continew.starter.extension.crud.enums.Api; | ||||
| @Tag(name = "字典项管理 API") | ||||
| @RestController | ||||
| @CrudRequestMapping(value = "/system/dict/item", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE}) | ||||
| public class DictItemController | ||||
|     extends BaseController<DictItemService, DictItemResp, DictItemDetailResp, DictItemQuery, DictItemReq> {} | ||||
| public class DictItemController extends BaseController<DictItemService, DictItemResp, DictItemDetailResp, DictItemQuery, DictItemReq> {} | ||||
| @@ -37,5 +37,4 @@ import top.charles7c.continew.starter.extension.crud.base.BaseController; | ||||
| @Tag(name = "存储库管理 API") | ||||
| @RestController | ||||
| @CrudRequestMapping("/system/storage") | ||||
| public class StorageController | ||||
|     extends BaseController<StorageService, StorageResp, StorageDetailResp, StorageQuery, StorageReq> {} | ||||
| public class StorageController extends BaseController<StorageService, StorageResp, StorageDetailResp, StorageQuery, StorageReq> {} | ||||
| @@ -95,14 +95,14 @@ public class UserCenterController { | ||||
|     @Operation(summary = "修改密码", description = "修改用户登录密码") | ||||
|     @PatchMapping("/password") | ||||
|     public R updatePassword(@Validated @RequestBody UserPasswordUpdateReq updateReq) { | ||||
|         String rawOldPassword = | ||||
|             ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getOldPassword())); | ||||
|         String rawOldPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq | ||||
|             .getOldPassword())); | ||||
|         ValidationUtils.throwIfNull(rawOldPassword, "当前密码解密失败"); | ||||
|         String rawNewPassword = | ||||
|             ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getNewPassword())); | ||||
|         String rawNewPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq | ||||
|             .getNewPassword())); | ||||
|         ValidationUtils.throwIfNull(rawNewPassword, "新密码解密失败"); | ||||
|         ValidationUtils.throwIf(!ReUtil.isMatch(RegexConstants.PASSWORD, rawNewPassword), | ||||
|             "密码长度为 6 到 32 位,可以包含字母、数字、下划线,特殊字符,同时包含字母和数字"); | ||||
|         ValidationUtils.throwIf(!ReUtil | ||||
|             .isMatch(RegexConstants.PASSWORD, rawNewPassword), "密码长度为 6 到 32 位,可以包含字母、数字、下划线,特殊字符,同时包含字母和数字"); | ||||
|         userService.updatePassword(rawOldPassword, rawNewPassword, LoginHelper.getUserId()); | ||||
|         return R.ok("修改成功"); | ||||
|     } | ||||
| @@ -110,8 +110,8 @@ public class UserCenterController { | ||||
|     @Operation(summary = "修改手机号", description = "修改手机号") | ||||
|     @PatchMapping("/phone") | ||||
|     public R updatePhone(@Validated @RequestBody UserPhoneUpdateReq updateReq) { | ||||
|         String rawCurrentPassword = | ||||
|             ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getCurrentPassword())); | ||||
|         String rawCurrentPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq | ||||
|             .getCurrentPassword())); | ||||
|         ValidationUtils.throwIfBlank(rawCurrentPassword, "当前密码解密失败"); | ||||
|         String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, updateReq.getNewPhone()); | ||||
|         String captcha = RedisUtils.get(captchaKey); | ||||
| @@ -125,8 +125,8 @@ public class UserCenterController { | ||||
|     @Operation(summary = "修改邮箱", description = "修改用户邮箱") | ||||
|     @PatchMapping("/email") | ||||
|     public R updateEmail(@Validated @RequestBody UserEmailUpdateRequest updateReq) { | ||||
|         String rawCurrentPassword = | ||||
|             ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getCurrentPassword())); | ||||
|         String rawCurrentPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq | ||||
|             .getCurrentPassword())); | ||||
|         ValidationUtils.throwIfBlank(rawCurrentPassword, "当前密码解密失败"); | ||||
|         String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, updateReq.getNewEmail()); | ||||
|         String captcha = RedisUtils.get(captchaKey); | ||||
|   | ||||
| @@ -73,7 +73,7 @@ public class GeneratorController { | ||||
|     @SaCheckPermission("tool:generator:list") | ||||
|     @GetMapping("/field/{tableName}") | ||||
|     public R<List<FieldConfigDO>> listFieldConfig(@PathVariable String tableName, | ||||
|         @RequestParam(required = false, defaultValue = "false") Boolean requireSync) { | ||||
|                                                   @RequestParam(required = false, defaultValue = "false") Boolean requireSync) { | ||||
|         return R.ok(generatorService.listFieldConfig(tableName, requireSync)); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -23,5 +23,6 @@ import org.springframework.boot.test.context.SpringBootTest; | ||||
| class ContiNewAdminApplicationTests { | ||||
|  | ||||
|     @Test | ||||
|     void contextLoads() {} | ||||
|     void contextLoads() { | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										7
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -121,15 +121,12 @@ | ||||
|                 </executions> | ||||
|                 <configuration> | ||||
|                     <java> | ||||
|                         <importOrder> | ||||
|                             <order>java,jakarta,lombok,io,org,com,cn,top.charles7c,</order> | ||||
|                         </importOrder> | ||||
|                         <removeUnusedImports/> | ||||
|                         <eclipse> | ||||
|                             <file>code-style/code-formatter.xml</file> | ||||
|                             <file>.style/p3c-codestyle.xml</file> | ||||
|                         </eclipse> | ||||
|                         <licenseHeader> | ||||
|                             <file>code-style/license-header</file> | ||||
|                             <file>.style/license-header</file> | ||||
|                         </licenseHeader> | ||||
|                     </java> | ||||
|                 </configuration> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user