10003 基于SSM开发的礼服租赁系统
代码:
鏈-椄:https://pan@baidu@com/s/1J6jgZDc60GVup3Se9NTpsw (把@换成 . 就可正常访问)
趧-紶-碼:9274
f/u枝此段-吶傛打开baidu網盤手机App,caozuo更方便哦
技术
JAVA
功能详情
前台功能: | 后台功能: |
---|---|
礼服图片展示和出售 | 系统相关信息展示 |
礼服的详细信息 | 礼服的分类 |
礼服的简介 | 礼服信息的维护 |
服装的公告 | 礼服的租赁信息 |
站台的信息 | 礼服的退租信息 |
会员的注册 | 物流的配送信息 |
后台的登录链接 | 物流的签收信息 |
联系管理员 | 游客的管理 |
新闻的管理 |
系统相关截图
● 前台首页
● 后台首页
domain实体类:
package com.liyan.domain;
import java.io.Serializable;
public class Account implements Serializable{
private Integer id;
private String name;
private Integer money;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getMoney() {
return money;
}
public void setMoney(Integer money) {
this.money = money;
}
@Override
public String toString() {
return "Account{" +
"id=" + id +
", name='" + name + '\'' +
", money=" + money +
'}';
}
}
dao接口:
package com.liyan.dao;
import com.liyan.domain.Account;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface IAccountDao {
@Select(“select * from account”)
List findAll();
@Insert("insert into account(name,money)values(#{name},#{money})")
void save(Account account);
}
service接口:
package com.liyan.service;
import com.liyan.domain.Account;
import java.util.List;
public interface IAccountService {
List findAll();
void save(Account account);
}
service实现类:
package com.liyan.service.impl;
import com.liyan.dao.IAccountDao;
import com.liyan.domain.Account;
import com.liyan.service.IAccountService;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service(“accountService”)
public class AccountServiceImpl implements IAccountService {
@Autowired
private IAccountDao accountDao;
public List findAll() {
return accountDao.findAll();
}
public void save(Account account) {
accountDao.save(account);
}
}
controller层代码:
package com.liyan.web.controller;
import com.liyan.domain.Account;
import com.liyan.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@Controller
@RequestMapping(“account”)
public class AccountController {
@Autowired
private IAccountService accountService;
@RequestMapping("save")
public String save(Account account){
accountService.save(account);
return "success";
}
@RequestMapping("findAll")
public ModelAndView findAll(){
Listaccounts=accountService.findAll();
System.out.println("查询了所有账户");
ModelAndView mv=new ModelAndView();
mv.setViewName("success");
mv.addObject("accounts",accounts);
return mv;
}
}
配置文件
applicationContext.xml:
jdbc.properties:
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssmtest
jdbc.username=root
jdbc.password=root
springmvc.xml:
success.jsp:
<%@ page contentType=“text/html;charset=UTF-8” language=“java” %>
web.xml:
org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:applicationContext.xml dispatcherServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:springmvc.xml 1 dispatcherServlet / characterEncodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 characterEncodingFilter /*index.jsp:
<%@page contentType=“text/html; UTF-8” language=“java” pageEncoding=“UTF-8” %>
测试类:
Test01springIOC:
package com.liyan.test;
import com.liyan.service.IAccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Test01SpringIOC {
public static void main(String[] args) {
ApplicationContext ac=new ClassPathXmlApplicationContext(“applicationContext.xml”);
IAccountService accountService=ac.getBean(“accountService”,IAccountService.class);
accountService.findAll();
}
}
Test02Mybatis:
package com.liyan.test;
import com.liyan.dao.IAccountDao;
import com.liyan.domain.Account;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.IOException;
import java.io.InputStream;
public class Test02Mybatis {
public static void main(String[] args) throws IOException {
InputStream in= Resources.getResourceAsStream(“SqlMapConfig.xml”);
SqlSessionFactoryBuilder builder=new SqlSessionFactoryBuilder();
SqlSessionFactory factory=builder.build(in);
SqlSession sqlSession=factory.openSession();
IAccountDao accountDao=sqlSession.getMapper(IAccountDao.class);
// Listaccounts=accountDao.findAll();
// for (Account account:accounts){
// System.out.println(account);
// }
Account account=new Account();
account.setName(“liyan”);
account.setMoney(20000);
accountDao.save(account);
sqlSession.commit();
sqlSession.close();
in.close();
}
}
Test03SpringMybatis:
package com.liyan.test;
import com.liyan.domain.Account;
import com.liyan.service.IAccountService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = “classpath:applicationContext.xml”)
public class Test03SpringMybatis {
@Autowired
private IAccountService accountService;
@Test
public void findAll(){
Listaccounts =accountService.findAll();
for (Account account:accounts){
System.out.println(account);
}
}
@Test
public void save(){
Account account=new Account();
account.setName("xiaoyanzi");
account.setMoney(55555);
accountService.save(account);
}
}
SqlMapConfig.xml:
pom包:
4.0.0
com.liyan
ssm2Demo
1.0-SNAPSHOT
war