-
Notifications
You must be signed in to change notification settings - Fork 1
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 #153 from kkn1125/kkn1125/be/mapper
[BE][:hammer_and_wrench: FEAT]: ResponseEntity -> ObjectMapper 변경 + r…
- Loading branch information
Showing
35 changed files
with
417 additions
and
237 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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/narang/web/repository/BillRepositoryCustom.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,9 @@ | ||
package com.narang.web.repository; | ||
|
||
import com.narang.web.entity.Bill; | ||
|
||
import java.util.List; | ||
|
||
public interface BillRepositoryCustom { | ||
public List<Bill> findByUid(String uid); | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/narang/web/repository/BillRepositoryCustomImpl.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,25 @@ | ||
package com.narang.web.repository; | ||
|
||
import com.narang.web.entity.Bill; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.mongodb.core.MongoTemplate; | ||
import org.springframework.data.mongodb.core.query.Criteria; | ||
import org.springframework.data.mongodb.core.query.Query; | ||
|
||
import java.util.List; | ||
|
||
public class BillRepositoryCustomImpl implements BillRepositoryCustom { | ||
private MongoTemplate billTemplate; | ||
|
||
@Autowired | ||
BillRepositoryCustomImpl(MongoTemplate billTemplate) { | ||
this.billTemplate = billTemplate; | ||
} | ||
|
||
@Override | ||
public List<Bill> findByUid(String uid) { | ||
Criteria cr = new Criteria("uid").is(uid); | ||
Query q = new Query(cr); | ||
return billTemplate.find(q, Bill.class); | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/java/com/narang/web/repository/CartRepositoryCustom.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,7 @@ | ||
package com.narang.web.repository; | ||
|
||
import com.narang.web.entity.Cart; | ||
|
||
public interface CartRepositoryCustom { | ||
public Cart update(Cart cart); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/narang/web/repository/CartRepositoryCustomImpl.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,21 @@ | ||
package com.narang.web.repository; | ||
|
||
import com.narang.web.entity.Cart; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.mongodb.core.MongoTemplate; | ||
|
||
public class CartRepositoryCustomImpl implements CartRepositoryCustom { | ||
private MongoTemplate cartTemplate; | ||
|
||
@Autowired | ||
CartRepositoryCustomImpl(MongoTemplate cartTemplate) { | ||
this.cartTemplate = cartTemplate; | ||
} | ||
|
||
@Override | ||
public Cart update(Cart cart) { | ||
Cart foundCart = cartTemplate.findById(cart.getId(), Cart.class); | ||
foundCart.replaceIfNotNull(cart); | ||
return cartTemplate.save(foundCart, "cart"); | ||
} | ||
} |
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
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
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
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
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 |
---|---|---|
|
@@ -50,5 +50,4 @@ public Boolean deleteByDid(String did, String uid) { | |
likeTemplate.remove(q, "like"); | ||
return true; | ||
} | ||
|
||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/java/com/narang/web/repository/ProductRepositoryCustom.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,7 @@ | ||
package com.narang.web.repository; | ||
|
||
import com.narang.web.entity.Product; | ||
|
||
public interface ProductRepositoryCustom { | ||
public Product update(Product product); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/narang/web/repository/ProductRepositoryCustomImpl.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,21 @@ | ||
package com.narang.web.repository; | ||
|
||
import com.narang.web.entity.Product; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.mongodb.core.MongoTemplate; | ||
|
||
public class ProductRepositoryCustomImpl implements ProductRepositoryCustom { | ||
private MongoTemplate productTemplate; | ||
|
||
@Autowired | ||
ProductRepositoryCustomImpl(MongoTemplate productTemplate) { | ||
this.productTemplate = productTemplate; | ||
} | ||
|
||
@Override | ||
public Product update(Product product) { | ||
Product foundProduct = productTemplate.findById(product.getId(), Product.class); | ||
foundProduct.replaceIfNotNull(product); | ||
return productTemplate.save(foundProduct, "products"); | ||
} | ||
} |
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
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
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
Oops, something went wrong.