瀏覽代碼

【ADD】增加权限认证接口注解
【ADD】增加开发说明

xczzmn 4 年之前
父節點
當前提交
ca2a664fdd

+ 568 - 0
doc/GoogleStyle.xml

@@ -0,0 +1,568 @@
+<code_scheme name="GoogleStyle" version="173">
+  <option name="OTHER_INDENT_OPTIONS">
+    <value>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="CONTINUATION_INDENT_SIZE" value="4" />
+      <option name="TAB_SIZE" value="2" />
+    </value>
+  </option>
+  <option name="RIGHT_MARGIN" value="100" />
+  <AndroidXmlCodeStyleSettings>
+    <option name="USE_CUSTOM_SETTINGS" value="true" />
+    <option name="LAYOUT_SETTINGS">
+      <value>
+        <option name="INSERT_BLANK_LINE_BEFORE_TAG" value="false" />
+      </value>
+    </option>
+  </AndroidXmlCodeStyleSettings>
+  <JSCodeStyleSettings version="0">
+    <option name="INDENT_CHAINED_CALLS" value="false" />
+  </JSCodeStyleSettings>
+  <JavaCodeStyleSettings>
+    <option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
+    <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
+    <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
+    <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
+      <value />
+    </option>
+    <option name="IMPORT_LAYOUT_TABLE">
+      <value>
+        <package name="" withSubpackages="true" static="true" />
+        <emptyLine />
+        <package name="" withSubpackages="true" static="false" />
+      </value>
+    </option>
+    <option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
+    <option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
+    <option name="JD_P_AT_EMPTY_LINES" value="false" />
+    <option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
+    <option name="JD_KEEP_EMPTY_EXCEPTION" value="false" />
+    <option name="JD_KEEP_EMPTY_RETURN" value="false" />
+  </JavaCodeStyleSettings>
+  <Objective-C>
+    <option name="INDENT_NAMESPACE_MEMBERS" value="0" />
+    <option name="INDENT_C_STRUCT_MEMBERS" value="2" />
+    <option name="INDENT_CLASS_MEMBERS" value="2" />
+    <option name="INDENT_VISIBILITY_KEYWORDS" value="1" />
+    <option name="INDENT_INSIDE_CODE_BLOCK" value="2" />
+    <option name="KEEP_STRUCTURES_IN_ONE_LINE" value="true" />
+    <option name="FUNCTION_PARAMETERS_WRAP" value="5" />
+    <option name="FUNCTION_CALL_ARGUMENTS_WRAP" value="5" />
+    <option name="TEMPLATE_CALL_ARGUMENTS_WRAP" value="5" />
+    <option name="TEMPLATE_CALL_ARGUMENTS_ALIGN_MULTILINE" value="true" />
+    <option name="ALIGN_INIT_LIST_IN_COLUMNS" value="false" />
+    <option name="SPACE_BEFORE_SUPERCLASS_COLON" value="false" />
+  </Objective-C>
+  <Objective-C-extensions>
+    <option name="GENERATE_INSTANCE_VARIABLES_FOR_PROPERTIES" value="ASK" />
+    <option name="RELEASE_STYLE" value="IVAR" />
+    <option name="TYPE_QUALIFIERS_PLACEMENT" value="BEFORE" />
+    <file>
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
+    </file>
+    <class>
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
+      <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
+    </class>
+    <extensions>
+      <pair source="cc" header="h" />
+      <pair source="c" header="h" />
+    </extensions>
+  </Objective-C-extensions>
+  <Python>
+    <option name="USE_CONTINUATION_INDENT_FOR_ARGUMENTS" value="true" />
+  </Python>
+  <TypeScriptCodeStyleSettings version="0">
+    <option name="INDENT_CHAINED_CALLS" value="false" />
+  </TypeScriptCodeStyleSettings>
+  <XML>
+    <option name="XML_ALIGN_ATTRIBUTES" value="false" />
+    <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
+  </XML>
+  <codeStyleSettings language="CSS">
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="CONTINUATION_INDENT_SIZE" value="4" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="ECMA Script Level 4">
+    <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
+    <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
+    <option name="ALIGN_MULTILINE_FOR" value="false" />
+    <option name="CALL_PARAMETERS_WRAP" value="1" />
+    <option name="METHOD_PARAMETERS_WRAP" value="1" />
+    <option name="EXTENDS_LIST_WRAP" value="1" />
+    <option name="BINARY_OPERATION_WRAP" value="1" />
+    <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
+    <option name="TERNARY_OPERATION_WRAP" value="1" />
+    <option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
+    <option name="FOR_STATEMENT_WRAP" value="1" />
+    <option name="ARRAY_INITIALIZER_WRAP" value="1" />
+    <option name="IF_BRACE_FORCE" value="3" />
+    <option name="DOWHILE_BRACE_FORCE" value="3" />
+    <option name="WHILE_BRACE_FORCE" value="3" />
+    <option name="FOR_BRACE_FORCE" value="3" />
+  </codeStyleSettings>
+  <codeStyleSettings language="HTML">
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="CONTINUATION_INDENT_SIZE" value="4" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="JAVA">
+    <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
+    <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
+    <option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
+    <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
+    <option name="ALIGN_MULTILINE_RESOURCES" value="false" />
+    <option name="ALIGN_MULTILINE_FOR" value="false" />
+    <option name="CALL_PARAMETERS_WRAP" value="1" />
+    <option name="METHOD_PARAMETERS_WRAP" value="1" />
+    <option name="EXTENDS_LIST_WRAP" value="1" />
+    <option name="THROWS_KEYWORD_WRAP" value="1" />
+    <option name="METHOD_CALL_CHAIN_WRAP" value="1" />
+    <option name="BINARY_OPERATION_WRAP" value="1" />
+    <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
+    <option name="TERNARY_OPERATION_WRAP" value="1" />
+    <option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
+    <option name="FOR_STATEMENT_WRAP" value="1" />
+    <option name="ARRAY_INITIALIZER_WRAP" value="1" />
+    <option name="WRAP_COMMENTS" value="true" />
+    <option name="IF_BRACE_FORCE" value="3" />
+    <option name="DOWHILE_BRACE_FORCE" value="3" />
+    <option name="WHILE_BRACE_FORCE" value="3" />
+    <option name="FOR_BRACE_FORCE" value="3" />
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="CONTINUATION_INDENT_SIZE" value="4" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="JSON">
+    <indentOptions>
+      <option name="CONTINUATION_INDENT_SIZE" value="4" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="JavaScript">
+    <option name="RIGHT_MARGIN" value="80" />
+    <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
+    <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
+    <option name="ALIGN_MULTILINE_FOR" value="false" />
+    <option name="CALL_PARAMETERS_WRAP" value="1" />
+    <option name="METHOD_PARAMETERS_WRAP" value="1" />
+    <option name="BINARY_OPERATION_WRAP" value="1" />
+    <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
+    <option name="TERNARY_OPERATION_WRAP" value="1" />
+    <option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
+    <option name="FOR_STATEMENT_WRAP" value="1" />
+    <option name="ARRAY_INITIALIZER_WRAP" value="1" />
+    <option name="IF_BRACE_FORCE" value="3" />
+    <option name="DOWHILE_BRACE_FORCE" value="3" />
+    <option name="WHILE_BRACE_FORCE" value="3" />
+    <option name="FOR_BRACE_FORCE" value="3" />
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="ObjectiveC">
+    <option name="RIGHT_MARGIN" value="80" />
+    <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
+    <option name="BLANK_LINES_BEFORE_IMPORTS" value="0" />
+    <option name="BLANK_LINES_AFTER_IMPORTS" value="0" />
+    <option name="BLANK_LINES_AROUND_CLASS" value="0" />
+    <option name="BLANK_LINES_AROUND_METHOD" value="0" />
+    <option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
+    <option name="ALIGN_MULTILINE_BINARY_OPERATION" value="false" />
+    <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
+    <option name="FOR_STATEMENT_WRAP" value="1" />
+    <option name="ASSIGNMENT_WRAP" value="1" />
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="CONTINUATION_INDENT_SIZE" value="4" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="PROTO">
+    <option name="RIGHT_MARGIN" value="80" />
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="CONTINUATION_INDENT_SIZE" value="2" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="Python">
+    <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
+    <option name="RIGHT_MARGIN" value="80" />
+    <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
+    <option name="PARENT_SETTINGS_INSTALLED" value="true" />
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="CONTINUATION_INDENT_SIZE" value="4" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="SASS">
+    <indentOptions>
+      <option name="CONTINUATION_INDENT_SIZE" value="4" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="SCSS">
+    <indentOptions>
+      <option name="CONTINUATION_INDENT_SIZE" value="4" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="TypeScript">
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+  <codeStyleSettings language="XML">
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="CONTINUATION_INDENT_SIZE" value="2" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+    <arrangement>
+      <rules>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>xmlns:android</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>^$</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>xmlns:.*</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>^$</XML_NAMESPACE>
+              </AND>
+            </match>
+            <order>BY_NAME</order>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:id</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>style</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>^$</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>^$</XML_NAMESPACE>
+              </AND>
+            </match>
+            <order>BY_NAME</order>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:.*Style</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+            <order>BY_NAME</order>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_width</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_height</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_weight</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_margin</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_marginTop</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_marginBottom</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_marginStart</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_marginEnd</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_marginLeft</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_marginRight</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:layout_.*</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+            <order>BY_NAME</order>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:padding</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:paddingTop</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:paddingBottom</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:paddingStart</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:paddingEnd</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:paddingLeft</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*:paddingRight</NAME>
+                <XML_ATTRIBUTE />
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*</NAME>
+                <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+              </AND>
+            </match>
+            <order>BY_NAME</order>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*</NAME>
+                <XML_NAMESPACE>http://schemas.android.com/apk/res-auto</XML_NAMESPACE>
+              </AND>
+            </match>
+            <order>BY_NAME</order>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*</NAME>
+                <XML_NAMESPACE>http://schemas.android.com/tools</XML_NAMESPACE>
+              </AND>
+            </match>
+            <order>BY_NAME</order>
+          </rule>
+        </section>
+        <section>
+          <rule>
+            <match>
+              <AND>
+                <NAME>.*</NAME>
+                <XML_NAMESPACE>.*</XML_NAMESPACE>
+              </AND>
+            </match>
+            <order>BY_NAME</order>
+          </rule>
+        </section>
+      </rules>
+    </arrangement>
+  </codeStyleSettings>
+  <codeStyleSettings language="protobuf">
+    <option name="RIGHT_MARGIN" value="80" />
+    <indentOptions>
+      <option name="INDENT_SIZE" value="2" />
+      <option name="CONTINUATION_INDENT_SIZE" value="2" />
+      <option name="TAB_SIZE" value="2" />
+    </indentOptions>
+  </codeStyleSettings>
+</code_scheme>

