The third day of home rush
* First day SSH integration, project common problem resolution
* The second day Easyui control simple use, complete user Management module (login, set password, increase the deletion check)
First, the use of SVN
Requires server and client two software, enterprise development, using Linux Server
1, server
When you practice, temporarily install the SVN server Windows (VISUALSVN-SERVER-2.1.5.MSI)------Install without using the Chinese space directory (default port 443, 8443)
* * post-installation access address https://PC2011101416ajs:8443/svn/
* * Recommended to use HTTPS://LOCALHOST:8443/SVN
Set up a warehouse, you can set up a project as a unit---storage and project-related documents (code is only a part)
Establish user native user yuy/123
2, client software TortoiseSVN
You can check out checkout SVN warehouse documents in any folder, import import/, and make version control
3. Install SVN plugin in MyEclipse
Go to the official website to download svn-----Now popular online installation version
Site-1.8.8.zip is SVN1.8.8 offline installation version
MyEclipse 8.5 Plug-in installation recommended, installed in the Dropins directory
* Traditional installation, plug the plugin into the installation directory features and plugins
* Now recommended in Myeclipse/dropins to meet the directory structure
Plugins directory/eclipse/features and plugins
After installing the plugin, there is an SVN configuration in the windows-preferences, with an SVN view in the view
Establish connection with Respository
Upload the MyEclipse project to the warehouse------the right Key project----team----share project (Project display * and? The current project is different from the warehouse)
Right-click the project----Team---Submit (the project appears on the small warehouse icon, Representative was managed)
Tag tag and Branch branch
When the code completes a certain function, in the Mileage Cup for the code to create a tag tag (the label records the corresponding version of each file, when the project upgrade problems, you can restore to the designated tag)
* * Code to complete the common functionality, build another branch to continue development, a code can create multiple branches, multiple software systems based on the same common code
The decompile plugin resolves the class file to Java source code
Copy the Jad directory to the Dropins directory under the MyEclipse installation directory and copy Jad.exe to the Jdk/bin directory
Reboot MyEclipse, configure Jad.exe path in Jadclipse to complete the decompile
Window-preferences-Search Jadclipse---path to Decompliler (D:\Program Files\java\jdk1.7.0_09\bin\jad.exe)
====================================================================================
Second, modify the user Management module legacy bugs
Bug1:flexjson a date to serialize the Millisecond value-----page does not conform to date format when serializing a Date object
Add the Getbirthdaystr () method to the domain class user
Manually format a date as a string
@Transient
Public String Getbirthdaystr () {
if (birthday== null) {
return null;
}
DateFormat DateFormat = new SimpleDateFormat ("Yyyy-mm-dd");
return Dateformat.format (birthday);
}
Jsonserializer Jsonserializer = new Jsonserializer (). Transform (New Datetransformer ("Yyyy-mm-dd"), Date.class);
BUG2: Date query, submit request parameter not available
<input type= "text" id= "Birthday" name= "Beginbirthday" class= "Easyui-datebox"/>
Question: $ ("#birthday"). Val () cannot get the selected date ...
<input type= "text" class= "Combo-text validatebox-text" "autocomplete=" Off "style=" WIDTH:133PX; height:20px; line-height:20px; " >
Make a selection
<input type= "hidden" class= "Combo-value" name= "Beginbirthday" value= "2013-03-01" > Store selected values (name is the value you originally specified)
Solution $ ("[name= ' Beginbirthday ']"). Val (); Using the Name property selector is OK.
BUG3: When modifying a user, if the Query ID object user compares the password, then updates the submitting user, resulting in two different objects with the same identifier
@Override
public void UpdateUser (user user) {//pass parameter is a off-pipe object
Query first
User Existuser = Userdao.findbyid (User.class, User.getid ()); Persistent objects
if (!existuser.getpassword (). Equals (User.getpassword ())) {//ratio of encrypted
User.setpassword (Md5utils.md5 (User.getpassword ()));
}
Beanutils.copyproperties (user, existuser);
}
Add view users and delete users without selecting the prompt
function Doview () {
Alert ("Edit user");
var item = $ (' #grid '). DataGrid (' getselected ');
if (item!=null) {
Console.info (item.id);
Location.href = "${pagecontext.request.contextpath}/user_view.action?id=" +item.id;
}else{
$.messager.alert ("Information Prompt", "View user must select a line of user information", "error");
}
}
function Dodelete () {
Alert ("Delete user");
var ids = [];
var items = $ (' #grid '). DataGrid (' Getselections ');
if (Items.length = = 0) {
$.messager.alert ("Information prompt", "Delete user must select at least one line of user information", "error");
return;
}
for (var i=0; i<items.length; i++) {
Ids.push (items[i].id);
}
}
====================================================================================
Third, the House rush to send the business the first part: the Foundation Establishment Service
The basic set up this part of the business, mainly for other functions of the system to provide some basic data information, other functions can rely on basic data information to complete
1 * * * * Basic file (data dictionary function)
2 line type: National, provincial, provincial, urban-----------------when the line is set, select line type, query line data dictionary
3. Type of Dispatcher: driver, small member
Data dictionaries have nothing to do with business processes, only related to business data
4 Collection Time: The time of receipt and dispatch (different from the working time of the sending staff)
5) Collection criteria: How many goods can be taken to send 0-5 kg 5-10 kg
5 to send the staff to set up: to pick up the information to carry out the search (substitute, who has a job, find other to send staff substitute)
6 Vehicle and line settings (ignore)
7 region, zoning, fixed area: The current residential emergency services can cover provinces and cities (regional management), relatively large area (zoning road, street, community), the district (is a collection of partitions, is to send the delivery range of staff)
8 when the designated area, for the dispatch of staff
Simplifying the business (assuming that only one of the assigned districts is in charge and 24 hours to work)
Enterprise-side data modeling, the most professional software PowerDesigner (Sybase company products)---charges
Three new models in PD: CDM concept map for requirements, OOM object-oriented design, PDM physical data Model diagram (for database)
Three kinds of graphs can be converted directly to each other
Create a table-----Name property to the user, the Code property generates the codes, and the same data type is defined as domain
Domain For example many table primary keys are int, and many table primary keys are UUID varchar (32)
Columns defines the columns in the table
Preview view Generate SQL code
Export: Database-generate Database
Base Setup Section datasheet:
Users operating System user
Collection Standard table: the use of the collection of the school staff
CREATE TABLE Bc_standard
(
ID varchar (+) NOT NULL,//number UUID generation
Name varchar (30),//Standard names
Minweight double,//min weight
Maxweight double,//maximum weight
Deltag char (1),//whether void 1 void, 0 normal use
user_id int,//operator
UpdateTime timestamp,//Update time
Primary KEY (ID)
);
================= operates between the user and the standard One-to-many, a system user can develop multiple standards
To send a member of the table: storage to send information
CREATE TABLE Bc_staff
(
ID varchar NOT NULL,//number
Name varchar (20),//Name
telephone int,//mobile phone
Haspda char (1),//whether there is a PDA mobile device
Deltag char (1),//Invalid flag
Station varchar (40),//affiliated Company
standard_id varchar (32),//adopt the standard of picking
Primary KEY (ID)
);
================== standard table and the number of the table to send a one-to-many, multiple access to the same standard
Regional table: Store information in provinces and cities
CREATE TABLE Bc_region
(
ID varchar NOT NULL,//number
Province varchar (50),//province
City varchar (50),//municipality
District varchar (50),//District
Postcode varchar (50),//ZIP code
Shortcode varchar (30),//Simple code
Citycode varchar (30),//city code
Primary KEY (ID)
);
Partition table: The area is too large to complete the fetch task, must partition
CREATE TABLE Bc_subarea
(
ID varchar NOT NULL,//number
decidedzone_id varchar (32),//fixed area number
region_id varchar (32),//area number
Addresskey varchar (100),//keywords
Startnum varchar (30),//starting building, community, street number
Endnum varchar (30),//end of building, community, street number
Single char (1),//Odd
Position varchar (255),//location information
Primary KEY (ID)
);
District table: Assigning responsible partitions to the assigned Member
CREATE TABLE Bc_decidedzone
(
ID varchar NOT NULL,//number
Name varchar (30),//
staff_id varchar (32),//Send Staff
Primary KEY (ID)
);
A pick-up officer is responsible for a number of designated areas and a designated area is assigned by a staff member.
One area is not divided into multiple partitions
A fixed area is made up of multiple partitions
--------------------------------------------------------------------------------------------------------------- --------------
Base file Settings The main table holds "driver" "small member" in the "Pick type" child table------a one-to-many relationship
After the user login, the first set up the collection of standards, the management of the information of the receiving staff, regional settings, zoning, management of the district (designated for the assigned area responsible for the delivery of the staff)
--------------------------------------------------------------------------------------------------------------- ---------------
First, according to PDM design. Writing Java entity classes to complete the work of building tables
New 5 Entity classes
Standard Standard
Staff to send a member
Region Area
SubArea Partition
Decidedzone-Ding District
Modify the page ztree menu------MENU.JSO Maintenance
* * Use the new feature code of the third day to replace the employee project Menu.json
* * Overwrite the original base with the new feature code in the third day
* * Page fake data Standard.json, Staff.json
Five. Basic Setup functionality implementation
User Management page structure, in the data list part of a separate iframe, the link to access the userinfo.jsp, the use of ordinary requests submitted by the way, submit the form
Pages to add, modify traditional page submissions, query, delete using AJAX submission
The collection standard, the dispatcher, the area management----will use one page to complete the enhancement check
To store a div with the Add Modify form form, use the pop-up-----to complete a page change check
Pure Ajax Programming (STRUTS2 Tag library is useless)
standard.jsp Design
1, the introduction of Easyui need all JS and CSS
2, page layout as a whole a part of the DataGrid-------
<body class= "Easyui-layout" style= "Visibility:hidden" >
<div region= "center" >
<table id= "Grid" ></table>
</div> <!--only-->
</body>
* Tips, the body hidden style= "Visibility:hidden", after the page is loaded and then show $ ("Body"). CSS ({visibility: "visible"});
3, table toolbar ICONCLA display button icon Easyui/theme/icon.css
Tool bar
var toolbar = [{
ID: ' Button-view ',
Text: ' Query ',
Iconcls: ' Icon-search ',
Handler:doview
}, {
ID: ' Button-add ',
Text: ' Add ',
Iconcls: ' Icon-add ',
Handler:doadd
}, {
ID: ' Button-delete ',
Text: ' Delete ',
Iconcls: ' Icon-cancel ',
Handler:dodelete
}];
* Click on three buttons, call Doview Doadd Dodelete three methods respectively
4. Define the columns in the table
var columns = [{column one Information},{column two information},{column three information}]; Many columns
The first type of tick ID
{
Field: ' ID ',
Checkbox:true,//Generate first column check, for delete, view
}
Second Normal column
{
Field: ' Name ',//return property name in JSON data
Title: ' Standard name ',//column name in table
width:120,//width
Align: ' center '//Center
}
Third, complex JSON data parsing
Display of special structure
{"id": "001", "Name": "0-10 kg", "minweight": "0", "maxweight": "Ten", "UpdateTime": "1999-10-10 12:23:34", "operator": {" Username ":" John "," Station ":" Head Office "}} =============================
{
Field: ' Operator.username ',
Title: ' operator ',
WIDTH:120,
Align: ' center ',
Formatter:function (Data,row, index) {//Data returns the corresponding property in JSON, row represents the entire JSON data
return row.operator.username;
}
}
5. Hide Add Standard div Write form
<div class= "Easyui-window" > Pop-up window
Divided into two parts: the first part of the Save button, the second part of the form (for add and modify)
=============== add standard, standard list view, standard delete
Six, the collection of standard Code implementation
1, add the standard window pop-up
<div class= "Easyui-window" ></div>
Set window properties in JS
$ (' #addStandardWindow '). Window ({
Title: ' Add the collection standard ',
width:400,
Modal:true,
Shadow:true,
Closed:true,
height:400,
Resizable:false
});
Set up the style= "top:" in <div>. px Left:.. px
Standardaction for input data validation------name Non-empty, Minweight greater than 0 checksum, maxweight must be greater than minweight (Job fieldexpression)
In Standardservice, the Minweight and maxweight corresponding records are first judged, namedquery
Define AJAX Common Results page success.jsp error.jsp
2. List paging query (unconditional)
Paging Criteria: Page page number, rows per page How many
Query standard needs to display user information, but user information is in another table
Set it to Lazy=false query now
@LazyToOne (Lazytooneoption.false)
private user user;
3, delete the Tick ID
In JS $ ("#grid"). DataGrid ("Getselections"); Get all the selected objects, and then get the ID stitching string from the object to send to the server
Job, you can query, do not go to the query voided standard/On the page display set aside criteria (add a column)