فهرست منبع

前端代码适配springboot3微调

MaxKey 1 سال پیش
والد
کامیت
01a70fcb6c

+ 5 - 1
maxkey-web-frontend/maxkey-web-app/src/app/service/base.service.ts

@@ -82,7 +82,11 @@ export class BaseService<T> {
   }
 
   get(id: String): Observable<Message<T>> {
-    return this.http.get<Message<T>>(`${this.server.urls.base + this.server.urls.get}/${id}`);
+    if (id === null || id === '') {
+      return this.http.get<Message<T>>(`${this.server.urls.base + this.server.urls.get}`);
+    } else {
+      return this.http.get<Message<T>>(`${this.server.urls.base + this.server.urls.get}/${id}`);
+    }
   }
 
   getByParams(params: NzSafeAny, getURL?: string): Observable<Message<T>> {

+ 3 - 0
maxkey-web-frontend/maxkey-web-mgt-app/src/app/service/base.service.ts

@@ -84,6 +84,9 @@ export class BaseService<T> {
   }
 
   get(id: String): Observable<Message<T>> {
+    if (id === null || id === '') {
+      return this.http.get<Message<T>>(`${this.server.urls.base + this.server.urls.get}`);
+    }
     return this.http.get<Message<T>>(`${this.server.urls.base + this.server.urls.get}/${id}`);
   }
 

+ 4 - 3
maxkey-webs/maxkey-web-mgt/src/main/java/org/dromara/maxkey/web/contorller/OrganizationsController.java

@@ -41,6 +41,7 @@ import org.dromara.maxkey.util.ExcelUtils;
 import org.dromara.maxkey.web.component.TreeAttributes;
 import org.dromara.maxkey.web.component.TreeNode;
 import org.dromara.mybatis.jpa.entity.JpaPageResults;
+import org.dromara.mybatis.jpa.query.Query;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -153,9 +154,9 @@ public class OrganizationsController {
 	@ResponseBody
 	@RequestMapping(value={"/tree"}, produces = {MediaType.APPLICATION_JSON_VALUE})
 	public ResponseEntity<?> tree(@ModelAttribute Organizations organization,@CurrentUser UserInfo currentUser) {
-		_logger.debug("-query  {}" , organization);
-		organization.setInstId(currentUser.getInstId());
-		List<Organizations>  orgList = organizationsService.query(organization);
+		_logger.debug("-tree  {}" , organization);
+		List<Organizations>  orgList = organizationsService.query(
+				Query.builder().eq("instid", currentUser.getInstId()));
 		if (orgList != null) {
 			TreeAttributes treeAttributes = new TreeAttributes();
 			int nodeCount = 0;

+ 3 - 3
maxkey-webs/maxkey-web-mgt/src/main/java/org/dromara/maxkey/web/permissions/contorller/ResourcesController.java

@@ -31,6 +31,7 @@ import org.dromara.maxkey.persistence.service.ResourcesService;
 import org.dromara.maxkey.web.component.TreeAttributes;
 import org.dromara.maxkey.web.component.TreeNode;
 import org.dromara.mybatis.jpa.entity.JpaPageResults;
+import org.dromara.mybatis.jpa.query.Query;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -141,9 +142,8 @@ public class ResourcesController {
 	@ResponseBody
 	@RequestMapping(value={"/tree"}, produces = {MediaType.APPLICATION_JSON_VALUE})
 	public ResponseEntity<?> tree(@ModelAttribute Resources resource,@CurrentUser UserInfo currentUser) {
-		_logger.debug("-query  {}" , resource);
-		resource.setInstId(currentUser.getInstId());
-		List<Resources>  resourceList = resourcesService.query(resource);
+		_logger.debug("-tree  {}" , resource);
+		List<Resources>  resourceList = resourcesService.query(Query.builder().eq("instid", currentUser.getInstId()));
 		if (resourceList != null) {
 			TreeAttributes treeAttributes = new TreeAttributes();
 			int nodeCount = 0;