基于SSM的花店系统

发布时间 2023-05-08 22:44:25作者: Qi柒

 基于Idea开发的SSM花店项目,文章包含源码,数据库文件

开发工具:Intellij IDEA

数据库:MySQL5.7

  • 1、项目名称

        有间花店

  • 2、项目背景

                无论现代社会如何进一步发展,鲜花一直都肩负着人类情感交流的重要使命。随着经济的不断发展,人们生活水平的提高,精神层面的需求不断提升,花卉消费近年来也呈现越来越旺的趋势。鲜花,散发的气味可以起到一定的缓和人们急躁的心绪,可以促使人们全神贯注地去做身边的事情;鲜花也可以作为礼物,可以美化家居,可以表达情感,可以陶冶身心等等
花的用途可谓多种多样。而且随着互联网技术的飞速发展,互联网已经走进了千家万户,网上交易的成熟性以及安全性不断增强,使得电子商务正在飞速发展。在这样的背景下我们创办的网络、门面、电话一体的校园花店,以鲜花专递为市场切入
点,兼顾网站长期市场占有率和短期资金回报率以抢占市场。以满足个性消费为主题,以鲜花为试点带动其他产品的发展进而最终形成具有"湖北民院xx花店"自己品牌优势的市场。

 

  • 3、项目技术

        SpringSpringMVC + Mybatis

 

  • 4、项目所需配置:

        application-dao.xml:配置Spring连接数据库

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
	   http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd">

    <!--<context:property-placeholder location="classpath:druid.properties"/>-->
    <!-- spring配置文件,此文件负责dao层 (摒弃mybatis主配置文件)-->
    <!--配置数据源信息-->
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://localhost:3306/flower1?useSSL=true&amp;useUnicode=true&amp;characterEncoding=utf8"/>
        <property name="username" value="root"/>
        <property name="password" value="123456"/>
    </bean>

    <!--配置spring整合mybatis框架的SQLSessionFactoryBean-->
    <bean class="org.mybatis.spring.SqlSessionFactoryBean" id="sqlSessionFactory">
        <property name="dataSource" ref="dataSource"/>
        <property name="configLocation" value="classpath:mybatis-config.xml"/>
        <property name="typeAliasesPackage" value="cn.entity"/>
        <property name="plugins">
            <array>
                <bean class="com.github.pagehelper.PageInterceptor">
                    <property name="properties">
                        <value>
                            <!--配置PageHelper-->
                            offsetAsPageNum=true
                            reasonable=true
                            rowBoundsWithCount=true
                            pageSizeZero=true
                        </value>
                    </property>
                </bean>
            </array>
        </property>
    </bean>


    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <!--basePackage:这个属性是映射接口的包-->
        <property name="basePackage" value="cn.Mapper"/>
    </bean>

    <context:component-scan base-package="cn.Mapper,cn.Service"/>

</beans>

       Spring-mvc.xml用于与web层交互,配置拦截器,模型视图,文件上传以及加载静态资源

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       	    http://www.springframework.org/schema/beans/spring-beans.xsd
       	    http://www.springframework.org/schema/mvc
       	    http://www.springframework.org/schema/mvc/spring-mvc.xsd
       	    http://www.springframework.org/schema/context
       	    http://www.springframework.org/schema/context/spring-context.xsd">
    <!--扫描注解-->
    <context:component-scan base-package="cn.Controller,cn.Service"/>
    <mvc:default-servlet-handler/>
    <!--提供Controller请求转发,json自动转换等功能-->
    <mvc:annotation-driven/>

    <!--模型视图-->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

   <!--文件上传-->
    <bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver" id="multipartResolver">
        <property name="defaultEncoding" value="utf-8"/>
        <!--&lt;!&ndash; 上传文件大小上限,单位为字节(10485760=10M) &ndash;&gt;-->
        <property name="maxUploadSize" value="10485760"/>
        <property name="maxInMemorySize" value="40960"/>
    </bean>

    <mvc:interceptors>
        <mvc:interceptor>
            <!-- 拦截的路径   -->
            <mvc:mapping path="/addCart.do"/>
            <mvc:mapping path="/showOrder1.do"/>
            <!-- 自己定义的拦截器位置   -->
            <bean class="cn.interceptor.UserInterceptor"></bean>
        </mvc:interceptor>
    </mvc:interceptors>
</beans>

        web.xml:配置前端控制器,监听器

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
    <welcome-file-list>
        <welcome-file>welcome.jsp</welcome-file>
    </welcome-file-list>
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>*.jpg</url-pattern>
        <url-pattern>*.png</url-pattern>
    </servlet-mapping>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:application-*.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>DispatcherServlet</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:Spring-mvc.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>DispatcherServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>


    <filter>
        <filter-name>encoding</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>encoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>
  • 5、项目内容展示:

登录页面

 

首页:

 

 

商品详情页:

 

 商品分类:

 

 

 购物车页:

 

订单页:

 

 

后台页:

 

 

 该项目页面美观,逻辑清晰,适合初学者练手

以上便是SSM花店项目的大致页面介绍 如有需要请添加wx:Qi213812