├── README.md ├── pom.xml ├── sms.sql └── src └── main ├── java └── com │ └── wxl │ └── sms │ ├── bean │ ├── Group.java │ ├── Product.java │ ├── Provider.java │ ├── User.java │ └── to │ │ ├── Check.java │ │ └── Sale.java │ ├── controller │ ├── GroupController.java │ ├── ProductController.java │ ├── ProviderController.java │ ├── SaleController.java │ └── UserController.java │ ├── dao │ ├── GroupMapper.java │ ├── ProductMapper.java │ ├── ProviderMapper.java │ ├── SaleMapper.java │ └── UserMapper.java │ ├── service │ ├── GroupService.java │ ├── ProductService.java │ ├── ProviderService.java │ ├── SaleService.java │ ├── UserService.java │ └── impl │ │ ├── GroupServiceImpl.java │ │ ├── ProductServiceImpl.java │ │ ├── ProviderServiceImpl.java │ │ ├── SaleServiceImpl.java │ │ └── UserServiceImpl.java │ ├── test │ └── MapperTest.java │ └── util │ └── LoginFilter.java ├── resources ├── applicationContext.xml ├── jdbc.properties ├── mapper │ ├── GroupMapper.xml │ ├── ProductMapper.xml │ ├── ProviderMapper.xml │ ├── SaleMapper.xml │ └── UserMapper.xml ├── mybatis-config.xml └── springmvc.xml └── webapp ├── WEB-INF └── web.xml ├── aust.png ├── bg.jpg ├── include ├── footer.jsp ├── header.jsp └── search.jsp ├── login.jsp └── page ├── group ├── group.jsp ├── groupAdd.jsp └── groupUpdate.jsp ├── other ├── checkout.jsp └── main.jsp ├── product ├── product.jsp ├── productAdd.jsp ├── productUpdate.jsp └── searchProduct.jsp ├── provider ├── provider.jsp ├── providerAdd.jsp ├── providerUpdate.jsp └── records.jsp ├── sale └── sale.jsp └── user ├── updatePassword.jsp ├── user.jsp └── userAdd.jsp /README.md: -------------------------------------------------------------------------------- 1 | # 基于Java的超市管理系统 2 | 3 | > 本系统为2021年安徽理工大学毕业设计项目,采用后端SSM框架,前端BootStrap(前后端不分离)的系统架构模式,实现了基本的超市管理功能; 4 | !!!🕵️‍♀️🕵️‍♀️🕵️‍♀️ 5 | 6 | ## 1.项目介绍 7 | 本系统实现了超市管理的基本功能,包括商品库存模块,商品分类模块,供应商管理模块,销售统计模块以及用户管理模块。 8 | 9 | ## 2.软件架构 10 | ### 2.1 项目技术栈 11 | - 后端:Spring + SpringMVC + MyBatis 12 | - 前端:BootStrap 13 | - 插件:PageHelper分页插件 14 | - 环境:Jdk 1.8 + Tomcat 9.0.45 + Maven管理工具 + MySQL v5.7.33 15 | 16 | ### 2.2 数据库设计 17 | ![image](https://user-images.githubusercontent.com/42307653/120094835-4b060a00-c155-11eb-877e-ac578682e0e2.png) 18 | 19 | ### 2.3 系统架构图 20 | ![image](https://user-images.githubusercontent.com/42307653/120094572-a636fd00-c153-11eb-93ae-6566bbaca447.png) 21 | 22 | ## 3.系统功能演示 23 | ### 3.1 系统首页 24 | - 访问路径(本地部署):localhost:8080/sms 25 | - 管理员密码:王小龙/123456 26 | - 普通用户:小王/123456 27 | 28 | ![image](https://user-images.githubusercontent.com/42307653/119770663-142eba80-beef-11eb-8770-f6919fe447ab.png) 29 | 30 | ### 3.2 商品库存管理 31 | ![image](https://user-images.githubusercontent.com/42307653/119770773-3c1e1e00-beef-11eb-8375-b312a9f56afb.png) 32 | 33 | ### 3.3 商品分类管理 34 | ![image](https://user-images.githubusercontent.com/42307653/119771358-2826ec00-bef0-11eb-997b-cd50583c7e23.png) 35 | 36 | ### 3.4 供应商管理 37 | ![image](https://user-images.githubusercontent.com/42307653/119771388-36750800-bef0-11eb-90c4-08ee67a926e8.png) 38 | 39 | ### 3.5 销售统计 40 | ![image](https://user-images.githubusercontent.com/42307653/119771412-3f65d980-bef0-11eb-99c4-e17c8b599f49.png) 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.wxl.sms 8 | sms 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 8 13 | 8 14 | 4.3.28.RELEASE 15 | 16 | 17 | 18 | 19 | 20 | org.springframework 21 | spring-context 22 | ${spring.version} 23 | 24 | 25 | 26 | org.springframework 27 | spring-web 28 | ${spring.version} 29 | 30 | 31 | org.springframework 32 | spring-webmvc 33 | ${spring.version} 34 | 35 | 36 | 37 | org.springframework 38 | spring-jdbc 39 | ${spring.version} 40 | 41 | 42 | 43 | org.springframework 44 | spring-aspects 45 | ${spring.version} 46 | 47 | 48 | 49 | 50 | org.mybatis 51 | mybatis 52 | 3.4.2 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | org.mybatis 63 | mybatis-spring 64 | 1.3.1 65 | 66 | 67 | 68 | 69 | c3p0 70 | c3p0 71 | 0.9.1.2 72 | 73 | 74 | mysql 75 | mysql-connector-java 76 | 5.1.47 77 | 78 | 79 | 80 | 81 | jstl 82 | jstl 83 | 1.2 84 | 85 | 86 | javax.servlet 87 | javax.servlet-api 88 | 3.0.1 89 | provided 90 | 91 | 92 | 93 | javax.servlet 94 | jsp-api 95 | 2.0 96 | 97 | 98 | 99 | 100 | junit 101 | junit 102 | 4.12 103 | compile 104 | 105 | 106 | 107 | org.projectlombok 108 | lombok 109 | 1.18.12 110 | 111 | 112 | 113 | 114 | org.springframework 115 | spring-test 116 | ${spring.version} 117 | 118 | 119 | 120 | 121 | 122 | com.github.pagehelper 123 | pagehelper 124 | 5.2.0 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /sms.sql: -------------------------------------------------------------------------------- 1 | /* 2 | SQLyog Ultimate v12.09 (64 bit) 3 | MySQL - 5.7.33 : Database - sms2021 4 | ********************************************************************* 5 | */ 6 | 7 | /*!40101 SET NAMES utf8 */; 8 | 9 | /*!40101 SET SQL_MODE=''*/; 10 | 11 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 12 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 13 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 14 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 15 | CREATE DATABASE /*!32312 IF NOT EXISTS*/`sms2021` /*!40100 DEFAULT CHARACTER SET utf8 */; 16 | 17 | USE `sms2021`; 18 | 19 | /*Table structure for table `tb_group` */ 20 | 21 | DROP TABLE IF EXISTS `tb_group`; 22 | 23 | CREATE TABLE `tb_group` ( 24 | `id` int(11) NOT NULL AUTO_INCREMENT, 25 | `group_name` varchar(255) NOT NULL DEFAULT '', 26 | PRIMARY KEY (`id`) 27 | ) ENGINE=InnoDB AUTO_INCREMENT=2012 DEFAULT CHARSET=utf8; 28 | 29 | /*Data for the table `tb_group` */ 30 | 31 | insert into `tb_group`(`id`,`group_name`) values (2001,'食品'),(2002,'饮料'),(2003,'日用品'),(2004,'数码产品'),(2005,'图书'),(2006,'玩具'),(2007,'电子产品'),(2008,'日常穿搭'),(2009,'卫生健康'),(2010,'汽车内饰'),(2011,'时尚穿搭'); 32 | 33 | /*Table structure for table `tb_product` */ 34 | 35 | DROP TABLE IF EXISTS `tb_product`; 36 | 37 | CREATE TABLE `tb_product` ( 38 | `id` int(11) NOT NULL AUTO_INCREMENT, 39 | `group_id` int(11) DEFAULT NULL COMMENT '类别', 40 | `provider_id` int(11) DEFAULT NULL COMMENT '供应商编号', 41 | `product_name` varchar(255) NOT NULL DEFAULT '', 42 | `yield_date` datetime DEFAULT NULL COMMENT '生产日期', 43 | `product_factory` varchar(255) NOT NULL DEFAULT '' COMMENT '生产工厂', 44 | `purchase_price` float unsigned NOT NULL DEFAULT '0' COMMENT '进价', 45 | `stock` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '库存', 46 | `sale_price` float unsigned NOT NULL DEFAULT '0' COMMENT '售价', 47 | `sale_count` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '销售量', 48 | `create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 49 | PRIMARY KEY (`id`), 50 | KEY `fk_tb_product_tb_group` (`group_id`), 51 | KEY `fk_product_provider` (`provider_id`), 52 | CONSTRAINT `fk_product_category` FOREIGN KEY (`group_id`) REFERENCES `tb_group` (`id`), 53 | CONSTRAINT `fk_product_provider` FOREIGN KEY (`provider_id`) REFERENCES `tb_provider` (`id`) 54 | ) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8; 55 | 56 | /*Data for the table `tb_product` */ 57 | 58 | insert into `tb_product`(`id`,`group_id`,`provider_id`,`product_name`,`yield_date`,`product_factory`,`purchase_price`,`stock`,`sale_price`,`sale_count`,`create_date`) values (10,2001,20190013,'奥利奥Update0428','2021-03-31 00:00:00','奥利奥饼干工厂',3.3,987,6.5,35,'2021-04-24 22:15:30'),(11,2003,20190013,'黑人牙膏(薄荷味)','2021-03-05 00:00:00','上海宝洁日用品公司',3.2,960,9.5,50,'2021-04-24 22:16:40'),(12,2001,20190014,'火腿肠','2021-01-01 00:00:00','北京王中王',2.2,140,3,211,'2021-04-12 23:52:48'),(13,2002,20190012,'可口可乐(500ML)','2021-02-17 00:00:00','合肥太古可乐',2.1,288,3,12,'2021-03-02 23:53:57'),(15,2003,20190014,'金口健牙膏','2021-01-24 00:00:00','云南白药牙膏有限公司',6,180,12,20,'2021-03-03 12:58:42'),(16,2007,20190014,'神舟K670E-G6D1笔记本电脑','2020-02-21 00:00:00','深圳市神舟创新科技公司',4199,200,5799,10,'2021-04-25 11:05:51'),(17,2002,20190013,'康师傅绿茶','2021-04-08 00:00:00','上海康师傅有限公司',1.2,200,3,0,'2021-04-01 11:09:10'),(18,2001,20190012,'康师傅红烧拌面','2021-03-31 00:00:00','上海康师傅有限公司',3.2,100,5,0,'2021-04-25 13:48:18'),(19,2002,20190014,'蒙牛纯牛奶250ML','2021-03-30 00:00:00','蒙牛乳业',1.2,500,3.5,0,'2021-04-25 14:34:46'),(20,2003,20190014,'黑人牙膏(草莓味)','2021-03-30 00:00:00','上海宝洁有限公司',5.2,2000,12,24,'2021-04-27 13:13:11'),(21,2002,20190014,'蒙牛纯牛奶 1.5L','2021-02-03 00:00:00','蒙牛乳业',6,300,12,0,'2021-04-27 13:14:17'),(22,2007,20190014,'ROMOSS/罗马仕 sense8P','2021-04-06 00:00:00','深圳罗马仕科技有限公司',60,487,119,13,'2021-04-27 13:16:48'),(23,2002,20190014,'蒙牛圣牧有机牛奶品醇200ml*12','2021-03-11 00:00:00','蒙牛乳业',30,100,79,0,'2021-04-27 13:19:01'),(24,2004,20190014,'BOW航世笔记本外接键盘','2020-06-27 00:00:00','B.O.W',12,3000,39,0,'2021-04-27 13:20:14'),(25,2003,20190013,'米家电水壶1A','2021-02-10 00:00:00','MIJIA/米家',50,276,79,24,'2021-04-27 13:28:15'),(26,2009,20190014,'决明子枸杞菊花茶','2021-04-06 00:00:00','泉州市百年修本茶业有限公司',6,100,59,0,'2021-04-27 13:29:32'),(27,2007,20190014,'sense 4 mini','2021-04-08 00:00:00','深圳罗马仕科技有限公司',12,280,39,20,'2021-04-27 13:30:21'),(28,2008,20190014,'李宁跑步鞋透气新款男鞋','2021-05-05 00:00:00','Lining/李宁',120,300,319,0,'2021-04-27 13:32:32'),(29,2009,20190014,'蓝禾医疗一次性使用医用口罩','2021-03-31 00:00:00','浙江蓝禾医疗用品有限公司',5.2,100,19,0,'2021-04-27 13:33:39'),(30,2010,20190014,'临时停车牌号码汽车用品','2021-03-30 00:00:00','以斯帖车品专营店',3.2,300,12,0,'2021-04-27 13:35:13'),(31,2002,20190014,'蒙牛真果粒礼盒装250g*24盒','2021-03-10 00:00:00','蒙牛乳业',26,100,52,0,'2021-04-27 13:36:00'),(32,2002,20190014,'【超定制】豆本豆豆奶250ml*24盒','2021-04-01 00:00:00','豆本豆',12,300,39,0,'2021-04-27 13:36:56'),(33,2008,20190013,'鸿星尔克开衫卫衣男','2021-03-31 00:00:00','鸿星尔克',120,300,339,0,'2021-04-27 13:37:48'),(34,2007,20190012,'华为荣耀9x手机壳','2021-03-30 00:00:00','深圳罗马仕科技有限公司',5.2,300,39,0,'2021-04-27 13:38:26'),(35,2007,20190013,'绿联usb扩展器转换接头','2021-04-01 00:00:00','B.O.W',6,300,39,0,'2021-04-27 13:39:09'),(36,2001,20190012,'威其诺自热小火锅速食','2021-03-29 00:00:00','蒙牛乳业',6,100,39,0,'2021-04-27 13:39:53'),(37,2008,20190014,'红米k30手机壳液态硅胶','2021-03-30 00:00:00','蒙牛乳业',3.2,88,12,12,'2021-04-27 13:40:21'),(38,2008,20190014,'取暖器小型家用小太阳','2021-04-05 00:00:00','上海康师傅有限公司',5.2,300,39,0,'2021-04-27 13:40:54'),(39,2003,20190012,'电脑椅家用靠背办公椅','2021-03-31 00:00:00','上海康师傅有限公司',120,300,119,0,'2021-04-27 13:41:35'),(40,2003,20190014,'联想小新air14键盘膜','2021-04-02 00:00:00','深圳罗马仕科技有限公司',120,288,5,12,'2021-04-27 13:42:08'),(41,2003,20190014,'黑人薄荷(牙膏味)','2021-04-06 00:00:00','上海宝洁有限公司',6,200,12,12,'2021-04-29 00:20:23'),(44,2003,20190017,'米家保温杯(500ML)黑色','2021-04-28 00:00:00','南京米家日用品有限公司',36,188,99,12,'2021-05-04 17:58:11'),(45,2007,20190017,'测试商品0509','2021-05-04 00:00:00','深圳罗马电子科技技术公司',68,200,168,32,'2021-05-09 21:59:10'),(46,2004,20190014,'华为Mate 40 Pro 6+128','2021-05-03 00:00:00','华为终端',6299,1000,7999,0,'2021-05-13 17:25:13'),(47,2006,20190017,'四驱车','2021-04-26 00:00:00','奥飞娱乐',34,990,60,10,'2021-05-17 19:28:16'),(48,2002,20190012,'可口可乐330ML*6','2021-04-22 00:00:00','合肥太古娱乐',7.9,1000,12.9,0,'2021-05-24 15:12:33'),(49,2001,20190012,'泰国香蕉','2021-04-26 00:00:00','淮南天猫超市大润发',7.9,990,15,10,'2021-05-24 15:13:14'),(50,2001,20190012,'桃李花式面包','2021-05-22 00:00:00','江苏省镇江市',1.3,600,2.5,0,'2021-05-26 23:17:00'),(51,2009,20190013,'甘草','2021-04-29 00:00:00','安徽省合肥市高新区',3.6,600,12,0,'2021-05-26 23:17:53'),(52,2005,20190019,'大话数据结构','2021-05-04 00:00:00','上海大雅图书',37,588,89,12,'2021-05-26 23:19:56'),(53,2005,20190019,'计算机网络(第七版)','2021-05-05 00:00:00','上海大雅图书',34,580,78,20,'2021-05-26 23:20:35'),(54,2006,20190019,'飞机航模','2021-04-27 00:00:00','武汉玩具厂',37,600,400,0,'2021-05-27 12:46:46'),(55,2011,20190017,'鸿星尔克卫衣','2021-05-10 00:00:00','福建衣服厂',39,100,128,0,'2021-05-27 12:47:35'),(56,2009,20190014,'蓝月亮洗衣液','2021-03-11 00:00:00','江苏省镇江市',37,599,128,1,'2021-05-29 00:08:01'); 59 | 60 | /*Table structure for table `tb_provider` */ 61 | 62 | DROP TABLE IF EXISTS `tb_provider`; 63 | 64 | CREATE TABLE `tb_provider` ( 65 | `id` int(11) NOT NULL AUTO_INCREMENT, 66 | `provider_name` varchar(255) NOT NULL DEFAULT '', 67 | `provider_contact` varchar(50) NOT NULL DEFAULT '', 68 | `contact_phone` varchar(50) NOT NULL DEFAULT '', 69 | `provider_address` varchar(50) NOT NULL DEFAULT '', 70 | PRIMARY KEY (`id`) 71 | ) ENGINE=InnoDB AUTO_INCREMENT=20190020 DEFAULT CHARSET=utf8; 72 | 73 | /*Data for the table `tb_provider` */ 74 | 75 | insert into `tb_provider`(`id`,`provider_name`,`provider_contact`,`contact_phone`,`provider_address`) values (20190012,'安徽合家欢超市供货端','李南京','18129373827','安徽省合肥市蜀山区幸福路112号'),(20190013,'百货超市供货端','高子腾','16736352263','江苏省无锡市'),(20190014,'天猫超市电商线下特供','李天猫','19384748392','浙江省余杭区太子路12号'),(20190016,'安徽淮南超市','李飞','18130112698','安徽省淮南市田家庵区'),(20190017,'南京百大超市','花木兰','18130112665','南京雨花台区66号'),(20190018,'上海桃李面包厂','李亮','17364320225','上海徐家汇'),(20190019,'京东','刘强','8274617','江苏省宿迁市京东电商特供'); 76 | 77 | /*Table structure for table `tb_sale` */ 78 | 79 | DROP TABLE IF EXISTS `tb_sale`; 80 | 81 | CREATE TABLE `tb_sale` ( 82 | `sale_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '销售表id', 83 | `product_id` int(11) DEFAULT NULL COMMENT '商品编号id', 84 | `product_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称', 85 | `group_id` int(11) DEFAULT NULL COMMENT '所属分类id', 86 | `purchase_price` float NOT NULL DEFAULT '0' COMMENT '进价', 87 | `sale_price` float NOT NULL DEFAULT '0' COMMENT '售价', 88 | `sale_count` int(11) NOT NULL DEFAULT '0' COMMENT '销量', 89 | `sale_volume` float DEFAULT NULL COMMENT '销售额', 90 | `net_profit` float DEFAULT NULL COMMENT '净利润', 91 | `generate_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '时间', 92 | PRIMARY KEY (`sale_id`) 93 | ) ENGINE=InnoDB AUTO_INCREMENT=10063 DEFAULT CHARSET=utf8; 94 | 95 | /*Data for the table `tb_sale` */ 96 | 97 | insert into `tb_sale`(`sale_id`,`product_id`,`product_name`,`group_id`,`purchase_price`,`sale_price`,`sale_count`,`sale_volume`,`net_profit`,`generate_time`) values (10029,12,'火腿肠',2001,2.2,3,10,22,8,'2021-05-04 23:42:25'),(10030,12,'火腿肠',2001,2.2,3,15,33,12,'2021-05-05 00:34:26'),(10031,12,'火腿肠',2001,2.2,3,15,33,12,'2021-05-05 00:34:47'),(10032,10,'奥利奥Update0428',2001,3.3,6.5,12,39.6,38.4,'2021-05-05 00:35:20'),(10033,13,'可口可乐(500ML)',2002,2.1,3,12,25.2,10.8,'2021-05-05 00:35:32'),(10034,15,'金口健牙膏',2003,6,12,10,60,60,'2021-05-05 00:35:52'),(10035,10,'奥利奥Update0428',2001,3.3,6.5,10,33,32,'2021-05-05 00:51:38'),(10036,11,'黑人牙膏(薄荷味)',2003,3.2,9.5,10,32,63,'2021-05-05 00:51:41'),(10037,15,'金口健牙膏',2003,6,12,10,60,60,'2021-05-05 00:51:45'),(10038,16,'神舟K670E-G6D1笔记本电脑',2004,4199,5799,10,41990,16000,'2021-05-05 00:52:07'),(10039,22,'ROMOSS/罗马仕 sense8P',2007,60,119,10,600,590,'2021-05-05 00:52:20'),(10040,11,'黑人牙膏(薄荷味)',2001,3.2,9.5,10,32,63,'2021-05-05 00:53:04'),(10041,11,'黑人牙膏(薄荷味)',2001,3.2,9.5,10,32,63,'2021-05-05 00:54:44'),(10042,11,'黑人牙膏(薄荷味)',2003,3.2,9.5,10,32,63,'2021-05-05 00:56:55'),(10043,12,'火腿肠',2001,2.2,3,10,22,8,'2021-05-05 00:57:37'),(10044,11,'黑人牙膏(薄荷味)',2003,3.2,9.5,10,32,63,'2021-05-05 01:19:37'),(10045,45,'测试商品0509',2007,68,168,12,816,1200,'2021-05-09 22:00:06'),(10046,20,'黑人牙膏(草莓味)',2003,5.2,12,12,62.4,81.6,'2021-05-10 14:16:30'),(10047,25,'米家电水壶1A',2003,50,79,12,600,348,'2021-05-10 14:17:00'),(10048,40,'联想小新air14键盘膜',2003,120,5,12,1440,-1380,'2021-05-10 14:17:04'),(10049,41,'黑人薄荷(牙膏味)',2003,6,12,12,72,72,'2021-05-10 14:17:33'),(10050,44,'米家保温杯(500ML)黑色',2003,36,99,12,432,756,'2021-05-10 14:17:35'),(10051,20,'黑人牙膏(草莓味)',2003,5.2,12,12,62.4,81.6,'2021-05-10 23:50:19'),(10052,25,'米家电水壶1A',2003,50,79,12,600,348,'2021-05-10 23:50:28'),(10053,27,'sense 4 mini',2007,12,39,20,240,540,'2021-05-12 21:48:34'),(10054,45,'测试商品0509',2007,68,168,20,1360,2000,'2021-05-12 21:48:48'),(10055,47,'四驱车',2006,34,60,10,340,260,'2021-05-17 19:28:59'),(10056,49,'泰国香蕉',2001,7.9,15,10,79,71,'2021-05-24 15:16:32'),(10057,52,'大话数据结构',2005,37,89,12,444,624,'2021-05-28 23:57:29'),(10058,53,'计算机网络(第七版)',2005,34,78,20,680,880,'2021-05-28 23:57:41'),(10059,37,'红米k30手机壳液态硅胶',2008,3.2,12,12,38.4,105.6,'2021-05-29 00:03:55'),(10060,22,'ROMOSS/罗马仕 sense8P',2007,60,119,3,180,177,'2021-05-29 00:06:32'),(10061,10,'奥利奥Update0428',2001,3.3,6.5,13,42.9,41.6,'2021-05-29 00:07:08'),(10062,56,'蓝月亮洗衣液',2009,37,128,1,37,91,'2021-05-29 00:08:12'); 98 | 99 | /*Table structure for table `tb_user` */ 100 | 101 | DROP TABLE IF EXISTS `tb_user`; 102 | 103 | CREATE TABLE `tb_user` ( 104 | `id` int(11) NOT NULL AUTO_INCREMENT, 105 | `username` varchar(50) DEFAULT NULL, 106 | `password` varchar(50) DEFAULT NULL, 107 | `role` varchar(50) DEFAULT NULL, 108 | PRIMARY KEY (`id`) 109 | ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; 110 | 111 | /*Data for the table `tb_user` */ 112 | 113 | insert into `tb_user`(`id`,`username`,`password`,`role`) values (14,'测试用户','ceshiyonghu','admin'),(16,'王小龙','123456','admin'),(17,'普通用户张三','123456','user'),(18,'小王','123456','user'); 114 | 115 | /*!50106 set global event_scheduler = 1*/; 116 | 117 | /* Event structure for event `event_AutoDeleteLogs` */ 118 | 119 | /*!50106 DROP EVENT IF EXISTS `event_AutoDeleteLogs`*/; 120 | 121 | DELIMITER $$ 122 | 123 | /*!50106 CREATE DEFINER=`root`@`localhost` EVENT `event_AutoDeleteLogs` ON SCHEDULE EVERY 1 DAY STARTS '2019-04-25 00:00:00' ON COMPLETION PRESERVE ENABLE DO CALL AutoDeleteLogs() */$$ 124 | DELIMITER ; 125 | 126 | /* Function structure for function `currval` */ 127 | 128 | /*!50003 DROP FUNCTION IF EXISTS `currval` */; 129 | DELIMITER $$ 130 | 131 | /*!50003 CREATE DEFINER=`root`@`localhost` FUNCTION `currval`(doctor_id VARCHAR(6)) RETURNS int(11) 132 | READS SQL DATA 133 | DETERMINISTIC 134 | BEGIN 135 | DECLARE VALUE INTEGER; 136 | SET VALUE = 10001; 137 | SELECT current_value INTO VALUE FROM doctor WHERE NAME = doctor_id; 138 | RETURN VALUE; 139 | END */$$ 140 | DELIMITER ; 141 | 142 | /* Function structure for function `nextval` */ 143 | 144 | /*!50003 DROP FUNCTION IF EXISTS `nextval` */; 145 | DELIMITER $$ 146 | 147 | /*!50003 CREATE DEFINER=`root`@`localhost` FUNCTION `nextval`(doctor_id VARCHAR(6)) RETURNS int(11) 148 | DETERMINISTIC 149 | BEGIN 150 | UPDATE doctor SET current_value = current_value + increment WHERE Name = doctor_id; 151 | RETURN currval(seq_name); 152 | END */$$ 153 | DELIMITER ; 154 | 155 | /* Procedure structure for procedure `AutoDeleteLogs` */ 156 | 157 | /*!50003 DROP PROCEDURE IF EXISTS `AutoDeleteLogs` */; 158 | 159 | DELIMITER $$ 160 | 161 | /*!50003 CREATE DEFINER=`root`@`localhost` PROCEDURE `AutoDeleteLogs`() 162 | BEGIN 163 | DELETE FROM log WHERE DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 3 DAY)) AND (type = 'DEBUG' OR type = 'INFO'); 164 | END */$$ 165 | DELIMITER ; 166 | 167 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 168 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 169 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 170 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 171 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/bean/Group.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.bean; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @author wxl on 2021/4/25 1:19 12 | */ 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @ToString 17 | public class Group { 18 | private Integer id; 19 | private String groupName; 20 | 21 | // 新增属性, 一个商品类别下有很多商品 22 | private List products; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/bean/Product.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.bean; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | import java.sql.Date; 9 | 10 | /** 11 | * @author wxl on 2021/4/24 22:10 12 | */ 13 | @Data 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @ToString 17 | public class Product { 18 | private Integer id; 19 | private Integer groupId; 20 | // 2021年5月3日01:17:21新增, 用于records.jsp页面显示 21 | private Integer providerId; 22 | private String productName; 23 | private Date yieldDate; 24 | private String productFactory; 25 | private float purchasePrice; 26 | private Integer stock; 27 | private float salePrice; 28 | private Integer saleCount; 29 | private Date createDate; 30 | 31 | // 方便查询取值 32 | private Group group; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/bean/Provider.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.bean; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | /** 9 | * @author wxl on 2021/4/29 0:24 10 | */ 11 | @Data 12 | @ToString 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | public class Provider { 16 | private Integer id; 17 | private String providerName; 18 | private String providerContact; 19 | private String contactPhone; 20 | private String providerAddress; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/bean/User.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.bean; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | /** 9 | * 用户登录实体类 10 | * 11 | * @author wxl on 2021/5/8 22:12 12 | */ 13 | @Data 14 | @ToString 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class User { 18 | private Integer id; 19 | private String username; 20 | private String password; 21 | private String role; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/bean/to/Check.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.bean.to; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | /** 9 | * 用于结算服务显示的TO 10 | * 11 | * @author wxl on 2021/4/27 1:26 12 | */ 13 | @Data 14 | @ToString 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class Check { 18 | // 商品id 19 | private Integer productId; 20 | // 商品名称 21 | private String productName; 22 | // 销售单价 23 | private float productSalePrice; 24 | // 购买数量 25 | private Integer productNumber; 26 | // 应付金额 27 | private float checkPrice; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/bean/to/Sale.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.bean.to; 2 | 3 | import com.wxl.sms.bean.Product; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.ToString; 8 | 9 | /** 10 | * AUTHORNB! 11 | * 用于销售统计页面的TO 12 | * 背景: 销售页面需要计算销售统计, 因此SQL聚合函数使用的较多, 因此, 不便于展示某一商品的单个详细信息 13 | * 因此封装Sale对象, 使用Sale对象里封装单个Product对象, 用于单个商品的展示 14 | * 15 | * @author wxl on 2021/5/4 23:48 16 | */ 17 | @Data 18 | @ToString 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | public class Sale { 22 | // 商品id 23 | private Integer productId; 24 | // 销售量 25 | private float saleCount; 26 | // 销售净利润 27 | private float netProfit; 28 | 29 | // 用于展示单个商品信息的Product 30 | private Product product; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/controller/GroupController.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.wxl.sms.bean.Group; 6 | import com.wxl.sms.service.GroupService; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.ui.Model; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestParam; 11 | 12 | import javax.annotation.Resource; 13 | import java.util.List; 14 | 15 | /** 16 | * @author wxl on 2021/4/25 1:52 17 | */ 18 | @Controller 19 | @RequestMapping("/group") 20 | public class GroupController { 21 | @Resource 22 | private GroupService groupService; 23 | 24 | /*注释掉吧, 没用到*/ 25 | // @RequestMapping("/getProductsByGroupName") 26 | // public String getGroupByGroupName(HttpServletRequest request, 27 | // @RequestParam(value = "pn", defaultValue = "1") Integer pn, 28 | // Model model) { 29 | // String groupName = request.getParameter("productGroup"); 30 | // Group group = groupService.getGroupByGroupName(groupName); 31 | // PageHelper.startPage(pn, 5); 32 | // List products = group.getProducts(); 33 | // PageInfo pageInfo = new PageInfo<>(products, 5); 34 | // model.addAttribute("pageInfo", pageInfo); 35 | // 36 | // return "product/product"; 37 | // } 38 | 39 | /** 40 | * 查询所有商品分类信息 41 | * 42 | * @param pn 传入要查询的页码(要查询第几页的数据) 43 | * @param model 为了将数据传入到cookie域中方便取出数据 44 | * @return 返回group.jsp页面 45 | */ 46 | @RequestMapping("/groupList") 47 | public String getAllGroups(@RequestParam(value = "pn", defaultValue = "1") Integer pn, 48 | Model model) { 49 | PageHelper.startPage(pn, 5); 50 | List groups = groupService.getAllGroups(); 51 | PageInfo pageInfo = new PageInfo<>(groups, 5); 52 | model.addAttribute("pageInfo", pageInfo); 53 | 54 | return "group/group"; 55 | } 56 | 57 | /** 58 | * 仅仅是跳转到添加商品分类页面 59 | * 60 | * @return groupAdd.jsp 61 | */ 62 | @RequestMapping("/addGroupPage") 63 | public String toAddGroupPage() { 64 | return "group/groupAdd"; 65 | } 66 | 67 | /** 68 | * ===> 执行新增商品分类逻辑 69 | * 新增商品分类 70 | * 71 | * @param group 表单封装后的Group对象 72 | * @return 通过重定向返回到group.jsp 73 | */ 74 | @RequestMapping("/addGroup") 75 | public String addGroup(Group group) { 76 | int row = groupService.addGroup(group); 77 | System.out.println("addProduct()影响的行数:" + row); 78 | 79 | return "forward:/group/groupList"; 80 | } 81 | 82 | /** 83 | * ===> 携带根据选中条目的id查询的数据(数据回显)跳转到修改商品分类界面 84 | * 跳转到修改商品分类页面(过程中根据id通过后台查询出选定id对应的商品分类信息用于展示) 85 | * 86 | * @param id 选中条目的分类id 87 | * @param model 用于封装根据id去后台查询出的数据 88 | * @return 商品分类信息修改页面 89 | */ 90 | @RequestMapping("/toUpdateGroupPage") 91 | public String toUpdateGroupPage(@RequestParam("id") Integer id, Model model) { 92 | Group group = groupService.getGroupByGroupId(id); 93 | model.addAttribute("group", group); 94 | 95 | return "group/groupUpdate"; 96 | } 97 | 98 | /** 99 | * ===> 执行修改商品分类信息逻辑 100 | * 修改商品分类信息 101 | * 102 | * @param group 表单封装的Group实体 103 | * @return 重定向到groupList 104 | */ 105 | @RequestMapping("/updateGroup") 106 | public String updateGroup(Group group) { 107 | int row = groupService.updateGroup(group); 108 | System.out.println("updateGroup()影响的行数:" + row); 109 | 110 | return "forward:/group/groupList"; 111 | } 112 | 113 | /** 114 | * ===> 根据选中条目的id删除分类信息 115 | * 根据分类id删除商品分类信息 116 | * 117 | * @param groupId 分类id 118 | * @return 重定向到groupList 119 | */ 120 | @RequestMapping("/deleteGroup") 121 | public String deleteGroupBySelectedId(@RequestParam("groupId") Integer groupId) { 122 | int row = groupService.deleteGroupById(groupId); 123 | System.out.println("deleteGroupById()影响的行数:" + row); 124 | 125 | return "forward:/group/groupList"; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/controller/ProductController.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.wxl.sms.bean.Group; 6 | import com.wxl.sms.bean.Product; 7 | import com.wxl.sms.bean.Provider; 8 | import com.wxl.sms.bean.to.Check; 9 | import com.wxl.sms.service.GroupService; 10 | import com.wxl.sms.service.ProductService; 11 | import com.wxl.sms.service.ProviderService; 12 | import com.wxl.sms.service.SaleService; 13 | import org.springframework.stereotype.Controller; 14 | import org.springframework.transaction.annotation.Transactional; 15 | import org.springframework.ui.Model; 16 | import org.springframework.web.bind.annotation.ModelAttribute; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.bind.annotation.RequestParam; 19 | 20 | import javax.annotation.Resource; 21 | import javax.servlet.http.HttpServletRequest; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | /** 26 | * 商品(Product)Controller 27 | * PageHelper的一些数据: PageInfo中封装了详细的分页信息, 包括我们查询出的数据 28 | * - pageNum: 当前页码 29 | * - PageSize: 每页有多少条记录 30 | * - startRow: 开始查询的记录 31 | * - endRow: 结束的记录 32 | * - ToTal: 总记录数 33 | * - Pages: 总页码 34 | * - firstPage/lastPage: 第一页/最后一页 35 | * - isFirstPage/isLastPage: 是否第一页/是否最后一页 36 | * - isHasPreviousPage/isHasNextPage: 是否有前一页/是否有后一页 37 | * 38 | * 39 | * @author wxl on 2021/4/24 23:39 40 | */ 41 | @Controller 42 | @RequestMapping("/product") 43 | public class ProductController { 44 | @Resource 45 | private ProductService productService; 46 | @Resource 47 | private GroupService groupService; 48 | @Resource 49 | private SaleService saleService; 50 | @Resource 51 | private ProviderService providerService; 52 | 53 | 54 | /** 55 | * 查询所有商品库存信息(这里用到了PageHelper分页插件) 56 | * 57 | * @param pn 传入要查询的页码(要查询第几页的数据) 58 | * @param model 为了将数据传入到cookie域中方便取出数据 59 | * @return 返回product.jsp页面 60 | */ 61 | @RequestMapping("/productList") 62 | public String getAllProducts(@RequestParam(value = "pn", defaultValue = "1") Integer pn, 63 | Model model) { 64 | PageHelper.startPage(pn, 5); 65 | // startPage后面紧跟的这个查询就是一个分页查询 66 | List products = productService.getAllProducts(); 67 | // 使用PageInfo包装查询后的结果, 只需要将PageInfo交给页面就行了(param2:表示分页条显示的页数) 68 | PageInfo pageInfo = new PageInfo<>(products, 5); 69 | model.addAttribute("pageInfo", pageInfo); 70 | 71 | // 2021年4月30日01:40:08添加, 为了让条件查询更容容易, 这里由填写商品分类, 修改为选择下拉框 72 | List allGroups = groupService.getAllGroups(); 73 | model.addAttribute("allGroups", allGroups); 74 | 75 | return "product/product"; 76 | } 77 | 78 | 79 | /** 80 | * [Deprecated] 81 | * 用于搜索显示, 根据商品名称查询后显示 ---> 需要优化 ---> getProductInfoBySearch() 82 | * 83 | * @param request 从from表单中获取参数 84 | * @param model 存数据 85 | * @return 返回provider.jsp页面 86 | */ 87 | @Deprecated 88 | @RequestMapping("/productName") 89 | public String getProductByProductName(HttpServletRequest request, 90 | Model model) { 91 | String productName = request.getParameter("productNameInForm"); 92 | System.out.println(productName); 93 | Product product = productService.getProductByProductName(productName); 94 | // 虽然只有一条数据, 但是隔壁product.jsp取值还是从分页数据中取值的啊, 只好特殊对待了...(竟然能用) 95 | List productListOnlyOne = new ArrayList<>(); 96 | productListOnlyOne.add(product); 97 | PageInfo pageInfo = new PageInfo<>(productListOnlyOne, 5); 98 | model.addAttribute("pageInfo", pageInfo); 99 | 100 | List allGroups = groupService.getAllGroups(); 101 | model.addAttribute("allGroups", allGroups); 102 | 103 | return "product/product"; 104 | } 105 | 106 | 107 | /** 108 | * [Deprecated] 109 | * 对最初的搜索商品信息的优化方案 ===> 用于搜索显示, 根据商品名称查询后显示(PLUS版) 110 | * 2021年5月10日13:22:04 ===> 方法有更新, 详情参阅Pro版 111 | * 112 | * @param pn 传入要查询的页码(要查询第几页的数据) 113 | * @param request 用于获取表单中填写的值 114 | * @param model 为了将数据传入到cookie域中方便取出数据 115 | * @return 返回product.jsp页面 116 | */ 117 | @Deprecated 118 | @RequestMapping("/search") 119 | public String getProductInfoBySearch(@RequestParam(value = "pn", defaultValue = "1") Integer pn, 120 | HttpServletRequest request, 121 | Model model) { 122 | String productName = ""; 123 | Integer groupId = null; 124 | // 表单输入的商品名称 125 | if (request.getParameter("productNameInForm") != null) { 126 | productName = request.getParameter("productNameInForm"); 127 | } 128 | if (request.getParameter("groupIdInForm") != null && 129 | !request.getParameter("groupIdInForm").equals("0")) { 130 | // 表单输入的商品类别 131 | groupId = Integer.parseInt(request.getParameter("groupIdInForm")); 132 | } 133 | 134 | // System.out.println("~~~~~~++++++" + productName + "--> " + groupId); 135 | 136 | PageHelper.startPage(pn, 5); 137 | List products = productService.getProductByProductNameOrProductGroup(productName, groupId); 138 | PageInfo pageInfo = new PageInfo<>(products, 5); 139 | model.addAttribute("pageInfo", pageInfo); 140 | 141 | List allGroups = groupService.getAllGroups(); 142 | model.addAttribute("allGroups", allGroups); 143 | 144 | // model.addAttribute("selectedProductGroupId", groupId); 145 | // // 根据id获取分类名 146 | // Group searchGroup = groupService.getGroupByGroupId(groupId); 147 | // model.addAttribute("selectedProductGroupName", searchGroup.getGroupName()); 148 | // 149 | // System.out.println("%%%%%%--->" + groupId); 150 | // System.out.println("%%%%%%--->" + searchGroup.getGroupName()); 151 | return "product/product"; 152 | 153 | // 2021年4月30日03:21:12(测试用) 154 | // return "searchProduct"; 155 | } 156 | 157 | 158 | /** 159 | * “用于搜索显示, 根据商品名称查询后显示” 的Pro版 160 | * 1、原先的方法, 按照商品类别搜索后, 点击该类别下的第二页时, 页面实际显示结果为所有商品列表的第二页 --> BUG 161 | * 2、之前未解决的原因: 一直在想着怎么在点击超链接的时候提交表单 162 | * 3、解决思路: 想要点击超链接的时候提交表单, 也就是为了获取表单里的groupId数据, 这里将点击搜索时用的groupId 163 | * 以Model的格式传递到页面中(searchProduct.jsp), 下一次点击类似第二页的操作时, 获取到该分类的id号, 去取代 164 | * 从表单中获取的值 165 | * - 前提条件: 做了优化, 默认分类不是食品(遍历第一项), 而是提示信息, 并且值为 0, 后端处理时, 若值为0 166 | * 则赋值productId为null, 此时MyBatis后端代码, 将不带有此条件(动态SQL); 167 | * - 取代表单中获取的productId, 是有条件的, 如果用户什么也不填, 那Model返回的值就是null, 在方法处理时 168 | * 添加了postGroupId默认值也为0, 如果为0, 那么就不接管替代表单值; 169 | * 170 | * @param pn 传入要查询的页码(要查询第几页的数据) 171 | * @param request 用于获取表单中填写的值 172 | * @param model 为了将数据传入到cookie域中方便取出数据 173 | * @param postGroupId 存储上一次表单提交的商品分类值 174 | * @return searchProduct.jsp 175 | */ 176 | @RequestMapping("/searchPro") 177 | public String getProductInfoBySearchPro(@RequestParam(value = "pn", defaultValue = "1") Integer pn, 178 | HttpServletRequest request, Model model, 179 | @RequestParam(value = "groupId", defaultValue = "0") Integer postGroupId) { 180 | String productName = ""; 181 | 182 | // 表单输入的商品名称 183 | if (request.getParameter("productNameInForm") != null) { 184 | productName = request.getParameter("productNameInForm"); 185 | } 186 | 187 | Integer groupId = null; 188 | if (postGroupId == null || postGroupId == 0) { 189 | if (request.getParameter("groupIdInForm") != null && 190 | !request.getParameter("groupIdInForm").equals("0")) { 191 | // 表单输入的商品类别 192 | groupId = Integer.parseInt(request.getParameter("groupIdInForm")); 193 | } 194 | } else { 195 | groupId = postGroupId; 196 | } 197 | 198 | PageHelper.startPage(pn, 5); 199 | List products = productService.getProductByProductNameOrProductGroup(productName, groupId); 200 | // System.out.println("*********" + products); 201 | PageInfo pageInfo = new PageInfo<>(products, 5); 202 | model.addAttribute("pageInfo", pageInfo); 203 | 204 | List allGroups = groupService.getAllGroups(); 205 | model.addAttribute("allGroups", allGroups); 206 | 207 | // 2021年5月10日12:59:04 优化搜索表单分页问题 208 | model.addAttribute("groupId", groupId); 209 | 210 | // 2021年4月30日03:21:12(测试用) 211 | return "product/searchProduct"; 212 | } 213 | 214 | /** 215 | * ===> 携带系统分组信息及供应商信息跳转到添加商品页面 216 | * 217 | * (Pre)仅仅是跳转到添加商品页面 218 | * -- 后面附加了用于新增商品时, 下拉选择“商品分类”和“供应商”, 而不是输入文本 219 | * 220 | * @return productAdd.jsp 221 | */ 222 | @RequestMapping("/addProductPage") 223 | public String toAddProductPage(Model model) { 224 | // 2021年4月30日01:02:57 新增 attribute(为了让添加商品信息时, 显示出商品分类信息而不是分类id) 225 | List allGroups = groupService.getAllGroups(); 226 | model.addAttribute("allGroups", allGroups); 227 | 228 | // 2021年5月4日17:44:43 新增 attribute(在新增供应商id关联后, 在新增时要体现供应商这一字段) 229 | List allProviders = providerService.getAllProviders(); 230 | model.addAttribute("allProviders", allProviders); 231 | 232 | return "product/productAdd"; 233 | } 234 | 235 | 236 | /** 237 | * ===> 执行新增商品逻辑 238 | * 239 | * 执行添加数据操作, 之后返回到查询界面 240 | * - 这里有报错 org.apache.ibatis.reflection.ReflectionException: 241 | * There is no getter for property named 'product' in 'class com.wxl.sms.bean.Product' 242 | * - 当时仅仅考虑到了是SpringMVC没有自动封装成JavaBean, 一直在表单上找原因, 搜了一些帖子后发现, 是 243 | * mybatis方面的报错信息, 并且在这里先打印参数product的值, 也排除了不是没有封装成功的原因, 244 | * 所以呀, 看报错信息去精准定位!!! 245 | * 246 | * @param product Product 247 | * @return forward:/product/productList 248 | */ 249 | @RequestMapping("/addProduct") 250 | public String addProduct(@ModelAttribute("productAddForm") Product product) { 251 | System.out.println(product); 252 | int row = productService.addProduct(product); 253 | System.out.println("影响的行数:" + row); 254 | 255 | return "forward:/product/productList"; 256 | } 257 | 258 | 259 | /** 260 | * [Deprecated] 261 | * 商品结算找零服务 262 | * 263 | * @param request 原生requestAPI, 用于获取表单数据 264 | * @param model 存储最终计算的价格, 并放入request域中 265 | * @return checkout.jsp页面 266 | */ 267 | @Deprecated 268 | @RequestMapping("/check") 269 | public String checkService(HttpServletRequest request, Model model) { 270 | Integer productId = Integer.parseInt(request.getParameter("productId")); 271 | int productNumber = Integer.parseInt(request.getParameter("productNumber")); 272 | 273 | float productSalePrice = productService.getProductSalePriceByProductId(productId); 274 | float checkPrice = productNumber * productSalePrice; 275 | model.addAttribute("checkPrice", checkPrice); 276 | 277 | return "other/checkout"; 278 | } 279 | 280 | 281 | /** 282 | * [Deprecated] 283 | * 商品结算找零服务(Plus版) 284 | * 285 | * @param request 原生requestAPI, 用于获取表单数据 286 | * @param model 存储结算页面的抽象后封装的TO对象, 并放入request域中 287 | * @return checkout.jsp页面 288 | */ 289 | @Deprecated 290 | @RequestMapping("/checkPlus") 291 | public String checkServicePlus(HttpServletRequest request, Model model) { 292 | Integer productId = Integer.parseInt(request.getParameter("productId")); 293 | Check checkObj = productService.getProductByProductIdToCheckService(productId); 294 | // 在这里完成最后对Check的初始化 295 | checkObj.setProductNumber(Integer.parseInt(request.getParameter("productNumber"))); 296 | checkObj.setCheckPrice(checkObj.getProductNumber() * checkObj.getProductSalePrice()); 297 | model.addAttribute("checkObj", checkObj); 298 | 299 | return "other/checkout"; 300 | } 301 | 302 | 303 | /** 304 | * 商品结算找零服务(PlusPro版-2021年5月2日15:22:50) 305 | * 306 | * @param request 原生requestAPI, 用于获取表单数据 307 | * @param model 存储结算页面的抽象后封装的TO对象, 并放入request域中 308 | * @return checkout.jsp页面 309 | */ 310 | @RequestMapping("/checkPlusPro") 311 | public String checkServicePlusPro(HttpServletRequest request, Model model) { 312 | Integer productId = null; 313 | if (request.getParameter("productId") != null) { 314 | // 从表单获取销售商品的id 315 | productId = Integer.parseInt(request.getParameter("productId")); 316 | } 317 | // 根据表单生成对应id的商品详细信息 318 | Check checkObj = productService.getProductByProductIdToCheckService(productId); 319 | // 获取后台此id的商品详细信息 320 | Product product = productService.getProductByProductId(productId); 321 | 322 | // 在这里完成最后对Check的初始化 323 | checkObj.setProductNumber(Integer.parseInt(request.getParameter("productNumber"))); 324 | 325 | // (2021年5月2日01:05:20)增加购买数量与库存之间的判断 326 | if (checkObj.getProductNumber() > product.getStock()) { 327 | throw new RuntimeException("商品库存不足, 请联系管理员增加库存!"); 328 | } else { 329 | checkObj.setCheckPrice(checkObj.getProductNumber() * checkObj.getProductSalePrice()); 330 | model.addAttribute("checkObj", checkObj); 331 | 332 | // ***************************事务操作*************************** 333 | // generateSaleItemAndUpdateStock(productId, checkObj.getProductNumber()); 334 | generateSaleItemAndUpdateStockPlus(productId, checkObj.getProductNumber(), product); 335 | // ************************************************************* 336 | 337 | return "other/checkout"; 338 | } 339 | } 340 | 341 | 342 | @Deprecated 343 | @Transactional 344 | public void generateSaleItemAndUpdateStock(Integer productId, Integer saleCount) { 345 | int updateProductStock = productService.updateProductStock(productId, saleCount); 346 | System.out.println("***updateProductStock ==> " + updateProductStock); 347 | int insertSaleItem = saleService.insertSaleItem(productId, saleCount); 348 | System.out.println("***insertSaleItem ==> " + insertSaleItem); 349 | } 350 | 351 | 352 | /** 353 | * 事务操作, 启用Spring声明式事务管理 354 | * 355 | * @param productId 商品id 356 | * @param saleCount 销售量 357 | * @param product id查询到的商品 358 | */ 359 | @Transactional 360 | public void generateSaleItemAndUpdateStockPlus(Integer productId, Integer saleCount, Product product) { 361 | Integer beforeStock = product.getStock(); 362 | Integer stock = beforeStock - saleCount; 363 | Integer nowSaleCount = product.getSaleCount() + saleCount; 364 | 365 | int updateProductStock = productService.updateProductStockPlus(productId, nowSaleCount, stock); 366 | System.out.println("***updateProductStock ==> " + updateProductStock); 367 | int insertSaleItem = saleService.insertSaleItem(productId, saleCount); 368 | System.out.println("***insertSaleItem ==> " + insertSaleItem); 369 | } 370 | 371 | 372 | /** 373 | * ===> 删除选中条目的商品 374 | * 按照商品id删除商品 375 | * 376 | * @param productId 商品id 377 | * @return forward:/product/productList 378 | */ 379 | @RequestMapping("/deleteProduct") 380 | public String deleteProductByProductId(@RequestParam("productId") Integer productId) { 381 | int row = productService.deleteProductByProductId(productId); 382 | System.out.println("删除操作影响的行数:" + row); 383 | return "forward:/product/productList"; 384 | } 385 | 386 | 387 | /** 388 | * ===> 携带选中条目的id查询出的商品信息跳转到添加修改页面 389 | * 390 | * @param productId 从按钮上得到的商品id 391 | * @param model 用于表单提交时传给updateProductByProductId()方法id, 便于根据id修改 392 | * @return productUpdate.jsp 393 | */ 394 | @RequestMapping("/toUpdateProductPage") 395 | public String toUpdateProductPage(@RequestParam("productId") Integer productId, Model model) { 396 | // model.addAttribute("productId", productId); 397 | // productService.getProductSalePriceByProductId() 398 | System.out.println("**********表单得到的id = " + productId); 399 | Product selectedProduct = productService.getProductByProductId(productId); 400 | System.out.println("===> " + selectedProduct); 401 | model.addAttribute("selectedProduct", selectedProduct); 402 | 403 | // 2021年4月30日01:06:43 新增 attribute(为了让修改商品信息时, 显示出商品分类信息而不是分类id) 404 | List allGroups = groupService.getAllGroups(); 405 | model.addAttribute("allGroups", allGroups); 406 | 407 | return "product/productUpdate"; 408 | } 409 | 410 | 411 | /** 412 | * ===> 执行更新商品信息逻辑 413 | * 根据商品id(表单提交封装后获取id)更新商品信息 414 | * 415 | * @param product 表单封装的product实体类 416 | * @return forward:/product/productList 417 | */ 418 | @RequestMapping("/updateProductByProductId") 419 | public String updateProductByProductId(Product product) { 420 | System.out.println("******FORM:" + product); 421 | int row = productService.updateProductByProductId(product); 422 | System.out.println("影响的行数:" + row); 423 | 424 | return "forward:/product/productList"; 425 | } 426 | 427 | } 428 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/controller/ProviderController.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.wxl.sms.bean.Product; 6 | import com.wxl.sms.bean.Provider; 7 | import com.wxl.sms.service.ProviderService; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.ui.Model; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | 13 | import javax.annotation.Resource; 14 | import javax.servlet.http.HttpServletRequest; 15 | import java.util.List; 16 | 17 | /** 18 | * @author wxl on 2021/4/29 0:28 19 | */ 20 | @Controller 21 | @RequestMapping("/provider") 22 | public class ProviderController { 23 | @Resource 24 | private ProviderService providerService; 25 | 26 | /** 27 | * 查询所有供应商信息 28 | * 29 | * @param pn 传入要查询的页码(要查询第几页的数据) 30 | * @param model 为了将数据传入到cookie域中方便取出数据 31 | * @return 返回provider.jsp页面 32 | */ 33 | @RequestMapping("/providerList") 34 | public String getAllProviders(@RequestParam(value = "pn", defaultValue = "1") Integer pn, 35 | Model model) { 36 | PageHelper.startPage(pn, 5); 37 | List providers = providerService.getAllProviders(); 38 | PageInfo pageInfo = new PageInfo<>(providers, 5); 39 | model.addAttribute("pageInfo", pageInfo); 40 | 41 | return "provider/provider"; 42 | } 43 | 44 | 45 | /** 46 | * 根据供应商id查询出该供应商所供应的所有商品列表集合 47 | * 48 | * @param pn 展示页码 49 | * @param providerId 供应商id 50 | * @param model 存储转发查询得到的数据 51 | * @return records.jsp记录页面 52 | */ 53 | @RequestMapping("/provideProducts") 54 | public String showProductBySelectedProvider(@RequestParam(value = "pn", defaultValue = "1") Integer pn, 55 | @RequestParam("providerId") Integer providerId, 56 | Model model) { 57 | PageHelper.startPage(pn, 5); 58 | List records = providerService.getProviderRecordsByProviderId(providerId); 59 | PageInfo pageInfo = new PageInfo<>(records, 5); 60 | model.addAttribute("pageInfo", pageInfo); 61 | 62 | Provider provider = providerService.getProviderByProviderId(providerId); 63 | model.addAttribute("provider", provider); 64 | 65 | return "provider/records"; 66 | } 67 | 68 | /** 69 | * 根据搜索框里输入的供应商联系人电话进行查询后返回 70 | * 71 | * @param pn 页码 72 | * @param request 用于获取表单数据的原始API 73 | * @param model 封装数据 74 | * @return provider.jsp 75 | */ 76 | @RequestMapping("/searchProvider") 77 | public String searchProvider(@RequestParam(value = "pn", defaultValue = "1") Integer pn, 78 | HttpServletRequest request, Model model) { 79 | String phoneNumber = request.getParameter("phoneNumber"); 80 | PageHelper.startPage(pn, 5); 81 | List providers = providerService.getProviderByProviderPhoneNumber(phoneNumber); 82 | System.out.println("*****结果*****" + providers); 83 | PageInfo pageInfo = new PageInfo<>(providers, 5); 84 | model.addAttribute("pageInfo", pageInfo); 85 | 86 | return "provider/provider"; 87 | } 88 | 89 | 90 | /** 91 | * ===> 删除选定条目的供应商 92 | * 根据供应商id删除供应商 93 | * 94 | * @param providerId 供应商id 95 | * @return 重定向/provider/providerList 96 | */ 97 | @RequestMapping("deleteProvider") 98 | public String deleteProvider(@RequestParam("providerId") Integer providerId) { 99 | int row = providerService.deleteProviderByProviderId(providerId); 100 | System.out.println("deleteProviderByProviderId ==> " + row); 101 | 102 | return "forward:/provider/providerList"; 103 | } 104 | 105 | /** 106 | * 仅仅是跳转到添加到供应商界面 107 | * 108 | * @return providerAdd.jsp 109 | */ 110 | @RequestMapping("/toAddProviderPage") 111 | public String toAddProviderPage() { 112 | 113 | return "provider/providerAdd"; 114 | } 115 | 116 | /** 117 | * 添加供应商 118 | * 119 | * @param provider 表单封装的Provider对象 120 | * @return 重定向到/provider/providerList 121 | */ 122 | @RequestMapping("/addProvider") 123 | public String addProvider(Provider provider) { 124 | int row = providerService.addProvider(provider); 125 | System.out.println("addProvider ==> " + row); 126 | 127 | return "forward:/provider/providerList"; 128 | } 129 | 130 | /** 131 | * 跳转到修改供应商页面, 同时携带根据id查询出的信息进行回显 132 | * 133 | * @param providerId 供应商id 134 | * @param model 携带数据转发 135 | * @return providerUpdate.jsp 136 | */ 137 | @RequestMapping("/toUpdateProviderPage") 138 | public String toUpdateProvider(@RequestParam("providerId") Integer providerId, 139 | Model model) { 140 | Provider selectedProvider = providerService.getProviderByProviderId(providerId); 141 | model.addAttribute("selectedProvider", selectedProvider); 142 | 143 | return "provider/providerUpdate"; 144 | } 145 | 146 | /** 147 | * 更新供应商 148 | * 149 | * @param provider 表单封装的Provider实体类 150 | * @return 重定向到/provider/providerList 151 | */ 152 | @RequestMapping("/updateProvider") 153 | public String updateProvider(Provider provider) { 154 | int row = providerService.updateProvider(provider); 155 | System.out.println("updateProvider => " + row); 156 | 157 | return "forward:/provider/providerList"; 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/controller/SaleController.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.wxl.sms.bean.Group; 6 | import com.wxl.sms.bean.to.Sale; 7 | import com.wxl.sms.service.GroupService; 8 | import com.wxl.sms.service.ProductService; 9 | import com.wxl.sms.service.SaleService; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | 15 | import javax.annotation.Resource; 16 | import javax.servlet.http.HttpServletRequest; 17 | import java.util.List; 18 | 19 | /** 20 | * 销售统计Controller 21 | * 22 | * @author wxl on 2021/5/5 0:08 23 | */ 24 | @Controller 25 | @RequestMapping("/sale") 26 | public class SaleController { 27 | @Resource 28 | private SaleService saleService; 29 | @Resource 30 | private ProductService productService; 31 | @Resource 32 | private GroupService groupService; 33 | 34 | 35 | /** 36 | * 重定向后进入sale.jsp页面 37 | * 38 | * @return 重定向到sale.jsp 39 | */ 40 | @RequestMapping("/toSale") 41 | public String toSalePage() { 42 | return "forward:/sale/saleInfo"; 43 | } 44 | 45 | /** 46 | * 用于显示销售统计页面的信息 47 | * 48 | * @param pn 页码 49 | * @param request 原生API, 用于获取表单输入信息以进行条件查询 50 | * @param model 存储数据域中 51 | * @return sale.jsp 52 | */ 53 | @Deprecated 54 | @RequestMapping("/saleInfo") 55 | public String showSaleInfo(@RequestParam(value = "pn", defaultValue = "1") Integer pn, 56 | HttpServletRequest request, 57 | Model model) { 58 | System.out.println("preGroupId ===> " + request.getParameter("groupIdInForm")); 59 | Integer groupId = null; 60 | String startDate = ""; 61 | String endDate = ""; 62 | 63 | if (request.getParameter("groupIdInForm") != null && 64 | !request.getParameter("groupIdInForm").equals("0")) { 65 | // 表单输入的商品类别 66 | groupId = Integer.parseInt(request.getParameter("groupIdInForm")); 67 | } 68 | if (request.getParameter("startDate") != null && 69 | request.getParameter("endDate") != null) { 70 | startDate = request.getParameter("startDate"); 71 | endDate = request.getParameter("endDate"); 72 | } 73 | 74 | // System.out.println("********************************"); 75 | // System.out.println("groupId ===> " + groupId); 76 | // System.out.println("startDate ===> " + startDate); 77 | // System.out.println("endDate ===> " + endDate); 78 | // System.out.println("********************************"); 79 | 80 | PageHelper.startPage(pn, 5); 81 | List sales = saleService.getSaleInfoByCondition(groupId, startDate, endDate); 82 | for (Sale sale : sales) { 83 | sale.setProduct(productService.getProductByProductId(sale.getProductId())); 84 | sale.getProduct().setGroup(groupService.getGroupByGroupId(sale.getProduct().getGroupId())); 85 | } 86 | 87 | PageInfo pageInfo = new PageInfo<>(sales, 5); 88 | model.addAttribute("pageInfo", pageInfo); 89 | 90 | // 2021年5月5日01:13:06添加, 为了让条件查询更容容易, 这里由填写商品分类, 修改为选择下拉框 91 | List allGroups = groupService.getAllGroups(); 92 | model.addAttribute("allGroups", allGroups); 93 | 94 | return "sale/sale"; 95 | } 96 | 97 | 98 | /** 99 | * 用于显示销售统计页面的信息 100 | * 101 | * @param pn 页码 102 | * @param request 原生API, 用于获取表单输入信息以进行条件查询 103 | * @param model 存储数据域中 104 | * @param postGroupId 存储上一次表单提交的商品分类值 105 | * @return sale.jsp 106 | */ 107 | @RequestMapping("/saleInfoPro") 108 | public String showSaleInfoPro(@RequestParam(value = "pn", defaultValue = "1") Integer pn, 109 | HttpServletRequest request, 110 | Model model, 111 | @RequestParam(value = "groupId", defaultValue = "0") Integer postGroupId) { 112 | // System.out.println("preGroupId ===> " + request.getParameter("groupIdInForm")); 113 | Integer groupId = null; 114 | String startDate = ""; 115 | String endDate = ""; 116 | 117 | if (postGroupId == 0) { 118 | if (request.getParameter("groupIdInForm") != null && 119 | !request.getParameter("groupIdInForm").equals("0")) { 120 | // 表单输入的商品类别 121 | groupId = Integer.parseInt(request.getParameter("groupIdInForm")); 122 | } 123 | } else { 124 | groupId = postGroupId; 125 | } 126 | 127 | if (request.getParameter("startDate") != null && 128 | request.getParameter("endDate") != null) { 129 | startDate = request.getParameter("startDate"); 130 | endDate = request.getParameter("endDate"); 131 | } 132 | 133 | PageHelper.startPage(pn, 5); 134 | List sales = saleService.getSaleInfoByCondition(groupId, startDate, endDate); 135 | for (Sale sale : sales) { 136 | sale.setProduct(productService.getProductByProductId(sale.getProductId())); 137 | sale.getProduct().setGroup(groupService.getGroupByGroupId(sale.getProduct().getGroupId())); 138 | } 139 | 140 | PageInfo pageInfo = new PageInfo<>(sales, 5); 141 | model.addAttribute("pageInfo", pageInfo); 142 | 143 | // 2021年5月5日01:13:06添加, 为了让条件查询更容容易, 这里由填写商品分类, 修改为选择下拉框 144 | List allGroups = groupService.getAllGroups(); 145 | model.addAttribute("allGroups", allGroups); 146 | 147 | // 2021年5月10日14:12:48 Pro版, 解决分页BUG 148 | model.addAttribute("groupId", groupId); 149 | 150 | return "sale/sale"; 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.wxl.sms.bean.User; 6 | import com.wxl.sms.service.UserService; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.ui.Model; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestParam; 11 | 12 | import javax.annotation.Resource; 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpSession; 15 | import java.util.List; 16 | 17 | /** 18 | * @author wxl on 2021/5/8 22:25 19 | */ 20 | @Controller 21 | public class UserController { 22 | @Resource 23 | private UserService userService; 24 | 25 | /** 26 | * 系统登录处理 27 | * 28 | * @param request 获取登录表单数据 29 | * @param model 存储显示登录状态信息 30 | * @param session 用于过滤器判断, 存储登录状态信息 31 | * @return login.jsp、main.jsp 32 | */ 33 | @RequestMapping("/login") 34 | public String login(HttpServletRequest request, Model model, HttpSession session) { 35 | String loginName; 36 | String loginPassword; 37 | String rememberMe; 38 | if (request.getParameter("loginName") != null 39 | && !request.getParameter("loginName").equals("")) { 40 | loginName = request.getParameter("loginName"); 41 | loginPassword = request.getParameter("loginPassword"); 42 | } else { 43 | model.addAttribute("ERROR_INFO", "请输入用户名!"); 44 | return "../login"; 45 | } 46 | 47 | System.out.println("username = " + loginName + ", password = " + loginPassword); 48 | 49 | User userInDB = userService.getUserByUsername(loginName); 50 | System.out.println("======> " + userInDB); 51 | if (userInDB == null) { 52 | // System.out.println("用户名输入错误!"); 53 | model.addAttribute("ERROR_INFO", "用户名输入错误!"); 54 | return "../login"; 55 | } else if (!userInDB.getPassword().equals(loginPassword)) { 56 | // System.out.println("密码输入错误!"); 57 | model.addAttribute("ERROR_INFO", "密码输入错误!"); 58 | return "../login"; 59 | } else { 60 | // System.out.println("登录成功!"); 61 | model.addAttribute("ERROR_INFO", null); 62 | // 判断session中是否有User, 有的话就是已经登录 -> 即放行 63 | session.setAttribute("user", userInDB); 64 | 65 | rememberMe = request.getParameter("rm"); 66 | if ("1".equals(rememberMe)) { 67 | // 设置勾选“记住我”之后保存登录状态为24h 68 | session.setMaxInactiveInterval(24 * 60 * 60); 69 | } 70 | 71 | return "other/main"; 72 | } 73 | } 74 | 75 | /** 76 | * 处理退出系统 77 | * 78 | * @param session 用于清除系统登录状态 79 | * @return 登录页面 80 | */ 81 | @RequestMapping("/exit") 82 | public String exitSystem(HttpSession session) { 83 | // 用户点击退出登录, 这里进行session中清除当前用户信息 84 | session.removeAttribute("user"); 85 | 86 | return "../login"; 87 | } 88 | 89 | 90 | /** 91 | * 获取当前系统中的所有用户用于信息显示 92 | * 93 | * @param pn 显示页码 94 | * @param model 为了将数据传入到cookie域中方便取出数据 95 | * @return user.jsp 96 | */ 97 | @RequestMapping("/userList") 98 | public String getAllUser(@RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model 99 | /*, @RequestAttribute("ADD_USER_MSG") String msg*/) { 100 | PageHelper.startPage(pn, 5); 101 | List allUser = userService.getAllUser(); 102 | PageInfo pageInfo = new PageInfo<>(allUser, 5); 103 | model.addAttribute("pageInfo", pageInfo); 104 | 105 | // 显示添加用户信息操作 106 | // model.addAttribute("ADD_USER_STATE_MSG", msg); 107 | 108 | return "user/user"; 109 | } 110 | 111 | /** 112 | * 仅仅是跳转到新增用户界面 113 | * 114 | * @return userAdd.jsp 115 | */ 116 | @RequestMapping("toAddUser") 117 | public String toAddUserPage() { 118 | return "user/userAdd"; 119 | } 120 | 121 | 122 | /** 123 | * 添加系统登录用户 124 | * 125 | * @param user 表单封装的用户对象 126 | * @return 用户列表 127 | */ 128 | @RequestMapping("/addUser") 129 | public String addUser(User user, HttpServletRequest request) { 130 | // ****************添加用户时的用户名不可以与之前的重复******************* 131 | List allUser = userService.getAllUser(); 132 | for (User savedUser : allUser) { 133 | if (savedUser.getUsername().equals(user.getUsername())) { 134 | System.out.println("用户名已存在, 添加失败"); 135 | request.setAttribute("ADD_USER_MSG", "用户名已存在, 添加失败"); 136 | // model.addAttribute("ADD_USER_MSG", "用户名已存在, 添加失败"); 137 | // session.setAttribute("ADD_USER_MSG", "用户名已存在, 添加失败"); 138 | return "forward:userList"; 139 | } 140 | } 141 | // ******************************************************************* 142 | 143 | int addUser = userService.addUser(user); 144 | System.out.println("addUser ==> " + addUser); 145 | request.setAttribute("ADD_USER_MSG", "添加用户 " + user.getUsername() + " 成功"); 146 | // model.addAttribute("ADD_USER_MSG", "添加用户 " + user.getUsername() + " 成功"); 147 | // session.setAttribute("ADD_USER_MSG", "添加用户 " + user.getUsername() + " 成功"); 148 | 149 | return "forward:userList"; 150 | } 151 | 152 | /** 153 | * 重置所有用户的密码为123456 154 | * 155 | * @return 重定向到userList.jsp 156 | */ 157 | @RequestMapping("/resetAllPassword") 158 | public String resetAllPassword() { 159 | int resetAllPassword = userService.resetAllPassword(); 160 | System.out.println("resetAllPassword ==> " + resetAllPassword); 161 | 162 | return "forward:userList"; 163 | } 164 | 165 | /** 166 | * 重置选中用户密码 167 | * 168 | * @param id 选中用户id 169 | * @return 重定向到userList.jsp 170 | */ 171 | @RequestMapping("/resetSelectedUserPassword") 172 | public String resetSelectedUserPassword(@RequestParam("id") Integer id) { 173 | int resetPasswordByUserId = userService.resetPasswordByUserId(id); 174 | System.out.println("resetPasswordByUserId ==> " + resetPasswordByUserId); 175 | 176 | return "forward:userList"; 177 | } 178 | 179 | /** 180 | * 删除选中用户 181 | * 182 | * @param id 选中用户id 183 | * @return 重定向到userList.jsp 184 | */ 185 | @RequestMapping("/deleteSelectedUser") 186 | public String deleteSelectedUser(@RequestParam("id") Integer id, HttpSession session) { 187 | // ********************如果删除选中的用户是当前系统登录本人, 则删除失败 188 | User user = (User) session.getAttribute("user"); 189 | // System.out.println("---> 当前系统登录用户:" + user); 190 | User userByUserId = userService.getUserByUserId(id); 191 | // System.out.println("---> 根据id查的用户:" + userByUserId); 192 | if (user.getId().equals(userByUserId.getId())) { 193 | System.out.println("您不可以删除您自己"); 194 | return "forward:userList"; 195 | } 196 | 197 | int deleteUserByUserId = userService.deleteUserByUserId(id); 198 | System.out.println("deleteUserByUserId ==> " + deleteUserByUserId); 199 | 200 | return "forward:userList"; 201 | } 202 | 203 | /** 204 | * 注销当前用户并退出 205 | * 206 | * @param id 选中用户id 207 | * @return 注销后退出系统 208 | */ 209 | @RequestMapping("/deleteCurrentUser") 210 | public String deleteCurrentUser(@RequestParam("id") Integer id) { 211 | // ******************如果当前用户是最后一个管理员账户, 设置不可删除 212 | List allAdmin = userService.getAllAdmin(); 213 | if (allAdmin.size() == 1) { 214 | System.out.println("您是当前系统的最后一位管理员, 禁止删除"); 215 | return "forward:userList"; 216 | } 217 | 218 | int deleteUserByUserId = userService.deleteUserByUserId(id); 219 | System.out.println("deleteUserByUserId ==> " + deleteUserByUserId); 220 | 221 | return "forward:/exit"; 222 | } 223 | 224 | /** 225 | * 跳转到修改当前用户密码界面 226 | * 227 | * @return updatePassword.jsp 228 | */ 229 | @RequestMapping("/toUpdateCurrentPasswordPage") 230 | public String toUpdateCurrentPasswordPage() { 231 | return "user/updatePassword"; 232 | } 233 | 234 | /** 235 | * 修改当前用户密码 236 | * 237 | * @param request 获取输入的新密码 238 | * @param session 获取当前登录用户id 239 | * @param model 存储修改结果 240 | * @return main.jsp 241 | */ 242 | @RequestMapping("/updateCurrentUserPassword") 243 | public String updateCurrentUserPassword(HttpServletRequest request, HttpSession session, Model model) { 244 | String password = request.getParameter("password"); 245 | User user = (User) session.getAttribute("user"); 246 | int updatePassword = userService.updatePassword(user.getId(), password); 247 | System.out.println("updatePassword ==> " + updatePassword); 248 | model.addAttribute("updatePassword", updatePassword); 249 | 250 | return "other/main"; 251 | } 252 | 253 | // ********以下两个Controller是为了防止JSP页面跳转失败而加的, 无逻辑操作 254 | 255 | /** 256 | * 跳转到首页 257 | * 258 | * @return main.jsp 259 | */ 260 | @RequestMapping("/home") 261 | public String toHomePage() { 262 | return "other/main"; 263 | } 264 | 265 | /** 266 | * 跳转到结算业面 267 | * 268 | * @return checkout.jsp 269 | */ 270 | @RequestMapping("/toCheckout") 271 | public String toCheckoutPage() { 272 | return "other/checkout"; 273 | } 274 | } 275 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/dao/GroupMapper.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.dao; 2 | 3 | import com.wxl.sms.bean.Group; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 商品分组数据库层代码 9 | * 10 | * @author wxl on 2021/4/25 1:20 11 | */ 12 | public interface GroupMapper { 13 | 14 | /** 15 | * 根据分类的id查询返回分类实体 16 | * 17 | * @param id 分类的id 18 | * @return 分类实体 19 | */ 20 | Group getGroupByGroupId(Integer id); 21 | 22 | // /** 23 | // * 根据商品分类名称查询商品分类的时候还能把本类下的商品信息查询出来 24 | // * 25 | // * @param groupName 商品分类名称 26 | // * @return Group 27 | // */ 28 | // Group getGroupByGroupName(String groupName); 29 | 30 | /** 31 | * 获取所有商品分类信息用于页面的展示 32 | * 33 | * @return List 34 | */ 35 | List getAllGroups(); 36 | 37 | /** 38 | * 新增商品分类 39 | * 40 | * @param group group 41 | * @return 影响的行数 42 | */ 43 | int addGroup(Group group); 44 | 45 | /** 46 | * 修改商品分类信息 47 | * 48 | * @param group 表单封装返回Group实体 49 | * @return 影响的行数 50 | */ 51 | int updateGroup(Group group); 52 | 53 | /** 54 | * 根据id删除商品分类信息 55 | * 56 | * @param id 分类id 57 | * @return 影响的行数 58 | */ 59 | int deleteGroupById(Integer id); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/dao/ProductMapper.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.dao; 2 | 3 | import com.wxl.sms.bean.Product; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author wxl on 2021/4/24 22:24 10 | */ 11 | public interface ProductMapper { 12 | 13 | /** 14 | * 查询所有商品信息并返回集合封装数据, 用于直接查询返回所有的商品信息 15 | * @return List 16 | */ 17 | List getAllProducts(); 18 | 19 | 20 | /** 21 | * 用于搜索显示, 根据商品名称查询后显示 22 | * @param productName 商品名称 23 | * @return 单个Product实体 24 | */ 25 | Product getProductByProductName(String productName); 26 | 27 | 28 | /** 29 | * 用于搜索显示, 根据商品名称查询后显示 ---> PLUS 30 | * 31 | * @param productName 商品名称 32 | * @param groupId 商品类别id 33 | * @return Product集合 34 | */ 35 | List getProductByProductNameOrProductGroup(@Param("productName") String productName, 36 | @Param("groupId") Integer groupId); 37 | 38 | 39 | // List getProductsByProductGroup(); 40 | 41 | /** 42 | * 新增商品信息 43 | * 44 | * @param product product 45 | * @return 影响的行数 46 | */ 47 | int addProduct(Product product); 48 | 49 | /** 50 | * 根据商品的编号获取到该商品的价格 51 | * 52 | * @param id 商品id 53 | * @return 商品的价格 54 | */ 55 | float getProductSalePriceByProductId(Integer id); 56 | 57 | /** 58 | * 根据商品的编号获取到该商品(用于结算服务) 59 | * 60 | * @param productId 商品的编号 61 | * @return Product 62 | */ 63 | Product getProductByProductIdForCheckService(Integer productId); 64 | 65 | /** 66 | * 按照商品id删除商品 67 | * 68 | * @param productId 商品id 69 | * @return 影响的行数 70 | */ 71 | int deleteProductByProductId(Integer productId); 72 | 73 | /** 74 | * 按照商品id修改商品 75 | * 76 | * @param product 表单数据封装成的Product对象 77 | * @return 影响的行数 78 | */ 79 | int updateProductByProductId(Product product); 80 | 81 | /** 82 | * 根据商品id获取该商品对象 83 | * 84 | * @param productId 商品id 85 | * @return 商品对象 86 | */ 87 | Product getProductByProductId(Integer productId); 88 | 89 | /** 90 | * 更新id对应的商品库存 91 | * 92 | * @param productId 商品id 93 | * @param saleCount 售出数量 94 | * @return 影响行数 95 | */ 96 | int updateProductStock(@Param("productId") Integer productId, @Param("saleCount") Integer saleCount); 97 | 98 | /** 99 | * 更新id对应的商品库存(PLUS) 100 | * 101 | * @param productId 商品id 102 | * @param saleCount 售出数量 103 | * @param stock 库存 104 | * @return 影响行数 105 | */ 106 | int updateProductStockPlus(@Param("productId") Integer productId, 107 | @Param("saleCount") Integer saleCount, 108 | @Param("stock") Integer stock); 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/dao/ProviderMapper.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.dao; 2 | 3 | import com.wxl.sms.bean.Product; 4 | import com.wxl.sms.bean.Provider; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 供应商数据库操作Mapper 10 | * 11 | * @author wxl on 2021/4/29 0:22 12 | */ 13 | public interface ProviderMapper { 14 | 15 | /** 16 | * 获取所有供应商List 17 | * 18 | * @return List 19 | */ 20 | List getAllProviders(); 21 | 22 | /** 23 | * 根据供应商id查询出该供应商供应的商品 24 | * 生产意义: 查看各个商品对应的销量来衡量一个供应商 25 | * 26 | * @param providerId 供应商id 27 | * @return 商品集合, 这里抽取部分字段进行展示 28 | */ 29 | List getProviderRecordsByProviderId(Integer providerId); 30 | 31 | /** 32 | * 根据供应商id查询出该供应商实体 33 | * 34 | * @param providerId 供应商id 35 | * @return 供应商实体 36 | */ 37 | Provider getProviderByProviderId(Integer providerId); 38 | 39 | /** 40 | * 根据供应商联系人电话号码查询出该供应商 41 | * 42 | * @param phoneNumber 供应商联系人电话号码 43 | * @return 供应商实体 44 | */ 45 | List getProviderByProviderPhoneNumber(String phoneNumber); 46 | 47 | /** 48 | * 根据供应商id删除供应商 49 | * 50 | * @param providerId 供应商id 51 | * @return 影响的行数 52 | */ 53 | int deleteProviderByProviderId(Integer providerId); 54 | 55 | /** 56 | * 添加供应商 57 | * 58 | * @param provider 供应商实体类 59 | * @return 影响的行数 60 | */ 61 | int addProvider(Provider provider); 62 | 63 | /** 64 | * 修改供应商 65 | * 66 | * @param provider 供应商实体类 67 | * @return 影响的行数 68 | */ 69 | int updateProvider(Provider provider); 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/dao/SaleMapper.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.dao; 2 | 3 | import com.wxl.sms.bean.to.Sale; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 销售表Mapper 10 | * 11 | * @author wxl on 2021/5/2 1:10 12 | */ 13 | public interface SaleMapper { 14 | 15 | /** 16 | * 增加一条销售记录(事务操作) 17 | * 18 | * @return 影响的行数 19 | */ 20 | int insertSaleItemFinal(@Param("productId") Integer productId, 21 | @Param("productName") String productName, 22 | @Param("groupId") Integer groupId, 23 | @Param("purchasePrice") float purchasePrice, 24 | @Param("salePrice") float salePrice, 25 | @Param("saleCount") Integer saleCount, 26 | @Param("saleVolume") float saleVolume, 27 | @Param("netProfit") float netProfit); 28 | 29 | 30 | /** 31 | * 用于根据条件展示销售信息 32 | * 33 | * @param groupId 商品分类信息 34 | * @param startDate 搜索开始时间 35 | * @param endDate 搜索结束时间 36 | * @return TO集合 37 | */ 38 | List getSaleInfoByCondition(@Param("groupId") Integer groupId, 39 | @Param("startDate") String startDate, 40 | @Param("endDate") String endDate); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/dao/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.dao; 2 | 3 | import com.wxl.sms.bean.User; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 用于系统登录的Mapper 10 | * 11 | * @author wxl on 2021/5/8 22:10 12 | */ 13 | public interface UserMapper { 14 | 15 | /** 16 | * 用于登录验证, 根据输入的用户名去数据库查询返回该用户用于对比 17 | * 18 | * @param username username参数 19 | * @return User实体类 20 | */ 21 | User getUserByUsername(String username); 22 | 23 | /** 24 | * 获取系统所有用户, 用于页面显示 25 | * 26 | * @return List集合 27 | */ 28 | List getAllUser(); 29 | 30 | /** 31 | * 添加用户 32 | * 33 | * @param user SpringMVC自动封装表单对象 34 | * @return 影响的行数 35 | */ 36 | int addUser(User user); 37 | 38 | /** 39 | * 重置所有用户的密码 40 | * 41 | * @return 影响的行数 42 | */ 43 | int resetAllPassword(); 44 | 45 | /** 46 | * 按照用户id重置某一用户密码 47 | * 48 | * @param id 用户id 49 | * @return 影响的行数 50 | */ 51 | int resetPasswordByUserId(Integer id); 52 | 53 | /** 54 | * 按照用户id删除某一用户 55 | * 56 | * @param id 用户id 57 | * @return 影响的行数 58 | */ 59 | int deleteUserByUserId(Integer id); 60 | 61 | /** 62 | * 修改密码 63 | * 64 | * @param id 用户id 65 | * @param password 新密码 66 | * @return 影响的行数 67 | */ 68 | int updatePassword(@Param("id") Integer id, @Param("password") String password); 69 | 70 | /** 71 | * 获取当前系统中所有的管理员账户信息 72 | * 73 | * @return List 74 | */ 75 | List getAllAdmin(); 76 | 77 | /** 78 | * 根据用户id获取用户 79 | * 80 | * @return user 81 | */ 82 | User getUserByUserId(Integer id); 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/GroupService.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service; 2 | 3 | import com.wxl.sms.bean.Group; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author wxl on 2021/4/25 1:51 9 | */ 10 | public interface GroupService { 11 | 12 | // /** 13 | // * 根据商品分类名称查询商品分类的时候还能把本类下的商品信息查询出来 14 | // * 15 | // * @param groupName 商品分类名称 16 | // * @return Group 17 | // */ 18 | // Group getGroupByGroupName(String groupName); 19 | 20 | /** 21 | * 获取所有商品分类信息用于页面的展示 22 | * 23 | * @return List 24 | */ 25 | List getAllGroups(); 26 | 27 | /** 28 | * 新增商品分类 29 | * 30 | * @param group group 31 | * @return 影响的行数 32 | */ 33 | int addGroup(Group group); 34 | 35 | /** 36 | * 根据分类的id查询返回分类实体 37 | * 38 | * @param id 分类的id 39 | * @return 分类实体 40 | */ 41 | Group getGroupByGroupId(Integer id); 42 | 43 | /** 44 | * 修改商品分类信息 45 | * 46 | * @param group 表单封装返回Group实体 47 | * @return 影响的行数 48 | */ 49 | int updateGroup(Group group); 50 | 51 | /** 52 | * 根据id删除商品分类信息 53 | * 54 | * @param id 分类id 55 | * @return 影响的行数 56 | */ 57 | int deleteGroupById(Integer id); 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/ProductService.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service; 2 | 3 | import com.wxl.sms.bean.Product; 4 | import com.wxl.sms.bean.to.Check; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author wxl on 2021/4/24 23:37 10 | */ 11 | public interface ProductService { 12 | 13 | /** 14 | * 获取所有商品信息 15 | * 16 | * @return List集合 17 | */ 18 | List getAllProducts(); 19 | 20 | /** 21 | * 用于搜索显示, 根据商品名称查询后显示 22 | * 23 | * @param productName 商品名称 24 | * @return 单个Product实体 25 | */ 26 | Product getProductByProductName(String productName); 27 | 28 | /** 29 | * 新增商品信息 30 | * 31 | * @param product product 32 | * @return 影响的行数 33 | */ 34 | int addProduct(Product product); 35 | 36 | /** 37 | * 根据商品的编号获取到该商品的价格 38 | * 39 | * @param id 商品id 40 | * @return 商品的价格 41 | */ 42 | float getProductSalePriceByProductId(Integer id); 43 | 44 | /** 45 | * 根据商品id查询商品的信息之后封装到Check的TO类中, 用于结算服务显示 46 | * 47 | * @param productId 商品id 48 | * @return TO -> Check 49 | */ 50 | Check getProductByProductIdToCheckService(Integer productId); 51 | 52 | /** 53 | * 按照商品id删除商品 54 | * 55 | * @param productId 商品id 56 | * @return 影响的行数 57 | */ 58 | int deleteProductByProductId(Integer productId); 59 | 60 | /** 61 | * 按照商品id修改商品 62 | * 63 | * @param product 表单数据封装成的Product对象 64 | * @return 影响的行数 65 | */ 66 | int updateProductByProductId(Product product); 67 | 68 | /** 69 | * 根据商品id获取该商品对象 70 | * 71 | * @param productId 商品id 72 | * @return 商品对象 73 | */ 74 | Product getProductByProductId(Integer productId); 75 | 76 | 77 | /** 78 | * 用于搜索显示, 根据商品名称查询后显示 ---> PLUS 79 | * 2021年4月30日01:44:36 80 | * 81 | * @param productName 商品名称 82 | * @param groupId 商品类别id 83 | * @return Product集合 84 | */ 85 | List getProductByProductNameOrProductGroup(String productName, Integer groupId); 86 | 87 | /** 88 | * 更新id对应的商品库存 89 | * 90 | * @param productId 商品id 91 | * @param saleCount 售出数量 92 | * @return 影响行数 93 | */ 94 | @Deprecated 95 | int updateProductStock(Integer productId, Integer saleCount); 96 | 97 | /** 98 | * 更新id对应的商品库存(PLUS) 99 | * 100 | * @param productId 商品id 101 | * @param saleCount 售出数量 102 | * @param stock 库存 103 | * @return 影响行数 104 | */ 105 | int updateProductStockPlus(Integer productId, 106 | Integer saleCount, 107 | Integer stock); 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/ProviderService.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service; 2 | 3 | import com.wxl.sms.bean.Product; 4 | import com.wxl.sms.bean.Provider; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author wxl on 2021/4/29 0:26 10 | */ 11 | public interface ProviderService { 12 | 13 | /** 14 | * 获取所有供应商List 15 | * 16 | * @return List 17 | */ 18 | List getAllProviders(); 19 | 20 | /** 21 | * 根据供应商id查询出该供应商供应的商品 22 | * 生产意义: 查看各个商品对应的销量来衡量一个供应商 23 | * 24 | * @param providerId 供应商id 25 | * @return 商品集合, 这里抽取部分字段进行展示 26 | */ 27 | List getProviderRecordsByProviderId(Integer providerId); 28 | 29 | /** 30 | * 根据供应商id查询出该供应商实体 31 | * 32 | * @param providerId 供应商id 33 | * @return 供应商实体 34 | */ 35 | Provider getProviderByProviderId(Integer providerId); 36 | 37 | /** 38 | * 根据供应商联系人电话号码查询出该供应商 39 | * 40 | * @param phoneNumber 供应商联系人电话号码 41 | * @return 供应商实体 42 | */ 43 | List getProviderByProviderPhoneNumber(String phoneNumber); 44 | 45 | /** 46 | * 根据供应商id删除供应商 47 | * 48 | * @param providerId 供应商id 49 | * @return 影响的行数 50 | */ 51 | int deleteProviderByProviderId(Integer providerId); 52 | 53 | /** 54 | * 添加供应商 55 | * 56 | * @param provider 供应商实体类 57 | * @return 影响的行数 58 | */ 59 | int addProvider(Provider provider); 60 | 61 | /** 62 | * 修改供应商 63 | * 64 | * @param provider 供应商实体类 65 | * @return 影响的行数 66 | */ 67 | int updateProvider(Provider provider); 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/SaleService.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service; 2 | 3 | import com.wxl.sms.bean.to.Sale; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author wxl on 2021/5/2 1:22 9 | */ 10 | public interface SaleService { 11 | 12 | /** 13 | * 增加一条销售记录 14 | * 15 | * @param productId 售出商品id 16 | * @param saleCount 售出数量 17 | * @return 影响的行数 18 | */ 19 | int insertSaleItem(Integer productId, Integer saleCount); 20 | 21 | /** 22 | * 用于根据条件展示销售信息 23 | * 24 | * @param groupId 商品分类信息 25 | * @param startDate 搜索开始时间 26 | * @param endDate 搜索结束时间 27 | * @return TO集合 28 | */ 29 | List getSaleInfoByCondition(Integer groupId, String startDate, String endDate); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service; 2 | 3 | import com.wxl.sms.bean.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author wxl on 2021/5/8 22:23 9 | */ 10 | public interface UserService { 11 | 12 | /** 13 | * 用于登录验证, 根据输入的用户名去数据库查询返回该用户用于对比 14 | * 15 | * @param username username参数 16 | * @return User实体类 17 | */ 18 | User getUserByUsername(String username); 19 | 20 | /** 21 | * 获取系统所有用户, 用于页面显示 22 | * 23 | * @return List集合 24 | */ 25 | List getAllUser(); 26 | 27 | /** 28 | * 添加用户 29 | * 30 | * @param user SpringMVC自动封装表单对象 31 | * @return 影响的行数 32 | */ 33 | int addUser(User user); 34 | 35 | /** 36 | * 重置所有用户的密码 37 | * 38 | * @return 影响的行数 39 | */ 40 | int resetAllPassword(); 41 | 42 | 43 | /** 44 | * 按照用户id重置某一用户密码 45 | * 46 | * @param id 用户id 47 | * @return 影响的行数 48 | */ 49 | int resetPasswordByUserId(Integer id); 50 | 51 | /** 52 | * 按照用户id删除某一用户 53 | * 54 | * @param id 用户id 55 | * @return 影响的行数 56 | */ 57 | int deleteUserByUserId(Integer id); 58 | 59 | /** 60 | * 修改密码 61 | * 62 | * @param id 用户id 63 | * @param password 新密码 64 | * @return 影响的行数 65 | */ 66 | int updatePassword(Integer id, String password); 67 | 68 | /** 69 | * 获取当前系统中所有的管理员账户信息 70 | * 71 | * @return List 72 | */ 73 | List getAllAdmin(); 74 | 75 | /** 76 | * 根据用户id获取用户 77 | * 78 | * @return user 79 | */ 80 | User getUserByUserId(Integer id); 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/impl/GroupServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service.impl; 2 | 3 | import com.wxl.sms.bean.Group; 4 | import com.wxl.sms.dao.GroupMapper; 5 | import com.wxl.sms.service.GroupService; 6 | import org.springframework.stereotype.Service; 7 | 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | /** 12 | * @author wxl on 2021/4/25 1:51 13 | */ 14 | @Service 15 | public class GroupServiceImpl implements GroupService { 16 | @Resource 17 | private GroupMapper groupMapper; 18 | 19 | // @Override 20 | // public Group getGroupByGroupName(String groupName) { 21 | // return groupMapper.getGroupByGroupName(groupName); 22 | // } 23 | 24 | @Override 25 | public List getAllGroups() { 26 | return groupMapper.getAllGroups(); 27 | } 28 | 29 | @Override 30 | public int addGroup(Group group) { 31 | return groupMapper.addGroup(group); 32 | } 33 | 34 | @Override 35 | public Group getGroupByGroupId(Integer id) { 36 | return groupMapper.getGroupByGroupId(id); 37 | } 38 | 39 | @Override 40 | public int updateGroup(Group group) { 41 | return groupMapper.updateGroup(group); 42 | } 43 | 44 | @Override 45 | public int deleteGroupById(Integer id) { 46 | return groupMapper.deleteGroupById(id); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/impl/ProductServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service.impl; 2 | 3 | import com.wxl.sms.bean.Product; 4 | import com.wxl.sms.bean.to.Check; 5 | import com.wxl.sms.dao.ProductMapper; 6 | import com.wxl.sms.service.ProductService; 7 | import org.springframework.stereotype.Service; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.List; 11 | 12 | /** 13 | * @author wxl on 2021/4/24 23:37 14 | */ 15 | @Service 16 | public class ProductServiceImpl implements ProductService { 17 | @Resource 18 | private ProductMapper productMapper; 19 | 20 | @Override 21 | public List getAllProducts() { 22 | return productMapper.getAllProducts(); 23 | } 24 | 25 | @Override 26 | public Product getProductByProductName(String productName) { 27 | return productMapper.getProductByProductName(productName); 28 | } 29 | 30 | @Override 31 | public int addProduct(Product product) { 32 | return productMapper.addProduct(product); 33 | } 34 | 35 | @Override 36 | public float getProductSalePriceByProductId(Integer id) { 37 | return productMapper.getProductSalePriceByProductId(id); 38 | } 39 | 40 | @Override 41 | public Check getProductByProductIdToCheckService(Integer productId) { 42 | Product product = productMapper.getProductByProductIdForCheckService(productId); 43 | Check check = new Check(); 44 | check.setProductId(product.getId()); 45 | check.setProductName(product.getProductName()); 46 | // check.setCheckPrice(product.getSalePrice()); 47 | check.setProductSalePrice(product.getSalePrice()); 48 | 49 | return check; 50 | } 51 | 52 | @Override 53 | public int deleteProductByProductId(Integer productId) { 54 | return productMapper.deleteProductByProductId(productId); 55 | } 56 | 57 | @Override 58 | public int updateProductByProductId(Product product) { 59 | return productMapper.updateProductByProductId(product); 60 | } 61 | 62 | @Override 63 | public Product getProductByProductId(Integer productId) { 64 | return productMapper.getProductByProductId(productId); 65 | } 66 | 67 | @Override 68 | public List getProductByProductNameOrProductGroup(String productName, Integer groupId) { 69 | return productMapper.getProductByProductNameOrProductGroup(productName, groupId); 70 | } 71 | 72 | @Override 73 | @Deprecated 74 | public int updateProductStock(Integer productId, Integer saleCount) { 75 | return productMapper.updateProductStock(productId, saleCount); 76 | } 77 | 78 | @Override 79 | public int updateProductStockPlus(Integer productId, Integer saleCount, Integer stock) { 80 | return productMapper.updateProductStockPlus(productId, saleCount, stock); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/impl/ProviderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service.impl; 2 | 3 | import com.wxl.sms.bean.Product; 4 | import com.wxl.sms.bean.Provider; 5 | import com.wxl.sms.dao.ProviderMapper; 6 | import com.wxl.sms.service.ProviderService; 7 | import org.springframework.stereotype.Service; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.List; 11 | 12 | /** 13 | * @author wxl on 2021/4/29 0:27 14 | */ 15 | @Service 16 | public class ProviderServiceImpl implements ProviderService { 17 | @Resource 18 | private ProviderMapper providerMapper; 19 | 20 | @Override 21 | public List getAllProviders() { 22 | return providerMapper.getAllProviders(); 23 | } 24 | 25 | @Override 26 | public List getProviderRecordsByProviderId(Integer providerId) { 27 | return providerMapper.getProviderRecordsByProviderId(providerId); 28 | } 29 | 30 | @Override 31 | public Provider getProviderByProviderId(Integer providerId) { 32 | return providerMapper.getProviderByProviderId(providerId); 33 | } 34 | 35 | @Override 36 | public List getProviderByProviderPhoneNumber(String phoneNumber) { 37 | return providerMapper.getProviderByProviderPhoneNumber(phoneNumber); 38 | } 39 | 40 | @Override 41 | public int deleteProviderByProviderId(Integer providerId) { 42 | return providerMapper.deleteProviderByProviderId(providerId); 43 | } 44 | 45 | @Override 46 | public int addProvider(Provider provider) { 47 | return providerMapper.addProvider(provider); 48 | } 49 | 50 | @Override 51 | public int updateProvider(Provider provider) { 52 | return providerMapper.updateProvider(provider); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/impl/SaleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service.impl; 2 | 3 | import com.wxl.sms.bean.Product; 4 | import com.wxl.sms.bean.to.Sale; 5 | import com.wxl.sms.dao.ProductMapper; 6 | import com.wxl.sms.dao.SaleMapper; 7 | import com.wxl.sms.service.SaleService; 8 | import org.springframework.stereotype.Service; 9 | 10 | import javax.annotation.Resource; 11 | import java.util.List; 12 | 13 | /** 14 | * @author wxl on 2021/5/2 1:22 15 | */ 16 | @Service 17 | public class SaleServiceImpl implements SaleService { 18 | @Resource 19 | private SaleMapper saleMapper; 20 | @Resource 21 | private ProductMapper productMapper; 22 | 23 | @Override 24 | public int insertSaleItem(Integer productId, Integer saleCount) { 25 | Product product = productMapper.getProductByProductId(productId); 26 | 27 | String productName = product.getProductName(); 28 | Integer groupId = product.getGroupId(); 29 | float purchasePrice = product.getPurchasePrice(); 30 | float salePrice = product.getSalePrice(); 31 | // saleVolume - 销售额 32 | float saleVolume = saleCount * purchasePrice; 33 | // netProfit - 净利润 34 | float netProfit = (salePrice - purchasePrice) * saleCount; 35 | 36 | return saleMapper.insertSaleItemFinal(productId, productName, groupId, purchasePrice, salePrice, 37 | saleCount, saleVolume, netProfit); 38 | } 39 | 40 | @Override 41 | public List getSaleInfoByCondition(Integer groupId, String startDate, String endDate) { 42 | return saleMapper.getSaleInfoByCondition(groupId, startDate, endDate); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.service.impl; 2 | 3 | import com.wxl.sms.bean.User; 4 | import com.wxl.sms.dao.UserMapper; 5 | import com.wxl.sms.service.UserService; 6 | import org.springframework.stereotype.Service; 7 | 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | /** 12 | * @author wxl on 2021/5/8 22:23 13 | */ 14 | @Service 15 | public class UserServiceImpl implements UserService { 16 | @Resource 17 | private UserMapper userMapper; 18 | 19 | @Override 20 | public User getUserByUsername(String username) { 21 | return userMapper.getUserByUsername(username); 22 | } 23 | 24 | @Override 25 | public List getAllUser() { 26 | return userMapper.getAllUser(); 27 | } 28 | 29 | @Override 30 | public int addUser(User user) { 31 | return userMapper.addUser(user); 32 | } 33 | 34 | @Override 35 | public int resetAllPassword() { 36 | return userMapper.resetAllPassword(); 37 | } 38 | 39 | @Override 40 | public int resetPasswordByUserId(Integer id) { 41 | return userMapper.resetPasswordByUserId(id); 42 | } 43 | 44 | @Override 45 | public int deleteUserByUserId(Integer id) { 46 | return userMapper.deleteUserByUserId(id); 47 | } 48 | 49 | @Override 50 | public int updatePassword(Integer id, String password) { 51 | return userMapper.updatePassword(id, password); 52 | } 53 | 54 | @Override 55 | public List getAllAdmin() { 56 | return userMapper.getAllAdmin(); 57 | } 58 | 59 | @Override 60 | public User getUserByUserId(Integer id) { 61 | return userMapper.getUserByUserId(id); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/test/MapperTest.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.test; 2 | 3 | import com.wxl.sms.bean.Product; 4 | import com.wxl.sms.dao.ProductMapper; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.test.context.ContextConfiguration; 9 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * @author wxl on 2021/4/24 22:29 15 | */ 16 | @RunWith(SpringJUnit4ClassRunner.class) 17 | @ContextConfiguration(locations = {"classpath:applicationContext.xml"}) 18 | public class MapperTest { 19 | @Autowired 20 | private ProductMapper productMapper; 21 | 22 | @Test 23 | public void testProductMapper() { 24 | System.out.println("xxx"); 25 | System.out.println(productMapper); 26 | 27 | List products = productMapper.getAllProducts(); 28 | for (Product product : products) { 29 | System.out.println(product); 30 | } 31 | 32 | System.out.println("Auto Compile... ..."); 33 | System.out.println("Auto Compile... ...Success"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/wxl/sms/util/LoginFilter.java: -------------------------------------------------------------------------------- 1 | package com.wxl.sms.util; 2 | 3 | import javax.servlet.Filter; 4 | import javax.servlet.FilterChain; 5 | import javax.servlet.FilterConfig; 6 | import javax.servlet.ServletException; 7 | import javax.servlet.ServletRequest; 8 | import javax.servlet.ServletResponse; 9 | import javax.servlet.annotation.WebFilter; 10 | import javax.servlet.http.HttpServletRequest; 11 | import java.io.IOException; 12 | 13 | /** 14 | * 完成登录验证的过滤器 15 | * 16 | * @author wxl on 2021/5/8 23:21 17 | */ 18 | //@Component 19 | @WebFilter("/*") 20 | public class LoginFilter implements Filter { 21 | 22 | @Override 23 | public void init(FilterConfig filterConfig) { 24 | 25 | } 26 | 27 | @Override 28 | public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { 29 | HttpServletRequest request = (HttpServletRequest) req; 30 | 31 | // 1.获取资源请求路径 32 | String requestURI = request.getRequestURI(); 33 | // 2.判断是否包含登录相关资源路径 34 | if (requestURI.contains("/login") || requestURI.contains("login.jsp")) { 35 | // 证明用户就是想要登录 36 | chain.doFilter(request, res); 37 | } else { 38 | // 需要验证用户是否登录 -> 从session中获取User 39 | Object user = request.getSession().getAttribute("user"); 40 | if (user != null) { 41 | chain.doFilter(request, res); 42 | } else { 43 | // 没有登录, 跳转登录页面 44 | request.setAttribute("LOGIN_MSG", "您尚未登录, 请登录"); 45 | request.getRequestDispatcher("/login.jsp").forward(request, res); 46 | } 47 | } 48 | } 49 | 50 | @Override 51 | public void destroy() { 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/resources/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 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 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/main/resources/jdbc.properties: -------------------------------------------------------------------------------- 1 | jdbc.jdbcUrl=jdbc:mysql://localhost:3306/sms2021 2 | jdbc.driverClass=com.mysql.jdbc.Driver 3 | jdbc.username=root 4 | jdbc.passwd=wxl1919@mysql 5 | -------------------------------------------------------------------------------- /src/main/resources/mapper/GroupMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 40 | 41 | insert into tb_group(group_name) 42 | values (#{groupName}) 43 | 44 | 45 | 46 | 47 | update tb_group 48 | set group_name = #{groupName} 49 | where id = #{id} 50 | 51 | 52 | 53 | 54 | delete 55 | from tb_group 56 | where id = #{id} 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ProductMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | p.id, 8 | p.group_id, 9 | p.product_name, 10 | p.yield_date, 11 | p.product_factory, 12 | p.purchase_price, 13 | p.sale_price, 14 | p.stock, 15 | p.sale_count, 16 | p.create_date, 17 | g.id gId, 18 | g.group_name groupName 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 45 | 53 | 54 | 55 | 63 | 64 | 67 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 86 | 87 | 88 | 89 | 92 | 93 | insert into tb_product(product_name, group_id, provider_id, yield_date, 94 | product_factory, purchase_price, sale_price, 95 | stock) 96 | values (#{productName}, #{groupId}, #{providerId}, 97 | #{yieldDate}, #{productFactory}, 98 | #{purchasePrice}, #{salePrice}, #{stock}) 99 | 100 | 101 | 102 | 107 | 108 | 109 | 114 | 115 | 116 | 117 | 118 | delete 119 | from tb_product 120 | where id = #{productId} 121 | 122 | 123 | 124 | 125 | update tb_product 126 | set product_name=#{productName}, 127 | group_id=#{groupId}, 128 | yield_date=#{yieldDate}, 129 | product_factory=#{productFactory}, 130 | purchase_price=#{purchasePrice}, 131 | sale_price=#{salePrice}, 132 | stock=#{stock} 133 | where id = #{id} 134 | 135 | 136 | 137 | 145 | 146 | 147 | 148 | 164 | 165 | 166 | 167 | 168 | UPDATE tb_product 169 | SET sale_count=sale_count + #{saleCount} and 170 | stock=stock-#{saleCount} 171 | WHERE id = #{productId} 172 | 173 | 174 | 175 | 176 | 177 | update tb_product 178 | set sale_count = #{saleCount}, 179 | stock = #{stock} 180 | where id = #{productId} 181 | 182 | 183 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ProviderMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | p.id, 8 | p.group_id, 9 | p.product_name, 10 | p.yield_date, 11 | p.product_factory, 12 | p.purchase_price, 13 | p.sale_price, 14 | p.stock, 15 | p.sale_count, 16 | p.create_date, 17 | g.id gId, 18 | g.group_name groupName 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 44 | 45 | 46 | 55 | 56 | 57 | 62 | 63 | 64 | 69 | 70 | 71 | 72 | delete 73 | from tb_provider 74 | where id = #{providerId} 75 | 76 | 77 | 78 | 79 | insert into tb_provider(provider_name, provider_contact, contact_phone, 80 | provider_address) 81 | values (#{providerName}, #{providerContact}, 82 | #{contactPhone}, #{providerAddress}) 83 | 84 | 85 | 86 | 87 | update tb_provider 88 | set provider_name=#{providerName}, 89 | provider_contact=#{providerContact}, 90 | contact_phone=#{contactPhone}, 91 | provider_address=#{providerAddress} 92 | where id = #{id} 93 | 94 | -------------------------------------------------------------------------------- /src/main/resources/mapper/SaleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | INSERT INTO tb_sale(product_id, product_name, group_id, 9 | purchase_price, sale_price, sale_count, sale_volume, net_profit) 10 | VALUES (#{productId}, #{productName}, #{groupId}, #{purchasePrice}, 11 | #{salePrice}, #{saleCount}, #{saleVolume}, #{netProfit}) 12 | 13 | 14 | 21 | 22 | 23 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | insert into tb_user(username, password, role) 22 | values (#{username}, #{password}, #{role}) 23 | 24 | 25 | 26 | 27 | update tb_user 28 | set password = '123456'; 29 | 30 | 31 | 32 | 33 | update tb_user 34 | set password = '123456' 35 | where id = #{id} 36 | 37 | 38 | 39 | 40 | delete 41 | from tb_user 42 | where id = #{id} 43 | 44 | 45 | 46 | 47 | update tb_user 48 | set password = #{password} 49 | where id = #{id} 50 | 51 | 52 | 53 | 58 | 59 | 60 | 65 | -------------------------------------------------------------------------------- /src/main/resources/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/springmvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | login.jsp 9 | index.jsp 10 | 11 | 12 | 13 | 14 | contextConfigLocation 15 | classpath:applicationContext.xml 16 | 17 | 18 | org.springframework.web.context.ContextLoaderListener 19 | 20 | 21 | 22 | 23 | dispatcherServlet 24 | org.springframework.web.servlet.DispatcherServlet 25 | 26 | contextConfigLocation 27 | classpath:springmvc.xml 28 | 29 | 1 30 | 31 | 32 | 33 | dispatcherServlet 34 | / 35 | 36 | 37 | 38 | 39 | 40 | 41 | characterEncodingFilter 42 | org.springframework.web.filter.CharacterEncodingFilter 43 | 44 | 45 | encoding 46 | UTF-8 47 | 48 | 49 | 50 | forceRequestEncoding 51 | true 52 | 53 | 54 | 55 | forceResponseEncoding 56 | true 57 | 58 | 59 | 60 | 61 | characterEncodingFilter 62 | 63 | /* 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/main/webapp/aust.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyback2u/sms/dd4fbeefc0f9b601b230dda74a35b7362925e466/src/main/webapp/aust.png -------------------------------------------------------------------------------- /src/main/webapp/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyback2u/sms/dd4fbeefc0f9b601b230dda74a35b7362925e466/src/main/webapp/bg.jpg -------------------------------------------------------------------------------- /src/main/webapp/include/footer.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 16:01 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | 13 | <%----%> 14 | <%----%> -------------------------------------------------------------------------------- /src/main/webapp/include/header.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 15:38 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 9 | 10 | 11 | 基于Java的超市管理系统 12 | 13 | <%--引入BootStrap核心样式文件--%> 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/webapp/include/search.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 15:38 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <% 9 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 10 | %> 11 | 12 | 19 | 20 | 28 | 29 | 82 | 83 | 84 | 100 | -------------------------------------------------------------------------------- /src/main/webapp/login.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 16:48 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 9 | <% 10 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 11 | %> 12 | 13 | 14 | 系统登录页面 15 | <%--引入BootStrap核心样式文件--%> 16 | 17 | 18 | 19 | 20 | > 21 |
22 | <%-- border: solid 0px black;border-radius: 5px;box-shadow: 2px 2px 10px #909090; background-color: aliceblue;--%> 23 | <%-- background-size:100% 100%;position: absolute;top: 40px;right: 20px;--%> 24 |
25 |

系统登录

26 |
27 | 28 |
29 |
30 |
31 | 32 |
33 | 35 |
36 |
37 |
38 | 39 |
40 | 42 |
43 |
44 | <%--“记住我”功能暂未开发(2021年5月9日22:11:15)--%> 45 |
46 |
47 |
48 | 51 |
52 |
53 |
54 |
55 |
56 | 57 |
58 |
59 | 60 |
61 |
62 |
63 | 64 | 67 | 68 | 69 | 72 | 73 |
74 |
75 |
76 |
77 | 78 | 79 | -------------------------------------------------------------------------------- /src/main/webapp/page/group/group.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 16:16 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ include file="../../include/header.jsp" %> 9 | <%@ include file="../../include/search.jsp" %> 10 | <% 11 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 12 | %> 13 | 21 |
22 | <%--导航栏--%> 23 |
24 | 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 | 62 | 63 | 64 | 65 |
编号类别操作
${group.id}${group.groupName} 53 | 55 | 修改分类 56 | 57 | 59 | 删除分类 60 | 61 |
66 | <%--表格(结束)--%> 67 | 68 | <%--分页信息(开始)--%> 69 |
70 | <%--分页数据显示--%> 71 |
72 | 当前第 ${pageInfo.pageNum} 页, 总 ${pageInfo.pages} 页, 总 ${pageInfo.total} 条记录 73 |
74 | <%--分页条--%> 75 |
76 | 107 |
108 |
109 | <%--分页信息(结束)--%> 110 |
111 |
112 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/group/groupAdd.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" %> 2 | <%@ include file="../../include/header.jsp" %> 3 | <%@ include file="../../include/search.jsp" %> 4 | <% 5 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 6 | %> 7 | 8 |
9 | <%--导航栏--%> 10 |
11 | 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 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/group/groupUpdate.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/5/1 5 | Time: 23:09 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ include file="../../include/header.jsp" %> 9 | <%@ include file="../../include/search.jsp" %> 10 | <% 11 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 12 | %> 13 | 14 |
15 | <%--导航栏--%> 16 |
17 | 22 |
23 | 24 | <%--中间部门内容--%> 25 |
26 | <%--h3标题--%> 27 |
28 |

