JAVA-based management system under the SSM accidents framework

Record learning every day, have a good mood every day. * ^ _ ^ *

Accidents in learning 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 accidents in the development of project management system to build SSM (MYECLIPSE) framework will eventually work accidents management systems project development background to a project.
The project has a user role, including the administrator, staff, each character contains its own user name and password.
In the function of the system, the injury is an important table. This table makes up the staff association. In correspondence injury table mingzi field staff and workers of injury, the employee id id field corresponds with an employee's injury
, they have a relationship.

The summary results of all system data: administrator (admin), employees (zhigong), injuries (shangqing)

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

 

Staff table

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | employees the above mentioned id 
mingzi |  VARCHAR ( 255 ) |  | name 
username |  VARCHAR ( 255 ) |  | account 
password |  VARCHAR ( 255 ) |  | password 
xingbie |  VARCHAR ( 255 ) |  |Sex 
nianling |  VARCHAR ( 255 ) |  | Age

 

Table injury

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | injuries the above mentioned id 
zhigong |  VARCHAR ( 255 ) |  | staff 
zhigongid |  VARCHAR ( 255 ) |  | employees the above mentioned id 
Shangqing |  VARCHAR ( 255 ) |  | injury 
chulifangshi |  VARCHAR ( 255 ) |  |Treatment 
jibie |  VARCHAR ( 255 ) |  | level

 

 

 

SET FOREIGN_KEY_CHECKS=0;

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

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

-- Table structure for gggongshangshigu

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

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_zhigong`; 

the CREATE  TABLE ` t_zhigong` ( `id` the INT ( . 11 ) the NOT  NULL the AUTO_INCREMENT the COMMENT ' employee id' , `Mingzi` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' name ' ,` username` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' account ' , `password` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' password ' ,` xingbie` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' sex ' , `nianling` VARCHAR ( 255) DEFAULT NULL COMMENT '年龄',PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='职工';

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

DROP TABLE IF EXISTS `t_shangqing`;

CREATE TABLE `t_shangqing` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '伤情id',`zhigong` VARCHAR(255 ) the DEFAULT  NULL the COMMENT ' employee ' , `zhigongid` the INT ( . 11 ) the DEFAULT  NULL the COMMENT ' employee ID ' ,` shangqing` VARCHAR ( 5000 ) the DEFAULT  NULL the COMMENT ' injury ' , `chulifangshi` VARCHAR ( 5000 ) the DEFAULT  NULL the COMMENT ' approach ' , `jibie` VARCHAR ( 255 ) the DEFAULT  NULLThe COMMENT ' level ' , a PRIMARY  KEY ( `id`) 

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

 

 

Add injuries modules:

By adding module injury, the injury can be the process of adding. Jump all the information on the page to add a page injuries, injuries input, click the Add operation, the injury data submitted to the shangqingController in to post. Field contains information including employee injury, workers id, injury, treatment, levels. In shangqingController accept all parameters defined injury shangqing. The method of using the insert shangqingdao shangqing entities into the database. The process of adding data corresponding to the matching shangqingxml complete the insertion operation is performed in the sql statement in shangqingMapper. The part of the core code is as follows:

The insert method by adding shangqingdao page transmitted to the database injury shangqingdao.insert (shangqing);

Adding injury success information stored in the message request, the user is given the page prompt request.setAttribute ( "message", "Add injuries success");

Returns the injury management interface

return "forward:/tianjiashangqing.action";

Query module injury:

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

Circulated to display the table. Complete injury queries. Specific code as follows:

Generating a sample type injury, query by example defined ShangqingExample example = new ShangqingExample ();

Discover all injury information List shangqingall = shangqingdao.selectByExample (example) by the method shangqingdao of selectByExample;

The injury information stored in the request, on display request.setAttribute ( "shangqingall", shangqingall) page by foreach method;

Returns the injury management interface

return "forward:/shangqingguanli.action";

Modify injuries modules:

Click the Edit button, you can jump to the page modify injuries. In injury modify the page, it will initialize all information and correspondence information corresponding to the injury to fill the edit field in. After injury editing information page by encapsulating the data post method is a physical injury, passed into the shangqingController. In xiugaishangqing the reception, after reception is completed, the call updateByPrimaryKeySelective method shangqingMapper modified. The part of the code as follows:

Modified corresponding injury shangqingdao.updateByPrimaryKeySelective (shangqing) by modifying the method according to the id of shangqingdao;

The success injury modify information stored in the message request, give the user prompt request.setAttribute in the page ( "message", "modify the injury information successfully");

Returns the injury management interface

return "forward:/shangqingguanli.action";

Delete injuries modules:

Delete injury as a function of the implementation, by clicking the Delete button injuries initiating get request to the server. Request id information included in the injury, a method using int deleteByPrimaryKey accept the incoming shangqingdao id, and the id in the shangqingController. Acting in accordance with the method deletes the corresponding id injury. Finally, the injury information deleted successfully return to the page, the part of the core code is as follows:

Deletes the corresponding injury shangqingdao.deleteByPrimaryKey (id) id by removing method according to the shangqingdao;

Success will remove the injury information is saved to the message request, the user is given prompt request.setAttribute in the page ( "message", "delete injuries success");

Returns the injury management interface

return "forward:/shangqingguanli.action";

Guess you like

Origin www.cnblogs.com/lqs11/p/11598997.html