개발/국비 프로젝트

[프로젝트] 국비과정 파이널프로젝트_ SQL 짜기위한 코드 Service와 Mapper들

mabb 2022. 10. 14. 21:59
반응형

침대에 엎드려서 종이에 쿼리문을 짜보고자함.
Service 인터페이스와 매퍼를 참고하기 위한 코드 복붙.
현재는 기본 CRUD만 적은 상태로
Paging을 위한 카운트 및 조건 체크 메소드 등 추가하여야함.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
public interface CartService {
 
    public int registerCart(Cart cart);
    public List<Cart> printCart(Paging paging, String memberId);
    public int modifyQtyCart(Cart cart);
    public int removeCart(Cart cart);
    
    
}
public interface CouponService {
    //쿠폰관리
    public int registerCoupon(Coupon coupon);
    public List<Coupon> printCoupon(Coupon coupon);
    public List<Coupon> printMemberCoupon(Coupon coupon);
    public int removeCoupon(Coupon coupon);
    
    //회원쿠폰
    //sysdate + 유효기간
    public int registerMemberCoupon(Coupon coupon);
    public int modifyMemberCoupon(Coupon coupon);
}
public interface ProductService {
    //상품
    public int registerProduct(Product product);
    public List<Product> printAllProduct(Paging paging,Search search);
    public Product printOneProduct(Product product);
    public List<Product> printLikeProduct(Paging paging);
    public int modifyProduct(Product product);
    public int removeProduct(Product product);
    
    
    //주문
    public int registerOrder(Order order);
    public Order printOneOrder(Order order);
    public List<Order> printMemberOrder(Paging paging,Search search,Order order);
    public List<Order> printMemberCancelOrder(Paging paging,Search search,Order order);
    public int modifyPayCompleteOrder(Order order);
    public int modifyDeliveryCompleteOrder(Order order);
    public int modifyCancelOrder(Order order);
    public int modifyBackOrder(Order order);
    
    //찜
    public int registerProductLike(ProductLike like);
    public List<Product> printProductLike(Paging paging,ProductLike like);
    public int removeProductLike(ProductLike like);
    
    
}
public interface ShopQnaService {
    
    public int registerShopQna(ShopQna qna);
    public List<ShopQna> printShopQnaByProductNo(Paging paging,ShopQna qna);
    public List<ShopQna> printShopQnaByMemberId(Paging paging,ShopQna qna);
    public int removeShopQna(ShopQna qna);
}
public interface ReviewService {
    
    public int registerReview(Review review);
    public List<Review> printReview(Paging paging,Review review);
    public List<Review> printMemberReview(Paging paging,Review review);
    public int removeMemberReview(Review review);
 
}
cs

 

 

 
<mapper namespace="ShopQnaMapper">
<resultMap type="sQna" id="sQnaResultMap">
<id column="QNA_NO" property="qnaNo"/>
<result column="PRODUCT_NO" property="productNo"/>
<result column="QNA_CODE" property="qnaCode"/>
<result column="QNA_TYPE" property="qnaType"/>
<result column="QNA_TITLE" property="qnaTitle"/>
<result column="QNA_CONTENTS" property="qnaContents"/>
<result column="Q_ENROLL_DATE" property="qEnrollDate"/>
<result column="A_ENROLL_DATE" property="aEnrollDate"/>
<result column="ANSWER_STATUS" property="answerStatus"/>
<result column="ANSWER_CONTENTS" property="answerContents"/>
<result column="SECRET_STATUS" property="secretStatus"/>
<result column="MEMBER_ID" property="memberId"/>
</resultMap>
</mapper>
<mapper namespace="ReviewMapper">
<resultMap type="Review" id="ReviewResultMap">
<id column="REVIEW_NO" property="reviewNo"/>
<result column="MEMBER_ID" property="memberId"/>
<result column="MEMBER_NICK" property="memberNick"/>
<result column="REVIEW_CONTENTS" property="reviewContents"/>
<result column="REVIEW_IMG_NAME" property="reviewImgName"/>
<result column="REVIEW_IMG_RENAME" property="reviewImgRename"/>
<result column="REVIEW_IMG_ROOT" property="reviewImgRoot"/>
<result column="REVIEW_TIME" property="ReviewTime"/>
<result column="REVIEW_GRADE" property="reviewGrade"/>
<result column="PRODUCT_NO" property="productNo"/>
</resultMap>
</mapper>
<mapper namespace="ProductMapper">
<resultMap type="Product" id="ProductResultMap">
<id column="PRODUCT_NO" property="productNo"/>
<result column="PRODUCT_NAME" property="productName"/>
<result column="PRODUCT_BRAND" property="productBrand"/>
<result column="PRODUCT_PRICE" property="productPrice"/>
<result column="PRODUCT_DESC" property="productDesc"/>
<result column="GRADE_SUM" property="gradeSum"/>
<result column="PRODUCT_REGI_DATE" property="productRegiDate"/>
<result column="PRODUCT_MODI_DATE" property="productModiDate"/>
<result column="PRODUCT_SALES" property="productSales"/>
<result column="MAIN_IMG_NAME" property="mainImgName"/>
<result column="SUB_IMG1_NAME" property="firstSubImgName"/>
<result column="SUB_IMG2_NAME" property="secondSubImgName"/>
<result column="SUB_IMG3_NAME" property="thirdSubImgName"/>
<result column="SUB_IMG4_NAME" property="fourthSubImgName"/>
<result column="INFO_IMG_NAME" property="infoImgName"/>
<result column="MAIN_IMG_RENAME" property="mainImgReName"/>
<result column="SUB_IMG1_RENAME" property="firstSubImgReName"/>
<result column="SUB_IMG2_RENAME" property="secondSubImgReName"/>
<result column="SUB_IMG3_RENAME" property="thirdSubImgReName"/>
<result column="SUB_IMG4_RENAME" property="fourthSubImgReName"/>
<result column="INFO_IMG_RENAME" property="infoImgReName"/>
<result column="MAIN_IMG_ROOT" property="mainImgRoot"/>
<result column="SUB_IMG1_ROOT" property="firstSubImgRoot"/>
<result column="SUB_IMG2_ROOT" property="secondSubImgRoot"/>
<result column="SUB_IMG3_ROOT" property="thirdSubImgRoot"/>
<result column="SUB_IMG4_ROOT" property="fourthSubImgRoot"/>
<result column="INFO_IMG_ROOT" property="infoImgRoot"/>
<result column="COUPON_LIST" property="couponList"/>
 