修改分类详情页

29 |
30 | 31 | <%--修改商品分类表单--%> 32 |
33 | <%--类别id--%> 34 |
35 | 36 |
37 | 39 |
40 |
41 | <%--商品类别--%> 42 |
43 | 44 |
45 | 47 |
48 |
49 | 50 |
51 |
52 | 53 |
54 |
55 | 56 |
57 |
58 |
59 |
60 |
61 | 62 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/other/checkout.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 16:20 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ include file="../../include/header.jsp" %> 9 | <%@ include file="../../include/search.jsp" %> 10 | <% 11 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 12 | %> 13 | 14 |
15 | <%--路径导航--%> 16 |
17 | 21 |

收银台服务

22 |
23 | 24 | <%--已购商品输入框--%> 25 |
26 |
27 |
28 | 29 | 30 |
31 |   32 |
33 | 34 | 35 |
36 |     37 | 40 |
41 |
42 |
43 | 44 | <%--商品详细结算信息--%> 45 |
46 |

详细信息如下:

47 | 48 |
49 |

50 | 商品名称:${checkObj.productName}     51 | 销售单价:${checkObj.productSalePrice}     52 | 购买数量:${checkObj.productNumber} 53 |

54 |

55 | 应付金额:${checkObj.checkPrice}     56 | 实收金额: 57 | 58 | 59 | 61 |
62 |