+ 33 - 0
doc/README.md

@@ -0,0 +1,33 @@
+# 后端
+
+## 介绍
+
+## 软件架构
+
+### 模块说明
+
+railway-admin 
+
+railway-framework	
+
+railway-system	
+
+railway-common	
+
+railway-business
+
+### 主要技术框架
+
+SpringBoot
+MyBatis
+
+## 编码规则
+
+### 编码风格
+
+请自行导入GoogleStyle.xml,导入步骤:File->Settings->Editor->Code Style->Scheme->右侧齿轮->Import Scheme
+其他编码设计规则参考《Java 开发手册》
+
+### 数据库设计
+
+

+ 2 - 1
doc/Swagger注解说明.md

@@ -30,4 +30,5 @@ response:抛出异常的类
 #@ApiModel:用于响应类上,表示一个返回响应数据的信息
 (这种一般用在post创建的时候,使用@RequestBody这样的场景,
 请求参数无法使用@ApiImplicitParam注解进行描述的时候)
-@ApiModelProperty:用在属性上,描述响应类的属性
+
+#@ApiModelProperty:用在属性上,描述响应类的属性

+ 7 - 21
pom.xml

@@ -31,6 +31,7 @@
     <bitwalker.version>1.21</bitwalker.version>
     <kaptcha.version>2.3.2</kaptcha.version>
     <swagger.version>3.0.0</swagger.version>
