ssm整合

pom.xml




  4.0.0

  com.hgd
  ssm
  1.0-SNAPSHOT
  war

  ssm Maven Webapp
  
  http://www.example.com

  
    UTF-8
    1.8
    1.8
  

  
    
    
      org.springframework
      spring-beans
      5.2.6.RELEASE
    
    
    
      org.springframework
      spring-core
      5.2.6.RELEASE
    
    
      org.springframework
      spring-context
      5.2.6.RELEASE
    
    
      org.springframework
      spring-expression
      5.2.6.RELEASE
    
    
    
      org.springframework
      spring-tx
      5.2.6.RELEASE
    
    
      org.springframework
      spring-jdbc
      5.2.6.RELEASE
    
    
    
      mysql
      mysql-connector-java
      5.1.47
    
    
    
      com.alibaba
      druid
      1.1.10
    
    
    
      org.mybatis
      mybatis
      3.5.3
    
    
    
      org.mybatis
      mybatis-spring
      2.0.3
    
    
    
      org.springframework
      spring-aspects
      5.2.4.RELEASE
    
    
      aopalliance
      aopalliance
      1.0
    
    
    
      org.springframework
      spring-web
      5.2.6.RELEASE
    
    
      org.springframework
      spring-webmvc
      5.2.6.RELEASE
    
    
    
      javax.servlet
      jstl
      1.2
    
    
    
      javax.servlet
      javax.servlet-api
      4.0.0
      provided
    

    
      org.springframework
      spring-context-support
      5.2.6.RELEASE
    
    
      org.springframework
      spring-oxm
      5.2.6.RELEASE
    
    
      com.thoughtworks.xstream
      xstream
      1.4.10
    

    
    
      com.fasterxml.jackson.core
      jackson-databind
      2.10.4
    

    
    
      org.springframework
      spring-test
      5.2.6.RELEASE
    

    
    
      junit
      junit
      4.13
    

    
    
      com.jayway.jsonpath
      json-path
      2.4.0
    

    
    
      commons-fileupload
      commons-fileupload
      1.4
    

  

  
    
      
      
        org.apache.maven.plugins
        maven-compiler-plugin
        3.2
        
          1.8
          1.8
          UTF-8
        
      

      
        org.apache.tomcat.maven
        tomcat7-maven-plugin
        2.2
        
          /
          80
        
      
    
  

jdbc.properties

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/hotel?characterEncoding=utf-8
jdbc.username=root
jdbc.password=123456

springmvc.xml




        
        

        
        
            
            
        

        
        

applicactionContext-dao.xml




    
    

    
    
        
        
        
        
    

    
    
        
        
        
        
    

    
        
        
    

applicationContext-service.xml




    
    

    

    
    
        
        
    

    
    
        
            
            
            
            
            
            
            
            
            
            
            
            
            
        
    

    
    
        
    

OrderController

package com.hgd.ssm.controller;

import com.hgd.ssm.po.Order;
import com.hgd.ssm.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @auther 黄国栋
 * @data 2020-06-25 09:30
 * @since
 */
@Controller
public class OrderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping("findAll")
    @ResponseBody
    public List findAll(){
        return orderService.findAll();
    }

}

OrderService

package com.hgd.ssm.service;

import com.hgd.ssm.po.Order;

import java.util.List;

public interface OrderService {

    List findAll();

}

package com.hgd.ssm.service;

import com.hgd.ssm.mapper.OrderMapper;
import com.hgd.ssm.po.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @auther 黄国栋
 * @data 2020-06-25 09:28
 * @since
 */
@Service
public class OrderServiceImpl implements OrderService{

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public List findAll() {
        return orderMapper.findAll();
    }

}

OrderMapper

package com.hgd.ssm.mapper;

import com.hgd.ssm.po.Order;

import java.util.List;

public interface OrderMapper {

    //查询所有
    List findAll();

}





    
    

Order

package com.hgd.ssm.po;

import java.util.Date;

/**
 * @auther 黄国栋
 * @data 2020-06-25 09:21
 * @since
 */
public class Order {
    private Integer id;
    private String orderCode;
    private Date orderDate;
    private Integer orderStatus;
    private Date payDate;
    private Integer tableId;
    private Double totalPrice;
    private Date updateDate;
    private Integer disabled;

    public Integer getId() {
        return id;
    }

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

    public String getOrderCode() {
        return orderCode;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Date getPayDate() {
        return payDate;
    }

    public void setPayDate(Date payDate) {
        this.payDate = payDate;
    }

    public Integer getTableId() {
        return tableId;
    }

    public void setTableId(Integer tableId) {
        this.tableId = tableId;
    }

    public Double getTotalPrice() {
        return totalPrice;
    }

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

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Integer getDisabled() {
        return disabled;
    }

    public void setDisabled(Integer disabled) {
        this.disabled = disabled;
    }

    @Override
    public String toString() {
        return "Order{" +
                "id=" + id +
                ", orderCode='" + orderCode + '\'' +
                ", orderDate=" + orderDate +
                ", orderStatus=" + orderStatus +
                ", payDate=" + payDate +
                ", tableId=" + tableId +
                ", totalPrice=" + totalPrice +
                ", updateDate=" + updateDate +
                ", disabled=" + disabled +
                '}';
    }
}

 

你可能感兴趣的:(spring,mvc)