优化代码生成器的辅助类名生成方式
This commit is contained in:
parent
930d5aaa70
commit
21c040b74e
@ -43,14 +43,14 @@ Ruoyi-Flex是一套全部开源的快速开发平台,使用MIT开源许可协
|
|||||||
|
|
||||||
## Ruoyi-Flex交流群
|
## Ruoyi-Flex交流群
|
||||||
|
|
||||||
如果您看了文档,还有不明事宜,请加群交流:
|
如果您看了文档,还入不了门,请扫码支付199元加群寻求帮助:
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>1、普通QQ群: 100956531</td>
|
<td>1、QQ交流群: 100956531</td>
|
||||||
<td>[Ruoyi-Flex交流一群]</td>
|
<td>[Ruoyi-Flex交流一群]</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>2、付费微信VIP交流群(需扫码捐助99元后加好友入群):</td>
|
<td>2、微信交流群:</td>
|
||||||
<td><img src="https://gitee.com/dataprince/ruoyi-flex/raw/master/image/dataprince.jpg"/></td>
|
<td><img src="https://gitee.com/dataprince/ruoyi-flex/raw/master/image/dataprince.jpg"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -45,7 +45,7 @@ public class VelocityUtils
|
|||||||
VelocityContext velocityContext = new VelocityContext();
|
VelocityContext velocityContext = new VelocityContext();
|
||||||
velocityContext.put("tplCategory", genTable.getTplCategory());
|
velocityContext.put("tplCategory", genTable.getTplCategory());
|
||||||
velocityContext.put("tableName", genTable.getTableName());
|
velocityContext.put("tableName", genTable.getTableName());
|
||||||
velocityContext.put("CapitalTableName", StringUtils.upperCase(genTable.getTableName()));//表名大写:SYS_USER
|
velocityContext.put("CapitalUnderScoreClassName", StringUtils.upperCase(StringUtils.toUnderScoreCase(genTable.getClassName())));//大写的类名下划线:SYS_USER
|
||||||
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
|
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
|
||||||
velocityContext.put("ClassName", genTable.getClassName());
|
velocityContext.put("ClassName", genTable.getClassName());
|
||||||
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
|
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
|
||||||
|
@ -30,7 +30,7 @@ import ${packageName}.domain.bo.${ClassName}Bo;
|
|||||||
import ${packageName}.domain.vo.${ClassName}Vo;
|
import ${packageName}.domain.vo.${ClassName}Vo;
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
import ${packageName}.service.I${ClassName}Service;
|
||||||
|
|
||||||
import static ${packageName}.domain.table.${ClassName}TableDef.${CapitalTableName};
|
import static ${packageName}.domain.table.${ClassName}TableDef.${CapitalUnderScoreClassName};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}Service业务层处理
|
* ${functionName}Service业务层处理
|
||||||
@ -46,7 +46,7 @@ public class ${ClassName}ServiceImpl extends BaseServiceImpl<${ClassName}Mapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper query() {
|
public QueryWrapper query() {
|
||||||
return super.query().from(${CapitalTableName});
|
return super.query().from(${CapitalUnderScoreClassName});
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryWrapper buildQueryWrapper(${ClassName}Bo ${className}Bo) {
|
private QueryWrapper buildQueryWrapper(${ClassName}Bo ${className}Bo) {
|
||||||
@ -68,12 +68,12 @@ public class ${ClassName}ServiceImpl extends BaseServiceImpl<${ClassName}Mapper,
|
|||||||
#set($condition=${className}+'Bo.get'+$AttrName+'() != null')
|
#set($condition=${className}+'Bo.get'+$AttrName+'() != null')
|
||||||
#end
|
#end
|
||||||
if ($condition) {
|
if ($condition) {
|
||||||
queryWrapper.and(${CapitalTableName}.${capitalColumnName}.$mpMethod(${className}Bo.get$AttrName()));
|
queryWrapper.and(${CapitalUnderScoreClassName}.${capitalColumnName}.$mpMethod(${className}Bo.get$AttrName()));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Map<String, Object> params = ${className}Bo.getParams();
|
Map<String, Object> params = ${className}Bo.getParams();
|
||||||
if (params.get("begin$AttrName") != null && params.get("end$AttrName") != null) {
|
if (params.get("begin$AttrName") != null && params.get("end$AttrName") != null) {
|
||||||
queryWrapper.and(${CapitalTableName}.${capitalColumnName}.$mpMethod(params.get("begin$AttrName"), params.get("end$AttrName")));
|
queryWrapper.and(${CapitalUnderScoreClassName}.${capitalColumnName}.$mpMethod(params.get("begin$AttrName"), params.get("end$AttrName")));
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
@ -92,7 +92,7 @@ public class ${ClassName}ServiceImpl extends BaseServiceImpl<${ClassName}Mapper,
|
|||||||
public ${ClassName}Vo selectById(${pkColumn.javaType} ${pkColumn.javaField})
|
public ${ClassName}Vo selectById(${pkColumn.javaType} ${pkColumn.javaField})
|
||||||
{
|
{
|
||||||
#set($CapitalPkColumn=${pkColumn.columnName.toUpperCase()})
|
#set($CapitalPkColumn=${pkColumn.columnName.toUpperCase()})
|
||||||
return this.getOneAs(query().where(${CapitalTableName}.${CapitalPkColumn}.eq(${pkColumn.javaField})), ${ClassName}Vo.class);
|
return this.getOneAs(query().where(${CapitalUnderScoreClassName}.${CapitalPkColumn}.eq(${pkColumn.javaField})), ${ClassName}Vo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user