JAVA-based B / S Mode quotation system computer parts

With the continuous development of social economy, the extent of the information society is also rising. People growing dependence on computers. Computer quality directly affect people's mood and efficiency of work and study. This paper uses Struts, Spring and Hibernate three open source framework designed and developed computer parts pricing system based on B / S mode, the system's application lets users spend a small amount of money to buy high-cost computer parts and accessories, Finally, to help users assemble into relatively high quality of the computer. The system has better expansibility and maintainability. The project uses the framework for SSM (MYECLIPSE), the choice of development tools for MYECLIPSE. Computer parts quotation system as a background item.
To complete the system, we first need to analyze the needs of the system. A computer parts quotation system should include user roles administrator user. In order to allow the user a smooth landing system to complete the related operations, landing roles you need to set up an account and password for each field.
In order to complete the function of the system needs to be set up spare parts order form, recording order information. It defines the relationship between the two tables in the order in which the fields corresponding to the number of parts shuliang orders, parts orders in price and jiage corresponding field.

The summary results for all data systems: the administrator (admin), user (yonghu), parts (sanjian), orders (dingdan)

Administrators table

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | administrator the above mentioned id 
username |  VARCHAR ( 255 ) |  | account 
password |  VARCHAR ( 255 ) |  | password

 

user table

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | user the above mentioned id 
username |  VARCHAR ( 255 ) |  | account 
password |  VARCHAR ( 255 ) |  | password

 

Spare parts list

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | spare parts the above mentioned id 
mingzi |  VARCHAR ( 255 ) |  | name 
pinpai |  VARCHAR ( 255 ) |  | brand 
jiage |  VARCHAR ( 255 ) |  | Price 
Shuliang |  VARCHAR ( 255 ) |  | number
xingneng |  VARCHAR ( 255 ) |  | performance 
zhuangjifeiyong |  VARCHAR ( 255 ) |  | installed cost

 

Orders table

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | orders for the above mentioned id 
pinpai |  VARCHAR ( 255 ) |  | brand 
Shuliang |  VARCHAR ( 255 ) |  | number 
jiage |  VARCHAR ( 255 ) |  | Price

 

 

 

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------

-- ----------------------------

-- Table structure for ggjsjsjbjxitong

-- ----------------------------

DROP TABLE IF EXISTS `t_admin`;

CREATE TABLE `t_admin` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '管理员id',`username` VARCHAR(255) DEFAULT NULL COMMENT '账号', `password` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' password ' , a PRIMARY  KEY (` id`) 

) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' Administrators ' ; 

- ----------- ----------------- 

the DROP  TABLE  the IF  EXISTS `t_yonghu`; 

the CREATE  TABLE ` t_yonghu` ( `id` the INT ( . 11 ) the NOT  NULL the AUTO_INCREMENT the COMMENT ' user id',`username` VARCHAR(255) DEFAULT NULL COMMENT '账号',`password` VARCHAR(255) DEFAULT NULL COMMENT '密码',PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='用户';

-- ----------------------------

DROP TABLE IF EXISTS `t_sanjian`;

CREATE TABLE `t_sanjian` (` id` INT ( 11 ) the NOT  NULL AUTO_INCREMENT the COMMENT ' parts the above mentioned id ' , `mingzi` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' name ' ,` pinpai` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' brand ' , jiage` ` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' price ' ,` shuliang` VARCHAR (255 ) the DEFAULT  NULL the COMMENT ' number ' , `xingneng` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' performance ' ,` zhuangjifeiyong` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' cost of installation ' , a PRIMARY  KEY ( `id`) 

) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' parts ' ; 

- ----------------------------

DROP TABLE IF EXISTS `t_dingdan`;

CREATE TABLE `t_dingdan` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '订单id',`pinpai` VARCHAR(255) DEFAULT NULL COMMENT '品牌',`shuliang` VARCHAR(255) DEFAULT NULL COMMENT '数量',`jiage` VARCHAR(255) DEFAULT NULLThe COMMENT ' price ' , a PRIMARY  KEY ( `id`) 

) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' line ' ;

 

 

Computer parts query module:

In the background jisuanjisanjianguanli method, get all the data through selectByexample method. Save it to your request by foreach method in the page

Circulated to display the table. Computer parts to complete the query. Specific code as follows:

Generating a sample-based computer parts, define the query by example JisuanjisanjianExample example = new JisuanjisanjianExample ();

All computer parts query information List jisuanjisanjianall = jisuanjisanjiandao.selectByExample (example) by the method jisuanjisanjiandao of selectByExample;

The computer parts information stored in the request, on display request.setAttribute ( "jisuanjisanjianall", jisuanjisanjianall) page by foreach method;

Computer parts return management interface

return "forward:/jisuanjisanjianguanli.action";

Modify the computer parts modules:

Information has been uploaded to the computer parts can be modified operation, this part of the operation in computer spare parts management interface, click the Modify button to jump to the page modify computer parts. In the edit screen, the computer will initialize all parts of the field information, field information including name, brand, price, quantity, performance and cost of installation. Content id field information obtained through computer parts. The modified information is passed to the receiving jisuanjisanjianController jisuanjisanjian. There is contained in jisuanjisanjianController advance defined jisuanjisanjiandao, the parameter is jisuanjisanjianMapper is achieved. jisuanjisanjianMapper defined modification method, modify the method used here is updateByPrimaryKeySelective, the method can be modified after the synchronization information to the database, the information will eventually be modified successfully returned the page. The part of the code as follows:

Modified corresponding computer parts jisuanjisanjiandao.updateByPrimaryKeySelective (jisuanjisanjian) by modifying the method according to the id of jisuanjisanjiandao;

Success will modify the computer parts information, save the message request, the user is given prompt request.setAttribute in the page ( "message", "modify the computer parts information successfully");

Computer parts return management interface

return "forward:/jisuanjisanjianguanli.action";

Guess you like

Origin www.cnblogs.com/rt14/p/11568200.html