</resultMap>
</mapper>
<mapper namespace="OrderMapper">
<resultMap type="Order" id="OrderResultMap">
<id column="ORDER_NO" property="orderNo"/>
<result column="PRODUCT_NO" property="productNo"/>
<result column="ORDER_GROUP" property="orderGroup"/>
<result column="ORDER_QTY" property="orderQty"/>
<result column="DELIVERY_FEE" property="deliveryFee"/>
<result column="COUPON_NO" property="couponNo"/>
<result column="DISCOUNT_AMOUNT" property="discountAmount"/>
<result column="FINAL_COST" property="finalCost"/>
<result column="MEMBER_ID" property="memberId"/>
<result column="MEMBER_NAME" property="memberName"/>
<result column="MEMBER_EMAIL" property="memberEmail"/>
<result column="MEMBER_PHONE" property="memberPhone"/>
<result column="ADDRESS" property="address"/>
<result column="ADDRESS_DETAIL" property="addressDetail"/>
<result column="POST_NO" property="postNo"/>
<result column="CONTACT_PHONE" property="contactPhone"/>
<result column="DELIVERY_REQUEST" property="deliveryRequest"/>
<result column="AGREE_YN" property="agreeYn"/>
<result column="PAYMENT_METHOD" property="paymentMethod"/>
<result column="CARD_KIND" property="cardKind"/>
<result column="MONTHLY_PAY" property="monthlyPay"/>
<result column="BANK_KIND" property="bankKind"/>
<result column="BANK_PAYER_NAME" property="bankPayerName"/>
<result column="PAY_COMPLETE" property="payComplete"/>
<result column="ORDER_CANCEL" property="orderCancel"/>
<result column="ORDER_BACK" property="orderBack"/>
<result column="DELIVERY_START" property="deliveryStart"/>
<result column="DELIVERY_COMPLETE" property="deliveryComplete"/>
<result column="DELIVERY_NO" property="deliveryNo"/>
</resultMap>
</mapper>
<mapper namespace="CouponMapper">
<resultMap type="Coupon" id="CouponResultMap">
<id column="COUPON_NO" property="couponNo"/>
<result column="COUPON_NAME" property="couponName"/>
<result column="COUPON_DESC" property="couponDesc"/>
<result column="DISCOUNT_AMOUNT" property="descountAmount"/>
<result column="PRICE_CONDITION" property="priceCondition"/>
<result column="BRAND_CONDITION" property="brandCondition"/>
<result column="FIRST_CONDITION" property="firstCondition"/>
<result column="COUPON_PERIOD" property="couponPeriod"/>
<result column="COUPON_REGI_DATE" property="couponRegiDate"/>
<result column="PRODUCT_CONDITION" property="productCondition"/>
<result column="COUPON_RUN_YN" property="couponRunYn"/>
</resultMap>
</mapper>
<mapper namespace="CartMapper">
<resultMap type="Cart" id="CartResultMap">
<id column="PRODUCT_NO" property="productNo"/>
<result column="MEMBER_ID" property="memberId"/>
<result column="PRODUCT_NAME" property="productName"/>
<result column="PRICE" property="price"/>
<result column="PRODUCT_AMOUNT" property="productAmount"/>
</resultMap>
</mapper>
반응형