Last active
December 19, 2023 17:45
-
-
Save JoJoJotarou/e463ca00bed749800d95f269bf8cf4a7 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> | |
<!-- .meta.xml 添加自定义 controller 模板信息,其他不变 --> | |
<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; | |
/** | |
* ${tableClass.tableName} 控制层。 | |
* | |
* @author ${author!} | |
* @since ${.now?string('yyyy-MM-dd HH:mm:ss')} | |
*/ | |
@RestController | |
@RequestMapping("/${tableClass.shortClassName?uncap_first}") | |
public class ${baseInfo.fileName} { | |
private final ${serviceInterface.fileName} ${serviceInterface.fileName?uncap_first}; | |
public ${baseInfo.fileName} (${serviceInterface.fileName} ${serviceInterface.fileName?uncap_first}){ | |
this.${serviceInterface.fileName?uncap_first} = ${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 com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
import org.apache.ibatis.annotations.Mapper; | |
/** | |
* @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
IDEA 修改位置:
相关链接:https://gitee.com/baomidou/MybatisX/issues/I4Z9ID#note_9713093_link