Record learning every day, have a good mood every day. * ^ _ ^ *
When studying the civil aviation ticket management system project, to facilitate future access to timely, record it in this platform in the development process of the project. In the study, when the selection of the SSM (MYECLIPSE), whether this framework is to learn or use are very convenient, simple and approachable. Is a framework that we can focus on learning to learn programming, I chose MYECLIPSE in the development of the civil aviation ticket management system project to build SSM (MYECLIPSE) framework, will eventually civil aviation ticket management system project development project for a background.
The project has included the Administrator user role, user, each role contains its own user name and password.
Orders contacted the ticket, the user, by associating making ticket, established a link between users, enhanced usability and convenience of the system. Enhancing the user experience. Relationship between them is qidian field corresponds to the start of ticket orders, zhongdian field corresponds to the end of the ticket orders, ticket orders corresponding to the id and ticket id field, nicheng field corresponds to the user and the user's orders, orders corresponding to the user id id field with the user.
The summary results for all data systems: the administrator (admin), tickets (jipiao), user (yonghu), 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
Tickets table
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | tickets from the above mentioned id Qidian | VARCHAR ( 255 ) | | start of Zhongdian | VARCHAR ( 255 ) | | end Shijian | VARCHAR ( 255 ) | | time hangkonggongsi | VARCHAR ( 255 ) | | airline
user table
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | user the above mentioned id nicheng | VARCHAR ( 255 ) | | nickname username | VARCHAR ( 255 ) | | account password | VARCHAR ( 255 ) | | password yue | VARCHAR ( 255 ) | | balance
Orders table
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | orders for the above mentioned id Qidian | VARCHAR ( 255 ) | | start of Zhongdian | VARCHAR ( 255 ) | | end jibiaoid | VARCHAR ( 255 ) | | tickets the above mentioned id yonghu | VARCHAR ( 255 ) | |User yonghuid | VARCHAR ( 255 ) | | user id
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- ---------------------------- -- Table structure for ggwangshangjiaoyi -- ---------------------------- 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_jipiao`; the CREATE TABLE ` t_jipiao` ( `id` the INT ( . 11 ) the NOT NULL the AUTO_INCREMENT the COMMENT ' ticket id' , `Qidian` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' starting point ' ,` zhongdian` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' end ' , `shijian` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' time ' ,` hangkonggongsi` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' airline ' , PRIMARY KEY ( `id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='机票'; -- ---------------------------- DROP TABLE IF EXISTS `t_yonghu`; CREATE TABLE `t_yonghu` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '用户id',`nicheng` VARCHAR(255) DEFAULT NULL COMMENT '昵称',`username` VARCHAR(255 ) the DEFAULT NULL the COMMENT ' account number ' , `password` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' password ' ,` yue` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' balance ' , a PRIMARY KEY ( `id`) ) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' user ' ; - ---------------------------- DROP TABLE IF EXISTS `t_dingdan`; CREATE TABLE `t_dingdan` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '订单id',`qidian` VARCHAR(255) DEFAULT NULL COMMENT '起点',`zhongdian` VARCHAR(255) DEFAULT NULL COMMENT '终点',`jibiaoid` INT(11) DEFAULT NULLThe COMMENT ' ticket ID ' , `yonghu` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' user ' ,` yonghuid` the INT ( . 11 ) the DEFAULT NULL the COMMENT ' user ID ' , a PRIMARY KEY ( `id`) ) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' line ' ;
Flights to add modules:
By adding module tickets, tickets add operation can be completed. Jump to Add Flights page in the page, all of the information input tickets, click the Add operation, can be submitted to the ticket data to post in jipiaoController. Field information, including ticket included in the start, end, time, airline. In jipiaoController accept all ticket parameters defined jipiao. Using the insert method jipiaodao jipiao entities into the database. The process of adding data corresponding to the matching jipiaoxml complete the insertion operation is performed in the sql statement in jipiaoMapper. The part of the core code is as follows:
The page transmitted by the insert method jipiaodao tickets added to the database jipiaodao.insert (jipiao);
Add the successful ticket information, saved to the message request, the user is given the page prompt request.setAttribute ( "message", "add the ticket success");
Return ticket management interface
return "forward:/tianjiajipiao.action";
Find fares modules:
Ticket query module implementations to initiate jipiaoguanli.action request page. By this request, the response to the server jipiaoController class jipiaoguanli, query operation data in the process by selectByexample. After all ticket information query, save it to request the jipiaoall in, on display in the page and return jipiaoguanli.jsp, the part of the core code is as follows:
Generating a ticket based sample, defined by the example query JipiaoExample example = new JipiaoExample ();
Check out all the ticket information List jipiaoall = jipiaodao.selectByExample (example) by selectByExample method of jipiaodao;
Ticket information will be stored in the request, on display request.setAttribute ( "jipiaoall", jipiaoall) page by foreach method;
Return ticket management interface
return "forward:/jipiaoguanli.action";
Tickets modification module:
For ticket information has been uploaded can be modified to operate, the part of the operation in the ticket management interface, click the Modify button to jump to modify the ticket page. In the modified page will initialize all fields ticket information, field information including start, end, time, airline. Field information content available through ticket id. The modified information is passed to the receiving jipiaoController jipiao. There is contained in jipiaoController advance defined jipiaodao, the parameter is jipiaoMapper is achieved. jipiaoMapper 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:
The corresponding ticket jipiaodao.updateByPrimaryKeySelective modified by modifying the method jipiaodao id's (jipiao);
Ticket information will be modified successfully, save the message request, the user is given prompt request.setAttribute in the page ( "message", "modify ticket information successfully");
Return ticket management interface
return "forward:/jipiaoguanli.action";
Tickets delete modules:
Tickets delete function is implemented in jipiaoController, the implementation is shanchujipiao. shanchujipiao.action the page by the get method? Id form will need to remove the ticket id uploaded to the server in response to a corresponding method, call deleteByPrimaryKey method jipiaodao in complete deletion. Will delete successful message is returned to the page, complete the operation to delete data. The part of the core code:
Delete by deleting the corresponding method according jipiaodao ticket id jipiaodao.deleteByPrimaryKey (id);
Ticket information will be deleted successfully saved to the message request, the user is given prompt request.setAttribute in the page ( "message", "delete ticket success");
Return ticket management interface
return "forward:/jipiaoguanli.action";