Javaweb化妆品网上购物系统
購(gòu)物網(wǎng)站這個(gè)項(xiàng)目是我上學(xué)期Web應(yīng)用開發(fā)課程的一個(gè)期末項(xiàng)目,當(dāng)時(shí)項(xiàng)目交了上去之后就沒怎么管,很多細(xì)節(jié)都忘了.最近在準(zhǔn)備實(shí)習(xí)時(shí),因?yàn)槊嬖嚬俸苡锌赡軙?huì)問到關(guān)于這個(gè)項(xiàng)目的問題,所以打算重新拿出來整理一下.首先大體介紹下這個(gè)項(xiàng)目實(shí)現(xiàn)的內(nèi)容:
●用戶的注冊(cè),登錄,修改密碼界面.
●總商品瀏覽界面
●某個(gè)商品具體信息界面
●用戶購(gòu)物車及付款界面
●管理員模式(對(duì)商品信息進(jìn)行修改,刪除,添加)
●數(shù)據(jù)庫(kù)(數(shù)據(jù)庫(kù)存放著大量的商品,用戶信息)
基本上就是仿照淘寶的購(gòu)物界面,要說明的一點(diǎn)是本項(xiàng)目沒有使用到任何外部的框架或架構(gòu),都是原生態(tài)的代碼,這是因?yàn)閯倢W(xué)Web老師想讓我們先把基礎(chǔ)學(xué)好.使用到的編程工具是Eclipse,編程語言包括HTML,CSS,JSP,少量的JS.下面貼出的是購(gòu)物網(wǎng)站的主要界面.
化妝品網(wǎng)上購(gòu)物系統(tǒng)功能模塊示意圖
代碼已經(jīng)上傳github,下載地址:Github
管理員模塊的主要功能是實(shí)現(xiàn)在本網(wǎng)站的維護(hù)和管理,如類別的添加、刪除管理;商品的添加,推薦,刪除等管理;訂單的管理等。如圖3.3所示。
圖3.3 后臺(tái)管理模塊圖
圖4-11 系統(tǒng)前臺(tái)界面
圖4-12 用戶注冊(cè)頁面
圖4-13 購(gòu)物車模塊
圖4-14 定單提交模塊
圖4-3 管理員登錄界面
圖4.4 化妝品網(wǎng)站后臺(tái)
圖4.5 商品信息管理
圖4.6 添加商品模塊
圖4-7 會(huì)員管理模塊
圖4-8 訂單管理模塊
圖4-9 公告管理模塊
圖4-10 添加公告模塊
/*
* 代碼展示
*/
package com.hdxy.vehicle.action;
import java.util.ArrayList;
import java.util.Date;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.stereotype.Controller;
import com.hdxy.vehicle.base.Pagination;
import com.hdxy.vehicle.entity.CoachAssess;
import com.hdxy.vehicle.entity.SysUser;
import com.hdxy.vehicle.service.CoachAssessService;
import com.hdxy.vehicle.util.ActionResult;
/**
* TODO 類描述
*
* @version 0.0.1
* @author generator
* @date 2019-03-02
*/
@Controller
public class CoachAssessAction {
?@Autowired
?private CoachAssessService coachAssessService;
?/**
? * 顯示所有新聞信息并分頁
? *
? * @param entity
? * @return
? */
?@ResponseBody
?@RequestMapping("/isAdmin/findCoachAssess")
?public Pagination<CoachAssess> findCoachAssess(CoachAssess entity) {
? try {
? ?entity.setSortColumns("updateTime desc");
? ?return coachAssessService.findPageByCondition(entity);
? } catch (Exception e) {
? ?e.printStackTrace();
? }
? return new Pagination<>(0, new ArrayList<>());
?}
?/**
? * 刪除新聞信息
? *
? * @param id
? * @return
? */
?@ResponseBody
?@RequestMapping("/isAdmin/delCoachAssess")
?public ActionResult delCoachAssess(Integer id) {
? ActionResult res = new ActionResult();
? try {
? ?coachAssessService.deleteById(id);
? ?res.setSuccess(true);
? ?res.setMsg("刪除成功");
? } catch (Exception e) {
? ?e.printStackTrace();
? ?res.setMsg("出現(xiàn)異常,刪除失敗");
? }
? return res;
?}
?/**
? * 跳轉(zhuǎn)編輯頁面
? *
? * @param id
? * @return
? */
?@RequestMapping("/isAdmin/forwardEditCoachAssess")
?public ModelAndView forwardEditCoachAssess(Integer id) {
? ModelAndView model = new ModelAndView();
? model.setViewName("backstage/editCoachAssess");
? try {
? ?model.addObject("editCoachAssess", coachAssessService.findById(id));
? } catch (Exception e) {
? ?e.printStackTrace();
? }
? return model;
?}
?/**
? * 修改新聞信息
? *
? * @param entity
? * @return
? */
?@ResponseBody
?@RequestMapping("/isAdmin/upCoachAssess")
?public ActionResult upCoachAssess(CoachAssess entity, HttpSession session) {
? ActionResult res = new ActionResult();
? try {
? ?entity.setUpdateTime(new Date());
? ?SysUser sysUser = (SysUser) session.getAttribute("sysUser");
? ?entity.setUsername(sysUser.getName());
? ?coachAssessService.updateById(entity);
? ?res.setSuccess(true);
? ?res.setMsg("修改成功");
? } catch (Exception e) {
? ?e.printStackTrace();
? ?res.setMsg("出現(xiàn)異常,修改失敗");
? }
? return res;
?}
?/**
? * 添加新聞信息
? *
? * @param entity
? * @return
? */
?@ResponseBody
?@RequestMapping("/isAdmin/addCoachAssess")
?public ActionResult addCoachAssess(CoachAssess entity, HttpSession session) {
? ActionResult res = new ActionResult();
? try {
? ?entity.setUpdateTime(new Date());
? ?SysUser sysUser = (SysUser) session.getAttribute("sysUser");
? ?entity.setUsername(sysUser.getName());
? ?coachAssessService.save(entity);
? ?res.setSuccess(true);
? ?res.setMsg("添加成功");
? } catch (Exception e) {
? ?e.printStackTrace();
? ?res.setMsg("出現(xiàn)異常,添加失敗");
? }
? return res;
?}
?/**
? * 修改新聞信息狀態(tài)
? *
? * @param id
? * @return
? */
?@ResponseBody
?@RequestMapping("/isAdmin/updateCoachAssessState")
?public ActionResult updateCoachAssessState(CoachAssess entity) {
? ActionResult res = new ActionResult();
? try {
? ?coachAssessService.updateById(entity);
? ?res.setSuccess(true);
? ?res.setMsg("操作成功");
? } catch (Exception e) {
? ?e.printStackTrace();
? ?res.setMsg("出現(xiàn)異常,操作失敗");
? }
? return res;
?}
?/**
? * 顯示所有發(fā)布了的新聞信息并分頁
? *
? * @param entity
? * @return
? */
?@ResponseBody
?@RequestMapping("/user/findCoachAssessByPage")
?public Pagination<CoachAssess> findCoachAssessByPage(CoachAssess entity) {
? try {
? ?entity.setSortColumns("updateTime desc");
? ?return coachAssessService.findPageByCondition(entity);
? } catch (Exception e) {
? ?e.printStackTrace();
? }
? return new Pagination<>(0, new ArrayList<>());
?}
?@ResponseBody
?@RequestMapping("/user/queryCoachAssessCount")
?public Integer queryCoachAssessCount(CoachAssess entity) {
? Integer pageNum = 0;
? try {
? ?Integer count = coachAssessService.queryCoachAssessCount(entity);
? ?pageNum = (int) Math.ceil((float) count / entity.getLimit());
? } catch (Exception e) {
? ?e.printStackTrace();
? }
? return pageNum;
?}
?/**
? * 跳轉(zhuǎn)新聞詳情頁面
? *
? * @param id
? * @return
? */
?@RequestMapping("/user/forwardCoachAssessDetails")
?public ModelAndView forwardCoachAssessDetails(Integer id) {
? ModelAndView model = new ModelAndView();
? model.setViewName("forward:/coachAssessDetails.jsp");
? try {
? ?model.addObject("coachAssess", coachAssessService.findById(id));
? } catch (Exception e) {
? ?e.printStackTrace();
? }
? return model;
?}
}
代碼已經(jīng)上傳github,下載地址:https://github.com/21503882/net-cosmetic
總結(jié)
以上是生活随笔為你收集整理的Javaweb化妆品网上购物系统的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 四则运算算法实现(java)
- 下一篇: 管道-过滤器体系结构风格