IDEA Templates
强大的模板
IDEA Templates
-
File | Settings | Editor | File and Code Templates修改存在的模板
-
File | Settings | Editor | Live Templates中用template group增加自定义模板,再在里面加入live template用来自定义模板。Abbreviaation(缩写):触发词,Description(描述),Templates text(模板内容)。
-
Expand with 用enter(自己的习惯)。
-
edit variables自定义可变参数。
-
//expression date("yyyy/MM/dd") time("hh:mm:ss") //skip if defined(如果定义了,则跳过)
-
-
选中 reformat according to style (会根据你输入的位置智能缩进) 。
jsp
<%--
% Cteate by IntelliJ IDEA.
% @author: JingHai
% @date: $DATE$
% @time: $TIME$
% @version: 1.0
% @description: nothing.
--%>
html
java
/**
* Cteate by IntelliJ IDEA.
* @author: JingHai
* @date: $DATE$
* @time: $TIME$
* @version: 1.0
* @description: nothing.
**/
java method
**(/需要手写,不能在模板中,eg: /+mjc+Enter)
*
* @author JingHai
* @method $method$
$params$
* @return $return$
* @date: $DATE$
* @time: $TIME$
**/
**(/需要手写,不能在模板中,eg: /+msim+Enter)
*
* @method $method$
$params$
* @return $return$
**/
//Edit variables
method methodName()
date date()
time time()
params groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) {result+='* @param ' + params[i] + ((i < params.size() - 1) ? '\\r\\n ' : '')}; return result", methodParameters())groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) {result+='* @param ' + params[i] + ((i < params.size() - 1) ? '\\n\\b' : '')}; return result", methodParameters())
return methodReturnType()
注意:
date&time 用 Expression
method¶ms&return用Default value
java class
/**
* 类 名:$PACKAGE_NAME$.$NAME$
* 类描述:nothing
* 创建时间:$DATE$ $TIME$
* 修改人:
* 修改时间:
* 修改备注:
*
* @author JingHai
* @version 1.0
*
**/
/**
* @className:$PACKAGE_NAME$.$NAME$
* @classDescription:nothing
* @createTime:$DATE$ $TIME$
* @modifier:
* @changeTime:
* @modifyComments:
*
* @author JingHai
* @version 1.0
*
**/
PACKAGE_NAME currentPackage()
NAME fileNameWithoutExtension()
TIME time("hh:mm:ss")
DATE date("yyyy/MM/dd")
xml
mapper.xml
<?xml version="1.0" encoding="UTF-8" ?>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
database.properties
jdbc.driverClass=com.mysql.cj.jdbc.Driver
jdbc.Url=jdbc:mysql://localhost:3306/database?useSSL=true&useUnicode=true&characterEncoder=UTF-8&serverTimezone=Asia/Shanghai
jdbc.user=root
jdbc.password=123456
mybatis-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
spring-dao.xml
<?xml version="1.0" encoding="UTF-8"?>
spring-service.xml
<?xml version="1.0" encoding="UTF-8"?>
springmvc-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
springmvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:applicationContext.xml
1
springmvc
/
encoding
org.springframework.web.filter.CharacterEncodingFilter
encoding
utf-8
encoding
/*
15