当前位置:   article > 正文

SSM ==> 超市管理系统(mysql)_超市管理系统mysql html

超市管理系统mysql html

局部页面效果

作者:赵橙晔

sql部分,如下


  1. /*
  2. Navicat Premium Data Transfer
  3. Source Server : mysql
  4. Source Server Type : MySQL
  5. Source Server Version : 50731
  6. Source Host : localhost:3306
  7. Source Schema : ssm2
  8. Target Server Type : MySQL
  9. Target Server Version : 50731
  10. File Encoding : 65001
  11. Date: 06/05/2022 14:52:03
  12. */
  13. SET NAMES utf8mb4;
  14. SET FOREIGN_KEY_CHECKS = 0;
  15. -- ----------------------------
  16. -- Table structure for goods
  17. -- ----------------------------
  18. DROP TABLE IF EXISTS `goods`;
  19. CREATE TABLE `goods` (
  20. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '货物的编号',
  21. `goodsName` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '货物的名字',
  22. `goodsNum` int(255) NULL DEFAULT NULL COMMENT '货物的数量',
  23. `goodsPrice` double(10, 2) NULL DEFAULT NULL COMMENT '货物的单价',
  24. `status` int(255) NULL DEFAULT 1,
  25. PRIMARY KEY (`id`) USING BTREE,
  26. INDEX `goodsName`(`goodsName`) USING BTREE,
  27. INDEX `quantity`(`goodsNum`) USING BTREE,
  28. INDEX `unitprice`(`goodsPrice`) USING BTREE
  29. ) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
  30. -- ----------------------------
  31. -- Records of goods
  32. -- ----------------------------
  33. INSERT INTO `goods` VALUES (1, '棒棒糖', 20000, 1.00, 1);
  34. INSERT INTO `goods` VALUES (2, '干脆面', 10000, 2.00, 1);
  35. INSERT INTO `goods` VALUES (4, '辣条', 34000, 5.00, 0);
  36. INSERT INTO `goods` VALUES (5, '口香糖', 20000, 6.00, 1);
  37. INSERT INTO `goods` VALUES (6, '沙琪玛', 30000, 7.00, 1);
  38. INSERT INTO `goods` VALUES (7, '大列巴', 20000, 10.00, 1);
  39. INSERT INTO `goods` VALUES (8, '迎春', 30000, 13.00, 1);
  40. INSERT INTO `goods` VALUES (9, '红塔山', 300000, 10.00, 1);
  41. INSERT INTO `goods` VALUES (10, '长白山', 2000, 10.00, 1);
  42. INSERT INTO `goods` VALUES (11, '小熊猫', 20000, 15.00, 1);
  43. INSERT INTO `goods` VALUES (12, '红金龙', 20000, 8.00, 1);
  44. INSERT INTO `goods` VALUES (13, '煊赫门', 23580, 18.00, 1);
  45. INSERT INTO `goods` VALUES (14, '黄鹤楼', 10000, 25.00, 1);
  46. INSERT INTO `goods` VALUES (15, '牡丹', 10000, 16.00, 1);
  47. INSERT INTO `goods` VALUES (16, '利群', 10000, 16.00, 1);
  48. INSERT INTO `goods` VALUES (17, '娇子', 10000, 11.00, 1);
  49. INSERT INTO `goods` VALUES (18, '中南海', 10000, 12.00, 1);
  50. INSERT INTO `goods` VALUES (19, '中华(硬)', 10000, 45.00, 1);
  51. INSERT INTO `goods` VALUES (20, '荷花(硬)', 2000, 34.00, 1);
  52. INSERT INTO `goods` VALUES (21, '房子', 20000, 300.00, 0);
  53. -- ----------------------------
  54. -- Table structure for permission
  55. -- ----------------------------
  56. DROP TABLE IF EXISTS `permission`;
  57. CREATE TABLE `permission` (
  58. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '权限的编号',
  59. `permissionName` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  60. `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  61. PRIMARY KEY (`id`) USING BTREE
  62. ) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
  63. -- ----------------------------
  64. -- Records of permission
  65. -- ----------------------------
  66. INSERT INTO `permission` VALUES (1, '修改普通用户', '/updateUser');
  67. INSERT INTO `permission` VALUES (2, '增加普通用户', '/addUser');
  68. INSERT INTO `permission` VALUES (3, '删除普通用户', '/deleteUser');
  69. INSERT INTO `permission` VALUES (4, '查看普通用户', '/findUser');
  70. INSERT INTO `permission` VALUES (5, '修改管理员用户', '/updateAdmin');
  71. INSERT INTO `permission` VALUES (6, '增加管理员用户', '/addAdmin');
  72. INSERT INTO `permission` VALUES (7, '删除管理员用户', '/deleteAdmin');
  73. INSERT INTO `permission` VALUES (8, '查看管理员用户', '/findAdmin');
  74. -- ----------------------------
  75. -- Table structure for role
  76. -- ----------------------------
  77. DROP TABLE IF EXISTS `role`;
  78. CREATE TABLE `role` (
  79. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '职位编号',
  80. `roleName` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  81. `roleDesc` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  82. `status` int(255) NULL DEFAULT NULL,
  83. PRIMARY KEY (`id`) USING BTREE
  84. ) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
  85. -- ----------------------------
  86. -- Records of role
  87. -- ----------------------------
  88. INSERT INTO `role` VALUES (1, '促销员', '负责销售货品', 1);
  89. INSERT INTO `role` VALUES (2, '理货员', '负责整理货品', 1);
  90. INSERT INTO `role` VALUES (3, '收银员', '负责给客户结账', 1);
  91. INSERT INTO `role` VALUES (5, '保安', '保卫平安,偷吃小熊饼干', 1);
  92. INSERT INTO `role` VALUES (6, '老板', '负责赚钱养家', 1);
  93. INSERT INTO `role` VALUES (7, '老板娘', '负责貌美如花', 1);
  94. INSERT INTO `role` VALUES (8, 'UXD设计师', '让程序改变的完美无瑕', 0);
  95. INSERT INTO `role` VALUES (9, '网红探店', '负责宣传杂货铺', 0);
  96. INSERT INTO `role` VALUES (10, '普通用户', '负责或者就好', 0);
  97. INSERT INTO `role` VALUES (11, '普通用户', '保安', 1);
  98. INSERT INTO `role` VALUES (12, '炼尸工', '冶炼自己', 0);
  99. -- ----------------------------
  100. -- Table structure for temp
  101. -- ----------------------------
  102. DROP TABLE IF EXISTS `temp`;
  103. CREATE TABLE `temp` (
  104. `id` int(11) NOT NULL AUTO_INCREMENT,
  105. `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  106. PRIMARY KEY (`id`) USING BTREE
  107. ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
  108. -- ----------------------------
  109. -- Records of temp
  110. -- ----------------------------
  111. INSERT INTO `temp` VALUES (1, '/dist/jsps/assets/images/temp01.jpg');
  112. INSERT INTO `temp` VALUES (2, '/dist/jsps/assets/images/temp02.jpg');
  113. -- ----------------------------
  114. -- Table structure for user
  115. -- ----------------------------
  116. DROP TABLE IF EXISTS `user`;
  117. CREATE TABLE `user` (
  118. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '用户编号',
  119. `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '用户名',
  120. `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '用户密码',
  121. `accountBalance` bigint(255) NULL DEFAULT NULL COMMENT '账户余额',
  122. `status` int(255) NULL DEFAULT NULL COMMENT '状态0关闭,1开启',
  123. PRIMARY KEY (`id`) USING BTREE,
  124. INDEX `username`(`username`) USING BTREE
  125. ) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
  126. -- ----------------------------
  127. -- Records of user
  128. -- ----------------------------
  129. INSERT INTO `user` VALUES (1, '张三', '123456', 200, 1);
  130. INSERT INTO `user` VALUES (2, '李四', '123456', 250, 1);
  131. -- ----------------------------
  132. -- Table structure for user_goods
  133. -- ----------------------------
  134. DROP TABLE IF EXISTS `user_goods`;
  135. CREATE TABLE `user_goods` (
  136. `userId` int(11) NOT NULL,
  137. `goodsId` int(11) NOT NULL,
  138. PRIMARY KEY (`userId`, `goodsId`) USING BTREE,
  139. INDEX `goodsId_id`(`goodsId`) USING BTREE,
  140. CONSTRAINT `goodsId_id` FOREIGN KEY (`goodsId`) REFERENCES `goods` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  141. CONSTRAINT `userId_id` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
  142. ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
  143. -- ----------------------------
  144. -- Records of user_goods
  145. -- ----------------------------
  146. INSERT INTO `user_goods` VALUES (2, 2);
  147. INSERT INTO `user_goods` VALUES (4, 5);
  148. INSERT INTO `user_goods` VALUES (9, 6);
  149. INSERT INTO `user_goods` VALUES (3, 7);
  150. INSERT INTO `user_goods` VALUES (10, 8);
  151. INSERT INTO `user_goods` VALUES (9, 11);
  152. INSERT INTO `user_goods` VALUES (11, 13);
  153. INSERT INTO `user_goods` VALUES (15, 16);
  154. INSERT INTO `user_goods` VALUES (19, 20);
  155. -- ----------------------------
  156. -- Table structure for user_role
  157. -- ----------------------------
  158. DROP TABLE IF EXISTS `user_role`;
  159. CREATE TABLE `user_role` (
  160. `userId` int(11) NOT NULL,
  161. `roleId` int(11) NOT NULL,
  162. PRIMARY KEY (`userId`, `roleId`) USING BTREE,
  163. INDEX `user_role_roleId`(`roleId`) USING BTREE,
  164. CONSTRAINT `user_role_roleId` FOREIGN KEY (`roleId`) REFERENCES `role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  165. CONSTRAINT `user_role_userId` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
  166. ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
  167. -- ----------------------------
  168. -- Records of user_role
  169. -- ----------------------------
  170. INSERT INTO `user_role` VALUES (1, 1);
  171. INSERT INTO `user_role` VALUES (4, 1);
  172. INSERT INTO `user_role` VALUES (6, 1);
  173. INSERT INTO `user_role` VALUES (1, 2);
  174. INSERT INTO `user_role` VALUES (2, 2);
  175. INSERT INTO `user_role` VALUES (5, 2);
  176. INSERT INTO `user_role` VALUES (8, 3);
  177. INSERT INTO `user_role` VALUES (19, 3);
  178. SET FOREIGN_KEY_CHECKS = 1;

文件分布式结构如下


web页面如下

index.jsp


  1. <html>
  2. <body>
  3. <%response.sendRedirect("http://localhost/login.jsp");%>
  4. </body>
  5. </html>

login.jsp

  1. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  2. <html>
  3. <head>
  4. <title>Flat Admin V.3 - Free flat-design bootstrap administrator templates</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta http-equiv="Content-Type" charset="UTF-8">
  7. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  8. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  9. <!-- Theme -->
  10. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  11. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  12. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  13. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  14. </head>
  15. <body>
  16. <div class="app app-default">
  17. <div class="app-container app-login">
  18. <div class="flex-center">
  19. <div class="app-header"></div>
  20. <div class="app-body">
  21. <div class="loader-container text-center">
  22. <div class="icon">
  23. <div class="sk-folding-cube">
  24. <div class="sk-cube1 sk-cube"></div>
  25. <div class="sk-cube2 sk-cube"></div>
  26. <div class="sk-cube4 sk-cube"></div>
  27. <div class="sk-cube3 sk-cube"></div>
  28. </div>
  29. </div>
  30. <div class="title">Logging in...</div>
  31. </div>
  32. <div class="app-block">
  33. <div class="app-form">
  34. <div class="form-header">
  35. <div class="app-brand"><span class="highlight">登录</span> 界面</div>
  36. </div>
  37. <form action="${pageContext.request.contextPath}/user/login" method="POST">
  38. <div class="input-group">
  39. <span class="input-group-addon" id="basic-addon1">
  40. <i class="fa fa-user" aria-hidden="true"></i></span>
  41. <input type="text" class="form-control" name="username" id="username" placeholder="Username" aria-describedby="basic-addon1">
  42. </div>
  43. <div class="input-group">
  44. <span class="input-group-addon" id="basic-addon2">
  45. <i class="fa fa-key" aria-hidden="true"></i></span>
  46. <input type="password" class="form-control" name="password" id="password" placeholder="Password" aria-describedby="basic-addon2">
  47. </div>
  48. <div class="text-center">
  49. <input type="submit" class="btn btn-success btn-submit" value="登录">
  50. <%-- <input type="submit" value="登录" >--%>
  51. </div>
  52. </form>
  53. <div class="form-line">
  54. <div class="title">OR</div>
  55. </div>
  56. <div class="form-footer">
  57. <button type="button" class="btn btn-default btn-sm btn-social __facebook">
  58. <div class="info">
  59. <i class="icon fa fa-facebook-official" aria-hidden="true"></i>
  60. <span class="title">其他登录方式</span>
  61. </div>
  62. </button>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="app-footer">
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </body>
  73. </html>

error页面


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <html>
  8. <head><title>Apache Tomcat/7.0.47 - Error report</title>
  9. <style><!--
  10. H1 {
  11. font-family: Tahoma, Arial, sans-serif;
  12. color: white;
  13. background-color: #525D76;
  14. font-size: 92px;
  15. }
  16. H2 {
  17. font-family: Tahoma, Arial, sans-serif;
  18. color: white;
  19. background-color: #525D76;
  20. font-size: 16px;
  21. }
  22. H3 {
  23. font-family: Tahoma, Arial, sans-serif;
  24. color: white;
  25. background-color: #525D76;
  26. font-size: 64px;
  27. }
  28. BODY {
  29. font-family: Tahoma, Arial, sans-serif;
  30. color: black;
  31. background-color: white;
  32. }
  33. B {
  34. font-family: Tahoma, Arial, sans-serif;
  35. color: white;
  36. background-color: #525D76;
  37. }
  38. P {
  39. font-family: Tahoma, Arial, sans-serif;
  40. background: white;
  41. color: black;
  42. font-size: 50px;
  43. }
  44. A {
  45. color: black;
  46. }
  47. A.name {
  48. color: black;
  49. }
  50. HR {
  51. color: #525D76;
  52. }
  53. --></style>
  54. </head>
  55. <body><h1>HTTP Status 250 - 万能错误页面</h1>
  56. <HR size="1" noshade="noshade">
  57. <p><b>type</b> Status report</p>
  58. <p><b>message</b> <u>org.apache.coyote.init</u></p>
  59. <p><b>description</b> <u>org.apache.coyote.AbstractProtocol init</u></p>
  60. <HR size="10" noshade="noshade">
  61. <h3>Apache Tomcat/7.0.47</h3></body>
  62. </html>

main.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@taglib prefix="security" uri="http://www.springframework.org/security/tags"%>
  7. <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" isELIgnored="false"%>
  8. <html>
  9. <head>
  10. <title>Home</title>
  11. <meta name="viewport" content="width=device-width, initial-scale=1">
  12. <meta http-equiv="Content-Type" charset="UTF-8">
  13. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  15. <!-- Theme -->
  16. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  20. </head>
  21. <body>
  22. <div class="app app-default">
  23. <aside class="app-sidebar" id="sidebar">
  24. <div class="sidebar-header">
  25. <a class="sidebar-brand" href="#"><span class="highlight">欢迎</span> 王琪</a>
  26. <button type="button" class="sidebar-toggle">
  27. <i class="fa fa-times"></i>
  28. </button>
  29. </div>
  30. <div class="sidebar-menu">
  31. <ul class="sidebar-nav">
  32. <li class="active">
  33. <a href="${pageContext.request.contextPath}/dist/jsps/main.jsp">
  34. <div class="icon">
  35. <i class="fa fa-tasks" aria-hidden="true"></i>
  36. </div>
  37. <div class="title">首页</div>
  38. </a>
  39. </li>
  40. <li class="@@menu.messaging">
  41. <a href="${pageContext.request.contextPath}/user/findAll?page=1&size=8">
  42. <div class="icon">
  43. <i class="fa fa-comments" aria-hidden="true"></i>
  44. </div>
  45. <div class="title">用户管理</div>
  46. </a>
  47. </li>
  48. <li class="@@menu.messaging ">
  49. <a href="${pageContext.request.contextPath}/role/findAll?page=1&size=8">
  50. <div class="icon">
  51. <i class="fa fa-cube" aria-hidden="true"></i>
  52. </div>
  53. <div class="title">职位管理</div>
  54. </a>
  55. </li>
  56. <li class="@@menu.messaging ">
  57. <a href="${pageContext.request.contextPath}/goods/findAll?page=1&size=8">
  58. <div class="icon">
  59. <i class="fa fa-cube" aria-hidden="true"></i>
  60. </div>
  61. <div class="title">货品管理</div>
  62. </a>
  63. </li>
  64. <li class="@@menu.messaging ">
  65. <a href="${pageContext.request.contextPath}/user/findUserAndGoodsById?userId=7">
  66. <div class="icon">
  67. <i class="fa fa-cube" aria-hidden="true"></i>
  68. </div>
  69. <div class="title">订单管理</div>
  70. </a>
  71. </li>
  72. </ul>
  73. </div>
  74. <div class="sidebar-footer">
  75. <ul class="menu">
  76. <li>
  77. <a href="/" class="dropdown-toggle" data-toggle="dropdown">
  78. <i class="fa fa-cogs" aria-hidden="true"></i>
  79. </a>
  80. </li>
  81. <li><a href="#"><span class="flag-icon flag-icon-th flag-icon-squared"></span></a></li>
  82. </ul>
  83. </div>
  84. </aside>
  85. <div class="app-container">
  86. <nav class="navbar navbar-default" id="navbar">
  87. <div class="container-fluid">
  88. <div class="navbar-collapse collapse in">
  89. <ul class="nav navbar-nav navbar-mobile">
  90. <li>
  91. <button type="button" class="sidebar-toggle">
  92. <i class="fa fa-bars"></i>
  93. </button>
  94. </li>
  95. <li class="logo">
  96. <a class="navbar-brand" href="#"><span class="highlight">欢迎</span> 王琪</a>
  97. </li>
  98. <li>
  99. <button type="button" class="navbar-toggle">
  100. <img class="profile-img" src="${pageContext.request.contextPath}/dist/jsps/assets/images/profile.png">
  101. </button>
  102. </li>
  103. </ul>
  104. <ul class="nav navbar-nav navbar-left">
  105. <li class="navbar-title"><span class="highlight">China soft</span><span>&nbsp;International</span></li>
  106. <li class="navbar-search hidden-sm">
  107. <input id="search" type="text" placeholder="Old eight..">
  108. <button class="btn-search"><i class="fa fa-search"></i></button>
  109. </li>
  110. </ul>
  111. <ul class="nav navbar-nav navbar-right">
  112. <li class="dropdown notification">
  113. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  114. <div class="icon"><i class="fa fa-shopping-basket" aria-hidden="true"></i></div>
  115. <div class="title">New Orders</div>
  116. <div class="count">0</div>
  117. </a>
  118. <div class="dropdown-menu">
  119. <ul>
  120. <li class="dropdown-header">Ordering</li>
  121. <li class="dropdown-empty">No New Ordered</li>
  122. <li class="dropdown-footer">
  123. <a href="#">View All <i class="fa fa-angle-right" aria-hidden="true"></i></a>
  124. </li>
  125. </ul>
  126. </div>
  127. </li>
  128. <li class="dropdown notification warning">
  129. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  130. <div class="icon"><i class="fa fa-comments" aria-hidden="true"></i></div>
  131. <div class="title">Unread Messages</div>
  132. <div class="count">99</div>
  133. </a>
  134. <div class="dropdown-menu">
  135. <ul>
  136. <li class="dropdown-header">Message</li>
  137. <li>
  138. <a href="#">
  139. <span class="badge badge-warning pull-right">10</span>
  140. <div class="message">
  141. <img class="profile" src="${pageContext.request.contextPath}https://placehold.it/100x100">
  142. <div class="content">
  143. <div class="title">"Payment Confirmation.."</div>
  144. <div class="description">Alan Anderson</div>
  145. </div>
  146. </div>
  147. </a>
  148. </li>
  149. <li>
  150. <a href="#">
  151. <span class="badge badge-warning pull-right">5</span>
  152. <div class="message">
  153. <img class="profile" src="https://placehold.it/100x100">
  154. <div class="content">
  155. <div class="title">"Hello World"</div>
  156. <div class="description">Marco Harmon</div>
  157. </div>
  158. </div>
  159. </a>
  160. </li>
  161. <li>
  162. <a href="#">
  163. <span class="badge badge-warning pull-right">2</span>
  164. <div class="message">
  165. <img class="profile" src=${pageContext.request.contextPath}"https://placehold.it/100x100">
  166. <div class="content">
  167. <div class="title">"Order Confirmation.."</div>
  168. <div class="description">Brenda Lawson</div>
  169. </div>
  170. </div>
  171. </a>
  172. </li>
  173. <li class="dropdown-footer">
  174. <a href="#">View All <i class="fa fa-angle-right" aria-hidden="true"></i></a>
  175. </li>
  176. </ul>
  177. </div>
  178. </li>
  179. <li class="dropdown notification danger">
  180. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  181. <div class="icon"><i class="fa fa-bell" aria-hidden="true"></i></div>
  182. <div class="title">System Notifications</div>
  183. <div class="count">10</div>
  184. </a>
  185. <div class="dropdown-menu">
  186. <ul>
  187. <li class="dropdown-header">Notification</li>
  188. <li>
  189. <a href="#">
  190. <span class="badge badge-danger pull-right">8</span>
  191. <div class="message">
  192. <div class="content">
  193. <div class="title">New Order</div>
  194. <div class="description">$400 total</div>
  195. </div>
  196. </div>
  197. </a>
  198. </li>
  199. <li>
  200. <a href="#">
  201. <span class="badge badge-danger pull-right">14</span>
  202. Inbox
  203. </a>
  204. </li>
  205. <li>
  206. <a href="#">
  207. <span class="badge badge-danger pull-right">5</span>
  208. Issues Report
  209. </a>
  210. </li>
  211. <li class="dropdown-footer">
  212. <a href="#">View All <i class="fa fa-angle-right" aria-hidden="true"></i></a>
  213. </li>
  214. </ul>
  215. </div>
  216. </li>
  217. <li class="dropdown profile">
  218. <a href="/html/pages/profile.html" class="dropdown-toggle" data-toggle="dropdown">
  219. <img class="profile-img" src="${pageContext.request.contextPath}/dist/jsps/assets/images/profile.png">
  220. <div class="title">Profile</div>
  221. </a>
  222. <div class="dropdown-menu">
  223. <div class="profile-info">
  224. <h4 class="username">Scott White</h4>
  225. </div>
  226. <ul class="action">
  227. <li>
  228. <a href="#">
  229. Profile
  230. </a>
  231. </li>
  232. <li>
  233. <a href="#">
  234. <span class="badge badge-danger pull-right">5</span>
  235. My Inbox
  236. </a>
  237. </li>
  238. <li>
  239. <a href="#">
  240. Setting
  241. </a>
  242. </li>
  243. <li>
  244. <a href="#">
  245. Logout
  246. </a>
  247. </li>
  248. </ul>
  249. </div>
  250. </li>
  251. </ul>
  252. </div>
  253. </div>
  254. </nav>
  255. <div class="row">
  256. <div class="col-xs-12">
  257. <img src="${pageContext.request.contextPath}/dist/jsps/assets/images/main.jpg" height="700" width="1280" style="margin-left: 5%;margin-right: 5%"/>
  258. </div>
  259. <script type="text/javascript" src="./assets/js/vendor.js"></script>
  260. <script type="text/javascript" src="./assets/js/app.js"></script>
  261. </div>
  262. </div>
  263. </div>
  264. </body>
  265. </html>

goods-add.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  8. <html>
  9. <head>
  10. <title>Home</title>
  11. <meta name="viewport" content="width=device-width, initial-scale=1">
  12. <meta http-equiv="Content-Type" charset="UTF-8">
  13. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  15. <!-- Theme -->
  16. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  20. </head>
  21. <body>
  22. <div class="app app-default">
  23. <%-- 引入左边栏--%>
  24. <jsp:include page="left.jsp"></jsp:include>
  25. <div class="app-container">
  26. <div class="row">
  27. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  28. <div class="card card-mini">
  29. <div class="card-header">
  30. <div class="card-title">
  31. <a href="${pageContext.request.contextPath}/goods/findAll?page=1&size=8"> <button style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">返回上一页</button></a>
  32. &nbsp; &nbsp; &nbsp;
  33. </div>
  34. </div>
  35. <form style="margin-left: 10%; margin-right: 10%;" action="${pageContext.request.contextPath}/goods/save" method="post">
  36. <div class="form-group">
  37. <input type="hidden" name="id" value="${goods.id}">
  38. <label for="exampleInputEmail1">货品名称</label>
  39. <input type="text" class="form-control" name="goodsName" id="username" value="${goods.goodsName}" placeholder="请输入货物名称">
  40. </div>
  41. <div class="form-group">
  42. <label for="exampleInputEmail1">货品数量</label>
  43. <input type="text" class="form-control" name="goodsNum" id="accountBalance" value="${goods.goodsNum}" placeholder="请输入货物数量">
  44. </div>
  45. <div class="form-group">
  46. <label for="exampleInputEmail1">货品单价</label>
  47. <input type="text" class="form-control" name="goodsPrice" id="exampleInputEmail1" value="${goods.goodsPrice}" placeholder="请输入货物单价">
  48. </div>
  49. <button style="margin-left: 40%;" type="submit" class="btn btn-default">保存</button>
  50. <button type="reset" class="btn btn-default">重置</button>
  51. </form>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <script type="text/javascript" src="../assets/js/vendor.js"></script>
  59. <script type="text/javascript" src="../assets/js/app.js"></script>
  60. </body>
  61. </html>

goods-list.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <title>Home</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1">
  13. <meta http-equiv="Content-Type" charset="UTF-8">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  16. <!-- Theme -->
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  21. </head>
  22. <body>
  23. <div class="app app-default">
  24. <%-- 引入左边栏--%>
  25. <jsp:include page="left.jsp"></jsp:include>
  26. <div class="app-container">
  27. <div class="row">
  28. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  29. <div class="card card-mini">
  30. <div class="card-header">
  31. <div class="card-title">
  32. <button onclick="location.href='${pageContext.request.contextPath}/dist/jsps/pages/goods-add.jsp'"
  33. style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">新建</button>
  34. &nbsp; &nbsp; <button
  35. onclick="location.href='${pageContext.request.contextPath}/goods/findAllGoods'"
  36. style="background-color: rgb(102, 175, 220); border:beige;color: rgb(243, 241, 238);">显示全部</button>
  37. </div>
  38. </div>
  39. <div class="card-body no-padding table-responsive">
  40. <table class="table card-table">
  41. <thead>
  42. <tr>
  43. <th>货品名称</th>
  44. <th class="right">货品数量</th>
  45. <th>货品单价</th>
  46. <th>购物车</th>
  47. <th>操作方式</th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <c:forEach items="${goodsList.list}" var="goodsList">
  52. <tr>
  53. <td>${goodsList.goodsName}</td>
  54. <td class="right">${goodsList.goodsNum}/个</td>
  55. <td><span class="badge badge-success badge-icon">
  56. <i class="fa fa-check" aria-hidden="true"></i>
  57. <span>${goodsList.goodsPrice}¥/个</span></span></td>
  58. <td><button onclick="location.href='${pageContext.request.contextPath}/user/addOrder?goodsId=${goodsList.id}&userId=3'"
  59. style="background-color: rgb(61, 210, 128);border: beige;color: beige;">添加到购物车</button></td>
  60. <td>
  61. <button onclick="location.href='${pageContext.request.contextPath}/goods/findGoodsById?goodsId=${goodsList.id}'"
  62. style="background-color: rgb(109, 207, 234); border:beige;color: rgb(250, 248, 243);">修 改</button>&nbsp;&nbsp;&nbsp;
  63. <button onclick="location.href='${pageContext.request.contextPath}/goods/deleteById?goodsId=${goodsList.id}'"
  64. style="background-color: rgb(208, 87, 46); border:beige;color: rgb(247, 245, 241);">删 除</button>
  65. </td>
  66. </tr>
  67. </c:forEach>
  68. </tbody>
  69. </table>
  70. </div>
  71. <div class="box-footer">
  72. <div class="pull-left">
  73. <div class="form-group form-inline">
  74. 总共${goodsList.pages} 页,共${goodsList.total} 条数据
  75. </div>
  76. </div>
  77. <div class="box-tools pull-right">
  78. <ul class="pagination">
  79. <li>
  80. <a href="${pageContext.request.contextPath}/gooods/findAll?page=1&size=${goodsList.pageSize}"
  81. aria-label="Previous">首页</a>
  82. </li>
  83. <li>
  84. <a href="${pageContext.request.contextPath}/goods/findAll?page=${goodsList.pageNum-1}&size=${goodsList.pageSize}">
  85. 上一页</a></li>
  86. <c:forEach begin="1" end="${goodsList.pages}" var="pageNum">
  87. <li>
  88. <a href="${pageContext.request.contextPath}/goods/findAll?page=${pageNum}&size=${goodsList.pageSize}">
  89. ${pageNum}</a></li>
  90. </c:forEach>
  91. <li>
  92. <a href="${pageContext.request.contextPath}/goods/findAll?page=${goodsList.pageNum+1}&size=${goodsList.pageSize}">下一页</a>
  93. </li>
  94. <li>
  95. <a href="${pageContext.request.contextPath}/goods/findAll?page=${goodsList.pages}&size=${goodsList.pageSize}"
  96. aria-label="Next">尾页</a>
  97. </li>
  98. </ul>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </body>
  107. </html>

goods-list-all.jsp

  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <title>Home</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1">
  13. <meta http-equiv="Content-Type" charset="UTF-8">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  16. <!-- Theme -->
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  21. </head>
  22. <body>
  23. <div class="app app-default">
  24. <%-- 引入左边栏--%>
  25. <jsp:include page="left.jsp"></jsp:include>
  26. <div class="app-container">
  27. <div class="row">
  28. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  29. <div class="card card-mini">
  30. <div class="card-header">
  31. <div class="card-title">
  32. <button onclick="location.href='${pageContext.request.contextPath}/dist/jsps/pages/goods-add.jsp'"
  33. style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">新建</button>
  34. &nbsp; &nbsp; <button
  35. onclick="location.href='${pageContext.request.contextPath}/goods/findAllGoods'"
  36. style="background-color: rgb(102, 175, 220); border:beige;color: rgb(243, 241, 238);">显示全部</button>
  37. </div>
  38. </div>
  39. <div class="card-body no-padding table-responsive">
  40. <table class="table card-table">
  41. <thead>
  42. <tr>
  43. <th>货品名称</th>
  44. <th class="right">货品数量</th>
  45. <th>货品单价</th>
  46. <th>购物车</th>
  47. <th>操作方式</th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <c:forEach items="${goodsList}" var="goodsList">
  52. <tr>
  53. <td>${goodsList.goodsName}</td>
  54. <td class="right">${goodsList.goodsNum}/个</td>
  55. <td><span class="badge badge-success badge-icon">
  56. <i class="fa fa-check" aria-hidden="true"></i>
  57. <span>${goodsList.goodsPrice}¥/个</span></span></td>
  58. <td><button onclick="location.href='${pageContext.request.contextPath}/user/addOrder?goodsId=${goodsList.id}&userId=3'"
  59. style="background-color: rgb(61, 210, 128);border: beige;color: beige;">添加到购物车</button></td>
  60. <td>
  61. <button onclick="location.href='${pageContext.request.contextPath}/goods/findRoleById?goodsId=${goodsList.id}'"
  62. style="background-color: rgb(109, 207, 234); border:beige;color: rgb(250, 248, 243);">修 改</button>&nbsp;&nbsp;&nbsp;
  63. <button onclick="location.href='${pageContext.request.contextPath}/goods/deleteById?goodsId=${goodsList.id}'"
  64. style="background-color: rgb(208, 87, 46); border:beige;color: rgb(247, 245, 241);">删 除</button>
  65. </td>
  66. </tr>
  67. </c:forEach>
  68. </tbody>
  69. </table>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <script type="text/javascript" src="../assets/js/vendor.js"></script>
  76. <script type="text/javascript" src="../assets/js/app.js"></script>
  77. </div>
  78. </div>
  79. </body>
  80. </html>

left.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <html>
  8. <head>
  9. <title>Title</title>
  10. </head>
  11. <body>
  12. <aside class="app-sidebar" id="sidebar">
  13. <div class="sidebar-header">
  14. <a class="sidebar-brand" href="#"><span class="highlight">欢迎</span> 王琪</a>
  15. <button type="button" class="sidebar-toggle">
  16. <i class="fa fa-times"></i>
  17. </button>
  18. </div>
  19. <div class="sidebar-menu">
  20. <ul class="sidebar-nav">
  21. <li class="active">
  22. <a href="${pageContext.request.contextPath}/dist/jsps/main.jsp">
  23. <div class="icon">
  24. <i class="fa fa-tasks" aria-hidden="true"></i>
  25. </div>
  26. <div class="title">首页</div>
  27. </a>
  28. </li>
  29. <li class="@@menu.messaging">
  30. <a href="${pageContext.request.contextPath}/user/findAll?page=1&size=8">
  31. <div class="icon">
  32. <i class="fa fa-comments" aria-hidden="true"></i>
  33. </div>
  34. <div class="title">用户管理</div>
  35. </a>
  36. </li>
  37. <li class="@@menu.messaging ">
  38. <a href="${pageContext.request.contextPath}/role/findAll?page=1&size=8">
  39. <div class="icon">
  40. <i class="fa fa-cube" aria-hidden="true"></i>
  41. </div>
  42. <div class="title">职位管理</div>
  43. </a>
  44. </li>
  45. <li class="@@menu.messaging ">
  46. <a href="${pageContext.request.contextPath}/goods/findAll?page=1&size=8">
  47. <div class="icon">
  48. <i class="fa fa-cube" aria-hidden="true"></i>
  49. </div>
  50. <div class="title">货品管理</div>
  51. </a>
  52. </li>
  53. <li class="@@menu.messaging ">
  54. <a href="${pageContext.request.contextPath}/user/findUserAndGoodsById?userId=7">
  55. <div class="icon">
  56. <i class="fa fa-cube" aria-hidden="true"></i>
  57. </div>
  58. <div class="title">订单管理</div>
  59. </a>
  60. </li>
  61. </ul>
  62. </div>
  63. <div class="sidebar-footer">
  64. <ul class="menu">
  65. <li>
  66. <a href="/" class="dropdown-toggle" data-toggle="dropdown">
  67. <i class="fa fa-cogs" aria-hidden="true"></i>
  68. </a>
  69. </li>
  70. <li><a href="#"><span class="flag-icon flag-icon-th flag-icon-squared"></span></a></li>
  71. </ul>
  72. </div>
  73. </aside>
  74. <script type="text/ng-template" id="sidebar-dropdown.tpl.html">
  75. <div class="dropdown-background">
  76. <div class="bg"></div>
  77. </div>
  78. <div class="dropdown-container">
  79. {{list}}
  80. </div>
  81. </script>
  82. </body>
  83. </html>

order-list


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  8. <%@ taglib prefix="out" uri="http://java.sun.com/jsp/jstl/core" %>
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12. <title>Home</title>
  13. <meta name="viewport" content="width=device-width, initial-scale=1">
  14. <meta http-equiv="Content-Type" charset="UTF-8">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  16. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  17. <!-- Theme -->
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  21. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  22. </head>
  23. <body>
  24. <div class="app app-default">
  25. <%-- 引入左边栏--%>
  26. <jsp:include page="left.jsp"></jsp:include>
  27. <div class="app-container">
  28. <div class="row">
  29. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  30. <div class="card card-mini">
  31. <div class="card-header">
  32. <div class="card-title">
  33. <a> <button style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">破产按钮</button></a>
  34. </div>
  35. </div>
  36. <div class="card-body no-padding table-responsive">
  37. <table class="table card-table">
  38. <thead>
  39. <tr>
  40. <th>订单编号</th>
  41. <th class="right">订单用户</th>
  42. <th>购买物品</th>
  43. <th>购买数量</th>
  44. <th>支付单价</th>
  45. <th>操作方式</th>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. <c:forEach items="${userList}" var="userList">
  50. <c:forEach items="${userList.goodsList}" var="goodsList">
  51. <tr>
  52. <td>zretc-wqzhp-${userList.id}-${goodsList.id}</td>
  53. <td class="right">${userList.username}</td>
  54. <td>${goodsList.goodsName}</td>
  55. <td>10个</td>
  56. <td><span class="badge badge-success badge-icon"><i class="fa fa-check" aria-hidden="true"></i><span>¥${goodsList.goodsPrice}</span></span></td>
  57. <td>
  58. <button onclick="location.href='${pageContext.request.contextPath}/user/findZhiFu?userId=${userList.id}&number=10&goodsPrice=${goodsList.goodsPrice}&goodsId=${goodsList.id}'"
  59. style="background-color: rgb(109, 207, 234); border:beige;color: rgb(250, 248, 243);">支 付</button>
  60. &nbsp;&nbsp;
  61. &nbsp;<button onclick="deleteOrder(${userList.id},${goodsList.id})"
  62. style="background-color: rgb(208, 87, 46); border:beige;color: rgb(247, 245, 241);">删 除</button>
  63. &nbsp;&nbsp;
  64. &nbsp;<button onclick="baoChang()"
  65. style="background-color: rgb(75,206,160); border:beige;color: rgb(247, 245, 241);">包 场</button></td>
  66. </tr>
  67. </c:forEach>
  68. </c:forEach>
  69. </tbody>
  70. </table>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <script type="text/javascript" src="${pageContext.request.contextPath}/dist/jsps/assets/js/vendor.js"></script>
  79. <script type="text/javascript" src="${pageContext.request.contextPath}/dist/jsps/assets/js/app.js"></script>
  80. <script>
  81. /**
  82. * 包场模块
  83. */
  84. function baoChang() {
  85. alert("After background calculation, you have not reached the strength of private field!!")
  86. }
  87. /**
  88. * 删除模块
  89. */
  90. function deleteOrder(userId,goodsId) {
  91. if (confirm("Are you sure you want to delete ?")) {
  92. window.location.href = "${pageContext.request.contextPath}/user/deleteOrder?userId="+userId+"&goodsId="+goodsId;
  93. }
  94. }
  95. </script>
  96. </body>
  97. </html>

role-add.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  8. <%@ taglib prefix="out" uri="http://java.sun.com/jsp/jstl/core" %>
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12. <title>Home</title>
  13. <meta name="viewport" content="width=device-width, initial-scale=1">
  14. <meta http-equiv="Content-Type" charset="UTF-8">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  16. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  17. <!-- Theme -->
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  21. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  22. </head>
  23. <body>
  24. <div class="app app-default">
  25. <%-- 引入左边栏--%>
  26. <jsp:include page="left.jsp"></jsp:include>
  27. <div class="app-container">
  28. <div class="row">
  29. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  30. <div class="card card-mini">
  31. <div class="card-header">
  32. <div class="card-title">
  33. <a> <button style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">破产按钮</button></a>
  34. </div>
  35. </div>
  36. <div class="card-body no-padding table-responsive">
  37. <table class="table card-table">
  38. <thead>
  39. <tr>
  40. <th>订单编号</th>
  41. <th class="right">订单用户</th>
  42. <th>购买物品</th>
  43. <th>购买数量</th>
  44. <th>支付单价</th>
  45. <th>操作方式</th>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. <c:forEach items="${userList}" var="userList">
  50. <c:forEach items="${userList.goodsList}" var="goodsList">
  51. <tr>
  52. <td>zretc-wqzhp-${userList.id}-${goodsList.id}</td>
  53. <td class="right">${userList.username}</td>
  54. <td>${goodsList.goodsName}</td>
  55. <td>10个</td>
  56. <td><span class="badge badge-success badge-icon"><i class="fa fa-check" aria-hidden="true"></i><span>¥${goodsList.goodsPrice}</span></span></td>
  57. <td>
  58. <button onclick="location.href='${pageContext.request.contextPath}/user/findZhiFu?userId=${userList.id}&number=10&goodsPrice=${goodsList.goodsPrice}&goodsId=${goodsList.id}'"
  59. style="background-color: rgb(109, 207, 234); border:beige;color: rgb(250, 248, 243);">支 付</button>
  60. &nbsp;&nbsp;
  61. &nbsp;<button onclick="deleteOrder(${userList.id},${goodsList.id})"
  62. style="background-color: rgb(208, 87, 46); border:beige;color: rgb(247, 245, 241);">删 除</button>
  63. &nbsp;&nbsp;
  64. &nbsp;<button onclick="baoChang()"
  65. style="background-color: rgb(75,206,160); border:beige;color: rgb(247, 245, 241);">包 场</button></td>
  66. </tr>
  67. </c:forEach>
  68. </c:forEach>
  69. </tbody>
  70. </table>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <script type="text/javascript" src="${pageContext.request.contextPath}/dist/jsps/assets/js/vendor.js"></script>
  79. <script type="text/javascript" src="${pageContext.request.contextPath}/dist/jsps/assets/js/app.js"></script>
  80. <script>
  81. /**
  82. * 包场模块
  83. */
  84. function baoChang() {
  85. alert("After background calculation, you have not reached the strength of private field!!")
  86. }
  87. /**
  88. * 删除模块
  89. */
  90. function deleteOrder(userId,goodsId) {
  91. if (confirm("Are you sure you want to delete ?")) {
  92. window.location.href = "${pageContext.request.contextPath}/user/deleteOrder?userId="+userId+"&goodsId="+goodsId;
  93. }
  94. }
  95. </script>
  96. </body>
  97. </html>

role-list.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <title>Home</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1">
  13. <meta http-equiv="Content-Type" charset="UTF-8">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  16. <!-- Theme -->
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  21. </head>
  22. <body>
  23. <div class="app app-default">
  24. <%-- 引入左边栏--%>
  25. <jsp:include page="left.jsp"></jsp:include>
  26. <div class="app-container">
  27. <div class="row">
  28. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  29. <div class="card card-mini">
  30. <div class="card-header">
  31. <div class="card-title">
  32. <button onclick="location.href='${pageContext.request.contextPath}/dist/jsps/pages/role-add.jsp'"
  33. style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">新建</button>
  34. &nbsp; &nbsp; <button
  35. onclick="location.href='${pageContext.request.contextPath}/role/findAllRole'"
  36. style="background-color: rgb(102, 175, 220); border:beige;color: rgb(243, 241, 238);">显示全部</button>
  37. </div>
  38. </div>
  39. <div class="card-body no-padding table-responsive">
  40. <table class="table card-table">
  41. <thead>
  42. <tr>
  43. <th>职位名称</th>
  44. <th>职位描述</th>
  45. <th>天作之合</th>
  46. <th>操作方式</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. <c:forEach items="${roleList.list}" var="roleList">
  51. <tr>
  52. <td>${roleList.roleName}</td>
  53. <td>${roleList.roleDesc}</td>
  54. <td><button onclick="location.href='${pageContext.request.contextPath}/role/addOrder?roleId=${roleList.id}&userId=1'"
  55. style="background-color: rgb(61, 210, 128);border: beige;color: beige;">入职通知命令</button></td>
  56. <td>
  57. <button onclick="location.href='${pageContext.request.contextPath}/role/findRoleById?roleId=${roleList.id}'"
  58. style="background-color: rgb(109, 207, 234); border:beige;color: rgb(250, 248, 243);">修 改</button>&nbsp;&nbsp;&nbsp;
  59. <button onclick="location.href='${pageContext.request.contextPath}/role/deleteById?roleId=${roleList.id}'"
  60. style="background-color: rgb(208, 87, 46); border:beige;color: rgb(247, 245, 241);">删 除</button>
  61. </td>
  62. </tr>
  63. </c:forEach>
  64. </tbody>
  65. </table>
  66. </div>
  67. <div class="box-footer">
  68. <div class="pull-left">
  69. <div class="form-group form-inline">
  70. 总共${roleList.pages} 页,共${roleList.total} 条数据
  71. </div>
  72. </div>
  73. <div class="box-tools pull-right">
  74. <ul class="pagination">
  75. <li>
  76. <a href="${pageContext.request.contextPath}/user/findAll?page=1&size=${roleList.pageSize}"
  77. aria-label="Previous">首页</a>
  78. </li>
  79. <li>
  80. <a href="${pageContext.request.contextPath}/user/findAll?page=${roleList.pageNum-1}&size=${roleList.pageSize}">
  81. 上一页</a></li>
  82. <c:forEach begin="1" end="${roleList.pages}" var="pageNum">
  83. <li>
  84. <a href="${pageContext.request.contextPath}/user/findAll?page=${pageNum}&size=${roleList.pageSize}">
  85. ${pageNum}</a></li>
  86. </c:forEach>
  87. <li>
  88. <a href="${pageContext.request.contextPath}/user/findAll?page=${roleList.pageNum+1}&size=${roleList.pageSize}">下一页</a>
  89. </li>
  90. <li>
  91. <a href="${pageContext.request.contextPath}/user/findAll?page=${roleList.pages}&size=${roleList.pageSize}"
  92. aria-label="Next">尾页</a>
  93. </li>
  94. </ul>
  95. </div>
  96. </div>
  97. </div>
  98. </div></div>
  99. </div>
  100. </div>
  101. <script type="text/javascript" src="${pageContext.request.contextPath}../assets/js/vendor.js"></script>
  102. <script type="text/javascript" src="${pageContext.request.contextPath}../assets/js/app.js"></script>
  103. </body>
  104. </html>

role-list-all.jsp

  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <title>Home</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1">
  13. <meta http-equiv="Content-Type" charset="UTF-8">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  16. <!-- Theme -->
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  21. </head>
  22. <body>
  23. <div class="app app-default">
  24. <aside class="app-sidebar" id="sidebar">
  25. <div class="sidebar-header">
  26. <a class="sidebar-brand" href="#"><span class="highlight">欢迎</span> Admin</a>
  27. <button type="button" class="sidebar-toggle">
  28. <i class="fa fa-times"></i>
  29. </button>
  30. </div>
  31. <div class="sidebar-menu">
  32. <ul class="sidebar-nav">
  33. <li class="active">
  34. <a href="${pageContext.request.contextPath}/dist/jsps/main.jsp">
  35. <div class="icon">
  36. <i class="fa fa-tasks" aria-hidden="true"></i>
  37. </div>
  38. <div class="title">首页</div>
  39. </a>
  40. </li>
  41. <li class="@@menu.messaging">
  42. <a href="${pageContext.request.contextPath}/user/findAll">
  43. <div class="icon">
  44. <i class="fa fa-comments" aria-hidden="true"></i>
  45. </div>
  46. <div class="title">用户管理</div>
  47. </a>
  48. </li>
  49. <li class="@@menu.messaging ">
  50. <a href="${pageContext.request.contextPath}/role/findAll">
  51. <div class="icon">
  52. <i class="fa fa-cube" aria-hidden="true"></i>
  53. </div>
  54. <div class="title">职位管理</div>
  55. </a>
  56. </li>
  57. <li class="@@menu.messaging ">
  58. <a href="${pageContext.request.contextPath}/goods/findAll?page=1&size=8"">
  59. <div class="icon">
  60. <i class="fa fa-cube" aria-hidden="true"></i>
  61. </div>
  62. <div class="title">货品管理</div>
  63. </a>
  64. </li>
  65. <li class="@@menu.messaging ">
  66. <a href="order-list.jsp">
  67. <div class="icon">
  68. <i class="fa fa-cube" aria-hidden="true"></i>
  69. </div>
  70. <div class="title">订单管理</div>
  71. </a>
  72. </li>
  73. </ul>
  74. </div>
  75. <div class="sidebar-footer">
  76. <ul class="menu">
  77. <li>
  78. <a href="/" class="dropdown-toggle" data-toggle="dropdown">
  79. <i class="fa fa-cogs" aria-hidden="true"></i>
  80. </a>
  81. </li>
  82. <li><a href="#"><span class="flag-icon flag-icon-th flag-icon-squared"></span></a></li>
  83. </ul>
  84. </div>
  85. </aside>
  86. <%-- 引入左边栏--%>
  87. <jsp:include page="left.jsp"></jsp:include>
  88. <div class="app-container">
  89. <div class="row">
  90. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  91. <div class="card card-mini">
  92. <div class="card-header">
  93. <div class="card-title">
  94. <button onclick="location.href='${pageContext.request.contextPath}/dist/jsps/pages/role-add.jsp'"
  95. style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">新建</button>
  96. &nbsp; &nbsp; <button
  97. onclick="location.href='${pageContext.request.contextPath}/role/findAllRole'"
  98. style="background-color: rgb(102, 175, 220); border:beige;color: rgb(243, 241, 238);">显示全部</button>
  99. </div>
  100. </div>
  101. <div class="card-body no-padding table-responsive">
  102. <table class="table card-table">
  103. <thead>
  104. <tr>
  105. <th>职位名称</th>
  106. <th>职位描述</th>
  107. <th>天作之合</th>
  108. <th>操作方式</th>
  109. </tr>
  110. </thead>
  111. <tbody>
  112. <c:forEach items="${roleList.list}" var="roleList">
  113. <tr>
  114. <td>${roleList.roleName}</td>
  115. <td>${roleList.roleDesc}</td>
  116. <td><button onclick="location.href='${pageContext.request.contextPath}/role/addOrder?roleId=${roleList.id}&userId=1'"
  117. style="background-color: rgb(61, 210, 128);border: beige;color: beige;">入职通知命令</button></td>
  118. <td>
  119. <button onclick="location.href='${pageContext.request.contextPath}/role/findRoleById?roleId=${roleList.id}'"
  120. style="background-color: rgb(109, 207, 234); border:beige;color: rgb(250, 248, 243);">修 改</button>&nbsp;&nbsp;&nbsp;
  121. <button onclick="location.href='${pageContext.request.contextPath}/role/deleteById?roleId=${roleList.id}'"
  122. style="background-color: rgb(208, 87, 46); border:beige;color: rgb(247, 245, 241);">删 除</button>
  123. </td>
  124. </tr>
  125. </c:forEach>
  126. </tbody>
  127. </table>
  128. </div>
  129. </div>
  130. </div></div>
  131. </div>
  132. </div>
  133. <script type="text/javascript" src="${pageContext.request.contextPath}../assets/js/vendor.js"></script>
  134. <script type="text/javascript" src="${pageContext.request.contextPath}../assets/js/app.js"></script>
  135. </body>
  136. </html>

temp.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <title>Home</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1">
  13. <meta http-equiv="Content-Type" charset="UTF-8">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  16. <!-- Theme -->
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  21. </head>
  22. <body>
  23. <div class="app app-default">
  24. <%-- 引入左边栏--%>
  25. <jsp:include page="left.jsp"></jsp:include>
  26. <div class="app-container">
  27. <div class="row">
  28. <table class="table table-condensed">
  29. <h1 style="text-align: center">离婚信息详情表</h1>
  30. <tr>
  31. <th></th>
  32. <th></th>
  33. <th></th>
  34. <th></th>
  35. <th>照片</th>
  36. <th>姓名</th>
  37. <th></th>
  38. </tr>
  39. <tr>
  40. <th></th>
  41. <th></th>
  42. <th></th>
  43. <th></th>
  44. <td>
  45. <c:forEach items="${tempList}" var="temp">
  46. <img src="${pageContext.request.contextPath}${temp.url}" width="213px" height="320px">
  47. </c:forEach>
  48. </td>
  49. <td>王 琪</td>
  50. <th></th>
  51. </tr>
  52. <tr>
  53. <th></th>
  54. <th></th>
  55. <th></th>
  56. <th></th>
  57. <th>学历</th>
  58. <th>智商</th>
  59. <th></th>
  60. </tr>
  61. <tr>
  62. <th></th>
  63. <th></th>
  64. <th></th>
  65. <th></th>
  66. <td>卡塞尔学院研究生毕业</td>
  67. <td>IQ:156</td>
  68. <th></th>
  69. </tr>
  70. <tr>
  71. <tr>
  72. <th></th>
  73. <th></th>
  74. <th></th>
  75. <th></th>
  76. <th>操作</th>
  77. <th>步骤</th>
  78. <th></th>
  79. </tr>
  80. <tr>
  81. <th></th>
  82. <th></th>
  83. <th></th>
  84. <th></th>
  85. <td>
  86. <button onclick="location.href='${pageContext.request.contextPath}/login/findAllTemp?id=2'"
  87. style="background-color: rgba(22,146,168,0.9); border:beige;color: rgb(247, 245, 241);">切 换</button>
  88. </td>
  89. <td>
  90. <input type="file">
  91. </td>
  92. <th></th>
  93. </tr>
  94. </table>
  95. </div>
  96. </div>
  97. </div>
  98. </body>
  99. </html>

temp-list.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="multipart/form-data;charset=utf-8" />
  10. <title>Title</title>
  11. </head>
  12. <body>
  13. <form action="/temp/save" method="post" enctype="multipart/form-data">
  14. <label class="layui-form-label">请选择上传图片:
  15. <input type="file" name="pictureFile" class="layui-upload-file"></label>
  16. <input type="submit" value="提交">
  17. </form>
  18. </body>
  19. </html>

user.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  8. <html>
  9. <head>
  10. <title>Home</title>
  11. <meta name="viewport" content="width=device-width, initial-scale=1">
  12. <meta http-equiv="Content-Type" charset="UTF-8">
  13. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  15. <!-- Theme -->
  16. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  20. </head>
  21. <body>
  22. <div class="app app-default">
  23. <%-- 引入左边栏--%>
  24. <jsp:include page="left.jsp"></jsp:include>
  25. <div class="app-container">
  26. <div class="row">
  27. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  28. <div class="card card-mini">
  29. <div class="card-header">
  30. <div class="card-title">
  31. <a href="user-list.html"> <button style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">返回上一页</button></a>
  32. &nbsp; &nbsp; &nbsp;
  33. </div>
  34. </div>
  35. <%-- <table class="table table-striped">--%>
  36. <%-- <tr>--%>
  37. <%-- <td>头像</td>--%>
  38. <%-- <td></td>--%>
  39. <%-- <td></td>--%>
  40. <%-- </tr>--%>
  41. <%-- </table>--%>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </body>
  49. </html>

user-add.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  8. <html>
  9. <head>
  10. <title>Home</title>
  11. <meta name="viewport" content="width=device-width, initial-scale=1">
  12. <meta http-equiv="Content-Type" charset="UTF-8">
  13. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  15. <!-- Theme -->
  16. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  20. </head>
  21. <body>
  22. <div class="app app-default">
  23. <%-- 引入左边栏--%>
  24. <jsp:include page="left.jsp"></jsp:include>
  25. <div class="app-container">
  26. <div class="row">
  27. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  28. <div class="card card-mini">
  29. <div class="card-header">
  30. <div class="card-title">
  31. <a href="user-list.html"> <button style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">返回上一页</button></a>
  32. &nbsp; &nbsp; &nbsp;
  33. </div>
  34. </div>
  35. <form style="margin-left: 10%; margin-right: 10%;" action="${pageContext.request.contextPath}/user/save" method="post">
  36. <div class="form-group">
  37. <input type="hidden" name="id" value="${user.id}">
  38. <label for="exampleInputEmail1">用户名</label>
  39. <input type="text" class="form-control" name="username" id="username" value="${user.username}" placeholder="请输入用户名">
  40. </div>
  41. <div class="form-group">
  42. <label for="password">账户信息</label>
  43. <input type="password" class="form-control" name="password" id="password" value="${user.password}" placeholder="请输入密码">
  44. </div>
  45. <div class="form-group">
  46. <label for="exampleInputEmail1">账户余额</label>
  47. <input type="text" class="form-control" name="accountBalance" id="accountBalance" value="${user.accountBalance}" placeholder=""请输入账户余额>
  48. </div>
  49. <div class="form-group">
  50. <label for="exampleInputEmail1">类别</label>
  51. <input type="text" class="form-control" id="exampleInputEmail1" value="普通用户" placeholder="">
  52. </div>
  53. <button style="margin-left: 40%;" type="submit" class="btn btn-default">保存</button>
  54. <button type="reset" class="btn btn-default">重置</button>
  55. </form>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <script type="text/javascript" src="../assets/js/vendor.js"></script>
  63. <script type="text/javascript" src="../assets/js/app.js"></script>
  64. </body>
  65. </html>

user-list.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <title>Home</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1">
  13. <meta http-equiv="Content-Type" charset="UTF-8">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  16. <!-- Theme -->
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  21. </head>
  22. <body>
  23. <div class="app app-default">
  24. <%-- 引入左边栏--%>
  25. <jsp:include page="left.jsp"></jsp:include>
  26. <div class="app-container">
  27. <div class="row">
  28. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  29. <div class="card card-mini">
  30. <div class="card-header">
  31. <div class="card-title">
  32. <button onclick="location.href='${pageContext.request.contextPath}/dist/jsps/pages/user-add.jsp'"
  33. style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">新建</button>
  34. &nbsp; &nbsp; <button
  35. onclick="location.href='${pageContext.request.contextPath}/user/findAllUser'"
  36. style="background-color: rgb(102, 175, 220); border:beige;color: rgb(243, 241, 238);">显示全部</button>
  37. </div>
  38. <%-- <ul class="card-action">--%>
  39. <%-- <li>--%>
  40. <%-- <input style="width: 250px;height: 30px" placeholder="这是一个输入框">--%>
  41. <%-- </li>--%>
  42. <%-- </ul>--%>
  43. </div>
  44. <div class="card-body no-padding table-responsive">
  45. <table class="table card-table">
  46. <thead>
  47. <tr>
  48. <th>用户名</th>
  49. <th class="right">账户信息</th>
  50. <th>账户余额</th>
  51. <th>类别</th>
  52. <th>操作方式</th>
  53. </tr>
  54. </thead>
  55. <tbody>
  56. <tr>
  57. <td>王琪</td>
  58. <td class="right">******</td>
  59. <td><span class="badge badge-success badge-icon"><i class="fa fa-check" aria-hidden="true"></i><span>¥∞</span></span></td>
  60. <td>老板娘</td>
  61. <td>
  62. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  63. <button onclick="location.href='${pageContext.request.contextPath}/login/findAllTemp?id=1'"
  64. style="background-color: #e56932; border:beige; color: rgb(246,244,240);width: 80px;height: 25px;">离婚</button>
  65. </td>
  66. </tr>
  67. <c:forEach items="${userList.list}" var="userList">
  68. <tr>
  69. <td>${userList.username}</td>
  70. <td class="right">******</td>
  71. <td><span class="badge badge-success badge-icon"><i class="fa fa-check" aria-hidden="true"></i><span>¥${userList.accountBalance}</span></span></td>
  72. <td>普通用户</td>
  73. <td>
  74. <button onclick="location.href='${pageContext.request.contextPath}/user/findUserById?userId=${userList.id}'"
  75. style="background-color: rgb(109, 207, 234); border:beige;color: rgb(250, 248, 243);">修 改</button>&nbsp;&nbsp;&nbsp;
  76. <button onclick="location.href='${pageContext.request.contextPath}/user/deleteById?userId=${userList.id}'"
  77. style="background-color: rgb(208, 87, 46); border:beige;color: rgb(247, 245, 241);">删 除</button>
  78. </td>
  79. </tr>
  80. </c:forEach>
  81. </tbody>
  82. </table>
  83. </div>
  84. <div class="box-footer">
  85. <div class="pull-left">
  86. <div class="form-group form-inline">
  87. 总共${userList.pages} 页,共${userList.total} 条数据
  88. </div>
  89. </div>
  90. <div class="box-tools pull-right">
  91. <ul class="pagination">
  92. <li>
  93. <a href="${pageContext.request.contextPath}/user/findAll?page=1&size=${userList.pageSize}"
  94. aria-label="Previous">首页</a>
  95. </li>
  96. <li>
  97. <a href="${pageContext.request.contextPath}/user/findAll?page=${userList.pageNum-1}&size=${userList.pageSize}">
  98. 上一页</a></li>
  99. <c:forEach begin="1" end="${userList.pages}" var="pageNum">
  100. <li>
  101. <a href="${pageContext.request.contextPath}/user/findAll?page=${pageNum}&size=${userList.pageSize}">
  102. ${pageNum}</a></li>
  103. </c:forEach>
  104. <li>
  105. <a href="${pageContext.request.contextPath}/user/findAll?page=${userList.pageNum+1}&size=${userList.pageSize}">下一页</a>
  106. </li>
  107. <li>
  108. <a href="${pageContext.request.contextPath}/user/findAll?page=${userList.pages}&size=${userList.pageSize}"
  109. aria-label="Next">尾页</a>
  110. </li>
  111. </ul>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. <script>
  118. </script>
  119. </div>
  120. </div>
  121. </body>
  122. </html>

user-list-all.jsp


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <title>Home</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1">
  13. <meta http-equiv="Content-Type" charset="UTF-8">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  16. <!-- Theme -->
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  21. </head>
  22. <body>
  23. <div class="app app-default">
  24. <jsp:include page="left.jsp"></jsp:include>
  25. <div class="app-container">
  26. <div class="row">
  27. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  28. <div class="card card-mini">
  29. <div class="card-header">
  30. <div class="card-title">
  31. <a> <button onclick="location.href='${pageContext.request.contextPath}/dist/jsps/pages/user-add.jsp'"
  32. style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">新建</button></a>
  33. &nbsp; &nbsp; <button
  34. onclick="location.href='${pageContext.request.contextPath}/user/findAllUser'"
  35. style="background-color: rgb(102, 175, 220); border:beige;color: rgb(243, 241, 238);">显示全部</button></a>
  36. </div>
  37. <%-- <ul class="card-action">--%>
  38. <%-- <li>--%>
  39. <%-- <input style="width: 250px;height: 30px" placeholder="这是一个输入框">--%>
  40. <%-- </li>--%>
  41. <%-- </ul>--%>
  42. </div>
  43. <div class="card-body no-padding table-responsive">
  44. <table class="table card-table">
  45. <thead>
  46. <tr>
  47. <th>用户名</th>
  48. <th class="right">账户信息</th>
  49. <th>账户余额</th>
  50. <th>类别</th>
  51. <th>操作方式</th>
  52. </tr>
  53. </thead>
  54. <tbody>
  55. <tr>
  56. <td>王琪</td>
  57. <td class="right">******</td>
  58. <td><span class="badge badge-success badge-icon"><i class="fa fa-check" aria-hidden="true"></i><span>¥∞</span></span></td>
  59. <td>老板娘</td>
  60. <td>
  61. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  62. <button onclick="location.href='${pageContext.request.contextPath}/login/findAllTemp?id=1'"
  63. style="background-color: #e56932; border:beige; color: rgb(246,244,240);width: 80px;height: 25px;">离婚</button>
  64. </td>
  65. </tr>
  66. <c:forEach items="${userList}" var="userList">
  67. <tr>
  68. <td>${userList.username}</td>
  69. <td class="right">******</td>
  70. <td><span class="badge badge-success badge-icon"><i class="fa fa-check" aria-hidden="true"></i><span>¥${userList.accountBalance}</span></span></td>
  71. <td>普通用户</td>
  72. <td>
  73. <button onclick="location.href='${pageContext.request.contextPath}/user/findUserAndRoleById?userId=${userList.id}'"
  74. style="background-color: rgb(47, 197, 107); border:beige; color: rgb(246, 244, 240);">职位</button>
  75. <button onclick="location.href='${pageContext.request.contextPath}/user/findUserById?userId=${userList.id}'"
  76. style="background-color: rgb(109, 207, 234); border:beige;color: rgb(250, 248, 243);">修 改</button>&nbsp;&nbsp;&nbsp;
  77. <button onclick="location.href='${pageContext.request.contextPath}/user/deleteById?userId=${userList.id}'"
  78. style="background-color: rgb(208, 87, 46); border:beige;color: rgb(247, 245, 241);">删 除</button>
  79. </td>
  80. </tr>
  81. </c:forEach>
  82. </tbody>
  83. </table>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <script>
  89. </script>
  90. </div>
  91. </div>
  92. </body>
  93. </html>

user-role-list


  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 86176
  4. To change this template use File | Settings | File Templates.
  5. --%>
  6. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  7. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <title>Home</title>
  12. <meta name="viewport" content="width=device-width, initial-scale=1">
  13. <meta http-equiv="Content-Type" charset="UTF-8">
  14. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/vendor.css">
  15. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/flat-admin.css">
  16. <!-- Theme -->
  17. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue-sky.css">
  18. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/blue.css">
  19. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/red.css">
  20. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/dist/jsps/assets/css/theme/yellow.css">
  21. </head>
  22. <body>
  23. <div class="app app-default">
  24. <%-- 引入左边栏--%>
  25. <jsp:include page="left.jsp"></jsp:include>
  26. <div class="app-container">
  27. <div class="row">
  28. <table class="table table-condensed">
  29. <h1 style="text-align: center">职位信息详情表</h1>
  30. <tr>
  31. <td>编号</td>
  32. <td>职位</td>
  33. <td>任务</td>
  34. <th>操作</th>
  35. </tr>
  36. <c:forEach items="${roleList}" var="roleList">
  37. <tr>
  38. <td>**</td>
  39. <td>${roleList.roleName}</td>
  40. <td>${roleList.roleDesc}</td>
  41. <td>
  42. <button onclick=" deleteUserRole(${roleList.id},${userId})"location.href='${pageContext.request.contextPath}/user/deleteUserRoleById?roleId=${roleList.id}&userId=${userId}'"
  43. style="background-color: rgb(208, 87, 46); border:beige;color: rgb(247, 245, 241);">删 除</button>
  44. </td>
  45. </tr>
  46. </c:forEach>
  47. </table>
  48. </div>
  49. </div>
  50. </div>
  51. <script>
  52. /**
  53. * 删除模块
  54. */
  55. function deleteUserRole(roleId,userId) {
  56. if (confirm("Are you sure you want to delete ?")) {
  57. window.location.href = "${pageContext.request.contextPath}/user/deleteUserRoleById?roleId="+roleId+"&userId="+userId;
  58. }
  59. }
  60. </script>
  61. </body>
  62. </html>

后端代码如下


pom文件


  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.0</modelVersion>
  6. <groupId>com.zretc</groupId>
  7. <artifactId>SSM_Project</artifactId>
  8. <packaging>pom</packaging>
  9. <version>1.0-SNAPSHOT</version>
  10. <properties>
  11. <spring.version>5.0.2.RELEASE</spring.version>
  12. <slf4j.version>1.6.6</slf4j.version>
  13. <log4j.version>1.2.12</log4j.version>
  14. <oracle.version>11.2.0.1.0</oracle.version>
  15. <mybatis.version>3.4.5</mybatis.version>
  16. <spring.security.version>5.0.1.RELEASE</spring.security.version>
  17. </properties>
  18. <dependencies>
  19. <!-- spring -->
  20. <dependency>
  21. <groupId>org.aspectj</groupId>
  22. <artifactId>aspectjweaver</artifactId>
  23. <version>1.6.8</version>
  24. </dependency>
  25. <dependency>
  26. <groupId>org.springframework</groupId>
  27. <artifactId>spring-aop</artifactId>
  28. <version>${spring.version}</version>
  29. </dependency>
  30. <dependency>
  31. <groupId>org.springframework</groupId>
  32. <artifactId>spring-context</artifactId>
  33. <version>${spring.version}</version>
  34. </dependency>
  35. <dependency>
  36. <groupId>org.springframework</groupId>
  37. <artifactId>spring-context-support</artifactId>
  38. <version>${spring.version}</version>
  39. </dependency>
  40. <dependency>
  41. <groupId>org.springframework</groupId>
  42. <artifactId>spring-web</artifactId>
  43. <version>${spring.version}</version>
  44. </dependency>
  45. <dependency>
  46. <groupId>org.springframework</groupId>
  47. <artifactId>spring-orm</artifactId>
  48. <version>${spring.version}</version>
  49. </dependency>
  50. <dependency>
  51. <groupId>org.springframework</groupId>
  52. <artifactId>spring-beans</artifactId>
  53. <version>${spring.version}</version>
  54. </dependency>
  55. <dependency>
  56. <groupId>org.springframework</groupId>
  57. <artifactId>spring-core</artifactId>
  58. <version>${spring.version}</version>
  59. </dependency>
  60. <dependency>
  61. <groupId>org.springframework</groupId>
  62. <artifactId>spring-test</artifactId>
  63. <version>${spring.version}</version>
  64. </dependency>
  65. <dependency>
  66. <groupId>org.springframework</groupId>
  67. <artifactId>spring-webmvc</artifactId>
  68. <version>${spring.version}</version>
  69. </dependency>
  70. <dependency>
  71. <groupId>org.springframework</groupId>
  72. <artifactId>spring-tx</artifactId>
  73. <version>${spring.version}</version>
  74. </dependency>
  75. <dependency>
  76. <groupId>junit</groupId>
  77. <artifactId>junit</artifactId>
  78. <version>4.12</version>
  79. <scope>test</scope>
  80. </dependency>
  81. <dependency>
  82. <groupId>javax.servlet</groupId>
  83. <artifactId>javax.servlet-api</artifactId>
  84. <version>3.1.0</version>
  85. <scope>provided</scope>
  86. </dependency>
  87. <dependency>
  88. <groupId>javax.servlet.jsp</groupId>
  89. <artifactId>jsp-api</artifactId>
  90. <version>2.0</version>
  91. <scope>provided</scope>
  92. </dependency>
  93. <dependency>
  94. <groupId>jstl</groupId>
  95. <artifactId>jstl</artifactId>
  96. <version>1.2</version>
  97. </dependency>
  98. <!-- log start -->
  99. <dependency>
  100. <groupId>log4j</groupId>
  101. <artifactId>log4j</artifactId>
  102. <version>${log4j.version}</version>
  103. </dependency>
  104. <dependency>
  105. <groupId>org.slf4j</groupId>
  106. <artifactId>slf4j-api</artifactId>
  107. <version>${slf4j.version}</version>
  108. </dependency>
  109. <dependency>
  110. <groupId>org.slf4j</groupId>
  111. <artifactId>slf4j-log4j12</artifactId>
  112. <version>${slf4j.version}</version>
  113. </dependency>
  114. <!-- log end -->
  115. <dependency>
  116. <groupId>org.mybatis</groupId>
  117. <artifactId>mybatis</artifactId>
  118. <version>${mybatis.version}</version>
  119. </dependency>
  120. <dependency>
  121. <groupId>org.mybatis</groupId>
  122. <artifactId>mybatis-spring</artifactId>
  123. <version>1.3.0</version>
  124. </dependency>
  125. <dependency>
  126. <groupId>c3p0</groupId>
  127. <artifactId>c3p0</artifactId>
  128. <version>0.9.1.2</version>
  129. <type>jar</type>
  130. <scope>compile</scope>
  131. </dependency>
  132. <dependency>
  133. <groupId>com.github.pagehelper</groupId>
  134. <artifactId>pagehelper</artifactId>
  135. <version>5.1.2</version>
  136. </dependency>
  137. <dependency>
  138. <groupId>org.springframework.security</groupId>
  139. <artifactId>spring-security-web</artifactId>
  140. <version>${spring.security.version}</version>
  141. </dependency>
  142. <dependency>
  143. <groupId>org.springframework.security</groupId>
  144. <artifactId>spring-security-config</artifactId>
  145. <version>${spring.security.version}</version>
  146. </dependency>
  147. <dependency>
  148. <groupId>org.springframework.security</groupId>
  149. <artifactId>spring-security-core</artifactId>
  150. <version>${spring.security.version}</version>
  151. </dependency>
  152. <dependency>
  153. <groupId>org.springframework.security</groupId>
  154. <artifactId>spring-security-taglibs</artifactId>
  155. <version>${spring.security.version}</version>
  156. </dependency>
  157. <dependency>
  158. <groupId>mysql</groupId>
  159. <artifactId>mysql-connector-java</artifactId>
  160. <version>5.1.47</version>
  161. </dependency>
  162. <dependency>
  163. <groupId>javax.annotation</groupId>
  164. <artifactId>jsr250-api</artifactId>
  165. <version>1.0</version>
  166. </dependency>
  167. <dependency>
  168. <groupId>org.projectlombok</groupId>
  169. <artifactId>lombok</artifactId>
  170. <version>1.16.20</version>
  171. </dependency>
  172. <dependency>
  173. <groupId>commons-io</groupId>
  174. <artifactId>commons-io</artifactId>
  175. <version>2.4</version>
  176. </dependency>
  177. <dependency>
  178. <groupId>commons-io</groupId>
  179. <artifactId>commons-io</artifactId>
  180. <version>1.4</version>
  181. </dependency>
  182. <dependency>
  183. <groupId>commons-fileupload</groupId>
  184. <artifactId>commons-fileupload</artifactId>
  185. <version>1.3.1</version>
  186. </dependency>
  187. </dependencies>
  188. <build>
  189. <pluginManagement>
  190. <plugins>
  191. <plugin>
  192. <groupId>org.apache.maven.plugins</groupId>
  193. <artifactId>maven-compiler-plugin</artifactId>
  194. <version>3.2</version>
  195. <configuration>
  196. <source>1.8</source>
  197. <target>1.8</target>
  198. <encoding>UTF-8</encoding>
  199. <showWarnings>true</showWarnings>
  200. </configuration>
  201. </plugin>
  202. </plugins>
  203. </pluginManagement>
  204. </build>
  205. <modules>
  206. <module>SSM_Pojo</module>
  207. <module>SSM_Service</module>
  208. <module>SSM_Mapper</module>
  209. <module>SSM_Utils</module>
  210. <module>SSM_Controller</module>
  211. </modules>
  212. </project>

controller层

GoodsController类


  1. package com.zretc.controller;
  2. import com.github.pagehelper.PageInfo;
  3. import com.zretc.pojo.Goods;
  4. import com.zretc.pojo.Role;
  5. import com.zretc.service.GoodsService;
  6. import com.zretc.service.RoleService;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.stereotype.Controller;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestParam;
  11. import org.springframework.web.servlet.ModelAndView;
  12. import java.util.List;
  13. @Controller
  14. @RequestMapping("/goods")
  15. public class GoodsController {
  16. @Autowired
  17. private GoodsService goodsService;
  18. /**
  19. * 查询所有货品
  20. */
  21. @RequestMapping("/findAllGoods")
  22. public ModelAndView findAll() {
  23. ModelAndView modelAndView = new ModelAndView();
  24. List<Goods> goodsList = goodsService.findAll();
  25. System.out.println(1111111111);
  26. System.out.println(goodsList);
  27. modelAndView.addObject("goodsList", goodsList);
  28. modelAndView.setViewName("goods-list-all");
  29. return modelAndView;
  30. }
  31. /**
  32. * 查询所有用户分页显示
  33. */
  34. @RequestMapping("/findAll")
  35. public ModelAndView findAllGoods(@RequestParam(name = "page", required = true, defaultValue = "1") int page, @RequestParam(name = "size", required = true, defaultValue = "8") int size) {
  36. ModelAndView modelAndView = new ModelAndView();
  37. List<Goods> userList = goodsService.findAll(page,size);
  38. PageInfo<Goods> pageInfo = new PageInfo<>(userList);
  39. modelAndView.addObject("goodsList",pageInfo);
  40. modelAndView.setViewName("goods-list");
  41. return modelAndView;
  42. }
  43. /**
  44. * 根据职位id查询货品
  45. *
  46. * @return
  47. */
  48. @RequestMapping("findGoodsById")
  49. public ModelAndView findProductById(@RequestParam(name = "goodsId") int goodsId) {
  50. ModelAndView modelAndView = new ModelAndView();
  51. Goods product = goodsService.findGoodsById(goodsId);
  52. modelAndView.addObject("goods", product);
  53. modelAndView.setViewName("goods-add");
  54. return modelAndView;
  55. }
  56. /**
  57. * 根据id删除
  58. */
  59. @RequestMapping("/deleteById")
  60. public String deleteById(@RequestParam(name = "goodsId") int goodsId){
  61. goodsService.deleteById(goodsId);
  62. return "redirect:findAll";
  63. }
  64. /**
  65. * 新增
  66. *
  67. * @param goods
  68. */
  69. @RequestMapping("save")
  70. public String save(Goods goods) {
  71. System.out.println(goods);
  72. // 判断产品id是否为空
  73. if (goods.getId()==null) {
  74. System.out.println(goods.getId());
  75. System.out.println("==============");
  76. // 新增的方法
  77. goodsService.save(goods);
  78. } else {
  79. System.out.println(goods.getId());
  80. System.out.println("---------------");
  81. // 修改的方法
  82. goodsService.updateGoods(goods);
  83. }
  84. return "redirect:findAll";
  85. }
  86. }
  1. package com.zretc.controller;
  2. import org.springframework.stereotype.Controller;
  3. import org.springframework.web.bind.annotation.RequestMapping;
  4. @Controller
  5. @RequestMapping("/order")
  6. public class OrderController {
  7. }


 




  1. package com.zretc.controller;
  2. import com.github.pagehelper.PageInfo;
  3. import com.zretc.pojo.Goods;
  4. import com.zretc.pojo.Role;
  5. import com.zretc.pojo.User;
  6. import com.zretc.service.UserService;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.context.annotation.PropertySource;
  9. import org.springframework.stereotype.Controller;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RequestParam;
  12. import org.springframework.web.servlet.ModelAndView;
  13. import java.util.List;
  14. @Controller
  15. @RequestMapping("/user")
  16. public class UserController {
  17. @Autowired
  18. private UserService userService;
  19. /**
  20. * 查询所有用户分页显示
  21. */
  22. @RequestMapping("/findAll")
  23. public ModelAndView findAll(@RequestParam(name = "page", required = true, defaultValue = "1") int page, @RequestParam(name = "size", required = true, defaultValue = "8") int size) {
  24. ModelAndView modelAndView = new ModelAndView();
  25. List<User> userList = userService.findAll(page,size);
  26. PageInfo<User> pageInfo = new PageInfo<>(userList);
  27. modelAndView.addObject("userList",pageInfo);
  28. modelAndView.setViewName("user-list");
  29. return modelAndView;
  30. }
  31. /**
  32. * 查询所有用户
  33. */
  34. @RequestMapping("/findAllUser")
  35. public ModelAndView findAllUser() {
  36. ModelAndView modelAndView = new ModelAndView();
  37. List<User> userList = userService.findAll();
  38. modelAndView.addObject("userList",userList);
  39. modelAndView.setViewName("user-list-all");
  40. return modelAndView;
  41. }
  42. /**
  43. * 根据产品id用户
  44. *
  45. * @return
  46. */
  47. @RequestMapping("findUserById")
  48. public ModelAndView findProductById(@RequestParam(name = "userId") int userId) {
  49. ModelAndView modelAndView = new ModelAndView();
  50. User product = userService.findUserById(userId);
  51. modelAndView.addObject("user", product);
  52. modelAndView.setViewName("user-add");
  53. return modelAndView;
  54. }
  55. /**
  56. * 根据id删除
  57. */
  58. @RequestMapping("/deleteById")
  59. public String deleteById(@RequestParam(name = "userId") int userId){
  60. userService.deleteById(userId);
  61. return "redirect:findAll";
  62. }
  63. /**
  64. * 新增
  65. *
  66. * @param user
  67. */
  68. @RequestMapping("/save")
  69. public String save(User user) {
  70. System.out.println(1111);
  71. System.out.println(user);
  72. // 判断产品id是否为空
  73. if (user.getId()==null) {
  74. // 新增的方法
  75. userService.save(user);
  76. } else {
  77. // 修改的方法
  78. userService.updateUser(user);
  79. }
  80. return "redirect:findAll";
  81. }
  82. /**
  83. * 查询每个人拥有几个职位
  84. */
  85. @RequestMapping("/findUserAndRoleById")
  86. public ModelAndView findUserAndRoleById(@RequestParam(name = "userId") int userId){
  87. System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  88. ModelAndView modelAndView = new ModelAndView();
  89. User product = userService.findUserAndRoleById(userId);
  90. System.out.println(product);
  91. List<Role> roleList = product.getRoleList();
  92. Integer productId = product.getId();
  93. System.out.println(roleList);
  94. modelAndView.addObject("roleList", roleList);
  95. modelAndView.addObject("userId", productId);
  96. modelAndView.setViewName("user-role-list");
  97. return modelAndView;
  98. }
  99. /**
  100. * 登录
  101. */
  102. @RequestMapping("/login")
  103. public String login(User user){
  104. System.out.println("99999999999999");
  105. System.out.println(user);
  106. // @RequestParam("username") String name,@RequestParam("password") String password
  107. //
  108. System.out.println("这是登录页面");
  109. if ("王琪".equals(user.getUsername()) && "123456".equals(user.getPassword())){
  110. return "../main";
  111. }else {
  112. return "../../../error";
  113. }
  114. }
  115. @RequestMapping("deleteUserRoleById")
  116. public String deleteUserRoleById(@RequestParam("roleId") int roleId,@RequestParam("userId") int userId){
  117. userService.deleteUserRoleById(roleId,userId);
  118. return "redirect:http://localhost/user/findUserAndRoleById?userId=1";
  119. }
  120. /**
  121. * 查询每个人拥有几个职位
  122. */
  123. @RequestMapping("/findUserAndGoodsById")
  124. public ModelAndView findUserAndGoodsById(){
  125. System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
  126. int userId=0;
  127. ModelAndView modelAndView = new ModelAndView();
  128. List<User> userList = userService.findUserAndGoodsById(userId);
  129. System.out.println(userList);
  130. modelAndView.addObject("userList", userList);
  131. modelAndView.setViewName("order-list");
  132. return modelAndView;
  133. }
  134. /**
  135. * 订单支付模块
  136. */
  137. @RequestMapping("/findZhiFu")
  138. public String findZhiFu(@RequestParam("userId") int id,@RequestParam("number") int goodsNum,@RequestParam("goodsPrice") double goodsPrice,@RequestParam("goodsId") int goodsId){
  139. userService.findZhiFu(id,goodsNum,goodsPrice,goodsId);
  140. return "redirect:findAll";
  141. }
  142. /**
  143. * 删除订单模块
  144. */
  145. @RequestMapping("/deleteOrder")
  146. public String deleteOrder(@RequestParam("userId") int userId,@RequestParam("goodsId") int goodsId){
  147. userService.deleteOrder(userId,goodsId);
  148. return "redirect:findUserAndGoodsById";
  149. }
  150. /**
  151. * 添加项目
  152. * @param goodsId
  153. * @param userId
  154. * @return
  155. */
  156. @RequestMapping("/addOrder")
  157. public String addOrder(@RequestParam("goodsId") int goodsId,@RequestParam("userId") int userId){
  158. userService.addOrder(goodsId,userId);
  159. return "redirect:findUserAndGoodsById";
  160. }
  161. }

pojo层


  1. package com.zretc.pojo;
  2. import lombok.Data;
  3. import java.util.List;
  4. /**
  5. * 实体类
  6. * 货品
  7. * 作者:
  8. */
  9. @Data
  10. public class Goods {
  11. //货品编号
  12. private Integer id;
  13. //货品名称
  14. private String goodsName;
  15. //货品数量
  16. private int goodsNum;
  17. //货品单价
  18. private double goodsPrice;
  19. //货品状态
  20. private int status;
  21. //每个产品有多少个人下订单
  22. private List<User> userList;
  23. }

  1. package com.zretc.pojo;
  2. import lombok.Data;
  3. import java.util.List;
  4. /**
  5. * 实体类
  6. * 职务
  7. * 作者:
  8. @Data
  9. public class Role {
  10. //职位编号
  11. private Integer id;
  12. //职位名称
  13. private String roleName;
  14. //职位描述
  15. private String roleDesc;
  16. //职位状态
  17. private String status;
  18. //这个职位有多少人
  19. private List<User> userList;
  20. }

  1. package com.zretc.pojo;
  2. import lombok.Data;
  3. @Data
  4. public class Temp {
  5. private int id;
  6. private String url;
  7. }

  1. package com.zretc.pojo;
  2. import lombok.Data;
  3. import java.util.List;
  4. @Data
  5. public class User {
  6. //用户编号
  7. private Integer id;
  8. //用户名
  9. private String username;
  10. //密码
  11. private String password;
  12. //账户余额
  13. private int accountBalance;
  14. //状态
  15. //是否删除
  16. private int status;
  17. //每个人有几个职位
  18. private List<Role> roleList;
  19. //每个人有几个订单
  20. private List<Goods> goodsList;
  21. }

service层


  1. package com.zretc.service;
  2. import com.zretc.pojo.Goods;
  3. import java.util.List;
  4. public interface GoodsService {
  5. /**
  6. * 查询所有货品
  7. * @return
  8. */
  9. List<Goods> findAll();
  10. /**
  11. * 查询所有货品分页显示
  12. * @return
  13. */
  14. List<Goods> findAll(int page,int size);
  15. /**
  16. * 根据id查询货品
  17. * @param goodsId
  18. * @return
  19. */
  20. Goods findGoodsById(int goodsId);
  21. /**
  22. * 根据id删除货品
  23. * @param goodsId
  24. */
  25. void deleteById(int goodsId);
  26. /**
  27. * 新增货品
  28. * @param goods
  29. */
  30. void save(Goods goods);
  31. /**
  32. * 修改商品
  33. * @param goods
  34. */
  35. void updateGoods(Goods goods);
  36. }


  1. package com.zretc.service;
  2. import com.zretc.pojo.Role;
  3. import com.zretc.pojo.Temp;
  4. import org.springframework.ui.ModelMap;
  5. import org.springframework.web.multipart.MultipartFile;
  6. import java.io.IOException;
  7. import java.util.List;
  8. public interface TempService {
  9. List<Temp> findAll(int id);
  10. }

  1. package com.zretc.service;
  2. import com.zretc.pojo.User;
  3. import org.apache.ibatis.annotations.Select;
  4. import java.util.List;
  5. public interface UserService {
  6. /**
  7. * 查询所有用户分页显示
  8. * @return
  9. */
  10. List<User> findAll(int page,int size);
  11. /**
  12. * 查询所有用户
  13. * @return
  14. */
  15. List<User> findAll();
  16. /**
  17. * 添加用户
  18. * @param user
  19. */
  20. void save(User user);
  21. /**
  22. * 修改用户
  23. */
  24. void updateUser(User user);
  25. /**
  26. * 根据id查询用户
  27. * @param userId
  28. * @return
  29. */
  30. User findUserById(int userId);
  31. /**
  32. * 根据id删除用户
  33. * @param userId
  34. */
  35. void deleteById(int userId);
  36. /**
  37. * 查询每个人拥有几个职位
  38. * @param userId
  39. * @return
  40. */
  41. User findUserAndRoleById(int userId);
  42. /**
  43. * 删除一个人拥有的职位
  44. * @param roleId
  45. */
  46. void deleteUserRoleById(int roleId,int userId);
  47. /**
  48. * 查询每个人有几个订单
  49. * @param userId
  50. * @return
  51. */
  52. List<User> findUserAndGoodsById(int userId);
  53. /**
  54. * 订单支付
  55. * @param id
  56. * @param goodsNum
  57. * @param goodsPrice
  58. */
  59. void findZhiFu(int id, int goodsNum, double goodsPrice,int goodsId);
  60. /**
  61. * 订单删除
  62. * @param userId
  63. * @param goodsId
  64. */
  65. void deleteOrder(int userId, int goodsId);
  66. /**
  67. * 订单添加
  68. * @param goodsId
  69. * @param userId
  70. */
  71. void addOrder(int goodsId, int userId);
  72. }

serviceImpl层


  1. package com.zretc.service.impl;
  2. import com.github.pagehelper.PageHelper;
  3. import com.zretc.mapper.GoodsMapper;
  4. import com.zretc.pojo.Goods;
  5. import com.zretc.service.GoodsService;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8. import java.util.List;
  9. @Service
  10. public class GoodsServiceImpl implements GoodsService {
  11. @Autowired
  12. private GoodsMapper goodsMapper;
  13. /**
  14. * 查询所有货品
  15. * @return
  16. */
  17. @Override
  18. public List<Goods> findAll() {
  19. List<Goods> goodsList = goodsMapper.findAll();
  20. System.out.println(222222222);
  21. System.out.println(goodsList);
  22. return goodsList;
  23. }
  24. /**
  25. * 查询所有货品 分页显示
  26. * @return
  27. */
  28. @Override
  29. public List<Goods> findAll(int page, int size) {
  30. PageHelper.startPage(page,size);
  31. List<Goods> goodsList = goodsMapper.findAll();
  32. return goodsList;
  33. }
  34. /**
  35. * 根据id查询货品
  36. * @param goodsId
  37. * @return
  38. */
  39. @Override
  40. public Goods findGoodsById(int goodsId) {
  41. return goodsMapper.findGoodsById(goodsId);
  42. }
  43. /**
  44. * 根据id删除货品
  45. * @param goodsId
  46. */
  47. @Override
  48. public void deleteById(int goodsId) {
  49. goodsMapper.deleteById(goodsId);
  50. }
  51. /**
  52. * 新增
  53. * @param goods
  54. */
  55. @Override
  56. public void save(Goods goods) {
  57. goodsMapper.save(goods);
  58. }
  59. /**
  60. * 修改商品
  61. * @param goods
  62. */
  63. @Override
  64. public void updateGoods(Goods goods) {
  65. goodsMapper.updateGoods(goods);
  66. }
  67. }

  1. package com.zretc.service.impl;
  2. import com.github.pagehelper.PageHelper;
  3. import com.zretc.mapper.RoleMapper;
  4. import com.zretc.pojo.Role;
  5. import com.zretc.service.RoleService;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8. import java.util.List;
  9. @Service
  10. public class RoleServiceImpl implements RoleService {
  11. @Autowired
  12. private RoleMapper roleMapper;
  13. /**
  14. * 查询所有职位
  15. * @return
  16. */
  17. @Override
  18. public List<Role> findAll() {
  19. List<Role> roleList= roleMapper.findAll();
  20. System.out.println("2222222222");
  21. System.out.println(roleList);
  22. return roleList;
  23. }
  24. /**
  25. * 通过分页查询所有职位
  26. */
  27. @Override
  28. public List<Role> findAll(int page, int size) {
  29. PageHelper.startPage(page,size);
  30. List<Role> roleList= roleMapper.findAll();
  31. return roleList;
  32. }
  33. /**
  34. * 根据id删除职位
  35. * @param userId
  36. */
  37. @Override
  38. public void deleteById(int userId) {
  39. roleMapper.deleteById(userId);
  40. }
  41. /**
  42. * 根据id查询职位
  43. * @param roleId
  44. * @return
  45. */
  46. @Override
  47. public Role findRoleById(int roleId) {
  48. return roleMapper.findRoleById(roleId);
  49. }
  50. /**
  51. * 新增职位
  52. * @param role
  53. */
  54. @Override
  55. public void save(Role role) {
  56. roleMapper.save(role);
  57. }
  58. /**
  59. * 修改职位
  60. * @param role
  61. */
  62. @Override
  63. public void updateRole(Role role) {
  64. roleMapper.updateRole(role);
  65. }
  66. /**
  67. * 添加给用户职位
  68. * @param roleId
  69. * @param userId
  70. */
  71. @Override
  72. public void addOrder(int roleId, int userId) {
  73. roleMapper.addOrder(roleId,userId);
  74. }
  75. }


  1. package com.zretc.service.impl;
  2. import com.github.pagehelper.PageHelper;
  3. import com.zretc.mapper.UserMapper;
  4. import com.zretc.pojo.Role;
  5. import com.zretc.pojo.User;
  6. import com.zretc.service.UserService;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.jdbc.support.CustomSQLErrorCodesTranslation;
  9. import org.springframework.stereotype.Service;
  10. import java.util.ArrayList;
  11. import java.util.List;
  12. @Service
  13. public class UserServiceImpl implements UserService {
  14. @Autowired
  15. private UserMapper userMapper;
  16. /**
  17. * 查看所有用户分页显示
  18. * @param page
  19. * @param size
  20. * @return
  21. */
  22. @Override
  23. public List<User> findAll(int page,int size) {
  24. // 分页插件
  25. PageHelper.startPage(page,size);
  26. List<User> userList = userMapper.findAll();
  27. return userList ;
  28. }
  29. /**
  30. * 查看所有用户
  31. * @return
  32. */
  33. @Override
  34. public List<User> findAll() {
  35. List<User> userList = userMapper.findAll();
  36. System.out.println(userList);
  37. return userList ;
  38. }
  39. /**
  40. * 添加用户
  41. * @param user
  42. */
  43. @Override
  44. public void save(User user) {
  45. System.out.println(2222);
  46. System.out.println(user);
  47. userMapper.save(user);
  48. }
  49. /**
  50. * 修改用户
  51. */
  52. @Override
  53. public void updateUser(User user) {
  54. System.out.println(2222);
  55. System.out.println(user);
  56. userMapper.updataUser(user);
  57. }
  58. /**
  59. * 根据id查询
  60. */
  61. @Override
  62. public User findUserById(int userId) {
  63. return userMapper.findUserById(userId);
  64. }
  65. /**
  66. * 根据id删除用户
  67. */
  68. @Override
  69. public void deleteById(int userId) {
  70. userMapper.deleteBYId(userId);
  71. }
  72. /**
  73. * 查询每个人拥有几个zhiwie
  74. */
  75. @Override
  76. public User findUserAndRoleById(int userId) {
  77. User userAndRoleById = userMapper.findUserAndRoleById(userId);
  78. System.out.println("5555555555555555555555");
  79. System.out.println(userAndRoleById.getUsername());
  80. for (Role role : userAndRoleById.getRoleList()) {
  81. System.out.println(role);
  82. }
  83. return userAndRoleById;
  84. }
  85. /**
  86. * 删除一个人拥有的职位
  87. * @param roleId
  88. */
  89. @Override
  90. public void deleteUserRoleById(int roleId,int userId) {
  91. userMapper.deleteUserRoleById(roleId,userId);
  92. }
  93. /**
  94. * 查询每个人拥有的订单
  95. */
  96. @Override
  97. public List<User> findUserAndGoodsById(int userId) {
  98. System.out.println("service00000000000000000000000000");
  99. List<User> userList = new ArrayList<User>() ;
  100. List<Integer> byUserIdAll = userMapper.findByUserIdAll();
  101. for (Integer integer : byUserIdAll) {
  102. userId=integer;
  103. User userAndRoleById = userMapper.findUserAndGoodsById(userId);
  104. System.out.println(userAndRoleById);
  105. userList.add(userAndRoleById);
  106. }
  107. System.out.println(userList);
  108. return userList;
  109. }
  110. /**
  111. * 支付
  112. * @param id
  113. * @param goodsNum
  114. * @param goodsPrice
  115. */
  116. @Override
  117. public void findZhiFu(int id, int goodsNum, double goodsPrice,int goodsId) {
  118. double accountBalance = userMapper.findZhiFuById(id);
  119. System.out.println("支付模快serviceImpl");
  120. System.out.println(accountBalance);
  121. accountBalance = accountBalance-(goodsNum*goodsPrice);
  122. System.out.println(accountBalance);
  123. userMapper.findZhiFu(id,accountBalance);
  124. /**
  125. * 删除订单
  126. */
  127. userMapper.deleteOrder(id,goodsId);
  128. }
  129. /**
  130. * 订单删除
  131. * @param userId
  132. * @param goodsId
  133. */
  134. @Override
  135. public void deleteOrder(int userId, int goodsId) {
  136. userMapper.deleteOrder(userId,goodsId);
  137. }
  138. /**
  139. * 添加项目
  140. * @param goodsId
  141. * @param userId
  142. */
  143. @Override
  144. public void addOrder(int goodsId, int userId) {
  145. userMapper.addOrder(goodsId,userId);
  146. }
  147. }

mapper层


  1. package com.zretc.mapper;
  2. import com.zretc.pojo.Goods;
  3. import com.zretc.pojo.Role;
  4. import org.apache.ibatis.annotations.*;
  5. import org.springframework.stereotype.Repository;
  6. import java.util.List;
  7. @Repository
  8. public interface GoodsMapper {
  9. /**
  10. * 查询所有货品
  11. * @return
  12. */
  13. @Select("select * from goods where status=1")
  14. List<Goods> findAll() ;
  15. /**
  16. * 根据id查询货品
  17. * @param goodsId
  18. * @return
  19. */
  20. @Select("select * from goods where id=#{goodsId}")
  21. Goods findGoodsById(int goodsId);
  22. /**
  23. * 根据id删除货品
  24. * @param goodsId
  25. */
  26. @Update("update goods set status=0 where id=#{goodsId}")
  27. void deleteById(int goodsId);
  28. /**
  29. * 添加货品
  30. * @param goods
  31. */
  32. @Insert(" insert into goods values(#{id},#{goodsName},#{goodsNum},#{goodsPrice},1)")
  33. // insert into role values(#{id},#{roleName},#{roleDesc},1)
  34. void save(Goods goods);
  35. /**
  36. * 修改货品
  37. * @param goods
  38. */
  39. @Update("update goods set goodsName=#{goodsName},goodsNum=#{goodsNum},goodsPrice=#{goodsPrice},status=1 where id=#{id}")
  40. void updateGoods(Goods goods);
  41. /**
  42. * 根据用户id查询商品信息
  43. */
  44. @Select("select * from goods where id in(select goodsId from user_goods where userId=#{userId})")
  45. @Results({
  46. @Result(id = true, property = "id", column = "id"),
  47. @Result(property = "goodsName", column = "goodsName"),
  48. @Result(property = "goodsNum", column = "goodsNum"),
  49. @Result(property = "goodsPrice", column = "goodsPrice"),
  50. @Result(property = "status", column = "status"),
  51. })
  52. List<Goods> findGoodsByUserId(int id);
  53. }

  1. package com.zretc.mapper;
  2. import com.zretc.pojo.Role;
  3. import com.zretc.pojo.User;
  4. import org.apache.ibatis.annotations.*;
  5. import org.springframework.stereotype.Repository;
  6. import java.util.List;
  7. @Repository
  8. public interface RoleMapper {
  9. /**
  10. * 根据用户id查询角色信息
  11. */
  12. @Select("select * from role where id in(select roleId from user_role where userId=#{userId})")
  13. @Results({
  14. @Result(id = true, property = "id", column = "id"),
  15. @Result(property = "roleName", column = "roleName"),
  16. @Result(property = "roleDesc", column = "roleDesc"),
  17. })
  18. List<Role> findRoleByUserId(int id);
  19. /**
  20. * 查询所有职位
  21. * @return
  22. */
  23. @Select("select * from role where status=1")
  24. List<Role> findAll() ;
  25. /**
  26. * 根据id删除职位
  27. * @param roleId
  28. */
  29. @Update("update role set status=0 where id=#{roleId}")
  30. void deleteById(int roleId);
  31. /**
  32. * 根据id查询职位
  33. * @param roleId
  34. * @return
  35. */
  36. @Select("select * from role where id=#{roleId}")
  37. Role findRoleById(int roleId);
  38. /**
  39. * 新增职位
  40. * @param role
  41. */
  42. @Insert("insert into role values(#{id},#{roleName},#{roleDesc},1)")
  43. void save(Role role);
  44. /**
  45. * 修改职位
  46. * @param role
  47. */
  48. @Update("update role set roleName=#{roleName},roleDesc=#{roleDesc} where id=#{id}")
  49. void updateRole(Role role);
  50. /**
  51. * 给用户添加职位
  52. * @param roleId
  53. * @param userId
  54. */
  55. @Insert("INSERT INTO user_role VALUES (#{param2},#{param1})")
  56. void addOrder(int roleId, int userId);
  57. }


  1. package com.zretc.mapper;
  2. import com.zretc.pojo.User;
  3. import org.apache.ibatis.annotations.*;
  4. import org.springframework.stereotype.Repository;
  5. import java.util.List;
  6. @Repository
  7. public interface UserMapper {
  8. /**
  9. * 查询所有普通用户
  10. * @return
  11. */
  12. @Select("SELECT * FROM user where status=1")
  13. List<User> findAll() ;
  14. /**
  15. * 新增用户
  16. * @param user
  17. */
  18. @Insert("insert into user values(#{id},#{username},#{password},#{accountBalance},1)")
  19. void save(User user);
  20. /**
  21. * 修改用户
  22. * @param user
  23. */
  24. @Update("update user set username=#{username},password=#{password},accountBalance=#{accountBalance},status=1 where id=#{id}")
  25. void updataUser(User user);
  26. /**
  27. * 根据id查询
  28. * @param userId
  29. * @return
  30. */
  31. @Select("select * from user where id=#{userId}")
  32. User findUserById(int userId);
  33. /**
  34. * 根据id删除用户
  35. * @param userId
  36. */
  37. @Update("update user set status=0 where id=#{userId}")
  38. void deleteBYId(int userId);
  39. /**
  40. * 查询每个人有几个职位
  41. * @param userId
  42. * @return
  43. */
  44. @Select("select * from user where id=#{userId}")
  45. @Results({
  46. @Result(id = true ,property = "id",column = "id"),
  47. @Result(property = "username",column = "username"),
  48. @Result(property = "password",column = "password"),
  49. @Result(property = "password",column = "password"),
  50. @Result(property = "accountBalance",column = "accountBalance"),
  51. @Result(property = "status",column = "status"),
  52. @Result(property = "roleList", column = "id", javaType = List.class,
  53. many = @Many(select = "com.zretc.mapper.RoleMapper.findRoleByUserId")
  54. ),
  55. })
  56. User findUserAndRoleById(int userId);
  57. /**
  58. * 删除每个人的职位
  59. * @param roleId
  60. * @param userId
  61. */
  62. @Delete("delete from user_role where roleId=#{param1} and userId=#{param2} ")
  63. void deleteUserRoleById( int roleId,int userId);
  64. /**
  65. * 查询每个人有几个职位
  66. * @param userId
  67. * @return
  68. */
  69. @Select("select * from user where id=#{userId}")
  70. @Results({
  71. @Result(id = true ,property = "id",column = "id"),
  72. @Result(property = "username",column = "username"),
  73. @Result(property = "password",column = "password"),
  74. @Result(property = "password",column = "password"),
  75. @Result(property = "accountBalance",column = "accountBalance"),
  76. @Result(property = "status",column = "status"),
  77. @Result(property = "goodsList", column = "id", javaType = List.class,
  78. many = @Many(select = "com.zretc.mapper.GoodsMapper.findGoodsByUserId")
  79. ),
  80. })
  81. User findUserAndGoodsById(int userId);
  82. /**
  83. * 查询订单的所有userId
  84. * @return
  85. */
  86. @Select("select userId from user_goods")
  87. List<Integer> findByUserIdAll();
  88. /**
  89. * 支付功能
  90. * 支付订单,每个人的账户金额减少响应的数量
  91. * @param id
  92. * @param accountBalance
  93. */
  94. @Update("update user set accountBalance=#{param2} where id=#{param1}")
  95. void findZhiFu(int id, double accountBalance);
  96. /**
  97. * 获取支付的账户余额
  98. */
  99. @Select("select accountBalance from user where id=#{param1}")
  100. double findZhiFuById(int id);
  101. /**
  102. * 删除订单
  103. * @param id
  104. * @param goodsId
  105. */
  106. @Delete("DELETE from user_goods where userId=#{param1} and goodsId=#{param2}")
  107. void deleteOrder(int id, int goodsId);
  108. /**
  109. * 添加订单
  110. * @param goodsId
  111. * @param userId
  112. */
  113. @Insert("INSERT INTO user_goods VALUES (#{param2},#{param1})")
  114. void addOrder(int goodsId, int userId);
  115. }

源代码已经上传。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/719582
推荐阅读
相关标签
  

闽ICP备14008679号