前端代码适配springboot3微调

This commit is contained in:
MaxKey 2023-08-19 10:42:42 +08:00
parent 7e71d8dd93
commit 01a70fcb6c
4 changed files with 15 additions and 7 deletions

View File

@ -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>> {

View File

@ -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}`);
}

View File

@ -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;

View File

@ -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;