ois = orderItemService.listForCart(user.getId());
66 | for (OrderItem oi : ois) {
67 | cartTotalItemNumber += oi.getNumber();
68 | }
69 | }
70 | session.setAttribute("cartTotalItemNumber", cartTotalItemNumber);
71 | }
72 |
73 | /**
74 | * 在DispatcherServlet完全处理完请求后被调用,可用于清理资源等
75 | *
76 | * 当有拦截器抛出异常时,会从当前拦截器往回执行所有的拦截器的afterCompletion()
77 | */
78 |
79 | public void afterCompletion(HttpServletRequest request,
80 | HttpServletResponse response, Object handler, Exception ex)
81 | throws Exception {
82 |
83 | // System.out.println("afterCompletion(), 在访问视图之后被调用");
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/CategoryMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.Category;
4 | import cn.wmyskxz.pojo.CategoryExample;
5 | import java.util.List;
6 |
7 | public interface CategoryMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(Category record);
11 |
12 | int insertSelective(Category record);
13 |
14 | List selectByExample(CategoryExample example);
15 |
16 | Category selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(Category record);
19 |
20 | int updateByPrimaryKey(Category record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/OrderItemMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.OrderItem;
4 | import cn.wmyskxz.pojo.OrderItemExample;
5 | import java.util.List;
6 |
7 | public interface OrderItemMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(OrderItem record);
11 |
12 | int insertSelective(OrderItem record);
13 |
14 | List selectByExample(OrderItemExample example);
15 |
16 | OrderItem selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(OrderItem record);
19 |
20 | int updateByPrimaryKey(OrderItem record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/OrderMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.Order;
4 | import cn.wmyskxz.pojo.OrderExample;
5 | import java.util.List;
6 |
7 | public interface OrderMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(Order record);
11 |
12 | int insertSelective(Order record);
13 |
14 | List selectByExample(OrderExample example);
15 |
16 | Order selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(Order record);
19 |
20 | int updateByPrimaryKey(Order record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/ProductImageMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.ProductImage;
4 | import cn.wmyskxz.pojo.ProductImageExample;
5 | import java.util.List;
6 |
7 | public interface ProductImageMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(ProductImage record);
11 |
12 | int insertSelective(ProductImage record);
13 |
14 | List selectByExample(ProductImageExample example);
15 |
16 | ProductImage selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(ProductImage record);
19 |
20 | int updateByPrimaryKey(ProductImage record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/ProductMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.Product;
4 | import cn.wmyskxz.pojo.ProductExample;
5 | import java.util.List;
6 |
7 | public interface ProductMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(Product record);
11 |
12 | int insertSelective(Product record);
13 |
14 | List selectByExample(ProductExample example);
15 |
16 | Product selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(Product record);
19 |
20 | int updateByPrimaryKey(Product record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/PropertyMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.Property;
4 | import cn.wmyskxz.pojo.PropertyExample;
5 | import java.util.List;
6 |
7 | public interface PropertyMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(Property record);
11 |
12 | int insertSelective(Property record);
13 |
14 | List selectByExample(PropertyExample example);
15 |
16 | Property selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(Property record);
19 |
20 | int updateByPrimaryKey(Property record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/PropertyValueMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.PropertyValue;
4 | import cn.wmyskxz.pojo.PropertyValueExample;
5 | import java.util.List;
6 |
7 | public interface PropertyValueMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(PropertyValue record);
11 |
12 | int insertSelective(PropertyValue record);
13 |
14 | List selectByExample(PropertyValueExample example);
15 |
16 | PropertyValue selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(PropertyValue record);
19 |
20 | int updateByPrimaryKey(PropertyValue record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/ReferalLinkMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.ReferalLink;
4 | import cn.wmyskxz.pojo.ReferalLinkExample;
5 | import java.util.List;
6 |
7 | public interface ReferalLinkMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(ReferalLink record);
11 |
12 | int insertSelective(ReferalLink record);
13 |
14 | List selectByExample(ReferalLinkExample example);
15 |
16 | ReferalLink selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(ReferalLink record);
19 |
20 | int updateByPrimaryKey(ReferalLink record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/ReviewMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.Review;
4 | import cn.wmyskxz.pojo.ReviewExample;
5 | import java.util.List;
6 |
7 | public interface ReviewMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(Review record);
11 |
12 | int insertSelective(Review record);
13 |
14 | List selectByExample(ReviewExample example);
15 |
16 | Review selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(Review record);
19 |
20 | int updateByPrimaryKey(Review record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/mapper/UserMapper.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.mapper;
2 |
3 | import cn.wmyskxz.pojo.User;
4 | import cn.wmyskxz.pojo.UserExample;
5 | import java.util.List;
6 |
7 | public interface UserMapper {
8 | int deleteByPrimaryKey(Integer id);
9 |
10 | int insert(User record);
11 |
12 | int insertSelective(User record);
13 |
14 | List selectByExample(UserExample example);
15 |
16 | User selectByPrimaryKey(Integer id);
17 |
18 | int updateByPrimaryKeySelective(User record);
19 |
20 | int updateByPrimaryKey(User record);
21 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/Category.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | import java.util.List;
4 |
5 | public class Category {
6 | private Integer id;
7 |
8 | private String name;
9 |
10 | private List products;
11 |
12 | private List> productByRow;
13 |
14 | public Integer getId() {
15 | return id;
16 | }
17 |
18 | public void setId(Integer id) {
19 | this.id = id;
20 | }
21 |
22 | public String getName() {
23 | return name;
24 | }
25 |
26 | public void setName(String name) {
27 | this.name = name == null ? null : name.trim();
28 | }
29 |
30 | public List getProducts() {
31 | return products;
32 | }
33 |
34 | public void setProducts(List products) {
35 | this.products = products;
36 | }
37 |
38 | public List> getProductByRow() {
39 | return productByRow;
40 | }
41 |
42 | public void setProductByRow(List> productByRow) {
43 | this.productByRow = productByRow;
44 | }
45 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/Order.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | import java.util.Date;
4 | import java.util.List;
5 |
6 | public class Order {
7 | private Integer id;
8 |
9 | private String order_code;
10 |
11 | private String address;
12 |
13 | private String post;
14 |
15 | private String receiver;
16 |
17 | private String mobile;
18 |
19 | private String user_message;
20 |
21 | private Date create_date;
22 |
23 | private Date pay_date;
24 |
25 | private Date delivery_date;
26 |
27 | private Date confirm_date;
28 |
29 | private Integer user_id;
30 |
31 | private String status;
32 |
33 | /*如下是非数据库字段*/
34 | private List orderItems;
35 |
36 | private User user;
37 |
38 | private float total;
39 |
40 | private int totalNumber;
41 |
42 | public Integer getId() {
43 | return id;
44 | }
45 |
46 | public void setId(Integer id) {
47 | this.id = id;
48 | }
49 |
50 | public String getOrder_code() {
51 | return order_code;
52 | }
53 |
54 | public void setOrder_code(String order_code) {
55 | this.order_code = order_code == null ? null : order_code.trim();
56 | }
57 |
58 | public String getAddress() {
59 | return address;
60 | }
61 |
62 | public void setAddress(String address) {
63 | this.address = address == null ? null : address.trim();
64 | }
65 |
66 | public String getPost() {
67 | return post;
68 | }
69 |
70 | public void setPost(String post) {
71 | this.post = post == null ? null : post.trim();
72 | }
73 |
74 | public String getReceiver() {
75 | return receiver;
76 | }
77 |
78 | public void setReceiver(String receiver) {
79 | this.receiver = receiver == null ? null : receiver.trim();
80 | }
81 |
82 | public String getMobile() {
83 | return mobile;
84 | }
85 |
86 | public void setMobile(String mobile) {
87 | this.mobile = mobile == null ? null : mobile.trim();
88 | }
89 |
90 | public String getUser_message() {
91 | return user_message;
92 | }
93 |
94 | public void setUser_message(String user_message) {
95 | this.user_message = user_message == null ? null : user_message.trim();
96 | }
97 |
98 | public Date getCreate_date() {
99 | return create_date;
100 | }
101 |
102 | public void setCreate_date(Date create_date) {
103 | this.create_date = create_date;
104 | }
105 |
106 | public Date getPay_date() {
107 | return pay_date;
108 | }
109 |
110 | public void setPay_date(Date pay_date) {
111 | this.pay_date = pay_date;
112 | }
113 |
114 | public Date getDelivery_date() {
115 | return delivery_date;
116 | }
117 |
118 | public void setDelivery_date(Date delivery_date) {
119 | this.delivery_date = delivery_date;
120 | }
121 |
122 | public Date getConfirm_date() {
123 | return confirm_date;
124 | }
125 |
126 | public void setConfirm_date(Date confirm_date) {
127 | this.confirm_date = confirm_date;
128 | }
129 |
130 | public Integer getUser_id() {
131 | return user_id;
132 | }
133 |
134 | public void setUser_id(Integer user_id) {
135 | this.user_id = user_id;
136 | }
137 |
138 | public String getStatus() {
139 | return status;
140 | }
141 |
142 | public void setStatus(String status) {
143 | this.status = status == null ? null : status.trim();
144 | }
145 |
146 | public List getOrderItems() {
147 | return orderItems;
148 | }
149 |
150 | public void setOrderItems(List orderItems) {
151 | this.orderItems = orderItems;
152 | }
153 |
154 | public User getUser() {
155 | return user;
156 | }
157 |
158 | public void setUser(User user) {
159 | this.user = user;
160 | }
161 |
162 | public float getTotal() {
163 | return total;
164 | }
165 |
166 | public void setTotal(float total) {
167 | this.total = total;
168 | }
169 |
170 | public int getTotalNumber() {
171 | return totalNumber;
172 | }
173 |
174 | public void setTotalNumber(int totalNumber) {
175 | this.totalNumber = totalNumber;
176 | }
177 |
178 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/OrderItem.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | public class OrderItem {
4 | private Integer id;
5 |
6 | private Integer product_id;
7 |
8 | private Integer order_id;
9 |
10 | private Integer user_id;
11 |
12 | private Integer number;
13 |
14 | private Product product;
15 |
16 | public Product getProduct() {
17 | return product;
18 | }
19 |
20 | public void setProduct(Product product) {
21 | this.product = product;
22 | }
23 |
24 | public Integer getId() {
25 | return id;
26 | }
27 |
28 | public void setId(Integer id) {
29 | this.id = id;
30 | }
31 |
32 | public Integer getProduct_id() {
33 | return product_id;
34 | }
35 |
36 | public void setProduct_id(Integer product_id) {
37 | this.product_id = product_id;
38 | }
39 |
40 | public Integer getOrder_id() {
41 | return order_id;
42 | }
43 |
44 | public void setOrder_id(Integer order_id) {
45 | this.order_id = order_id;
46 | }
47 |
48 | public Integer getUser_id() {
49 | return user_id;
50 | }
51 |
52 | public void setUser_id(Integer user_id) {
53 | this.user_id = user_id;
54 | }
55 |
56 | public Integer getNumber() {
57 | return number;
58 | }
59 |
60 | public void setNumber(Integer number) {
61 | this.number = number;
62 | }
63 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/Product.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | public class Product {
4 | private Integer id;
5 |
6 | private String name;
7 |
8 | private String sub_title;
9 |
10 | private Float price;
11 |
12 | private Integer sale;
13 |
14 | private Integer stock;
15 |
16 | private Integer category_id;
17 |
18 | private Integer reviewCount;
19 |
20 | public Integer getId() {
21 | return id;
22 | }
23 |
24 | public void setId(Integer id) {
25 | this.id = id;
26 | }
27 |
28 | public String getName() {
29 | return name;
30 | }
31 |
32 | public void setName(String name) {
33 | this.name = name == null ? null : name.trim();
34 | }
35 |
36 | public String getSub_title() {
37 | return sub_title;
38 | }
39 |
40 | public void setSub_title(String sub_title) {
41 | this.sub_title = sub_title == null ? null : sub_title.trim();
42 | }
43 |
44 | public Float getPrice() {
45 | return price;
46 | }
47 |
48 | public void setPrice(Float price) {
49 | this.price = price;
50 | }
51 |
52 | public Integer getSale() {
53 | return sale;
54 | }
55 |
56 | public void setSale(Integer sale) {
57 | this.sale = sale;
58 | }
59 |
60 | public Integer getStock() {
61 | return stock;
62 | }
63 |
64 | public void setStock(Integer stock) {
65 | this.stock = stock;
66 | }
67 |
68 | public Integer getCategory_id() {
69 | return category_id;
70 | }
71 |
72 | public void setCategory_id(Integer category_id) {
73 | this.category_id = category_id;
74 | }
75 |
76 | public Integer getReviewCount() {
77 | return reviewCount;
78 | }
79 |
80 | public void setReviewCount(Integer reviewCount) {
81 | this.reviewCount = reviewCount;
82 | }
83 |
84 | public Integer getSaleXReviewCount() {
85 | return this.reviewCount * this.sale;
86 | }
87 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/ProductImage.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | public class ProductImage {
4 | private Integer id;
5 |
6 | private Integer product_id;
7 |
8 | public Integer getId() {
9 | return id;
10 | }
11 |
12 | public void setId(Integer id) {
13 | this.id = id;
14 | }
15 |
16 | public Integer getProduct_id() {
17 | return product_id;
18 | }
19 |
20 | public void setProduct_id(Integer product_id) {
21 | this.product_id = product_id;
22 | }
23 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/Property.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | public class Property {
4 | private Integer id;
5 |
6 | private String name;
7 |
8 | private Integer category_id;
9 |
10 | public Integer getId() {
11 | return id;
12 | }
13 |
14 | public void setId(Integer id) {
15 | this.id = id;
16 | }
17 |
18 | public String getName() {
19 | return name;
20 | }
21 |
22 | public void setName(String name) {
23 | this.name = name == null ? null : name.trim();
24 | }
25 |
26 | public Integer getCategory_id() {
27 | return category_id;
28 | }
29 |
30 | public void setCategory_id(Integer category_id) {
31 | this.category_id = category_id;
32 | }
33 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/PropertyValue.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | public class PropertyValue {
4 | private Integer id;
5 |
6 | private Integer product_id;
7 |
8 | private Integer property_id;
9 |
10 | private String value;
11 |
12 | private Property property;
13 |
14 | public Integer getId() {
15 | return id;
16 | }
17 |
18 | public void setId(Integer id) {
19 | this.id = id;
20 | }
21 |
22 | public Integer getProduct_id() {
23 | return product_id;
24 | }
25 |
26 | public void setProduct_id(Integer product_id) {
27 | this.product_id = product_id;
28 | }
29 |
30 | public Integer getProperty_id() {
31 | return property_id;
32 | }
33 |
34 | public void setProperty_id(Integer property_id) {
35 | this.property_id = property_id;
36 | }
37 |
38 | public String getValue() {
39 | return value;
40 | }
41 |
42 | public void setValue(String value) {
43 | this.value = value == null ? null : value.trim();
44 | }
45 |
46 | public Property getProperty() {
47 | return property;
48 | }
49 |
50 | public void setProperty(Property property) {
51 | this.property = property;
52 | }
53 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/ReferalLink.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | public class ReferalLink {
4 | private Integer id;
5 |
6 | private String text;
7 |
8 | private String link;
9 |
10 | public Integer getId() {
11 | return id;
12 | }
13 |
14 | public void setId(Integer id) {
15 | this.id = id;
16 | }
17 |
18 | public String getText() {
19 | return text;
20 | }
21 |
22 | public void setText(String text) {
23 | this.text = text == null ? null : text.trim();
24 | }
25 |
26 | public String getLink() {
27 | return link;
28 | }
29 |
30 | public void setLink(String link) {
31 | this.link = link == null ? null : link.trim();
32 | }
33 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/Review.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | import java.util.Date;
4 |
5 | public class Review {
6 | private Integer id;
7 |
8 | private String content;
9 |
10 | private Integer user_id;
11 |
12 | private Integer product_id;
13 |
14 | private Date createDate;
15 |
16 | private User user;
17 |
18 | public Integer getId() {
19 | return id;
20 | }
21 |
22 | public void setId(Integer id) {
23 | this.id = id;
24 | }
25 |
26 | public String getContent() {
27 | return content;
28 | }
29 |
30 | public void setContent(String content) {
31 | this.content = content == null ? null : content.trim();
32 | }
33 |
34 | public Integer getUser_id() {
35 | return user_id;
36 | }
37 |
38 | public void setUser_id(Integer user_id) {
39 | this.user_id = user_id;
40 | }
41 |
42 | public Integer getProduct_id() {
43 | return product_id;
44 | }
45 |
46 | public void setProduct_id(Integer product_id) {
47 | this.product_id = product_id;
48 | }
49 |
50 | public Date getCreateDate() {
51 | return createDate;
52 | }
53 |
54 | public void setCreateDate(Date createDate) {
55 | this.createDate = createDate;
56 | }
57 |
58 | public User getUser() {
59 | return user;
60 | }
61 |
62 | public void setUser(User user) {
63 | this.user = user;
64 | }
65 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/pojo/User.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.pojo;
2 |
3 | public class User {
4 | private Integer id;
5 |
6 | private String name;
7 |
8 | private String password;
9 |
10 | public Integer getId() {
11 | return id;
12 | }
13 |
14 | public void setId(Integer id) {
15 | this.id = id;
16 | }
17 |
18 | public String getName() {
19 | return name;
20 | }
21 |
22 | public void setName(String name) {
23 | this.name = name == null ? null : name.trim();
24 | }
25 |
26 | public String getPassword() {
27 | return password;
28 | }
29 |
30 | public void setPassword(String password) {
31 | this.password = password == null ? null : password.trim();
32 | }
33 |
34 | public String getAnonymousName() {
35 | if (name == null){
36 | return null;
37 | }
38 | if (name.length() <= 1){
39 | return "*";
40 | }
41 | if (name.length() == 2){
42 | return name.substring(0, 1) + "*";
43 | }
44 |
45 | char[] cs = name.toCharArray();
46 | for (int i = 1; i < cs.length - 1; i++) {
47 | cs[i] = '*';
48 | }
49 | return new String(cs);
50 | }
51 | }
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/CategoryService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.Category;
4 |
5 | import java.util.List;
6 |
7 | public interface CategoryService {
8 |
9 | /**
10 | * 返回分类列表
11 | * @return
12 | */
13 | List list();
14 |
15 | /**
16 | * 通过id获取对应的数据
17 | * @param id
18 | * @return
19 | */
20 | Category get(Integer id);
21 |
22 | /**
23 | * 更新分类
24 | * @param category
25 | * @return
26 | */
27 | void update(Category category);
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/CategoryServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.CategoryMapper;
4 | import cn.wmyskxz.pojo.Category;
5 | import cn.wmyskxz.pojo.CategoryExample;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * CategoryService 的实现类
13 | *
14 | * @author: @我没有三颗心脏
15 | * @create: 2018-04-27-下午 16:35
16 | */
17 | @Service
18 | public class CategoryServiceImpl implements CategoryService {
19 |
20 | @Autowired
21 | CategoryMapper categoryMapper;
22 |
23 | public List list() {
24 | CategoryExample example = new CategoryExample();
25 | List categories = categoryMapper.selectByExample(example);
26 | return categories;
27 | }
28 |
29 | public Category get(Integer id) {
30 | return categoryMapper.selectByPrimaryKey(id);
31 | }
32 |
33 | public void update(Category category) {
34 | categoryMapper.updateByPrimaryKey(category);
35 | }
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/OrderItemService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.Order;
4 | import cn.wmyskxz.pojo.OrderItem;
5 |
6 | import java.util.List;
7 |
8 | public interface OrderItemService {
9 |
10 | /**
11 | * 通过id返回OrderItem项
12 | *
13 | * @param id
14 | * @return
15 | */
16 | OrderItem getById(Integer id);
17 |
18 | /**
19 | * 增加一条订单数据
20 | *
21 | * @param orderItem
22 | */
23 | void add(OrderItem orderItem);
24 |
25 | /**
26 | * 通过订单id查询到该订单下所有的Item
27 | *
28 | * @param order_id
29 | * @return
30 | */
31 | List getByOrderId(Integer order_id);
32 |
33 | /**
34 | * 更新OrderItem,也只是更新number属性
35 | *
36 | * @param orderItem
37 | */
38 | void update(OrderItem orderItem);
39 |
40 | /**
41 | * 根据user_id来该用户下对应的所有订单项
42 | *
43 | * @param user_id
44 | * @return
45 | */
46 | List listByUserId(Integer user_id);
47 |
48 | /**
49 | * 返回当前user_id下的购物车订单列表
50 | *
51 | * @param user_id
52 | * @return
53 | */
54 | List listForCart(Integer user_id);
55 |
56 | /**
57 | * 通过id删除订单项
58 | *
59 | * @param id
60 | */
61 | void delete(Integer id);
62 |
63 | /**
64 | * 为List填充订单项
65 | *
66 | * @param orders
67 | */
68 | void fill(List orders);
69 |
70 | /**
71 | * 为Order填充订单项
72 | *
73 | * @param o
74 | */
75 | void fill(Order o);
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/OrderItemServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.OrderItemMapper;
4 | import cn.wmyskxz.pojo.Order;
5 | import cn.wmyskxz.pojo.OrderItem;
6 | import cn.wmyskxz.pojo.OrderItemExample;
7 | import cn.wmyskxz.pojo.Product;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * OrderItemService 实现类
15 | *
16 | * @author: @我没有三颗心脏
17 | * @create: 2018-04-29-上午 10:15
18 | */
19 | @Service
20 | public class OrderItemServiceImpl implements OrderItemService {
21 |
22 | @Autowired
23 | OrderItemMapper orderItemMapper;
24 |
25 | @Autowired
26 | ProductService productService;
27 |
28 | @Override
29 | public void add(OrderItem orderItem) {
30 | orderItemMapper.insert(orderItem);
31 | }
32 |
33 | @Override
34 | public OrderItem getById(Integer id) {
35 | OrderItem orderItem = orderItemMapper.selectByPrimaryKey(id);
36 | setProduct(orderItem);
37 | return orderItem;
38 | }
39 |
40 | @Override
41 | public List getByOrderId(Integer order_id) {
42 | OrderItemExample example = new OrderItemExample();
43 | example.or().andOrder_idEqualTo(order_id);
44 | List result = orderItemMapper.selectByExample(example);
45 | setProduct(result);
46 | return result;
47 | }
48 |
49 | @Override
50 | public void update(OrderItem orderItem) {
51 | orderItemMapper.updateByPrimaryKey(orderItem);
52 | }
53 |
54 | @Override
55 | public List listByUserId(Integer user_id) {
56 | OrderItemExample example = new OrderItemExample();
57 | example.or().andUser_idEqualTo(user_id);
58 | List result = orderItemMapper.selectByExample(example);
59 | setProduct(result);
60 | return result;
61 | }
62 |
63 | @Override
64 | public List listForCart(Integer user_id) {
65 | OrderItemExample example = new OrderItemExample();
66 | example.or().andUser_idEqualTo(user_id).andOrder_idIsNull();
67 | List result = orderItemMapper.selectByExample(example);
68 | setProduct(result);
69 | return result;
70 | }
71 |
72 | public void setProduct(List ois) {
73 | for (OrderItem oi : ois) {
74 | setProduct(oi);
75 | }
76 | }
77 |
78 | private void setProduct(OrderItem oi) {
79 | Product p = productService.get(oi.getProduct_id());
80 | oi.setProduct(p);
81 | }
82 |
83 | @Override
84 | public void delete(Integer id) {
85 | orderItemMapper.deleteByPrimaryKey(id);
86 | }
87 |
88 | @Override
89 | public void fill(List orders) {
90 | for (Order o : orders) {
91 | fill(o);
92 | }
93 | }
94 |
95 | @Override
96 | public void fill(Order order) {
97 | OrderItemExample example = new OrderItemExample();
98 | example.or().andOrder_idEqualTo(order.getId());
99 | example.setOrderByClause("id desc");
100 | List orderItems = orderItemMapper.selectByExample(example);
101 | setProduct(orderItems);
102 |
103 | float total = 0;
104 | int totalNumber = 0;
105 | for (OrderItem oi : orderItems) {
106 | total += oi.getNumber() * oi.getProduct().getPrice();
107 | totalNumber += oi.getNumber();
108 | }
109 | order.setTotal(total);
110 | order.setTotalNumber(totalNumber);
111 | order.setOrderItems(orderItems);
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/OrderService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.Order;
4 | import cn.wmyskxz.pojo.OrderItem;
5 |
6 | import java.util.List;
7 |
8 | public interface OrderService {
9 |
10 | String waitPay = "waitPay";
11 | String waitDelivery = "waitDelivery";
12 | String waitConfirm = "waitConfirm";
13 | String waitReview = "waitReview";
14 | String finish = "finish";
15 | String delete = "delete";
16 |
17 | /**
18 | * 根据ID返回对应的Order
19 | *
20 | * @param id
21 | * @return
22 | */
23 | Order get(int id);
24 |
25 | /**
26 | * 返回所有的订单
27 | *
28 | * @return
29 | */
30 | List listAll();
31 |
32 | /**
33 | * 按照用户、订单状态来查询
34 | *
35 | * @param user_id
36 | * @param excludedStatus
37 | * @return
38 | */
39 | List list(Integer user_id, String excludedStatus);
40 |
41 | /**
42 | * 返回user_id下的所有订单
43 | *
44 | * @param user_id
45 | * @return
46 | */
47 | List listByUserId(Integer user_id);
48 |
49 | /**
50 | * 更新订单
51 | *
52 | * @param order
53 | */
54 | void update(Order order);
55 |
56 | /**
57 | * 增加订单
58 | *
59 | * @param order
60 | */
61 | void add(Order order);
62 |
63 | /**
64 | * 增加订单,返回一个float类型的数值用来表示该订单的总价
65 | *
66 | * @param order
67 | * @param orderItems
68 | * @return
69 | */
70 | float add(Order order, List orderItems);
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/OrderServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.OrderMapper;
4 | import cn.wmyskxz.pojo.Order;
5 | import cn.wmyskxz.pojo.OrderExample;
6 | import cn.wmyskxz.pojo.OrderItem;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 | import org.springframework.transaction.annotation.Propagation;
10 | import org.springframework.transaction.annotation.Transactional;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * OrderService 实现类
16 | *
17 | * @author: @我没有三颗心脏
18 | * @create: 2018-04-29-上午 10:19
19 | */
20 | @Service
21 | public class OrderServiceImpl implements OrderService {
22 |
23 | @Autowired
24 | OrderMapper orderMapper;
25 |
26 | @Autowired
27 | OrderItemService orderItemService;
28 |
29 | @Override
30 | public Order get(int id) {
31 | return orderMapper.selectByPrimaryKey(id);
32 | }
33 |
34 | @Override
35 | public List listAll() {
36 | OrderExample example = new OrderExample();
37 | return orderMapper.selectByExample(example);
38 | }
39 |
40 | @Override
41 | public List list(Integer user_id, String excludedStatus) {
42 | OrderExample example = new OrderExample();
43 | example.or().andUser_idEqualTo(user_id).andStatusNotEqualTo(excludedStatus);
44 | example.setOrderByClause("id desc");
45 | return orderMapper.selectByExample(example);
46 | }
47 |
48 | @Override
49 | public List listByUserId(Integer user_id) {
50 | OrderExample example = new OrderExample();
51 | example.or().andUser_idEqualTo(user_id);
52 | return orderMapper.selectByExample(example);
53 | }
54 |
55 | @Override
56 | public void update(Order order) {
57 | orderMapper.updateByPrimaryKey(order);
58 | }
59 |
60 | @Override
61 | public void add(Order c) {
62 | orderMapper.insert(c);
63 | }
64 |
65 | @Override
66 | @Transactional(propagation = Propagation.REQUIRED, rollbackForClassName = "Exception")
67 | public float add(Order order, List orderItems) {
68 | float total = 0;
69 | add(order);
70 |
71 | // 用来模拟当增加订单后出现异常,观察事务管理是否预期发生
72 | if (false)
73 | throw new RuntimeException();
74 |
75 | for (OrderItem oi : orderItems) {
76 | oi.setOrder_id(order.getId());
77 | orderItemService.update(oi);
78 | total += oi.getProduct().getPrice() * oi.getNumber();
79 | }
80 | return total;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/ProductImageService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.ProductImage;
4 |
5 | import java.util.List;
6 |
7 | public interface ProductImageService {
8 |
9 | void add(ProductImage image);
10 |
11 | void deleteByProductId(Integer product_id);
12 |
13 | void update(ProductImage image);
14 |
15 | ProductImage get(Integer id);
16 |
17 | List list(Integer product_id);
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/ProductImageServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.ProductImageMapper;
4 | import cn.wmyskxz.pojo.ProductImage;
5 | import cn.wmyskxz.pojo.ProductImageExample;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * ProductImageService 实现类
13 | *
14 | * @author: @我没有三颗心脏
15 | * @create: 2018-04-28-上午 11:04
16 | */
17 | @Service
18 | public class ProductImageServiceImpl implements ProductImageService {
19 |
20 | @Autowired
21 | ProductImageMapper productImageMapper;
22 |
23 | public void add(ProductImage image) {
24 | productImageMapper.insert(image);
25 | }
26 |
27 | public void deleteByProductId(Integer product_id) {
28 |
29 | // 按条件查询出需要删除的列表
30 | ProductImageExample example = new ProductImageExample();
31 | example.or().andProduct_idEqualTo(product_id);
32 | List productImages = list(product_id);
33 |
34 | // 循环删除
35 | for (int i = 0; i < productImages.size(); i++) {
36 | productImageMapper.deleteByPrimaryKey(productImages.get(i).getId());
37 | }
38 | }
39 |
40 | public void update(ProductImage image) {
41 | productImageMapper.updateByPrimaryKey(image);
42 | }
43 |
44 | public ProductImage get(Integer id) {
45 | return productImageMapper.selectByPrimaryKey(id);
46 | }
47 |
48 | public List list(Integer product_id) {
49 | ProductImageExample example = new ProductImageExample();
50 | example.or().andProduct_idEqualTo(product_id);
51 | List productImages = productImageMapper.selectByExample(example);
52 | return productImages;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/ProductService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.Category;
4 | import cn.wmyskxz.pojo.Product;
5 |
6 | import java.util.List;
7 |
8 | public interface ProductService {
9 |
10 | /**
11 | * 增加一条数据
12 | *
13 | * @param product
14 | */
15 | void add(Product product);
16 |
17 | /**
18 | * 通过id删除一条数据
19 | *
20 | * @param id
21 | */
22 | void delete(Integer id);
23 |
24 | /**
25 | * 更新一条数据
26 | *
27 | * @param product
28 | */
29 | void update(Product product);
30 |
31 | /**
32 | * 根据id获取一条数据
33 | *
34 | * @param id
35 | * @return
36 | */
37 | Product get(Integer id);
38 |
39 | /**
40 | * 根据category_id返回所有对应的Product数据
41 | *
42 | * @param category_id
43 | * @return
44 | */
45 | List list(Integer category_id);
46 |
47 | /**
48 | * 为多个分类填充产品集合
49 | *
50 | * @param categories
51 | */
52 | void fill(List categories);
53 |
54 | /**
55 | * 为一个分类填充产品集合
56 | *
57 | * @param category
58 | */
59 | void fill(Category category);
60 |
61 | /**
62 | * 为多个分类填充产品集合
63 | *
64 | * @param categories
65 | */
66 | void fillByRow(List categories);
67 |
68 | /**
69 | * 为产品填充ReviewCount字段
70 | *
71 | * @param product
72 | */
73 | void setReviewCount(Product product);
74 |
75 | /**
76 | * 根据keyword返回相应的产品集合
77 | *
78 | * @param keyword
79 | * @return
80 | */
81 | List search(String keyword);
82 | }
83 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/ProductServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.ProductMapper;
4 | import cn.wmyskxz.pojo.Category;
5 | import cn.wmyskxz.pojo.Product;
6 | import cn.wmyskxz.pojo.ProductExample;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | /**
14 | * ProductService 实现类
15 | *
16 | * @author: @我没有三颗心脏
17 | * @create: 2018-04-27-下午 20:16
18 | */
19 | @Service
20 | public class ProductServiceImpl implements ProductService {
21 |
22 | @Autowired
23 | ProductMapper productMapper;
24 |
25 | @Autowired
26 | ReviewService reviewService;
27 |
28 | @Override
29 | public void add(Product product) {
30 | productMapper.insert(product);
31 | }
32 |
33 | @Override
34 | public void delete(Integer id) {
35 | productMapper.deleteByPrimaryKey(id);
36 | }
37 |
38 | @Override
39 | public void update(Product product) {
40 | productMapper.updateByPrimaryKey(product);
41 | }
42 |
43 | @Override
44 | public Product get(Integer id) {
45 | return productMapper.selectByPrimaryKey(id);
46 | }
47 |
48 | @Override
49 | public List list(Integer category_id) {
50 | ProductExample example = new ProductExample();
51 | example.or().andCategory_idEqualTo(category_id);
52 | List products = productMapper.selectByExample(example);
53 | return products;
54 | }
55 |
56 | @Override
57 | public void fill(List categories) {
58 | for (Category category : categories) {
59 | fill(category);
60 | }
61 | }
62 |
63 | @Override
64 | public void fill(Category category) {
65 | List products = list(category.getId());
66 | category.setProducts(products);
67 | }
68 |
69 | @Override
70 | public void fillByRow(List categories) {
71 | int productNumberOfEachRow = 8;
72 | for (Category category : categories) {
73 | List products = category.getProducts();
74 | List> productByRow = new ArrayList<>();
75 | for (int i = 0; i < products.size(); i += productNumberOfEachRow) {
76 | int size = i + productNumberOfEachRow;
77 | size = size > products.size() ? products.size() : size;
78 | List productsOfEachRow = products.subList(i, size);
79 | productByRow.add(productsOfEachRow);
80 | }
81 | category.setProductByRow(productByRow);
82 | }
83 | }
84 |
85 | @Override
86 | public void setReviewCount(Product product) {
87 | int reviewCount = reviewService.getCount(product.getId());
88 | product.setReviewCount(reviewCount);
89 | }
90 |
91 | @Override
92 | public List search(String keyword) {
93 | ProductExample example = new ProductExample();
94 | example.or().andNameLike("%" + keyword + "%");
95 | example.setOrderByClause("id desc");
96 | return productMapper.selectByExample(example);
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/PropertyService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.Property;
4 |
5 | import java.util.List;
6 |
7 | public interface PropertyService {
8 |
9 | /**
10 | * 增加一条属性
11 | * @param property
12 | */
13 | void add(Property property);
14 |
15 | /**
16 | * 根据id删除一条数据
17 | * @param id
18 | */
19 | void delete(Integer id);
20 |
21 | /**
22 | * 更新一条数据
23 | * @param property
24 | */
25 | void update(Property property);
26 |
27 | /**
28 | * 返回所有的category_id下的Property列表
29 | * @return
30 | */
31 | List list(Integer category_id);
32 |
33 | /**
34 | * 根据id返回一条数据
35 | * @param id
36 | */
37 | Property get(Integer id);
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/PropertyServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.PropertyMapper;
4 | import cn.wmyskxz.pojo.Property;
5 | import cn.wmyskxz.pojo.PropertyExample;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * PropertyService 实现类
13 | *
14 | * @author: @我没有三颗心脏
15 | * @create: 2018-04-27-下午 19:07
16 | */
17 | @Service
18 | public class PropertyServiceImpl implements PropertyService {
19 |
20 | @Autowired
21 | PropertyMapper propertyMapper;
22 |
23 | public void add(Property property) {
24 | propertyMapper.insert(property);
25 | }
26 |
27 | public void delete(Integer id) {
28 | propertyMapper.deleteByPrimaryKey(id);
29 | }
30 |
31 | public void update(Property property) {
32 | propertyMapper.updateByPrimaryKey(property);
33 | }
34 |
35 | public List list(Integer category_id) {
36 | PropertyExample example = new PropertyExample();
37 | example.or().andCategory_idEqualTo(category_id);
38 | List properties = propertyMapper.selectByExample(example);
39 | return properties;
40 | }
41 |
42 | public Property get(Integer id) {
43 | return propertyMapper.selectByPrimaryKey(id);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/PropertyValueService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.PropertyValue;
4 |
5 | import java.util.List;
6 |
7 | public interface PropertyValueService {
8 |
9 | /**
10 | * 增加一条属性
11 | *
12 | * @param propertyValue
13 | */
14 | void add(PropertyValue propertyValue);
15 |
16 | /**
17 | * 根据id删除一条数据
18 | *
19 | * @param id
20 | */
21 | void delete(Integer id);
22 |
23 | /**
24 | * 根据 product_id 来删除对应的数据
25 | *
26 | * @param product_id
27 | */
28 | void deleteByProductId(Integer product_id);
29 |
30 | /**
31 | * 更新一条数据
32 | *
33 | * @param propertyValue
34 | */
35 | void update(PropertyValue propertyValue);
36 |
37 | /**
38 | * PropertyValue 表有两个外键,需要根据这两个外键进行匹配
39 | * 返回对应的所有 PropertyValue 值
40 | *
41 | * @return
42 | */
43 | List list(Integer product_id, Integer category_id);
44 |
45 | /**
46 | * 根据id返回一条数据
47 | *
48 | * @param id
49 | */
50 | PropertyValue get(Integer id);
51 |
52 | /**
53 | * 根据product_id返回PropertyValue,
54 | * 并设置好自身的Property
55 | *
56 | * @param product_id
57 | * @return
58 | */
59 | List listByProductId(Integer product_id);
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/PropertyValueServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.PropertyValueMapper;
4 | import cn.wmyskxz.pojo.*;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * cn.wmyskxz.pojo.PropertyValueValueService 实现类
13 | *
14 | * @author: @我没有三颗心脏
15 | * @create: 2018-04-28-上午 7:47
16 | */
17 | @Service
18 | public class PropertyValueServiceImpl implements PropertyValueService {
19 |
20 | @Autowired
21 | PropertyValueMapper propertyValueMapper;
22 |
23 | @Autowired
24 | PropertyService propertyService;
25 |
26 | @Autowired
27 | ProductService productService;
28 |
29 | public void add(PropertyValue propertyValue) {
30 | propertyValueMapper.insert(propertyValue);
31 | }
32 |
33 | public void delete(Integer id) {
34 | propertyValueMapper.deleteByPrimaryKey(id);
35 | }
36 |
37 | public void deleteByProductId(Integer product_id) {
38 | // 按条件查询出需要删除的列表
39 | PropertyValueExample example = new PropertyValueExample();
40 | example.or().andProduct_idEqualTo(product_id);
41 | Integer category_id = productService.get(product_id).getCategory_id();
42 | List propertyValues = list(product_id, category_id);
43 | // 循环删除
44 | for (int i = 0; i < propertyValues.size(); i++) {
45 | propertyValueMapper.deleteByPrimaryKey(propertyValues.get(i).getId());
46 | }
47 | }
48 |
49 | public void update(PropertyValue propertyValue) {
50 | propertyValueMapper.updateByPrimaryKey(propertyValue);
51 | }
52 |
53 | public List list(Integer product_id, Integer category_id) {
54 | PropertyValueExample example = new PropertyValueExample();
55 | List propertyValues = new ArrayList<>();
56 | List properties = propertyService.list(category_id);
57 | for (Property property : properties) {
58 | // 筛选出同时匹配 property_id 和 product_id 的值
59 | example.or().andProperty_idEqualTo(property.getId()).andProduct_idEqualTo(product_id);
60 | propertyValues.addAll(propertyValueMapper.selectByExample(example));
61 | }
62 | return propertyValues;
63 | }
64 |
65 | public PropertyValue get(Integer id) {
66 | return propertyValueMapper.selectByPrimaryKey(id);
67 | }
68 |
69 | public List listByProductId(Integer product_id) {
70 | PropertyValueExample example = new PropertyValueExample();
71 | example.or().andProduct_idEqualTo(product_id);
72 | List propertyValues = propertyValueMapper.selectByExample(example);
73 | for (PropertyValue propertyValue : propertyValues) {
74 | Property property = propertyService.get(propertyValue.getProperty_id());
75 | propertyValue.setProperty(property);
76 | }
77 | return propertyValues;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/ReferalLinkService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.ReferalLink;
4 |
5 | import java.util.List;
6 |
7 | public interface ReferalLinkService {
8 |
9 | /**
10 | * 返回所有的ReferalLink
11 | *
12 | * @return
13 | */
14 | List listAll();
15 |
16 | /**
17 | * 更新
18 | *
19 | * @param link
20 | */
21 | void update(ReferalLink link);
22 |
23 | /**
24 | * 更新链接显示的文本
25 | *
26 | * @param id
27 | * @param text
28 | */
29 | void updateLinkText(Integer id, String text);
30 |
31 | /**
32 | * 更新链接的链接地址
33 | *
34 | * @param id
35 | * @param link
36 | */
37 | void updateLinkLink(Integer id, String link);
38 |
39 | /**
40 | * 根据id返回一个ReferalLink对象
41 | *
42 | * @param id
43 | * @return
44 | */
45 | ReferalLink get(Integer id);
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/ReferalLinkServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.ReferalLinkMapper;
4 | import cn.wmyskxz.pojo.ReferalLink;
5 | import cn.wmyskxz.pojo.ReferalLinkExample;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * ReferalLinkService 实现类
13 | *
14 | * @author: @我没有三颗心脏
15 | * @create: 2018-04-29-上午 10:48
16 | */
17 | @Service
18 | public class ReferalLinkServiceImpl implements ReferalLinkService {
19 |
20 | @Autowired
21 | ReferalLinkMapper referalLinkMapper;
22 |
23 | public List listAll() {
24 | ReferalLinkExample example = new ReferalLinkExample();
25 | return referalLinkMapper.selectByExample(example);
26 | }
27 |
28 | public void updateLinkText(Integer id, String text) {
29 | ReferalLink referalLink = get(id);
30 | referalLink.setText(text);
31 | referalLinkMapper.updateByPrimaryKey(referalLink);
32 | }
33 |
34 | public void update(ReferalLink link) {
35 | referalLinkMapper.updateByPrimaryKey(link);
36 | }
37 |
38 | public void updateLinkLink(Integer id, String link) {
39 | ReferalLink referalLink = get(id);
40 | referalLink.setLink(link);
41 | referalLinkMapper.updateByPrimaryKey(referalLink);
42 | }
43 |
44 | public ReferalLink get(Integer id) {
45 | return referalLinkMapper.selectByPrimaryKey(id);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/ReviewService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.Review;
4 |
5 | import java.util.List;
6 |
7 | public interface ReviewService {
8 |
9 | /**
10 | * 增加一条评论
11 | *
12 | * @param review
13 | */
14 | void add(Review review);
15 |
16 | /**
17 | * 删除一条评论
18 | *
19 | * @param id
20 | */
21 | void delete(int id);
22 |
23 | /**
24 | * 更新一条评论
25 | *
26 | * @param review
27 | */
28 | void update(Review review);
29 |
30 | /**
31 | * 通过id返回一条Review
32 | *
33 | * @param id
34 | * @return
35 | */
36 | Review get(int id);
37 |
38 | /**
39 | * 根据product_id来返回当前产品下的所有评论
40 | *
41 | * @param product_id
42 | * @return
43 | */
44 | List listByProductId(Integer product_id);
45 |
46 | /**
47 | * 返回当前产品下评论的数量
48 | *
49 | * @param product_id
50 | * @return
51 | */
52 | int getCount(int product_id);
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/ReviewServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.ReviewMapper;
4 | import cn.wmyskxz.pojo.Review;
5 | import cn.wmyskxz.pojo.ReviewExample;
6 | import cn.wmyskxz.pojo.User;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * ReviewService 实现类
14 | *
15 | * @author: @我没有三颗心脏
16 | * @create: 2018-05-02-上午 7:51
17 | */
18 | @Service
19 | public class ReviewServiceImpl implements ReviewService {
20 |
21 | @Autowired
22 | ReviewMapper reviewMapper;
23 |
24 | @Autowired
25 | UserService userService;
26 |
27 | @Override
28 | public void add(Review review) {
29 | reviewMapper.insert(review);
30 | }
31 |
32 | @Override
33 | public void delete(int id) {
34 | reviewMapper.deleteByPrimaryKey(id);
35 | }
36 |
37 | @Override
38 | public void update(Review review) {
39 | reviewMapper.updateByPrimaryKeySelective(review);
40 | }
41 |
42 | @Override
43 | public Review get(int id) {
44 | return reviewMapper.selectByPrimaryKey(id);
45 | }
46 |
47 | @Override
48 | public List listByProductId(Integer product_id) {
49 | ReviewExample example = new ReviewExample();
50 | example.or().andProduct_idEqualTo(product_id);
51 | example.setOrderByClause("id desc");
52 |
53 | List reviews = reviewMapper.selectByExample(example);
54 | setUser(reviews);
55 | return reviews;
56 | }
57 |
58 | public void setUser(List reviews) {
59 | for (Review review : reviews) {
60 | setUser(review);
61 | }
62 | }
63 |
64 | private void setUser(Review review) {
65 | int user_id = review.getUser_id();
66 | User user = userService.get(user_id);
67 | review.setUser(user);
68 | }
69 |
70 | @Override
71 | public int getCount(int product_id) {
72 | return listByProductId(product_id).size();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/UserService.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.pojo.User;
4 |
5 | import java.util.List;
6 |
7 | public interface UserService {
8 |
9 | /**
10 | * 返回所有的用户
11 | *
12 | * @return
13 | */
14 | List list();
15 |
16 | /**
17 | * 更改用户密码
18 | *
19 | * @param id
20 | * @param password
21 | */
22 | void updatePassword(int id, String password);
23 |
24 | /**
25 | * 根据id获取用户
26 | *
27 | * @param id
28 | * @return
29 | */
30 | User get(Integer id);
31 |
32 | /**
33 | * 根据用户名和密码来查询用户
34 | *
35 | * @param name
36 | * @param password
37 | * @return
38 | */
39 | User get(String name, String password);
40 |
41 | /**
42 | * 根据用户名判断用户是否存在
43 | *
44 | * @param name
45 | * @return
46 | */
47 | boolean isExist(String name);
48 |
49 | /**
50 | * 增加一条用户数据
51 | *
52 | * @param user
53 | */
54 | void add(User user);
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/cn/wmyskxz/service/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.wmyskxz.service;
2 |
3 | import cn.wmyskxz.mapper.UserMapper;
4 | import cn.wmyskxz.pojo.User;
5 | import cn.wmyskxz.pojo.UserExample;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * UserService 实现类
13 | *
14 | * @author: @我没有三颗心脏
15 | * @create: 2018-04-29-上午 9:47
16 | */
17 | @Service
18 | public class UserServiceImpl implements UserService {
19 |
20 | @Autowired
21 | UserMapper userMapper;
22 |
23 | @Override
24 | public List list() {
25 | UserExample example = new UserExample();
26 | return userMapper.selectByExample(example);
27 | }
28 |
29 | @Override
30 | public void updatePassword(int id, String password) {
31 | User user = get(id);
32 | user.setPassword(password);
33 | userMapper.updateByPrimaryKey(user);
34 | }
35 |
36 | @Override
37 | public User get(Integer id) {
38 | return userMapper.selectByPrimaryKey(id);
39 | }
40 |
41 | @Override
42 | public User get(String name, String password) {
43 | UserExample example = new UserExample();
44 | example.or().andNameEqualTo(name).andPasswordEqualTo(password);
45 | List result = userMapper.selectByExample(example);
46 | if (result.isEmpty())
47 | return null;
48 | return result.get(0);
49 | }
50 |
51 | @Override
52 | public boolean isExist(String name) {
53 | UserExample example =new UserExample();
54 | example.or().andNameEqualTo(name);
55 | List result= userMapper.selectByExample(example);
56 | if(!result.isEmpty())
57 | return true;
58 | return false;
59 | }
60 |
61 | @Override
62 | public void add(User user) {
63 | userMapper.insert(user);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/resources/jdbc.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/resources/jdbc.properties
--------------------------------------------------------------------------------
/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/CategoryMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | and ${criterion.condition}
17 |
18 |
19 | and ${criterion.condition} #{criterion.value}
20 |
21 |
22 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
23 |
24 |
25 | and ${criterion.condition}
26 |
28 | #{listItem}
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | id, name
40 |
41 |
56 |
62 |
63 | delete from category
64 | where id = #{id,jdbcType=INTEGER}
65 |
66 |
68 | insert into category (name)
69 | values (#{name,jdbcType=VARCHAR})
70 |
71 |
73 | insert into category
74 |
75 |
76 | name,
77 |
78 |
79 |
80 |
81 | #{name,jdbcType=VARCHAR},
82 |
83 |
84 |
85 |
86 | update category
87 |
88 |
89 | name = #{name,jdbcType=VARCHAR},
90 |
91 |
92 | where id = #{id,jdbcType=INTEGER}
93 |
94 |
95 | update category
96 | set name = #{name,jdbcType=VARCHAR}
97 | where id = #{id,jdbcType=INTEGER}
98 |
99 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/ProductImageMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | and ${criterion.condition}
17 |
18 |
19 | and ${criterion.condition} #{criterion.value}
20 |
21 |
22 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
23 |
24 |
25 | and ${criterion.condition}
26 |
28 | #{listItem}
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | id, product_id
40 |
41 |
56 |
62 |
63 | delete from product_image
64 | where id = #{id,jdbcType=INTEGER}
65 |
66 |
68 | insert into product_image (product_id)
69 | values (#{product_id,jdbcType=INTEGER})
70 |
71 |
73 | insert into product_image
74 |
75 |
76 | product_id,
77 |
78 |
79 |
80 |
81 | #{product_id,jdbcType=INTEGER},
82 |
83 |
84 |
85 |
86 | update product_image
87 |
88 |
89 | product_id = #{product_id,jdbcType=INTEGER},
90 |
91 |
92 | where id = #{id,jdbcType=INTEGER}
93 |
94 |
95 | update product_image
96 | set product_id = #{product_id,jdbcType=INTEGER}
97 | where id = #{id,jdbcType=INTEGER}
98 |
99 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/PropertyMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | and ${criterion.condition}
18 |
19 |
20 | and ${criterion.condition} #{criterion.value}
21 |
22 |
23 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
24 |
25 |
26 | and ${criterion.condition}
27 |
29 | #{listItem}
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | id, name, category_id
41 |
42 |
57 |
63 |
64 | delete from property
65 | where id = #{id,jdbcType=INTEGER}
66 |
67 |
69 | insert into property (name, category_id)
70 | values (#{name,jdbcType=VARCHAR}, #{category_id,jdbcType=INTEGER})
71 |
72 |
74 | insert into property
75 |
76 |
77 | name,
78 |
79 |
80 | category_id,
81 |
82 |
83 |
84 |
85 | #{name,jdbcType=VARCHAR},
86 |
87 |
88 | #{category_id,jdbcType=INTEGER},
89 |
90 |
91 |
92 |
93 | update property
94 |
95 |
96 | name = #{name,jdbcType=VARCHAR},
97 |
98 |
99 | category_id = #{category_id,jdbcType=INTEGER},
100 |
101 |
102 | where id = #{id,jdbcType=INTEGER}
103 |
104 |
105 | update property
106 | set name = #{name,jdbcType=VARCHAR},
107 | category_id = #{category_id,jdbcType=INTEGER}
108 | where id = #{id,jdbcType=INTEGER}
109 |
110 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/ReferalLinkMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | and ${criterion.condition}
18 |
19 |
20 | and ${criterion.condition} #{criterion.value}
21 |
22 |
23 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
24 |
25 |
26 | and ${criterion.condition}
27 |
29 | #{listItem}
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | id, text, link
41 |
42 |
57 |
63 |
64 | delete from referal_link
65 | where id = #{id,jdbcType=INTEGER}
66 |
67 |
69 | insert into referal_link (text, link)
70 | values (#{text,jdbcType=VARCHAR}, #{link,jdbcType=VARCHAR})
71 |
72 |
74 | insert into referal_link
75 |
76 |
77 | text,
78 |
79 |
80 | link,
81 |
82 |
83 |
84 |
85 | #{text,jdbcType=VARCHAR},
86 |
87 |
88 | #{link,jdbcType=VARCHAR},
89 |
90 |
91 |
92 |
93 | update referal_link
94 |
95 |
96 | text = #{text,jdbcType=VARCHAR},
97 |
98 |
99 | link = #{link,jdbcType=VARCHAR},
100 |
101 |
102 | where id = #{id,jdbcType=INTEGER}
103 |
104 |
105 | update referal_link
106 | set text = #{text,jdbcType=VARCHAR},
107 | link = #{link,jdbcType=VARCHAR}
108 | where id = #{id,jdbcType=INTEGER}
109 |
110 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/UserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | and ${criterion.condition}
18 |
19 |
20 | and ${criterion.condition} #{criterion.value}
21 |
22 |
23 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
24 |
25 |
26 | and ${criterion.condition}
27 |
29 | #{listItem}
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | id, name, password
41 |
42 |
57 |
63 |
64 | delete from user
65 | where id = #{id,jdbcType=INTEGER}
66 |
67 |
68 | insert into user (name, password)
69 | values (#{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR})
70 |
71 |
73 | insert into user
74 |
75 |
76 | name,
77 |
78 |
79 | password,
80 |
81 |
82 |
83 |
84 | #{name,jdbcType=VARCHAR},
85 |
86 |
87 | #{password,jdbcType=VARCHAR},
88 |
89 |
90 |
91 |
92 | update user
93 |
94 |
95 | name = #{name,jdbcType=VARCHAR},
96 |
97 |
98 | password = #{password,jdbcType=VARCHAR},
99 |
100 |
101 | where id = #{id,jdbcType=INTEGER}
102 |
103 |
104 | update user
105 | set name = #{name,jdbcType=VARCHAR},
106 | password = #{password,jdbcType=VARCHAR}
107 | where id = #{id,jdbcType=INTEGER}
108 |
109 |
--------------------------------------------------------------------------------
/src/main/resources/spring-mvc.xml:
--------------------------------------------------------------------------------
1 |
2 |
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 |
--------------------------------------------------------------------------------
/src/main/resources/spring-mybatis.xml:
--------------------------------------------------------------------------------
1 |
2 |
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 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/admin/editCategory.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
4 |
5 |
6 |
7 |
8 | 模仿天猫-后台
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
33 |
34 |
35 |
55 |
56 |
57 |
58 |
66 |
67 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 编辑分类
80 |
81 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/admin/editProperty.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
4 |
5 |
6 |
7 |
8 | 模仿天猫-后台
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
33 |
34 |
35 |
55 |
56 |
57 |
58 |
66 |
67 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 编辑属性名称
80 |
81 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/admin/editPropertyValue.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
4 |
5 |
6 |
7 |
8 | 模仿天猫-后台
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
33 |
34 |
35 |
55 |
56 |
57 |
58 |
66 |
67 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 编辑属性值
80 |
81 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/admin/editUser.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
4 |
5 |
6 |
7 |
8 | 模仿天猫-后台
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
33 |
34 |
35 |
55 |
56 |
57 |
58 |
66 |
67 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 修改密码
80 |
81 |
82 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/admin/index.jsp:
--------------------------------------------------------------------------------
1 | <%
2 | // request.getRequestDispatcher("/admin/listCategory").forward(request, response);
3 | response.sendRedirect("/admin/listCategory");
4 | %>
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/alipay.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 |
4 | <%@include file="include/header.jsp" %>
5 | <%@include file="include/top.jsp" %>
6 |
7 |
43 |
44 |
45 |

46 |
47 |
48 |
49 |
50 | 扫一扫付款(元)
51 |
52 | ¥${param.total}
53 |
54 |
55 |
56 |

57 |
58 |
59 |
60 |
65 |
66 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/include/header.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
4 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
5 |
6 |
7 | 模仿天猫-前端
8 |
9 | <%-- 引入JQ和Bootstrap--%>
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/include/mini-search.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 |
4 |
98 |
99 |
100 |
101 |
126 |
127 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/include/modal.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 |
4 |
5 |
6 |
7 |
8 |
14 |
15 |
账户登录
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
不要输入真实的天猫账号密码
30 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
57 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/include/search.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false"%>
3 |
4 | <%-- 首页搜索栏和Tmall图标 --%>
5 |
51 |
52 |
53 |
54 | <%-- 分类信息栏 --%>
55 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/include/top.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 |
4 |
5 | <%-- 顶部导航栏 --%>
6 |
35 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/orderConfirmedPage.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false"%>
3 |
4 | <%@include file="include/header.jsp" %>
5 | <%@include file="include/top.jsp" %>
6 | <%@include file="include/mini-search.jsp" %>
7 |
8 |
23 |
24 |
25 |
26 |

27 |
交易已经成功,卖家将收到您的货款。
28 |
29 |
30 |
31 | <%@include file="include/footer.jsp" %>
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/payed.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 |
4 | <%@include file="include/header.jsp" %>
5 | <%@include file="include/top.jsp" %>
6 | <%@include file="include/mini-search.jsp" %>
7 |
8 |
63 |
64 |
65 |
66 |

67 |
您已成功付款
68 |
69 |
70 |
71 |
72 | - 收货地址:${o.address} ${o.receiver} ${o.mobile }
73 | - 实付款:
74 | ¥${param.total}
75 |
76 | - 预计02月31日送达
77 |
78 |
79 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |

92 |
安全提醒:下单后,
用QQ给您发送链接办理退款的都是骗子!天猫不存在系统升级,订单异常等问题,谨防假冒客服电话诈骗!
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/productDetail.jsp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/WEB-INF/views/productDetail.jsp
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/registerSuccessPage.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" isELIgnored="false" %>
3 | <%@include file="include/header.jsp" %>
4 | <%@include file="include/top.jsp" %>
5 | <%@include file="include/mini-search.jsp" %>
6 |
7 |
50 | <%----%>
51 | <%--
--%>
52 | <%--
--%>
53 | <%--
--%>
54 |
55 | <%--
--%>
56 | <%--
--%>
57 | <%--
--%>
58 | <%--
--%>
59 |
60 |
61 |
62 |
63 | 恭喜注册成功
64 |
65 |
66 | <%@include file="include/footer.jsp" %>
67 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/views/test.jsp:
--------------------------------------------------------------------------------
1 | <%--
2 | Created by IntelliJ IDEA.
3 | User: Administrator
4 | Date: 2018/5/3 0003
5 | Time: 上午 9:00
6 | To change this template use File | Settings | File Templates.
7 | --%>
8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
9 |
10 |
11 | Title
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 | encodingFilter
10 | org.springframework.web.filter.CharacterEncodingFilter
11 |
12 | encoding
13 | UTF-8
14 |
15 |
16 |
17 | encodingFilter
18 | /*
19 |
20 |
21 |
22 |
23 | SpringMVC
24 | org.springframework.web.servlet.DispatcherServlet
25 |
26 |
27 | contextConfigLocation
28 | classpath:spring-*.xml
29 |
30 | 1
31 | true
32 |
33 |
34 | SpringMVC
35 |
36 | /
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/main/webapp/assets/font-awesome/fonts/fontawesome-webfontba72.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/assets/font-awesome/fonts/fontawesome-webfontba72.eot
--------------------------------------------------------------------------------
/src/main/webapp/assets/font-awesome/fonts/fontawesome-webfontba72.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/assets/font-awesome/fonts/fontawesome-webfontba72.ttf
--------------------------------------------------------------------------------
/src/main/webapp/assets/font-awesome/fonts/fontawesome-webfontba72.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/assets/font-awesome/fonts/fontawesome-webfontba72.woff
--------------------------------------------------------------------------------
/src/main/webapp/assets/font-awesome/fonts/fontawesome-webfontd41d.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/assets/font-awesome/fonts/fontawesome-webfontd41d.eot
--------------------------------------------------------------------------------
/src/main/webapp/assets/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/assets/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/src/main/webapp/assets/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/assets/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/src/main/webapp/assets/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/assets/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/src/main/webapp/assets/fonts/glyphicons-halflings-regulard41d.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/assets/fonts/glyphicons-halflings-regulard41d.eot
--------------------------------------------------------------------------------
/src/main/webapp/assets/js/jquery.metisMenu.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 |
3 | var pluginName = "metisMenu",
4 | defaults = {
5 | toggle: true
6 | };
7 |
8 | function Plugin(element, options) {
9 | this.element = element;
10 | this.settings = $.extend({}, defaults, options);
11 | this._defaults = defaults;
12 | this._name = pluginName;
13 | this.init();
14 | }
15 |
16 | Plugin.prototype = {
17 | init: function () {
18 |
19 | var $this = $(this.element),
20 | $toggle = this.settings.toggle;
21 |
22 | $this.find('li.active').has('ul').children('ul').addClass('collapse in');
23 | $this.find('li').not('.active').has('ul').children('ul').addClass('collapse');
24 |
25 | $this.find('li').has('ul').children('a').on('click', function (e) {
26 | e.preventDefault();
27 |
28 | $(this).parent('li').toggleClass('active').children('ul').collapse('toggle');
29 |
30 | if ($toggle) {
31 | $(this).parent('li').siblings().removeClass('active').children('ul.in').collapse('hide');
32 | }
33 | });
34 | }
35 | };
36 |
37 | $.fn[ pluginName ] = function (options) {
38 | return this.each(function () {
39 | if (!$.data(this, "plugin_" + pluginName)) {
40 | $.data(this, "plugin_" + pluginName, new Plugin(this, options));
41 | }
42 | });
43 | };
44 |
45 | })(jQuery, window, document);
46 |
--------------------------------------------------------------------------------
/src/main/webapp/assets/js/morris/morris-0.4.3.min.css:
--------------------------------------------------------------------------------
1 | .morris-hover{position:absolute;z-index:1000;}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255, 255, 255, 0.8);border:solid 2px rgba(230, 230, 230, 0.8);font-family:sans-serif;font-size:12px;text-align:center;}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0;}
2 | .morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0;}
--------------------------------------------------------------------------------
/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/src/main/webapp/css/fore/footer.css:
--------------------------------------------------------------------------------
1 | div.footer {
2 | margin: 0px 0px;
3 | border-top-style: solid;
4 | border-top-width: 1px;
5 | border-top-color: #e7e7e7;
6 | display: block!important;
7 | }
8 |
9 | div.footer_ensure {
10 | margin-top: 24px;
11 | margin-bottom: 24px;
12 | text-align: center;
13 | }
14 |
15 | div.footer_desc {
16 | border-top-style: solid;
17 | border-top-width: 1px;
18 | border-top-color: #e7e7e7;
19 | padding-top: 30px;
20 | margin: 0px 20px;
21 | }
22 |
23 | div.footer_desc div.descColumn {
24 | width: 20%;
25 | float: left;
26 | padding-left: 15px;
27 | }
28 |
29 | div.footer_desc div.descColumn span.descColumnTitle {
30 | color: #646464;
31 | font-weight: bold;
32 | font-size: 16px;
33 | }
34 |
35 | div.footer_desc a {
36 | text-decoration: none !important;
37 | display: block;
38 | padding-top: 3px;
39 | }
40 |
41 | div.footer_desc a:hover {
42 | text-decoration: underline!important;
43 | }
--------------------------------------------------------------------------------
/src/main/webapp/css/fore/head.css:
--------------------------------------------------------------------------------
1 | /*nav.header {*/
2 | /*background-color: #f2f2f2;*/
3 | /*padding-top: 5px;*/
4 | /*padding-bottom: 5px;*/
5 | /*!* 下边缘有1个像素的实线边框,颜色是比背景色#f2f2f2略深的#e7e7e7 *!*/
6 | /*border-bottom: 1px solid #e7e7e7;*/
7 | /*}*/
8 |
9 | /*nav.header span,*/
10 | /*nav.header a {*/
11 | /*color: #999;*/
12 | /*!* 左右外边距10px,但是没有上下外边距 *!*/
13 | /*margin: 0px 10px 0px 10px;*/
14 | /*}*/
15 |
16 | /*nav.header a:hover {*/
17 | /*color: #FF0036;*/
18 | /*text-decoration: none;*/
19 | /*}*/
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/webapp/css/fore/imgAndInfo.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/css/fore/imgAndInfo.css
--------------------------------------------------------------------------------
/src/main/webapp/css/fore/navigator.css:
--------------------------------------------------------------------------------
1 | div.tb-shop {
2 | text-align: center;
3 | }
4 |
5 | div.page {
6 | padding-top: 80px;
7 | }
8 |
9 | nav.tb-shop-nav {
10 | text-align: center;
11 | height: 40px;
12 | background-color: #3C3C3C;
13 | padding-top: 5px;
14 | }
15 |
16 | nav.tb-shop-nav span {
17 | color: white;
18 | font-size: 20px;
19 | margin: 5px 5px;
20 | }
21 |
22 | div.tb-property {
23 | margin: 40px 160px;
24 | }
25 |
26 | div.tb-wrap {
27 | width: 418px;
28 | float: left;
29 | }
30 |
31 | div.tb-gallery {
32 | overflow: hidden;
33 | padding: 0 20px;
34 | }
35 |
36 | div.tb-detail-hd{
37 |
38 | }
39 |
40 | div.tb-detail-hd h1 a{
41 | line-height: 1;
42 | font-size: 16px;
43 | font-weight: 700;
44 | color: #000000;
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/webapp/css/fore/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-size: 12px;
3 | font-family: Arial;
4 | }
5 |
6 | /* 工作区域固定宽度,自动居中 */
7 | .workArea {
8 | width: 1230px;
9 | margin: 0 auto;
10 | }
11 |
12 | /* 天猫红配色 */
13 | .redColor {
14 | color: #FF0036;
15 | }
16 |
17 | /* 超链设置为灰色 */
18 | a {
19 | color: #999;
20 | }
21 |
22 | a:hover {
23 | /* 去掉下划线 */
24 | text-decoration: none;
25 | /* 设置为天猫红 */
26 | color: #FF0036;
27 | }
28 |
29 | .boldWord{
30 | font-weight: bold;
31 | }
32 |
33 |
34 | /* ——————————————————————————————分割线———————————————————————————— */
35 |
36 | /* 顶部导航栏固定高度 */
37 | #site-nav {
38 | background-color: #f2f2f2;
39 | height: 32px;
40 | /* 顶部导航栏下面的灰色横线 */
41 | border-bottom: 1px solid #e7e7e7;
42 | }
43 |
44 | #site-nav span {
45 | padding-left: 20px;
46 | line-height: 32px;
47 | }
48 |
49 | /* ——————————————————————————————分割线———————————————————————————— */
50 |
51 | .header {
52 | height: 130px;
53 | }
54 |
55 | .headerLayout {
56 | height: 130px;
57 | }
58 |
59 | .logo img {
60 | height: 130px;
61 | width: 240px;
62 | position: absolute;
63 | margin-left: -15px;
64 | }
65 |
66 | .mallSearch-input {
67 | height: 40px;
68 | width: 625px;
69 | background-color: #FF0036;
70 | font-size: 14px;
71 | margin: 0 auto;
72 | display: block;
73 | padding: 1px;
74 | /* 垂直居中 */
75 | position: relative;
76 | top: 35%;
77 | }
78 |
79 | .mallSearch-input input {
80 | height: 36px;
81 | width: 490px;
82 | border: none;
83 | margin: 1px;
84 | color: black;
85 | /* 去掉输入框轮廓,否则获取焦点时会发生颜色变化 */
86 | outline: none;
87 | /* 边框设置成透明的,否则会有边框阴影 */
88 | border: 1px solid transparent;
89 | padding-left: 8px;
90 | }
91 |
92 | .mallSearch-input button {
93 | width: 125px;
94 | height: 36px;
95 | font-size: 18px;
96 | font-weight: 700;
97 | letter-spacing: 5px;
98 | right: 0;
99 | cursor: pointer;
100 | overflow: hidden;
101 | /* 边框设置成透明的,否则会有边框阴影 */
102 | border: 1px solid transparent;
103 | background-color: #FF0036;
104 | color: white;
105 | }
106 |
107 | .hot-query {
108 | height: 28px;
109 | font-size: 14px;
110 | padding: 4px 0 0;
111 | overflow: hidden;
112 | margin-left: -13px;
113 | }
114 |
115 | .hot-query li {
116 | display: inline-block;
117 | padding: 0 12px;
118 | font-size: 14px;
119 | }
120 |
121 | .hot-query .hot-query-li {
122 | border-left: 1px solid #cccccc;
123 | line-height: 1.1;
124 | }
125 |
126 | li, ul {
127 | /* 去掉前面的点 */
128 | list-style: none;
129 | }
130 |
131 | /* ——————————————————————————————分割线———————————————————————————— */
132 |
133 | .main-nav {
134 | height: 36px;
135 | border-bottom: 1px solid #FF0036;
136 | }
137 |
138 | .category-type {
139 | width: 200px;
140 | float: left;
141 | height: 36px;
142 | background-color: #FF0036;
143 | color: white;
144 | font-size: 16px;
145 | }
146 |
147 | .category-type .category-type-icon {
148 | margin-left: 14px;
149 | line-height: 36px;
150 | }
151 |
152 | .category-type .category-type-text {
153 | margin-left: 8px;
154 | font-weight: 700;
155 | }
156 |
157 | .main-nav img {
158 | float: left;
159 | height: 30px;
160 | width: 100px;
161 | }
162 |
163 | .main-nav span a {
164 | float: left;
165 | padding: 0 8px;
166 | font-weight: 500;
167 | font-size: 16px;
168 | color: #333;
169 | line-height: 36px;
170 | }
171 |
172 | /* ——————————————————————————————分割线———————————————————————————— */
173 | .category-con {
174 | background-color: #e8e8e8;
175 | }
176 |
177 | #carousel-of-product {
178 | display: block;
179 | margin: 0 auto;
180 | position: relative;
181 | left: 30px;
182 | }
183 |
184 | /* ——————————————————————————————分割线———————————————————————————— */
185 |
186 |
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/7day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/7day.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/alipay2wei.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/alipay2wei.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/buyflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/buyflow.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/carousel1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/carousel1.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/carousel2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/carousel2.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/carousel3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/carousel3.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/carousel4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/carousel4.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/cartNotSelected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/cartNotSelected.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/cartSelected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/cartSelected.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/comformPayFlow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/comformPayFlow.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/confirmOrderTmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/confirmOrderTmall.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/copyRight1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/copyRight1.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/copyRight2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/copyRight2.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/creditcard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/creditcard.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/decrease.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/decrease.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/end.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/end.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/footer1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/footer1.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/footer2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/footer2.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/footer3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/footer3.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/footer4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/footer4.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/hd.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/hd.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/ico-circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/ico-circle.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/increase.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/increase.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/leaveMessage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/leaveMessage.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/li_dot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/li_dot.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/loginPage-background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/loginPage-background.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/no-product.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/no-product.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/orderFinish.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/orderFinish.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/orderItemTmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/orderItemTmall.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/paySuccess.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/paySuccess.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/police-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/police-icon.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/priceBackground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/priceBackground.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/promise.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/promise.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/qr-code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/qr-code.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/reviewLight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/reviewLight.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/simpleLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/simpleLogo.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/tmall-cat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/tmall-cat.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/tmall-coupon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/tmall-coupon.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/tmall-international.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/tmall-international.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/tmall-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/tmall-logo.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/tmall-shop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/tmall-shop.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/tmallLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/tmallLogo.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/tmallbuy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/tmallbuy.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/wangwang.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/wangwang.gif
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/warning.png
--------------------------------------------------------------------------------
/src/main/webapp/img/fore/ww-online.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/fore/ww-online.png
--------------------------------------------------------------------------------
/src/main/webapp/img/product/1/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/product/1/1.jpg
--------------------------------------------------------------------------------
/src/main/webapp/img/product/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wmyskxz/Tmall_SSM/9b64b90f5f0501d31212835aa6eb0cfeeb8b2786/src/main/webapp/img/product/error.png
--------------------------------------------------------------------------------
/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%
2 | request.getRequestDispatcher("/home").forward(request, response);
3 | %>
--------------------------------------------------------------------------------
/src/main/webapp/js/bootstrap/3.3.6/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/src/test/java/FileTester.java:
--------------------------------------------------------------------------------
1 | import org.junit.Test;
2 |
3 | import java.io.*;
4 |
5 | /**
6 | * 测试 File
7 | *
8 | * @author: @我没有三颗心脏
9 | * @create: 2018-04-28-下午 16:48
10 | */
11 |
12 | public class FileTester {
13 |
14 | @Test
15 | public void test() {
16 | String newDir2 = "C:/test";
17 | deleteDir(new File(newDir2));
18 | }
19 |
20 | /**
21 | * 递归删除目录下的所有文件及子目录下所有文件
22 | *
23 | * @param dir 将要删除的文件目录
24 | * @return boolean Returns "true" if all deletions were successful.
25 | * If a deletion fails, the method stops attempting to
26 | * delete and returns "false".
27 | */
28 | private static boolean deleteDir(File dir) {
29 | if (dir.isDirectory()) {
30 | String[] children = dir.list();
31 | //递归删除目录中的子目录下
32 | for (int i = 0; i < children.length; i++) {
33 | boolean success = deleteDir(new File(dir, children[i]));
34 | if (!success) {
35 | return false;
36 | }
37 | }
38 | }
39 | // 目录此时为空,可以删除
40 | return dir.delete();
41 | }
42 |
43 | @Test
44 | public void tester() {
45 | String filePath = "D:/test.txt";
46 | File readFile = new File(filePath);
47 | File writeFile = new File("D:/result.txt");
48 | BufferedReader reader = null;
49 |
50 | try {
51 | System.out.println("以行为单位读取文件内容,一次读一整行:");
52 | reader = new BufferedReader(new InputStreamReader(new FileInputStream(readFile), "gbk"));
53 | // OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(writeFile), "gbk");
54 | // BufferedWriter writer = new BufferedWriter(write);
55 | FileWriter writer = new FileWriter("D:/result.txt", true);
56 |
57 |
58 | String tempString = null;
59 | int line = 1;
60 | // 一次读入一行,直到读入null为文件结束
61 | while ((tempString = reader.readLine()) != null) {
62 | // 显示行号
63 | System.out.println("line " + line + ": " + tempString);
64 |
65 | // 当判断为头部
66 | if (tempString.startsWith("-")) {
67 | // 开头
68 | tempString = tempString.substring(1);
69 | writer.write(" \r\n" +
70 | "
\r\n");
71 | writer.write("
" + tempString + "
\r\n" +
72 | "
>\r\n" +
73 | "
\r\n" +
74 | "
\r\n");
75 | } else {
76 | // 结尾
77 | if (tempString.startsWith("*")) {
78 | writer.write("
\r\n" +
79 | "
\r\n" +
80 | "
\r\n");
81 | } else if (tempString.endsWith("=")) {
82 | // 中间的hot-word
83 | tempString = tempString.substring(0, tempString.length() - 1);
84 | writer.write(" " + tempString + "\r\n");
85 | } else {
86 | writer.write(" " + tempString + "\r\n");
87 | }
88 | }
89 |
90 |
91 | line++;
92 | }
93 |
94 |
95 | reader.close();
96 | writer.close();
97 | } catch (IOException e) {
98 | e.printStackTrace();
99 | } finally {
100 | if (reader != null) {
101 | try {
102 | reader.close();
103 | } catch (IOException e1) {
104 | }
105 | }
106 | }
107 | }
108 | }
--------------------------------------------------------------------------------
/src/test/java/TestMybatisGenerator.java:
--------------------------------------------------------------------------------
1 | import org.mybatis.generator.api.MyBatisGenerator;
2 | import org.mybatis.generator.api.ShellCallback;
3 | import org.mybatis.generator.config.Configuration;
4 | import org.mybatis.generator.config.xml.ConfigurationParser;
5 | import org.mybatis.generator.internal.DefaultShellCallback;
6 |
7 | import java.io.File;
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * 逆向工程测试类
13 | *
14 | * @author: @我没有三颗心脏
15 | * @create: 2018-04-27-上午 8:26
16 | */
17 | //@RunWith(SpringJUnit4ClassRunner.class)
18 | //@ContextConfiguration("classpath:spring-mybatis.xml")
19 | public class TestMybatisGenerator {
20 |
21 | public static void main(String[] args) throws Exception {
22 | // warnings 为用于放置生成过程中警告信息的集合对象
23 | List warnings = new ArrayList();
24 | // 指定是否覆盖重名文件
25 | boolean overwrite = true;
26 | // 加载配置文件
27 | File configFile = new File(MyBatisGenerator.class.getClassLoader().getResource("generatorConfig.xml").toURI());
28 | // 配置解析类
29 | ConfigurationParser cp = new ConfigurationParser(warnings);
30 | // 配置解析类解析配置文件并生成 Configuration 配置对象
31 | Configuration config = cp.parseConfiguration(configFile);
32 | // ShellCallback 负责如何处理重复文件
33 | ShellCallback callback = new DefaultShellCallback(overwrite);
34 | // 逆向工程对象
35 | MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
36 | // 执行逆向文件生成操作
37 | myBatisGenerator.generate(null);
38 | // 打印提示信息
39 | System.out.println("MyBatis 逆向工程执行成功,刷新项目查看文件!");
40 | }
41 |
42 | // @Autowired
43 | // CategoryMapper categoryMapper;
44 | //
45 | // @Test
46 | // public void test() {
47 | // Category category = new Category();
48 | // category.setName("分类1");
49 | // categoryMapper.insert(category);
50 | // }
51 |
52 |
53 | }
54 |
55 |
--------------------------------------------------------------------------------