mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 日常字符串校验 统一重构到 StringUtils 便于维护扩展
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
package com.ruoyi.generator.domain;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.constant.GenConstants;
|
||||
@ -204,7 +204,7 @@ public class GenTable implements Serializable {
|
||||
}
|
||||
|
||||
public static boolean isSub(String tplCategory) {
|
||||
return tplCategory != null && StrUtil.equals(GenConstants.TPL_SUB, tplCategory);
|
||||
return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory);
|
||||
}
|
||||
|
||||
public boolean isTree() {
|
||||
@ -212,7 +212,7 @@ public class GenTable implements Serializable {
|
||||
}
|
||||
|
||||
public static boolean isTree(String tplCategory) {
|
||||
return tplCategory != null && StrUtil.equals(GenConstants.TPL_TREE, tplCategory);
|
||||
return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory);
|
||||
}
|
||||
|
||||
public boolean isCrud() {
|
||||
@ -220,7 +220,7 @@ public class GenTable implements Serializable {
|
||||
}
|
||||
|
||||
public static boolean isCrud(String tplCategory) {
|
||||
return tplCategory != null && StrUtil.equals(GenConstants.TPL_CRUD, tplCategory);
|
||||
return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
|
||||
}
|
||||
|
||||
public boolean isSuperColumn(String javaField) {
|
||||
@ -229,9 +229,9 @@ public class GenTable implements Serializable {
|
||||
|
||||
public static boolean isSuperColumn(String tplCategory, String javaField) {
|
||||
if (isTree(tplCategory)) {
|
||||
return StrUtil.equalsAnyIgnoreCase(javaField,
|
||||
return StringUtils.equalsAnyIgnoreCase(javaField,
|
||||
ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY));
|
||||
}
|
||||
return StrUtil.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
|
||||
return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ruoyi.generator.domain;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.*;
|
||||
@ -150,7 +150,7 @@ public class GenTableColumn implements Serializable {
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
|
||||
public String getCapJavaField() {
|
||||
return StrUtil.upperFirst(javaField);
|
||||
return StringUtils.upperFirst(javaField);
|
||||
}
|
||||
|
||||
public boolean isPk() {
|
||||
@ -158,7 +158,7 @@ public class GenTableColumn implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isPk(String isPk) {
|
||||
return isPk != null && StrUtil.equals("1", isPk);
|
||||
return isPk != null && StringUtils.equals("1", isPk);
|
||||
}
|
||||
|
||||
public boolean isIncrement() {
|
||||
@ -166,7 +166,7 @@ public class GenTableColumn implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isIncrement(String isIncrement) {
|
||||
return isIncrement != null && StrUtil.equals("1", isIncrement);
|
||||
return isIncrement != null && StringUtils.equals("1", isIncrement);
|
||||
}
|
||||
|
||||
public boolean isRequired() {
|
||||
@ -174,7 +174,7 @@ public class GenTableColumn implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isRequired(String isRequired) {
|
||||
return isRequired != null && StrUtil.equals("1", isRequired);
|
||||
return isRequired != null && StringUtils.equals("1", isRequired);
|
||||
}
|
||||
|
||||
public boolean isInsert() {
|
||||
@ -182,7 +182,7 @@ public class GenTableColumn implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isInsert(String isInsert) {
|
||||
return isInsert != null && StrUtil.equals("1", isInsert);
|
||||
return isInsert != null && StringUtils.equals("1", isInsert);
|
||||
}
|
||||
|
||||
public boolean isEdit() {
|
||||
@ -190,7 +190,7 @@ public class GenTableColumn implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isEdit(String isEdit) {
|
||||
return isEdit != null && StrUtil.equals("1", isEdit);
|
||||
return isEdit != null && StringUtils.equals("1", isEdit);
|
||||
}
|
||||
|
||||
public boolean isList() {
|
||||
@ -198,7 +198,7 @@ public class GenTableColumn implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isList(String isList) {
|
||||
return isList != null && StrUtil.equals("1", isList);
|
||||
return isList != null && StringUtils.equals("1", isList);
|
||||
}
|
||||
|
||||
public boolean isQuery() {
|
||||
@ -206,7 +206,7 @@ public class GenTableColumn implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isQuery(String isQuery) {
|
||||
return isQuery != null && StrUtil.equals("1", isQuery);
|
||||
return isQuery != null && StringUtils.equals("1", isQuery);
|
||||
}
|
||||
|
||||
public boolean isSuperColumn() {
|
||||
@ -214,7 +214,7 @@ public class GenTableColumn implements Serializable {
|
||||
}
|
||||
|
||||
public static boolean isSuperColumn(String javaField) {
|
||||
return StrUtil.equalsAnyIgnoreCase(javaField,
|
||||
return StringUtils.equalsAnyIgnoreCase(javaField,
|
||||
// BaseEntity
|
||||
"createBy", "createTime", "updateBy", "updateTime", "remark",
|
||||
// TreeEntity
|
||||
@ -227,15 +227,15 @@ public class GenTableColumn implements Serializable {
|
||||
|
||||
public static boolean isUsableColumn(String javaField) {
|
||||
// isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单
|
||||
return StrUtil.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark");
|
||||
return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark");
|
||||
}
|
||||
|
||||
public String readConverterExp() {
|
||||
String remarks = StrUtil.subBetween(this.columnComment, "(", ")");
|
||||
String remarks = StringUtils.subBetween(this.columnComment, "(", ")");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (StrUtil.isNotEmpty(remarks)) {
|
||||
if (StringUtils.isNotEmpty(remarks)) {
|
||||
for (String value : remarks.split(" ")) {
|
||||
if (StrUtil.isNotEmpty(value)) {
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
Object startStr = value.subSequence(0, 1);
|
||||
String endStr = value.substring(1);
|
||||
sb.append("").append(startStr).append("=").append(endStr).append(",");
|
||||
|
@ -3,7 +3,7 @@ package com.ruoyi.generator.service;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
@ -137,15 +137,15 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
||||
for (GenTableColumn cenTableColumn : genTable.getColumns()) {
|
||||
genTableColumnMapper.update(cenTableColumn,
|
||||
new LambdaUpdateWrapper<GenTableColumn>()
|
||||
.set(StrUtil.isBlank(cenTableColumn.getColumnComment()), GenTableColumn::getColumnComment, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsPk()), GenTableColumn::getIsPk, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsIncrement()), GenTableColumn::getIsIncrement, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsInsert()), GenTableColumn::getIsInsert, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsEdit()), GenTableColumn::getIsEdit, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsList()), GenTableColumn::getIsList, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsQuery()), GenTableColumn::getIsQuery, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getIsRequired()), GenTableColumn::getIsRequired, null)
|
||||
.set(StrUtil.isBlank(cenTableColumn.getDictType()), GenTableColumn::getDictType, "")
|
||||
.set(StringUtils.isBlank(cenTableColumn.getColumnComment()), GenTableColumn::getColumnComment, null)
|
||||
.set(StringUtils.isBlank(cenTableColumn.getIsPk()), GenTableColumn::getIsPk, null)
|
||||
.set(StringUtils.isBlank(cenTableColumn.getIsIncrement()), GenTableColumn::getIsIncrement, null)
|
||||
.set(StringUtils.isBlank(cenTableColumn.getIsInsert()), GenTableColumn::getIsInsert, null)
|
||||
.set(StringUtils.isBlank(cenTableColumn.getIsEdit()), GenTableColumn::getIsEdit, null)
|
||||
.set(StringUtils.isBlank(cenTableColumn.getIsList()), GenTableColumn::getIsList, null)
|
||||
.set(StringUtils.isBlank(cenTableColumn.getIsQuery()), GenTableColumn::getIsQuery, null)
|
||||
.set(StringUtils.isBlank(cenTableColumn.getIsRequired()), GenTableColumn::getIsRequired, null)
|
||||
.set(StringUtils.isBlank(cenTableColumn.getDictType()), GenTableColumn::getDictType, "")
|
||||
.eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId()));
|
||||
}
|
||||
}
|
||||
@ -260,7 +260,7 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||
for (String template : templates) {
|
||||
if (!StrUtil.containsAny("sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm", template)) {
|
||||
if (!StringUtils.containsAny("sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm", template)) {
|
||||
// 渲染模板
|
||||
StringWriter sw = new StringWriter();
|
||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||
@ -451,7 +451,7 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
||||
*/
|
||||
public static String getGenPath(GenTable table, String template) {
|
||||
String genPath = table.getGenPath();
|
||||
if (StrUtil.equals(genPath, "/")) {
|
||||
if (StringUtils.equals(genPath, "/")) {
|
||||
return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table);
|
||||
}
|
||||
return genPath + File.separator + VelocityUtils.getFileName(template, table);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ruoyi.generator.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.constant.GenConstants;
|
||||
import com.ruoyi.generator.config.GenConfig;
|
||||
import com.ruoyi.generator.domain.GenTable;
|
||||
@ -40,7 +40,7 @@ public class GenUtils
|
||||
column.setTableId(table.getTableId());
|
||||
column.setCreateBy(table.getCreateBy());
|
||||
// 设置java字段名
|
||||
column.setJavaField(StrUtil.toCamelCase(columnName));
|
||||
column.setJavaField(StringUtils.toCamelCase(columnName));
|
||||
// 设置默认类型
|
||||
column.setJavaType(GenConstants.TYPE_STRING);
|
||||
|
||||
@ -61,7 +61,7 @@ public class GenUtils
|
||||
column.setHtmlType(GenConstants.HTML_INPUT);
|
||||
|
||||
// 如果是浮点型 统一用BigDecimal
|
||||
String[] str = StrUtil.splitToArray(StrUtil.subBetween(column.getColumnType(), "(", ")"), ",");
|
||||
String[] str = StringUtils.splitToArray(StringUtils.subBetween(column.getColumnType(), "(", ")"), ",");
|
||||
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0)
|
||||
{
|
||||
column.setJavaType(GenConstants.TYPE_BIGDECIMAL);
|
||||
@ -98,33 +98,33 @@ public class GenUtils
|
||||
}
|
||||
|
||||
// 查询字段类型
|
||||
if (StrUtil.endWithIgnoreCase(columnName, "name"))
|
||||
if (StringUtils.endWithIgnoreCase(columnName, "name"))
|
||||
{
|
||||
column.setQueryType(GenConstants.QUERY_LIKE);
|
||||
}
|
||||
// 状态字段设置单选框
|
||||
if (StrUtil.endWithIgnoreCase(columnName, "status"))
|
||||
if (StringUtils.endWithIgnoreCase(columnName, "status"))
|
||||
{
|
||||
column.setHtmlType(GenConstants.HTML_RADIO);
|
||||
}
|
||||
// 类型&性别字段设置下拉框
|
||||
else if (StrUtil.endWithIgnoreCase(columnName, "type")
|
||||
|| StrUtil.endWithIgnoreCase(columnName, "sex"))
|
||||
else if (StringUtils.endWithIgnoreCase(columnName, "type")
|
||||
|| StringUtils.endWithIgnoreCase(columnName, "sex"))
|
||||
{
|
||||
column.setHtmlType(GenConstants.HTML_SELECT);
|
||||
}
|
||||
// 图片字段设置图片上传控件
|
||||
else if (StrUtil.endWithIgnoreCase(columnName, "image"))
|
||||
else if (StringUtils.endWithIgnoreCase(columnName, "image"))
|
||||
{
|
||||
column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD);
|
||||
}
|
||||
// 文件字段设置文件上传控件
|
||||
else if (StrUtil.endWithIgnoreCase(columnName, "file"))
|
||||
else if (StringUtils.endWithIgnoreCase(columnName, "file"))
|
||||
{
|
||||
column.setHtmlType(GenConstants.HTML_FILE_UPLOAD);
|
||||
}
|
||||
// 内容字段设置富文本控件
|
||||
else if (StrUtil.endWithIgnoreCase(columnName, "content"))
|
||||
else if (StringUtils.endWithIgnoreCase(columnName, "content"))
|
||||
{
|
||||
column.setHtmlType(GenConstants.HTML_EDITOR);
|
||||
}
|
||||
@ -152,7 +152,7 @@ public class GenUtils
|
||||
{
|
||||
int lastIndex = packageName.lastIndexOf(".");
|
||||
int nameLength = packageName.length();
|
||||
String moduleName = StrUtil.sub(packageName, lastIndex + 1, nameLength);
|
||||
String moduleName = StringUtils.sub(packageName, lastIndex + 1, nameLength);
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ public class GenUtils
|
||||
{
|
||||
int lastIndex = tableName.lastIndexOf("_");
|
||||
int nameLength = tableName.length();
|
||||
String businessName = StrUtil.sub(tableName, lastIndex + 1, nameLength);
|
||||
String businessName = StringUtils.sub(tableName, lastIndex + 1, nameLength);
|
||||
return businessName;
|
||||
}
|
||||
|
||||
@ -180,12 +180,12 @@ public class GenUtils
|
||||
{
|
||||
boolean autoRemovePre = GenConfig.getAutoRemovePre();
|
||||
String tablePrefix = GenConfig.getTablePrefix();
|
||||
if (autoRemovePre && StrUtil.isNotEmpty(tablePrefix))
|
||||
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix))
|
||||
{
|
||||
String[] searchList = StrUtil.splitToArray(tablePrefix, ",");
|
||||
String[] searchList = StringUtils.splitToArray(tablePrefix, ",");
|
||||
tableName = replaceFirst(tableName, searchList);
|
||||
}
|
||||
return StrUtil.upperFirst(StrUtil.toCamelCase(tableName));
|
||||
return StringUtils.upperFirst(StringUtils.toCamelCase(tableName));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,9 +228,9 @@ public class GenUtils
|
||||
*/
|
||||
public static String getDbType(String columnType)
|
||||
{
|
||||
if (StrUtil.indexOf(columnType, '(') > 0)
|
||||
if (StringUtils.indexOf(columnType, '(') > 0)
|
||||
{
|
||||
return StrUtil.subBefore(columnType, "(",false);
|
||||
return StringUtils.subBefore(columnType, "(",false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -246,9 +246,9 @@ public class GenUtils
|
||||
*/
|
||||
public static Integer getColumnLength(String columnType)
|
||||
{
|
||||
if (StrUtil.indexOf(columnType, '(') > 0)
|
||||
if (StringUtils.indexOf(columnType, '(') > 0)
|
||||
{
|
||||
String length = StrUtil.subBetween(columnType, "(", ")");
|
||||
String length = StringUtils.subBetween(columnType, "(", ")");
|
||||
return Integer.valueOf(length);
|
||||
}
|
||||
else
|
||||
|
@ -2,7 +2,7 @@ package com.ruoyi.generator.util;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.constant.GenConstants;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.JsonUtils;
|
||||
@ -47,11 +47,11 @@ public class VelocityUtils
|
||||
VelocityContext velocityContext = new VelocityContext();
|
||||
velocityContext.put("tplCategory", genTable.getTplCategory());
|
||||
velocityContext.put("tableName", genTable.getTableName());
|
||||
velocityContext.put("functionName", StrUtil.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
|
||||
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
|
||||
velocityContext.put("ClassName", genTable.getClassName());
|
||||
velocityContext.put("className", StrUtil.lowerFirst(genTable.getClassName()));
|
||||
velocityContext.put("className", StringUtils.lowerFirst(genTable.getClassName()));
|
||||
velocityContext.put("moduleName", genTable.getModuleName());
|
||||
velocityContext.put("BusinessName", StrUtil.upperFirst(genTable.getBusinessName()));
|
||||
velocityContext.put("BusinessName", StringUtils.upperFirst(genTable.getBusinessName()));
|
||||
velocityContext.put("businessName", genTable.getBusinessName());
|
||||
velocityContext.put("basePackage", getPackagePrefix(packageName));
|
||||
velocityContext.put("packageName", packageName);
|
||||
@ -110,15 +110,15 @@ public class VelocityUtils
|
||||
String subTableName = genTable.getSubTableName();
|
||||
String subTableFkName = genTable.getSubTableFkName();
|
||||
String subClassName = genTable.getSubTable().getClassName();
|
||||
String subTableFkClassName = StrUtil.toCamelCase(subTableFkName);
|
||||
String subTableFkClassName = StringUtils.toCamelCase(subTableFkName);
|
||||
|
||||
context.put("subTable", subTable);
|
||||
context.put("subTableName", subTableName);
|
||||
context.put("subTableFkName", subTableFkName);
|
||||
context.put("subTableFkClassName", subTableFkClassName);
|
||||
context.put("subTableFkclassName", StrUtil.lowerFirst(subTableFkClassName));
|
||||
context.put("subTableFkclassName", StringUtils.lowerFirst(subTableFkClassName));
|
||||
context.put("subClassName", subClassName);
|
||||
context.put("subclassName", StrUtil.lowerFirst(subClassName));
|
||||
context.put("subclassName", StringUtils.lowerFirst(subClassName));
|
||||
context.put("subImportList", getImportList(genTable.getSubTable()));
|
||||
}
|
||||
|
||||
@ -172,45 +172,45 @@ public class VelocityUtils
|
||||
// 业务名称
|
||||
String businessName = genTable.getBusinessName();
|
||||
|
||||
String javaPath = PROJECT_PATH + "/" + StrUtil.replace(packageName, ".", "/");
|
||||
String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/");
|
||||
String mybatisPath = MYBATIS_PATH + "/" + moduleName;
|
||||
String vuePath = "vue";
|
||||
|
||||
if (template.contains("domain.java.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/domain/{}.java", javaPath, className);
|
||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
||||
}
|
||||
if (template.contains("vo.java.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/domain/vo/{}Vo.java", javaPath, className);
|
||||
fileName = StringUtils.format("{}/domain/vo/{}Vo.java", javaPath, className);
|
||||
}
|
||||
if (template.contains("bo.java.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/domain/bo/{}Bo.java", javaPath, className);
|
||||
fileName = StringUtils.format("{}/domain/bo/{}Bo.java", javaPath, className);
|
||||
}
|
||||
if (template.contains("sub-domain.java.vm") && StrUtil.equals(GenConstants.TPL_SUB, genTable.getTplCategory()))
|
||||
if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory()))
|
||||
{
|
||||
fileName = StrUtil.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
||||
}
|
||||
else if (template.contains("mapper.java.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/mapper/{}Mapper.java", javaPath, className);
|
||||
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
||||
}
|
||||
else if (template.contains("service.java.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/service/I{}Service.java", javaPath, className);
|
||||
fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className);
|
||||
}
|
||||
else if (template.contains("serviceImpl.java.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
|
||||
fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
|
||||
}
|
||||
else if (template.contains("controller.java.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/controller/{}Controller.java", javaPath, className);
|
||||
fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className);
|
||||
}
|
||||
else if (template.contains("mapper.xml.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/{}Mapper.xml", mybatisPath, className);
|
||||
fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className);
|
||||
}
|
||||
else if (template.contains("sql.vm"))
|
||||
{
|
||||
@ -218,15 +218,15 @@ public class VelocityUtils
|
||||
}
|
||||
else if (template.contains("api.js.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/api/{}/{}.js", vuePath, moduleName, businessName);
|
||||
fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName);
|
||||
}
|
||||
else if (template.contains("index.vue.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
||||
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
||||
}
|
||||
else if (template.contains("index-tree.vue.vm"))
|
||||
{
|
||||
fileName = StrUtil.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
||||
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
@ -240,7 +240,7 @@ public class VelocityUtils
|
||||
public static String getPackagePrefix(String packageName)
|
||||
{
|
||||
int lastIndex = packageName.lastIndexOf(".");
|
||||
String basePackage = StrUtil.sub(packageName, 0, lastIndex);
|
||||
String basePackage = StringUtils.sub(packageName, 0, lastIndex);
|
||||
return basePackage;
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ public class VelocityUtils
|
||||
*/
|
||||
public static String getPermissionPrefix(String moduleName, String businessName)
|
||||
{
|
||||
return StrUtil.format("{}:{}", moduleName, businessName);
|
||||
return StringUtils.format("{}:{}", moduleName, businessName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -295,7 +295,7 @@ public class VelocityUtils
|
||||
public static String getParentMenuId(Map<String, Object> paramsObj)
|
||||
{
|
||||
if (Validator.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID)
|
||||
&& StrUtil.isNotEmpty(paramsObj.getString(GenConstants.PARENT_MENU_ID)))
|
||||
&& StringUtils.isNotEmpty(Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_ID))))
|
||||
{
|
||||
return Convert.toStr(paramsObj.get(GenConstants.PARENT_MENU_ID));
|
||||
}
|
||||
@ -312,9 +312,9 @@ public class VelocityUtils
|
||||
{
|
||||
if (Validator.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_CODE))
|
||||
{
|
||||
return StrUtil.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_CODE)));
|
||||
return StringUtils.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_CODE)));
|
||||
}
|
||||
return StrUtil.EMPTY;
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -327,9 +327,9 @@ public class VelocityUtils
|
||||
{
|
||||
if (Validator.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_PARENT_CODE))
|
||||
{
|
||||
return StrUtil.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_PARENT_CODE)));
|
||||
return StringUtils.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_PARENT_CODE)));
|
||||
}
|
||||
return StrUtil.EMPTY;
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -342,9 +342,9 @@ public class VelocityUtils
|
||||
{
|
||||
if (Validator.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.TREE_NAME))
|
||||
{
|
||||
return StrUtil.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_NAME)));
|
||||
return StringUtils.toCamelCase(Convert.toStr(paramsObj.get(GenConstants.TREE_NAME)));
|
||||
}
|
||||
return StrUtil.EMPTY;
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
package ${packageName}.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
@ -61,7 +61,7 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper,
|
||||
#set($mpMethod=$column.queryType.toLowerCase())
|
||||
#if($queryType != 'BETWEEN')
|
||||
#if($javaType == 'String')
|
||||
#set($condition='StrUtil.isNotBlank(bo.get'+$AttrName+'())')
|
||||
#set($condition='StringUtils.isNotBlank(bo.get'+$AttrName+'())')
|
||||
#else
|
||||
#set($condition='bo.get'+$AttrName+'() != null')
|
||||
#end
|
||||
|
Reference in New Issue
Block a user