Compare commits
30 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
bcb769d65c | 3 years ago |
|
|
aef1f5e49f | 3 years ago |
|
|
28b6bc0287 | 3 years ago |
|
|
98d82935b5 | 3 years ago |
|
|
13ffc3ea5a | 3 years ago |
|
|
5e820b68c4 | 3 years ago |
|
|
4c0c68ec27 | 3 years ago |
|
|
47902e0914 | 3 years ago |
|
|
260cd596d5 | 3 years ago |
|
|
dc9e097653 | 3 years ago |
|
|
9535e952af | 3 years ago |
|
|
eb055c17a7 | 3 years ago |
|
|
47b48a561e | 3 years ago |
|
|
f63f1ed16d | 3 years ago |
|
|
bc1de74ca9 | 3 years ago |
|
|
8f3a66a3bb | 3 years ago |
|
|
c49b302784 | 3 years ago |
|
|
19bfeb2dec | 3 years ago |
|
|
f174a1ff98 | 3 years ago |
|
|
677156ee9e | 3 years ago |
|
|
fd0502ece3 | 3 years ago |
|
|
a05800ea8b | 3 years ago |
|
|
a4c6f2f9aa | 3 years ago |
|
|
8af8541d04 | 3 years ago |
|
|
b65b0b2607 | 3 years ago |
|
|
220381dccf | 3 years ago |
|
|
15a4ebeac6 | 3 years ago |
|
|
7708fcfe24 | 3 years ago |
|
|
88c348b8d8 | 3 years ago |
|
|
95bbdd38cc | 3 years ago |
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/shppingcart-backend/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/shppingcart-backend/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/shoppingcart-backend/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/shoppingcart-backend/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="TemplatesSettings">
|
||||
<option name="templateConfigs">
|
||||
<TemplateContext>
|
||||
<option name="generateConfig">
|
||||
<GenerateConfig>
|
||||
<option name="annotationType" value="NONE" />
|
||||
<option name="basePackage" value="generator" />
|
||||
<option name="basePath" value="src/main/java" />
|
||||
<option name="classNameStrategy" value="camel" />
|
||||
<option name="encoding" value="UTF-8" />
|
||||
<option name="extraClassSuffix" value="" />
|
||||
<option name="ignoreFieldPrefix" value="" />
|
||||
<option name="ignoreFieldSuffix" value="" />
|
||||
<option name="ignoreTablePrefix" value="" />
|
||||
<option name="ignoreTableSuffix" value="" />
|
||||
<option name="moduleName" value="shoppingcart-backend" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$/shoppingcart-backend" />
|
||||
<option name="moduleUIInfoList">
|
||||
<list>
|
||||
<ModuleInfoGo>
|
||||
<option name="basePath" value="${domain.basePath}" />
|
||||
<option name="configFileName" value="mapperInterface.ftl" />
|
||||
<option name="configName" value="mapperInterface" />
|
||||
<option name="encoding" value="${domain.encoding}" />
|
||||
<option name="fileName" value="${domain.fileName}Mapper" />
|
||||
<option name="fileNameWithSuffix" value="${domain.fileName}Mapper.java" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$/shoppingcart-backend" />
|
||||
<option name="packageName" value="${domain.basePackage}.mapper" />
|
||||
</ModuleInfoGo>
|
||||
<ModuleInfoGo>
|
||||
<option name="basePath" value="src/main/resources" />
|
||||
<option name="configFileName" value="mapperXml.ftl" />
|
||||
<option name="configName" value="mapperXml" />
|
||||
<option name="encoding" value="${domain.encoding}" />
|
||||
<option name="fileName" value="${domain.fileName}Mapper" />
|
||||
<option name="fileNameWithSuffix" value="${domain.fileName}Mapper.xml" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$/shoppingcart-backend" />
|
||||
<option name="packageName" value="mapper" />
|
||||
</ModuleInfoGo>
|
||||
<ModuleInfoGo>
|
||||
<option name="basePath" value="${domain.basePath}" />
|
||||
<option name="configFileName" value="serviceImpl.ftl" />
|
||||
<option name="configName" value="serviceImpl" />
|
||||
<option name="encoding" value="${domain.encoding}" />
|
||||
<option name="fileName" value="${domain.fileName}ServiceImpl" />
|
||||
<option name="fileNameWithSuffix" value="${domain.fileName}ServiceImpl.java" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$/shoppingcart-backend" />
|
||||
<option name="packageName" value="${domain.basePackage}.service.impl" />
|
||||
</ModuleInfoGo>
|
||||
<ModuleInfoGo>
|
||||
<option name="basePath" value="${domain.basePath}" />
|
||||
<option name="configFileName" value="serviceInterface.ftl" />
|
||||
<option name="configName" value="serviceInterface" />
|
||||
<option name="encoding" value="${domain.encoding}" />
|
||||
<option name="fileName" value="${domain.fileName}Service" />
|
||||
<option name="fileNameWithSuffix" value="${domain.fileName}Service.java" />
|
||||
<option name="modulePath" value="$PROJECT_DIR$/shoppingcart-backend" />
|
||||
<option name="packageName" value="${domain.basePackage}.service" />
|
||||
</ModuleInfoGo>
|
||||
</list>
|
||||
</option>
|
||||
<option name="needToStringHashcodeEquals" value="true" />
|
||||
<option name="needsComment" value="true" />
|
||||
<option name="needsModel" value="true" />
|
||||
<option name="relativePackage" value="domain" />
|
||||
<option name="superClass" value="" />
|
||||
<option name="tableUIInfoList">
|
||||
<list>
|
||||
<TableUIInfo>
|
||||
<option name="className" value="CartItem" />
|
||||
<option name="tableName" value="cart_item" />
|
||||
</TableUIInfo>
|
||||
</list>
|
||||
</option>
|
||||
<option name="templatesName" value="mybatis-plus3" />
|
||||
<option name="useLombokPlugin" value="true" />
|
||||
</GenerateConfig>
|
||||
</option>
|
||||
<option name="moduleName" value="shoppingcart-backend" />
|
||||
<option name="projectPath" value="$PROJECT_DIR$" />
|
||||
<option name="templateName" value="mybatis-plus3" />
|
||||
</TemplateContext>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,60 @@
|
||||
create table if not exists `huas-project-yangwp`.product
|
||||
(
|
||||
id int auto_increment
|
||||
primary key,
|
||||
name varchar(255) not null,
|
||||
description text null,
|
||||
price decimal(10, 2) not null,
|
||||
in_cart tinyint(1) default 0 not null comment '是否在购物车中,0表示不在,1表示在',
|
||||
quantity int default 0 not null comment '购物车中的商品数量,如果商品不在购物车中,那么数量为0',
|
||||
created_at datetime ,
|
||||
updated_at datetime ,
|
||||
is_deleted tinyint(1) default 0 not null
|
||||
)
|
||||
charset = utf8mb3;
|
||||
|
||||
-- 创建user表
|
||||
CREATE TABLE `user`
|
||||
(
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`password` varchar(255) NOT NULL,
|
||||
`location` varchar(255),
|
||||
`created_at` datetime ,
|
||||
`updated_at` datetime ,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
|
||||
|
||||
-- 创建cart_item表
|
||||
CREATE TABLE `cart_item`
|
||||
(
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`product_id` int(11) NOT NULL,
|
||||
`quantity` int(11) NOT NULL DEFAULT '0' COMMENT '购物车中的商品数量',
|
||||
`created_at` datetime ,
|
||||
`updated_at` datetime ,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
|
||||
FOREIGN KEY (`product_id`) REFERENCES `product` (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
-- 创建order表
|
||||
CREATE TABLE `order`
|
||||
(
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`product_id` int(11) NOT NULL,
|
||||
`quantity` int(11) NOT NULL COMMENT '购买的商品数量',
|
||||
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`created_at` datetime ,
|
||||
`updated_at` datetime ,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
|
||||
FOREIGN KEY (`product_id`) REFERENCES `product` (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
@ -0,0 +1,23 @@
|
||||
package com.ywp.shoppingcartbackend.Config;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Contact;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import org.springdoc.core.GroupedOpenApi;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Bean
|
||||
public OpenAPI customOpenAPI() {
|
||||
return new OpenAPI()
|
||||
.addServersItem(new Server().url("http://localhost:8088"))
|
||||
.info(new Info().title("丽娃购物车商城系统")
|
||||
.description("丽娃购物车商城文档")
|
||||
.contact(new Contact().name("liwa").email("111@qq.com").url("https://github.com/zhubaiali"))
|
||||
.version("1.0"));
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,19 @@
|
||||
package com.ywp.shppingcartbackend;
|
||||
package com.ywp.shoppingcartbackend;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.ywp.shppingcartbackend.mapper")
|
||||
@MapperScan("com.ywp.shoppingcartbackend.mapper")
|
||||
@EnableScheduling
|
||||
public class ShppingcartBackendApplication {
|
||||
public class ShoppingcartBackendApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ShppingcartBackendApplication.class, args);
|
||||
SpringApplication.run(ShoppingcartBackendApplication.class, args);
|
||||
System.out.println("----------------------start success-----------------------");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.ywp.shoppingcartbackend.controller;
|
||||
|
||||
import com.ywp.shoppingcartbackend.domain.Order;
|
||||
import com.ywp.shoppingcartbackend.service.OrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/order/user/{userId}")
|
||||
public class OrderController {
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<Order> createOrder(@PathVariable Integer userId, @RequestParam Integer productId, @RequestParam Integer quantity) {
|
||||
Order order = orderService.createOrder(userId, productId, quantity);
|
||||
return ResponseEntity.ok(order);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{orderId}")
|
||||
public ResponseEntity<Void> deleteOrder(@PathVariable Integer userId, @PathVariable Integer orderId) {
|
||||
orderService.deleteOrder(userId, orderId);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@GetMapping("")
|
||||
public ResponseEntity<List<Order>> getOrdersByUserId(@PathVariable Integer userId) {
|
||||
List<Order> orders = orderService.getOrdersByUserId(userId);
|
||||
return ResponseEntity.ok(orders);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.ywp.shoppingcartbackend.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.ywp.shoppingcartbackend.domain.Product;
|
||||
import com.ywp.shoppingcartbackend.service.ProductService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/product")
|
||||
public class ProductController {
|
||||
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
@GetMapping("")
|
||||
public ResponseEntity<IPage<Product>> getAllProducts(@RequestParam(required = false, defaultValue = "0") Integer pageNum,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
||||
IPage<Product> products = productService.getAllProducts(pageNum, pageSize);
|
||||
return ResponseEntity.ok(products);
|
||||
}
|
||||
|
||||
@GetMapping("/{productId}")
|
||||
public ResponseEntity<Product> getProductById(@PathVariable Integer productId) {
|
||||
Product product = productService.getProductById(productId);
|
||||
return ResponseEntity.ok(product);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.ywp.shoppingcartbackend.controller;
|
||||
|
||||
import com.ywp.shoppingcartbackend.domain.User;
|
||||
import com.ywp.shoppingcartbackend.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@PostMapping("/register")
|
||||
public ResponseEntity<User> register(@RequestBody User user) {
|
||||
User registeredUser = userService.register(user);
|
||||
return ResponseEntity.ok(registeredUser);
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public ResponseEntity<User> login(@RequestBody Map<String, String> credentials) {
|
||||
String username = credentials.get("username");
|
||||
String password = credentials.get("password");
|
||||
User loggedInUser = userService.login(username, password);
|
||||
return ResponseEntity.ok(loggedInUser);
|
||||
}
|
||||
|
||||
@PatchMapping("/{userId}/location")
|
||||
public ResponseEntity<User> updateLocation(@PathVariable Integer userId, @RequestParam String location) {
|
||||
User updatedUser = userService.updateLocation(userId, location);
|
||||
return ResponseEntity.ok(updatedUser);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package com.ywp.shoppingcartbackend.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName cart_item
|
||||
*/
|
||||
@TableName("cart_item")
|
||||
@Data
|
||||
public class CartItem implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer productId;
|
||||
|
||||
/**
|
||||
* 购物车中的商品数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updatedAt;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
CartItem other = (CartItem) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
|
||||
&& (this.getProductId() == null ? other.getProductId() == null
|
||||
: this.getProductId().equals(other.getProductId()))
|
||||
&& (this.getQuantity() == null ? other.getQuantity() == null
|
||||
: this.getQuantity().equals(other.getQuantity()))
|
||||
&& (this.getCreatedAt() == null ? other.getCreatedAt() == null
|
||||
: this.getCreatedAt().equals(other.getCreatedAt()))
|
||||
&& (this.getUpdatedAt() == null ? other.getUpdatedAt() == null
|
||||
: this.getUpdatedAt().equals(other.getUpdatedAt()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
|
||||
result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
|
||||
result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
|
||||
result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
|
||||
result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", userId=").append(userId);
|
||||
sb.append(", productId=").append(productId);
|
||||
sb.append(", quantity=").append(quantity);
|
||||
sb.append(", createdAt=").append(createdAt);
|
||||
sb.append(", updatedAt=").append(updatedAt);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,110 @@
|
||||
package com.ywp.shoppingcartbackend.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName order
|
||||
*/
|
||||
@TableName("`order`")
|
||||
@Data
|
||||
public class Order implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer productId;
|
||||
|
||||
/**
|
||||
* 购买的商品数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updatedAt;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Order other = (Order) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
|
||||
&& (this.getProductId() == null ? other.getProductId() == null
|
||||
: this.getProductId().equals(other.getProductId()))
|
||||
&& (this.getQuantity() == null ? other.getQuantity() == null
|
||||
: this.getQuantity().equals(other.getQuantity()))
|
||||
&& (this.getIsDeleted() == null ? other.getIsDeleted() == null
|
||||
: this.getIsDeleted().equals(other.getIsDeleted()))
|
||||
&& (this.getCreatedAt() == null ? other.getCreatedAt() == null
|
||||
: this.getCreatedAt().equals(other.getCreatedAt()))
|
||||
&& (this.getUpdatedAt() == null ? other.getUpdatedAt() == null
|
||||
: this.getUpdatedAt().equals(other.getUpdatedAt()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
|
||||
result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
|
||||
result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
|
||||
result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
|
||||
result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
|
||||
result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", userId=").append(userId);
|
||||
sb.append(", productId=").append(productId);
|
||||
sb.append(", quantity=").append(quantity);
|
||||
sb.append(", isDeleted=").append(isDeleted);
|
||||
sb.append(", createdAt=").append(createdAt);
|
||||
sb.append(", updatedAt=").append(updatedAt);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package com.ywp.shoppingcartbackend.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName user
|
||||
*/
|
||||
@TableName("user")
|
||||
@Data
|
||||
public class User implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updatedAt;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
User other = (User) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getUsername() == null ? other.getUsername() == null
|
||||
: this.getUsername().equals(other.getUsername()))
|
||||
&& (this.getPassword() == null ? other.getPassword() == null
|
||||
: this.getPassword().equals(other.getPassword()))
|
||||
&& (this.getLocation() == null ? other.getLocation() == null
|
||||
: this.getLocation().equals(other.getLocation()))
|
||||
&& (this.getCreatedAt() == null ? other.getCreatedAt() == null
|
||||
: this.getCreatedAt().equals(other.getCreatedAt()))
|
||||
&& (this.getUpdatedAt() == null ? other.getUpdatedAt() == null
|
||||
: this.getUpdatedAt().equals(other.getUpdatedAt()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
|
||||
result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
|
||||
result = prime * result + ((getLocation() == null) ? 0 : getLocation().hashCode());
|
||||
result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
|
||||
result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", username=").append(username);
|
||||
sb.append(", password=").append(password);
|
||||
sb.append(", location=").append(location);
|
||||
sb.append(", createdAt=").append(createdAt);
|
||||
sb.append(", updatedAt=").append(updatedAt);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.ywp.shoppingcartbackend.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
/**
|
||||
* 自定义异常类
|
||||
*
|
||||
* @author liwa
|
||||
*/
|
||||
@ResponseStatus(value = HttpStatus.NOT_FOUND)
|
||||
public class ResourceNotFoundException extends RuntimeException {
|
||||
|
||||
public ResourceNotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.ywp.shoppingcartbackend.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ywp.shoppingcartbackend.domain.CartItem;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【cart_item】的数据库操作Mapper
|
||||
* @createDate 2023-05-13 20:46:21
|
||||
* @Entity com.ywp.shoppingcartbackend.domain.CartItem
|
||||
*/
|
||||
@Mapper
|
||||
public interface CartItemMapper extends BaseMapper<CartItem> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.ywp.shoppingcartbackend.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ywp.shoppingcartbackend.domain.Order;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【order】的数据库操作Mapper
|
||||
* @createDate 2023-05-13 20:46:08
|
||||
* @Entity com.ywp.shoppingcartbackend.domain.Order
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderMapper extends BaseMapper<Order> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.ywp.shoppingcartbackend.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ywp.shoppingcartbackend.domain.Product;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【product】的数据库操作Mapper
|
||||
* @createDate 2023-05-13 11:10:48
|
||||
* @Entity com.ywp.shoppingcartbackend.domain.Product
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductMapper extends BaseMapper<Product> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.ywp.shoppingcartbackend.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ywp.shoppingcartbackend.domain.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【user】的数据库操作Mapper
|
||||
* @createDate 2023-05-13 20:39:44
|
||||
* @Entity com.ywp.shoppingcartbackend.domain.User
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.ywp.shoppingcartbackend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ywp.shoppingcartbackend.domain.CartItem;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【cart_item】的数据库操作Service
|
||||
* @createDate 2023-05-13 20:46:21
|
||||
*/
|
||||
public interface CartItemService extends IService<CartItem> {
|
||||
|
||||
/**
|
||||
* 将指定数量的特定商品添加到指定用户的购物车
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param productId 商品ID
|
||||
* @param quantity 要添加的商品数量
|
||||
* @return 新添加的购物车商品项
|
||||
*/
|
||||
CartItem addToCart(Integer userId, Integer productId, Integer quantity);
|
||||
|
||||
/**
|
||||
* 从指定用户的购物车中移除特定商品
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param productId 商品ID
|
||||
*/
|
||||
void removeFromCart(Integer userId, Integer productId);
|
||||
|
||||
/**
|
||||
* 获取指定用户购物车中的所有商品
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 该用户购物车中的商品列表
|
||||
*/
|
||||
IPage<CartItem> getCartItems(Integer userId, int pageNumber, int pageSize);
|
||||
|
||||
CartItem decreaseQuantity(Integer userId, Integer productId, Integer quantity);
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.ywp.shoppingcartbackend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ywp.shoppingcartbackend.domain.Order;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【order】的数据库操作Service
|
||||
* @createDate 2023-05-13 20:46:08
|
||||
*/
|
||||
public interface OrderService extends IService<Order> {
|
||||
Order createOrder(Integer userId, Integer productId, Integer quantity);
|
||||
|
||||
void deleteOrder(Integer userId, Integer orderId);
|
||||
|
||||
List<Order> getOrdersByUserId(Integer userId);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.ywp.shoppingcartbackend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ywp.shoppingcartbackend.domain.Product;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【product】的数据库操作Service
|
||||
* @createDate 2023-05-13 11:10:48
|
||||
*/
|
||||
public interface ProductService extends IService<Product> {
|
||||
|
||||
IPage<Product> getAllProducts(int page, int size);
|
||||
|
||||
Product getProductById(Integer productId);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.ywp.shoppingcartbackend.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ywp.shoppingcartbackend.domain.User;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【user】的数据库操作Service
|
||||
* @createDate 2023-05-13 20:39:44
|
||||
*/
|
||||
public interface UserService extends IService<User> {
|
||||
User register(User user);
|
||||
User login(String username, String password);
|
||||
User updateLocation(Integer userId, String location);
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.ywp.shoppingcartbackend.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ywp.shoppingcartbackend.domain.Order;
|
||||
import com.ywp.shoppingcartbackend.domain.Product;
|
||||
import com.ywp.shoppingcartbackend.mapper.OrderMapper;
|
||||
import com.ywp.shoppingcartbackend.service.OrderService;
|
||||
import com.ywp.shoppingcartbackend.service.ProductService;
|
||||
|
||||
import org.apache.ibatis.javassist.NotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【order】的数据库操作Service实现
|
||||
* @createDate 2023-05-13 20:46:08
|
||||
*/
|
||||
@Service
|
||||
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
@Override
|
||||
@Transactional
|
||||
public Order createOrder(Integer userId, Integer productId, Integer quantity) {
|
||||
// 创建新的订单
|
||||
Product product = productService.getById(productId);
|
||||
if (product == null || product.getQuantity() < quantity) {
|
||||
throw new IllegalArgumentException("Product is unavailable or quantity is insufficient.");
|
||||
}
|
||||
|
||||
Order order = new Order();
|
||||
order.setUserId(userId);
|
||||
order.setProductId(productId);
|
||||
order.setQuantity(quantity);
|
||||
order.setIsDeleted(0);
|
||||
this.save(order);
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteOrder(Integer userId, Integer orderId) {
|
||||
// 删除指定的订单
|
||||
Order order = this.getById(orderId);
|
||||
if (order == null || !order.getUserId().equals(userId)) {
|
||||
throw new IllegalArgumentException("Invalid order id: " + orderId);
|
||||
}
|
||||
order.setIsDeleted(1);
|
||||
this.updateById(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Order> getOrdersByUserId(Integer userId) {
|
||||
// 获取用户的所有订单
|
||||
QueryWrapper<Order> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id", userId).eq("is_deleted", 0);
|
||||
return this.list(queryWrapper);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.ywp.shoppingcartbackend.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ywp.shoppingcartbackend.domain.Product;
|
||||
import com.ywp.shoppingcartbackend.exception.ResourceNotFoundException;
|
||||
import com.ywp.shoppingcartbackend.mapper.ProductMapper;
|
||||
import com.ywp.shoppingcartbackend.service.ProductService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【product】的数据库操作Service实现
|
||||
* @createDate 2023-05-13 11:10:48
|
||||
*/
|
||||
@Service
|
||||
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {
|
||||
|
||||
@Override
|
||||
public IPage<Product> getAllProducts(int page, int size) {
|
||||
// 创建 Page 对象,传入当前页数和每页数量
|
||||
Page<Product> productPage = new Page<>(page, size);
|
||||
// 使用 MyBatis Plus 的 selectPage 方法进行分页查询
|
||||
return this.page(productPage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Product getProductById(Integer productId) {
|
||||
// 使用 MyBatis Plus 的 getById 方法来获取指定id的商品
|
||||
Product product = this.getById(productId);
|
||||
if (product == null) {
|
||||
throw new ResourceNotFoundException("Product with id " + productId + " not found");
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.ywp.shoppingcartbackend.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ywp.shoppingcartbackend.domain.User;
|
||||
import com.ywp.shoppingcartbackend.mapper.UserMapper;
|
||||
import com.ywp.shoppingcartbackend.service.UserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author asus
|
||||
* @description 针对表【user】的数据库操作Service实现
|
||||
* @createDate 2023-05-13 20:39:44
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public User register(User user) {
|
||||
if (user == null || user.getUsername() == null || user.getPassword() == null) {
|
||||
throw new IllegalArgumentException("User information is incomplete.");
|
||||
}
|
||||
|
||||
// 检查用户名是否已存在
|
||||
if (getByUsername(user.getUsername()) != null) {
|
||||
throw new IllegalArgumentException("Username already exists: " + user.getUsername());
|
||||
}
|
||||
|
||||
user.setCreatedAt(new Date());
|
||||
user.setUpdatedAt(new Date());
|
||||
this.save(user);
|
||||
return user;
|
||||
}
|
||||
private User getByUsername(String username) {
|
||||
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("username", username);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
@Override
|
||||
@Transactional
|
||||
public User login(String username, String password) {
|
||||
User user = getByUsername(username);
|
||||
// 检查用户名和密码是否正确
|
||||
if (user == null || !user.getPassword().equals(password)) {
|
||||
throw new IllegalArgumentException("Username or password is incorrect.");
|
||||
}
|
||||
|
||||
// 否则,返回用户信息
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public User updateLocation(Integer userId, String location) {
|
||||
// 更新用户的地址信息
|
||||
User user = this.getById(userId);
|
||||
if (user == null) {
|
||||
throw new IllegalArgumentException("Invalid user id: " + userId);
|
||||
}
|
||||
user.setLocation(location);
|
||||
this.updateById(user);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/huas-project-yangwp?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC
|
||||
username: root
|
||||
password: 123456
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
server:
|
||||
port: 8088
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ywp.shoppingcartbackend.mapper.CartItemMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ywp.shoppingcartbackend.domain.CartItem">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="productId" column="product_id" jdbcType="INTEGER"/>
|
||||
<result property="quantity" column="quantity" jdbcType="INTEGER"/>
|
||||
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
|
||||
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_id,product_id,
|
||||
quantity,created_at,updated_at
|
||||
</sql>
|
||||
</mapper>
|
||||
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ywp.shoppingcartbackend.mapper.OrderMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ywp.shoppingcartbackend.domain.Order">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="productId" column="product_id" jdbcType="INTEGER"/>
|
||||
<result property="quantity" column="quantity" jdbcType="INTEGER"/>
|
||||
<result property="isDeleted" column="is_deleted" jdbcType="TINYINT"/>
|
||||
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
|
||||
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_id,product_id,
|
||||
quantity,is_deleted,created_at,
|
||||
updated_at
|
||||
</sql>
|
||||
</mapper>
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ywp.shoppingcartbackend.mapper.UserMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ywp.shoppingcartbackend.domain.User">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="username" column="username" jdbcType="VARCHAR"/>
|
||||
<result property="password" column="password" jdbcType="VARCHAR"/>
|
||||
<result property="location" column="location" jdbcType="VARCHAR"/>
|
||||
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
|
||||
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,username,password,
|
||||
location,created_at,updated_at
|
||||
</sql>
|
||||
</mapper>
|
||||
@ -1,10 +1,10 @@
|
||||
package com.ywp.shppingcartbackend;
|
||||
package com.ywp.shoppingcartbackend;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class ShppingcartBackendApplicationTests {
|
||||
class shoppingcartBackendApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@ -0,0 +1,3 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
not dead
|
||||
@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
@ -0,0 +1,23 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
@ -0,0 +1,29 @@
|
||||
# liwa-shoppingcart
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Run your tests
|
||||
```
|
||||
npm run test
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "liwa-shoppingcart",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"better-scroll": "^2.2.0",
|
||||
"core-js": "^3.6.5",
|
||||
"fastclick": "^1.0.6",
|
||||
"postcss-px-to-viewport": "^1.1.1",
|
||||
"vue": "^2.6.11",
|
||||
"vue-lazyload": "^1.3.3",
|
||||
"vue-router": "^3.5.1",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.5.0",
|
||||
"@vue/cli-service": "^4.5.0",
|
||||
"vue-template-compiler": "^2.6.11"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<!-- 2.路由跳转页面 -->
|
||||
<!-- exclude值为组件导出的name值 -->
|
||||
<keep-alive exclude='Detail'>
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
<!-- 1.底部标签栏 -->
|
||||
<main-tab-bar></main-tab-bar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MainTabBar from "components/content/tabbar/MainTabBar";
|
||||
|
||||
export default {
|
||||
name: "App",
|
||||
components: {
|
||||
MainTabBar,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import "assets/css/base.css";
|
||||
</style>
|
||||
@ -0,0 +1,349 @@
|
||||
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
||||
|
||||
/* Document
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Correct the line height in all browsers.
|
||||
* 2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
line-height: 1.15; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/* Sections
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the margin in all browsers.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the `main` element consistently in IE.
|
||||
*/
|
||||
|
||||
main {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the font size and margin on `h1` elements within `section` and
|
||||
* `article` contexts in Chrome, Firefox, and Safari.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
/* Grouping content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in Firefox.
|
||||
* 2. Show the overflow in Edge and IE.
|
||||
*/
|
||||
|
||||
hr {
|
||||
box-sizing: content-box; /* 1 */
|
||||
height: 0; /* 1 */
|
||||
overflow: visible; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
pre {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/* Text-level semantics
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the gray background on active links in IE 10.
|
||||
*/
|
||||
|
||||
a {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Remove the bottom border in Chrome 57-
|
||||
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none; /* 1 */
|
||||
text-decoration: underline; /* 2 */
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font weight in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` elements from affecting the line height in
|
||||
* all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/* Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the border on images inside links in IE 10.
|
||||
*/
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
/* Forms
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Change the font styles in all browsers.
|
||||
* 2. Remove the margin in Firefox and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
line-height: 1.15; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the overflow in IE.
|
||||
* 1. Show the overflow in Edge.
|
||||
*/
|
||||
|
||||
button,
|
||||
input { /* 1 */
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
||||
* 1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the inability to style clickable types in iOS and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
[type="button"],
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner border and padding in Firefox.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the focus styles unset by the previous rule.
|
||||
*/
|
||||
|
||||
button:-moz-focusring,
|
||||
[type="button"]:-moz-focusring,
|
||||
[type="reset"]:-moz-focusring,
|
||||
[type="submit"]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the padding in Firefox.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
padding: 0.35em 0.75em 0.625em;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the text wrapping in Edge and IE.
|
||||
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
||||
* 3. Remove the padding so developers are not caught out when they zero out
|
||||
* `fieldset` elements in all browsers.
|
||||
*/
|
||||
|
||||
legend {
|
||||
box-sizing: border-box; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
display: table; /* 1 */
|
||||
max-width: 100%; /* 1 */
|
||||
padding: 0; /* 3 */
|
||||
white-space: normal; /* 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the default vertical scrollbar in IE 10+.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in IE 10.
|
||||
* 2. Remove the padding in IE 10.
|
||||
*/
|
||||
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the cursor style of increment and decrement buttons in Chrome.
|
||||
*/
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the odd appearance in Chrome and Safari.
|
||||
* 2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner padding in Chrome and Safari on macOS.
|
||||
*/
|
||||
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inability to style clickable types in iOS and Safari.
|
||||
* 2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/* Interactive
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Add the correct display in Edge, IE 10+, and Firefox.
|
||||
*/
|
||||
|
||||
details {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the correct display in all browsers.
|
||||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
/* Misc
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10+.
|
||||
*/
|
||||
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10.
|
||||
*/
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
/* v2.0 | 20110126
|
||||
http://meyerweb.com/eric/tools/css/reset/
|
||||
License: none (public domain)
|
||||
*/
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
menu, nav, output, ruby, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 520 B |
|
After Width: | Height: | Size: 566 B |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 785 B |
|
After Width: | Height: | Size: 785 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 518 B |
|
After Width: | Height: | Size: 518 B |
|
After Width: | Height: | Size: 927 B |
|
After Width: | Height: | Size: 927 B |
|
After Width: | Height: | Size: 674 B |
|
After Width: | Height: | Size: 674 B |