Skip to content

Commit

Permalink
Merge pull request #36 from KBDS-Dreamverse/feat/#31-save
Browse files Browse the repository at this point in the history
Feat/#31 save
  • Loading branch information
oU-Ua authored Feb 8, 2024
2 parents ebddf9e + e7dfa8b commit a662b5e
Show file tree
Hide file tree
Showing 32 changed files with 151 additions and 105 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ out/
### VS Code ###
.vscode/

/src/main/resources/application.yml
/src/main/resources/application.yml
/src/main/resources/db-application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public class Asset {
private Boolean isAstInternal;
private AstTag astTag;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "corp_id" )
private Corporation corp;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private User user;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kbds.itamserveradmin.domain.asset.entity;

import com.kbds.itamserveradmin.domain.contract.entity.Contract;
import com.kbds.itamserveradmin.domain.user.entity.User;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -23,11 +24,11 @@ public class AssetNotice {


//==연관관계==//
// @ManyToOne
// @JoinColumn(name = "contract_id")
// private Contract contract;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "contract_id")
private Contract contract;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "writer_id")
private User writer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.*;

@Entity
@Data
Expand All @@ -27,7 +24,7 @@ public class ManualLog {

//==연관관계==//

// @ManyToOne
// @JoinColumn(name = "ast_id")
// private Asset asset;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_id")
private Asset asset;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kbds.itamserveradmin.domain.assetRequest.entity;

import com.kbds.itamserveradmin.domain.assetRequest.entity.RequestStatus;
import com.kbds.itamserveradmin.domain.contract.entity.Contract;
import com.kbds.itamserveradmin.domain.user.entity.User;
import com.kbds.itamserveradmin.global.entity.BaseEntity;
import lombok.AllArgsConstructor;
Expand Down Expand Up @@ -40,13 +41,13 @@ public class AssetRequest {

//==연관관계==//

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_req_user_id")
private User astRequestUser;

// @ManyToOne
// @JoinColumn(name = "cont_id")
// private Contract contract;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "cont_id")
private Contract contract;

//==연관관계==//

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ public class AssetRequestLog {
private Long astReqCnt;

private LocalDateTime astReqSud;


//==연관관계==//
@ManyToOne

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_req_id")
private AssetRequest assetRequest;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_req_user_id")
private User assetRequestUser;
//==연관관계==//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,14 @@ public class AssetRequestManage {


//==연관관계==//
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_admin_id")
private AssetAdmin assetAdmin;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_req_id")
private AssetRequest assetRequest;


@OneToMany(mappedBy = "assetRequestManage",fetch = FetchType.LAZY)
@Builder.Default
private List<AssetRequestManageLog> assetRequestManageLogs = new ArrayList<>();

@PrePersist
public void prePersist() {
LocalDateTime now = LocalDateTime.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class AssetRequestManageLog {

//==연관관계==//

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_req_mg_id")
private AssetRequestManage assetRequestManage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.*;

@Entity
@Data
Expand All @@ -20,7 +19,7 @@ public class CALKey {
private KeyStatus calKeyStatus;

//==연관관계==//
// @ManyToOne
// @JoinColumn(name = "cont_id")
// private Contract contract;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "cont_id")
private Contract contract;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,21 @@ public class Contract {
@Id
private String contId;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_id")
private Asset ast;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "corp_id")
private Corporation corp;

@OneToOne
private NewAssetRequest newAstReq;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "usr_id")
private User user;

@OneToMany(mappedBy = "contract", fetch = FetchType.LAZY)
private List<ContractRecord> records = new ArrayList<>();

private LocalDateTime contRegDate;
private String contLicTag;
private int contPrice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public class ContractRecord extends BaseEntity {

private RecordType recordType;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false, name = "user_Id")
private User user;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false, name = "contract_id")
private Contract contract;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.*;

@Entity
@Data
Expand All @@ -20,7 +19,7 @@ public class LicenseKey {
private KeyStatus licKeyStatus;

//==연관관계==//
// @ManyToOne
// @JoinColumn(name = "cont_id")
// private Contract contract;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "cont_id")
private Contract contract;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.kbds.itamserveradmin.domain.contract.entity;
import com.kbds.itamserveradmin.domain.contract.entity.Contract;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;

@Entity
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public class Corporation {
@Builder.Default
private List<User> users = new ArrayList<>();

// @OneToMany(mappedBy ="cooperation")
// private List<Asset> assets = new ArrayList<>();

@OneToMany(mappedBy = "corp",fetch = FetchType.LAZY)
@Builder.Default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,9 @@ public class Department {

//==연관관계==//

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "corp_id")
private Corporation corporation;

@OneToMany(mappedBy = "department",fetch = FetchType.LAZY)
@Builder.Default
private List<User> users = new ArrayList<>();

@OneToMany(mappedBy = "department",fetch = FetchType.LAZY)
@Builder.Default
private List<DepartmentAsset> departmentAssets = new ArrayList<>();

@OneToMany(mappedBy = "department",fetch = FetchType.LAZY)
@Builder.Default
private List<NewAssetRequest> newAssetRequests = new ArrayList<>();
//==연관관계==//
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kbds.itamserveradmin.domain.department.entity;

import com.kbds.itamserveradmin.domain.contract.entity.Contract;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -18,13 +19,13 @@ public class DepartmentAsset {
private String DeptAstId;

//==연관관계==//
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dept_id")
private Department department;

// @ManyToOne
// @JoinColumn(name = "contract_id")
// private Contract contract;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "contract_id")
private Contract contract;

//==연관관계==//

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ public class NewAssetRequest {

//==연관관계==//

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dept_id")
private Department department;

@OneToMany(mappedBy = "newAssetRequest",fetch = FetchType.LAZY)
@Builder.Default
private List<NewAssetRequestAdmin> newAssetRequestAdmins = new ArrayList<>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class NewAssetRequestLog {

private String newAstReqUsePlan;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dept_id")
private Department department;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.kbds.itamserveradmin.domain.purchaseRequest.repository;

import com.kbds.itamserveradmin.domain.purchaseRequest.entity.NewAssetRequestLog;
import org.springframework.data.jpa.repository.JpaRepository;

public interface NewAssetRequestLogRepository extends JpaRepository<NewAssetRequestLog,String> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.kbds.itamserveradmin.domain.purchaseRequest.repository;

import com.kbds.itamserveradmin.domain.purchaseRequest.entity.NewAssetRequest;
import org.springframework.data.jpa.repository.JpaRepository;

public interface NewAssetRequestRepository extends JpaRepository<NewAssetRequest,String> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.kbds.itamserveradmin.domain.user.controller;

import com.kbds.itamserveradmin.domain.user.dto.MainRes;
import com.kbds.itamserveradmin.domain.user.service.UserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequiredArgsConstructor
@RequestMapping("/kbitam")
public class UserController {
private final UserService userService;

@PostMapping("/")
public ResponseEntity<MainRes>GetUserInfo(@RequestBody String userId){

return ResponseEntity.ok(null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.kbds.itamserveradmin.domain.user.dto;

public class MainRes {
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.kbds.itamserveradmin.domain.user.entity;

import com.kbds.itamserveradmin.domain.contract.entity.Contract;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.*;

@Entity
@Data
Expand All @@ -21,11 +19,11 @@ public class AssetAdmin {

//==연관관계==//

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "manager_id")
private User manager;

// @ManyToOne
// @JoinColumn(name = "cont_id")
// private Contract contract;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "cont_id")
private Contract contract;
}
Loading

0 comments on commit a662b5e

Please sign in to comment.