删除OrganizationController中的无效依赖

This commit is contained in:
高子兴 2024-07-05 23:36:18 +08:00
parent 2f57ff6a4c
commit fca88ffd68

View File

@ -1,16 +1,12 @@
package org.cmh.backend.OrganizationManagement.controller; package org.cmh.backend.OrganizationManagement.controller;
import org.aspectj.weaver.ast.Or;
import org.cmh.backend.OrganizationManagement.model.Organization; import org.cmh.backend.OrganizationManagement.model.Organization;
import org.cmh.backend.OrganizationManagement.service.OrganizationService; import org.cmh.backend.OrganizationManagement.service.OrganizationService;
import org.cmh.backend.authentication.model.User;
import org.cmh.backend.authentication.service.UserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -33,14 +29,14 @@ public class OrganizationController {
@PostMapping("/addOrganization") @PostMapping("/addOrganization")
public Organization add(@RequestBody Map<String, String> credentials) { public Organization add(@RequestBody Map<String, String> credentials) {
Organization organization = new Organization(); Organization organization = new Organization();
if(credentials.get("organizationId") != null){ if (credentials.get("organizationId") != null) {
organization.setOrganizationId(Long.parseLong(credentials.get("organizationId"))); organization.setOrganizationId(Long.parseLong(credentials.get("organizationId")));
} }
organization.setOrganizationName(credentials.get("organizationName")); organization.setOrganizationName(credentials.get("organizationName"));
organization.setOrganizationStatus(Boolean.parseBoolean(credentials.get("organizationStatus"))); organization.setOrganizationStatus(Boolean.parseBoolean(credentials.get("organizationStatus")));
if(Integer.parseInt(credentials.get("parentOrganization")) != 0){ if (Integer.parseInt(credentials.get("parentOrganization")) != 0) {
organization.setParentOrganization(organizationService.getById(Long.parseLong(credentials.get("parentOrganization")))); organization.setParentOrganization(organizationService.getById(Long.parseLong(credentials.get("parentOrganization"))));
}else{ } else {
organization.setParentOrganization(null); organization.setParentOrganization(null);
} }
organization.setEmail(credentials.get("email")); organization.setEmail(credentials.get("email"));