Skip to content

Commit

Permalink
Merge pull request #98 from Tea-Bliss/dev
Browse files Browse the repository at this point in the history
fix:hot fix
  • Loading branch information
lemonticsoul authored Jun 23, 2024
2 parents 534e332 + 7c92d0a commit dda43d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/main/java/store/teabliss/tea/mapper/TeaMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public interface TeaMapper {

void updatesale(String name,Long quantity);

void deleteIngredient(Long tea_id);

void deleteFlavor(Long tea_id);



}
15 changes: 13 additions & 2 deletions src/main/java/store/teabliss/tea/service/TeaService.java
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ public boolean deletetea(int id){

public boolean patchtea(Long id,TeaPatchDto teaPatchDto){





Tea updatetea = Tea.builder()
.id(id)
.price(teaPatchDto.getPrice())
Expand All @@ -361,25 +365,32 @@ public boolean patchtea(Long id,TeaPatchDto teaPatchDto){
.season(teaPatchDto.getSeason())
.build();


teaMapper.deleteIngredient(id);
teaMapper.deleteFlavor(id);


List<Long> temp1=teaPatchDto.getIngredient();


for (Long t1:temp1){
TeaIngredient teaingredient =TeaIngredient.builder()
.ingredientId(t1)
.teaId(id)
.build();

teaMapper.updateIngredient(teaingredient);
teaMapper.saveIngredient(teaingredient);
}

List<Long> temp2=teaPatchDto.getFlavor();


for (Long t2:temp2){
TeaFlavor teaflavor =TeaFlavor.builder()
.flavor(t2)
.teaId(id)
.build();
teaMapper.updateFlavor(teaflavor);
teaMapper.saveFlavor(teaflavor);
}


Expand Down

0 comments on commit dda43d1

Please sign in to comment.