fix: 修复模板问题.

This commit is contained in:
Mario Luo 2021-04-27 16:18:48 +08:00
parent 497644d0dd
commit 1fae85080b
4 changed files with 17 additions and 11 deletions

View File

@ -16,8 +16,9 @@ $!define
#set($entityShortType = $!tableInfo.name)
#set($entityType = $!tableInfo.psiClassObj.getQualifiedName())
#set($entityVarName = $!tool.firstLowerCase($!tableInfo.name))
#set($pkType = $!pk.type)
import $pkType;
import $entityType;
import $serviceType;
import lombok.AllArgsConstructor;
@ -44,7 +45,7 @@ public class $!{tableName} {
private $serviceSortType $serviceVarName;
/**
* 获取列表(分页)
* 获取$!{tableInfo.comment}列表(分页)
*/
@GetMapping("/list")
public Page<$entityShortType> list(Pageable page) {
@ -52,7 +53,7 @@ public class $!{tableName} {
}
/**
* 获取一条数据
* 获取$!{tableInfo.comment}
*/
@GetMapping("/get")
public $entityShortType get($!pk.shortType id) {
@ -60,7 +61,7 @@ public class $!{tableName} {
}
/**
* 添加
* 添加$!{tableInfo.comment}
*/
@PostMapping("/add")
public void add(@RequestBody $entityShortType $entityVarName) {
@ -69,7 +70,7 @@ public class $!{tableName} {
/**
* 修改
* 修改$!{tableInfo.comment}
*/
@PostMapping("/update")
public void update(@RequestBody $entityShortType $entityVarName) {
@ -77,11 +78,11 @@ public class $!{tableName} {
}
/**
* 删除
* 删除$!{tableInfo.comment}
*/
@PostMapping("/delete")
public void delete($!pk.shortType id) {
${serviceVarName}.deleteById(id);
}
}
}

View File

@ -10,11 +10,12 @@ $!define
#end
##实体类名、主键类名
#set($entityShortType = $!tableInfo.name)
#set($entityType = $!tableInfo.psiClassObj.getQualifiedName())
#set($pkShortType = $!pk.shortType)
#set($pkType = $!pk.type)
#if($tableInfo.psiClassObj)
import $!tableInfo.psiClassObj.getQualifiedName();
#end
import $pkType;
import $entityType;
import org.springframework.data.mongodb.repository.MongoRepository;

View File

@ -13,7 +13,9 @@ $!define
#set($entityType = $!tableInfo.psiClassObj.getQualifiedName())
#set($entityVarName = $!tool.firstLowerCase($!tableInfo.name))
#set($pkShortType = $!pk.shortType)
#set($pkType = $!pk.type)
import $pkType;
import $entityType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@ -28,7 +30,7 @@ import java.util.List;
* @since $!time.currTime()
*/
public interface $!{tableName} {
void save($entityShortType $entityVarName);
void deleteById($pkShortType id);

View File

@ -18,7 +18,9 @@ $!define
#set($entityType = $!tableInfo.psiClassObj.getQualifiedName())
#set($entityVarName = $!tool.firstLowerCase($!tableInfo.name))
#set($pkShortType = $!pk.shortType)
#set($pkType = $!pk.type)
import $pkType;
import $entityType;
import $serviceType;
import $repositoryType;