javaWeb毕设分享 农产品销售管理系统【源码+论文】

文章目录

  • 一、项目设计
  • * 1\. 模块设计
    
    • 2. 实现效果
  • 二、部分源码
  • 项目源码

一、项目设计

项目分享:见文末!

1. 模块设计

会员子系统主要包括会员注册(系统必须,几乎每个系统都有)、购物车(一般买到的东西可以放购物车和直接付钱,这里本系统是统一放购物车)、顾客留言(供用户发表言论的地方)、商品浏览(本系统的主要功能也是系统的首页也是商务网站永恒的信仰,太常见了)、订单管理(查询用户自身所买东西的地方)、修改注册资料。会员子系统

在这里插入图片描述

在这里插入图片描述

2. 实现效果

在这里插入图片描述在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

二、部分源码

部分代码示例:


package com.itbaizhan.service;

import java.util.List;

import org.hibernate.*;

import com.itbaizhan.ORM.*;
import com.itbaizhan.base.BaseLog;

/** ��Ʒ���ࡢ��Ʒ���ؼ���Ʒҵ���߼�����ӿ�ʵ�� */
public class MerServiceImpl extends BaseLog implements MerService {

	/** ������Ʒ���� */
	public boolean addCategory(Category cate) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		boolean status = false;
		try{
			tx = session.beginTransaction();
			session.save(cate);
			tx.commit();
			status = true;
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�addCategory����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return status;
	}
	
	/** �����Ʒ���� */
	public List browseCategory() throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		List list = null;
		try{
			Query query = session.createQuery("from Category as a order by a.id");
			tx = session.beginTransaction();
			list = query.list();
			tx.commit();
			if (!Hibernate.isInitialized(list))Hibernate.initialize(list);
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�browseCategory����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return list;
	}
	
	/** ɾ��ָ������Ʒ���� */	
	public boolean delCategory(Integer id) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		boolean status = false;
		try{
			tx = session.beginTransaction();
			Category cate = (Category)session.load(Category.class, id);
			session.delete(cate);
			tx.commit();
			status = true;
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�delCategory����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return status;
	}
	
	/** װ��ָ������Ʒ���� */
	public Category loadCategory(Integer id) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		Category cate = null;
		try{
			tx = session.beginTransaction();
			cate = (Category)session.get(Category.class, id);
			tx.commit();
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�loadCategory����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return cate;
	}

	/** ������Ʒ���� */
	public boolean updateCategory(Category cate) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		boolean status = false;
		try{
			tx = session.beginTransaction();
			session.update(cate);
			tx.commit();
			status = true;
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�updateCategory����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return status;
	}

	/** ������Ʒ */
	public boolean addMer(Merchandise mer) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		boolean status = false;
		try{
			tx = session.beginTransaction();
			session.save(mer);
			tx.commit();
			status = true;
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�addMer����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return status;
	}

	/** �����Ʒ */
	public List browseMer(String hql) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		List list = null;
		try{
			Query query = session.createQuery(hql);
			tx = session.beginTransaction();
			list = query.list();
			tx.commit();
			if (!Hibernate.isInitialized(list))Hibernate.initialize(list);
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�browseMer����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return list;
	}

	/** ɾ��ָ������Ʒ */	
	public boolean delMer(Integer id) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		boolean status = false;
		try{
			tx = session.beginTransaction();
			Merchandise mer = (Merchandise)session.load(Merchandise.class, id);
			session.delete(mer);
			tx.commit();
			status = true;
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�delMer����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return status;
	}

	/** װ��ָ������Ʒ */
	public Merchandise loadMer(Integer id) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		Merchandise mer = null;
		try{
			tx = session.beginTransaction();
			mer = (Merchandise)session.get(Merchandise.class, id);
			tx.commit();
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�loadMer����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return mer;
	}

	/** ������Ʒ */
	public boolean updateMer(Merchandise mer) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		boolean status = false;
		try{
			tx = session.beginTransaction();
			session.update(mer);
			tx.commit();
			status = true;
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�updateMer����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return status;
	}

	/** ��ҳ�����Ʒ */
	public List browseMer(int pageSize, int pageNo, int cateId,boolean isSpecial) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		List list = null;
		try{
			String hql = "from Merchandise as a";
			if (isSpecial){	//�ؼ���Ʒ
				hql = hql + " where a.special=1";
			}else{ //��ͨ��Ʒ
				hql = hql + " where a.special=0";				
			}
			if (cateId!=0){ //ָ�����
				hql = hql + " and a.category.id="+cateId;
			}
			hql = hql + " order by a.id desc";
			Query query = session.createQuery(hql);
			query.setMaxResults(pageSize);
			query.setFirstResult((pageNo-1)*pageSize);
			tx = session.beginTransaction();
			list = query.list();
			tx.commit();
			if (!Hibernate.isInitialized(list))Hibernate.initialize(list);
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�browseMer����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return list;
	}

	/** ������Ʒ */
	public List browseMer(int pageSize, int pageNo, String hql) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		List list = null;
		try{
			Query query = session.createQuery(hql);
			query.setMaxResults(pageSize);
			query.setFirstResult((pageNo-1)*pageSize);
			tx = session.beginTransaction();
			list = query.list();
			tx.commit();
			if (!Hibernate.isInitialized(list))Hibernate.initialize(list);
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�browseMer����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return list;
	}
	
	/** ͳ�Ƽ�¼���� */
	public int countRecord(String hql) throws Exception {
		Session session = MySessionFactory.getSession();
		Transaction tx = null;
		int count = 0;
		try{
			tx = session.beginTransaction();
			Query query = session.createQuery(hql);
			query.setMaxResults(1);
			count = ((Integer)query.uniqueResult()).intValue();
			tx.commit();
		}catch(Exception ex){
			if(tx!=null)tx.rollback();
			logger.info("��ִ��MerServiceImpl���е�countRecord����ʱ���?\n");
			ex.printStackTrace();
		}finally{
			MySessionFactory.closeSession();
		}	
		return count;
	}
}

项目源码

项目分享:见文末!

**项目分享: ** https://blog.csdn.net/mojikopi

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
销售管理系统源码 第1章 系统登录 系统登录模块主要用于验证用户登录系统时输入的用户名、密码和验证码是否正确,只有合法的用户才可以进入系统,否则将不能进入此系统,系统登录页面如图1.1所示。 图1.1 登录页面 在用户名处输入“admin”,密码为“51aspx”,并输入正确的验证码,单击“确定”按钮,进入网页首页,如图1.2所示。 图1.2 首页 第2章 基本信息 基本信息主要包括:添加公司信息、添加商品信息、公司信息管理、商品信息管理。 2.1 添加公司信息 在功能导航区中单击“添加公司信息”按钮,在操作区会显示添加页面,如图2.1所示。此页面主要用于添加供应商及客户信息。在“所属类型”下拉列表中选择公司的所属类型,单击“添加”按钮,完成添加操作。 图2.1 添加公司信息 2.2 添加商品信息 在功能导航区中单击“添加公司信息”按钮,在操作区中会显示添加页面。添加商品信息页面的运行效果如图2.2所示。此页面的操作方法请参见2.1节的添加公司信息。 说明:供应商下拉列表中的信息是公司的所属类型为供应商的公司信息。 图2.2 添加商品信息 2.3 公司信息管理 在功能导航区中单击“公司信息管理”按钮,在操作区中会显示公司信息的管理页面。如图2.3所示。此页面主要实现修改及删除公司信息等功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值