+    <swagger-annotations.version>1.6.2</swagger-annotations.version>
     <mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
     <pagehelper.boot.version>1.3.1</pagehelper.boot.version>
     <fastjson.version>1.2.78</fastjson.version>
@@ -71,27 +72,6 @@
         <version>${kaptcha.version}</version>
       </dependency>
 
-      <!-- Shiro核心框架 -->
-      <dependency>
-        <groupId>org.apache.shiro</groupId>
-        <artifactId>shiro-core</artifactId>
-        <version>${shiro.version}</version>
-      </dependency>
-
-      <!-- Shiro使用Spring框架 -->
-      <dependency>
-        <groupId>org.apache.shiro</groupId>
-        <artifactId>shiro-spring</artifactId>
-        <version>${shiro.version}</version>
-      </dependency>
-
-      <!-- Shiro使用EhCache缓存框架 -->
-      <dependency>
-        <groupId>org.apache.shiro</groupId>
-        <artifactId>shiro-ehcache</artifactId>
-        <version>${shiro.version}</version>
-      </dependency>
-
       <!-- 解析客户端操作系统、浏览器等 -->
       <dependency>
         <groupId>eu.bitwalker</groupId>
@@ -139,6 +119,12 @@
         <version>${swagger.version}</version>
       </dependency>
 
