Skip to content

Instantly share code, notes, and snippets.

@codethereforam
Created November 28, 2019 07:18
Show Gist options
  • Save codethereforam/c1f362676b753b494a815249fbccca94 to your computer and use it in GitHub Desktop.
Save codethereforam/c1f362676b753b494a815249fbccca94 to your computer and use it in GitHub Desktop.
idea live template个人配置
<templateSet group="user">
<template name="odc" value="&lt;choose&gt;&#10; &lt;when test=&quot;orderByClause != null&quot;&gt;&#10; order by ${orderByClause}&#10; &lt;/when&gt;&#10; &lt;otherwise&gt;&#10; $CLIPBOARD$&#10; &lt;/otherwise&gt;&#10; &lt;/choose&gt;" description="" toReformat="true" toShortenFQNames="true">
<variable name="CLIPBOARD" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="SQL_STATEMENT" value="true" />
<option name="SQL_STATEMENT_MEMSQL" value="true" />
<option name="SQL_STATEMENT_MYSQL" value="true" />
</context>
</template>
<template name="odcx" value="&lt;if test=&quot;orderByClause != null&quot;&gt;&#10; order by ${orderByClause}&#10;&lt;/if&gt;" description="" toReformat="false" toShortenFQNames="false">
<context>
<option name="SQL_STATEMENT" value="true" />
<option name="SQL_STATEMENT_MEMSQL" value="true" />
<option name="SQL_STATEMENT_MYSQL" value="true" />
</context>
</template>
<template name="mli" value="&lt;if test=&quot;$FIELD1$ != null&quot;&gt;&#10; &lt;choose&gt;&#10; &lt;when test=&quot;$FIELD2$.size() == 1&quot;&gt;&#10; &lt;bind name=&quot;$FIELD5$likeValue&quot; value=&quot;$FIELD3$[0] + '%'&quot; /&gt;&#10; AND LIKE #{$FIELD6$likeValue}&#10; &lt;/when&gt;&#10; &lt;otherwise&gt;&#10; and in&#10; &lt;foreach collection=&quot;$FIELD4$&quot; open=&quot;(&quot; close=&quot;)&quot; item=&quot;item&quot; separator=&quot;,&quot;&gt;&#10; #{item}&#10; &lt;/foreach&gt;&#10; &lt;/otherwise&gt;&#10; &lt;/choose&gt;&#10; &lt;/if&gt;" description="" toReformat="true" toShortenFQNames="true">
<variable name="FIELD1" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<variable name="FIELD2" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<variable name="FIELD5" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<variable name="FIELD3" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<variable name="FIELD6" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<variable name="FIELD4" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="SQL_ALL" value="true" />
<option name="SQL_MEMSQL" value="true" />
<option name="SQL_MYSQL" value="true" />
<option name="SQL_STATEMENT" value="false" />
<option name="SQL_STATEMENT_MEMSQL" value="false" />
<option name="SQL_STATEMENT_MYSQL" value="false" />
</context>
</template>
<template name="lik" value="&lt;if test=&quot;$V1$ != null&quot;&gt;&#10; &lt;bind name=&quot;$V2$Like&quot; value=&quot;$V3$ + '%'&quot; /&gt;&#10; AND $END$ LIKE #{$V4$Like}&#10; &lt;/if&gt;" description="" toReformat="true" toShortenFQNames="true">
<variable name="V1" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<variable name="V2" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<variable name="V3" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<variable name="V4" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="SQL_ALL" value="true" />
<option name="SQL_MEMSQL" value="true" />
<option name="SQL_MYSQL" value="true" />
<option name="SQL_STATEMENT" value="false" />
<option name="SQL_STATEMENT_MEMSQL" value="false" />
<option name="SQL_STATEMENT_MYSQL" value="false" />
</context>
</template>
<template name="ift" value="&lt;if test=&quot;$CB1$ != null&quot;&gt;and $END$ = #{$CB2$}&lt;/if&gt;" description="" toReformat="true" toShortenFQNames="true">
<variable name="CB1" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<variable name="CB2" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="SQL_STATEMENT" value="true" />
<option name="SQL_STATEMENT_MEMSQL" value="true" />
<option name="SQL_STATEMENT_MYSQL" value="true" />
</context>
</template>
<template name="cv" value="$CLIPBOARD$" description="" toReformat="false" toShortenFQNames="true">
<variable name="CLIPBOARD" expression="groovyScript(&quot;Arrays.stream(_1.split(',')).map({ s -&gt;if (s.contains(' ')) {return s} else{ return s + ' ' + s.tokenize('.')[-1].replaceAll(/_\\w/) { it[1].toUpperCase() }}}).collect(java.util.stream.Collectors.joining(', '))&quot;, clipboard())" defaultValue="" alwaysStopAt="true" />
<context>
<option name="OTHER" value="true" />
</context>
</template>
<template name="psvm" value="public static void main(String[] args){&#10; $END$&#10;}" description="main() method declaration" toReformat="true" toShortenFQNames="true" />
<template name="*" value="* &#10; *&#10; * @author yanganyu &#10; * @date $date$ $time$&#10;$params$ &#10; * @return {@code $returnValue$}&#10; */ " description="my annotation" toReformat="true" toShortenFQNames="true">
<variable name="date" expression="date()" defaultValue="" alwaysStopAt="false" />
<variable name="time" expression="time()" defaultValue="" alwaysStopAt="false" />
<variable name="params" expression="groovyScript(&quot;if(\&quot;${_1}\&quot;.length() == 2) {return '';} else {def result=''; def params=\&quot;${_1}\&quot;.replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i &lt; params.size(); i++) {result+=' * @param ' + params[i] + ' ' + params[i] + ((i &lt; params.size() - 1) ? '\\n' : '')}; return result}&quot;, methodParameters())" defaultValue="" alwaysStopAt="false" />
<variable name="returnValue" expression="methodReturnType()" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_COMMENT" value="true" />
<option name="JAVA_DECLARATION" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
</templateSet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment