-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
d4b99d7
commit 7f9c906
Showing
6 changed files
with
136 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
springboot/src/main/java/com/springboot/project/format/UserBlackOrganizeFormatter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.springboot.project.format; | ||
|
||
import org.springframework.stereotype.Service; | ||
import com.springboot.project.common.baseService.BaseService; | ||
import com.springboot.project.model.OrganizeModel; | ||
import com.springboot.project.model.UserBlackOrganizeModel; | ||
import com.springboot.project.model.UserModel; | ||
import com.springboot.project.entity.*; | ||
|
||
@Service | ||
public class UserBlackOrganizeFormatter extends BaseService { | ||
|
||
public UserBlackOrganizeModel format(UserBlackOrganizeEntity userBlackOrganizeEntity) { | ||
var userBlackOrganizeModel = new UserBlackOrganizeModel(); | ||
userBlackOrganizeModel.setId(userBlackOrganizeEntity.getId()); | ||
userBlackOrganizeModel.setCreateDate(userBlackOrganizeModel.getCreateDate()); | ||
userBlackOrganizeModel.setUpdateDate(userBlackOrganizeModel.getUpdateDate()); | ||
userBlackOrganizeModel.setUser(new UserModel().setId(userBlackOrganizeModel.getUser().getId())); | ||
userBlackOrganizeModel.setOrganize(new OrganizeModel().setId(userBlackOrganizeModel.getOrganize().getId())); | ||
return userBlackOrganizeModel; | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
springboot/src/main/java/com/springboot/project/model/UserBlackOrganizeModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.springboot.project.model; | ||
|
||
import java.util.Date; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.experimental.Accessors; | ||
|
||
@Getter | ||
@Setter | ||
@Accessors(chain = true) | ||
public class UserBlackOrganizeModel { | ||
|
||
private String id; | ||
private Date createDate; | ||
private Date updateDate; | ||
private OrganizeModel organize; | ||
private UserModel user; | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
springboot/src/main/java/com/springboot/project/service/UserBlackOrganizeClosureService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.springboot.project.service; | ||
|
||
import java.util.Date; | ||
import org.springframework.stereotype.Service; | ||
import com.springboot.project.common.baseService.BaseService; | ||
import com.springboot.project.common.database.JPQLFunction; | ||
import com.springboot.project.entity.*; | ||
|
||
@Service | ||
public class UserBlackOrganizeClosureService extends BaseService { | ||
|
||
public void create(String userId, String organizeId) { | ||
var user = this.UserEntity() | ||
.where(s -> s.getId().equals(userId)) | ||
.where(s -> !s.getIsDeleted()) | ||
.getOnlyValue(); | ||
var organize = this.OrganizeEntity() | ||
.where(s -> s.getId().equals(organizeId)) | ||
.where(s -> JPQLFunction.isNotDeletedOfOrganize(s.getId())) | ||
.getOnlyValue(); | ||
var userBlackOrganizeClosureEntity = new UserBlackOrganizeClosureEntity(); | ||
userBlackOrganizeClosureEntity.setId(newId()); | ||
userBlackOrganizeClosureEntity.setCreateDate(new Date()); | ||
userBlackOrganizeClosureEntity.setUpdateDate(new Date()); | ||
userBlackOrganizeClosureEntity.setUser(user); | ||
userBlackOrganizeClosureEntity.setOrganize(organize); | ||
this.persist(userBlackOrganizeClosureEntity); | ||
} | ||
|
||
public void delete(String id) { | ||
var userBlackOrganizeClosureEntity = this.UserBlackOrganizeClosureEntity() | ||
.where(s -> s.getId().equals(id)) | ||
.getOnlyValue(); | ||
userBlackOrganizeClosureEntity.setUser(null); | ||
userBlackOrganizeClosureEntity.setOrganize(null); | ||
this.remove(userBlackOrganizeClosureEntity); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
springboot/src/main/java/com/springboot/project/service/UserBlackOrganizeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.springboot.project.service; | ||
|
||
import java.util.Date; | ||
import org.springframework.stereotype.Service; | ||
import com.springboot.project.common.baseService.BaseService; | ||
import com.springboot.project.common.database.JPQLFunction; | ||
import com.springboot.project.entity.*; | ||
import com.springboot.project.model.UserBlackOrganizeModel; | ||
|
||
@Service | ||
public class UserBlackOrganizeService extends BaseService { | ||
|
||
public UserBlackOrganizeModel create(String userId, String organizeId) { | ||
var user = this.UserEntity() | ||
.where(s -> s.getId().equals(userId)) | ||
.where(s -> !s.getIsDeleted()) | ||
.getOnlyValue(); | ||
var organize = this.OrganizeEntity() | ||
.where(s -> s.getId().equals(organizeId)) | ||
.where(s -> JPQLFunction.isNotDeletedOfOrganize(s.getId())) | ||
.getOnlyValue(); | ||
var userBlackOrganizeEntity = new UserBlackOrganizeEntity(); | ||
userBlackOrganizeEntity.setId(newId()); | ||
userBlackOrganizeEntity.setCreateDate(new Date()); | ||
userBlackOrganizeEntity.setUpdateDate(new Date()); | ||
userBlackOrganizeEntity.setUser(user); | ||
userBlackOrganizeEntity.setOrganize(organize); | ||
this.persist(userBlackOrganizeEntity); | ||
|
||
return this.userBlackOrganizeFormatter.format(userBlackOrganizeEntity); | ||
} | ||
|
||
public void delete(String id) { | ||
var userBlackOrganizeEntity = this.UserBlackOrganizeEntity() | ||
.where(s -> s.getId().equals(id)) | ||
.getOnlyValue(); | ||
userBlackOrganizeEntity.setUser(null); | ||
userBlackOrganizeEntity.setOrganize(null); | ||
this.remove(userBlackOrganizeEntity); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters