Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

Main functions:

Administrator: commodity classification management, commodity management, commodity order management, user management and other functions. User role: view all commodities, users login and register, view commodities according to the category, release commodities, view the seller’s home page, contact the seller, leave messages for commodities, view orders, modify and view personal information and other functions. View the home page to obtain contact information

Main technologies:

HTML+CSS+JavaScript+jsp+mysql+Spring+mybatis

System Home page:

Login module:

Login code implementation:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <! DOCTYPE HTML > < HTML > <head lang="en"> <meta charset="UTF-8"> <title> rel="stylesheet" href="${pageContext.request.contextPath }/css/style.css" /> <script type="text/javascript"> /* if(top.location! =self.location){ top.location=self.location; } */ </script> </head> <body class="login_bg"> <section class="loginBox"> <header class="loginHeader"> <h1> Secondary transaction platform </h1> </header> <section class="loginCont"> <form class="loginForm" action="${pageContext.request.contextPath }/login.do" name="actionForm" id="actionForm" method="post" > <div class="info">${error }</div> <div class="inputbox"> <label For ="user"> </label> < INPUT type="text" class="input-text" ID ="userCode" name="userCode" placeholder=" Please input user name "required/> </div> <div Class ="inputbox"> <label for="mima"> </label> <input type="password" ID ="userPassword" name="userPassword" placeholder=" Please enter the password" required/> </div> <div Class ="submit" > <input type="reset" value=" reset" /> </div> </form> </section> </section> </body> </html>Copy the code

Product Details:

Click Buy to create an order information:

Personal Center:

Administrator Login:

Main code implementation:

/** * . * * * * */ package io.renren.modules.sys.controller; import com.google.code.kaptcha.Constants; import com.google.code.kaptcha.Producer; import io.renren.common.utils.R; import io.renren.modules.sys.shiro.ShiroUtils; import org.apache.shiro.authc.*; import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.IOException; ** @author Mark s.com */ @controller public class SysLoginController {@autowired private Producer Producer;  @RequestMapping("captcha.jpg") public void captcha(HttpServletResponse response)throws IOException { response.setHeader("Cache-Control", "no-store, no-cache"); response.setContentType("image/jpeg"); String text = producer.createText(); BufferedImage image = producer.createImage(text); / / save the shiro session ShiroUtils. SetSessionAttribute (the KAPTCHA_SESSION_KEY, text); ServletOutputStream out = response.getOutputStream(); ImageIO.write(image, "jpg", out); } /** * @responseBody@requestMapping (value = "/sys/login", method = RequestMethod.POST) public R login(String username, String password, String captcha) { String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); if(! Captcha. EqualsIgnoreCase (kaptcha)){return r.ror (" Captcha is not correct "); } try{ Subject subject = ShiroUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(username, password); //md5+Jiayan subject.login(token); }catch (UnknownAccountException e) { return R.error(e.getMessage()); } the catch (IncorrectCredentialsException e) {return R.e rror (" account or password is not correct "); }catch (LockedAccountException e) {return r.ror (" Account has been locked, please contact your administrator "); }catch (AuthenticationException e) {return r.ror (" account failed to authenticate "); } return R.ok(); } @requestMapping (value = "logout", method = RequestMethod.GET) public String logout() { ShiroUtils.logout(); return "redirect:login.html"; }}Copy the code

Main functions of the administrator:

Classification management:

Commodity Management:

Order Management:

User management;

Main table design:

The users table:

CREATE TABLE `NewTable` ( `user_id` bigint(20) NOT NULL AUTO_INCREMENT , 'username' varchar(50) CHARACTER SET UTf8MB4 COLLATE UTf8MB4_general_ci NOT NULL COMMENT 'username', Varchar (100) CHARACTER SET utf8MB4 COLLATE UTf8MB4_general_ci NULL DEFAULT NULL COMMENT 'password', 'salt' varchar(20) CHARACTER SET utf8MB4 COLLATE UTf8MB4_general_ci NULL DEFAULT NULL COMMENT 'salt', 'email' varchar(100) CHARACTER SET UTf8MB4 COLLATE UTf8MB4_general_ci NULL DEFAULT NULL COMMENT ' 'mobile' varchar(100) CHARACTER SET UTf8MB4 COLLATE UTf8MB4_general_ci NULL DEFAULT NULL COMMENT 'cellphone', 'status' tinyint(4) NULL DEFAULT NULL COMMENT' Create_time datetime NULL DEFAULT NULL COMMENT 'create time', PRIMARY KEY (' user_id '), UNIQUE INDEX `username` (`username`) USING BTREE )Copy the code

The order list:

CREATE TABLE 'NewTable' (' order_id 'bigint(20) NOT NULL AUTO_INCREMENT COMMENT' 表 名 名 ', 'order_no' varchar(20) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL DEFAULT COMMENT ', 'user_id' bigint(20) NOT NULL DEFAULT 0 COMMENT 'total_price' int(11) NOT NULL DEFAULT 1 COMMENT 'total_price', 'pay_status' BIGint (20) NOT NULL DEFAULT 0 COMMENT' Pay status :0. ', 'pay_time' datetime NULL DEFAULT NULL COMMENT 'pay_time', 'order_status' BIGINT (20) NOT NULL DEFAULT 0 COMMENT' Order status :0. To be paid 1. Paid 2. Completed distribution 3: Successful delivery 4. Manual close -2. Timeout close -3. Merchant close ', 'extra_info' varchar(100) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL DEFAULT COMMENT ' 'user_name' varchar(30) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL DEFAULT COMMENT '', 'user_phone' varchar(11) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL DEFAULT COMMENT ', 'user_address' varchar(100) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL DEFAULT ', PRIMARY KEY (`order_id`) )Copy the code

Commodity list:

CREATE TABLE 'NewTable' (' goods_id 'bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT' 表 名 库 iD ', 'goods_name' varchar(200) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL DEFAULT COMMENT ', 'goods_intro' varchar(200) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL DEFAULT COMMENT ', 'goods_category_id' bigint(20) NOT NULL DEFAULT 0 COMMENT 'iD', `goods_cover_img` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '/admin/dist/img/no-img.png' COMMENT '主 体', 'goods_detail_content' text CHARACTER SET utF8 COLLATE UTf8_general_ci NOT NULL COMMENT '主 体', Original_price 'int(11) NOT NULL DEFAULT 1 COMMENT' original_price ', 'selling_price' int(11) NOT NULL DEFAULT 1 COMMENT '表 示', 'tag' varchar(20) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL DEFAULT ', 'goods_SELL_status' tinyint(4) NOT NULL DEFAULT 0 COMMENT' 评 价 值 0- 评 价 1- 评 价 ', 'create_user' int(11) NOT NULL DEFAULT 0 COMMENT 'create_user', PRIMARY KEY (' goods_id ')Copy the code

Ok, that’s enough for today, partners like, favorites, comments, one button three go ah, check the home page to get contact information