- 一个很简单的汽车管理的系统
- 主要通过jsp,sql数据库来实现
- 来看下效果图
上面吧没有录制
效果图到这里就结束了下面就是大家关心的代码咯
我们先看下包是怎样的构建
下面就是代码咯
sql的代码
CREATE DATABASE MyDB
ON PRIMARY
(
NAME = 'MyDB_data',//你要创建的数据库名称
FILENAME = 'D:\DATA\MyDB_data.mdf',//这里写你要保存的路径
SIZE = 10MB,
MAXSIZE = 50MB,
FILEGROWTH = 10%
)
LOG ON
(
NAME = 'MyDB_log',//你要创建的数据库名称
FILENAME = 'D:\DATA\MyDB_log.ldf',//这里写你要保存的路径
SIZE = 10MB,
FILEGROWTH = 1MB
)
USE MyDB
CREATE TABLE car//表的名字
(
id int primary key identity(1,1) not null,
car_Brand varchar(64) not null,
car_Type varchar(64) not null,
car_Length float not null,
car_Width float not null,
car_Height float not null,
car_Color varchar(64) not null,
is_Electric_Car int not null,
number int
)
Car.Java的代码
public class Car {
private int id;
private String carBrand;
private String carType;
private float carLength;
private float carWidth;
private float carHeight;
private String carColor;
private int isElectricCar;
private int number;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCarBrand() {
return carBrand;
}
public void setCarBrand(String carBrand) {
this.carBrand = carBrand;
}
public String getCarType() {
return carType;
}
public void setCarType(String carType) {
this.carType = carType;
}
public float getCarLength() {
return carLength;
}
public void setCarLength(float carLength) {
this.carLength = carLength;
}
public float getCarWidth() {
return carWidth;
}
public void setCarWidth(float carWidth) {
this.carWidth = carWidth;
}
public float getCarHeight() {
return carHeight;
}
public void setCarHeight(float carHeight) {
this.carHeight = carHeight;
}
public String getCarColor() {
return carColor;
}
public void setCarColor(String carColor) {
this.carColor = carColor;
}
public int getIsElectricCar() {
return isElectricCar;
}
public void setIsElectricCar(int isElectricCar) {
this.isElectricCar = isElectricCar;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
}
CarService.java的代码
public interface CarService{
/**
* 查询
*/
List<Car> list();
/**
* 删除
*/
boolean delete(Integer id);
/**
* 修改
*/
boolean update(Car car);
/**
* 修改查询
*/
List<Car> updateS(int id);
/**
* 添加
*/
boolean add(Car car);
}
由于代码比较多全部放进来比较乱我把真个文件放在下方链接有需要的可以下载使用哦
下载的链接:https://pan.baidu.com/s/1kp4Z01xpA_y6EI7JJt91mQ 提取码: y6de