- 一個很簡單的汽車管理的系統
- 主要通過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/15yioiprT8xNsTf1EfDpE1Q&shfl=sharepset