+      <dependency>
+        <groupId>io.swagger</groupId>
+        <artifactId>swagger-annotations</artifactId>
+        <version>${swagger-annotations.version}</version>
+      </dependency>
+
       <!-- io常用工具类 -->
       <dependency>
         <groupId>commons-io</groupId>

+ 64 - 47
railway-admin/src/main/java/com/railway/web/controller/common/CaptchaController.java

@@ -1,19 +1,23 @@
 package com.railway.web.controller.common;
 
-import com.google.code.kaptcha.Constants;
 import com.google.code.kaptcha.Producer;
+import com.railway.common.constant.Constants;
 import com.railway.common.core.controller.BaseController;
+import com.railway.common.core.domain.AjaxResult;
+import com.railway.common.core.redis.RedisCache;
+import com.railway.common.utils.sign.Base64;
+import com.railway.common.utils.uuid.IdUtils;
+import com.railway.system.service.ISysConfigService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import java.awt.image.BufferedImage;
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 import javax.annotation.Resource;
 import javax.imageio.ImageIO;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.FastByteArrayOutputStream;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
@@ -33,53 +37,66 @@ public class CaptchaController extends BaseController {
   @Resource(name = "captchaProducerMath")
   private Producer captchaProducerMath;
 
+  /** 验证码类型 */
+  @Value("${railway.captchaType}")
+  private String captchaType;
+
+  private final RedisCache redisCache;
+  private final ISysConfigService configService;
+
+  public CaptchaController(RedisCache redisCache,
+      ISysConfigService configService) {
+    this.redisCache = redisCache;
+    this.configService = configService;
+  }
+
   /**
-   * 验证码生成
+   * 生成验证码
    */
   @ApiOperation(value = "验证码生成", notes = "验证码生成", response = ModelAndView.class)
-  @ApiImplicitParam(name = "type", value = "math 或 char",
-      required = true, paramType = "query", dataType = "string")
-  @GetMapping(value = "/captchaImage")
-  public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response) {
-    ServletOutputStream out = null;
-    try {
-      HttpSession session = request.getSession();
-      response.setDateHeader("Expires", 0);
-      response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
-      response.addHeader("Cache-Control", "post-check=0, pre-check=0");
-      response.setHeader("Pragma", "no-cache");
-      response.setContentType("image/jpeg");
+  @ApiImplicitParam(name = "type", value = "math 或 char", paramType = "query", dataType = "string")
+  @GetMapping("/captchaImage")
+  public AjaxResult getCode(String type) {
+    AjaxResult ajax = AjaxResult.success();
+    boolean captchaOnOff = configService.selectCaptchaOnOff();
+    ajax.put("captchaOnOff", captchaOnOff);
+    if (!captchaOnOff) {
+      return ajax;
+    }
 
-      String type = request.getParameter("type");
-      String capStr;
-      String code = null;
-      BufferedImage image = null;
-      if (type == null || "math".equals(type)) {
-        String capText = captchaProducerMath.createText();
-        capStr = capText.substring(0, capText.lastIndexOf("@"));
-        code = capText.substring(capText.lastIndexOf("@") + 1);
-        image = captchaProducerMath.createImage(capStr);
-      } else if ("char".equals(type)) {
-        capStr = code = captchaProducer.createText();
-        image = captchaProducer.createImage(capStr);
-      }
-      session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
-      out = response.getOutputStream();
-      assert image != null;
-      ImageIO.write(image, "jpg", out);
-      out.flush();
+    // 保存验证码信息
+    String uuid = IdUtils.simpleUUID();
+    String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
+    String capStr, code = null;
+    BufferedImage image = null;
 
-    } catch (Exception e) {
-      e.printStackTrace();
-    } finally {
-      try {
-        if (out != null) {
-          out.close();
-        }
-      } catch (IOException e) {
-        e.printStackTrace();
-      }
+    if(null == type){
+      type = this.captchaType;
     }
-    return null;
+
+    // 生成验证码
+    if ("math".equals(type)) {
+      String capText = captchaProducerMath.createText();
+      capStr = capText.substring(0, capText.lastIndexOf("@"));
+      code = capText.substring(capText.lastIndexOf("@") + 1);
+      image = captchaProducerMath.createImage(capStr);
+    } else if ("char".equals(captchaType)) {
+      capStr = code = captchaProducer.createText();
+      image = captchaProducer.createImage(capStr);
+    }
+
+    redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
+    // 转换流信息写出
+    FastByteArrayOutputStream os = new FastByteArrayOutputStream();
+    try {
+      assert image != null;
+      ImageIO.write(image, "jpg", os);
+    } catch (IOException e) {
+      return AjaxResult.error(e.getMessage());
+    }
+
+    ajax.put("uuid", uuid);
+    ajax.put("img", Base64.encode(os.toByteArray()));
+    return ajax;
   }
 }

+ 0 - 1
railway-admin/src/main/java/com/railway/web/controller/system/SysDeptController.java

@@ -9,7 +9,6 @@ import com.railway.common.enums.BusinessType;
 import com.railway.common.utils.StringUtils;
 import com.railway.system.service.ISysDeptService;
 import io.swagger.annotations.Api;
-import java.util.Iterator;
 import java.util.List;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.security.access.prepost.PreAuthorize;

+ 3 - 1
railway-admin/src/main/java/com/railway/web/controller/system/SysLoginController.java

@@ -70,9 +70,12 @@ public class SysLoginController {
     Set<String> roles = permissionService.getRolePermission(user);
     // 权限集合
     Set<String> permissions = permissionService.getMenuPermission(user);
+    // 菜单集合
+    Set<String> menus = menuService.selectMenuNameByUserId(user.getUserId());
     AjaxResult ajax = AjaxResult.success();
     ajax.put("user", user);
     ajax.put("roles", roles);
+    ajax.put("pages", menus);
     ajax.put("permissions", permissions);
     return ajax;
   }
@@ -82,7 +85,6 @@ public class SysLoginController {
    *
    * @return 路由信息
    */
-  @ApiOperation(value = "获取路由信息", notes = "获取路由信息", tags = {"登录验证 tags"}, response = AjaxResult.class)
   @GetMapping("getRouters")
   public AjaxResult getRouters() {
     Long userId = SecurityUtils.getUserId();

+ 2 - 0
railway-admin/src/main/resources/application.yml

@@ -12,6 +12,8 @@ railway:
   profile: D:/railway/uploadPath
   # 获取ip地址开关
   addressEnabled: false
+  # 验证码类型 math 数组计算 char 字符验证
+  captchaType: math
 
 # 开发环境配置
 server:

+ 0 - 2
railway-business/pom.xml

@@ -34,8 +34,6 @@
         <dependency>
             <groupId>io.swagger</groupId>
             <artifactId>swagger-annotations</artifactId>
-            <version>1.5.20</version>
-            <scope>compile</scope>
         </dependency>
     </dependencies>
 

+ 2 - 2
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusZzdzxxServiceImpl.java

@@ -25,7 +25,7 @@ private BusZzdzxxMapper busZzdzxxMapper;
 	*/
 	@Transactional(rollbackFor = Exception.class)
 	public int create(BusZzdzxx busZzdzxx) {
-		busZzdzxxMapper.insert(busZzdzxx);
+		return busZzdzxxMapper.insert(busZzdzxx);
 	}
 
 	/**
@@ -41,7 +41,7 @@ private BusZzdzxxMapper busZzdzxxMapper;
 	*/
 	@Transactional(rollbackFor = Exception.class)
 	public int update(BusZzdzxx busZzdzxx) {
-		busZzdzxxMapper.update(busZzdzxx);
+		return busZzdzxxMapper.update(busZzdzxx);
 	}
 
 	/**

+ 5 - 0
railway-common/pom.xml

@@ -122,6 +122,11 @@
       <artifactId>lombok</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>io.swagger</groupId>
+      <artifactId>swagger-annotations</artifactId>
+    </dependency>
+
   </dependencies>
 
 </project>

+ 7 - 0
railway-common/src/main/java/com/railway/common/core/domain/model/LoginBody.java

@@ -1,5 +1,7 @@
 package com.railway.common.core.domain.model;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
@@ -7,27 +9,32 @@ import lombok.Data;
  *
  * @author railway
  */
+@ApiModel(value = "用户登录接口入参")
 @Data
 public class LoginBody {
 
   /**
    * 用户名
    */
+  @ApiModelProperty(value = "用户名", required = true)
   private String username;
 
   /**
    * 用户密码
    */
+  @ApiModelProperty(value = "密码", required = true)
   private String password;
 
   /**
    * 验证码
    */
+  @ApiModelProperty(value = "验证码")
   private String code;
 
   /**
    * 唯一标识
    */
+  @ApiModelProperty(value = "验证码ID,获取验证码时返回的uuid")
   private String uuid = "";
 
 }

+ 0 - 54
railway-system/src/main/java/com/railway/system/mapper/SysUserOnlineMapper.java

@@ -1,54 +0,0 @@
-package com.railway.system.mapper;
-
-import java.util.List;
-import com.railway.system.domain.SysUserOnline;
-import org.springframework.stereotype.Repository;
-
-/**
- * 在线用户 数据层
- *
- * @author railway
- */
-@Repository
-public interface SysUserOnlineMapper {
-
-  /**
-   * 通过会话序号查询信息
-   *
-   * @param sessionId 会话ID
-   * @return 在线用户信息
-   */
-  SysUserOnline selectOnlineById(String sessionId);
-
-  /**
-   * 通过会话序号删除信息
-   *
-   * @param sessionId 会话ID
-   * @return 在线用户信息
-   */
-  int deleteOnlineById(String sessionId);
-
-  /**
-   * 保存会话信息
-   *
-   * @param online 会话信息
-   * @return 结果
-   */
-  int saveOnline(SysUserOnline online);
-
-  /**
-   * 查询会话集合
-   *
-   * @param userOnline 会话参数
-   * @return 会话集合
-   */
-  List<SysUserOnline> selectUserOnlineList(SysUserOnline userOnline);
-
-  /**
-   * 查询过期会话集合
-   *
-   * @param lastAccessTime 过期时间
-   * @return 会话集合
-   */
-  List<SysUserOnline> selectOnlineByExpired(String lastAccessTime);
-}

+ 8 - 0
railway-system/src/main/java/com/railway/system/service/ISysMenuService.java

@@ -38,6 +38,14 @@ public interface ISysMenuService {
    */
   Set<String> selectMenuPermsByUserId(Long userId);
 
+  /**
+   * 根据用户ID查询菜单信息
+   *
+   * @param userId 用户ID
+   * @return 菜单列表
+   */
+  Set<String> selectMenuNameByUserId(Long userId);
+
   /**
    * 根据用户ID查询菜单树信息
    *

+ 21 - 0
railway-system/src/main/java/com/railway/system/service/impl/SysMenuServiceImpl.java

@@ -90,6 +90,27 @@ public class SysMenuServiceImpl implements ISysMenuService {
     return permsSet;
   }
 
+  /**
+   * 根据用户ID查询菜单信息
+   *
+   * @param userId 用户ID
+   * @return 菜单列表
+   */
+  @Override
+  public Set<String> selectMenuNameByUserId(Long userId) {
+    List<SysMenu> menus;
+    if (SecurityUtils.isAdmin(userId)) {
+      menus = menuMapper.selectMenuTreeAll();
+    } else {
+      menus = menuMapper.selectMenuTreeByUserId(userId);
+    }
+    Set<String> menuSet = new HashSet<>();
+    for(SysMenu menu : menus){
+      menuSet.add(menu.getPath());
+    }
+    return menuSet;
+  }
+
   /**
    * 根据用户ID查询菜单
    *

+ 0 - 61
railway-system/src/main/resources/mapper/system/SysUserOnlineMapper.xml

@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.railway.system.mapper.SysUserOnlineMapper">
-
-  <resultMap type="SysUserOnline" id="SysUserOnlineResult">
-    <id property="sessionId" column="sessionId"/>
-    <result property="loginName" column="login_name"/>
-    <result property="deptName" column="dept_name"/>
-    <result property="ipaddr" column="ipaddr"/>
-    <result property="loginLocation" column="login_location"/>
-    <result property="browser" column="browser"/>
-    <result property="os" column="os"/>
-    <result property="status" column="status"/>
-    <result property="startTimestamp" column="start_timestamp"/>
-    <result property="lastAccessTime" column="last_access_time"/>
-    <result property="expireTime" column="expire_time"/>
-  </resultMap>
-
-  <sql id="selectOnlineVo">
-    select sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status,
-    start_timestamp, last_access_time, expire_time
-    from sys_user_online
-  </sql>
-
-  <select id="selectOnlineById" parameterType="String" resultMap="SysUserOnlineResult">
-    <include refid="selectOnlineVo"/>
-    where sessionId = #{sessionId}
-  </select>
-
-  <insert id="saveOnline" parameterType="SysUserOnline">
-    replace into sys_user_online(sessionId, login_name, dept_name, ipaddr, login_location, browser,
-    os, status, start_timestamp, last_access_time, expire_time)
-    values (#{sessionId}, #{loginName}, #{deptName}, #{ipaddr}, #{loginLocation}, #{browser}, #{os},
-    #{status}, #{startTimestamp}, #{lastAccessTime}, #{expireTime})
-  </insert>
-
-  <delete id="deleteOnlineById" parameterType="String">
-    delete from sys_user_online where sessionId = #{sessionId}
-  </delete>
-
-  <select id="selectUserOnlineList" parameterType="SysUserOnline" resultMap="SysUserOnlineResult">
-    <include refid="selectOnlineVo"/>
-    <where>
-      <if test="ipaddr != null and ipaddr != ''">
-        AND ipaddr like concat('%', #{ipaddr}, '%')
-      </if>
-      <if test="loginName != null and loginName != ''">
-        AND login_name like concat('%', #{loginName}, '%')
-      </if>
-    </where>
-  </select>
-
-  <select id="selectOnlineByExpired" parameterType="String" resultMap="SysUserOnlineResult">
-    <include refid="selectOnlineVo"/>
-    o
-    WHERE o.last_access_time <![CDATA[ <= ]]> #{lastAccessTime} ORDER BY o.last_access_time ASC
-  </select>
-
-</mapper>