找零:xxx 元

63 | 64 |
65 |
66 |
67 |
68 | 69 | 76 | 77 | <%@ include file="../../include/footer.jsp" %> 78 | -------------------------------------------------------------------------------- /src/main/webapp/page/other/main.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 16:19 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ include file="../../include/header.jsp" %> 9 | <%@ include file="../../include/search.jsp" %> 10 | <% 11 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 12 | %> 13 |
14 |

欢迎进入安徽理工大学校内超市管理系统

15 |
16 |
    17 |
  • 感谢周华平教授的指导与支持!
  • 18 |
  • 系统:基于Java的超市管理系统
  • 19 |
  • 本系统为@2021年安徽理工大学毕业设计项目
  • 20 |
  • 系统后端基于Spring、SpringMVC、MyBatis、PageHelper构建开发
  • 21 |
  • 系统前端采用BootStrap框架进行快速开发
  • 22 |
  • 系统设计模式:MVC设计模式
  • 23 |
24 |
25 | <%@ include file="../../include/footer.jsp" %> 26 | -------------------------------------------------------------------------------- /src/main/webapp/page/product/product.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 15:42 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ include file="../../include/header.jsp" %> 9 | <%@ include file="../../include/search.jsp" %> 10 | <% 11 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 12 | %> 13 | 14 | 22 | 23 | <%--中间内容部分--%> 24 |
25 | <%--路径导航与搜索框--%> 26 |
27 | <%--路径导航--%> 28 | 32 | <%--表单搜索框--%> 33 | <%--这里我理解错的地方, 并不是说两个表单输入, 根据是否有值来提交到不同的Controller, 这里是一个整体 34 | 获取所有表单上的值去查询, 是一个sql语句去处理的... ...(模糊查询) 35 | --%> 36 |
37 |
38 | 39 | 40 |
41 |     42 |
43 | 44 | 52 |
53 |     54 | 57 |     58 | 59 |  新增商品 60 | 61 |
62 |
63 | 64 | <%--商品库存信息表格--%> 65 |
66 | 67 | <%--表格样式: 基础表格、带边框、悬浮隔行变色--%> 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | <%--这两处操作的难点就是, 如何将选中的条目的obj对象的id获得并传出去以便按照id删除--%> 98 | 108 | 109 | 110 | 111 |
编号名称分类厂家生产日期进货日期进价售价售出数库存数操作
${product.id}${product.productName}${product.group.groupName}${product.productFactory}${product.yieldDate}${product.createDate}${product.purchasePrice}${product.salePrice}${product.saleCount}${product.stock} 99 | 101 | 修改 102 | 103 | 105 | 删除 106 | 107 |
112 | 113 | <%--分页信息--%> 114 |
115 | <%--分页数据显示--%> 116 |
117 | 当前第 ${pageInfo.pageNum} 页, 总 ${pageInfo.pages} 页, 总 ${pageInfo.total} 条记录 118 |
119 | <%--分页条--%> 120 |
121 | 154 |
155 |
156 | 157 |
158 |
159 | 160 | <%@ include file="../../include/footer.jsp" %> 161 | -------------------------------------------------------------------------------- /src/main/webapp/page/product/productAdd.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" %> 2 | <%@ include file="../../include/header.jsp" %> 3 | <%@ include file="../../include/search.jsp" %> 4 | <% 5 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 6 | %> 7 | 8 |
9 | 10 | <%--中间部门内容--%> 11 |
12 | <%--表单内容太多, 标题就不写了--%> 13 | <%--
--%> 14 | <%--

