Record learning every day, have a good mood every day. * ^ _ ^ *
Today we will analyze a web-based java pharmacy management platform, currently very popular B / S architecture to develop as JAVA technology relying on SSM technology framework, mysql database to establish the system.
Web-based pharmacy management platform java project using the framework for SSM (MYECLIPSE), the choice of development tools for MYECLIPSE. Java web-based pharmacy management platform for a background item.
In order to complete the web-based java pharmacy management platform, we first need to analyze the needs of the system. A web-based java pharmacy management platform should contain user roles administrator. 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.
It summarizes the results of java web-based pharmacy management platform for all project data: administrator (admin), pharmaceuticals (yaopin), sales records (xiaoshoujilu)
Java web-based administrator table of pharmacy management platform
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
Java web-based drugs table of pharmacy management platform
Field Name | Type | property | describe the above mentioned id | INT ( 11 ) | PRIMARY KEY | medicines the above mentioned id mingzi | VARCHAR ( 255 ) | | name jianjie | VARCHAR ( 255 ) | | Introduction shangchuanshijian | VARCHAR ( 255 ) | | Update Shuliang | VARCHAR ( 255 ) | |Number jiage | VARCHAR ( 255 ) | | Price
Java web-based sales management platform of pharmacy records table
Field Name | Type | properties | Description ID | the INT ( . 11 ) | a PRIMARY KEY | sales record ID yaopin | VARCHAR ( 255 ) | | pharmaceutical yaopinid | VARCHAR ( 255 ) | | Drugs ID Shuliang | VARCHAR ( 255 ) | | Number jiage | VARCHAR ( 255 ) | | price
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- ---------------------------- -- Table structure for ggjywebdjavaydglpt -- ---------------------------- 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_yaopin`; CREATE TABLE `t_yaopin` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '药品id' , `Mingzi` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' name ' ,` jianjie` VARCHAR ( 5000 ) the DEFAULT NULL the COMMENT ' Introduction ' , `shangchuanshijian` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' Update ' ,` shuliang` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' number ' , `jiage` VARCHAR (255) DEFAULT NULL COMMENT '价格',PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='药品'; -- ---------------------------- DROP TABLE IF EXISTS `t_xiaoshoujilu`; CREATE TABLE `t_xiaoshoujilu` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '销售记录id',`yaopin` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' drugs ' , `yaopinid` the INT ( . 11 ) the DEFAULT NULL the COMMENT ' drugs ID ' ,` shuliang` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' number ' , `jiage` VARCHAR ( 255 ) the DEFAULT NULL the COMMENT ' price ' , a PRIMARY KEY ( `id`) ) ENGINE =MyISAM the DEFAULT the CHARSET = UTF8 the COMMENT = ' sales records ' ;
Adding drugs modules:
By adding the drug module may be the process of adding the drug. Jump on the page to add the drug all the information page, enter the pharmaceuticals, click the Add operation, the drug can be submitted to the yaopinController data to post in. Information contained in the drug field, including name, description, upload time, quantity and price. In yaopinController accept all the medicines by defining the parameters yaopin. Using the insert method yaopindao yaopin entities into the database. The process of adding data corresponding to the matching yaopinxml complete the insertion operation is performed in the sql statement in yaopinMapper. The part of the core code is as follows:
The pages transmitted by adding the drug to the insert method yaopindao database yaopindao.insert (yaopin);
Add the success of the drug information, saved to the message request, the user is given the page prompt request.setAttribute ( "message", "Successfully added drugs");
Return Drug Administration Interface
return "forward:/tianjiayaopin.action";
Drug query module:
In the browser when entering drug search page, then the browser address bar is yaopinguanli.action, the address will respond yaopinController class yaopinguanli, in the process, get all the drug information 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 drugs, defined by the example query YaopinExample example = new YaopinExample ();
All drug information query the List yaopinall = yaopindao.selectByExample (example) by the method yaopindao of selectByExample;
The drug information, saved to the request, make the show request.setAttribute ( "yaopinall", yaopinall) page by foreach method;
Return Drug Administration Interface
return "forward:/yaopinguanli.action";
Modifying drugs modules:
Click the Edit button, you can jump to the drugs modify the page. Modifying the page in the drug, the drug will initialize all the information, and correspondence information corresponding to the edit field is filled. After editing drug information, page by encapsulating the data post method is a pharmaceutical entity, passed into the yaopinController. In xiugaiyaopin the reception, after reception is completed, the call updateByPrimaryKeySelective method yaopinMapper modified. The part of the code as follows:
Corresponding pharmaceutical yaopindao.updateByPrimaryKeySelective modified by modifying the method according to the id of yaopindao (yaopin);
The amendment is successful drugs information, saved to the message request, the user is given prompt request.setAttribute in the page ( "message", "modify drug information successfully");
Return Drug Administration Interface
return "forward:/yaopinguanli.action";
Delete drugs modules:
Implementation Drug delete function is, by clicking the Delete button drugs, to get the server to initiate the request. Drug contained in the request id information is used in the accepted yaopinController the int id, and the id of incoming deleteByPrimaryKey yaopindao method. Acting in accordance with the method deletes the corresponding id drugs. Finally, successful drug information will be deleted return to the page, the part of the core code is as follows:
Delete by deleting the corresponding method according yaopindao id pharmaceutical yaopindao.deleteByPrimaryKey (id);
Drug information will be deleted successfully saved to the message request, the user is given prompt request.setAttribute in the page ( "message", "delete successful drugs");
Return Drug Administration Interface
return "forward:/yaopinguanli.action";