master
parent
bd8a678259
commit
27503d55e1
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : zx
|
||||
Source Server Version : 80018
|
||||
Source Host : localhost:3306
|
||||
Source Database : test02
|
||||
|
||||
Target Server Type : MYSQL
|
||||
Target Server Version : 80018
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 2020-06-16 11:11:46
|
||||
*/
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for order_details
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `order_details`;
|
||||
CREATE TABLE `order_details` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`userId` int(11) NOT NULL,
|
||||
`orderNum` int(11) NOT NULL,
|
||||
`ISBN` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
||||
`count` int(11) NOT NULL,
|
||||
`price` float(10,2) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of order_details
|
||||
-- ----------------------------
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : zx
|
||||
Source Server Version : 80018
|
||||
Source Host : localhost:3306
|
||||
Source Database : test02
|
||||
|
||||
Target Server Type : MYSQL
|
||||
Target Server Version : 80018
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 2020-06-16 11:11:52
|
||||
*/
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user_cart
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `user_cart`;
|
||||
CREATE TABLE `user_cart` (
|
||||
`username` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`bookname` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
||||
`price` float(10,2) NOT NULL,
|
||||
`count` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user_cart
|
||||
-- ----------------------------
|
@ -1 +1,32 @@
|
||||
INSERT INTO `user_list` VALUES ('admin1', 'admin1', 1);
|
||||
/*
|
||||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : zx
|
||||
Source Server Version : 80018
|
||||
Source Host : localhost:3306
|
||||
Source Database : test02
|
||||
|
||||
Target Server Type : MYSQL
|
||||
Target Server Version : 80018
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 2020-06-16 11:11:57
|
||||
*/
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user_list
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `user_list`;
|
||||
CREATE TABLE `user_list` (
|
||||
`username` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
||||
`password` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
|
||||
`userstatus` int(11) NOT NULL,
|
||||
PRIMARY KEY (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user_list
|
||||
-- ----------------------------
|
||||
INSERT INTO `user_list` VALUES ('admin1', 'admin1', '1');
|
||||
|
@ -1,9 +1,18 @@
|
||||
package com.book.demo.mapper;
|
||||
|
||||
import com.book.demo.entity.Cart;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface CartMapper {
|
||||
@Select("select * from user_cart where id=#{id} and username=#{username}")
|
||||
int insertItem(String username,int id);
|
||||
@Delete("delete from user_cart where username=#{username}")
|
||||
void clearCart(String username);
|
||||
@Select("select * from user_cart where username=#{username}")
|
||||
Cart queryByName(String username);
|
||||
}
|
||||
|
Loading…
Reference in new issue