Today, a friend and together to complete a project information inquiry system, we use in the development of the framework is SSM (MYECLIPSE) framework. Limited knowledge of my friend, only this framework, ha ha, is designed to facilitate him. As usual selection of simple and convenient MYECLIPSE as a development tool, which is a background program. Introduction of this system is as follows: query information is the information management in a very important part, it stores a lot of information technology, economy, production, personnel, equipment and market database information system, from which you want quickly and easily the found the required information, is the basis of the information inquiry system. Information and Energy, as the material is an important resource for social and economic development. Data is recorded on the medium can be identified in some of a string of symbols, the objective is to target, kind of representation, it can be collected and processed by manual or automated means described in the form of facts, ideas and instructions; information is data after interpretation, or processing, it has an impact on people's behavior and give a sense of the data. The information processing includes the data converting them from acquiring the information, appropriately processed, the entire process again the recipient information for providing information. Generalized information processing generally includes: collection, storage, processing, transmission, control information retrieval and the like. , A user should contain information inquiry system administrator roles, 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.
The summary results for all data systems: the administrator (admin), user (yonghu), acquisition (caiji), retrieval (jiansuo)
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 Xingming | VARCHAR ( 255 ) | | Name xingbie | VARCHAR ( 255 ) | | Sex nianling | VARCHAR ( 255 ) | | Age username | VARCHAR ( 255 ) | |Account password | VARCHAR ( 255 ) | | password quanxian | VARCHAR ( 255 ) | | rights
Collection table
Field Name | Type | properties | Description ID | the INT ( . 11 ) | a PRIMARY KEY | acquired ID neirong | VARCHAR ( 255 ) | | Content timu | VARCHAR ( 255 ) | | Title Shijian | VARCHAR ( 255 ) | | Time
Retrieval table
Field Name | Type | properties | Description ID | the INT ( . 11 ) | a PRIMARY KEY | retrieved ID Zhonglei | VARCHAR ( 255 ) | | kind leixing | VARCHAR ( 255 ) | | type Shijian | VARCHAR ( 255 ) | | Time
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- ---------------------------- -- Table structure for ggxinxichaxunxt -- ---------------------------- 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' , `Xingming` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' name ' ,` xingbie` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' sex ' , `nianling` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' Age ' ,` username` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' account number ' , `password` VARCHAR ( 255) DEFAULT NULL COMMENT '密码',`quanxian` VARCHAR(255) DEFAULT NULL COMMENT '权限',PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='用户'; -- ---------------------------- DROP TABLE IF EXISTS `t_caiji`; CREATE TABLE `t_caiji` (`id` INT(11) The NOT NULL the AUTO_INCREMENT the COMMENT ' acquisition ID ' , `neirong` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' content ' ,` timu` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' subject ' , `shijian` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' time ' , a PRIMARY KEY ( `id`) ) ENGINE = MyISAM the DEFAULT CHARSET=utf8 COMMENT='采集'; -- ---------------------------- DROP TABLE IF EXISTS `t_jiansuo`; CREATE TABLE `t_jiansuo` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '检索id',`zhonglei` VARCHAR(255) DEFAULT NULL COMMENT '种类',`leixing` VARCHAR(255) DEFAULT NULLThe COMMENT ' Type ' , `shijian` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' time ' , a PRIMARY KEY (` id`) ) ENGINE = MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' retrieve ' ;
Add search module:
By adding retrieval module, the operation may be retrieved complete addition. Add the page to jump to the search page , enter all of the information retrieval, click the Add operation, you can retrieve the data submitted to the jiansuoController in to post. Field included in the information retrieval including the type, type, time. In jiansuoController accept all the search parameters by defining jiansuo. Using the insert method jiansuodao jiansuo entities into the database. The process of adding data corresponding to the matching jiansuoxml complete the insertion operation is performed in the sql statement in jiansuoMapper. The part of the core code is as follows:
Jiansuodao by the insert method of transmitting the retrieved pages to add to the database jiansuodao.insert (jiansuo);
Add the successful retrieval of information stored in the message request, the user is given the page prompt request.setAttribute ( "message", "add to retrieve success");
Return to retrieve management interface
return "forward:/tianjiajiansuo.action";
Query module:
When entering the search query page in a browser, then the browser address bar is jiansuoguanli.action, the address will respond jiansuoController class jiansuoguanli, in the process, get all the information retrieved by selectByexample method, and the information save the request, make cycle through the pages. The part of the core code is as follows:
Generating a sample-based retrieval, query by example defined JiansuoExample example = new JiansuoExample ();
Query all the retrieval information List jiansuoall = jiansuodao.selectByExample (example) by the method jiansuodao of selectByExample;
To retrieve information stored in the request, on display request.setAttribute ( "jiansuoall", jiansuoall) foreach method by page;
Return to retrieve management interface
return "forward:/jiansuoguanli.action";
Modify search module:
To retrieve information has been uploaded can be modified operation, this part of the operation in the retrieval management interface, click the Modify button to jump to retrieve the modified page. In the edit screen, the search field to initialize all information, including the type of field information, type, time. Information obtained through field content retrieval id. The modified information is passed to the receiving jiansuoController jiansuo. There is contained in jiansuoController advance defined jiansuodao, the parameter is jiansuoMapper is achieved. jiansuoMapper 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:
Retrieving jiansuodao.updateByPrimaryKeySelective modified by modifying the id corresponding to the method according to the jiansuodao (jiansuo);
The modification successful retrieval of information stored in the message request, the user is given the page prompt request.setAttribute ( "message", "modify retrieve information successfully");
Return to retrieve management interface
return "forward:/jiansuoguanli.action";
Delete search module:
In the management page, click Delete. Href attribute page through a tag, retrieval using the get method
Id is uploaded to the server, the server receives through jiansuoController class shanchujiansuo, after calling deleteByPrimaryKey jiansuoMapper method according to delete the ID. Save the information to delete the message request, the user is given delete successful message in the page, the part of the core code is as follows:
Remove retrieval jiansuodao.deleteByPrimaryKey (id) by removing a corresponding method based on the id of jiansuodao;
The deleted information retrieval success, to save the message request, the user is given prompt request.setAttribute in the page ( "message", "retrieve deleted successfully");
Return to retrieve management interface
return "forward:/jiansuoguanli.action";