添加商品详情页

--%> 15 | <%--
--%> 16 | 17 |
18 | <%--商品名称--%> 19 |
20 | 21 |
22 | 23 |
24 |
25 | 26 | <%--商品类别 v2--%> 27 |
28 | 29 |
30 | 37 |
38 |
39 | 40 | <%--供货商--%> 41 |
42 | 43 |
44 | 51 |
52 |
53 | 54 | <%--生产日期--%> 55 |
56 | 57 |
58 | 59 |
60 |
61 | 62 | <%--生产厂家--%> 63 |
64 | 65 |
66 | 68 |
69 |
70 | 71 | <%--进价--%> 72 |
73 | 74 |
75 | 77 |
78 |
79 | 80 | <%--库存--%> 81 |
82 | 83 |
84 | 85 |
86 |
87 | 88 | <%--售价--%> 89 |
90 | 91 |
92 | 93 |
94 |
95 | 96 |
97 |
98 | 99 |
100 |
101 | 102 |
103 |
104 |
105 |
106 |
107 | 108 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/product/productUpdate.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" %> 2 | <%@ include file="../../include/header.jsp" %> 3 | <%@ include file="../../include/search.jsp" %> 4 | <% 5 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 6 | %> 7 | 8 |
9 | 10 | <%--中间部门内容--%> 11 |
12 | <%--
--%> 13 | <%--

