zx 5 years ago
parent bd8a678259
commit 27503d55e1

@ -1,7 +1,38 @@
INSERT INTO `book_list` VALUES ('9787040535358', '全国计算机等级考试二级教程', '教育部考试中心编', '高等教育出版社', '考试', '本书根据教育部考试中心最新颁布的考试大纲编写,是教育部考试中心组织编写的全国计算机等级考试系列教程之一。', 99, 43.00);
INSERT INTO `book_list` VALUES ('9787221157270', '小芳园诗草', '(清) 李绍莲著 ; 李黎点校', '贵州人民出版社', '文学', '《小芳园诗草》的价值与意义在于保存了当时底层社会真实的状况和个体在社会变迁中的心理变化。', 99, 175.00);
INSERT INTO `book_list` VALUES ('9787302527763', '计算机网络', '张曾科编著', '清华大学出版社', '教育', '本书以因特网为中心,讲述计算机网络技术。', 90, 59.00);
INSERT INTO `book_list` VALUES ('9787514859119', '别再叫我宠物猫', '刘薇编著', '中国少年儿童出版社', '小说', '不再做宠物猫的火爪加入了四大森林猫族的雷族,他获得了真正自由的生活,能摆脱人类勇敢地做自己,但是与此同时,在他面前也充满着危险和挑战。', 10, 12.50);
INSERT INTO `book_list` VALUES ('9787520160476', '社会史研究', '行龙', '社会科学文献出版社', '社会', '本刊从研究选题到资料运用,均符合学术规范,具有较高学术价值,对于推进社会史研究多有帮助。', 20, 98.00);
INSERT INTO `book_list` VALUES ('9787521315219', '学在中国', '傅佳', '外语教学与研究出版社', '历史', '本书适用于来华接受预科教育的外国留学生也适用于追求短期高效学习的语言进修生和希望快速通过HSK五级考试的考生。', 99, 68.00);
INSERT INTO `book_list` VALUES ('9787554436967', '统计热力学', '李鹤龄, 张奎', '宁夏人民教育出版社', '科学', '本书的第一版是张奎教授与作者于1999年出版完成的2001年荣获国家教学成果二等奖、自治区教学成果一等奖。', 99, 48.00);
/*
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:40
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for book_list
-- ----------------------------
DROP TABLE IF EXISTS `book_list`;
CREATE TABLE `book_list` (
`bookname` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`kind` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`price` float(10,2) NOT NULL,
PRIMARY KEY (`bookname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of book_list
-- ----------------------------
INSERT INTO `book_list` VALUES ('全国计算机等级考试二级教程', '考试', '43.00');
INSERT INTO `book_list` VALUES ('别再叫我宠物猫', '小说', '12.50');
INSERT INTO `book_list` VALUES ('学在中国', '历史', '68.00');
INSERT INTO `book_list` VALUES ('小芳园诗草', '文学', '175.00');
INSERT INTO `book_list` VALUES ('社会史研究', '社会', '98.00');
INSERT INTO `book_list` VALUES ('统计热力学', '科学', '48.00');
INSERT INTO `book_list` VALUES ('计算机网络', '教育', '59.00');

@ -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,6 +1,8 @@
package com.book.demo.mapper;
import com.book.demo.entity.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
@ -13,12 +15,15 @@ import java.util.List;
public interface BookMapper {
@Select("select * from book_list where classify=#{classify}")
@Select("select * from book_list where kind=#{kind}")
Book[] getBooksByKind(String kind);
@Select("select * from book_list")
Book[] getAll();
@Select("select * from book_list where bookname=#{bookname}")
Book[] searchBooks(String bookname);
@Delete("delete from book_list where bookname=#{bookname}")
int deleteByBookName(String bookname);
@Insert("insert into book_list values (#{bookname},#{price},#{kind})")
int Insert(Book book);
}

@ -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);
}

@ -1,6 +1,7 @@
package com.book.demo.mapper;
import com.book.demo.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@ -16,4 +17,8 @@ public interface UserMapper {
@Insert("insert into user_list values(#{username},#{password},#{kind})")
int InsertUser(User user);
@Delete("delete from user_list where username=#{username}")
int deleteUserByName(String username);
@Select("select * from user_list")
User[] queryAllUser();
}

Loading…
Cancel
Save