-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from cgk95/hotfix/product_filter
[Hotfix] 사용하지 않는 제품을 product 테이블에서 삭제하는 작업 추가
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
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
26 changes: 26 additions & 0 deletions
26
...src/main/java/com/kernel360/modulebatch/product/job/infra/FilterUnusedProductTasklet.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,26 @@ | ||
package com.kernel360.modulebatch.product.job.infra; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.batch.core.StepContribution; | ||
import org.springframework.batch.core.configuration.annotation.StepScope; | ||
import org.springframework.batch.core.scope.context.ChunkContext; | ||
import org.springframework.batch.core.step.tasklet.Tasklet; | ||
import org.springframework.batch.repeat.RepeatStatus; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@StepScope | ||
@RequiredArgsConstructor | ||
public class FilterUnusedProductTasklet implements Tasklet { | ||
|
||
private final JdbcTemplate jdbcTemplate; | ||
|
||
@Override | ||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { | ||
jdbcTemplate.update("delete from product where product.upper_item like '%세탁%'"); | ||
jdbcTemplate.update("delete from product where product.product_name similar to '%(방향제|그라스|통풍구|선바이저|살라딘|세탁|체인)%'"); | ||
|
||
return RepeatStatus.FINISHED; | ||
} | ||
} |