From 98941acd2aadf435058412b4abe61fb6437433e8 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 20 五月 2020 09:15:19 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue --- ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java | 3 + ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java | 22 ++++--- ruoyi-ui/src/views/system/dept/index.vue | 16 ++--- ruoyi/src/main/java/com/ruoyi/framework/web/controller/BaseController.java | 1 ruoyi-ui/src/views/monitor/job/index.vue | 2 ruoyi-ui/src/views/monitor/operlog/index.vue | 2 README.md | 27 +++----- ruoyi-ui/src/utils/request.js | 33 +++++++---- ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java | 16 ++--- ruoyi/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/DataSource.java | 4 + ruoyi-ui/src/utils/errorCode.js | 6 ++ ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java | 1 ruoyi/src/main/resources/application.yml | 5 + ruoyi/src/main/java/com/ruoyi/framework/web/page/TableDataInfo.java | 6 +- ruoyi/src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java | 3 + ruoyi-ui/src/api/system/dept.js | 8 ++ ruoyi-ui/src/views/monitor/logininfor/index.vue | 2 ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java | 23 +++++++ 18 files changed, 116 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 526d956..49e75af 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,12 @@ ## 骞冲彴绠�浠� -涓�鐩存兂鍋氫竴娆惧悗鍙扮鐞嗙郴缁燂紝鐪嬩簡寰堝浼樼鐨勫紑婧愰」鐩絾鏄彂鐜版病鏈夊悎閫傜殑銆備簬鏄埄鐢ㄧ┖闂蹭紤鎭椂闂村紑濮嬭嚜宸卞啓浜嗕竴濂楀悗鍙扮郴缁熴�傚姝ゆ湁浜嗚嫢渚濄�傚ス鍙互鐢ㄤ簬鎵�鏈夌殑Web搴旂敤绋嬪簭锛屽缃戠珯绠$悊鍚庡彴锛岀綉绔欎細鍛樹腑蹇冿紝CMS锛孋RM锛孫A銆傛墍鏈夊墠绔悗鍙颁唬鐮佸皝瑁呰繃鍚庡崄鍒嗙簿绠�鏄撲笂鎵嬶紝鍑洪敊姒傜巼浣庛�傚悓鏃舵敮鎸佺Щ鍔ㄥ鎴风璁块棶銆傜郴缁熶細闄嗙画鏇存柊涓�浜涘疄鐢ㄥ姛鑳姐�� - -鎬у埆鐢凤紝鑻ヤ緷鏄粰杩樻病鏈夊嚭鐢熷コ鍎垮彇鐨勫悕瀛楋紙瀵撴剰锛氫綘鑻ヤ笉绂讳笉寮冿紝鎴戝繀鐢熸鐩镐緷锛� - -鍙傝�冨悗鍙版ā鏉縖vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) - -> 闃块噷浜戞湇鍔″櫒89鍏�/骞达紝鍙�12骞存湯鐗规儬锛岀垎娆句骇鍝侀檺鏃�1鎶� 锛歔鐐规垜杩涘叆](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link) - -> 濡傞渶涓嶅垎绂诲簲鐢紝璇风Щ姝� [RuoYi](https://gitee.com/y_project/RuoYi) `(淇濇寔鍚屾鏇存柊)`锛屽闇�鍏朵粬鐗堟湰锛岃绉绘 [椤圭洰鎵╁睍](http://doc.ruoyi.vip/ruoyi/document/xmkz.html) `(涓嶅畾鏃舵洿鏂�)` - -> 闃块噷浜戦�氱敤浜戜骇鍝�1888浼樻儬鍒� 锛歔鐐规垜棰嗗彇](https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=brki8iof) 鑵捐浜戦�氱敤浜戜骇鍝�2860浼樻儬鍒� 锛歔鐐规垜棰嗗彇](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console) `(浠呴檺鏂扮敤鎴�)` - -> 闃块噷浜慔i鎷艰喘 闄愰噺鐖嗘 浣庤嚦199鍏�/骞� [鐐规垜杩涘叆](https://www.aliyun.com/acts/hi-group-buying?userCode=brki8iof) `(浠呴檺鏂扮敤鎴�)` +* 鍓嶇閲囩敤Vue銆丒lement UI銆乂ue-Element-Admin銆� +* 鍚庣閲囩敤Spring Boot銆丼pring Security銆丷edis & Jwt銆� +* 鏉冮檺璁よ瘉浣跨敤Jwt锛屾敮鎸佸缁堢璁よ瘉绯荤粺銆� +* 鏀寔鍔犺浇鍔ㄦ�佹潈闄愯彍鍗曪紝澶氭柟寮忚交鏉炬潈闄愭帶鍒躲�� +* 楂樻晥鐜囧紑鍙戯紝浣跨敤浠g爜鐢熸垚鍣ㄥ彲浠ヤ竴閿敓鎴愬墠鍚庣浠g爜銆� +* 涓嶅垎绂荤増鏈紝璇风Щ姝RuoYi](https://gitee.com/y_project/RuoYi)锛屽井鏈嶅姟鐗堟湰锛岃绉绘[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) +* 闃块噷浜戜紭鎯犲埜锛歔鐐规垜杩涘叆](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link)锛岃吘璁簯浼樻儬鍒革細[鐐规垜棰嗗彇](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console) ## 鍐呯疆鍔熻兘 @@ -33,12 +27,13 @@ 15. 鏈嶅姟鐩戞帶锛氱洃瑙嗗綋鍓嶇郴缁烠PU銆佸唴瀛樸�佺鐩樸�佸爢鏍堢瓑鐩稿叧淇℃伅銆� 16. 鍦ㄧ嚎鏋勫缓鍣細鎷栧姩琛ㄥ崟鍏冪礌鐢熸垚鐩稿簲鐨凥TML浠g爜銆� 17. 杩炴帴姹犵洃瑙嗭細鐩戣褰撳墠绯荤粺鏁版嵁搴撹繛鎺ユ睜鐘舵�侊紝鍙繘琛屽垎鏋怱QL鎵惧嚭绯荤粺鎬ц兘鐡堕銆� + ## 鍦ㄧ嚎浣撻獙 -> admin/admin123 -> 闄嗛檰缁画鏀跺埌涓�浜涙墦璧忥紝涓轰簡鏇村ソ鐨勪綋楠屽凡鐢ㄤ簬婕旂ず鏈嶅姟鍣ㄥ崌绾с�傝阿璋㈠悇浣嶅皬浼欎即銆� + +- admin/admin123 +- 闄嗛檰缁画鏀跺埌涓�浜涙墦璧忥紝涓轰簡鏇村ソ鐨勪綋楠屽凡鐢ㄤ簬婕旂ず鏈嶅姟鍣ㄥ崌绾с�傝阿璋㈠悇浣嶅皬浼欎即銆� 婕旂ず鍦板潃锛歨ttp://vue.ruoyi.vip - 鏂囨。鍦板潃锛歨ttp://doc.ruoyi.vip ## 婕旂ず鍥� diff --git a/ruoyi-ui/src/api/system/dept.js b/ruoyi-ui/src/api/system/dept.js index c26894c..2804676 100644 --- a/ruoyi-ui/src/api/system/dept.js +++ b/ruoyi-ui/src/api/system/dept.js @@ -9,6 +9,14 @@ }) } +// 鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級 +export function listDeptExcludeChild(deptId) { + return request({ + url: '/system/dept/list/exclude/' + deptId, + method: 'get' + }) +} + // 鏌ヨ閮ㄩ棬璇︾粏 export function getDept(deptId) { return request({ diff --git a/ruoyi-ui/src/utils/errorCode.js b/ruoyi-ui/src/utils/errorCode.js new file mode 100644 index 0000000..d2111ee --- /dev/null +++ b/ruoyi-ui/src/utils/errorCode.js @@ -0,0 +1,6 @@ +export default { + '401': '璁よ瘉澶辫触锛屾棤娉曡闂郴缁熻祫婧�', + '403': '褰撳墠鎿嶄綔娌℃湁鏉冮檺', + '404': '璁块棶璧勬簮涓嶅瓨鍦�', + 'default': '绯荤粺鏈煡閿欒锛岃鍙嶉缁欑鐞嗗憳' +} diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index 6961649..7a0653d 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -2,6 +2,7 @@ import { Notification, MessageBox, Message } from 'element-ui' import store from '@/store' import { getToken } from '@/utils/auth' +import errorCode from '@/utils/errorCode' axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' // 鍒涘缓axios瀹炰緥 @@ -12,22 +13,24 @@ timeout: 10000 }) // request鎷︽埅鍣� -service.interceptors.request.use( - config => { - if (getToken()) { - config.headers['Authorization'] = 'Bearer ' + getToken() // 璁╂瘡涓姹傛惡甯﹁嚜瀹氫箟token 璇锋牴鎹疄闄呮儏鍐佃嚜琛屼慨鏀� - } - return config - }, - error => { +service.interceptors.request.use(config => { + // 鏄惁闇�瑕佽缃� token + const isToken = (config.headers || {}).isToken === false + if (getToken() && !isToken) { + config.headers['Authorization'] = 'Bearer ' + getToken() // 璁╂瘡涓姹傛惡甯﹁嚜瀹氫箟token 璇锋牴鎹疄闄呮儏鍐佃嚜琛屼慨鏀� + } + return config +}, error => { console.log(error) Promise.reject(error) - } -) +}) // 鍝嶅簲鎷︽埅鍣� service.interceptors.response.use(res => { - const code = res.data.code + // 鏈缃姸鎬佺爜鍒欓粯璁ゆ垚鍔熺姸鎬� + const code = res.data.code || 200; + // 鑾峰彇閿欒淇℃伅 + const message = errorCode[code] || res.data.msg || errorCode['default'] if (code === 401) { MessageBox.confirm( '鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', @@ -42,9 +45,15 @@ location.reload() // 涓轰簡閲嶆柊瀹炰緥鍖杤ue-router瀵硅薄 閬垮厤bug }) }) + } else if (code === 500) { + Message({ + message: message, + type: 'error' + }) + return Promise.reject(new Error(message)) } else if (code !== 200) { Notification.error({ - title: res.data.msg + title: message }) return Promise.reject('error') } else { diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index a7bb98c..3a69360 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -397,7 +397,7 @@ type: "warning" }).then(function() { return runJob(row.jobId, row.jobGroup); - }).then(function() { + }).then(() => { this.msgSuccess("鎵ц鎴愬姛"); }).catch(function() {}); }, diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue index e9d731b..c92b55e 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -91,7 +91,7 @@ <el-table-column label="璁块棶缂栧彿" align="center" prop="infoId" /> <el-table-column label="鐢ㄦ埛鍚嶇О" align="center" prop="userName" /> <el-table-column label="鐧诲綍鍦板潃" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" /> - <el-table-column label="鐧诲綍鍦扮偣" align="center" prop="loginLocation" /> + <el-table-column label="鐧诲綍鍦扮偣" align="center" prop="loginLocation" :show-overflow-tooltip="true" /> <el-table-column label="娴忚鍣�" align="center" prop="browser" /> <el-table-column label="鎿嶄綔绯荤粺" align="center" prop="os" /> <el-table-column label="鐧诲綍鐘舵��" align="center" prop="status" :formatter="statusFormat" /> diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue index 3b6988d..d593698 100644 --- a/ruoyi-ui/src/views/monitor/operlog/index.vue +++ b/ruoyi-ui/src/views/monitor/operlog/index.vue @@ -110,7 +110,7 @@ <el-table-column label="璇锋眰鏂瑰紡" align="center" prop="requestMethod" /> <el-table-column label="鎿嶄綔浜哄憳" align="center" prop="operName" /> <el-table-column label="涓绘満" align="center" prop="operIp" width="130" :show-overflow-tooltip="true" /> - <el-table-column label="鎿嶄綔鍦扮偣" align="center" prop="operLocation" /> + <el-table-column label="鎿嶄綔鍦扮偣" align="center" prop="operLocation" :show-overflow-tooltip="true" /> <el-table-column label="鎿嶄綔鐘舵��" align="center" prop="status" :formatter="statusFormat" /> <el-table-column label="鎿嶄綔鏃ユ湡" align="center" prop="operTime" width="180"> <template slot-scope="scope"> diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index 15e38b1..b503d85 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -138,7 +138,7 @@ </template> <script> -import { listDept, getDept, delDept, addDept, updateDept } from "@/api/system/dept"; +import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; @@ -220,12 +220,6 @@ children: node.children }; }, - /** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */ - getTreeselect() { - listDept().then(response => { - this.deptOptions = this.handleTree(response.data, "deptId"); - }); - }, // 瀛楀吀鐘舵�佸瓧鍏哥炕璇� statusFormat(row, column) { return this.selectDictLabel(this.statusOptions, row.status); @@ -256,22 +250,26 @@ /** 鏂板鎸夐挳鎿嶄綔 */ handleAdd(row) { this.reset(); - this.getTreeselect(); if (row != undefined) { this.form.parentId = row.deptId; } this.open = true; this.title = "娣诲姞閮ㄩ棬"; + listDept().then(response => { + this.deptOptions = this.handleTree(response.data, "deptId"); + }); }, /** 淇敼鎸夐挳鎿嶄綔 */ handleUpdate(row) { this.reset(); - this.getTreeselect(); getDept(row.deptId).then(response => { this.form = response.data; this.open = true; this.title = "淇敼閮ㄩ棬"; }); + listDeptExcludeChild(row.deptId).then(response => { + this.deptOptions = this.handleTree(response.data, "deptId"); + }); }, /** 鎻愪氦鎸夐挳 */ submitForm: function() { diff --git a/ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java b/ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java index ae3d8e3..c2bb892 100644 --- a/ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java +++ b/ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java @@ -1,6 +1,6 @@ package com.ruoyi.framework.aspectj; -import java.lang.reflect.Method; +import java.util.Objects; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; @@ -8,6 +8,7 @@ import org.aspectj.lang.reflect.MethodSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.ruoyi.common.utils.StringUtils; @@ -60,17 +61,12 @@ public DataSource getDataSource(ProceedingJoinPoint point) { MethodSignature signature = (MethodSignature) point.getSignature(); - Class<? extends Object> targetClass = point.getTarget().getClass(); - DataSource targetDataSource = targetClass.getAnnotation(DataSource.class); - if (StringUtils.isNotNull(targetDataSource)) + DataSource dataSource = AnnotationUtils.findAnnotation(signature.getMethod(), DataSource.class); + if (Objects.nonNull(dataSource)) { - return targetDataSource; - } - else - { - Method method = signature.getMethod(); - DataSource dataSource = method.getAnnotation(DataSource.class); return dataSource; } + + return AnnotationUtils.findAnnotation(signature.getDeclaringType(), DataSource.class); } } diff --git a/ruoyi/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/DataSource.java b/ruoyi/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/DataSource.java index a89c7b9..e5a780e 100644 --- a/ruoyi/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/DataSource.java +++ b/ruoyi/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/DataSource.java @@ -10,7 +10,9 @@ /** * 鑷畾涔夊鏁版嵁婧愬垏鎹㈡敞瑙� - * + * + * 浼樺厛绾э細鍏堟柟娉曪紝鍚庣被锛屽鏋滄柟娉曡鐩栦簡绫讳笂鐨勬暟鎹簮绫诲瀷锛屼互鏂规硶鐨勪负鍑嗭紝鍚﹀垯浠ョ被涓婄殑涓哄噯 + * * @author ruoyi */ @Target({ ElementType.METHOD, ElementType.TYPE }) diff --git a/ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java b/ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index 92fc5d1..692bb30 100644 --- a/ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java +++ b/ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java @@ -33,9 +33,13 @@ @Autowired private RuoYiConfig ruoyiConfig; - /** Swagger寮�鍏抽厤缃� */ - @Value("${swagger.enable}") - private boolean swaggerEnable; + /** 鏄惁寮�鍚痵wagger */ + @Value("${swagger.enabled}") + private boolean enabled; + + /** 璁剧疆璇锋眰鐨勭粺涓�鍓嶇紑 */ + @Value("${swagger.pathMapping}") + private String pathMapping; /** * 鍒涘缓API @@ -45,8 +49,7 @@ { return new Docket(DocumentationType.SWAGGER_2) // 鏄惁鍚敤Swagger - .enable(swaggerEnable) - .pathMapping("/dev-api") + .enable(enabled) // 鐢ㄦ潵鍒涘缓璇PI鐨勫熀鏈俊鎭紝灞曠ず鍦ㄦ枃妗g殑椤甸潰涓紙鑷畾涔夊睍绀虹殑淇℃伅锛� .apiInfo(apiInfo()) // 璁剧疆鍝簺鎺ュ彛鏆撮湶缁橲wagger灞曠ず @@ -54,13 +57,14 @@ // 鎵弿鎵�鏈夋湁娉ㄨВ鐨刟pi锛岀敤杩欑鏂瑰紡鏇寸伒娲� .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) // 鎵弿鎸囧畾鍖呬腑鐨剆wagger娉ㄨВ - //.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) + // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) // 鎵弿鎵�鏈� .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build() /* 璁剧疆瀹夊叏妯″紡锛宻wagger鍙互璁剧疆璁块棶token */ .securitySchemes(securitySchemes()) - .securityContexts(securityContexts()); + .securityContexts(securityContexts()) + .pathMapping(pathMapping); } /** @@ -72,7 +76,7 @@ apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); return apiKeyList; } - + /** * 瀹夊叏涓婁笅鏂� */ @@ -86,7 +90,7 @@ .build()); return securityContexts; } - + /** * 榛樿鐨勫畨鍏ㄤ笂寮曠敤 */ diff --git a/ruoyi/src/main/java/com/ruoyi/framework/web/controller/BaseController.java b/ruoyi/src/main/java/com/ruoyi/framework/web/controller/BaseController.java index 58e6cc1..d131e70 100644 --- a/ruoyi/src/main/java/com/ruoyi/framework/web/controller/BaseController.java +++ b/ruoyi/src/main/java/com/ruoyi/framework/web/controller/BaseController.java @@ -67,6 +67,7 @@ { TableDataInfo rspData = new TableDataInfo(); rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("鏌ヨ鎴愬姛"); rspData.setRows(list); rspData.setTotal(new PageInfo(list).getTotal()); return rspData; diff --git a/ruoyi/src/main/java/com/ruoyi/framework/web/page/TableDataInfo.java b/ruoyi/src/main/java/com/ruoyi/framework/web/page/TableDataInfo.java index a01a9ae..c44e527 100644 --- a/ruoyi/src/main/java/com/ruoyi/framework/web/page/TableDataInfo.java +++ b/ruoyi/src/main/java/com/ruoyi/framework/web/page/TableDataInfo.java @@ -22,7 +22,7 @@ private int code; /** 娑堟伅鍐呭 */ - private int msg; + private String msg; /** * 琛ㄦ牸鏁版嵁瀵硅薄 @@ -73,12 +73,12 @@ this.code = code; } - public int getMsg() + public String getMsg() { return msg; } - public void setMsg(int msg) + public void setMsg(String msg) { this.msg = msg; } diff --git a/ruoyi/src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java b/ruoyi/src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java index dc287de..ba11816 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/monitor/controller/SysJobLogController.java @@ -76,6 +76,9 @@ return toAjax(jobLogService.deleteJobLogByIds(jobLogIds)); } + /** + * 娓呯┖瀹氭椂浠诲姟璋冨害鏃ュ織 + */ @PreAuthorize("@ss.hasPermi('monitor:job:remove')") @Log(title = "璋冨害鏃ュ織", businessType = BusinessType.CLEAN) @DeleteMapping("/clean") diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java b/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java index 3c2cb0b..57154ec 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java @@ -1,6 +1,8 @@ package com.ruoyi.project.system.controller; +import java.util.Iterator; import java.util.List; +import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -46,6 +48,27 @@ } /** + * 鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級 + */ + @PreAuthorize("@ss.hasPermi('system:dept:list')") + @GetMapping("/list/exclude/{deptId}") + public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) + { + List<SysDept> depts = deptService.selectDeptList(new SysDept()); + Iterator<SysDept> it = depts.iterator(); + while (it.hasNext()) + { + SysDept d = (SysDept) it.next(); + if (d.getDeptId().intValue() == deptId + || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) + { + it.remove(); + } + } + return AjaxResult.success(depts); + } + + /** * 鏍规嵁閮ㄩ棬缂栧彿鑾峰彇璇︾粏淇℃伅 */ @PreAuthorize("@ss.hasPermi('system:dept:query')") diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java index 82e2e74..9ab87a3 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java @@ -114,6 +114,7 @@ * @param deptId 閮ㄩ棬ID * @return 瀛愰儴闂ㄦ暟 */ + @Override public int selectNormalChildrenDeptById(Long deptId) { return deptMapper.selectNormalChildrenDeptById(deptId); diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java index d719e42..10d7d65 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java @@ -124,6 +124,9 @@ return AjaxResult.success(); } + /** + * 鍒犻櫎浠g爜鐢熸垚 + */ @PreAuthorize("@ss.hasPermi('tool:gen:remove')") @Log(title = "浠g爜鐢熸垚", businessType = BusinessType.DELETE) @DeleteMapping("/{tableIds}") diff --git a/ruoyi/src/main/resources/application.yml b/ruoyi/src/main/resources/application.yml index 40afbec..c569e0e 100644 --- a/ruoyi/src/main/resources/application.yml +++ b/ruoyi/src/main/resources/application.yml @@ -118,7 +118,10 @@ # Swagger閰嶇疆 swagger: - enable: true + # 鏄惁寮�鍚痵wagger + enabled: true + # 璇锋眰鍓嶇紑 + pathMapping: /dev-api # 闃叉XSS鏀诲嚮 xss: -- Gitblit v1.9.3