外键约束
This commit is contained in:
parent
ffa9189583
commit
ba638747df
@ -24,8 +24,7 @@ public class TenantManagementController {
|
|||||||
@CrossOrigin(origins = "http://localhost:5173")
|
@CrossOrigin(origins = "http://localhost:5173")
|
||||||
@GetMapping("/getAllTenant")
|
@GetMapping("/getAllTenant")
|
||||||
public List<Tenant> getAll() {
|
public List<Tenant> getAll() {
|
||||||
List<Tenant> tenantList=tenantManagementService.findAll();
|
return tenantManagementService.findAll();
|
||||||
return tenantList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:5173")
|
@CrossOrigin(origins = "http://localhost:5173")
|
||||||
|
|||||||
@ -4,6 +4,7 @@ package org.cmh.backend.UserManagement.model;
|
|||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.cmh.backend.authentication.model.UserHS;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Getter
|
@Getter
|
||||||
@ -13,9 +14,13 @@ public class Tenant {
|
|||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
private String contact;
|
private String contact; // 联系人
|
||||||
private String phone;
|
private String phone; // 联系人电话
|
||||||
private String name;
|
private String name; // 租户名称
|
||||||
private String manager;
|
private String manager; // 租户管理员
|
||||||
private String symbol;
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "manager", referencedColumnName = "username", insertable = false, updatable = false)
|
||||||
|
private UserHS managerEntity; // 租户管理员对象
|
||||||
|
private String symbol; // 租户标识
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,8 +13,7 @@ public class TenantManagementService {
|
|||||||
private TenantManagementRepository tenantManagementRepository;
|
private TenantManagementRepository tenantManagementRepository;
|
||||||
|
|
||||||
public Tenant registerTenant(Tenant tenant) {
|
public Tenant registerTenant(Tenant tenant) {
|
||||||
Tenant savedTenant = tenantManagementRepository.save(tenant);
|
return tenantManagementRepository.save(tenant);
|
||||||
return savedTenant;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Tenant> findAll(){
|
public List<Tenant> findAll(){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user