锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

SMBMS 三层架构的简单案例 (超市订单管理系统)

时间:2023-02-02 21:30:00 9zj1b2连接器

14.SSM框架 SMBMS

MVC三层架构

在这里插入图片描述

SMBMS基本登录演示

1.搭建一个mawen-web项目

2.测试Tomcat正常运行

配置最新的web.xml配置 否则可能css风格无法呈现

3.导入相应的jar包

  <dependencies>     <dependency>       <!-- 单元测试 可能会产生test标签 删除即可-->       <groupId>junit</groupId>       <artifactId>junit</artifactId>       <version>4.12</version>     </dependency>      <dependency>       <!-- Jsp依赖-->       <groupId>javax.servlet.jsp</groupId>       <artifactId>javax.servlet.jsp-api</artifactId>       <version>2.3.3</version>       <scope>provided</scope>     </dependency>     <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->     <dependency>       <!-- Servlet依赖-->       <groupId>javax.servlet</groupId>       <artifactId>javax.servlet-api</artifactId>       <version>4.0.1</version>       <scope>provided</scope> </dependency> <!-- https://mvnrepository.com/artifact/taglibs/standard --> <dependency> <!-- Standard标签库--> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.2</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl-api --> <dependency> <!-- Jstl表达式依赖--> <groupId>javax.servlet.jsp.jstl</groupId> <artifactId>jstl-api</artifactId> <version>1.2</version> </dependency> <dependency> <!-- Java连接数据库--> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.47</version> </dependency> </dependencies> 

4.编写实体类

Bill Provider Role User用户类 对应Smbms数据库的表单 表类映射

1.Bill

import java.math.BigDecimal;
import java.util.Date;

public class Bill { 
        
    private Integer id;
    private String billCode;//账单编码
    private String productName;//商品全名
    private String productDesc;//商品描述
    private String productUnit;//商品单位
    private BigDecimal productCount;//商品数量
    private BigDecimal totalPrice;//总金额
    private Integer isPayment;//是否支付
    private Integer providerId;//供应商ID
    private Integer createdBy;//创建者
    private Date creationDate;//创建时间
    private Integer modifyDate;//更新时间
    private String providerName;//供应商名称

    public Integer getId() { 
        
        return id;
    }

    public void setId(Integer id) { 
        
        this.id = id;
    }

    public String getBillCode() { 
        
        return billCode;
    }

    public void setBillCode(String billCode) { 
        
        this.billCode = billCode;
    }

    public String getProductName() { 
        
        return productName;
    }

    public void setProductName(String productName) { 
        
        this.productName = productName;
    }

    public String getProductDesc() { 
        
        return productDesc;
    }

    public void setProductDesc(String productDesc) { 
        
        this.productDesc = productDesc;
    }

    public String getProductUnit() { 
        
        return productUnit;
    }

    public void setProductUnit(String productUnit) { 
        
        this.productUnit = productUnit;
    }

    public BigDecimal getProductCount() { 
        
        return productCount;
    }

    public void setProductCount(BigDecimal productCount) { 
        
        this.productCount = productCount;
    }

    public BigDecimal getTotalPrice() { 
        
        return totalPrice;
    }

    public void setTotalPrice(BigDecimal totalPrice) { 
        
        this.totalPrice = totalPrice;
    }

    public Integer getIsPayment() { 
        
        return isPayment;
    }

    public void setIsPayment(Integer isPayment) { 
        
        this.isPayment = isPayment;
    }

    public Integer getProviderId() { 
        
        return providerId;
    }

    public void setProviderId(Integer providerId) { 
        
        this.providerId = providerId;
    }

    public Integer getCreatedBy() { 
        
        return createdBy;
    }

    public void setCreatedBy(Integer createdBy) { 
        
        this.createdBy = createdBy;
    }

    public Date getCreationDate() { 
        
        return creationDate;
    }

    public void setCreationDate(Date creationDate) { 
        
        this.creationDate = creationDate;
    }

    public Integer getModifyDate() { 
        
        return modifyDate;
    }

    public void setModifyDate(Integer modifyDate) { 
        
        this.modifyDate = modifyDate;
    }

    public String getProviderName() { 
        
        return providerName;
    }

    public void setProviderName(String providerName) { 
        
        this.providerName = providerName;
    }
}

2.Provide

import java.util.Date;

public class Provider { 
        
    private Integer id;// id
    private String proCode;//供应商编码
    private String proName;//供应商名字
    private String proDesc;//供应商描述
    private String proContact;//供应商联系人
    private String proPhone;//供应商电话
    private String proAddress;//供应商地址
    private String proFax;//供应商传真
    private Integer createdBy;//创建者
    private Date creationDate;//创建时间
    private Integer modifyBy;//更新者
    private Date modifyDate;//更新时间


    public Integer getId() { 
        
        return id;
    }

    public void setId(Integer id) { 
        
        this.id = id;
    }

    public String getProCode() { 
        
        return proCode;
    }

    public void setProCode(String proCode) { 
        
        this.proCode = proCode;
    }

    public String getProName() { 
        
        return proName;
    }

    public void setProName(String proName) { 
        
        this.proName = proName;
    }

    public String getProDesc() { 
        
        return proDesc;
    }

