Share an example tutorial of the Yimai.com project
0.Development process:
1.Project agreement:
6 groups:
Group project name: EasyBuy_flc or (EasyBuy_01)
Team database name: EasyBuy_flc
Version control tool: svn, no longer used
In the future, you can upload your own group's projects to git
Development process control:
Team leader: Change all html pages to jsp suffix, and then establish the database and data table
ATeam members: Design database, write Chinese field names of data tables
BTeam members: Design entity classes
##Project development steps
1.Database design
Table1
EU_USER_IDvarchar Username
EU_USER_NAMEvarchar Real name
EU_PASSWORDvarchar Password
EU_SEXvarchar Gender (T, F)
EU_BIRTHDAY date Date of birth EU_IDENTITY_CODEvarchar ID card
EU_EMAILvarchar E-mail
====================== ======================================
easybuy_product_category (
Product Category Table) Table2
EPC_IDCategory Number
EPC_NAME ================================easybuy_product(Product list)
Table
3 EP_IDProduct number
EP_NAME Product name
EP_DESCRIPTIONProduct description
EP_PRICE Product price
EP_STOCK Product inventory
EPC_ID The parent category number of the category to which the current product belongs
EPC_CHILD_ID Category to which the current product belongs
EP_FILE_NAME Product image name
##========== ==================================================
easybuy_order(Order form) Table4
EO_IDOrder number
# EO_USER_ID Order's user
## EO_USER_NAME所 (real name)
EO_USER_ADDRESSOrder shipping address
EO_CREATE_TIMEOrder formation time
EO_COSTAmount of this order
EO_STATUSEO_TYPE Order type
(This project is not enabled)##================== ====================================
easybuy_order_detail(Order details table) Table
5EOD_ID Order details number
EO_IDOrder Number
EP_ID #Quantity of goods
EOD_COST =============================================
easybuy_news
(News table)
EN_TITLE
News Title
EN_CONTENT News content
EN_CREATE_TIME News release time
======= ============================================
easybuy_comment (comment form) Table 7
EC_ID Comment number
EC_CONTENT Comment content
EC_CREATE_TIME Comment creation time
EC_REPLY Comment reply
EC_REPLY_TIME Comment reply time
EC_NICK_NAME Commenter
================================================ ===============
2.Building the project structure
2.1Start from the entity layer
EntityThe layer code is as follows:
User userClass:
Product_category Product category:
package cn.com.dao;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import javax.naming.Context;import javax.naming.InitialContext;import javax.sql.DataSource;public class BaseDAO {public static final String driver = "com.mysql.jdbc.Driver";public static final String url = "jdbc:mysql://localhost:3306/easybuy?useUnicode=true&charaterEncoding=UTF-8";public static final String username = "root";public static final String pwd = "1234";public Connection con=null;public PreparedStatement ps=null;public ResultSet rs=null; //获取连接getConnectionpublic Connection getConnection() throws Exception {//加载驱动 Class.forName(driver);if (con == null || con.isClosed()) { con = DriverManager.getConnection(url, username, pwd); }return con; }//查询 executeQuerypublic ResultSet executeQuery(String sql, Object...objects) throws Exception { con = getConnection(); ps = con.prepareStatement(sql);for (int i = 0; i < objects.length; i++) { ps.setObject(i + 1, objects[i]); } rs = ps.executeQuery();return rs; }//增、删、改public int executeUpudate(String sql, Object... objects) throws Exception { con = getConnection(); ps = con.prepareStatement(sql);for (int i = 0; i < objects.length; i++) { ps.setObject(i + 1, objects[i]); }int num = ps.executeUpdate(); return num; }public void closeAll() throws Exception {if (rs != null || !rs.isClosed()) { rs.close(); }if (ps != null || !ps.isClosed()) { ps.close(); }if (con != null || !con.isClosed()) { con.close(); } } }
select(String name,String pwd) Exception; }
UserDaoImpl BaseDAO select(String name,String pwd) ="select count(1) from easybuy_user where loginname=? and loginname=?"=(rs!==rs.getInt("id"
select(String name,String pwd)
我的重难点:
难点1: 在浏览中cookie的存取。 问题描述: 当用户浏览商品时将该用或浏览的当前商品id放入cookie中在”最近浏览“中显示用户浏览过的商品信息 难点:cookie中存放有SessionId如何区分SessionId和商品id? 解决方案: 在将商品id放入cookie中是将cookie的key值和value值设置为相同的值也就是商品的id(cookie中存放Sessionid的cookie的key值和value值不一样),然后在遍历cookie时对比其key值和value值是否相等(相等即商品id不相等则不是商品)
难点2: 百度富文本编辑器中图片上传的配置 问题描述: 使用百度的文本富文本编辑器是传图片后不能在页面上显示 解决方案: 在ueditor的jsp文件夹下的config.json文件中配置正确的上传路径和访问访问路径。 imagePathFormat:图片上传后保存的路径相对于网站的根目录 imageUrlPrefix:图片的访问路径前缀相对于当前页面路径,其访问路径为imagerurlPrefix+imagePathFormat
难点3: 商品分类信息的层级显示: 问题描述: 商品分类中存在父级分类和子分类。如何显示 解决方案: 分别查询出父级分类和子级分类类在遍历父级分类时遍历子级分类找出该父级分类的子分类进行显示 复制代码如下:
商品分类
难点4:
使用过滤器实现权限控制 问题描述: 如何区分哪些页面需要验证权限 解决方案: 将需要验证权限的页面设置统一格式的路径在Filter中使用正则表达式筛选出取药进行权限验证的页面进行权限验证,
自在人与人
The above is the detailed content of Share an example tutorial of the Yimai.com project. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to implement dual WeChat login on Huawei mobile phones? With the rise of social media, WeChat has become one of the indispensable communication tools in people's daily lives. However, many people may encounter a problem: logging into multiple WeChat accounts at the same time on the same mobile phone. For Huawei mobile phone users, it is not difficult to achieve dual WeChat login. This article will introduce how to achieve dual WeChat login on Huawei mobile phones. First of all, the EMUI system that comes with Huawei mobile phones provides a very convenient function - dual application opening. Through the application dual opening function, users can simultaneously

Windows operating system is one of the most popular operating systems in the world, and its new version Win11 has attracted much attention. In the Win11 system, obtaining administrator rights is an important operation. Administrator rights allow users to perform more operations and settings on the system. This article will introduce in detail how to obtain administrator permissions in Win11 system and how to effectively manage permissions. In the Win11 system, administrator rights are divided into two types: local administrator and domain administrator. A local administrator has full administrative rights to the local computer

The programming language PHP is a powerful tool for web development, capable of supporting a variety of different programming logics and algorithms. Among them, implementing the Fibonacci sequence is a common and classic programming problem. In this article, we will introduce how to use the PHP programming language to implement the Fibonacci sequence, and attach specific code examples. The Fibonacci sequence is a mathematical sequence defined as follows: the first and second elements of the sequence are 1, and starting from the third element, the value of each element is equal to the sum of the previous two elements. The first few elements of the sequence

Detailed explanation of division operation in OracleSQL In OracleSQL, division operation is a common and important mathematical operation, used to calculate the result of dividing two numbers. Division is often used in database queries, so understanding the division operation and its usage in OracleSQL is one of the essential skills for database developers. This article will discuss the relevant knowledge of division operations in OracleSQL in detail and provide specific code examples for readers' reference. 1. Division operation in OracleSQL

How to implement the WeChat clone function on Huawei mobile phones With the popularity of social software and people's increasing emphasis on privacy and security, the WeChat clone function has gradually become the focus of people's attention. The WeChat clone function can help users log in to multiple WeChat accounts on the same mobile phone at the same time, making it easier to manage and use. It is not difficult to implement the WeChat clone function on Huawei mobile phones. You only need to follow the following steps. Step 1: Make sure that the mobile phone system version and WeChat version meet the requirements. First, make sure that your Huawei mobile phone system version has been updated to the latest version, as well as the WeChat App.

In today's software development field, Golang (Go language), as an efficient, concise and highly concurrency programming language, is increasingly favored by developers. Its rich standard library and efficient concurrency features make it a high-profile choice in the field of game development. This article will explore how to use Golang for game development and demonstrate its powerful possibilities through specific code examples. 1. Golang’s advantages in game development. As a statically typed language, Golang is used in building large-scale game systems.

The modulo operator (%) in PHP is used to obtain the remainder of the division of two numbers. In this article, we will discuss the role and usage of the modulo operator in detail, and provide specific code examples to help readers better understand. 1. The role of the modulo operator In mathematics, when we divide an integer by another integer, we get a quotient and a remainder. For example, when we divide 10 by 3, the quotient is 3 and the remainder is 1. The modulo operator is used to obtain this remainder. 2. Usage of the modulo operator In PHP, use the % symbol to represent the modulus

PHP Game Requirements Implementation Guide With the popularity and development of the Internet, the web game market is becoming more and more popular. Many developers hope to use the PHP language to develop their own web games, and implementing game requirements is a key step. This article will introduce how to use PHP language to implement common game requirements and provide specific code examples. 1. Create game characters In web games, game characters are a very important element. We need to define the attributes of the game character, such as name, level, experience value, etc., and provide methods to operate these