添加、修改商品详情页

--%> 14 | <%--
--%> 15 | 16 |
17 | <%--商品id--%> 18 | <%--如果想要属性不被修改, 这里要设置readonly, disable会导致不可读, 读不到数据后端根据id更新个锤子--%> 19 |
20 | 21 |
22 | 25 |
26 |
27 | 28 | <%--商品名称--%> 29 |
30 | 31 |
32 | 35 |
36 |
37 | <%--商品类别--%> 38 |
39 | 40 |
41 | 50 |
51 |
52 | 53 | <%--生产日期--%> 54 |
55 | 56 |
57 | 60 |
61 |
62 | 63 | <%--生产厂家--%> 64 |
65 | 66 |
67 | 70 |
71 |
72 | 73 | <%--进价--%> 74 |
75 | 76 |
77 | 80 |
81 |
82 | 83 | <%--库存--%> 84 |
85 | 86 |
87 | 90 |
91 |
92 | 93 | <%--售价--%> 94 |
95 | 96 |
97 | 100 |
101 |
102 | 103 |
104 |
105 | 106 |
107 |
108 | 109 |
110 |
111 |
112 |
113 |
114 | 115 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/product/searchProduct.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/30 5 | Time: 2:13 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ include file="../../include/header.jsp" %> 9 | <%@ include file="../../include/search.jsp" %> 10 | <% 11 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 12 | %> 13 | 14 | 26 | 27 | <%--中间内容部分--%> 28 |
29 | <%--路径导航与搜索框--%> 30 |
31 | <%--路径导航--%> 32 | 37 | <%--表单搜索框--%> 38 | <%--这里我理解错的地方, 并不是说两个表单输入, 根据是否有值来提交到不同的Controller, 这里是一个整体 39 | 获取所有表单上的值去查询, 是一个sql语句去处理的... ... 40 | --%> 41 |
42 |
43 | 44 | 45 |
46 |     47 |
48 | 49 | 57 |
58 |     59 | 62 |     63 | 64 |  新增商品 65 | 66 |
67 |
68 | 69 | <%--商品库存信息表格--%> 70 |
71 | 72 | <%--表格样式: 基础表格、带边框、悬浮隔行变色--%> 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | <%--这两处操作的难点就是, 如何将选中的条目的obj对象的id获得并传出去以便按照id删除--%> 103 | 113 | 114 | 115 | 116 |
编号名称分类厂家生产日期进货日期进价售价售出数库存数操作
${product.id}${product.productName}${product.group.groupName}${product.productFactory}${product.yieldDate}${product.createDate}${product.purchasePrice}${product.salePrice}${product.saleCount}${product.stock} 104 | 106 | 修改 107 | 108 | 110 | 删除 111 | 112 |
117 | 118 | <%--分页信息--%> 119 |
120 | <%--分页数据显示--%> 121 |
122 | 当前第 ${pageInfo.pageNum} 页, 总 ${pageInfo.pages} 页, 总 ${pageInfo.total} 条记录 123 |
124 | <%--分页条--%> 125 | <%--原因: 点击分页, 如第二页, 未能把表单数据提交上去--%> 126 |
127 | 161 |
162 |
163 |
164 |
165 | 166 | <%@ include file="../../include/footer.jsp" %> 167 | -------------------------------------------------------------------------------- /src/main/webapp/page/provider/provider.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 17:17 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ include file="../../include/header.jsp" %> 9 | <%@ include file="../../include/search.jsp" %> 10 | <% 11 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 12 | %> 13 | 14 | 28 | 29 |
30 | <%--路径导航与搜索框--%> 31 |
32 | <%--路径导航--%> 33 | 37 | 38 | <%--搜索框--%> 39 |
40 |
41 | 42 | 44 |
45 |     46 | 49 |     50 | 51 |  新增供应商 52 | 53 |
54 |
55 | 56 | <%--商品库存信息表格--%> 57 |
58 | <%--表格样式: 基础表格、带边框、悬浮隔行变色--%> 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | <%--这两处操作的难点就是, 如何将选中的条目的obj对象的id获得并传出去以便按照id删除--%> 79 | 93 | 94 | 95 | 96 |
供应商编码供应商名称供应商联系人供应商联系电话供应商地址操作
${provider.id}${provider.providerName}${provider.providerContact}${provider.contactPhone}${provider.providerAddress} 80 | 82 | 供货信息 83 | 84 | 86 | 修改 87 | 88 | 90 | 删除 91 | 92 |
97 | 98 | <%--分页信息--%> 99 |
100 | <%--分页数据显示--%> 101 |
102 | 当前第 ${pageInfo.pageNum} 页, 总 ${pageInfo.pages} 页, 总 ${pageInfo.total} 条记录 103 |
104 | <%--分页条--%> 105 |
106 | 144 |
145 |
146 |
147 |
148 | 149 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/provider/providerAdd.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/5/3 5 | Time: 22:47 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ include file="../../include/header.jsp" %> 9 | <%@ include file="../../include/search.jsp" %> 10 | <% 11 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 12 | %> 13 | 14 |
15 |
16 | <%--路径导航--%> 17 | 22 |
23 | 24 | <%--中间部门内容--%> 25 |
26 |
27 |

添加供货商详情页

28 |
29 | 30 | <%--添加供货商表单填写--%> 31 |
32 | <%--供货商名称--%> 33 |
34 | 35 |
36 | 38 |
39 |
40 | 41 | <%--供货商联系人--%> 42 |
43 | 44 |
45 | 47 |
48 |
49 | 50 | <%--供货商联系电话--%> 51 |
52 | 53 |
54 | 56 |
57 |
58 | 59 | <%--供货商地址--%> 60 |
61 | 62 |
63 | 65 |
66 |
67 | 68 |
69 |
70 | 71 |
72 |
73 | 74 |
75 |
76 |
77 |
78 |
79 | 80 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/provider/providerUpdate.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/5/3 5 | Time: 22:47 6 | --%> 7 | <%@ page contentType="text/html;charset=UTF-8" %> 8 | <%@ include file="../../include/header.jsp" %> 9 | <%@ include file="../../include/search.jsp" %> 10 | <% 11 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 12 | %> 13 | 14 | 19 | 20 |
21 |
22 | <%--路径导航--%> 23 | 28 |
29 | 30 | <%--中间部门内容--%> 31 |
32 |
33 |

修改供应商详情页

34 |
35 | 36 | <%--更新供应商信息(有信息回显)--%> 37 |
38 | <%--供应商id--%> 39 | <%--如果想要属性不被修改, 这里要设置readonly, disable会导致不可读, 读不到数据后端根据id更新个锤子--%> 40 |
41 | 42 |
43 | 46 |
47 |
48 | 49 | <%--供应商名称--%> 50 |
51 | 52 |
53 | 56 |
57 |
58 | 59 | <%--供货商联系人--%> 60 |
61 | 62 |
63 | 66 |
67 |
68 | 69 | <%--供货商联系电话--%> 70 |
71 | 72 |
73 | 76 |
77 |
78 | 79 | <%--供货商地址--%> 80 |
81 | 82 |
83 | 86 |
87 |
88 | 89 |
90 |
91 | 92 |
93 |
94 | 95 |
96 |
97 |
98 |
99 |
100 | 101 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/provider/records.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/5/3 5 | Time: 1:05 6 | Description: 供应商详情页面, 点击查看供应商, 显示出该供应商的供货销售情况页面 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" %> 9 | <%@ include file="../../include/header.jsp" %> 10 | <%@ include file="../../include/search.jsp" %> 11 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 12 | <% 13 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 14 | %> 15 | 16 | <%--中间内容部分--%> 17 |
18 | 19 | <%--路径导航--%> 20 |
21 | 26 |

