提交 01a70fcb 编写于 作者: M MaxKey

前端代码适配springboot3微调

上级 7e71d8dd
...@@ -82,7 +82,11 @@ export class BaseService<T> { ...@@ -82,7 +82,11 @@ export class BaseService<T> {
} }
get(id: String): Observable<Message<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>> { getByParams(params: NzSafeAny, getURL?: string): Observable<Message<T>> {
......
...@@ -84,6 +84,9 @@ export class BaseService<T> { ...@@ -84,6 +84,9 @@ export class BaseService<T> {
} }
get(id: String): Observable<Message<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}`); return this.http.get<Message<T>>(`${this.server.urls.base + this.server.urls.get}/${id}`);
} }
......
...@@ -41,6 +41,7 @@ import org.dromara.maxkey.util.ExcelUtils; ...@@ -41,6 +41,7 @@ import org.dromara.maxkey.util.ExcelUtils;
import org.dromara.maxkey.web.component.TreeAttributes; import org.dromara.maxkey.web.component.TreeAttributes;
import org.dromara.maxkey.web.component.TreeNode; import org.dromara.maxkey.web.component.TreeNode;
import org.dromara.mybatis.jpa.entity.JpaPageResults; import org.dromara.mybatis.jpa.entity.JpaPageResults;
import org.dromara.mybatis.jpa.query.Query;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -153,9 +154,9 @@ public class OrganizationsController { ...@@ -153,9 +154,9 @@ public class OrganizationsController {
@ResponseBody @ResponseBody
@RequestMapping(value={"/tree"}, produces = {MediaType.APPLICATION_JSON_VALUE}) @RequestMapping(value={"/tree"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<?> tree(@ModelAttribute Organizations organization,@CurrentUser UserInfo currentUser) { public ResponseEntity<?> tree(@ModelAttribute Organizations organization,@CurrentUser UserInfo currentUser) {
_logger.debug("-query {}" , organization); _logger.debug("-tree {}" , organization);
organization.setInstId(currentUser.getInstId()); List<Organizations> orgList = organizationsService.query(
List<Organizations> orgList = organizationsService.query(organization); Query.builder().eq("instid", currentUser.getInstId()));
if (orgList != null) { if (orgList != null) {
TreeAttributes treeAttributes = new TreeAttributes(); TreeAttributes treeAttributes = new TreeAttributes();
int nodeCount = 0; int nodeCount = 0;
......
...@@ -31,6 +31,7 @@ import org.dromara.maxkey.persistence.service.ResourcesService; ...@@ -31,6 +31,7 @@ import org.dromara.maxkey.persistence.service.ResourcesService;
import org.dromara.maxkey.web.component.TreeAttributes; import org.dromara.maxkey.web.component.TreeAttributes;
import org.dromara.maxkey.web.component.TreeNode; import org.dromara.maxkey.web.component.TreeNode;
import org.dromara.mybatis.jpa.entity.JpaPageResults; import org.dromara.mybatis.jpa.entity.JpaPageResults;
import org.dromara.mybatis.jpa.query.Query;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -141,9 +142,8 @@ public class ResourcesController { ...@@ -141,9 +142,8 @@ public class ResourcesController {
@ResponseBody @ResponseBody
@RequestMapping(value={"/tree"}, produces = {MediaType.APPLICATION_JSON_VALUE}) @RequestMapping(value={"/tree"}, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<?> tree(@ModelAttribute Resources resource,@CurrentUser UserInfo currentUser) { public ResponseEntity<?> tree(@ModelAttribute Resources resource,@CurrentUser UserInfo currentUser) {
_logger.debug("-query {}" , resource); _logger.debug("-tree {}" , resource);
resource.setInstId(currentUser.getInstId()); List<Resources> resourceList = resourcesService.query(Query.builder().eq("instid", currentUser.getInstId()));
List<Resources> resourceList = resourcesService.query(resource);
if (resourceList != null) { if (resourceList != null) {
TreeAttributes treeAttributes = new TreeAttributes(); TreeAttributes treeAttributes = new TreeAttributes();
int nodeCount = 0; int nodeCount = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册