mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-11-05 10:09:32 +08:00
🎉 优化代码生成
This commit is contained in:
parent
3f07d2d48d
commit
c80d129953
@ -24,7 +24,6 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Condition;
|
||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
import org.springblade.system.feign.IDictClient;
|
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -63,8 +62,6 @@ public class $!{table.controllerName} {
|
|||||||
|
|
||||||
private $!{table.serviceName} $!{table.entityPath}Service;
|
private $!{table.serviceName} $!{table.entityPath}Service;
|
||||||
|
|
||||||
private IDictClient dictClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
@ -73,8 +70,7 @@ public class $!{table.controllerName} {
|
|||||||
@ApiOperation(value = "详情", notes = "传入$!{table.entityPath}", position = 1)
|
@ApiOperation(value = "详情", notes = "传入$!{table.entityPath}", position = 1)
|
||||||
public R<$!{entity}VO> detail($!{entity} $!{table.entityPath}) {
|
public R<$!{entity}VO> detail($!{entity} $!{table.entityPath}) {
|
||||||
$!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath}));
|
$!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath}));
|
||||||
$!{entity}Wrapper $!{table.entityPath}Wrapper = new $!{entity}Wrapper(dictClient);
|
return R.data($!{entity}Wrapper.build().entityVO(detail));
|
||||||
return R.data($!{table.entityPath}Wrapper.entityVO(detail));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,8 +81,7 @@ public class $!{table.controllerName} {
|
|||||||
@ApiOperation(value = "分页", notes = "传入$!{table.entityPath}")
|
@ApiOperation(value = "分页", notes = "传入$!{table.entityPath}")
|
||||||
public R<IPage<$!{entity}VO>> list($!{entity} $!{table.entityPath}, Query query) {
|
public R<IPage<$!{entity}VO>> list($!{entity} $!{table.entityPath}, Query query) {
|
||||||
IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath}));
|
IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath}));
|
||||||
$!{entity}Wrapper $!{table.entityPath}Wrapper = new $!{entity}Wrapper(dictClient);
|
return R.data($!{entity}Wrapper.build().pageVO(pages));
|
||||||
return R.data($!{table.entityPath}Wrapper.pageVO(pages));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,6 @@ package $!{wrapperPackage};
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||||
import org.springblade.core.tool.utils.BeanUtil;
|
import org.springblade.core.tool.utils.BeanUtil;
|
||||||
import org.springblade.system.feign.IDictClient;
|
|
||||||
import $!{package.Entity}.$!{entity};
|
import $!{package.Entity}.$!{entity};
|
||||||
#set($voPackage=$package.Entity.replace("entity","vo"))
|
#set($voPackage=$package.Entity.replace("entity","vo"))
|
||||||
import $!{voPackage}.$!{entity}VO;
|
import $!{voPackage}.$!{entity}VO;
|
||||||
@ -30,21 +29,16 @@ import $!{voPackage}.$!{entity}VO;
|
|||||||
* @author $!{author}
|
* @author $!{author}
|
||||||
* @since $!{date}
|
* @since $!{date}
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
|
||||||
public class $!{entity}Wrapper extends BaseEntityWrapper<$!{entity}, $!{entity}VO> {
|
public class $!{entity}Wrapper extends BaseEntityWrapper<$!{entity}, $!{entity}VO> {
|
||||||
|
|
||||||
private IDictClient dictClient;
|
public static $!{entity}Wrapper build() {
|
||||||
|
return new $!{entity}Wrapper();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public $!{entity}VO entityVO($!{entity} $!{table.entityPath}) {
|
public $!{entity}VO entityVO($!{entity} $!{table.entityPath}) {
|
||||||
$!{entity}VO $!{table.entityPath}VO = BeanUtil.copy($!{table.entityPath}, $!{entity}VO.class);
|
$!{entity}VO $!{table.entityPath}VO = BeanUtil.copy($!{table.entityPath}, $!{entity}VO.class);
|
||||||
|
|
||||||
/*R<String> dict = dictClient.getValue("$!{table.entityPath}" , $!{table.entityPath}VO.getCategory());
|
|
||||||
if (dict.isSuccess()) {
|
|
||||||
String categoryName = dict.getData();
|
|
||||||
$!{table.entityPath}VO.setCategoryName(categoryName);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return $!{table.entityPath}VO;
|
return $!{table.entityPath}VO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user