作者 RuoYi

优化代码

@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 <velocity.version>2.3</velocity.version> 31 <velocity.version>2.3</velocity.version>
32 <jwt.version>0.9.1</jwt.version> 32 <jwt.version>0.9.1</jwt.version>
33 <!-- override dependency version --> 33 <!-- override dependency version -->
34 - <tomcat.version>9.0.100</tomcat.version> 34 + <tomcat.version>9.0.98</tomcat.version>
35 <logback.version>1.2.13</logback.version> 35 <logback.version>1.2.13</logback.version>
36 <spring-security.version>5.7.12</spring-security.version> 36 <spring-security.version>5.7.12</spring-security.version>
37 <spring-framework.version>5.3.39</spring-framework.version> 37 <spring-framework.version>5.3.39</spring-framework.version>
1 package com.ruoyi.common.utils.spring; 1 package com.ruoyi.common.utils.spring;
2 2
  3 +import org.springframework.aop.framework.Advised;
3 import org.springframework.aop.framework.AopContext; 4 import org.springframework.aop.framework.AopContext;
4 import org.springframework.beans.BeansException; 5 import org.springframework.beans.BeansException;
5 import org.springframework.beans.factory.NoSuchBeanDefinitionException; 6 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
@@ -120,7 +121,12 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC @@ -120,7 +121,12 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
120 @SuppressWarnings("unchecked") 121 @SuppressWarnings("unchecked")
121 public static <T> T getAopProxy(T invoker) 122 public static <T> T getAopProxy(T invoker)
122 { 123 {
123 - return (T) AopContext.currentProxy(); 124 + Object proxy = AopContext.currentProxy();
  125 + if (((Advised) proxy).getTargetSource().getTargetClass() == invoker.getClass())
  126 + {
  127 + return (T) proxy;
  128 + }
  129 + return invoker;
124 } 130 }
125 131
126 /** 132 /**
@@ -71,9 +71,9 @@ public class ${ClassName} extends ${Entity} @@ -71,9 +71,9 @@ public class ${ClassName} extends ${Entity}
71 { 71 {
72 return $column.javaField; 72 return $column.javaField;
73 } 73 }
  74 +
74 #end 75 #end
75 #end 76 #end
76 -  
77 #if($table.sub) 77 #if($table.sub)
78 public List<${subClassName}> get${subClassName}List() 78 public List<${subClassName}> get${subClassName}List()
79 { 79 {
@@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
75 icon="el-icon-plus" 75 icon="el-icon-plus"
76 size="mini" 76 size="mini"
77 @click="handleAdd" 77 @click="handleAdd"
78 - v-hasPermi="['${moduleName}:${businessName}:add']" 78 + v-hasPermi="['${permissionPrefix}:add']"
79 >新增</el-button> 79 >新增</el-button>
80 </el-col> 80 </el-col>
81 <el-col :span="1.5"> 81 <el-col :span="1.5">
@@ -144,21 +144,21 @@ @@ -144,21 +144,21 @@
144 type="text" 144 type="text"
145 icon="el-icon-edit" 145 icon="el-icon-edit"
146 @click="handleUpdate(scope.row)" 146 @click="handleUpdate(scope.row)"
147 - v-hasPermi="['${moduleName}:${businessName}:edit']" 147 + v-hasPermi="['${permissionPrefix}:edit']"
148 >修改</el-button> 148 >修改</el-button>
149 <el-button 149 <el-button
150 size="mini" 150 size="mini"
151 type="text" 151 type="text"
152 icon="el-icon-plus" 152 icon="el-icon-plus"
153 @click="handleAdd(scope.row)" 153 @click="handleAdd(scope.row)"
154 - v-hasPermi="['${moduleName}:${businessName}:add']" 154 + v-hasPermi="['${permissionPrefix}:add']"
155 >新增</el-button> 155 >新增</el-button>
156 <el-button 156 <el-button
157 size="mini" 157 size="mini"
158 type="text" 158 type="text"
159 icon="el-icon-delete" 159 icon="el-icon-delete"
160 @click="handleDelete(scope.row)" 160 @click="handleDelete(scope.row)"
161 - v-hasPermi="['${moduleName}:${businessName}:remove']" 161 + v-hasPermi="['${permissionPrefix}:remove']"
162 >删除</el-button> 162 >删除</el-button>
163 </template> 163 </template>
164 </el-table-column> 164 </el-table-column>
@@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
75 icon="el-icon-plus" 75 icon="el-icon-plus"
76 size="mini" 76 size="mini"
77 @click="handleAdd" 77 @click="handleAdd"
78 - v-hasPermi="['${moduleName}:${businessName}:add']" 78 + v-hasPermi="['${permissionPrefix}:add']"
79 >新增</el-button> 79 >新增</el-button>
80 </el-col> 80 </el-col>
81 <el-col :span="1.5"> 81 <el-col :span="1.5">
@@ -86,7 +86,7 @@ @@ -86,7 +86,7 @@
86 size="mini" 86 size="mini"
87 :disabled="single" 87 :disabled="single"
88 @click="handleUpdate" 88 @click="handleUpdate"
89 - v-hasPermi="['${moduleName}:${businessName}:edit']" 89 + v-hasPermi="['${permissionPrefix}:edit']"
90 >修改</el-button> 90 >修改</el-button>
91 </el-col> 91 </el-col>
92 <el-col :span="1.5"> 92 <el-col :span="1.5">
@@ -97,7 +97,7 @@ @@ -97,7 +97,7 @@
97 size="mini" 97 size="mini"
98 :disabled="multiple" 98 :disabled="multiple"
99 @click="handleDelete" 99 @click="handleDelete"
100 - v-hasPermi="['${moduleName}:${businessName}:remove']" 100 + v-hasPermi="['${permissionPrefix}:remove']"
101 >删除</el-button> 101 >删除</el-button>
102 </el-col> 102 </el-col>
103 <el-col :span="1.5"> 103 <el-col :span="1.5">
@@ -107,7 +107,7 @@ @@ -107,7 +107,7 @@
107 icon="el-icon-download" 107 icon="el-icon-download"
108 size="mini" 108 size="mini"
109 @click="handleExport" 109 @click="handleExport"
110 - v-hasPermi="['${moduleName}:${businessName}:export']" 110 + v-hasPermi="['${permissionPrefix}:export']"
111 >导出</el-button> 111 >导出</el-button>
112 </el-col> 112 </el-col>
113 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> 113 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@@ -158,14 +158,14 @@ @@ -158,14 +158,14 @@
158 type="text" 158 type="text"
159 icon="el-icon-edit" 159 icon="el-icon-edit"
160 @click="handleUpdate(scope.row)" 160 @click="handleUpdate(scope.row)"
161 - v-hasPermi="['${moduleName}:${businessName}:edit']" 161 + v-hasPermi="['${permissionPrefix}:edit']"
162 >修改</el-button> 162 >修改</el-button>
163 <el-button 163 <el-button
164 size="mini" 164 size="mini"
165 type="text" 165 type="text"
166 icon="el-icon-delete" 166 icon="el-icon-delete"
167 @click="handleDelete(scope.row)" 167 @click="handleDelete(scope.row)"
168 - v-hasPermi="['${moduleName}:${businessName}:remove']" 168 + v-hasPermi="['${permissionPrefix}:remove']"
169 >删除</el-button> 169 >删除</el-button>
170 </template> 170 </template>
171 </el-table-column> 171 </el-table-column>
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 plain 73 plain
74 icon="Plus" 74 icon="Plus"
75 @click="handleAdd" 75 @click="handleAdd"
76 - v-hasPermi="['${moduleName}:${businessName}:add']" 76 + v-hasPermi="['${permissionPrefix}:add']"
77 >新增</el-button> 77 >新增</el-button>
78 </el-col> 78 </el-col>
79 <el-col :span="1.5"> 79 <el-col :span="1.5">
@@ -136,9 +136,9 @@ @@ -136,9 +136,9 @@
136 #end 136 #end
137 <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> 137 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
138 <template #default="scope"> 138 <template #default="scope">
139 - <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">修改</el-button>  
140 - <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${moduleName}:${businessName}:add']">新增</el-button>  
141 - <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button> 139 + <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
  140 + <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${permissionPrefix}:add']">新增</el-button>
  141 + <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
142 </template> 142 </template>
143 </el-table-column> 143 </el-table-column>
144 </el-table> 144 </el-table>
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 plain 73 plain
74 icon="Plus" 74 icon="Plus"
75 @click="handleAdd" 75 @click="handleAdd"
76 - v-hasPermi="['${moduleName}:${businessName}:add']" 76 + v-hasPermi="['${permissionPrefix}:add']"
77 >新增</el-button> 77 >新增</el-button>
78 </el-col> 78 </el-col>
79 <el-col :span="1.5"> 79 <el-col :span="1.5">
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 icon="Edit" 83 icon="Edit"
84 :disabled="single" 84 :disabled="single"
85 @click="handleUpdate" 85 @click="handleUpdate"
86 - v-hasPermi="['${moduleName}:${businessName}:edit']" 86 + v-hasPermi="['${permissionPrefix}:edit']"
87 >修改</el-button> 87 >修改</el-button>
88 </el-col> 88 </el-col>
89 <el-col :span="1.5"> 89 <el-col :span="1.5">
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 icon="Delete" 93 icon="Delete"
94 :disabled="multiple" 94 :disabled="multiple"
95 @click="handleDelete" 95 @click="handleDelete"
96 - v-hasPermi="['${moduleName}:${businessName}:remove']" 96 + v-hasPermi="['${permissionPrefix}:remove']"
97 >删除</el-button> 97 >删除</el-button>
98 </el-col> 98 </el-col>
99 <el-col :span="1.5"> 99 <el-col :span="1.5">
@@ -102,7 +102,7 @@ @@ -102,7 +102,7 @@
102 plain 102 plain
103 icon="Download" 103 icon="Download"
104 @click="handleExport" 104 @click="handleExport"
105 - v-hasPermi="['${moduleName}:${businessName}:export']" 105 + v-hasPermi="['${permissionPrefix}:export']"
106 >导出</el-button> 106 >导出</el-button>
107 </el-col> 107 </el-col>
108 <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> 108 <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
@@ -148,8 +148,8 @@ @@ -148,8 +148,8 @@
148 #end 148 #end
149 <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> 149 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
150 <template #default="scope"> 150 <template #default="scope">
151 - <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">修改</el-button>  
152 - <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button> 151 + <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
  152 + <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
153 </template> 153 </template>
154 </el-table-column> 154 </el-table-column>
155 </el-table> 155 </el-table>
@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 <div class="navbar"> 2 <div class="navbar">
3 <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> 3 <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
4 4
5 - <breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>  
6 - <top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/> 5 + <breadcrumb v-if="!topNav" id="breadcrumb-container" class="breadcrumb-container" />
  6 + <top-nav v-if="topNav" id="topmenu-container" class="topmenu-container" />
7 7
8 <div class="right-menu"> 8 <div class="right-menu">
9 <template v-if="device!=='mobile'"> 9 <template v-if="device!=='mobile'">
@@ -95,16 +95,16 @@ export default { @@ -95,16 +95,16 @@ export default {
95 toggleSideBar() { 95 toggleSideBar() {
96 this.$store.dispatch('app/toggleSideBar') 96 this.$store.dispatch('app/toggleSideBar')
97 }, 97 },
98 - async logout() { 98 + logout() {
99 this.$confirm('确定注销并退出系统吗?', '提示', { 99 this.$confirm('确定注销并退出系统吗?', '提示', {
100 confirmButtonText: '确定', 100 confirmButtonText: '确定',
101 cancelButtonText: '取消', 101 cancelButtonText: '取消',
102 type: 'warning' 102 type: 'warning'
103 }).then(() => { 103 }).then(() => {
104 this.$store.dispatch('LogOut').then(() => { 104 this.$store.dispatch('LogOut').then(() => {
105 - location.href = '/index'; 105 + location.href = '/index'
106 }) 106 })
107 - }).catch(() => {}); 107 + }).catch(() => {})
108 } 108 }
109 } 109 }
110 } 110 }