Soul torture based on java jsp+mysql+Spring

Three, the third normal form 29

4.4.1 Table ER Diagram 30

4.4.2 User table design 30

4.4.3 Classification table design of second-hand goods 30

4.4.4 User order table design 31

4.4.5 Detailed design of second-hand item table 31

4.4.5 Second-hand item order table design 32

4.4.6 Database sql file 32

V. References 36

Main function realization:

Administrator: Commodity classification management, commodity management, commodity order management, user management and other functions.

User role: View all products, user login and registration, view products by category, publish products, view seller homepage, contact seller, leave a message for products, view orders, modify and view personal information, etc.

Main technique:

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

System homepage:

login module:

Login code implementation:

<%@ page language=“java” contentType=“text/html; charset=UTF-8”

pageEncoding=“UTF-8”%>

系统登录 - 超市订单管理系统

Second-hand trading platform

${error }

product details:

Click Buy to create an order message:

Personal center:

Admin 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;

/**

  • Login related

  • @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”);

//Generate text verification code

String text = producer.createText();

//Generate image verification code

BufferedImage image = producer.createImage(text);

//Save to shiro session

ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text);

ServletOutputStream out = response.getOutputStream();

ImageIO.write(image, “jpg”, out);

}

/**

  • Log in

*/

@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.error("Verification code is incorrect");

}

try{

Subject subject = ShiroUtils.getSubject();

UsernamePasswordToken token = new UsernamePasswordToken(username, password);//md5+Jiayan

subject.login(token);

}catch (UnknownAccountException e) {

return R.error(e.getMessage());

}catch (IncorrectCredentialsException e) {

return R.error("The account number or password is incorrect");

}catch (LockedAccountException e) {

return R.error("The account has been locked, please contact the administrator");

}catch (AuthenticationException e) {

return R.error("Account verification failed");

}

return R.ok();

}

/**

  • quit

*/

@RequestMapping(value = “logout”, method = RequestMethod.GET)

public String logout() {

ShiroUtils.logout();

return “redirect:login.html”;

}

}

Main functions of the administrator:

Category management:

![](https://img-blog.csdnimg.cn/20210615140836895.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6

"Analysis of Java interview questions in first-line manufacturers + back-end development study notes + latest architecture explanation video + actual project source code handouts"

[docs.qq.com/doc/DSmxTbFJ1cmN1R2dB] Full content open source sharing

Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zOTcwOTEzNA==,size_16,color_FFFFFF,t_70)

Commodity management:

Order Management:

User Management;

Main table design:

user table:

CREATE TABLE NewTable (

user_id bigint(20) NOT NULL AUTO_INCREMENT ,

usernamevarchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'username' ,

password varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ‘密码’ ,

salt varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ‘盐’ ,

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 ‘手机号’ ,

statustinyint(4) NULL DEFAULT NULL COMMENT 'Status 0: Disabled 1: Normal' ,

create_timedatetime NULL DEFAULT NULL COMMENT 'Creation time' ,

PRIMARY KEY (user_id),

UNIQUE INDEX username (username) USING BTREE

)

Order form:

CREATE TABLE NewTable (

order_idbigint(20) NOT NULL AUTO_INCREMENT COMMENT 'order table primary key id',

order_no varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ‘’ COMMENT ‘订单号’ ,

user_idbigint(20) NOT NULL DEFAULT 0 COMMENT 'user primary key id' ,

Guess you like

Origin blog.csdn.net/m0_65484000/article/details/122175429