Skip to content

Commit

Permalink
basic add Category entity
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnaDiao committed Jan 13, 2022
1 parent a1019ad commit c9b7435
Show file tree
Hide file tree
Showing 30 changed files with 103 additions and 42 deletions.
60 changes: 36 additions & 24 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions ecom-category/src/main/java/com.freeb/Dao/CategoryStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,23 @@ public Boolean CreateCategoryInfo(String description){
return false;
}

//todo 挪入products
public static final String CREATE_COMMENTS = "INSERT INTO COMMENT_INFO(user_id,prod_id,comment_detail,comment_media) VALUES(?,?,?,?)";
public Boolean CreateComments(Long userId,Long prodId,String commentDetail,String commentMedia){
try(Connection conn = druidUtil.GetConnection()){
PreparedStatement stmt = conn.prepareStatement(CREATE_COMMENTS);
stmt.setLong(1,userId);
stmt.setLong(2,prodId);
stmt.setString(3,commentDetail);
stmt.setString(4,commentMedia);
int rs = stmt.executeUpdate();
if(rs>0)return true;

}catch (SQLException e){
logger.error(String.format("DB connect failure %s",e.toString()));
// Notice here
e.printStackTrace();
}
return false;
}
}
14 changes: 14 additions & 0 deletions ecom-category/src/main/java/com/freeb/Service/CategoryService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.freeb.Service;

import com.freeb.Entity.CategoryPage;
import com.freeb.Entity.ProductPage;

import java.util.List;

public interface CategoryService {
public ProductPage GetProductPage(Long prodId);

public List<CategoryPage> GetCategoryPage(Long userId, String searchKey);


}
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions ecom-common/src/main/java/com/freeb/Entity/CategoryPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.freeb.Entity;

public class CategoryPage {
Long prodId;
String prodName;
Integer prodSales;
Byte[] prodImage;
Long merchantId;
Long merchantName;
}
11 changes: 11 additions & 0 deletions ecom-common/src/main/java/com/freeb/Entity/CommentInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.freeb.Entity;

import java.util.List;

public class CommentInfo {
Long userId;
String userName;
Long prodId;
String commentDetails;
List<String> commentImages;
}
14 changes: 14 additions & 0 deletions ecom-common/src/main/java/com/freeb/Entity/ProductPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.freeb.Entity;

import java.util.List;

public class ProductPage {
Long prodId;
String prodName;
Integer prodSales;
//TODO check图片用string可以吗
List<String> prodImages;
Long merchantId;
Long merchantName;
List<CommentInfo> prodComments;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 0 additions & 18 deletions ecom-search/src/main/java/com/freeb/Dao/ProductInfoStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,7 @@ public Boolean CreateDiscountInfo(Integer type,Long prodId,Double price){
}
return false;
}
//todo 挪入products
public static final String CREATE_COMMENTS = "INSERT INTO COMMENT_INFOS(user_id,prod_id,comment_detail,comment_media) VALUES(?,?,?,?)";
public Boolean CreateComments(Long userId,Long prodId,String commentDetail,String commentMedia){
try(Connection conn = druidUtil.GetConnection()){
PreparedStatement stmt = conn.prepareStatement(CREATE_COMMENTS);
stmt.setLong(1,userId);
stmt.setLong(2,prodId);
stmt.setString(3,commentDetail);
stmt.setString(4,commentMedia);
int rs = stmt.executeUpdate();
if(rs>0)return true;

}catch (SQLException e){
logger.error(String.format("DB connect failure %s",e.toString()));
// Notice here
e.printStackTrace();
}
return false;
}



Expand Down

0 comments on commit c9b7435

Please sign in to comment.