优化代码生成器的辅助类名生成方式

This commit is contained in:
dataprince 2023-12-04 16:06:20 +08:00
parent 930d5aaa70
commit 21c040b74e
3 changed files with 9 additions and 9 deletions

View File

@ -43,14 +43,14 @@ Ruoyi-Flex是一套全部开源的快速开发平台使用MIT开源许可协
## Ruoyi-Flex交流群
如果您看了文档,还有不明事宜,请加群交流
如果您看了文档,还入不了门请扫码支付199元加群寻求帮助
<table>
<tr>
<td>1、普通QQ群 100956531</td>
<td>1、QQ交流群: 100956531</td>
<td>[Ruoyi-Flex交流一群]</td>
</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>
</tr>
</table>

View File

@ -45,7 +45,7 @@ public class VelocityUtils
VelocityContext velocityContext = new VelocityContext();
velocityContext.put("tplCategory", genTable.getTplCategory());
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("ClassName", genTable.getClassName());
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));

View File

@ -30,7 +30,7 @@ import ${packageName}.domain.bo.${ClassName}Bo;
import ${packageName}.domain.vo.${ClassName}Vo;
import ${packageName}.service.I${ClassName}Service;
import static ${packageName}.domain.table.${ClassName}TableDef.${CapitalTableName};
import static ${packageName}.domain.table.${ClassName}TableDef.${CapitalUnderScoreClassName};
/**
* ${functionName}Service业务层处理
@ -46,7 +46,7 @@ public class ${ClassName}ServiceImpl extends BaseServiceImpl<${ClassName}Mapper,
@Override
public QueryWrapper query() {
return super.query().from(${CapitalTableName});
return super.query().from(${CapitalUnderScoreClassName});
}
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')
#end
if ($condition) {
queryWrapper.and(${CapitalTableName}.${capitalColumnName}.$mpMethod(${className}Bo.get$AttrName()));
queryWrapper.and(${CapitalUnderScoreClassName}.${capitalColumnName}.$mpMethod(${className}Bo.get$AttrName()));
}
#else
Map<String, Object> params = ${className}Bo.getParams();
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
@ -92,7 +92,7 @@ public class ${ClassName}ServiceImpl extends BaseServiceImpl<${ClassName}Mapper,
public ${ClassName}Vo selectById(${pkColumn.javaType} ${pkColumn.javaField})
{
#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);
}
/**