JAVA-based contract management system under the framework of SSM

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

Today, a friend and together to complete a project contract management 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: In this paper, the development of contract management system is a typical management information system (MIS), in this system, using the MVC three-tier structure, so the implementation of the system include the establishment and maintenance of background database ., front-end application and the development of the intermediate layer is three application servers for database requirement to establish data consistency and integrity of data security for good; the application requires fully functional, easy to use and so on; and intermediate application server layer should be equipped with flexible business logic changes can alter the performance comprehensively improve the quality and productivity software. the idea of using object-oriented thinking and engineering, providing for the successful and rapid development of software guidance is a contract management system office automation ..., a contract management system should contain the user has administrator roles. 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.
There is any relationship between systems company, we will save their relationship in the contract table. Their relationship is a contract of the company and the company's mingzi field corresponds to the company's contract with the company id id corresponding field
.

The summary results of all system data: administrator (admin), contract (hetong), Company (gongsi)

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

 

Contract table

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | contract the above mentioned id 
mingcheng |  VARCHAR ( 255 ) |  | name 
shangchuanshijian |  VARCHAR ( 255 ) |  | Update 
Jieshao |  VARCHAR ( 255 ) |  | Introduction 
Wenjian |  VARCHAR ( 255 ) |  |File 
gongsi |  VARCHAR ( 255 ) |  | Company 
gongsiid |  VARCHAR ( 255 ) |  | company id

 

Company list

Field Name | Type | property | describe 
the above mentioned id |  INT ( 11 ) |  PRIMARY  KEY  | Company the above mentioned id 
mingzi |  VARCHAR ( 255 ) |  | name 
Jieshao |  VARCHAR ( 255 ) |  | Introduction 
dizhi |  VARCHAR ( 255 ) |  | address 
lianxifangshi |  VARCHAR ( 255 ) |  | Contact information

 

 

SET FOREIGN_KEY_CHECKS=0;

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

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

-- Table structure for gghetongguanli

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

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

CREATE TABLE `t_hetong` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '合同id' , `Mingcheng` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' name ' ,` shangchuanshijian` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' Update ' , `jieshao` VARCHAR ( 5000 ) the DEFAULT  NULL the COMMENT ' introduction ' ,` wenjian` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' file ' , `gongsi` VARCHAR (255) DEFAULT NULL COMMENT '公司',`gongsiid` INT(11) DEFAULT NULL COMMENT '公司id',PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='合同';

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

DROP TABLE IF EXISTS `t_gongsi`;

CREATE TABLE `t_gongsi` (`id` INT(. 11 ) the NOT  NULL the AUTO_INCREMENT the COMMENT ' company ID ' , `mingzi` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' name ' ,` jieshao` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' introduction ' , `dizhi` VARCHAR ( 255 ) the DEFAULT  NULL the COMMENT ' address ' , `lianxifangshi` VARCHAR ( 255 ) the DEFAULT  NULLThe COMMENT ' Contact ' , a PRIMARY  KEY ( `id`) 

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

 

 

Adding contract module:

Contracts exist in the system to add features, add contract by clicking on the jump to the function module, the function module, fill in the corresponding contract information. Contract contains information name, upload time, description, document, company, corporate id, filling out all the information, via the post method to submit data to tianjiahetong.action, the address will respond in the server tianjiahetongact method hetongController class in . Response result, for all the acquired contract information, a package hetong class, using the insert method hetongdao hetongController defined in the class, the data is inserted into hetong contract database table. And gives the user message, adding the contract is successful, save the information to the message request, this information will be shown on the page. The part of the core code is as follows:

The insert method by adding hetongdao page transmitted to the contract database hetongdao.insert (hetong);

Add the successful contract information, save the message request, the user is given prompt request.setAttribute in the page ( "message", "add contract success");

Return Contract Management Interface

return "forward:/tianjiahetong.action";

Query contract module:

Query module definition of the contract in the background, click Contract Management in the sidebar, you can jump to the contract management interface. In this page hetongController defined hetongguanli contract inquiry response module. Check out all the information in hetongguanli, the return cycle through pages. Query method selectByexample method hetongdao in. The part of the core code is as follows:

Generating a sample-based contract, HetongExample example = new HetongExample () define the query by example;

Check out all the contract information List hetongall = hetongdao.selectByExample (example) by selectByExample method of hetongdao;

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

Return Contract Management Interface

return "forward:/hetongguanli.action";

Amendments to the contract module:

Information has been uploaded to the contract can be modified operation, this part of the operation in the contract management interface, click the Modify button to jump to the contract modification page. In the modified page, all contracts will initialize the fields of information, field information including name, upload time, description, document, company, id. Field information content available through contract id. The modified information is passed to the receiving hetongController hetong. In hetongController contains advance defined hetongdao, the parameter is hetongMapper is achieved. hetongMapper 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 modified id corresponding contract hetongdao.updateByPrimaryKeySelective hetongdao by modifying the method of (hetong);

The contract modification success message, save the message request, the user is given prompt request.setAttribute in the page ( "message", "Information successfully modify the contract");

Return Contract Management Interface

return "forward:/hetongguanli.action";

Delete contract module:

In the management page, click Delete. Page through the href attribute a label, use the get method the contract

Id is uploaded to the server, the server receives through hetongController class shanchuhetong, after calling deleteByPrimaryKey hetongMapper 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:

Delete by deleting the corresponding method according hetongdao contract hetongdao.deleteByPrimaryKey id (id);

The contract information deleted successfully saved to the message request, the user is given prompt request.setAttribute in the page ( "message", "delete successful contract");

Return Contract Management Interface

return "forward:/hetongguanli.action";

Guess you like

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