Code specification for the development platform of the potential Air vehicle networking platform (Cvnavi)
One, Java code
1. Comments
The class header, method header must be annotated, for example:
/**
* @ClassName: Enterprise
* @Description: TODO (Enterprise interaction)
* @author: Yan Qiwei
* @company: Shanghai Potential Aviation Network Technology Co., Ltd.
* @date July 6, 2017 3:33:39
*/
public class Enterprise {
@Autowired
Private Ienterpriseservice Ienterpriseservice;
/**
* @Title: Insert
* @Description: TODO (Enterprise Add)
* @param @return
* @param @throws ioexception settings file
* @return String return type
* @author: Yan Qiwei
* @date July 6, 2017 3:35:18
* @throws
*/
Public String Insert () throws ioexception{
return null;
}
}
/**
* @ClassName: Ienterpriseservice
* @Description: TODO (Enterprise Interface)
* @author: Yan Qiwei
* @company: Shanghai Potential Aviation Network Technology Co., Ltd.
* @date July 6, 2017 2:09:30
*/
Public interface Ienterpriseservice {
/**
* @Title: Insert
* @Description: TODO (add Enterprise Method)
* @param @throws Exception settings file
* @return void return type
* @author: Yan Qiwei
* @date July 6, 2017 3:31:47
* @throws
*/
public void Insert () throws Exception;
}
/**
* @ClassName: Enterpriseserviceimpl
* @Description: TODO (Enterprise Logic implementation Class)
* @author: Yan Qiwei
* @company: Shanghai Potential Aviation Network Technology Co., Ltd.
* @date July 6, 2017 2:09:56
*/
@Service ("Ienterpriseservice")
public class Enterpriseserviceimpl implements Ienterpriseservice {
/**
* @Title: Insert
* @Description: TODO (Add Enterprise Implementation Class)
* @see Com.cvnavi.enterprise.service.ienterpriseservice#insert ()
*/
@Override
public void Insert () throws Exception {
}
}
Comment Template:
How to use: 1, modify the name of the author in the template;
2, Preferences->java->code Style->code templates->comments->import.
2. SQL code
A, SELECT, from, WHERE, GROUP by, ORDER by, subquery, and so on must be A new row.
B, the processing of multi-table association must be based on the actual logic to select the association, not blindly use the left JOIN.
C, do not need to be associated with the table must be deleted
D. Every person who writes SQL must learn to view the SQL statement execution plan through a tool to optimize performance. Especially when you manipulate a table with a larger amount of data.
3. Precautions
1, The code is simple and understandable, rich in logic. A detailed comment must be added to the key code, the logical complex part.
2. Invalid code must be deleted.
Second, code formatting
1, line width settings
1.Java Code
Preferences->java->code style->formatter->edit->line wrapping->maximum line width: default 80
Change it to 160 on the line.
2.CSS Code
Window->preferences->web->css files->editor->line Width: default is 72
Change it to 160 on the line.
3.Html Code
window->preferences->web->html files->editor->line Width: default is 72
Change it to 160 on the line.
4.JSP Code
window->preferences->web->jsp files->editor-> See ' Editor ' for JSPs with HTML econtent->line width: Default is 72
Change it to 160 on the line.
5. XML code
Window->preferences->xml--XML Files--editor->line width: default is 80
Change it to 160 on the line.
2. Fast format
Eclipse provides the ability to automatically format source code and manage import statements (and remove unused statements). You can use the following shortcut keys to work with these features.
Ctrl + Shift + F – Formatting the source code.
Ctrl + Shift + O-manages the import statement and removes unused statements.
Note that the above two sets of shortcut keys with the Sogou Input Method shortcut key conflict, you must go to Sogou Input method settings in the key to the Sogou shortcut key to ban.
In addition, you can set the automatic layout when the file is saved (this method is limited to Java code), set the method as follows:
Save actions-> selected Perform the selected Actions on save-> selected for Preferences, Java, Editor, Window Mat source code and organize imports.
3. sql format
Since eclipse itself does not support proper formatting of SQL statements in XML files, it is recommended that SQL statements be pasted into an XML file after formatting in SQL editing tools such as Toad for DB2 (Frog). Also note that the SQL statement must be added space when the space, and reasonable to add a newline character.
Third, inspection standards
You must properly format your code before committing the code, making the code beautiful and easy to read. If you find code that does not conform to the specification, you need to return and re-modify the submission.
This article is from the "8429745" blog, please be sure to keep this source http://8439745.blog.51cto.com/8429745/1947515
Java Annotation Specification