Record learning every day, have a good mood every day. * ^ _ ^ *
Today, a friend and together to complete a project of social welfare 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 this: being home care is the main way the social welfare system of welfare services provided refers to various social service system and measures to social care and social services center, designed to promote social integration with social investment property combined into a system, in the face of all people in society in a broad sense, the main face of special populations in the narrow sense. In recent years, with the advent of the social security system and the low birthrate and aging society ..., a social welfare 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.
To complete the system function requires the user to set the application form, the application information is recorded. Defines the relationship between the two tables in the application, wherein the application corresponding field mingzi user with a user, id field corresponding to the user id of the user application
.
The summary results for all data systems: the administrator (admin), welfare (fuli), user (yonghu), application (shenqing)
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
Schedule of Benefits
Field Name | Type | properties | Description ID | the INT ( . 11 ) | a PRIMARY KEY | welfare ID renqun | VARCHAR ( 255 ) | | population shuoming | VARCHAR ( 255 ) | | Description Fuli | VARCHAR ( 255 ) | | Welfare fulixiangqing | VARCHAR ( 255 ) | | Benefits details
user table
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | user the above mentioned id mingzi | VARCHAR ( 255 ) | | name username | VARCHAR ( 255 ) | | account password | VARCHAR ( 255 ) | | password nianling | VARCHAR ( 255 ) | |Age xingbie | VARCHAR ( 255 ) | | Sex renqun | VARCHAR ( 255 ) | | crowd
Application Form
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | apply for the above mentioned id yonghu | VARCHAR ( 255 ) | | user yonghuid | VARCHAR ( 255 ) | | user the above mentioned id renqun | VARCHAR ( 255 ) | | crowd shuoming | VARCHAR ( 255 ) | |Description cailiao | VARCHAR ( 255 ) | | Material
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- ---------------------------- -- Table structure for ggsheihuifuli -- ---------------------------- 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) DEFAULT NULL COMMENT '密码',PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='管理员'; -- ---------------------------- DROP TABLE IF EXISTS `t_fuli`; CREATE TABLE `t_fuli` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '福利id', `renqun` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' crowd ' ,` shuoming` VARCHAR ( 5000 ) the DEFAULT NULL the COMMENT ' Description ' , `fuli` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' welfare ' ,` fulixiangqing` VARCHAR ( 5000 ) the DEFAULT NULL the COMMENT ' welfare details ' , 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',`mingzi` VARCHAR(255) DEFAULT NULL COMMENT '名字',`username` VARCHAR(255 ) the DEFAULT NULL the COMMENT ' account ' , `password` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' password ' ,` nianling` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' Age ' , `xingbie` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' gender ' , `renqun` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT'人群',PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='用户'; -- ---------------------------- DROP TABLE IF EXISTS `t_shenqing`; CREATE TABLE `t_shenqing` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '申请id',`yonghu` VARCHAR(255) DEFAULT NULLThe COMMENT ' user ' , `yonghuid` the INT ( . 11 ) the DEFAULT NULL the COMMENT ' user ID ' ,` renqun` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' crowd ' , `shuoming` VARCHAR ( 5000 ) the DEFAULT NULL the COMMENT ' Description ' ,` cailiao ` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' material ' ,PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='申请';
Add welfare module:
Defined tianjiafuliact receiving incoming pages in fuliController welfare parameters, define as fuli. Wherein Fuli field comprising: crowd, description, welfare , welfare details, the operation using the benefits tianjiafuliact objects stored in the database is defined in fuliMapper insert method, the matching database and insert into fuli statement to achieve the benefits of data into the database . The part of the core code is as follows:
Fulidao by the insert method to add a page to the database welfare transmission fulidao.insert (fuli);
Add the Foley information, save it to a message request, the user is given the page prompt request.setAttribute ( "message", "added Foley");
Return benefits administration interface
return "forward:/tianjiafuli.action";
Query module benefits:
Welfare for the implementation of the query module, launched fuliguanli.action request page. By this request, the server response fuliController class fuliguanli, query data by selectByexample operation in the process. After all of the benefits information query to request the fuliall stored in the page on display, return fuliguanli.jsp, the portion of the core code is as follows:
Generating a sample-based benefits, define the query by example FuliExample example = new FuliExample ();
Query all benefit information List fuliall = fulidao.selectByExample (example) by the method fulidao of selectByExample;
The benefit information stored in the request, on display request.setAttribute ( "fuliall", fuliall) page by foreach method;
Return benefits administration interface
return "forward:/fuliguanli.action";
Modify welfare module:
After filling out the page modify information, click the Modify button to submit data to xiugaifuli, the package is a welfare
Use update methods to modify the benefits information, synchronize data to the database, to complete the modification operation.
Modify the definition of successful message, modifying Foley, and stores the request code would read:
Modified corresponding benefits fulidao.updateByPrimaryKeySelective (fuli) by modifying the method according to the id of fulidao;
Foley will modify the information saved to the message request, the user is given prompt request.setAttribute in the page ( "message", "modify welfare information successfully");
Return benefits administration interface
return "forward:/fuliguanli.action";
Delete welfare module:
By a label on the page, shanchufuli? Id = id will be passed to the background, receiving welfare id by shanchufuli. Use of deleteByid
Delete the welfare, to complete the deletion. Delete the definition of a successful message, delete Foley, and saved to the request, the part of the code is as follows:
Deletes the corresponding benefits fulidao.deleteByPrimaryKey (id) id by removing method according to the fulidao;
Foley will delete information stored in the message request, give the user prompt request.setAttribute in the page ( "message", "delete Foley");
Return benefits administration interface
return "forward:/fuliguanli.action";