-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
๐ 172 delete enrolled service #173
Conversation
) { | ||
fun execute(ids: List<Long>) { | ||
val user = userUtil.fetchCurrentUser() | ||
ids.map { clientRepository.deleteByIdAndCreatedBy(it, user) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ids.map { clientRepository.deleteByIdAndCreatedBy(it, user) } | |
ids.forEach { clientRepository.deleteByIdAndCreatedBy(it, user) } |
๊ฒฐ๊ณผ ์ฐ๋๊ฑฐ๋ ์๋๋ฐ map๋ง๊ณ forEach๋ก ํ๋๊ฑฐ ์ด๋ค๊ฐ์?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ต
ab909cd
) { | ||
fun execute(ids: List<Long>) { | ||
val user = userUtil.fetchCurrentUser() | ||
ids.forEach { clientRepository.deleteByIdAndCreatedBy(it, user) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ๋์ฉ ๋ค ๊บผ๋ด์ id๋ก findํ๋๊ฒ๋ณด๋จ ids๋ก ํ๋ฒ์ ๋ฐ์์ findAll ํ ์ ์์ต๋๋ค findAllByIdsAndUser(ids: List<Long>, createdBy: User)
์ด๋ฐ์์ผ๋ก์
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetch join์ผ๋ก N+1๋ ํด๊ฒฐํ๋ฉด ์ข์๊ฑฐ๊ฐ๊ธดํ๋ฐ.. ์๊ท๋ชจํธ๋ํฝ ์๋น์ค๋ค๋ณด๋ ์๋ฌด๋๋ ๊ณ ๋ ค ์ํด๋ ๋ ๊ฑฐ๊ฐ๊ธฐ๋ํ๊ณ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleteAllByIds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s๊ฐ ๋น ์ ธ์๋๋์ผ๋ผ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main/kotlin/com/msg/gauth/domain/client/presentation/ClientController.kt
Show resolved
Hide resolved
val booleanExpression = (client.id.`in`(ids)).and(client.createdBy.eq(createdBy)) | ||
|
||
jpaQueryFactory.delete(client) | ||
.where(booleanExpression) | ||
.execute() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jpaQueryFactory.delete(client)
.where(client.id.`in`(ids), client.createdBy.eq(createdBy))
.execute()
๋ณ๋ก ์๋ณต์กํ ์ฟผ๋ฆฌ๊ฐ์๋ฐ ๊ตณ์ด booleanExpression๋ณด๋จ ์ด๋ ๊ฒ ํด๋ ๋ ๋ฏ
In
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where์ ๋ด์์ ์ผํ๋ฅผ ์ฌ์ฉํด์ ์กฐ๊ฑด์ ์ง์ ์ฐ๊ฒฐํ๋ฌใ ใด AND ์ฐ์ฐ์์ ๊ฒฐํฉ๋ ์ฌ๋ฌ ์กฐ๊ฑด์ ์ง์ ํ ์์ด์. ์ด๋ ๊ฒ ํ๋ฉดbooleanExpression ๋ณ์๊ฐ ์์ด๋ ์คํ์ด ๋ ๊ฑฐ์์
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4834abe
๋ค ์์ ์กฐ๊ฑด์ ์ผํ๋ก ์ฐ๊ฒฐํ์์ต๋๋ค
๐ก ๊ฐ์
์ ์ ๊ฐ ๋ฑ๋กํ ์๋น์ค๋ฅผ ์ฌ๋ฌ ๊ฐ ์ญ์ ํ ์ ์๋ api ์์ฑ
๐ ์์ ๋ด์ฉ
๐ ๋ณ๊ฒฝ์ฌํญ
๐โโ๏ธ ์ง๋ฌธ์ฌํญ
โ๏ธ ์ฌ์ฉ๋ฒ
๐ธ ๊ธฐํ