    public void setProDesc(String proDesc) { 
        
        this.proDesc = proDesc;
    }

    public String getProContact() { 
        
        return proContact;
    }

    public void setProContact(String proContact) { 
        
        this.proContact = proContact;
    }

    public String getProPhone() { 
        
        return proPhone;
    }

    public void setProPhone(String proPhone) { 
        
        this.proPhone = proPhone;
    }

    public String getProAdress() { 
        
        return proAddress;
    }

    public void setProAdress(String proAdress) { 
        
        this.proAddress = proAdress;
    }

    public String getProFax() { 
        
        return proFax;
    }

    public void setProFax(String proFax) { 
        
        this.proFax = proFax;
    }

    public Integer getCreatedBy() { 
        
        return createdBy;
    }

    public void setCreatedBy(Integer createdBy) { 
        
        this.createdBy = createdBy;
    }

    public Date getCreationDate() { 
        
        return creationDate;
    }

    public void setCreationDate(Date creationDate) { 
        
        this.creationDate = creationDate;
    }

    public Integer getModifyBy() { 
        
        return modifyBy;
    }

    public void setModifyBy(Integer modifyBy) { 
        
        this.modifyBy = modifyBy;
    }

    public Date getModifyDate() { 
        
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) { 
        
        this.modifyDate = modifyDate;
    }
}

3.Role

import java.util.Date;

public class Role { 
        
    private Integer id;//id
    private String roleCode;//角色编码
    private String roleName;//角色名称
    private Integer createdBy;//创建者
    private Date creationDate;//创建时间
    private Integer modifyBy;//更新者
    private Date modifyDate;//更新时间

    public Integer getId() { 
        
        return id;
    }

    public void setId(Integer id) { 
        
        this.id = id;
    }

    public String getRoleCode() { 
        
        return roleCode;
    }

    public void setRoleCode(String roleCode) { 
        
        this.roleCode = roleCode;
    }

    public String getRoleName() { 
        
        return roleName;
    }

    public void setRoleName(String roleName) { 
        
        this.roleName = roleName;
    }

    public Integer getCreatedBy() { 
        
        return createdBy;
    }

    public void setCreatedBy(Integer createdBy) { 
        
        this.createdBy = createdBy;
    }

    public Date getCreationDate() { 
        
        return creationDate;
    }

    public void setCreationDate(Date creationDate) { 
        
        this.creationDate = creationDate;
    }

    public Integer getModifyBy() { 
        
        return modifyBy;
    }

    public void setModifyBy(Integer modifyBy) { 
        
        this.modifyBy = modifyBy;
    }

    public Date getModifyDate() { 
        
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) { 
        
        this.modifyDate = modifyDate;
    }
}

4.User

import java.util.Date;

public class User { 
        
    private Integer id; //id
    private String userCode; //用户编码
    private String username; //用户名称
    private String userPassword; //用户密码
    private Integer gender; //性别
    private Date birthday; //用户生日
    private String phone;//用户电话
    private String address;//用户地址
    private Integer userRole;//用户角色
    private Integer createdBy;//创建者
    private Date creationDate;//创建时间
    private Integer modifyBy;//更新者
    private Date modifyDate;//更新时间
    private Integer age;//用户年龄
    private String userRolename;  //用户角色名称


    public Integer getId(int id) { 
        
        return this.id;
    }

    public void setId(Integer id) { 
        
        this.id = id;
    }

    public String getUserCode(String userCode)  { 
        
        return this.userCode;
    }

    public void setUserCode(String userCode) { 
        
        this.userCode = userCode;
    }

    public String getUsername() { 
        
        return username;
    }

    public void setUsername(String username) { 
        
        this.username = username;
    }

    public String getUserPassword() { 
        
        return userPassword;
    }

    public void setUserPassword(String userPassword) { 
        
        this.userPassword = userPassword;
    }

    public Integer getGender() { 
        
        return gender;
    }

    public void setGender(Integer gender) { 
        
        this.gender = gender;
    }

    public Date getBirthday() { 
        
        return birthday;
    }

    public void setBirthday(Date birthday) { 
        
        this.birthday = birthday;
    }

    public String getPhone() { 
        
        return phone;
    }

    public void setPhone(String phone) { 
        
        this.phone = phone;
    }

    public String getAddress() { 
        
        return address;
    }

    public void setAddress(String address) { 
        
        this.address = address;
    }

    public Integer getUserRole() { 
        
        return userRole;
    }

    public void setUserRole(Integer userRole) { 
        
        this.userRole = userRole;
    }

    public Integer getCreatedBy() { 
        
        return createdBy;
    }

    public void setCreatedBy(Integer createdBy) { 
        
        this.createdBy = createdBy;
    }

    public Date getCreationDate() { 
        
        return creationDate;
    }

    public void setCreationDate(Date creationDate) { 
        
        this.creationDate = creationDate;
    }

    public Integer getModifyBy() { 
        
        return modifyBy;
    }

    public void setModifyBy(Integer modifyBy) { 
        
        this.modifyBy = modifyBy;
    }

    public Date getModifyDate() { 
        
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) { 
        
        this.modifyDate = modifyDate;
    元器件数据手册IC替代型号,打造电子元器件IC百科大全!
          

相关文章