-
-
Save JamesHopbourn/9b232853ad201309c01b6bb8d6ce41fa to your computer and use it in GitHub Desktop.
IDEA MybatisX template (1. 自定义 controller 模板 2. mapperInterface 添加 @Mapper 注解)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<templates> | |
<template> | |
<property name="configName" value="serviceInterface"/> | |
<property name="configFile" value="serviceInterface.ftl"/> | |
<property name="fileName" value="${domain.fileName}Service"/> | |
<property name="suffix" value=".java"/> | |
<property name="packageName" value="${domain.basePackage}.service"/> | |
<property name="encoding" value="${domain.encoding}"/> | |
<property name="basePath" value="${domain.basePath}"/> | |
</template> | |
<template> | |
<property name="configName" value="serviceImpl"/> | |
<property name="configFile" value="serviceImpl.ftl"/> | |
<property name="fileName" value="${domain.fileName}ServiceImpl"/> | |
<property name="suffix" value=".java"/> | |
<property name="packageName" value="${domain.basePackage}.service.impl"/> | |
<property name="encoding" value="${domain.encoding}"/> | |
<property name="basePath" value="${domain.basePath}"/> | |
</template> | |
<template> | |
<property name="configName" value="mapperInterface"/> | |
<property name="configFile" value="mapperInterface.ftl"/> | |
<property name="fileName" value="${domain.fileName}Mapper"/> | |
<property name="suffix" value=".java"/> | |
<property name="packageName" value="${domain.basePackage}.mapper"/> | |
<property name="encoding" value="${domain.encoding}"/> | |
<property name="basePath" value="${domain.basePath}"/> | |
</template> | |
<template> | |
<property name="configName" value="mapperXml"/> | |
<property name="configFile" value="mapperXml.ftl"/> | |
<property name="fileName" value="${domain.fileName}Mapper"/> | |
<property name="suffix" value=".xml"/> | |
<property name="packageName" value="${domain.basePackage}.mapper.xml"/> | |
<property name="encoding" value="${domain.encoding}"/> | |
<property name="basePath" value="${domain.basePath}"/> | |
</template> | |
<template> | |
<property name="configName" value="controller"/> | |
<property name="configFile" value="controller.ftl"/> | |
<property name="fileName" value="${domain.fileName}Controller"/> | |
<property name="suffix" value=".java"/> | |
<property name="packageName" value="${domain.basePackage}.controller"/> | |
<property name="encoding" value="${domain.encoding}"/> | |
<property name="basePath" value="${domain.basePath}"/> | |
</template> | |
</templates> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ${baseInfo.packageName}; | |
import ${serviceInterface.packageName}.${serviceInterface.fileName}; | |
import org.springframework.web.bind.annotation.RestController; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import javax.annotation.Resource; | |
/** | |
* ${tableClass.tableName} 控制层。 | |
* | |
* @author ${author!} | |
* @since ${.now?string('yyyy-MM-dd HH:mm:ss')} | |
*/ | |
@RestController | |
@RequestMapping("${tableClass.shortClassName?uncap_first}") | |
public class ${baseInfo.fileName} { | |
@Resource | |
private ${serviceInterface.fileName} ${serviceInterface.fileName?uncap_first}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ${mapperInterface.packageName}; | |
import ${tableClass.fullClassName}; | |
<#if tableClass.pkFields??> | |
<#list tableClass.pkFields as field><#assign pkName>${field.shortTypeName}</#assign></#list> | |
</#if> | |
import org.apache.ibatis.annotations.Mapper; | |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
/** | |
* @author ${author!} | |
* @description 针对表【${tableClass.tableName}<#if tableClass.remark?has_content>(${tableClass.remark!})</#if>】的数据库操作Mapper | |
* @createDate ${.now?string('yyyy-MM-dd HH:mm:ss')} | |
* @Entity ${tableClass.fullClassName} | |
*/ | |
@Mapper | |
public interface ${mapperInterface.fileName} extends BaseMapper<${tableClass.shortClassName}> { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment