├── HELP.md ├── README.md ├── pom.xml ├── sims.iml ├── sims.sql └── src ├── main ├── java │ └── com │ │ └── bo │ │ └── sims │ │ ├── SimsApplication.java │ │ ├── configuration │ │ └── AdminWebConfig.java │ │ ├── controller │ │ ├── AccountsController.java │ │ ├── BillController.java │ │ ├── GoodsController.java │ │ ├── LoginController.java │ │ └── SupplierController.java │ │ ├── dao │ │ ├── BillMapper.java │ │ ├── GoodsMapper.java │ │ ├── SalesMapper.java │ │ ├── SupplierMapper.java │ │ └── UserMapper.java │ │ ├── interceptor │ │ └── loginInterceptor.java │ │ ├── pojo │ │ ├── Bill.java │ │ ├── Goods.java │ │ ├── Sales.java │ │ ├── Supplier.java │ │ └── User.java │ │ ├── service │ │ ├── BillService.java │ │ ├── GoodsService.java │ │ ├── SalesService.java │ │ ├── SupplierService.java │ │ ├── UserService.java │ │ └── impl │ │ │ ├── BillServiceImpl.java │ │ │ ├── GoodsServiceImpl.java │ │ │ ├── SalesServiceImpl.java │ │ │ ├── SupplierServiceImpl.java │ │ │ └── UserServiceImpl.java │ │ └── vo │ │ └── Settlement.java └── resources │ ├── application-dev.yaml │ ├── application-pro.yaml │ ├── application.yaml │ ├── mybatis │ └── mapper │ │ ├── BillMapper.xml │ │ ├── GoodsMapper.xml │ │ ├── SalesMapper.xml │ │ ├── SupplierMapper.xml │ │ └── UserMapper.xml │ ├── static │ ├── css │ │ ├── animate.css │ │ ├── me.css │ │ └── typo.css │ ├── images │ │ ├── aboutMe.jpg │ │ ├── bg.png │ │ ├── wechat.jpg │ │ └── wechatPay.jpg │ └── lib │ │ ├── prism │ │ ├── prism.css │ │ └── prism.js │ │ ├── qrcode │ │ ├── qrcode.js │ │ └── qrcode.min.js │ │ ├── scrollTo │ │ ├── jquery.scrollTo.js │ │ └── jquery.scrollTo.min.js │ │ ├── tocbot │ │ ├── tocbot.css │ │ ├── tocbot.js │ │ └── tocbot.min.js │ │ └── waypoints │ │ ├── jquery.waypoints.js │ │ └── jquery.waypoints.min.js │ └── templates │ ├── admin │ ├── bill-details.html │ ├── bill-payment.html │ ├── daily-accounts.html │ ├── goods-input.html │ ├── goods.html │ ├── login.html │ ├── suppliers-input.html │ └── suppliers.html │ ├── common.html │ └── error │ ├── 404.html │ ├── 500.html │ └── error.html └── test └── java └── com └── bo └── sims ├── SimsApplicationTests.java └── test.java /HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.5.1/maven-plugin/reference/html/) 8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.5.1/maven-plugin/reference/html/#build-image) 9 | * [Spring Web](https://docs.spring.io/spring-boot/docs/2.5.1/reference/htmlsingle/#boot-features-developing-web-applications) 10 | * [Thymeleaf](https://docs.spring.io/spring-boot/docs/2.5.1/reference/htmlsingle/#boot-features-spring-mvc-template-engines) 11 | * [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.5.1/reference/htmlsingle/#using-boot-devtools) 12 | 13 | ### Guides 14 | The following guides illustrate how to use some features concretely: 15 | 16 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) 17 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) 18 | * [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) 19 | * [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/) 20 | * [Handling Form Submission](https://spring.io/guides/gs/handling-form-submission/) 21 | 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 超市进销存管理系统 2 | 超市进销存管理系统(SpringBoot+Mybatis) 3 | 4 | 博客地址:http://42.194.145.57:8081/ 5 | 6 | 管理员账户:admin 密码:123456 7 | 8 | ## 一、技术栈 9 | ### 1.前端 10 | JS框架:JQuery 11 | 12 | CSS框架:Semantic UI官网 13 | 14 | 15 | ### 2.后端 16 | 核心框架:SpringBoot 2.4.4 17 | 18 | 项目构建:jdk1.8、Maven 3 19 | 20 | 持久层框架:Mybatis 21 | 22 | 模板框架:Thymeleaf 23 | 24 | 分页插件:PageHelper 25 | 26 | 运行环境:腾讯云Centos7 27 | 28 | ### 3.数据库 29 | MySQL 5.7 30 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.5.1 9 | 10 | 11 | com.bo 12 | sims 13 | 0.0.1-SNAPSHOT 14 | 15 | war 16 | sims 17 | Demo project for Spring Boot 18 | 19 | 1.8 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-thymeleaf 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-web 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-devtools 41 | runtime 42 | true 43 | 44 | 45 | mysql 46 | mysql-connector-java 47 | 5.1.49 48 | runtime 49 | 50 | 51 | org.projectlombok 52 | lombok 53 | true 54 | 55 | 56 | org.springframework.boot 57 | spring-boot-starter-test 58 | test 59 | 60 | 61 | 62 | 63 | org.mybatis.spring.boot 64 | mybatis-spring-boot-starter 65 | 2.1.4 66 | 67 | 68 | 69 | com.alibaba 70 | druid-spring-boot-starter 71 | 1.1.17 72 | 73 | 74 | 75 | org.springframework.boot 76 | spring-boot-starter-aop 77 | 2.4.4 78 | 79 | 80 | 81 | 82 | com.github.pagehelper 83 | pagehelper-spring-boot-starter 84 | 1.2.12 85 | 86 | 87 | 88 | org.springframework.boot 89 | spring-boot-starter-validation 90 | 91 | 92 | 93 | 94 | javax.servlet 95 | javax.servlet-api 96 | provided 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | org.springframework.boot 108 | spring-boot-maven-plugin 109 | 110 | 111 | 112 | org.projectlombok 113 | lombok 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /sims.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 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 | 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 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /sims.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : localhos_3306 5 | Source Server Version : 50554 6 | Source Host : localhost:3306 7 | Source Database : sims 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50554 11 | File Encoding : 65001 12 | 13 | Date: 2021-06-21 23:29:27 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for t_bill 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `t_bill`; 22 | CREATE TABLE `t_bill` ( 23 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 24 | `need_payment` decimal(10,2) DEFAULT NULL, 25 | `real_payment` decimal(10,2) DEFAULT NULL, 26 | `create_time` datetime DEFAULT NULL, 27 | `profits` decimal(10,2) DEFAULT NULL, 28 | PRIMARY KEY (`id`) 29 | ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; 30 | 31 | -- ---------------------------- 32 | -- Records of t_bill 33 | -- ---------------------------- 34 | INSERT INTO `t_bill` VALUES ('12', '65.00', '100.00', '2021-06-19 22:21:31', '41.00'); 35 | INSERT INTO `t_bill` VALUES ('13', '125.00', '1000.00', '2021-06-19 22:21:46', '27.00'); 36 | INSERT INTO `t_bill` VALUES ('14', '295.00', '1000.00', '2021-06-18 22:22:08', '96.00'); 37 | INSERT INTO `t_bill` VALUES ('15', '555.00', '10000.00', '2021-06-20 22:22:30', '161.00'); 38 | INSERT INTO `t_bill` VALUES ('16', '100.00', '1000.00', '2021-06-20 22:22:45', '44.00'); 39 | INSERT INTO `t_bill` VALUES ('17', '65.00', '1000.00', '2021-06-21 10:22:55', '41.00'); 40 | INSERT INTO `t_bill` VALUES ('18', '490.00', '10000.00', '2021-06-18 23:23:53', '163.00'); 41 | INSERT INTO `t_bill` VALUES ('19', '41.50', '500.00', '2021-06-20 22:24:18', '7.10'); 42 | INSERT INTO `t_bill` VALUES ('20', '195.00', '150.00', '2021-06-21 18:25:53', '51.00'); 43 | 44 | -- ---------------------------- 45 | -- Table structure for t_goods 46 | -- ---------------------------- 47 | DROP TABLE IF EXISTS `t_goods`; 48 | CREATE TABLE `t_goods` ( 49 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 50 | `name` varchar(255) NOT NULL, 51 | `count` bigint(20) DEFAULT NULL, 52 | `prime_price` decimal(10,2) DEFAULT NULL, 53 | `sale_price` decimal(10,2) DEFAULT NULL, 54 | `type` varchar(255) DEFAULT NULL, 55 | `sid` bigint(20) DEFAULT NULL, 56 | PRIMARY KEY (`id`), 57 | UNIQUE KEY `name` (`name`), 58 | KEY `sid` (`sid`), 59 | CONSTRAINT `t_goods_ibfk_1` FOREIGN KEY (`sid`) REFERENCES `t_supplier` (`id`) 60 | ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; 61 | 62 | -- ---------------------------- 63 | -- Records of t_goods 64 | -- ---------------------------- 65 | INSERT INTO `t_goods` VALUES ('2', '辣条', '319', '3.60', '5.00', '零食', '7'); 66 | INSERT INTO `t_goods` VALUES ('3', '薯片', '420', '4.50', '6.50', '零食', '8'); 67 | INSERT INTO `t_goods` VALUES ('4', '冰红茶', '440', '3.40', '5.50', '饮料', '7'); 68 | INSERT INTO `t_goods` VALUES ('5', '面包', '20', '5.40', '6.00', '食物', '9'); 69 | INSERT INTO `t_goods` VALUES ('7', '牛奶', '729', '2.40', '6.50', '饮料', '9'); 70 | INSERT INTO `t_goods` VALUES ('8', '绿茶', '840', '2.20', '3.50', '饮料', '5'); 71 | INSERT INTO `t_goods` VALUES ('11', '饼干', '210', '2.20', '4.50', '零食', '16'); 72 | INSERT INTO `t_goods` VALUES ('12', '棒棒糖', '900', '1.20', '2.99', '零食', '15'); 73 | INSERT INTO `t_goods` VALUES ('16', '可乐', '630', '3.20', '4.50', '饮料', '15'); 74 | 75 | -- ---------------------------- 76 | -- Table structure for t_sales 77 | -- ---------------------------- 78 | DROP TABLE IF EXISTS `t_sales`; 79 | CREATE TABLE `t_sales` ( 80 | `gid` bigint(20) DEFAULT NULL, 81 | `bid` bigint(20) DEFAULT NULL, 82 | `sales_count` bigint(20) DEFAULT NULL, 83 | KEY `gid` (`gid`), 84 | KEY `bid` (`bid`), 85 | CONSTRAINT `t_sales_ibfk_1` FOREIGN KEY (`gid`) REFERENCES `t_goods` (`id`), 86 | CONSTRAINT `t_sales_ibfk_2` FOREIGN KEY (`bid`) REFERENCES `t_bill` (`id`) 87 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 88 | 89 | -- ---------------------------- 90 | -- Records of t_sales 91 | -- ---------------------------- 92 | INSERT INTO `t_sales` VALUES ('7', '12', '10'); 93 | INSERT INTO `t_sales` VALUES ('8', '13', '10'); 94 | INSERT INTO `t_sales` VALUES ('8', '13', '10'); 95 | INSERT INTO `t_sales` VALUES ('4', '13', '10'); 96 | INSERT INTO `t_sales` VALUES ('5', '14', '5'); 97 | INSERT INTO `t_sales` VALUES ('3', '14', '10'); 98 | INSERT INTO `t_sales` VALUES ('7', '14', '10'); 99 | INSERT INTO `t_sales` VALUES ('8', '14', '10'); 100 | INSERT INTO `t_sales` VALUES ('2', '14', '10'); 101 | INSERT INTO `t_sales` VALUES ('2', '15', '100'); 102 | INSERT INTO `t_sales` VALUES ('4', '15', '10'); 103 | INSERT INTO `t_sales` VALUES ('8', '16', '10'); 104 | INSERT INTO `t_sales` VALUES ('7', '16', '10'); 105 | INSERT INTO `t_sales` VALUES ('7', '17', '10'); 106 | INSERT INTO `t_sales` VALUES ('4', '18', '10'); 107 | INSERT INTO `t_sales` VALUES ('3', '18', '50'); 108 | INSERT INTO `t_sales` VALUES ('4', '18', '20'); 109 | INSERT INTO `t_sales` VALUES ('8', '19', '10'); 110 | INSERT INTO `t_sales` VALUES ('7', '19', '1'); 111 | INSERT INTO `t_sales` VALUES ('3', '20', '10'); 112 | INSERT INTO `t_sales` VALUES ('2', '20', '20'); 113 | INSERT INTO `t_sales` VALUES ('5', '20', '5'); 114 | 115 | -- ---------------------------- 116 | -- Table structure for t_supplier 117 | -- ---------------------------- 118 | DROP TABLE IF EXISTS `t_supplier`; 119 | CREATE TABLE `t_supplier` ( 120 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 121 | `name` varchar(255) NOT NULL, 122 | `address` varchar(255) DEFAULT NULL, 123 | `contact` bigint(11) DEFAULT NULL, 124 | PRIMARY KEY (`id`), 125 | UNIQUE KEY `name` (`name`), 126 | UNIQUE KEY `name_2` (`name`) 127 | ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; 128 | 129 | -- ---------------------------- 130 | -- Records of t_supplier 131 | -- ---------------------------- 132 | INSERT INTO `t_supplier` VALUES ('5', '1号有限公司', '广州', '17554413697'); 133 | INSERT INTO `t_supplier` VALUES ('6', '2号有限公司', '佛山', '19872581367'); 134 | INSERT INTO `t_supplier` VALUES ('7', '3号有限公司', '湛江', '14723658987'); 135 | INSERT INTO `t_supplier` VALUES ('8', '4号有限公司', '东莞', '12123132185'); 136 | INSERT INTO `t_supplier` VALUES ('9', '7号有限公司', '珠海', '11113432447'); 137 | INSERT INTO `t_supplier` VALUES ('10', '8号有限公司', '深圳', '11113432447'); 138 | INSERT INTO `t_supplier` VALUES ('11', '10号有限公司', '茂名', '14923658981'); 139 | INSERT INTO `t_supplier` VALUES ('12', '9号有限公司', '清远', '19633658981'); 140 | INSERT INTO `t_supplier` VALUES ('13', '5号有限公司', '肇庆', '18524658981'); 141 | INSERT INTO `t_supplier` VALUES ('14', '6号有限公司', '云浮', '14853658981'); 142 | INSERT INTO `t_supplier` VALUES ('15', '11号有限公司', '河源', '14785658981'); 143 | INSERT INTO `t_supplier` VALUES ('16', '12号有限公司', '阳江', '14796658981'); 144 | 145 | -- ---------------------------- 146 | -- Table structure for t_user 147 | -- ---------------------------- 148 | DROP TABLE IF EXISTS `t_user`; 149 | CREATE TABLE `t_user` ( 150 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 151 | `username` varchar(255) DEFAULT NULL, 152 | `password` varchar(255) DEFAULT NULL, 153 | PRIMARY KEY (`id`) 154 | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; 155 | 156 | -- ---------------------------- 157 | -- Records of t_user 158 | -- ---------------------------- 159 | INSERT INTO `t_user` VALUES ('1', 'admin', '123456'); 160 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/SimsApplication.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 7 | 8 | // 由于部署上服务器,继承SpringBootServletInitializer extends SpringBootServletInitializer 9 | @SpringBootApplication 10 | public class SimsApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(SimsApplication.class, args); 14 | } 15 | 16 | //重写此方法 17 | // @Override 18 | // protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { 19 | // 20 | // return super.configure(builder); 21 | // } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/configuration/AdminWebConfig.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.configuration; 2 | 3 | 4 | import com.bo.sims.interceptor.loginInterceptor; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 8 | 9 | /** 10 | * 1、编写一个拦截器实现HandlerInterceptor接口 11 | * 2、拦截器注册到容器中(实现WebMvcConfigurer的addInterceptors) 12 | * 3、指定拦截规则【如果是拦截所有,静态资源也会被拦截】 13 | * 14 | * @author Bo 15 | * @create 2021-06-18 13:22 16 | */ 17 | @Configuration 18 | public class AdminWebConfig implements WebMvcConfigurer { 19 | 20 | 21 | @Override 22 | public void addInterceptors(InterceptorRegistry registry) { 23 | registry.addInterceptor(new loginInterceptor()) 24 | .addPathPatterns("/admin/**") 25 | .excludePathPatterns("/admin", "/admin/login", "/css/**", "/images/**", "/js/**", "/lib/**"); 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/controller/AccountsController.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | 7 | /** 8 | * @author Bo 9 | * @create 2021-06-18 13:55 10 | */ 11 | @Controller 12 | @RequestMapping("/admin") 13 | public class AccountsController { 14 | 15 | @GetMapping("/accounts") 16 | public String accounts(){ 17 | return "admin/daily-accounts"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/controller/BillController.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.controller; 2 | 3 | 4 | import com.bo.sims.pojo.Bill; 5 | import com.bo.sims.pojo.Goods; 6 | import com.bo.sims.pojo.Sales; 7 | import com.bo.sims.service.BillService; 8 | import com.bo.sims.service.GoodsService; 9 | import com.bo.sims.service.SalesService; 10 | import com.bo.sims.vo.Settlement; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.ui.Model; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.PostMapping; 16 | import org.springframework.web.bind.annotation.RequestMapping; 17 | import org.springframework.web.bind.annotation.RequestParam; 18 | import org.springframework.web.servlet.mvc.support.RedirectAttributes; 19 | 20 | import javax.validation.Valid; 21 | import java.math.BigDecimal; 22 | import java.util.ArrayList; 23 | import java.util.Date; 24 | import java.util.List; 25 | 26 | /** 27 | * @author Bo 28 | * @create 2021-06-18 0:46 29 | */ 30 | @Controller 31 | @RequestMapping("/admin") 32 | public class BillController { 33 | 34 | @Autowired 35 | private GoodsService goodsService; 36 | 37 | @Autowired 38 | private BillService billService; 39 | 40 | @Autowired 41 | private SalesService salesService; 42 | 43 | 44 | /** 45 | * 去订单结算页面 46 | * 47 | * @param model 48 | * @return 49 | */ 50 | @GetMapping("/bill/payment") 51 | public String billPayment(Model model) { 52 | List goodsList = goodsService.getAllGoods(); 53 | model.addAttribute("goodsList", goodsList); 54 | return "admin/bill-payment"; 55 | } 56 | 57 | 58 | /** 59 | * 处理订单结算页面提交的数据,重定向到订单详情页面 60 | * 61 | * @param settlement 62 | * @param attributes 63 | * @return 64 | */ 65 | @PostMapping("/bill/settlement") 66 | public String billSettlement(@Valid Settlement settlement, 67 | RedirectAttributes attributes) { 68 | //将settlement对象转成Sales的集合(存放商品id和销售量) 69 | List salesList = new ArrayList<>(); 70 | if (settlement.getGoodId1() != null) { 71 | salesList.add(new Sales(settlement.getGoodId1(), settlement.getSalesCount1())); 72 | } 73 | if (settlement.getGoodId2() != null) { 74 | salesList.add(new Sales(settlement.getGoodId2(), settlement.getSalesCount2())); 75 | } 76 | if (settlement.getGoodId3() != null) { 77 | salesList.add(new Sales(settlement.getGoodId3(), settlement.getSalesCount3())); 78 | } 79 | if (settlement.getGoodId4() != null) { 80 | salesList.add(new Sales(settlement.getGoodId4(), settlement.getSalesCount4())); 81 | } 82 | if (settlement.getGoodId5() != null) { 83 | salesList.add(new Sales(settlement.getGoodId5(), settlement.getSalesCount5())); 84 | } 85 | //如果salesList集合为空则证明没有商品需要结算,结算失败 86 | if (salesList.size() == 0) { 87 | attributes.addFlashAttribute("message", "结算失败"); 88 | return "redirect:/admin/bill/payment"; 89 | } 90 | List salePriceList = goodsService.getSalePriceAndUpdateCount(salesList); 91 | if (salePriceList == null) { 92 | //结算失败,service层已经进行事务回滚 93 | attributes.addFlashAttribute("message", "结算失败"); 94 | return "redirect:/admin/bill/payment"; 95 | } 96 | //到这里证明结算成功,商品的库存量已更新,且更新后库存量大于或者等0 97 | 98 | //根据salePriceList集合中的每个商品销售价乘上它的销售量,得到i个商品总共的销售总额needPayment 99 | BigDecimal needPayment = new BigDecimal("0"); 100 | for (int i = 0; i < salePriceList.size(); i++) { 101 | needPayment = needPayment.add(salePriceList.get(i).multiply(new BigDecimal(salesList.get(i).getSalesCount() + ""))); 102 | } 103 | 104 | //根据salesList集合查询数据库,获得这些商品的总利润 105 | BigDecimal profits = goodsService.getProfitsByIdAndSalesCount(salesList); 106 | 107 | //创建订单类的对象,通过构造器给对象赋值,再保存到数据库中 108 | Bill bill = new Bill(null, needPayment, settlement.getRealPayment(), profits, new Date()); 109 | billService.saveBill(bill); 110 | 111 | //把salesList集合中的Sales对象的订单号(bid)设置为刚插入的订单号 112 | for (Sales sales : salesList) { 113 | sales.setBid(bill.getId()); 114 | } 115 | 116 | //保存i条销售记录到数据库 117 | salesService.saveSalesList(salesList); 118 | //重定向去订单详细页面 119 | return "redirect:/admin/bill/details?id=" + bill.getId(); 120 | } 121 | 122 | /** 123 | * 根据订单id跳转到该订单的详细信息页面 124 | * 可以处理订单结算页面提交过来的数据,也可以实现搜索栏输入订单号后进行搜索功能 125 | * 还可以处理点击订单结果的处理 126 | * 127 | * @param id 128 | * @param model 129 | * @return 130 | */ 131 | @GetMapping("/bill/details") 132 | public String billDetails(@RequestParam("id") Long id, 133 | RedirectAttributes attributes, 134 | Model model) { 135 | if (id == -1) { 136 | attributes.addFlashAttribute("message", "请先输入商品信息再结算"); 137 | return "redirect:/admin/bill/payment"; 138 | } 139 | if (salesService.getSalesBill(id).size() == 0) { 140 | attributes.addFlashAttribute("message", "查找失败,订单号不存在"); 141 | return "redirect:/admin/bill/payment"; 142 | } 143 | //根据订单号查询该订单的5条销售记录下的详细订单信息 144 | List billDetails = salesService.getSalesBill(id); 145 | //放在mode给前端页面显示 146 | model.addAttribute("billDetails", billDetails); 147 | model.addAttribute("billId", billDetails.get(0).getBid()); 148 | return "admin/bill-details"; 149 | } 150 | 151 | 152 | /** 153 | * 去账目日结页面 154 | * 155 | * @param model 156 | * @return 157 | */ 158 | @GetMapping("/dailyAccounts") 159 | public String dailyAccounts(Model model) { 160 | List profitsAndTime = billService.getProfitsAndTime(); 161 | model.addAttribute("profitsAndTimes", profitsAndTime); 162 | model.addAttribute("dayCount", profitsAndTime.size()); 163 | return "admin/daily-accounts"; 164 | } 165 | 166 | } 167 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/controller/GoodsController.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.controller; 2 | 3 | import com.bo.sims.pojo.Goods; 4 | import com.bo.sims.service.GoodsService; 5 | import com.bo.sims.service.SupplierService; 6 | import com.github.pagehelper.PageHelper; 7 | import com.github.pagehelper.PageInfo; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.ui.Model; 11 | import org.springframework.validation.BindingResult; 12 | import org.springframework.web.bind.annotation.*; 13 | import org.springframework.web.servlet.mvc.support.RedirectAttributes; 14 | 15 | import javax.validation.Valid; 16 | import java.util.List; 17 | 18 | /** 19 | * @author Bo 20 | * @create 2021-06-18 21:50 21 | */ 22 | @Controller 23 | @RequestMapping("/admin") 24 | public class GoodsController { 25 | 26 | 27 | @Autowired 28 | private GoodsService goodsService; 29 | 30 | @Autowired 31 | private SupplierService supplierService; 32 | 33 | /** 34 | * 商品信息展示 35 | * 36 | * @param pageNum 37 | * @param model 38 | * @return 39 | */ 40 | @GetMapping("/goods") 41 | public String goodsList(@RequestParam(defaultValue = "1", value = "pageNum") Integer pageNum, 42 | Model model) { 43 | String orderBy = "goodsId desc"; 44 | PageHelper.startPage(pageNum, 5, orderBy); 45 | List list = goodsService.getAllGoods(); 46 | PageInfo pageInfo = new PageInfo<>(list); 47 | model.addAttribute("pageInfo", pageInfo); 48 | return "admin/goods"; 49 | } 50 | 51 | 52 | /** 53 | * 跳转到商品新增页面 54 | * @return 55 | */ 56 | @GetMapping("/goods/input") 57 | public String input(Model model){ 58 | model.addAttribute("goods",new Goods()); 59 | model.addAttribute("suppliers",supplierService.getAllSupplier()); 60 | return "admin/goods-input"; 61 | } 62 | 63 | 64 | /** 65 | * 处理点击修改后跳转到商品新增页面,并把需要修改的商品对象放在model里传给页面回显 66 | * 67 | * @param id 68 | * @param model 69 | * @return 70 | */ 71 | @GetMapping("/goods/{id}/input") 72 | public String update(@PathVariable("id") Long id, 73 | @RequestParam(defaultValue = "1", value = "pageNum") Integer pageNum, 74 | Model model){ 75 | model.addAttribute("goods",goodsService.getOneGoodsById(id)); 76 | model.addAttribute("suppliers",supplierService.getAllSupplier()); 77 | model.addAttribute("pageNum",pageNum); 78 | return "admin/goods-input"; 79 | } 80 | 81 | 82 | /** 83 | * goods-input页面的提交功能(插入操作) 84 | * @param goods 85 | * @param result 86 | * @param attributes 87 | * @return 88 | */ 89 | @PostMapping("/goods") 90 | public String saveGoods(@Valid Goods goods, 91 | BindingResult result, 92 | RedirectAttributes attributes){ 93 | if (result.hasErrors()){ 94 | return "admin/goods-input"; 95 | } 96 | if (goodsService.getOneGoodsByName(goods.getName()) != null){ 97 | result.rejectValue("name","nameError","不能添加重复的商品"); 98 | return "admin/goods-input"; 99 | } 100 | if (goodsService.saveGoods(goods) == 0){ 101 | attributes.addFlashAttribute("message", "操作失败"); 102 | } else { 103 | attributes.addFlashAttribute("message", "操作成功"); 104 | } 105 | return "redirect:/admin/goods"; 106 | } 107 | 108 | 109 | /** 110 | * goods-input页面的提交功能(更新操作) 111 | * @param goods 112 | * @param id 113 | * @param pageNum 114 | * @param result 115 | * @param attributes 116 | * @return 117 | */ 118 | @PostMapping("/goods/{id}") 119 | public String updateSupplier(@Valid Goods goods, 120 | @PathVariable("id") Long id, 121 | @RequestParam("pageNum") Integer pageNum, 122 | BindingResult result, 123 | RedirectAttributes attributes) { 124 | if (result.hasErrors()) { 125 | return "admin/suppliers-input"; 126 | } 127 | goods.setId(id); 128 | if (goodsService.updateGoods(goods) == 0) { 129 | attributes.addFlashAttribute("message", "操作失败"); 130 | } else { 131 | attributes.addFlashAttribute("message", "操作成功"); 132 | } 133 | return "redirect:/admin/goods?pageNum=" + pageNum; 134 | } 135 | 136 | 137 | /** 138 | * 商品列表页面的删除功能 139 | * @param id 140 | * @param pageNum 141 | * @param attributes 142 | * @return 143 | */ 144 | @GetMapping("/goods/{id}/delete") 145 | public String deleteId(@PathVariable("id") Long id, 146 | @RequestParam("pageNum") Integer pageNum, 147 | RedirectAttributes attributes){ 148 | Goods goods = goodsService.getOneGoodsById(id); 149 | if (goods != null){ 150 | if( goodsService.deleteById(id) != 0){ 151 | attributes.addFlashAttribute("message","删除成功"); 152 | }else { 153 | //删除商品失败可能的销售表中存放该商品id作为外键 154 | attributes.addFlashAttribute("message","删除失败,该商品正在销售中"); 155 | } 156 | }else { 157 | attributes.addFlashAttribute("message","删除失败"); 158 | } 159 | return "redirect:/admin/goods?pageNum=" + pageNum; 160 | } 161 | 162 | /** 163 | * 商品页面搜索功能 164 | * @param goodsName 165 | * @param attributes 166 | * @param model 167 | * @return 168 | */ 169 | @GetMapping("/goods/search") 170 | public String search(@RequestParam("goodsName") String goodsName, 171 | RedirectAttributes attributes, 172 | Model model){ 173 | Goods goods = goodsService.getOneGoodsByName(goodsName); 174 | if (goods == null){ 175 | attributes.addFlashAttribute("message","查找失败"); 176 | return "redirect:/admin/goods"; 177 | }else { 178 | model.addAttribute("goods",goods); 179 | model.addAttribute("suppliers",supplierService.getAllSupplier()); 180 | return "admin/goods-input"; 181 | } 182 | } 183 | 184 | 185 | 186 | 187 | 188 | } 189 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.controller; 2 | 3 | import com.bo.sims.pojo.User; 4 | import com.bo.sims.service.UserService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.ui.Model; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | 13 | import javax.servlet.http.HttpSession; 14 | 15 | /** 16 | * @author Bo 17 | * @create 2021-06-18 0:21 18 | */ 19 | @Controller 20 | @RequestMapping 21 | public class LoginController { 22 | 23 | @Autowired 24 | UserService userService; 25 | 26 | /** 27 | * 访问/admin直接跳转到管理后台登录页 28 | * @return 29 | */ 30 | @GetMapping(value = {"/","/admin"}) 31 | public String loginPage(){ 32 | 33 | return "admin/login"; 34 | } 35 | 36 | 37 | /** 38 | * 解决直接在浏览器中输入http://localhost:8080/admin/login访问出错 39 | * 因为在浏览器中直接输入为get请求,进不去postLogin方法中,会报错 40 | * 这个方法的作用是让页面跳转到login.html再重新填写表单再以post方式提交 41 | * @return 42 | */ 43 | @GetMapping("/admin/login") 44 | public String getLogin(){ 45 | 46 | return "admin/login"; 47 | } 48 | 49 | /** 50 | * 检查登录的用户名和密码是否正确 51 | * @param username 52 | * @param password 53 | * @return 54 | */ 55 | @PostMapping("/admin/login") 56 | public String postLogin(@RequestParam("username") String username, 57 | @RequestParam("password") String password, 58 | HttpSession session, 59 | Model model){ 60 | 61 | User user = userService.checkUser(username, password); 62 | if (user != null){ 63 | //登录成功,把用户信息放在session中返回给页面 64 | user.setPassword(null); 65 | session.setAttribute("user",user); 66 | return "redirect:/admin/bill/payment"; 67 | }else { 68 | //登录失败,把错误信息放在model中请求转发回admin 69 | model.addAttribute("message","用户名或密码错误"); 70 | return "admin/login"; 71 | } 72 | } 73 | 74 | 75 | /** 76 | * 注销 77 | * @param session 78 | * @return 79 | */ 80 | @GetMapping("/admin/logout") 81 | public String logout(HttpSession session){ 82 | //清空session中的已登录用户信息,再重定向回登录页面 83 | session.removeAttribute("user"); 84 | return "redirect:/admin/login"; 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/controller/SupplierController.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.controller; 2 | 3 | import com.bo.sims.pojo.Goods; 4 | import com.bo.sims.pojo.Supplier; 5 | import com.bo.sims.service.GoodsService; 6 | import com.bo.sims.service.SupplierService; 7 | import com.github.pagehelper.PageHelper; 8 | import com.github.pagehelper.PageInfo; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.validation.BindingResult; 13 | import org.springframework.web.bind.annotation.*; 14 | import org.springframework.web.servlet.mvc.support.RedirectAttributes; 15 | 16 | 17 | import java.util.List; 18 | import javax.validation.Valid; 19 | 20 | /** 21 | * @author Bo 22 | * @create 2021-06-18 13:32 23 | */ 24 | @Controller 25 | @RequestMapping("/admin") 26 | public class SupplierController { 27 | 28 | 29 | @Autowired 30 | private SupplierService supplierService; 31 | 32 | 33 | @Autowired 34 | private GoodsService goodsService; 35 | 36 | /** 37 | * 供应商信息展示 38 | * 39 | * @param pageNum 40 | * @param model 41 | * @return 42 | */ 43 | @GetMapping("/supplier") 44 | public String supplierList(@RequestParam(defaultValue = "1", value = "pageNum") Integer pageNum, 45 | Model model) { 46 | //按照排序id 升叙 排序 47 | String orderBy = "id desc"; 48 | //startPage的三个参数分别为当前页码、每页条数、排列顺序 49 | PageHelper.startPage(pageNum, 5, orderBy); 50 | //查询所有数据并封装成集合 51 | List list = supplierService.getAllSupplier(); 52 | //再通过封装成当页的数据构成的集合 53 | PageInfo pageInfo = new PageInfo<>(list); 54 | //把当页的数据放在model传递给页面,在博客管理页面显示数据 55 | model.addAttribute("pageInfo", pageInfo); 56 | 57 | return "admin/suppliers"; 58 | } 59 | 60 | 61 | /** 62 | * 跳转到供应商新增页面 63 | * 64 | * @return 65 | */ 66 | @GetMapping("/supplier/input") 67 | public String input(Model model) { 68 | model.addAttribute("supplier",new Supplier()); 69 | return "admin/suppliers-input"; 70 | } 71 | 72 | 73 | /** 74 | * 处理点击修改后跳转到供应商新增页面,并把需要修改的供应商对象放在model里传给页面回显 75 | * 76 | * @param id 77 | * @param model 78 | * @return 79 | */ 80 | @GetMapping("/supplier/{id}/input") 81 | public String update(@PathVariable("id") Long id, 82 | @RequestParam("pageNum") Integer pageNum, 83 | Model model) { 84 | model.addAttribute("supplier", supplierService.getOneSupplierById(id)); 85 | model.addAttribute("pageNum",pageNum); 86 | return "admin/suppliers-input"; 87 | } 88 | 89 | 90 | /** 91 | * supplier-input页面的提交功能(插入操作) 92 | * @param supplier 93 | * @param result 94 | * @param attributes 95 | * @return 96 | */ 97 | @PostMapping("/supplier") 98 | public String saveSupplier(@Valid Supplier supplier, 99 | BindingResult result, 100 | RedirectAttributes attributes) { 101 | // 后端非空的验证 102 | // 判断供应商名称、地址、联系方式是否为空,为空则回到供应商新增页面并提示错误信息。 103 | if (result.hasErrors()) { 104 | return "admin/suppliers-input"; 105 | } 106 | // 查询一下新增的供应商名字是否已经存在 107 | if (supplierService.getOneSupplierByName(supplier.getName()) != null) { 108 | result.rejectValue("name","nameError","不能添加重复的供应商"); 109 | return "admin/suppliers-input"; 110 | } 111 | // 新增供应商,并通过返回值验证操作结果 112 | if (supplierService.saveSupplier(supplier) == 0) { 113 | attributes.addFlashAttribute("message", "操作失败"); 114 | } else { 115 | attributes.addFlashAttribute("message", "操作成功"); 116 | } 117 | return "redirect:/admin/supplier"; 118 | } 119 | 120 | 121 | /** 122 | * supplier-input页面的提交功能(更新操作) 123 | * @param supplier 124 | * @param id 125 | * @param pageNum 126 | * @param result 127 | * @param attributes 128 | * @return 129 | */ 130 | @PostMapping("/supplier/{id}") 131 | public String updateSupplier(@Valid Supplier supplier, 132 | @PathVariable("id") Long id, 133 | @RequestParam("pageNum") Integer pageNum, 134 | BindingResult result, 135 | RedirectAttributes attributes) { 136 | if (result.hasErrors()) { 137 | return "admin/suppliers-input"; 138 | } 139 | supplier.setId(id); 140 | if (supplierService.updateSupplier(supplier) == 0) { 141 | attributes.addFlashAttribute("message1", "操作失败"); 142 | } else { 143 | attributes.addFlashAttribute("message", "操作成功"); 144 | } 145 | return "redirect:/admin/supplier?pageNum=" + pageNum; 146 | } 147 | 148 | 149 | /** 150 | * 供应商列表页面的删除功能 151 | * @param id 152 | * @param pageNum 153 | * @param attributes 154 | * @return 155 | */ 156 | @GetMapping("/supplier/{id}/delete") 157 | public String deleteId(@PathVariable("id") Long id, 158 | @RequestParam("pageNum") Integer pageNum, 159 | RedirectAttributes attributes){ 160 | Supplier supplier = supplierService.getOneSupplierById(id); 161 | //根据供应商id查询是否还存在需要此供应商供应的商品,如果存在则删除供应商失败 162 | List goodsList = goodsService.getAllGoodsBySupplierId(id); 163 | if (supplier != null && goodsList.isEmpty()){ 164 | if( supplierService.deleteById(id) != 0){ 165 | attributes.addFlashAttribute("message","删除成功"); 166 | }else { 167 | attributes.addFlashAttribute("message","删除失败"); 168 | } 169 | }else { 170 | attributes.addFlashAttribute("message","删除失败"); 171 | } 172 | return "redirect:/admin/supplier?pageNum=" + pageNum; 173 | } 174 | 175 | /** 176 | * 供应商页面搜索功能 177 | * @param supplierName 178 | * @param attributes 179 | * @param model 180 | * @return 181 | */ 182 | @GetMapping("/supplier/search") 183 | public String search(@RequestParam("supplierName") String supplierName, 184 | RedirectAttributes attributes, 185 | Model model){ 186 | Supplier supplier = supplierService.getOneSupplierByName(supplierName); 187 | if (supplier == null){ 188 | attributes.addFlashAttribute("message","查找失败"); 189 | return "redirect:/admin/supplier"; 190 | }else { 191 | model.addAttribute("supplier",supplier); 192 | return "admin/suppliers-input"; 193 | } 194 | } 195 | 196 | 197 | 198 | } 199 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/dao/BillMapper.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.dao; 2 | 3 | import com.bo.sims.pojo.Bill; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * @author Bo 12 | * @create 2021-06-19 13:35 13 | */ 14 | @Mapper 15 | @Repository 16 | public interface BillMapper { 17 | 18 | /** 19 | * 保存新的订单 20 | * @param bill 21 | * @return 22 | */ 23 | int saveBill(Bill bill); 24 | 25 | /** 26 | * 查询每天的总利润放在bill对象中,返回bill集合 27 | * @return 28 | */ 29 | List getProfitsAndTime(); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/dao/GoodsMapper.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.dao; 2 | 3 | import com.bo.sims.pojo.Goods; 4 | import org.apache.ibatis.annotations.*; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.List; 9 | 10 | /** 11 | * @author Bo 12 | * @create 2021-06-18 13:25 13 | */ 14 | @Mapper 15 | @Repository 16 | public interface GoodsMapper { 17 | 18 | @Insert("insert into t_goods (name,count,prime_price,sale_price,type,sid) values (#{name},#{count},#{primePrice},#{salePrice},#{type},#{sid})") 19 | int saveGoods(Goods goods); 20 | 21 | @Delete("delete from t_goods where id = #{id}") 22 | int deleteById(Long id); 23 | 24 | @Update("update t_goods set name = #{name}, count = #{count}, prime_price = #{primePrice}, sale_price = #{salePrice}, type = #{type}, sid = #{sid} where id = #{id}") 25 | int updateGoods(Goods goods); 26 | 27 | /** 28 | * 根据商品id查询一条商品信息(带对应的供应商信息) 29 | * 30 | * @return 31 | */ 32 | Goods getOneGoodsById(Long id); 33 | 34 | /** 35 | * 根据商品名称查询一条商品信息(带对应的供应商信息) 36 | * 37 | * @return 38 | */ 39 | Goods getOneGoodsByName(String name); 40 | 41 | /** 42 | * 查询所有商品信息(带对应的供应商信息) 43 | * 44 | * @return 45 | */ 46 | List getAllGoods(); 47 | 48 | /** 49 | * 根据供应商id查询它旗下所有商品信息(带对应的供应商信息) 50 | * 51 | * @param supplierId 52 | * @return 53 | */ 54 | List getAllGoodsBySupplierId(Long supplierId); 55 | 56 | 57 | /** 58 | * 根据商品id和库存量查询id相等且库存量大于或等于count的商品的售货价 59 | * 如果当前商品库存量不足count则返回0.0 60 | * 否则返回该商品的售货价 61 | * 62 | * @param id 63 | * @param count 64 | * @return 65 | */ 66 | BigDecimal getSalePriceByIdAndCount(Long id, Long count); 67 | 68 | 69 | /** 70 | * 根据商品id修改该商品的库存量为 原库存量 - (本次销售量)salesCount 71 | * 72 | * @param id 73 | * @param salesCount 74 | * @return 75 | */ 76 | int updateGoodsCount(Long id, Long salesCount); 77 | 78 | 79 | /** 80 | * 根据商品id查询它对应的库存量(要求是大于等于0的) 81 | * 82 | * @param id 83 | * @return 84 | */ 85 | Long getCountANDNotLessThanZeroById(Long id); 86 | 87 | /** 88 | * 根据商品id和销售量查询出它的总利润 = (售货价 - 进货价) * 销售数量 89 | * 90 | * @param id 91 | * @return 92 | */ 93 | BigDecimal getProfitsByIdAndSalesCount(Long id, Long salesCount); 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/dao/SalesMapper.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.dao; 2 | 3 | import com.bo.sims.pojo.Sales; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @author Bo 12 | * @create 2021-06-19 14:08 13 | */ 14 | @Mapper 15 | @Repository 16 | public interface SalesMapper { 17 | 18 | 19 | /** 20 | * 保存新的销售记录 21 | * @param sales 22 | * @return 23 | */ 24 | @Insert("insert into t_sales (gid,bid,sales_count) values (#{gid},#{bid},#{salesCount})") 25 | int saveSales(Sales sales); 26 | 27 | 28 | /** 29 | * 根据订单号查询该订单的销售详情 30 | * @param billId 31 | * @return 32 | */ 33 | List getSalesBill(Long billId); 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/dao/SupplierMapper.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.dao; 2 | 3 | import com.bo.sims.pojo.Supplier; 4 | import org.apache.ibatis.annotations.Delete; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @author Bo 13 | * @create 2021-06-18 16:38 14 | */ 15 | @Mapper 16 | @Repository 17 | public interface SupplierMapper { 18 | 19 | 20 | /** 21 | * 插入新的供应商信息 22 | * @param supplier 23 | * @return 24 | */ 25 | int saveSupplier(Supplier supplier); 26 | 27 | /** 28 | * 按supplier对象中的内容更新供应商的信息 29 | * @param supplier 30 | * @return 31 | */ 32 | int updateSupplier(Supplier supplier); 33 | 34 | 35 | /** 36 | * 根据供应商id删除该供应商信息 37 | * @param id 38 | * @return 39 | */ 40 | @Delete("delete from t_supplier where `id` = #{id}") 41 | int deleteById(Long id); 42 | 43 | /** 44 | * 根据供应商id查询一条供应商信息 45 | * @param id 46 | * @return 47 | */ 48 | @Select("select * from t_supplier where `id` = #{id}") 49 | Supplier getOneSupplierById(Long id); 50 | 51 | /** 52 | * 根据供应商名字查询一条供应商信息 53 | * @param name 54 | * @return 55 | */ 56 | @Select("select * from t_supplier where `name` = #{name}") 57 | Supplier getOneSupplierByName(String name); 58 | 59 | 60 | /** 61 | * 查询所有供应商信息 62 | * @return 63 | */ 64 | @Select("select * from t_supplier") 65 | List getAllSupplier(); 66 | 67 | 68 | 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/dao/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.dao; 2 | 3 | import com.bo.sims.pojo.User; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * @author Bo 9 | * @create 2021-06-18 11:05 10 | */ 11 | @Mapper 12 | @Repository 13 | public interface UserMapper{ 14 | 15 | /** 16 | * 查询用户名和密码 17 | * @param username 18 | * @param password 19 | * @return 20 | */ 21 | User getByUsernameAndPassword(String username,String password); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/interceptor/loginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.interceptor; 2 | 3 | import org.springframework.web.servlet.HandlerInterceptor; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | import javax.servlet.http.HttpSession; 8 | 9 | /** 10 | * 登录检查 11 | * 1、配置好拦截器要拦截哪些请求 12 | * 2、把这些配置放在容器中 13 | * @author Bo 14 | * @create 2021-06-18 13:20 15 | */ 16 | public class loginInterceptor implements HandlerInterceptor { 17 | 18 | /** 19 | * 目标方法执行之前 20 | * 21 | * @param request 22 | * @param response 23 | * @param handler 24 | * @return 25 | * @throws Exception 26 | */ 27 | @Override 28 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 29 | HttpSession session = request.getSession(); 30 | Object user = session.getAttribute("user"); 31 | if (user != null) { 32 | //放行 33 | return true; 34 | } else { 35 | //拦截住 36 | session.setAttribute("msg", "请先登录"); 37 | response.sendRedirect("/admin"); 38 | return false; 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/pojo/Bill.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.pojo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.validation.constraints.NotNull; 8 | import java.math.BigDecimal; 9 | import java.util.Date; 10 | 11 | /** 12 | * @author Bo 13 | * @create 2021-06-18 10:31 14 | */ 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | public class Bill { 19 | 20 | private Long id; 21 | 22 | private BigDecimal needPayment; //应付金额 23 | 24 | @NotNull(message = "实付金额不能为空") 25 | private BigDecimal realPayment; //实付金额 26 | 27 | private BigDecimal profits; //利润 28 | 29 | private Date createTime; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/pojo/Goods.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.pojo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | import javax.validation.constraints.NotNull; 9 | import java.math.BigDecimal; 10 | 11 | /** 12 | * @author Bo 13 | * @create 2021-06-18 10:29 14 | */ 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | public class Goods { 19 | 20 | private Long id; 21 | 22 | @NotBlank(message = "商品的名称不能为空") 23 | private String name; 24 | 25 | @NotNull(message = "商品的库存量不能为空") 26 | private Long count; 27 | 28 | @NotNull(message = "商品的进价不能为空") 29 | private BigDecimal primePrice; 30 | 31 | @NotNull(message = "商品的售价不能为空") 32 | private BigDecimal salePrice; 33 | 34 | @NotBlank(message = "商品的分类不能为空") 35 | private String type; 36 | 37 | private Long sid; 38 | 39 | private Supplier supplier; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/pojo/Sales.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.pojo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @author Bo 9 | * @create 2021-06-18 10:33 10 | */ 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | public class Sales { 15 | 16 | private Long gid; 17 | private Long bid; 18 | private Long salesCount; 19 | 20 | private Goods goods; 21 | private Bill bill; 22 | 23 | public Sales(Long gid, Long bid, Long salesCount) { 24 | this.gid = gid; 25 | this.bid = bid; 26 | this.salesCount = salesCount; 27 | } 28 | 29 | public Sales(Long gid, Long salesCount) { 30 | this.gid = gid; 31 | this.salesCount = salesCount; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/pojo/Supplier.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.pojo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | import javax.validation.constraints.NotNull; 9 | 10 | /** 11 | * @author Bo 12 | * @create 2021-06-18 10:26 13 | */ 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class Supplier { 18 | 19 | private Long id; 20 | 21 | //用@NotBlank注解标识name不能为空 22 | @NotBlank(message = "供应商的名称不能为空") 23 | private String name; 24 | 25 | @NotBlank(message = "供应商的地址不能为空") 26 | private String address; 27 | 28 | @NotNull(message = "供应商的联系方式不能为空") 29 | private Long contact; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/pojo/User.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.pojo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | 8 | 9 | /** 10 | * @author Bo 11 | * @create 2021-06-18 10:23 12 | */ 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public class User { 17 | 18 | private Long id; //用户id 19 | private String username; //用户名 20 | private String password; //密码 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/BillService.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service; 2 | 3 | import com.bo.sims.pojo.Bill; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author Bo 9 | * @create 2021-06-20 16:53 10 | */ 11 | public interface BillService { 12 | 13 | int saveBill(Bill bill); 14 | 15 | List getProfitsAndTime(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/GoodsService.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service; 2 | 3 | import com.bo.sims.pojo.Goods; 4 | import com.bo.sims.pojo.Sales; 5 | import com.bo.sims.vo.Settlement; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.List; 9 | 10 | /** 11 | * @author Bo 12 | * @create 2021-06-19 0:31 13 | */ 14 | public interface GoodsService { 15 | 16 | int saveGoods(Goods goods); 17 | 18 | int deleteById(Long id); 19 | 20 | int updateGoods(Goods goods); 21 | 22 | Goods getOneGoodsById(Long id); 23 | 24 | Goods getOneGoodsByName(String name); 25 | 26 | List getAllGoods(); 27 | 28 | List getAllGoodsBySupplierId(Long supplierId); 29 | 30 | List getSalePriceAndUpdateCount(List salesList); 31 | 32 | BigDecimal getProfitsByIdAndSalesCount(List salesList); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/SalesService.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service; 2 | 3 | import com.bo.sims.pojo.Sales; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author Bo 9 | * @create 2021-06-20 15:11 10 | */ 11 | public interface SalesService { 12 | 13 | 14 | int saveSalesList(List salesList); 15 | 16 | List getSalesBill(Long billId); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/SupplierService.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service; 2 | 3 | import com.bo.sims.pojo.Supplier; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author Bo 9 | * @create 2021-06-18 17:35 10 | */ 11 | public interface SupplierService { 12 | 13 | int saveSupplier(Supplier supplier); 14 | 15 | int updateSupplier(Supplier supplier); 16 | 17 | int deleteById(Long id); 18 | 19 | Supplier getOneSupplierByName(String name); 20 | 21 | Supplier getOneSupplierById(Long id); 22 | 23 | List getAllSupplier(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service; 2 | 3 | 4 | import com.bo.sims.pojo.User; 5 | 6 | /** 7 | * @author Bo 8 | * @create 2021-06-18 11:05 9 | */ 10 | public interface UserService{ 11 | 12 | /** 13 | * 检查用户名和密码是否正确 14 | * @param username 15 | * @param password 16 | * @return 17 | */ 18 | User checkUser(String username, String password); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/impl/BillServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service.impl; 2 | 3 | import com.bo.sims.dao.BillMapper; 4 | import com.bo.sims.pojo.Bill; 5 | import com.bo.sims.service.BillService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * @author Bo 15 | * @create 2021-06-20 16:53 16 | */ 17 | @Service 18 | public class BillServiceImpl implements BillService { 19 | 20 | @Autowired 21 | private BillMapper billMapper; 22 | 23 | 24 | @Transactional 25 | @Override 26 | public int saveBill(Bill bill) { 27 | return billMapper.saveBill(bill); 28 | } 29 | 30 | @Transactional 31 | @Override 32 | public List getProfitsAndTime() { 33 | return billMapper.getProfitsAndTime(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/impl/GoodsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service.impl; 2 | 3 | import com.bo.sims.dao.GoodsMapper; 4 | import com.bo.sims.pojo.Goods; 5 | import com.bo.sims.pojo.Sales; 6 | import com.bo.sims.service.GoodsService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Transactional; 10 | import org.springframework.transaction.interceptor.TransactionAspectSupport; 11 | 12 | import java.math.BigDecimal; 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | /** 17 | * @author Bo 18 | * @create 2021-06-19 0:31 19 | */ 20 | @Service 21 | public class GoodsServiceImpl implements GoodsService { 22 | 23 | @Autowired 24 | private GoodsMapper goodsMapper; 25 | 26 | @Transactional 27 | @Override 28 | public int saveGoods(Goods goods) { 29 | return goodsMapper.saveGoods(goods); 30 | } 31 | 32 | @Transactional 33 | @Override 34 | public int deleteById(Long id) { 35 | int i; 36 | try { 37 | i = goodsMapper.deleteById(id); 38 | }catch (Exception e){ 39 | return 0; 40 | } 41 | return i; 42 | } 43 | 44 | 45 | /** 46 | * 商品更新操作,如果要更新的商品名存在则更新失败 47 | * @param goods 48 | * @return 返回0更新失败,返回1更新成功 49 | */ 50 | @Transactional 51 | @Override 52 | public int updateGoods(Goods goods) { 53 | int i; 54 | try { 55 | i = goodsMapper.updateGoods(goods); 56 | }catch (Exception e){ 57 | return 0; 58 | } 59 | return i; 60 | } 61 | 62 | @Transactional 63 | @Override 64 | public Goods getOneGoodsById(Long id) { 65 | return goodsMapper.getOneGoodsById(id); 66 | } 67 | 68 | @Transactional 69 | @Override 70 | public Goods getOneGoodsByName(String name) { 71 | return goodsMapper.getOneGoodsByName(name); 72 | } 73 | 74 | @Transactional 75 | @Override 76 | public List getAllGoods() { 77 | return goodsMapper.getAllGoods(); 78 | } 79 | 80 | @Transactional 81 | @Override 82 | public List getAllGoodsBySupplierId(Long supplierId) { 83 | return goodsMapper.getAllGoodsBySupplierId(supplierId); 84 | } 85 | 86 | 87 | /** 88 | * 根据Sales集合中的(商品id,销售量)查询数据库,如果存在该商品且库存量大于或等于销售量时 89 | * 则更新商品库存量为 库存量-销售量 ,一共对商品表中的salesList.size()个商品进行操作, 90 | * 只要有其中一个商品出现更新失败或者更新后它的库存量小于0,则进行事务回滚 91 | * @param salesList 92 | * @return 如果返回null则证明商品销售量不足或者商品库存量更新失败 93 | * 如果不为null则是salesList.size()个商品各对应的销售价格 94 | */ 95 | @Transactional 96 | @Override 97 | public List getSalePriceAndUpdateCount(List salesList) { 98 | 99 | //创建销售价的集合,存放商品的销售价 100 | List salePriceList = new ArrayList<>(); 101 | 102 | //查询i个商品的库存量是否大于等于销售量,返回值为null则证明小于销售量,返回值不为null则是该商品的销售价 103 | for (Sales sales : salesList) { 104 | BigDecimal salePrice = goodsMapper.getSalePriceByIdAndCount(sales.getGid(), sales.getSalesCount()); 105 | //判断该商品的库存量是否大于等于销售量 106 | if (salePrice == null) { 107 | //小于库存量,返回null 108 | return null; 109 | } 110 | //此时库存量已经大于等于销售量,把该商品的销售价放进销售价集合中 111 | salePriceList.add(salePrice); 112 | } 113 | 114 | try { 115 | //更新商品的库存量 116 | for (Sales sales : salesList) { 117 | int flag = goodsMapper.updateGoodsCount(sales.getGid(), sales.getSalesCount()); 118 | //判断此次更新是否成功,不成功就抛出异常回滚事务 119 | if (flag == 0){ 120 | //手动抛出运行时异常,触发事务回滚功能 121 | throw new RuntimeException(); 122 | } 123 | } 124 | //查询5个商品更新后的库存量 125 | for (Sales sales : salesList) { 126 | Long count = goodsMapper.getCountANDNotLessThanZeroById(sales.getGid()); 127 | //判断更新后此商品的库存量是否大于等于0,不符合就抛出异常回滚事务 128 | if (count < 0){ 129 | //手动抛出运行时异常,触发事务回滚功能 130 | throw new RuntimeException(); 131 | } 132 | } 133 | }catch (Exception e){ 134 | //手动触发事务回滚 135 | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 136 | return null; 137 | } 138 | 139 | //将商品的销售价集合返回 140 | return salePriceList; 141 | } 142 | 143 | /** 144 | * 根据Sales集合中的(商品id,销售量)查询数据库中该商品销售销售数量的利润 145 | * @param salesList 146 | * @return 返回Sales集合中的商品总利润 147 | */ 148 | @Transactional 149 | @Override 150 | public BigDecimal getProfitsByIdAndSalesCount(List salesList) { 151 | BigDecimal profits = new BigDecimal("0"); 152 | for (Sales sales : salesList) { 153 | profits = profits.add(goodsMapper.getProfitsByIdAndSalesCount(sales.getGid(),sales.getSalesCount())); 154 | } 155 | return profits; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/impl/SalesServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service.impl; 2 | 3 | import com.bo.sims.dao.SalesMapper; 4 | import com.bo.sims.pojo.Sales; 5 | import com.bo.sims.service.SalesService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Bo 14 | * @create 2021-06-20 15:12 15 | */ 16 | @Service 17 | public class SalesServiceImpl implements SalesService { 18 | 19 | @Autowired 20 | private SalesMapper salesMapper; 21 | 22 | 23 | @Transactional 24 | @Override 25 | public int saveSalesList(List salesList) { 26 | for (Sales sales : salesList) { 27 | salesMapper.saveSales(sales); 28 | } 29 | return 1; 30 | } 31 | 32 | @Transactional 33 | @Override 34 | public List getSalesBill(Long billId) { 35 | return salesMapper.getSalesBill(billId); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/impl/SupplierServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service.impl; 2 | 3 | import com.bo.sims.dao.SupplierMapper; 4 | import com.bo.sims.pojo.Supplier; 5 | import com.bo.sims.service.SupplierService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Bo 14 | * @create 2021-06-18 17:38 15 | */ 16 | @Service 17 | public class SupplierServiceImpl implements SupplierService { 18 | 19 | @Autowired 20 | private SupplierMapper supplierMapper; 21 | 22 | 23 | @Transactional 24 | @Override 25 | public int saveSupplier(Supplier supplier) { 26 | return supplierMapper.saveSupplier(supplier); 27 | } 28 | 29 | 30 | /** 31 | * 供应商更新操作,如果要更新的供应商名存在则更新失败 32 | * @param supplier 33 | * @return 返回0更新失败,返回1更新成功 34 | */ 35 | @Transactional 36 | @Override 37 | public int updateSupplier(Supplier supplier) { 38 | int i; 39 | try { 40 | i = supplierMapper.updateSupplier(supplier); 41 | }catch (Exception e){ 42 | return 0; 43 | } 44 | return i; 45 | } 46 | 47 | @Transactional 48 | @Override 49 | public int deleteById(Long id) { 50 | return supplierMapper.deleteById(id); 51 | } 52 | 53 | @Transactional 54 | @Override 55 | public Supplier getOneSupplierByName(String name) { 56 | return supplierMapper.getOneSupplierByName(name); 57 | } 58 | 59 | @Transactional 60 | @Override 61 | public Supplier getOneSupplierById(Long id) { 62 | return supplierMapper.getOneSupplierById(id); 63 | } 64 | 65 | @Transactional 66 | @Override 67 | public List getAllSupplier() { 68 | return supplierMapper.getAllSupplier(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.service.impl; 2 | 3 | 4 | import com.bo.sims.dao.UserMapper; 5 | import com.bo.sims.pojo.User; 6 | import com.bo.sims.service.UserService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | /** 12 | * @author Bo 13 | * @create 2021-06-18 11:10 14 | */ 15 | @Service 16 | public class UserServiceImpl implements UserService { 17 | 18 | @Autowired 19 | private UserMapper userMapper; 20 | 21 | @Transactional 22 | @Override 23 | public User checkUser(String username, String password) { 24 | 25 | return userMapper.getByUsernameAndPassword(username, password); 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/bo/sims/vo/Settlement.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims.vo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.validation.constraints.NotNull; 8 | import java.math.BigDecimal; 9 | 10 | /** 11 | * @author Bo 12 | * @create 2021-06-19 13:05 13 | */ 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class Settlement { 18 | 19 | private Long goodId1; 20 | private Long salesCount1; 21 | 22 | private Long goodId2; 23 | private Long salesCount2; 24 | 25 | private Long goodId3; 26 | private Long salesCount3; 27 | 28 | private Long goodId4; 29 | private Long salesCount4; 30 | 31 | private Long goodId5; 32 | private Long salesCount5; 33 | 34 | @NotNull(message = "应付金额不能为空") 35 | private BigDecimal realPayment; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/resources/application-dev.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.jdbc.Driver 4 | url: jdbc:mysql://127.0.0.1:3306/sims?useUnicode=true&characterEncoding=utf-8 5 | username: root 6 | password: '0106' 7 | 8 | mybatis: 9 | mapper-locations: classpath:mybatis/mapper/*.xml 10 | configuration: 11 | map-underscore-to-camel-case: true 12 | 13 | logging: 14 | level: 15 | root: info 16 | com.bo: debug -------------------------------------------------------------------------------- /src/main/resources/application-pro.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.jdbc.Driver 4 | url: jdbc:mysql://127.0.0.1:3306/sims?useUnicode=true&characterEncoding=utf-8 5 | username: root 6 | password: '0106' 7 | 8 | mybatis: 9 | mapper-locations: classpath:mybatis/mapper/*.xml 10 | configuration: 11 | map-underscore-to-camel-case: true 12 | 13 | logging: 14 | level: 15 | root: warn 16 | com.bo: info -------------------------------------------------------------------------------- /src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: pro 4 | 5 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/mapper/BillMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | insert into `t_bill`(need_payment,real_payment,create_time,profits) 11 | values(#{needPayment},#{realPayment},#{createTime},#{profits}) 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/mapper/GoodsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 13 | 14 | 19 | 20 | 25 | 26 | 31 | 32 | 39 | 40 | 41 | 42 | UPDATE `t_goods` 43 | SET `count` = `count` - #{salesCount} 44 | WHERE `id` = #{id}; 45 | 46 | 47 | 48 | 49 | 56 | 57 | 58 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/mapper/SalesMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/mapper/SupplierMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | insert into `t_supplier`(`name`,`address`,`contact`) values (#{name},#{address},#{contact}); 10 | 11 | 12 | 13 | 14 | 15 | 16 | update `t_supplier` set `name` = #{name} , `address` = #{address} , `contact` = #{contact} where `id` = #{id}; 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/static/css/me.css: -------------------------------------------------------------------------------- 1 | 2 | body { 3 | /*background: url("../images/bg.png");*/ 4 | background: #f9f9f9; 5 | } 6 | 7 | 8 | .me-segment-border-none { 9 | border-top: none !important; 10 | border-bottom: none !important; 11 | border-right: none !important; 12 | border-left: none !important; 13 | } 14 | 15 | .me-segment-border-topNoNone { 16 | border-bottom: none !important; 17 | border-right: none !important; 18 | border-left: none !important; 19 | } 20 | 21 | .me-segment-border-bottomNoNone { 22 | border-top: none !important; 23 | border-right: none !important; 24 | border-left: none !important; 25 | } 26 | 27 | .me-padded-mini { 28 | padding: 0.2em !important; 29 | } 30 | .me-padded-tiny { 31 | padding: 0.3em !important; 32 | } 33 | .me-padded-small { 34 | padding: 1.5em !important; 35 | } 36 | 37 | 38 | .me-padded-tb-mini { 39 | padding-top: 0.2em !important; 40 | padding-bottom: 0.2em !important; 41 | } 42 | .me-padded-tb-tiny { 43 | padding-top: 0.3em !important; 44 | padding-bottom: 0.3em !important; 45 | } 46 | .me-padded-tb-small { 47 | padding-top: 0.5em !important; 48 | padding-bottom: 0.5em !important; 49 | } 50 | .me-padded-tb-middleSmall { 51 | padding-top: 0.75em !important; 52 | padding-bottom: 0.75em !important; 53 | } 54 | .me-padded-tb { 55 | padding-top: 1em !important; 56 | padding-bottom: 1em !important; 57 | } 58 | .me-padded-tb-large { 59 | padding-top: 2em !important; 60 | padding-bottom: 2em !important; 61 | } 62 | .me-padded-tb-middle { 63 | padding-top: 2.5em !important; 64 | padding-bottom: 2.5em !important; 65 | } 66 | .me-padded-tb-big { 67 | padding-top: 3em !important; 68 | padding-bottom: 3em !important; 69 | } 70 | .me-padded-tb-huge { 71 | padding-top: 4em !important; 72 | padding-bottom: 4em !important; 73 | } 74 | .me-padded-tb-massive { 75 | padding-top: 5em !important; 76 | padding-bottom: 5em !important; 77 | } 78 | 79 | 80 | .me-padded-lr-responsive { 81 | padding-left: 4em !important; 82 | padding-right: 4em !important; 83 | } 84 | 85 | /*------text------*/ 86 | 87 | .me-text-thin { 88 | font-weight: 300 !important; 89 | } 90 | .me-text-spaced { 91 | letter-spacing: 1px !important; 92 | } 93 | .me-text-lined { 94 | line-height: 1.8; 95 | } 96 | 97 | .me-text { 98 | font-weight: 300 !important; 99 | letter-spacing: 1px !important; 100 | line-height: 1.8; 101 | } 102 | 103 | /*-------margin-------*/ 104 | 105 | .me-margin-top-small { 106 | margin-top: 0.5em !important; 107 | } 108 | 109 | .me-margin-top { 110 | margin-top: 1em !important; 111 | } 112 | 113 | .me-margin-top-large { 114 | margin-top: 2em !important; 115 | } 116 | 117 | .me-margin-tb-tiny { 118 | margin-top: 0.3em !important; 119 | margin-bottom: 0.3em !important; 120 | } 121 | 122 | .me-margin-bottom-small { 123 | margin-bottom: 0.5em !important; 124 | } 125 | 126 | 127 | 128 | 129 | /*----opacity----*/ 130 | .me-opacity-mini { 131 | opacity: 0.8 !important; 132 | } 133 | 134 | .me-opacity-tiny { 135 | opacity: 0.6 !important; 136 | } 137 | 138 | 139 | 140 | 141 | /*-----position-----*/ 142 | .me-right-top { 143 | position: absolute; 144 | top: 0; 145 | right: 0; 146 | } 147 | 148 | 149 | /*----display-----*/ 150 | .me-inline-block { 151 | display: inline-block !important; 152 | } 153 | 154 | /*-----container-----*/ 155 | .me-container { 156 | max-width: 72em !important; 157 | margin: auto !important; 158 | } 159 | 160 | .me-container-small { 161 | max-width: 60em !important; 162 | margin: auto !important; 163 | } 164 | 165 | /*-----shadow------*/ 166 | .me-shadow-small { 167 | -webkit-box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important; 168 | box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important; 169 | } 170 | 171 | 172 | /*------position-------*/ 173 | .me-fixed { 174 | position: fixed !important; 175 | z-index: 10 !important; 176 | } 177 | 178 | .me-right-bottom { 179 | bottom: 0 !important; 180 | right: 0 !important; 181 | } 182 | 183 | 184 | 185 | /*-----color-----*/ 186 | .me-black { 187 | color: #333 !important; 188 | } 189 | 190 | 191 | 192 | .me-mobile-show { 193 | display: none !important; 194 | } 195 | 196 | @media screen and (max-width: 768px){ 197 | .me-mobile-hide { 198 | display: none !important; 199 | } 200 | .me-mobile-show { 201 | display: block !important; 202 | } 203 | .me-padded-lr-responsive { 204 | padding-left: 0 !important; 205 | padding-right: 0 !important; 206 | } 207 | .me-padded-lr-clear { 208 | padding-left: 0 !important; 209 | padding-right: 0 !important; 210 | } 211 | .me-mobile-wide { 212 | width: 100% !important; 213 | } 214 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/typo.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | .typo p { 4 | font-size: 16px; 5 | font-weight: 300; 6 | line-height: 1.8; 7 | text-align: justify; 8 | } 9 | 10 | /* 重设 HTML5 标签, IE 需要在 js 中 createElement(TAG) */ 11 | .typo article, aside, details, figcaption, figure, footer, header, menu, nav, section { 12 | display: block; 13 | } 14 | 15 | /* HTML5 媒体文件跟 img 保持一致 */ 16 | .typo audio, canvas, video { 17 | display: inline-block; 18 | } 19 | 20 | /* 要注意表单元素并不继承父级 font 的问题 */ 21 | .typo button, input, select, textarea { 22 | font: 300 1em/1.8 PingFang SC, Lantinghei SC, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif; 23 | } 24 | 25 | .typo button::-moz-focus-inner, 26 | .typo input::-moz-focus-inner { 27 | padding: 0; 28 | border: 0; 29 | } 30 | 31 | /* 去掉各Table cell 的边距并让其边重合 */ 32 | .typo table { 33 | border-collapse: collapse; 34 | border-spacing: 0; 35 | } 36 | 37 | /* 去除默认边框 */ 38 | .typo fieldset, img { 39 | border: 0; 40 | } 41 | 42 | /* 块/段落引用 */ 43 | .typo blockquote { 44 | position: relative; 45 | color: #999; 46 | font-weight: 400; 47 | border-left: 1px solid #1abc9c; 48 | padding-left: 1em; 49 | margin: 1em 3em 1em 2em; 50 | } 51 | 52 | @media only screen and ( max-width: 640px ) { 53 | .typo blockquote { 54 | margin: 1em 0; 55 | } 56 | } 57 | 58 | /* Firefox 以外,元素没有下划线,需添加 */ 59 | .typo acronym, abbr { 60 | border-bottom: 1px dotted; 61 | font-variant: normal; 62 | } 63 | 64 | /* 添加鼠标问号,进一步确保应用的语义是正确的(要知道,交互他们也有洁癖,如果你不去掉,那得多花点口舌) */ 65 | .typo abbr { 66 | cursor: help; 67 | } 68 | 69 | /* 一致的 del 样式 */ 70 | .typo del { 71 | text-decoration: line-through; 72 | } 73 | 74 | .typo address, caption, cite, code, dfn, em, th, var { 75 | font-style: normal; 76 | font-weight: 400; 77 | } 78 | 79 | /* 去掉列表前的标识, li 会继承,大部分网站通常用列表来很多内容,所以应该当去 */ 80 | .typo ul, ol { 81 | list-style: none; 82 | } 83 | 84 | /* 对齐是排版最重要的因素, 别让什么都居中 */ 85 | .typo caption, th { 86 | text-align: left; 87 | } 88 | 89 | .typo q:before,.typo q:after { 90 | content: ''; 91 | } 92 | 93 | /* 统一上标和下标 */ 94 | .typo sub,.typo sup { 95 | font-size: 75%; 96 | line-height: 0; 97 | position: relative; 98 | } 99 | 100 | .typo :root sub,.typo :root sup { 101 | vertical-align: baseline; /* for ie9 and other modern browsers */ 102 | } 103 | 104 | .typo sup { 105 | top: -0.5em; 106 | } 107 | 108 | .typo sub { 109 | bottom: -0.25em; 110 | } 111 | 112 | /* 让链接在 hover 状态下显示下划线 */ 113 | .typo a { 114 | color: #1abc9c; 115 | } 116 | 117 | .typo a:hover { 118 | text-decoration: underline; 119 | } 120 | 121 | .typo a { 122 | border-bottom: 1px solid #1abc9c; 123 | } 124 | 125 | .typo a:hover { 126 | border-bottom-color: #555; 127 | color: #555; 128 | text-decoration: none; 129 | } 130 | 131 | /* 默认不显示下划线,保持页面简洁 */ 132 | .typo ins,.typo a { 133 | text-decoration: none; 134 | } 135 | 136 | /* 专名号:虽然 u 已经重回 html5 Draft,但在所有浏览器中都是可以使用的, 137 | * 要做到更好,向后兼容的话,添加 class="typo-u" 来显示专名号 138 | * 关于 标签:http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-u-element 139 | * 被放弃的是 4,之前一直搞错 http://www.w3.org/TR/html401/appendix/changes.html#idx-deprecated 140 | * 一篇关于 标签的很好文章:http://html5doctor.com/u-element/ 141 | */ 142 | .typo u,.typo .typo-u { 143 | text-decoration: underline; 144 | } 145 | 146 | /* 标记,类似于手写的荧光笔的作用 */ 147 | .typo mark { 148 | background: #fffdd1; 149 | border-bottom: 1px solid #ffedce; 150 | padding: 2px; 151 | margin: 0 5px; 152 | } 153 | 154 | /* 代码片断 */ 155 | .typo pre,.typo code,.typo pre tt { 156 | font-family: Courier, 'Courier New', monospace; 157 | } 158 | 159 | .typo pre { 160 | background: #f8f8f8; 161 | border: 1px solid #ddd; 162 | padding: 1em 1.5em; 163 | display: block; 164 | -webkit-overflow-scrolling: touch; 165 | white-space: pre-wrap; 166 | word-wrap: break-word; 167 | } 168 | 169 | /* 一致化 horizontal rule */ 170 | .typo hr { 171 | border: none; 172 | border-bottom: 1px solid #cfcfcf; 173 | margin-bottom: 0.8em; 174 | height: 10px; 175 | } 176 | 177 | /* 底部印刷体、版本等标记 */ 178 | .typo small,.typo .typo-small, 179 | /* 图片说明 */ 180 | .typo figcaption { 181 | font-size: 0.9em; 182 | color: #888; 183 | } 184 | 185 | .typo strong,.typo b { 186 | font-weight: bold; 187 | color: #000; 188 | } 189 | 190 | /* 可拖动文件添加拖动手势 */ 191 | .typo [draggable] { 192 | cursor: move; 193 | } 194 | 195 | .typo .clearfix:before,.typo .clearfix:after { 196 | content: ""; 197 | display: table; 198 | } 199 | 200 | .typo .clearfix:after { 201 | clear: both; 202 | } 203 | 204 | .typo .clearfix { 205 | zoom: 1; 206 | } 207 | 208 | /* 强制文本换行 */ 209 | .typo .textwrap,.typo .textwrap td,.typo .textwrap th { 210 | word-wrap: break-word; 211 | word-break: break-all; 212 | } 213 | 214 | .typo .textwrap-table { 215 | table-layout: fixed; 216 | } 217 | 218 | /* 提供 serif 版本的字体设置: iOS 下中文自动 fallback 到 sans-serif */ 219 | .typo .serif { 220 | font-family: Palatino, Optima, Georgia, serif; 221 | } 222 | 223 | /* 保证块/段落之间的空白隔行 */ 224 | .typo p, .typo pre, .typo ul, .typo ol, .typo dl, .typo form, .typo hr, .typo table, 225 | .typo-p, .typo-pre, .typo-ul, .typo-ol, .typo-dl, .typo-form, .typo-hr, .typo-table, blockquote { 226 | margin-bottom: 1.2em 227 | } 228 | 229 | .typo h1,.typo h2,.typo h3,.typo h4,.typo h5,.typo h6 { 230 | font-family: PingFang SC, Verdana, Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif; 231 | font-weight: 100; 232 | color: #000; 233 | line-height: 1.35; 234 | } 235 | 236 | /* 标题应该更贴紧内容,并与其他块区分,margin 值要相应做优化 */ 237 | .typo h1, .typo h2, .typo h3, .typo h4, .typo h5, .typo h6, 238 | .typo-h1, .typo-h2, .typo-h3, .typo-h4, .typo-h5, .typo-h6 { 239 | margin-top: 1.2em; 240 | margin-bottom: 0.6em; 241 | line-height: 1.35; 242 | } 243 | 244 | .typo h1, .typo-h1 { 245 | font-size: 2em; 246 | } 247 | 248 | .typo h2, .typo-h2 { 249 | font-size: 1.8em; 250 | } 251 | 252 | .typo h3, .typo-h3 { 253 | font-size: 1.6em; 254 | } 255 | 256 | .typo h4, .typo-h4 { 257 | font-size: 1.4em; 258 | } 259 | 260 | .typo h5, .typo h6, .typo-h5, .typo-h6 { 261 | font-size: 1.2em; 262 | } 263 | 264 | /* 在文章中,应该还原 ul 和 ol 的样式 */ 265 | .typo ul, .typo-ul { 266 | margin-left: 1.3em; 267 | list-style: disc; 268 | } 269 | 270 | .typo ol, .typo-ol { 271 | list-style: decimal; 272 | margin-left: 1.9em; 273 | } 274 | 275 | .typo li ul, .typo li ol, .typo-ul ul, .typo-ul ol, .typo-ol ul, .typo-ol ol { 276 | margin-bottom: 0.8em; 277 | margin-left: 2em; 278 | } 279 | 280 | .typo li ul, .typo-ul ul, .typo-ol ul { 281 | list-style: circle; 282 | } 283 | 284 | /* 同 ul/ol,在文章中应用 table 基本格式 */ 285 | .typo table th, .typo table td, .typo-table th, .typo-table td, .typo table caption { 286 | border: 1px solid #ddd; 287 | padding: 0.5em 1em; 288 | color: #666; 289 | } 290 | 291 | .typo table th, .typo-table th { 292 | background: #fbfbfb; 293 | } 294 | 295 | .typo table thead th, .typo-table thead th { 296 | background: #f1f1f1; 297 | } 298 | 299 | .typo table caption { 300 | border-bottom: none; 301 | } 302 | 303 | /* 去除 webkit 中 input 和 textarea 的默认样式 */ 304 | .typo-input, .typo-textarea { 305 | -webkit-appearance: none; 306 | border-radius: 0; 307 | } 308 | 309 | .typo-em, .typo em, legend, caption { 310 | color: #000; 311 | font-weight: inherit; 312 | } 313 | 314 | /* 着重号,只能在少量(少于100个字符)且全是全角字符的情况下使用 */ 315 | .typo-em { 316 | position: relative; 317 | } 318 | 319 | .typo-em:after { 320 | position: absolute; 321 | top: 0.65em; 322 | left: 0; 323 | width: 100%; 324 | overflow: hidden; 325 | white-space: nowrap; 326 | content: "・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・"; 327 | } 328 | 329 | /* Responsive images */ 330 | .typo img { 331 | max-width: 100%; 332 | } 333 | -------------------------------------------------------------------------------- /src/main/resources/static/images/aboutMe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xjb1119/Sims/474ff6a61e379989021eaf380cef195118d7c6cd/src/main/resources/static/images/aboutMe.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xjb1119/Sims/474ff6a61e379989021eaf380cef195118d7c6cd/src/main/resources/static/images/bg.png -------------------------------------------------------------------------------- /src/main/resources/static/images/wechat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xjb1119/Sims/474ff6a61e379989021eaf380cef195118d7c6cd/src/main/resources/static/images/wechat.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/wechatPay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xjb1119/Sims/474ff6a61e379989021eaf380cef195118d7c6cd/src/main/resources/static/images/wechatPay.jpg -------------------------------------------------------------------------------- /src/main/resources/static/lib/prism/prism.css: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.23.0 2 | https://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript+abap+abnf+actionscript+ada+agda+al+antlr4+apacheconf+apex+apl+applescript+aql+arduino+arff+asciidoc+aspnet+asm6502+autohotkey+autoit+bash+basic+batch+bbcode+birb+bison+bnf+brainfuck+brightscript+bro+bsl+c+csharp+cpp+cfscript+chaiscript+cil+clojure+cmake+cobol+coffeescript+concurnas+csp+coq+crystal+css-extras+csv+cypher+d+dart+dataweave+dax+dhall+diff+django+dns-zone-file+docker+dot+ebnf+editorconfig+eiffel+ejs+elixir+elm+etlua+erb+erlang+excel-formula+fsharp+factor+false+firestore-security-rules+flow+fortran+ftl+gml+gcode+gdscript+gedcom+gherkin+git+glsl+go+graphql+groovy+haml+handlebars+haskell+haxe+hcl+hlsl+http+hpkp+hsts+ichigojam+icon+icu-message-format+idris+ignore+inform7+ini+io+j+java+javadoc+javadoclike+javastacktrace+jexl+jolie+jq+jsdoc+js-extras+json+json5+jsonp+jsstacktrace+js-templates+julia+keyman+kotlin+kumir+latex+latte+less+lilypond+liquid+lisp+livescript+llvm+log+lolcode+lua+makefile+markdown+markup-templating+matlab+mel+mizar+mongodb+monkey+moonscript+n1ql+n4js+nand2tetris-hdl+naniscript+nasm+neon+nevod+nginx+nim+nix+nsis+objectivec+ocaml+opencl+openqasm+oz+parigp+parser+pascal+pascaligo+psl+pcaxis+peoplecode+perl+php+phpdoc+php-extras+plsql+powerquery+powershell+processing+prolog+promql+properties+protobuf+pug+puppet+pure+purebasic+purescript+python+qsharp+q+qml+qore+r+racket+jsx+tsx+reason+regex+rego+renpy+rest+rip+roboconf+robotframework+ruby+rust+sas+sass+scss+scala+scheme+shell-session+smali+smalltalk+smarty+sml+solidity+solution-file+soy+sparql+splunk-spl+sqf+sql+squirrel+stan+iecst+stylus+swift+t4-templating+t4-cs+t4-vb+tap+tcl+tt2+textile+toml+turtle+twig+typescript+typoscript+unrealscript+uri+v+vala+vbnet+velocity+verilog+vhdl+vim+visual-basic+warpscript+wasm+wiki+xeora+xml-doc+xojo+xquery+yaml+yang+zig&plugins=line-numbers */ 3 | /** 4 | * okaidia theme for JavaScript, CSS and HTML 5 | * Loosely based on Monokai textmate theme by http://www.monokai.nl/ 6 | * @author ocodia 7 | */ 8 | 9 | code[class*="language-"], 10 | pre[class*="language-"] { 11 | color: #f8f8f2; 12 | background: none; 13 | text-shadow: 0 1px rgba(0, 0, 0, 0.3); 14 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 15 | font-size: 1em; 16 | text-align: left; 17 | white-space: pre; 18 | word-spacing: normal; 19 | word-break: normal; 20 | word-wrap: normal; 21 | line-height: 1.5; 22 | 23 | -moz-tab-size: 4; 24 | -o-tab-size: 4; 25 | tab-size: 4; 26 | 27 | -webkit-hyphens: none; 28 | -moz-hyphens: none; 29 | -ms-hyphens: none; 30 | hyphens: none; 31 | } 32 | 33 | /* Code blocks */ 34 | pre[class*="language-"] { 35 | padding: 1em; 36 | margin: .5em 0; 37 | overflow: auto; 38 | border-radius: 0.3em; 39 | } 40 | 41 | :not(pre) > code[class*="language-"], 42 | pre[class*="language-"] { 43 | background: #272822; 44 | } 45 | 46 | /* Inline code */ 47 | :not(pre) > code[class*="language-"] { 48 | padding: .1em; 49 | border-radius: .3em; 50 | white-space: normal; 51 | } 52 | 53 | .token.comment, 54 | .token.prolog, 55 | .token.doctype, 56 | .token.cdata { 57 | color: #8292a2; 58 | } 59 | 60 | .token.punctuation { 61 | color: #f8f8f2; 62 | } 63 | 64 | .token.namespace { 65 | opacity: .7; 66 | } 67 | 68 | .token.property, 69 | .token.tag, 70 | .token.constant, 71 | .token.symbol, 72 | .token.deleted { 73 | color: #f92672; 74 | } 75 | 76 | .token.boolean, 77 | .token.number { 78 | color: #ae81ff; 79 | } 80 | 81 | .token.selector, 82 | .token.attr-name, 83 | .token.string, 84 | .token.char, 85 | .token.builtin, 86 | .token.inserted { 87 | color: #a6e22e; 88 | } 89 | 90 | .token.operator, 91 | .token.entity, 92 | .token.url, 93 | .language-css .token.string, 94 | .style .token.string, 95 | .token.variable { 96 | color: #f8f8f2; 97 | } 98 | 99 | .token.atrule, 100 | .token.attr-value, 101 | .token.function, 102 | .token.class-name { 103 | color: #e6db74; 104 | } 105 | 106 | .token.keyword { 107 | color: #66d9ef; 108 | } 109 | 110 | .token.regex, 111 | .token.important { 112 | color: #fd971f; 113 | } 114 | 115 | .token.important, 116 | .token.bold { 117 | font-weight: bold; 118 | } 119 | .token.italic { 120 | font-style: italic; 121 | } 122 | 123 | .token.entity { 124 | cursor: help; 125 | } 126 | 127 | pre[class*="language-"].line-numbers { 128 | position: relative; 129 | padding-left: 3.8em; 130 | counter-reset: linenumber; 131 | } 132 | 133 | pre[class*="language-"].line-numbers > code { 134 | position: relative; 135 | white-space: inherit; 136 | } 137 | 138 | .line-numbers .line-numbers-rows { 139 | position: absolute; 140 | pointer-events: none; 141 | top: 0; 142 | font-size: 100%; 143 | left: -3.8em; 144 | width: 3em; /* works for line-numbers below 1000 lines */ 145 | letter-spacing: -1px; 146 | border-right: 1px solid #999; 147 | 148 | -webkit-user-select: none; 149 | -moz-user-select: none; 150 | -ms-user-select: none; 151 | user-select: none; 152 | 153 | } 154 | 155 | .line-numbers-rows > span { 156 | display: block; 157 | counter-increment: linenumber; 158 | } 159 | 160 | .line-numbers-rows > span:before { 161 | content: counter(linenumber); 162 | color: #999; 163 | display: block; 164 | padding-right: 0.8em; 165 | text-align: right; 166 | } 167 | 168 | -------------------------------------------------------------------------------- /src/main/resources/static/lib/scrollTo/jquery.scrollTo.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery.scrollTo 3 | * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler 4 | * Licensed under MIT 5 | * https://github.com/flesler/jquery.scrollTo 6 | * @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery 7 | * @author Ariel Flesler 8 | * @version 2.1.3 9 | */ 10 | ;(function(factory) { 11 | 'use strict'; 12 | if (typeof define === 'function' && define.amd) { 13 | // AMD 14 | define(['jquery'], factory); 15 | } else if (typeof module !== 'undefined' && module.exports) { 16 | // CommonJS 17 | module.exports = factory(require('jquery')); 18 | } else { 19 | // Global 20 | factory(jQuery); 21 | } 22 | })(function($) { 23 | 'use strict'; 24 | 25 | var $scrollTo = $.scrollTo = function(target, duration, settings) { 26 | return $(window).scrollTo(target, duration, settings); 27 | }; 28 | 29 | $scrollTo.defaults = { 30 | axis:'xy', 31 | duration: 0, 32 | limit:true 33 | }; 34 | 35 | function isWin(elem) { 36 | return !elem.nodeName || 37 | $.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1; 38 | } 39 | 40 | function isFunction(obj) { 41 | // Brought from jQuery since it's deprecated 42 | return typeof obj === 'function' 43 | } 44 | 45 | $.fn.scrollTo = function(target, duration, settings) { 46 | if (typeof duration === 'object') { 47 | settings = duration; 48 | duration = 0; 49 | } 50 | if (typeof settings === 'function') { 51 | settings = { onAfter:settings }; 52 | } 53 | if (target === 'max') { 54 | target = 9e9; 55 | } 56 | 57 | settings = $.extend({}, $scrollTo.defaults, settings); 58 | // Speed is still recognized for backwards compatibility 59 | duration = duration || settings.duration; 60 | // Make sure the settings are given right 61 | var queue = settings.queue && settings.axis.length > 1; 62 | if (queue) { 63 | // Let's keep the overall duration 64 | duration /= 2; 65 | } 66 | settings.offset = both(settings.offset); 67 | settings.over = both(settings.over); 68 | 69 | return this.each(function() { 70 | // Null target yields nothing, just like jQuery does 71 | if (target === null) return; 72 | 73 | var win = isWin(this), 74 | elem = win ? this.contentWindow || window : this, 75 | $elem = $(elem), 76 | targ = target, 77 | attr = {}, 78 | toff; 79 | 80 | switch (typeof targ) { 81 | // A number will pass the regex 82 | case 'number': 83 | case 'string': 84 | if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) { 85 | targ = both(targ); 86 | // We are done 87 | break; 88 | } 89 | // Relative/Absolute selector 90 | targ = win ? $(targ) : $(targ, elem); 91 | /* falls through */ 92 | case 'object': 93 | if (targ.length === 0) return; 94 | // DOMElement / jQuery 95 | if (targ.is || targ.style) { 96 | // Get the real position of the target 97 | toff = (targ = $(targ)).offset(); 98 | } 99 | } 100 | 101 | var offset = isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset; 102 | 103 | $.each(settings.axis.split(''), function(i, axis) { 104 | var Pos = axis === 'x' ? 'Left' : 'Top', 105 | pos = Pos.toLowerCase(), 106 | key = 'scroll' + Pos, 107 | prev = $elem[key](), 108 | max = $scrollTo.max(elem, axis); 109 | 110 | if (toff) {// jQuery / DOMElement 111 | attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]); 112 | 113 | // If it's a dom element, reduce the margin 114 | if (settings.margin) { 115 | attr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0; 116 | attr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0; 117 | } 118 | 119 | attr[key] += offset[pos] || 0; 120 | 121 | if (settings.over[pos]) { 122 | // Scroll to a fraction of its width/height 123 | attr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos]; 124 | } 125 | } else { 126 | var val = targ[pos]; 127 | // Handle percentage values 128 | attr[key] = val.slice && val.slice(-1) === '%' ? 129 | parseFloat(val) / 100 * max 130 | : val; 131 | } 132 | 133 | // Number or 'number' 134 | if (settings.limit && /^\d+$/.test(attr[key])) { 135 | // Check the limits 136 | attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max); 137 | } 138 | 139 | // Don't waste time animating, if there's no need. 140 | if (!i && settings.axis.length > 1) { 141 | if (prev === attr[key]) { 142 | // No animation needed 143 | attr = {}; 144 | } else if (queue) { 145 | // Intermediate animation 146 | animate(settings.onAfterFirst); 147 | // Don't animate this axis again in the next iteration. 148 | attr = {}; 149 | } 150 | } 151 | }); 152 | 153 | animate(settings.onAfter); 154 | 155 | function animate(callback) { 156 | var opts = $.extend({}, settings, { 157 | // The queue setting conflicts with animate() 158 | // Force it to always be true 159 | queue: true, 160 | duration: duration, 161 | complete: callback && function() { 162 | callback.call(elem, targ, settings); 163 | } 164 | }); 165 | $elem.animate(attr, opts); 166 | } 167 | }); 168 | }; 169 | 170 | // Max scrolling position, works on quirks mode 171 | // It only fails (not too badly) on IE, quirks mode. 172 | $scrollTo.max = function(elem, axis) { 173 | var Dim = axis === 'x' ? 'Width' : 'Height', 174 | scroll = 'scroll'+Dim; 175 | 176 | if (!isWin(elem)) 177 | return elem[scroll] - $(elem)[Dim.toLowerCase()](); 178 | 179 | var size = 'client' + Dim, 180 | doc = elem.ownerDocument || elem.document, 181 | html = doc.documentElement, 182 | body = doc.body; 183 | 184 | return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]); 185 | }; 186 | 187 | function both(val) { 188 | return isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val }; 189 | } 190 | 191 | // Add special hooks so that window scroll properties can be animated 192 | $.Tween.propHooks.scrollLeft = 193 | $.Tween.propHooks.scrollTop = { 194 | get: function(t) { 195 | return $(t.elem)[t.prop](); 196 | }, 197 | set: function(t) { 198 | var curr = this.get(t); 199 | // If interrupt is true and user scrolled, stop animating 200 | if (t.options.interrupt && t._last && t._last !== curr) { 201 | return $(t.elem).stop(); 202 | } 203 | var next = Math.round(t.now); 204 | // Don't waste CPU 205 | // Browsers don't render floating point scroll 206 | if (curr !== next) { 207 | $(t.elem)[t.prop](next); 208 | t._last = this.get(t); 209 | } 210 | } 211 | }; 212 | 213 | // AMD requirement 214 | return $scrollTo; 215 | }); 216 | -------------------------------------------------------------------------------- /src/main/resources/static/lib/scrollTo/jquery.scrollTo.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler 3 | * Licensed under MIT 4 | * @author Ariel Flesler 5 | * @version 2.1.3 6 | */ 7 | ;(function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else if(typeof module!=='undefined'&&module.exports){module.exports=factory(require('jquery'))}else{factory(jQuery)}})(function($){'use strict';var $scrollTo=$.scrollTo=function(target,duration,settings){return $(window).scrollTo(target,duration,settings)};$scrollTo.defaults={axis:'xy',duration:0,limit:true};function isWin(elem){return!elem.nodeName||$.inArray(elem.nodeName.toLowerCase(),['iframe','#document','html','body'])!==-1}function isFunction(obj){return typeof obj==='function'}$.fn.scrollTo=function(target,duration,settings){if(typeof duration==='object'){settings=duration;duration=0}if(typeof settings==='function'){settings={onAfter:settings}}if(target==='max'){target=9e9}settings=$.extend({},$scrollTo.defaults,settings);duration=duration||settings.duration;var queue=settings.queue&&settings.axis.length>1;if(queue){duration/=2}settings.offset=both(settings.offset);settings.over=both(settings.over);return this.each(function(){if(target===null){return}var win=isWin(this),elem=win?this.contentWindow||window:this,$elem=$(elem),targ=target,attr={},toff;switch(typeof targ){case 'number':case 'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=win?$(targ):$(targ,elem);case 'object':if(targ.length===0){return}if(targ.is||targ.style){toff=(targ=$(targ)).offset()}}var offset=isFunction(settings.offset)&&settings.offset(elem,targ)||settings.offset;$.each(settings.axis.split(''),function(i,axis){var Pos=axis==='x'?'Left':'Top',pos=Pos.toLowerCase(),key='scroll'+Pos,prev=$elem[key](),max=$scrollTo.max(elem,axis);if(toff){attr[key]=toff[pos]+(win?0:prev-$elem.offset()[pos]);if(settings.margin){attr[key]-=parseInt(targ.css('margin'+Pos),10)||0;attr[key]-=parseInt(targ.css('border'+Pos+'Width'),10)||0}attr[key]+=offset[pos]||0;if(settings.over[pos]){attr[key]+=targ[axis==='x'?'width':'height']()*settings.over[pos]}}else{var val=targ[pos];attr[key]=val.slice&&val.slice(-1)==='%'?parseFloat(val)/100*max:val}if(settings.limit&&/^\d+$/.test(attr[key])){attr[key]=attr[key]<=0?0:Math.min(attr[key],max)}if(!i&&settings.axis.length>1){if(prev===attr[key]){attr={}}else if(queue){animate(settings.onAfterFirst);attr={}}}});animate(settings.onAfter);function animate(callback){var opts=$.extend({},settings,{queue:true,duration:duration,complete:callback&&function(){callback.call(elem,targ,settings)}});$elem.animate(attr,opts)}})};$scrollTo.max=function(elem,axis){var Dim=axis==='x'?'Width':'Height',scroll='scroll'+Dim;if(!isWin(elem)){return elem[scroll]-$(elem)[Dim.toLowerCase()]()}var size='client'+Dim,doc=elem.ownerDocument||elem.document,html=doc.documentElement,body=doc.body;return Math.max(html[scroll],body[scroll])-Math.min(html[size],body[size])};function both(val){return isFunction(val)||$.isPlainObject(val)?val:{top:val,left:val}}$.Tween.propHooks.scrollLeft=$.Tween.propHooks.scrollTop={get:function(t){return $(t.elem)[t.prop]()},set:function(t){var curr=this.get(t);if(t.options.interrupt&&t._last&&t._last!==curr){return $(t.elem).stop()}var next=Math.round(t.now);if(curr!==next){$(t.elem)[t.prop](next);t._last=this.get(t)}}};return $scrollTo}); 8 | -------------------------------------------------------------------------------- /src/main/resources/static/lib/tocbot/tocbot.css: -------------------------------------------------------------------------------- 1 | .toc { 2 | overflow-y: auto 3 | } 4 | 5 | .toc > .toc-list { 6 | overflow: hidden; 7 | position: relative 8 | } 9 | 10 | .toc > .toc-list li { 11 | list-style: none 12 | } 13 | 14 | .toc-list { 15 | list-style-type: none; 16 | margin: 0; 17 | padding-left: 10px 18 | } 19 | 20 | .toc-list li a { 21 | display: block; 22 | padding: 4px 0; 23 | font-weight: 300 24 | } 25 | 26 | .toc-list li a:hover { 27 | color: blue; 28 | } 29 | 30 | a.toc-link { 31 | color: currentColor; 32 | height: 100% 33 | } 34 | 35 | .is-collapsible { 36 | max-height: 1000px; 37 | overflow: hidden; 38 | transition: all 300ms ease-in-out 39 | } 40 | 41 | .is-collapsed { 42 | max-height: 0 43 | } 44 | 45 | .is-position-fixed { 46 | position: fixed !important; 47 | top: 0 48 | } 49 | 50 | .is-active-link { 51 | font-weight: 700; 52 | color: blue !important; 53 | } 54 | 55 | .toc-link::before { 56 | background-color: #EEE; 57 | content: ' '; 58 | display: inline-block; 59 | height: 0; 60 | left: 0; 61 | margin-top: -1px; 62 | position: absolute; 63 | width: 2px 64 | } 65 | 66 | .is-active-link::before { 67 | background-color: #54BC4B 68 | } 69 | -------------------------------------------------------------------------------- /src/main/resources/static/lib/tocbot/tocbot.js: -------------------------------------------------------------------------------- 1 | !function(e){var t={};function n(o){if(t[o])return t[o].exports;var l=t[o]={i:o,l:!1,exports:{}};return e[o].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(o,l,function(t){return e[t]}.bind(null,l));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){(function(o){var l,r,i;!function(o,s){r=[],l=function(e){"use strict";var t,o,l,r=n(2),i={},s={},c=n(3),a=n(4),u=n(5),d=!!(e&&e.document&&e.document.querySelector&&e.addEventListener);if("undefined"==typeof window&&!d)return;var f=Object.prototype.hasOwnProperty;function m(e,t,n){var o,l;return t||(t=250),function(){var r=n||this,i=+new Date,s=arguments;o&&ie.fixedSidebarOffset?-1===n.className.indexOf(e.positionFixedClass)&&(n.className+=r+e.positionFixedClass):n.className=n.className.split(r+e.positionFixedClass).join("")}();var c,a=i;if(l&&null!==document.querySelector(e.tocSelector)&&a.length>0){n.call(a,function(t,n){return function t(n){var o=0;return n!==document.querySelector(e.contentSelector&&null!=n)&&(o=n.offsetTop,e.hasInnerContainers&&(o+=t(n.offsetParent))),o}(t)>s+e.headingsOffset+10?(c=a[0===n?n:n-1],!0):n===a.length-1?(c=a[a.length-1],!0):void 0});var u=document.querySelector(e.tocSelector).querySelectorAll("."+e.linkClass);t.call(u,function(t){t.className=t.className.split(r+e.activeLinkClass).join("")});var d=document.querySelector(e.tocSelector).querySelectorAll("."+e.listItemClass);t.call(d,function(t){t.className=t.className.split(r+e.activeListItemClass).join("")});var f=document.querySelector(e.tocSelector).querySelector("."+e.linkClass+".node-name--"+c.nodeName+'[href="'+e.basePath+"#"+c.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/@])/g,"\\$1")+'"]');-1===f.className.indexOf(e.activeLinkClass)&&(f.className+=r+e.activeLinkClass);var m=f.parentNode;m&&-1===m.className.indexOf(e.activeListItemClass)&&(m.className+=r+e.activeListItemClass);var h=document.querySelector(e.tocSelector).querySelectorAll("."+e.listClass+"."+e.collapsibleClass);t.call(h,function(t){-1===t.className.indexOf(e.isCollapsedClass)&&(t.className+=r+e.isCollapsedClass)}),f.nextSibling&&-1!==f.nextSibling.className.indexOf(e.isCollapsedClass)&&(f.nextSibling.className=f.nextSibling.className.split(r+e.isCollapsedClass).join("")),function t(n){return-1!==n.className.indexOf(e.collapsibleClass)&&-1!==n.className.indexOf(e.isCollapsedClass)?(n.className=n.className.split(r+e.isCollapsedClass).join(""),t(n.parentNode.parentNode)):n}(f.parentNode.parentNode)}}}}},function(e,t){e.exports=function(e){var t=[].reduce;function n(e){return e[e.length-1]}function o(t){if(!(t instanceof window.HTMLElement))return t;if(e.ignoreHiddenElements&&(!t.offsetHeight||!t.offsetParent))return null;var n={id:t.id,children:[],nodeName:t.nodeName,headingLevel:function(e){return+e.nodeName.split("H").join("")}(t),textContent:e.headingLabelCallback?String(e.headingLabelCallback(t.textContent)):t.textContent.trim()};return e.includeHtml&&(n.childNodes=t.childNodes),e.headingObjectCallback?e.headingObjectCallback(n,t):n}return{nestHeadingsArray:function(l){return t.call(l,function(t,l){var r=o(l);return r&&function(t,l){for(var r=o(t),i=r.headingLevel,s=l,c=n(s),a=i-(c?c.headingLevel:0);a>0;)(c=n(s))&&void 0!==c.children&&(s=c.children),a--;i>=e.collapseDepth&&(r.isCollapsed=!0),s.push(r)}(r,t.nest),t},{nest:[]})},selectHeadings:function(t,n){var o=n;e.ignoreSelector&&(o=n.split(",").map(function(t){return t.trim()+":not("+e.ignoreSelector+")"}));try{return document.querySelector(t).querySelectorAll(o)}catch(e){return console.warn("Element not found: "+t),null}}}}},function(e,t){e.exports=function(e){var t=document.querySelector(e.tocSelector);if(t&&t.scrollHeight>t.clientHeight){var n=t.querySelector("."+e.activeListItemClass);n&&(t.scrollTop=n.offsetTop)}}},function(e,t){function n(e,t){var n=window.pageYOffset,o={duration:t.duration,offset:t.offset||0,callback:t.callback,easing:t.easing||d},l=document.querySelector('[id="'+decodeURI(e).split("#").join("")+'"]'),r=typeof e==="string"?o.offset+(e?l&&l.getBoundingClientRect().top||0:-(document.documentElement.scrollTop||document.body.scrollTop)):e,i=typeof o.duration==="function"?o.duration(r):o.duration,s,c;function a(e){c=e-s;window.scrollTo(0,o.easing(c,n,r,i));if(c0||"#"===e.href.charAt(e.href.length-1))&&(r(e.href)===l||r(e.href)+"#"===l)}(i.target)||i.target.className.indexOf("no-smooth-scroll")>-1||"#"===i.target.href.charAt(i.target.href.length-2)&&"!"===i.target.href.charAt(i.target.href.length-1)||-1===i.target.className.indexOf(e.linkClass))return;n(i.target.hash,{duration:t,offset:o,callback:function(){!function(e){var t=document.getElementById(e.substring(1));t&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}(i.target.hash)}})},!1)}()}}]); -------------------------------------------------------------------------------- /src/main/resources/static/lib/tocbot/tocbot.min.js: -------------------------------------------------------------------------------- 1 | !function(e){var t={};function n(o){if(t[o])return t[o].exports;var l=t[o]={i:o,l:!1,exports:{}};return e[o].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(o,l,function(t){return e[t]}.bind(null,l));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){(function(o){var l,r,i;!function(o,s){r=[],l=function(e){"use strict";var t,o,l,r=n(2),i={},s={},c=n(3),a=n(4),u=n(5),d=!!(e&&e.document&&e.document.querySelector&&e.addEventListener);if("undefined"==typeof window&&!d)return;var f=Object.prototype.hasOwnProperty;function m(e,t,n){var o,l;return t||(t=250),function(){var r=n||this,i=+new Date,s=arguments;o&&ie.fixedSidebarOffset?-1===n.className.indexOf(e.positionFixedClass)&&(n.className+=r+e.positionFixedClass):n.className=n.className.split(r+e.positionFixedClass).join("")}();var c,a=i;if(l&&null!==document.querySelector(e.tocSelector)&&a.length>0){n.call(a,function(t,n){return function t(n){var o=0;return n!==document.querySelector(e.contentSelector&&null!=n)&&(o=n.offsetTop,e.hasInnerContainers&&(o+=t(n.offsetParent))),o}(t)>s+e.headingsOffset+10?(c=a[0===n?n:n-1],!0):n===a.length-1?(c=a[a.length-1],!0):void 0});var u=document.querySelector(e.tocSelector).querySelectorAll("."+e.linkClass);t.call(u,function(t){t.className=t.className.split(r+e.activeLinkClass).join("")});var d=document.querySelector(e.tocSelector).querySelectorAll("."+e.listItemClass);t.call(d,function(t){t.className=t.className.split(r+e.activeListItemClass).join("")});var f=document.querySelector(e.tocSelector).querySelector("."+e.linkClass+".node-name--"+c.nodeName+'[href="'+e.basePath+"#"+c.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/@])/g,"\\$1")+'"]');-1===f.className.indexOf(e.activeLinkClass)&&(f.className+=r+e.activeLinkClass);var m=f.parentNode;m&&-1===m.className.indexOf(e.activeListItemClass)&&(m.className+=r+e.activeListItemClass);var h=document.querySelector(e.tocSelector).querySelectorAll("."+e.listClass+"."+e.collapsibleClass);t.call(h,function(t){-1===t.className.indexOf(e.isCollapsedClass)&&(t.className+=r+e.isCollapsedClass)}),f.nextSibling&&-1!==f.nextSibling.className.indexOf(e.isCollapsedClass)&&(f.nextSibling.className=f.nextSibling.className.split(r+e.isCollapsedClass).join("")),function t(n){return-1!==n.className.indexOf(e.collapsibleClass)&&-1!==n.className.indexOf(e.isCollapsedClass)?(n.className=n.className.split(r+e.isCollapsedClass).join(""),t(n.parentNode.parentNode)):n}(f.parentNode.parentNode)}}}}},function(e,t){e.exports=function(e){var t=[].reduce;function n(e){return e[e.length-1]}function o(t){if(!(t instanceof window.HTMLElement))return t;if(e.ignoreHiddenElements&&(!t.offsetHeight||!t.offsetParent))return null;var n={id:t.id,children:[],nodeName:t.nodeName,headingLevel:function(e){return+e.nodeName.split("H").join("")}(t),textContent:e.headingLabelCallback?String(e.headingLabelCallback(t.textContent)):t.textContent.trim()};return e.includeHtml&&(n.childNodes=t.childNodes),e.headingObjectCallback?e.headingObjectCallback(n,t):n}return{nestHeadingsArray:function(l){return t.call(l,function(t,l){var r=o(l);return r&&function(t,l){for(var r=o(t),i=r.headingLevel,s=l,c=n(s),a=i-(c?c.headingLevel:0);a>0;)(c=n(s))&&void 0!==c.children&&(s=c.children),a--;i>=e.collapseDepth&&(r.isCollapsed=!0),s.push(r)}(r,t.nest),t},{nest:[]})},selectHeadings:function(t,n){var o=n;e.ignoreSelector&&(o=n.split(",").map(function(t){return t.trim()+":not("+e.ignoreSelector+")"}));try{return document.querySelector(t).querySelectorAll(o)}catch(e){return console.warn("Element not found: "+t),null}}}}},function(e,t){e.exports=function(e){var t=document.querySelector(e.tocSelector);if(t&&t.scrollHeight>t.clientHeight){var n=t.querySelector("."+e.activeListItemClass);n&&(t.scrollTop=n.offsetTop)}}},function(e,t){function n(e,t){var n=window.pageYOffset,o={duration:t.duration,offset:t.offset||0,callback:t.callback,easing:t.easing||d},l=document.querySelector('[id="'+decodeURI(e).split("#").join("")+'"]'),r=typeof e==="string"?o.offset+(e?l&&l.getBoundingClientRect().top||0:-(document.documentElement.scrollTop||document.body.scrollTop)):e,i=typeof o.duration==="function"?o.duration(r):o.duration,s,c;function a(e){c=e-s;window.scrollTo(0,o.easing(c,n,r,i));if(c0||"#"===e.href.charAt(e.href.length-1))&&(r(e.href)===l||r(e.href)+"#"===l)}(i.target)||i.target.className.indexOf("no-smooth-scroll")>-1||"#"===i.target.href.charAt(i.target.href.length-2)&&"!"===i.target.href.charAt(i.target.href.length-1)||-1===i.target.className.indexOf(e.linkClass))return;n(i.target.hash,{duration:t,offset:o,callback:function(){!function(e){var t=document.getElementById(e.substring(1));t&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}(i.target.hash)}})},!1)}()}}]); -------------------------------------------------------------------------------- /src/main/resources/static/lib/waypoints/jquery.waypoints.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Waypoints - 4.0.1 3 | Copyright © 2011-2016 Caleb Troughton 4 | Licensed under the MIT license. 5 | https://github.com/imakewebthings/waypoints/blob/master/licenses.txt 6 | */ 7 | !function(){"use strict";function t(o){if(!o)throw new Error("No options passed to Waypoint constructor");if(!o.element)throw new Error("No element option passed to Waypoint constructor");if(!o.handler)throw new Error("No handler option passed to Waypoint constructor");this.key="waypoint-"+e,this.options=t.Adapter.extend({},t.defaults,o),this.element=this.options.element,this.adapter=new t.Adapter(this.element),this.callback=o.handler,this.axis=this.options.horizontal?"horizontal":"vertical",this.enabled=this.options.enabled,this.triggerPoint=null,this.group=t.Group.findOrCreate({name:this.options.group,axis:this.axis}),this.context=t.Context.findOrCreateByElement(this.options.context),t.offsetAliases[this.options.offset]&&(this.options.offset=t.offsetAliases[this.options.offset]),this.group.add(this),this.context.add(this),i[this.key]=this,e+=1}var e=0,i={};t.prototype.queueTrigger=function(t){this.group.queueTrigger(this,t)},t.prototype.trigger=function(t){this.enabled&&this.callback&&this.callback.apply(this,t)},t.prototype.destroy=function(){this.context.remove(this),this.group.remove(this),delete i[this.key]},t.prototype.disable=function(){return this.enabled=!1,this},t.prototype.enable=function(){return this.context.refresh(),this.enabled=!0,this},t.prototype.next=function(){return this.group.next(this)},t.prototype.previous=function(){return this.group.previous(this)},t.invokeAll=function(t){var e=[];for(var o in i)e.push(i[o]);for(var n=0,r=e.length;r>n;n++)e[n][t]()},t.destroyAll=function(){t.invokeAll("destroy")},t.disableAll=function(){t.invokeAll("disable")},t.enableAll=function(){t.Context.refreshAll();for(var e in i)i[e].enabled=!0;return this},t.refreshAll=function(){t.Context.refreshAll()},t.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight},t.viewportWidth=function(){return document.documentElement.clientWidth},t.adapters=[],t.defaults={context:window,continuous:!0,enabled:!0,group:"default",horizontal:!1,offset:0},t.offsetAliases={"bottom-in-view":function(){return this.context.innerHeight()-this.adapter.outerHeight()},"right-in-view":function(){return this.context.innerWidth()-this.adapter.outerWidth()}},window.Waypoint=t}(),function(){"use strict";function t(t){window.setTimeout(t,1e3/60)}function e(t){this.element=t,this.Adapter=n.Adapter,this.adapter=new this.Adapter(t),this.key="waypoint-context-"+i,this.didScroll=!1,this.didResize=!1,this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()},this.waypoints={vertical:{},horizontal:{}},t.waypointContextKey=this.key,o[t.waypointContextKey]=this,i+=1,n.windowContext||(n.windowContext=!0,n.windowContext=new e(window)),this.createThrottledScrollHandler(),this.createThrottledResizeHandler()}var i=0,o={},n=window.Waypoint,r=window.onload;e.prototype.add=function(t){var e=t.options.horizontal?"horizontal":"vertical";this.waypoints[e][t.key]=t,this.refresh()},e.prototype.checkEmpty=function(){var t=this.Adapter.isEmptyObject(this.waypoints.horizontal),e=this.Adapter.isEmptyObject(this.waypoints.vertical),i=this.element==this.element.window;t&&e&&!i&&(this.adapter.off(".waypoints"),delete o[this.key])},e.prototype.createThrottledResizeHandler=function(){function t(){e.handleResize(),e.didResize=!1}var e=this;this.adapter.on("resize.waypoints",function(){e.didResize||(e.didResize=!0,n.requestAnimationFrame(t))})},e.prototype.createThrottledScrollHandler=function(){function t(){e.handleScroll(),e.didScroll=!1}var e=this;this.adapter.on("scroll.waypoints",function(){(!e.didScroll||n.isTouch)&&(e.didScroll=!0,n.requestAnimationFrame(t))})},e.prototype.handleResize=function(){n.Context.refreshAll()},e.prototype.handleScroll=function(){var t={},e={horizontal:{newScroll:this.adapter.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.adapter.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};for(var i in e){var o=e[i],n=o.newScroll>o.oldScroll,r=n?o.forward:o.backward;for(var s in this.waypoints[i]){var a=this.waypoints[i][s];if(null!==a.triggerPoint){var l=o.oldScroll=a.triggerPoint,p=l&&h,u=!l&&!h;(p||u)&&(a.queueTrigger(r),t[a.group.id]=a.group)}}}for(var c in t)t[c].flushTriggers();this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}},e.prototype.innerHeight=function(){return this.element==this.element.window?n.viewportHeight():this.adapter.innerHeight()},e.prototype.remove=function(t){delete this.waypoints[t.axis][t.key],this.checkEmpty()},e.prototype.innerWidth=function(){return this.element==this.element.window?n.viewportWidth():this.adapter.innerWidth()},e.prototype.destroy=function(){var t=[];for(var e in this.waypoints)for(var i in this.waypoints[e])t.push(this.waypoints[e][i]);for(var o=0,n=t.length;n>o;o++)t[o].destroy()},e.prototype.refresh=function(){var t,e=this.element==this.element.window,i=e?void 0:this.adapter.offset(),o={};this.handleScroll(),t={horizontal:{contextOffset:e?0:i.left,contextScroll:e?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:e?0:i.top,contextScroll:e?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};for(var r in t){var s=t[r];for(var a in this.waypoints[r]){var l,h,p,u,c,d=this.waypoints[r][a],f=d.options.offset,w=d.triggerPoint,y=0,g=null==w;d.element!==d.element.window&&(y=d.adapter.offset()[s.offsetProp]),"function"==typeof f?f=f.apply(d):"string"==typeof f&&(f=parseFloat(f),d.options.offset.indexOf("%")>-1&&(f=Math.ceil(s.contextDimension*f/100))),l=s.contextScroll-s.contextOffset,d.triggerPoint=Math.floor(y+l-f),h=w=s.oldScroll,u=h&&p,c=!h&&!p,!g&&u?(d.queueTrigger(s.backward),o[d.group.id]=d.group):!g&&c?(d.queueTrigger(s.forward),o[d.group.id]=d.group):g&&s.oldScroll>=d.triggerPoint&&(d.queueTrigger(s.forward),o[d.group.id]=d.group)}}return n.requestAnimationFrame(function(){for(var t in o)o[t].flushTriggers()}),this},e.findOrCreateByElement=function(t){return e.findByElement(t)||new e(t)},e.refreshAll=function(){for(var t in o)o[t].refresh()},e.findByElement=function(t){return o[t.waypointContextKey]},window.onload=function(){r&&r(),e.refreshAll()},n.requestAnimationFrame=function(e){var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t;i.call(window,e)},n.Context=e}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}function i(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),o[this.axis][this.name]=this}var o={vertical:{},horizontal:{}},n=window.Waypoint;i.prototype.add=function(t){this.waypoints.push(t)},i.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},i.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;s>r;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},i.prototype.next=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints),o=i===this.waypoints.length-1;return o?null:this.waypoints[i+1]},i.prototype.previous=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},i.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},i.prototype.remove=function(t){var e=n.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},i.prototype.first=function(){return this.waypoints[0]},i.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},i.findOrCreate=function(t){return o[t.axis][t.name]||new i(t)},n.Group=i}(),function(){"use strict";function t(t){this.$element=e(t)}var e=window.jQuery,i=window.Waypoint;e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,t)}}),e.each(["extend","inArray","isEmptyObject"],function(i,o){t[o]=e[o]}),i.adapters.push({name:"jquery",Adapter:t}),i.Adapter=t}(),function(){"use strict";function t(t){return function(){var i=[],o=arguments[0];return t.isFunction(arguments[0])&&(o=t.extend({},arguments[1]),o.handler=arguments[0]),this.each(function(){var n=t.extend({},o,{element:this});"string"==typeof n.context&&(n.context=t(this).closest(n.context)[0]),i.push(new e(n))}),i}}var e=window.Waypoint;window.jQuery&&(window.jQuery.fn.waypoint=t(window.jQuery)),window.Zepto&&(window.Zepto.fn.waypoint=t(window.Zepto))}(); -------------------------------------------------------------------------------- /src/main/resources/templates/admin/bill-details.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 订单结果 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 34 |
35 |
36 | 52 | 53 | 54 | 55 |
56 |
57 |

订单详情

58 | 59 |
60 |
61 |
62 |

订单号:  

63 |
64 |
65 |

10569744

66 |
67 |
68 |
69 | 70 |
71 |
72 |
73 |

结算时间:  

74 |
75 |
76 |

2021-6-17  22:25

78 |
79 |
80 |
81 | 82 |
84 |
85 |
86 |

商品名:  [[${billDetail.goods.name}]]

87 |
88 |
89 |

数量:  [[${billDetail.salesCount}]]

90 |
91 |
92 |
93 |
94 |
95 |
96 |

70 元

98 |
99 |
100 |
101 | 102 | 103 |
104 |
105 |
106 |

应付金额:  

107 |
108 |
109 |

1056 元

110 |
111 |
112 |
113 | 114 |
115 |
116 |
117 |

实付金额:  

118 |
119 |
120 |

1200 元

121 |
122 |
123 |
124 | 125 |
126 |
127 |
128 |

找零金额:  

129 |
130 |
131 |

144 元

133 |
134 |
135 |
136 | 137 | 138 |
139 |
140 | 141 |
142 |
143 | 144 | 145 | 146 | 147 | 148 | 206 | 207 | -------------------------------------------------------------------------------- /src/main/resources/templates/admin/bill-payment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 订单结算 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 34 |
35 |
36 | 37 | 53 | 54 | 55 |
56 |
57 | 58 |
59 | 60 | 61 | 62 |
63 | 64 |
提示:
65 |

操作成功

66 |
67 | 68 | 69 |
70 |
71 |
72 | 73 | 83 |
84 |
85 |
86 |
87 | 88 | 89 |
90 |
91 |
92 | 93 |
94 |
95 |
96 | 97 | 107 |
108 |
109 |
110 |
111 | 112 | 113 |
114 |
115 |
116 | 117 |
118 |
119 |
120 | 121 | 131 |
132 |
133 |
134 |
135 | 136 | 137 |
138 |
139 |
140 | 141 |
142 |
143 |
144 | 145 | 155 |
156 |
157 |
158 |
159 | 160 | 161 |
162 |
163 |
164 | 165 |
166 |
167 |
168 | 169 | 179 |
180 |
181 |
182 |
183 | 184 | 185 |
186 |
187 |
188 | 189 |
190 |
191 | 192 | 193 |
194 |
195 | 196 | 197 | 198 |
199 | 200 | 201 | 202 |
203 | 清空 204 | 205 |
206 | 207 |
208 | 209 |
210 |
211 | 212 |
213 |
214 | 215 | 216 | 217 | 218 | 219 | 242 | 243 | -------------------------------------------------------------------------------- /src/main/resources/templates/admin/daily-accounts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 账目日结 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 33 |
34 |
35 | 36 | 37 |
38 |
39 | 40 |
41 |
42 |
43 |

账目日结

44 |
45 |
46 | 共

104

天账目 47 |
48 |
49 |
50 | 51 | 52 |

2021

54 |
56 |
57 |
58 |

59 | 06-17 60 |

61 |
62 |
63 |

+ 1054 元

65 |
66 | 67 | 68 | 69 |
70 |
71 |
72 |

06-16

73 |
74 |
75 |

- 5050 元

76 |
77 |
78 |
79 |
80 |
81 |
82 |

06-15

83 |
84 |
85 |

+ 7094 元

86 |
87 |
88 |
89 | 90 | 91 |
92 |
93 | 94 | 95 |
96 |
97 | 98 |
99 |
100 | 101 | 102 | 103 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/main/resources/templates/admin/goods-input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 商品管理 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 34 |
35 |
36 | 52 | 53 | 54 | 55 |
56 |
57 | 58 |
60 | 61 | 62 | 63 |
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 | 101 |
102 |
103 | 104 |
105 |
106 | 107 | 108 |
109 |
110 |
111 |
112 | 113 | 114 |
115 |
116 |
117 |
118 | 119 | 120 |
121 |
122 | 123 | 124 |
125 | 126 | 127 | 128 |
129 | 130 | 131 |
132 | 133 |
134 | 135 |
136 |
137 | 138 |
139 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 204 | 205 | -------------------------------------------------------------------------------- /src/main/resources/templates/admin/goods.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 商品列表 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 33 |
34 |
35 | 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 | 84 | 85 | 86 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 141 | 142 | 143 | 144 | 145 |
商品名称分类供应商库存量进价售价操作
1快乐水饮料快乐水有限公司992.33.5 87 | 修改 88 | 删除 89 |
2辣条零食辣条有限公司2013.75.0 105 | 修改 106 | 删除 107 |
117 |
118 |
119 | 上一页 121 |
122 | 123 |
124 |

页,共 页,有 个商品

127 |
128 | 129 |
130 | 下一页 132 |
133 |
134 | 140 |
146 | 147 |
148 |
149 | 150 |
151 |
152 | 153 | 154 | 155 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /src/main/resources/templates/admin/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 超市进销存管理系统 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 | 89 | 90 | -------------------------------------------------------------------------------- /src/main/resources/templates/admin/suppliers-input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 供应商管理 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 33 |
34 |
35 | 51 | 52 | 53 | 54 |
55 |
56 | 57 |
59 | 60 | 61 | 62 |
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 | 103 |
104 | 105 |
106 |
107 | 108 |
109 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 153 | 154 | -------------------------------------------------------------------------------- /src/main/resources/templates/admin/suppliers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 供应商列表 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 33 |
34 |
35 | 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 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 134 | 135 | 136 | 137 | 138 |
供应商名称地址联系方式操作
1快乐水有限公司肇庆00147258369 83 | 修改 84 | 删除 85 |
2辣条有限公司广州01147258369 98 | 修改 99 | 删除 100 |
110 |
111 |
112 | 上一页 114 |
115 | 116 |
117 |

页,共 页,有 个供应商

120 |
121 | 122 |
123 | 下一页 125 |
126 |
127 | 133 |
139 | 140 |
141 |
142 | 143 |
144 |
145 | 146 | 147 | 157 | 158 | -------------------------------------------------------------------------------- /src/main/resources/templates/common.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/resources/templates/error/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 404 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 | 19 |
20 |
21 |
22 |

404

23 |

对不起,你访问的资源不存在

24 |
25 |
26 |
27 | 28 |
29 |
30 |
31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/resources/templates/error/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 500 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | 18 |
19 |
20 |
21 |

500

22 |

对不起,你访问的资源找不到

23 |
24 |
25 |
26 | 27 |
28 |
29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/resources/templates/error/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 错误 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 | -------------------------------------------------------------------------------- /src/test/java/com/bo/sims/SimsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims; 2 | 3 | import com.bo.sims.dao.UserMapper; 4 | import com.bo.sims.pojo.User; 5 | import com.bo.sims.service.UserService; 6 | import org.junit.jupiter.api.Test; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | 10 | @SpringBootTest 11 | class SimsApplicationTests { 12 | 13 | 14 | @Autowired 15 | UserService userService; 16 | 17 | @Test 18 | void contextLoads() { 19 | System.out.println(1); 20 | } 21 | 22 | @Test 23 | void test1(){ 24 | User user = userService.checkUser("admin", "123456"); 25 | System.out.println(user); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/com/bo/sims/test.java: -------------------------------------------------------------------------------- 1 | package com.bo.sims; 2 | 3 | import com.bo.sims.dao.GoodsMapper; 4 | import com.bo.sims.dao.SalesMapper; 5 | import com.bo.sims.pojo.Bill; 6 | import com.bo.sims.pojo.Goods; 7 | import com.bo.sims.pojo.Sales; 8 | import com.bo.sims.pojo.Supplier; 9 | import com.bo.sims.service.BillService; 10 | import com.bo.sims.service.GoodsService; 11 | import com.bo.sims.service.SupplierService; 12 | import com.bo.sims.vo.Settlement; 13 | import org.junit.jupiter.api.Test; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.boot.test.context.SpringBootTest; 16 | 17 | import javax.sql.DataSource; 18 | import java.math.BigDecimal; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | /** 23 | * @author Bo 24 | * @create 2021-06-18 11:47 25 | */ 26 | @SpringBootTest 27 | public class test { 28 | 29 | @Autowired 30 | SupplierService supplierService; 31 | 32 | @Autowired 33 | GoodsService goodsService; 34 | 35 | @Autowired 36 | GoodsMapper goodsMapper; 37 | 38 | @Autowired 39 | SalesMapper salesMapper; 40 | 41 | @Autowired 42 | BillService billService; 43 | 44 | @Autowired 45 | DataSource dataSource; 46 | 47 | @Test 48 | void test1(){ 49 | // Supplier sup1 = new Supplier(1L, "1号有限公司", "肇庆", 14725813697L); 50 | // Supplier sup2 = new Supplier(2L, "2号有限公司", "广州", 17554413697L); 51 | // Supplier sup3 = new Supplier(3L, "3号有限公司", "佛山", 19872581367L); 52 | // supplierService.saveSupplier(sup1); 53 | // supplierService.saveSupplier(sup2); 54 | // supplierService.saveSupplier(sup3); 55 | // supplierService.deleteById(2L); 56 | // Supplier sup4 = new Supplier(3L, "4号有限公司", "湛江", 13692581367L); 57 | // supplierService.updateSupplier(sup4); 58 | System.out.println(supplierService.getOneSupplierByName("4号有限公司")); 59 | System.out.println(); 60 | List list = supplierService.getAllSupplier(); 61 | for (Supplier supplier : list) { 62 | System.out.println(supplier); 63 | } 64 | } 65 | 66 | 67 | @Test 68 | void test2(){ 69 | List list = goodsService.getAllGoods(); 70 | for (Goods goods : list) { 71 | System.out.println(goods); 72 | } 73 | } 74 | 75 | @Test 76 | void test3(){ 77 | Goods goods1 = goodsService.getOneGoodsById(1L); 78 | Goods goods2 = goodsService.getOneGoodsByName("辣条"); 79 | 80 | System.out.println(goods1); 81 | System.out.println(goods2); 82 | } 83 | 84 | 85 | @Test 86 | void test4(){ 87 | // Goods goods1 = new Goods(1L, "面包", 40L, new BigDecimal(12.4), new BigDecimal(16.5), "食物", 7L, null); 88 | Goods goods2 = new Goods(2L, "牛奶", 980L, new BigDecimal(2.4), new BigDecimal(5.5), "饮料", 9L, null); 89 | goodsService.saveGoods(goods2); 90 | } 91 | 92 | @Test 93 | void test5(){ 94 | List list = goodsService.getAllGoodsBySupplierId(10L); 95 | for (Goods goods : list) { 96 | System.out.println(goods); 97 | } 98 | } 99 | 100 | @Test 101 | void test6(){ 102 | List list = salesMapper.getSalesBill(1L); 103 | for (Sales sales : list) { 104 | System.out.println(sales); 105 | } 106 | System.out.println(list.size()); 107 | } 108 | 109 | 110 | @Test 111 | void test7(){ 112 | BigDecimal price = goodsMapper.getSalePriceByIdAndCount(10L, 200L); 113 | System.out.println(price); 114 | } 115 | 116 | 117 | @Test 118 | void test8(){ 119 | Settlement settlement = new Settlement(2L, 10L, 2L, 10L, 2L, 10L, 2L, 10L, 2L, 10L, new BigDecimal("1000")); 120 | // List list = goodsService.getSalePriceAndUpdateCount(settlement); 121 | // System.out.println(list); 122 | List salesList = new ArrayList<>(); 123 | if (settlement.getGoodId1() != null){ 124 | salesList.add(new Sales(settlement.getGoodId1(),settlement.getSalesCount1())); 125 | } 126 | if (settlement.getGoodId2() != null){ 127 | salesList.add(new Sales(settlement.getGoodId2(),settlement.getSalesCount2())); 128 | } 129 | if (settlement.getGoodId3() != null){ 130 | salesList.add(new Sales(settlement.getGoodId3(),settlement.getSalesCount3())); 131 | } 132 | if (settlement.getGoodId4() != null){ 133 | salesList.add(new Sales(settlement.getGoodId4(),settlement.getSalesCount4())); 134 | } 135 | if (settlement.getGoodId5() != null){ 136 | salesList.add(new Sales(settlement.getGoodId5(),settlement.getSalesCount5())); 137 | } 138 | List list = goodsService.getSalePriceAndUpdateCount(salesList); 139 | 140 | System.out.println(list); 141 | } 142 | 143 | 144 | 145 | 146 | @Test 147 | void text9(){ 148 | System.out.println(dataSource.getClass()); 149 | } 150 | } 151 | --------------------------------------------------------------------------------