供应商联系人:${provider.providerContact},供应商:${provider.providerName}

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 | 66 | 67 | 68 | 69 |
供应商名称商品名称分类进价售价售出数库存数总利润
${provider.providerName}${record.productName}${record.group.groupName}${record.purchasePrice}${record.salePrice}${record.saleCount}${record.stock} 57 | 58 | 0 59 | 60 | 61 | 64 | 65 |
70 | 71 | <%--分页信息--%> 72 |
73 | <%--分页数据显示--%> 74 |
75 | 当前第 ${pageInfo.pageNum} 页, 总 ${pageInfo.pages} 页, 总 ${pageInfo.total} 条记录 76 |
77 | <%--分页条--%> 78 |
79 | 117 |
118 |
119 | 120 |
121 | 122 |
123 | 124 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/sale/sale.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Wang XiaoLong 4 | Date: 2021/4/24 5 | Time: 16:36 6 | Description: 销售统计功能页面 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" %> 9 | <%@ include file="../../include/header.jsp" %> 10 | <%@ include file="../../include/search.jsp" %> 11 | <% 12 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 13 | %> 14 | 15 |
16 | 17 |
18 | 22 |
23 |
24 | 25 | 33 |
34 |     35 |
36 | 37 | 38 |
39 |     40 |
41 | 42 | 43 |
44 | 45 |     46 | 49 |
50 |
51 | 52 | 53 |
54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
商品编号商品名称所属分类进价售价销量净利润
${sale.productId}${sale.product.productName}${sale.product.group.groupName}${sale.product.purchasePrice}${sale.product.salePrice}${sale.saleCount}${sale.netProfit}
84 | 85 | <%--分页信息--%> 86 |
87 | <%--分页数据显示--%> 88 |
89 | 当前第 ${pageInfo.pageNum} 页, 总 ${pageInfo.pages} 页, 总 ${pageInfo.total} 条记录 90 |
91 | 92 | <%--分页条--%> 93 |
94 | 127 |
128 |
129 |
130 |
131 | 132 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/user/updatePassword.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Description: 更新当前登录用户的密码 3 | --%> 4 | <%@ page contentType="text/html;charset=UTF-8" %> 5 | <%@ include file="../../include/header.jsp" %> 6 | <%@ include file="../../include/search.jsp" %> 7 | <% 8 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 9 | %> 10 | 11 |
12 | <%--导航栏--%> 13 |
14 | 19 |
20 | 21 | <%--中间部门内容--%> 22 |
23 |
24 |

修改密码

25 |
26 | 27 |
28 |
29 | 30 |
31 | 34 |
35 |
36 | 37 |
38 | 39 |
40 | 43 |
44 |
45 | 46 |
47 | 48 |
49 | 51 |
52 |
53 | 54 |
55 |
56 | 57 |
58 |
59 | 60 |
61 |
62 |
63 |
64 |
65 | 66 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/user/user.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Description: 管理员身份下, 进行用户管理的页面 3 | --%> 4 | <%@ page contentType="text/html;charset=UTF-8" %> 5 | <%@ include file="../../include/header.jsp" %> 6 | <%@ include file="../../include/search.jsp" %> 7 | <% 8 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 9 | %> 10 | 33 | 34 | <%--中间内容部分--%> 35 |
36 | <%--路径导航与搜索框--%> 37 |
38 | <%--路径导航--%> 39 | 43 | 44 | 45 |  新增用户 46 | 47 | 48 |  重置所有密码 49 | 50 |
51 | 52 | <%--用户信息表格--%> 53 |
54 | <%--表格样式: 基础表格、带边框、悬浮隔行变色--%> 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 82 | 83 | 84 | 85 |
用户编号账号密码角色操作
${user.id}${user.username}${user.password}${user.role == "admin"? "管理员":"普通用户"} 73 | 75 | 重置密码 76 | 77 | 79 | 注销用户 80 | 81 |
86 | 87 | <%--分页信息--%> 88 |
89 | <%--分页数据显示--%> 90 |
91 | 当前第 ${pageInfo.pageNum} 页, 总 ${pageInfo.pages} 页, 总 ${pageInfo.total} 条记录 92 |
93 | <%--分页条--%> 94 |
95 | 128 |
129 |
130 |
131 |
132 | 133 | <%@ include file="../../include/footer.jsp" %> -------------------------------------------------------------------------------- /src/main/webapp/page/user/userAdd.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" %> 2 | <%@ include file="../../include/header.jsp" %> 3 | <%@ include file="../../include/search.jsp" %> 4 | <% 5 | pageContext.setAttribute("APP_PATH", request.getContextPath()); 6 | %> 7 | 8 |
9 | <%--导航栏--%> 10 |
11 | 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 | 47 |
48 |
49 | 50 |
51 |
52 | 53 |
54 |
55 | 56 |
57 |
58 |
59 |
60 |
61 | 62 | <%@ include file="../../include/footer.jsp" %> --------------------------------------------------------------------------------