Merge branch 'code-generator'

# Conflicts:
#	smart-admin-api/sa-base/src/main/java/net/lab1024/sa/base/module/support/codegenerator/service/CodeGeneratorTemplateService.java
#	smart-admin-api/sa-base/src/main/java/net/lab1024/sa/base/module/support/codegenerator/service/variable/backend/domain/MapperVariableService.java
#	smart-admin-api/sa-base/src/main/java/net/lab1024/sa/base/module/support/job/core/SmartJobExecutor.java
#	smart-admin-api/sa-base/src/main/resources/code-generator-template/js/form.vue.vm
#	smart-admin-api/sa-base/src/main/resources/code-generator-template/js/list.vue.vm
#	smart-admin-web/javascript-ant-design-vue3/src/views/support/code-generator/components/form/code-generator-table-config-form-delete.vue
#	smart-admin-web/javascript-ant-design-vue3/src/views/support/code-generator/components/preview/code-generator-preview-modal.vue
This commit is contained in:
zhoumingfa 2024-08-14 15:11:15 +08:00
commit 6bcb9b296f
27 changed files with 284 additions and 202 deletions

View File

@ -1,9 +1,11 @@
package net.lab1024.sa.admin.module.business.goods.domain.form; package net.lab1024.sa.admin.module.business.goods.domain.form;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum; import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
import net.lab1024.sa.base.common.domain.PageParam; import net.lab1024.sa.base.common.domain.PageParam;
import net.lab1024.sa.base.common.json.deserializer.DictValueVoDeserializer;
import net.lab1024.sa.base.common.swagger.SchemaEnum; import net.lab1024.sa.base.common.swagger.SchemaEnum;
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum; import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
@ -32,6 +34,7 @@ public class GoodsQueryForm extends PageParam {
private Integer goodsStatus; private Integer goodsStatus;
@Schema(description = "产地") @Schema(description = "产地")
@JsonDeserialize(using = DictValueVoDeserializer.class)
private String place; private String place;
@Schema(description = "上架状态") @Schema(description = "上架状态")

View File

@ -199,7 +199,7 @@ public class GoodsService {
GoodsExcelVO.builder() GoodsExcelVO.builder()
.goodsStatus(SmartEnumUtil.getEnumDescByValue(e.getGoodsStatus(), GoodsStatusEnum.class)) .goodsStatus(SmartEnumUtil.getEnumDescByValue(e.getGoodsStatus(), GoodsStatusEnum.class))
.categoryName(categoryQueryService.queryCategoryName(e.getCategoryId())) .categoryName(categoryQueryService.queryCategoryName(e.getCategoryId()))
.place(dictCacheService.selectValueNameByValueCode(e.getPlace())) .place(Arrays.stream(e.getPlace().split(",")).map(code -> dictCacheService.selectValueNameByValueCode(code)).collect(Collectors.joining(",")))
.price(e.getPrice()) .price(e.getPrice())
.goodsName(e.getGoodsName()) .goodsName(e.getGoodsName())
.remark(e.getRemark()) .remark(e.getRemark())

View File

@ -18,7 +18,7 @@
INSTR(goods_name,#{query.searchWord}) INSTR(goods_name,#{query.searchWord})
</if> </if>
<if test="query.place != null"> <if test="query.place != null">
AND place = #{query.place} AND INSTR(place,#{query.place})
</if> </if>
<if test="query.goodsStatus != null"> <if test="query.goodsStatus != null">
AND goods_status = #{query.goodsStatus} AND goods_status = #{query.goodsStatus}

View File

@ -28,19 +28,19 @@ public class DictValueVoDeserializer extends JsonDeserializer<String> {
@Override @Override
public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
List<DictValueVO> list = new ArrayList<>(); List<String> list = new ArrayList<>();
ObjectCodec objectCodec = jsonParser.getCodec(); ObjectCodec objectCodec = jsonParser.getCodec();
JsonNode listOrObjectNode = objectCodec.readTree(jsonParser); JsonNode listOrObjectNode = objectCodec.readTree(jsonParser);
String deserialize = ""; String deserialize = "";
try { try {
if (listOrObjectNode.isArray()) { if (listOrObjectNode.isArray()) {
for (JsonNode node : listOrObjectNode) { for (JsonNode node : listOrObjectNode) {
list.add(objectCodec.treeToValue(node, DictValueVO.class)); list.add(node.asText());
} }
} else { } else {
list.add(objectCodec.treeToValue(listOrObjectNode, DictValueVO.class)); list.add(listOrObjectNode.asText());
} }
deserialize = list.stream().map(DictValueVO::getValueCode).collect(Collectors.joining(",")); deserialize = String.join(",", list);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
deserialize = listOrObjectNode.asText(); deserialize = listOrObjectNode.asText();

View File

@ -13,16 +13,13 @@ import net.lab1024.sa.base.common.util.SmartStringUtil;
import net.lab1024.sa.base.module.support.codegenerator.domain.entity.CodeGeneratorConfigEntity; import net.lab1024.sa.base.module.support.codegenerator.domain.entity.CodeGeneratorConfigEntity;
import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm; import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.*; import net.lab1024.sa.base.module.support.codegenerator.domain.model.*;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.backend.ControllerVariableService; import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.backend.DaoVariableService; import net.lab1024.sa.base.module.support.codegenerator.service.variable.backend.*;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.backend.ManagerVariableService;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.backend.ServiceVariableService;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.backend.domain.*; import net.lab1024.sa.base.module.support.codegenerator.service.variable.backend.domain.*;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.front.ApiVariableService; import net.lab1024.sa.base.module.support.codegenerator.service.variable.front.ApiVariableService;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.front.ConstVariableService; import net.lab1024.sa.base.module.support.codegenerator.service.variable.front.ConstVariableService;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.front.FormVariableService; import net.lab1024.sa.base.module.support.codegenerator.service.variable.front.FormVariableService;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.front.ListVariableService; import net.lab1024.sa.base.module.support.codegenerator.service.variable.front.ListVariableService;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService;
import net.lab1024.sa.base.module.support.codegenerator.util.CodeGeneratorTool; import net.lab1024.sa.base.module.support.codegenerator.util.CodeGeneratorTool;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.velocity.Template; import org.apache.velocity.Template;
@ -36,7 +33,7 @@ import javax.annotation.PostConstruct;
import java.io.File; import java.io.File;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.StringWriter; import java.io.StringWriter;
import java.nio.charset.Charset; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -47,7 +44,7 @@ import java.util.stream.Collectors;
* @Date 2022-06-30 22:15:38 * @Date 2022-06-30 22:15:38
* @Wechat zhuoda1024 * @Wechat zhuoda1024
* @Email lab1024@163.com * @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a> * @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/ */
@Service @Service
@ -70,6 +67,8 @@ public class CodeGeneratorTemplateService {
map.put("java/manager/Manager.java", new ManagerVariableService()); map.put("java/manager/Manager.java", new ManagerVariableService());
map.put("java/dao/Dao.java", new DaoVariableService()); map.put("java/dao/Dao.java", new DaoVariableService());
map.put("java/mapper/Mapper.xml", new MapperVariableService()); map.put("java/mapper/Mapper.xml", new MapperVariableService());
// 菜单 SQL
map.put("java/sql/Menu.sql", new MenuVariableService());
// 前端 // 前端
map.put("js/api.js", new ApiVariableService()); map.put("js/api.js", new ApiVariableService());
map.put("js/const.js", new ConstVariableService()); map.put("js/const.js", new ConstVariableService());
@ -94,7 +93,7 @@ public class CodeGeneratorTemplateService {
String fileName = templateFile.startsWith("java") ? upperCamel + templateSplit[templateSplit.length - 1] : lowerHyphen + "-" + templateSplit[templateSplit.length - 1]; String fileName = templateFile.startsWith("java") ? upperCamel + templateSplit[templateSplit.length - 1] : lowerHyphen + "-" + templateSplit[templateSplit.length - 1];
String fullPathFileName = templateFile.replaceAll(templateSplit[templateSplit.length - 1], fileName); String fullPathFileName = templateFile.replaceAll(templateSplit[templateSplit.length - 1], fileName);
fullPathFileName = fullPathFileName.replaceAll("java/", "java/" + basic.getModuleName().toLowerCase() + "/"); fullPathFileName = fullPathFileName.replaceAll("java/", "java/" + basic.getModuleName().toLowerCase() + "/");
fullPathFileName = fullPathFileName.replaceAll("js/", "js/" + basic.getModuleName().toLowerCase() + "/"); fullPathFileName = fullPathFileName.replaceAll("js/", "js/" + lowerHyphen + "/");
String fileContent = generate(tableName, templateFile, codeGeneratorConfigEntity); String fileContent = generate(tableName, templateFile, codeGeneratorConfigEntity);
File file = new File(uuid + "/" + fullPathFileName); File file = new File(uuid + "/" + fullPathFileName);
@ -130,7 +129,7 @@ public class CodeGeneratorTemplateService {
} }
ZipUtil.zip(outputStream, Charset.forName("utf-8"), false, null, dir); ZipUtil.zip(outputStream, StandardCharsets.UTF_8, false, null, dir);
FileUtil.del(dir); FileUtil.del(dir);

View File

@ -0,0 +1,27 @@
package net.lab1024.sa.base.module.support.codegenerator.service.variable.backend;
import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService;
import java.util.HashMap;
import java.util.Map;
/**
* 目前暂时没用到 这是一个空实现
*
* @author zhoumingfa
* @date 2024/8/13
*/
public class MenuVariableService extends CodeGenerateBaseVariableService {
@Override
public boolean isSupport(CodeGeneratorConfigForm form) {
return true;
}
@Override
public Map<String, Object> getInjectVariablesMap(CodeGeneratorConfigForm form) {
return new HashMap<>(2);
}
}

View File

@ -65,7 +65,15 @@ public class MapperVariableService extends CodeGenerateBaseVariableService {
stringBuilder.append("\n )"); stringBuilder.append("\n )");
} }
fieldMap.put("likeStr", stringBuilder.toString()); fieldMap.put("likeStr", stringBuilder.toString());
} else { } else if (CodeQueryFieldQueryTypeEnum.DICT.equalsValue(queryField.getQueryTypeEnum())) {
String stringBuilder = "AND INSTR(" +
form.getTableName() + "." + queryField.getColumnNameList().get(0) +
",#{queryForm." +
queryField.getFieldName() +
"})";
fieldMap.put("likeStr", stringBuilder);
}
else {
fieldMap.put("columnName", queryField.getColumnNameList().get(0)); fieldMap.put("columnName", queryField.getColumnNameList().get(0));
} }
} }

View File

@ -2,6 +2,7 @@ package net.lab1024.sa.base.module.support.codegenerator.service.variable.backen
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import net.lab1024.sa.base.common.util.SmartEnumUtil; import net.lab1024.sa.base.common.util.SmartEnumUtil;
import net.lab1024.sa.base.common.util.SmartStringUtil;
import net.lab1024.sa.base.module.support.codegenerator.constant.CodeQueryFieldQueryTypeEnum; import net.lab1024.sa.base.module.support.codegenerator.constant.CodeQueryFieldQueryTypeEnum;
import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm; import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeField; import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeField;
@ -41,14 +42,11 @@ public class QueryFormVariableService extends CodeGenerateBaseVariableService {
public ImmutablePair<List<String>, List<Map<String, Object>>> getPackageListAndFields(CodeGeneratorConfigForm form) { public ImmutablePair<List<String>, List<Map<String, Object>>> getPackageListAndFields(CodeGeneratorConfigForm form) {
List<CodeQueryField> fields = form.getQueryFields(); List<CodeQueryField> fields = form.getQueryFields();
if (CollectionUtils.isEmpty(fields)) {
return ImmutablePair.of(new ArrayList<>(), new ArrayList<>());
}
HashSet<String> packageList = new HashSet<>(); HashSet<String> packageList = new HashSet<>();
/** /**
* 1LocalDateLocalDateTimeBigDecimal 类型的包名 * 1LocalDateLocalDateTimeBigDecimal 类型的包名
* 2排序 * 2排序
@ -106,6 +104,14 @@ public class QueryFormVariableService extends CodeGenerateBaseVariableService {
finalFieldMap.put("javaType", codeField.getJavaType()); finalFieldMap.put("javaType", codeField.getJavaType());
break; break;
case DICT:
codeField = getCodeFieldByColumnName(field.getColumnNameList().get(0), form);
if (SmartStringUtil.isNotEmpty(codeField.getDict())) {
finalFieldMap.put("dict", "\n @JsonDeserialize(using = DictValueVoDeserializer.class)");
packageList.add("import com.fasterxml.jackson.databind.annotation.JsonDeserialize;");
packageList.add("import net.lab1024.sa.base.common.json.deserializer.DictValueVoDeserializer;");
}
finalFieldMap.put("javaType", "String");
default: default:
finalFieldMap.put("javaType", "String"); finalFieldMap.put("javaType", "String");
} }
@ -113,13 +119,11 @@ public class QueryFormVariableService extends CodeGenerateBaseVariableService {
finalFieldList.add(finalFieldMap); finalFieldList.add(finalFieldMap);
} }
// lombok // lombok
packageList.add("import lombok.Data;"); packageList.add("import lombok.Data;");
packageList.add("import lombok.EqualsAndHashCode;"); packageList.add("import lombok.EqualsAndHashCode;");
List<String> packageNameList = packageList.stream().filter(Objects::nonNull).collect(Collectors.toList()); List<String> packageNameList = packageList.stream().filter(Objects::nonNull).sorted().collect(Collectors.toList());
Collections.sort(packageNameList);
return ImmutablePair.of(packageNameList, finalFieldList); return ImmutablePair.of(packageNameList, finalFieldList);
} }

View File

@ -57,19 +57,20 @@ public class FormVariableService extends CodeGenerateBaseVariableService {
fieldsVariableList.add(objectMap); fieldsVariableList.add(objectMap);
if (CodeFrontComponentEnum.ENUM_SELECT.getValue().equals(field.getFrontComponent())) { if (CodeFrontComponentEnum.ENUM_SELECT.equalsValue(field.getFrontComponent())) {
frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';"); frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';");
} }
if (CodeFrontComponentEnum.BOOLEAN_SELECT.getValue().equals(field.getFrontComponent())) { if (CodeFrontComponentEnum.BOOLEAN_SELECT.equalsValue(field.getFrontComponent())) {
frontImportSet.add("import BooleanSelect from '/@/components/framework/boolean-select/index.vue';"); frontImportSet.add("import BooleanSelect from '/@/components/framework/boolean-select/index.vue';");
} }
if (CodeFrontComponentEnum.DICT_SELECT.getValue().equals(field.getFrontComponent())) { if (CodeFrontComponentEnum.DICT_SELECT.equalsValue(field.getFrontComponent())) {
frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';"); frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';");
} }
if (CodeFrontComponentEnum.FILE_UPLOAD.getValue().equals(field.getFrontComponent())) { if (CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(field.getFrontComponent())) {
frontImportSet.add("import { FILE_FOLDER_TYPE_ENUM } from '/@/constants/support/file-const';");
frontImportSet.add("import FileUpload from '/@/components/support/file-upload/index.vue';"); frontImportSet.add("import FileUpload from '/@/components/support/file-upload/index.vue';");
} }
} }

View File

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
import net.lab1024.sa.base.module.support.codegenerator.constant.CodeQueryFieldQueryTypeEnum; import net.lab1024.sa.base.module.support.codegenerator.constant.CodeQueryFieldQueryTypeEnum;
import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm; import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeField;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeQueryField; import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeQueryField;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService; import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService;
@ -35,19 +36,23 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
for (CodeQueryField queryField : queryFields) { for (CodeQueryField queryField : queryFields) {
Map<String, Object> objectMap = BeanUtil.beanToMap(queryField); Map<String, Object> objectMap = BeanUtil.beanToMap(queryField);
variableList.add(objectMap);
if("Enum".equals(queryField.getQueryTypeEnum())){ CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
objectMap.put("frontEnumName", codeField.getEnumName());
objectMap.put("dict", codeField.getDict());
if(CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())){
frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';"); frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';");
} }
if("Dict".equals(queryField.getQueryTypeEnum())){ if(CodeQueryFieldQueryTypeEnum.DICT.equalsValue(queryField.getQueryTypeEnum())){
frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';"); frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';");
} }
if(CodeQueryFieldQueryTypeEnum.DATE_RANGE.getValue().equals(queryField.getQueryTypeEnum())){ if(CodeQueryFieldQueryTypeEnum.DATE_RANGE.equalsValue(queryField.getQueryTypeEnum())){
frontImportSet.add("import { defaultTimeRanges } from '/@/lib/default-time-ranges';"); frontImportSet.add("import { defaultTimeRanges } from '/@/lib/default-time-ranges';");
} }
variableList.add(objectMap);
} }
variablesMap.put("queryFields",variableList); variablesMap.put("queryFields",variableList);

View File

@ -142,6 +142,7 @@ public class SmartJobExecutor implements Runnable {
logEntity.setSuccessFlag(true); logEntity.setSuccessFlag(true);
// 执行开始时间 // 执行开始时间
logEntity.setExecuteStartTime(executeTime); logEntity.setExecuteStartTime(executeTime);
logEntity.setExecuteEndTime(executeTime);
logEntity.setExecuteTimeMillis(0L); logEntity.setExecuteTimeMillis(0L);
logEntity.setCreateName(executorName); logEntity.setCreateName(executorName);
logEntity.setIp(SmartIpUtil.getLocalFirstIp()); logEntity.setIp(SmartIpUtil.getLocalFirstIp());

View File

@ -3,6 +3,7 @@ package ${packageName};
#foreach ($importClass in $importPackageList) #foreach ($importClass in $importPackageList)
$importClass $importClass
#end #end
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO; import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult; import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -23,7 +24,7 @@ import javax.validation.Valid;
*/ */
@RestController @RestController
@Tag(name = "") @Tag(name = "${basic.description}")
public class ${name.upperCamel}Controller { public class ${name.upperCamel}Controller {
@Resource @Resource
@ -31,6 +32,7 @@ public class ${name.upperCamel}Controller {
@Operation(summary = "分页查询 @author ${basic.backendAuthor}") @Operation(summary = "分页查询 @author ${basic.backendAuthor}")
@PostMapping("/${name.lowerCamel}/queryPage") @PostMapping("/${name.lowerCamel}/queryPage")
@SaCheckPermission("${name.lowerCamel}:query")
public ResponseDTO<PageResult<${name.upperCamel}VO>> queryPage(@RequestBody @Valid ${name.upperCamel}QueryForm queryForm) { public ResponseDTO<PageResult<${name.upperCamel}VO>> queryPage(@RequestBody @Valid ${name.upperCamel}QueryForm queryForm) {
return ResponseDTO.ok(${name.lowerCamel}Service.queryPage(queryForm)); return ResponseDTO.ok(${name.lowerCamel}Service.queryPage(queryForm));
} }
@ -38,12 +40,14 @@ public class ${name.upperCamel}Controller {
#if($insertAndUpdate.isSupportInsertAndUpdate) #if($insertAndUpdate.isSupportInsertAndUpdate)
@Operation(summary = "添加 @author ${basic.backendAuthor}") @Operation(summary = "添加 @author ${basic.backendAuthor}")
@PostMapping("/${name.lowerCamel}/add") @PostMapping("/${name.lowerCamel}/add")
@SaCheckPermission("${name.lowerCamel}:add")
public ResponseDTO<String> add(@RequestBody @Valid ${name.upperCamel}AddForm addForm) { public ResponseDTO<String> add(@RequestBody @Valid ${name.upperCamel}AddForm addForm) {
return ${name.lowerCamel}Service.add(addForm); return ${name.lowerCamel}Service.add(addForm);
} }
@Operation(summary = "更新 @author ${basic.backendAuthor}") @Operation(summary = "更新 @author ${basic.backendAuthor}")
@PostMapping("/${name.lowerCamel}/update") @PostMapping("/${name.lowerCamel}/update")
@SaCheckPermission("${name.lowerCamel}:update")
public ResponseDTO<String> update(@RequestBody @Valid ${name.upperCamel}UpdateForm updateForm) { public ResponseDTO<String> update(@RequestBody @Valid ${name.upperCamel}UpdateForm updateForm) {
return ${name.lowerCamel}Service.update(updateForm); return ${name.lowerCamel}Service.update(updateForm);
} }
@ -53,6 +57,7 @@ public class ${name.upperCamel}Controller {
#if($deleteInfo.deleteEnum == "Batch" || $deleteInfo.deleteEnum == "SingleAndBatch") #if($deleteInfo.deleteEnum == "Batch" || $deleteInfo.deleteEnum == "SingleAndBatch")
@Operation(summary = "批量删除 @author ${basic.backendAuthor}") @Operation(summary = "批量删除 @author ${basic.backendAuthor}")
@PostMapping("/${name.lowerCamel}/batchDelete") @PostMapping("/${name.lowerCamel}/batchDelete")
@SaCheckPermission("${name.lowerCamel}:delete")
public ResponseDTO<String> batchDelete(@RequestBody ValidateList<${primaryKeyJavaType}> idList) { public ResponseDTO<String> batchDelete(@RequestBody ValidateList<${primaryKeyJavaType}> idList) {
return ${name.lowerCamel}Service.batchDelete(idList); return ${name.lowerCamel}Service.batchDelete(idList);
} }
@ -61,6 +66,7 @@ public class ${name.upperCamel}Controller {
#if($deleteInfo.deleteEnum == "Single" || $deleteInfo.deleteEnum == "SingleAndBatch") #if($deleteInfo.deleteEnum == "Single" || $deleteInfo.deleteEnum == "SingleAndBatch")
@Operation(summary = "单个删除 @author ${basic.backendAuthor}") @Operation(summary = "单个删除 @author ${basic.backendAuthor}")
@GetMapping("/${name.lowerCamel}/delete/{${primaryKeyFieldName}}") @GetMapping("/${name.lowerCamel}/delete/{${primaryKeyFieldName}}")
@SaCheckPermission("${name.lowerCamel}:delete")
public ResponseDTO<String> batchDelete(@PathVariable ${primaryKeyJavaType} ${primaryKeyFieldName}) { public ResponseDTO<String> batchDelete(@PathVariable ${primaryKeyJavaType} ${primaryKeyFieldName}) {
return ${name.lowerCamel}Service.delete(${primaryKeyFieldName}); return ${name.lowerCamel}Service.delete(${primaryKeyFieldName});
} }

View File

@ -23,7 +23,12 @@
${queryField.likeStr} ${queryField.likeStr}
</if> </if>
#end #end
#if(${queryField.queryTypeEnum} == "Equal" || ${queryField.queryTypeEnum} == "Enum" || ${queryField.queryTypeEnum} == "Dict") #if(${queryField.queryTypeEnum} == "Dict")
<if test="queryForm.${queryField.fieldName} != null and queryForm.${queryField.fieldName} != ''">
${queryField.likeStr}
</if>
#end
#if(${queryField.queryTypeEnum} == "Equal" || ${queryField.queryTypeEnum} == "Enum")
<if test="queryForm.${queryField.fieldName} != null"> <if test="queryForm.${queryField.fieldName} != null">
AND ${tableName}.${queryField.columnName} = #{queryForm.${queryField.fieldName}} AND ${tableName}.${queryField.columnName} = #{queryForm.${queryField.fieldName}}
</if> </if>

View File

@ -0,0 +1,22 @@
# 默认是按前端工程文件的 /views/business 文件夹的路径作为前端组件路径,如果你没把生成的 .vue 前端代码放在 /views/business 下,
# 那就根据自己实际情况修改下面 SQL 的 path,component 字段值,避免执行 SQL 后菜单无法访问。
# 如果你一切都是按照默认,那么下面的 SQL 基本不用改
INSERT INTO t_menu ( menu_name, menu_type, parent_id, path, component, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, create_user_id )
VALUES ( '${basic.description}', 2, 0, '/${name.lowerHyphenCamel}/list', '/business/${name.lowerHyphenCamel}/${name.lowerHyphenCamel}-list.vue', false, false, true, false, 1, 1 );
# 按菜单名称查询该菜单的 menu_id 作为按钮权限的 父菜单ID 与 功能点关联菜单ID
SET @parent_id = NULL;
SELECT t_menu.menu_id INTO @parent_id FROM t_menu WHERE t_menu.menu_name = '${basic.description}';
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id )
VALUES ( '查询', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:query', 1, @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id )
VALUES ( '添加', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:add', 1, @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id )
VALUES ( '更新', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:update', 1, @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id )
VALUES ( '删除', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:delete', 1, @parent_id, 1 );

View File

@ -19,124 +19,121 @@
:destroyOnClose="true" :destroyOnClose="true"
> >
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" > <a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" >
#if($insertAndUpdate.countPerLine == 1) #if($insertAndUpdate.countPerLine == 1)
<a-row> #foreach ($field in $formFields)
#foreach ($field in $formFields) #if($field.frontComponent == "Input")
#if($field.frontComponent == "Input") <a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-form-item label="$!{field.label}" name="${field.fieldName}"> <a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
<a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" /> </a-form-item>
</a-form-item> #end
#end #if($field.frontComponent == "InputNumber")
#if($field.frontComponent == "InputNumber") <a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-form-item label="$!{field.label}" name="${field.fieldName}"> <a-input-number style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
<a-input-number style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" /> </a-form-item>
</a-form-item> #end
#end #if($field.frontComponent == "Textarea")
#if($field.frontComponent == "Textarea") <a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-form-item label="$!{field.label}" name="${field.fieldName}"> <a-textarea style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
<a-textarea style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" /> </a-form-item>
</a-form-item> #end
#end #if($field.frontComponent == "BooleanSelect")
#if($field.frontComponent == "BooleanSelect") <a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-form-item label="$!{field.label}" name="${field.fieldName}"> <BooleanSelect v-model:value="form.${field.fieldName}" style="width: 100%" />
<BooleanSelect v-model:value="form.${field.fieldName}" style="width: 100%" /> </a-form-item>
</a-form-item> #end
#end #if($field.frontComponent == "SmartEnumSelect")
#if($field.frontComponent == "SmartEnumSelect") <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enumName="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enumName="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/> </a-form-item>
</a-form-item> #end
#end #if($field.frontComponent == "DictSelect")
#if($field.frontComponent == "DictSelect") <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <DictSelect width="100%" v-model:value="form.${field.fieldName}" keyCode="$!{field.dict}" placeholder="$!{field.label}"/>
<DictSelect width="100%" v-model:value="form.${field.fieldName}" keyCode="$!{field.dict}" placeholder="$!{field.label}"/> </a-form-item>
</a-form-item> #end
#end #if($field.frontComponent == "Date")
#if($field.frontComponent == "Date") <a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-form-item label="$!{field.label}" name="${field.fieldName}"> <a-date-picker valueFormat="YYYY-MM-DD" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}"/>
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}"/> </a-form-item>
</a-form-item> #end
#end #if($field.frontComponent == "DateTime")
#if($field.frontComponent == "DateTime") <a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-form-item label="$!{field.label}" name="${field.fieldName}"> <a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}" />
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}" /> </a-form-item>
</a-form-item> #end
#end #if($field.frontComponent == "FileUpload")
#if($field.frontComponent == "FileUpload") <a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-form-item label="$!{field.label}" name="${field.fieldName}"> <FileUpload
<FileUpload :defaultFileList="form.$!{field.fieldName}"
:defaultFileList="form.$!{field.fieldName}" :folder="FILE_FOLDER_TYPE_ENUM.COMMON.value"
:folder="FILE_FOLDER_TYPE_ENUM.COMMON.value" buttonText="上传 $!{field.label}"
buttonText="上传 $!{field.label}" listType="text"
listType="text" @change="e => form.$!{field.fieldName} = e"
@change="e => form.$!{field.fieldName} = e" />
/> </a-form-item>
</a-form-item> #end
#end #end
#end #end
</a-row> #if($insertAndUpdate.countPerLine > 1)
<a-row>
#set($span=24 / $!insertAndUpdate.countPerLine )
#foreach ($field in $formFields)
<a-col :span="$!{span}">
#if($field.frontComponent == "Input")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end #end
#if($field.frontComponent == "InputNumber")
#if($insertAndUpdate.countPerLine > 1) <a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-row> <a-input-number style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
#set($span=24 / $!insertAndUpdate.countPerLine ) </a-form-item>
#foreach ($field in $formFields)
<a-col :span="$!{span}">
#if($field.frontComponent == "Input")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "InputNumber")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input-number style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "Textarea")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-textarea style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "BooleanSelect")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<BooleanSelect v-model:value="form.${field.fieldName}" style="width: 100%" />
</a-form-item>
#end
#if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enumName="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item>
#end
#if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" keyCode="$!{field.dict}" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "Date")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "DateTime")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "FileUpload")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<FileUpload
:defaultFileList="form.$!{field.fieldName}"
:folder="FILE_FOLDER_TYPE_ENUM.COMMON.value"
buttonText="上传 $!{field.label}"
listType="text"
@change="e => form.$!{field.fieldName} = e"
/>
</a-form-item>
#end
</a-col>
#end
</a-row>
#end #end
#if($field.frontComponent == "Textarea")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-textarea style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "BooleanSelect")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<BooleanSelect v-model:value="form.${field.fieldName}" style="width: 100%" />
</a-form-item>
#end
#if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enumName="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item>
#end
#if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" keyCode="$!{field.dict}" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "Date")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "DateTime")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "FileUpload")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<FileUpload
:defaultFileList="form.$!{field.fieldName}"
:folder="FILE_FOLDER_TYPE_ENUM.COMMON.value"
buttonText="上传 $!{field.label}"
listType="text"
@change="e => form.$!{field.fieldName} = e"
/>
</a-form-item>
#end
</a-col>
#end
</a-row>
#end
</a-form> </a-form>
<template #footer> <template #footer>
@ -171,6 +168,10 @@
if (rowData && !_.isEmpty(rowData)) { if (rowData && !_.isEmpty(rowData)) {
Object.assign(form, rowData); Object.assign(form, rowData);
} }
// 使用字典时把下面这注释修改成自己的字典字段 有多个字典字段就复制多份同理修改 不然打开表单时不显示字典初始值
// if (form.status && form.status.length > 0) {
// form.status = form.status.map((e) => e.valueCode);
// }
visibleFlag.value = true; visibleFlag.value = true;
nextTick(() => { nextTick(() => {
formRef.value.clearValidate(); formRef.value.clearValidate();

View File

@ -72,7 +72,7 @@
</a-button> </a-button>
#end #end
#if($deleteInfo.isSupportDelete && ($deleteInfo.deleteEnum == "Batch"||$deleteInfo.deleteEnum == "SingleAndBatch")) #if($deleteInfo.isSupportDelete && ($deleteInfo.deleteEnum == "Batch"||$deleteInfo.deleteEnum == "SingleAndBatch"))
<a-button @click="confirmBatchDelete" type="danger" size="small" :disabled="selectedRowKeyList.length == 0"> <a-button @click="confirmBatchDelete" type="primary" danger size="small" :disabled="selectedRowKeyList.length == 0">
<template #icon> <template #icon>
<DeleteOutlined /> <DeleteOutlined />
</template> </template>
@ -99,7 +99,21 @@
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
#end #end
> >
<template #bodyCell="{ record, column }"> <template #bodyCell="{ text, record, column }">
<!-- 有图片预览时 注释解开并把下面的'picture'修改成自己的图片字段名即可 -->
<!-- <template v-if="column.dataIndex === 'picture'">
<FilePreview :fileList="text" type="picture" />
</template> -->
<!-- 使用字典时 注释解开并把下面的'dict'修改成自己的字典字段名即可 有多个字典字段就复制多份同理修改 不然不显示字典 -->
<!-- 方便修改tag的颜色 orange green purple success processing error default warning -->
<!-- <template v-if="column.dataIndex === 'dict'">
<a-tag color="cyan">
{{ text && text.length > 0 ? text.map((e) => e.valueName).join(',') : '暂无' }}
</a-tag>
</template> -->
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate"> <div class="smart-table-operate">
#if($insertAndUpdate.isSupportInsertAndUpdate) #if($insertAndUpdate.isSupportInsertAndUpdate)
@ -145,6 +159,7 @@
#foreach ($import in $frontImportList) #foreach ($import in $frontImportList)
$!{import} $!{import}
#end #end
//import FilePreview from '/@/components/support/file-preview/index.vue'; // 图片预览组件
// ---------------------------- 表格列 ---------------------------- // ---------------------------- 表格列 ----------------------------

View File

@ -61,7 +61,6 @@
watch( watch(
() => props.modelValue, () => props.modelValue,
(nVal) => { (nVal) => {
console.log(nVal);
editorHtml.value = nVal; editorHtml.value = nVal;
}, },
{ {

View File

@ -27,9 +27,13 @@
</template> </template>
<script setup> <script setup>
import { computed, onMounted, ref, watch } from 'vue'; import { computed, onMounted, ref, watch, defineExpose } from 'vue';
import { dictApi } from '/src/api/support/dict-api'; import { dictApi } from '/src/api/support/dict-api';
defineExpose({
queryDict,
});
const props = defineProps({ const props = defineProps({
value: [Array, String], value: [Array, String],
placeholder: { placeholder: {

View File

@ -64,24 +64,6 @@
dictValueList.value = res.data; dictValueList.value = res.data;
} }
const values = computed(() => {
if (!props.value) {
return [];
}
if (!Array.isArray(props.value)) {
console.error('valueList is not array!!!');
return [];
}
let res = [];
if (props.value && props.value.length > 0) {
props.value.forEach((element) => {
res.push(element.valueCode);
});
return res;
}
return res;
});
onMounted(queryDict); onMounted(queryDict);
// -------------------------- -------------------------- // -------------------------- --------------------------
@ -96,21 +78,16 @@
const emit = defineEmits(['update:value', 'change']); const emit = defineEmits(['update:value', 'change']);
function onChange(value) { function onChange(value) {
let selected = [];
if (!value) { if (!value) {
emit('update:value', selected); emit('update:value', []);
emit('change', selected); emit('change', []);
return selected;
} }
if (Array.isArray(props.value)) { if (Array.isArray(value)) {
let valueList = dictValueList.value.filter((e) => value.includes(e.valueCode)); emit('update:value', value);
valueList = valueList.map((e) => e.valueCode); emit('change', value);
emit('update:value', valueList);
emit('change', valueList);
} else { } else {
let findValue = dictValueList.value.find((e) => e.valueCode === value); emit('update:value', [value]);
emit('update:value', findValue.valueCode); emit('change', [value]);
emit('change', findValue.valueCode);
} }
} }
</script> </script>

View File

@ -20,7 +20,7 @@
<SmartEnumSelect enum-name="GOODS_STATUS_ENUM" v-model:value="form.goodsStatus" /> <SmartEnumSelect enum-name="GOODS_STATUS_ENUM" v-model:value="form.goodsStatus" />
</a-form-item> </a-form-item>
<a-form-item label="产地" name="place"> <a-form-item label="产地" name="place">
<DictSelect key-code="GODOS_PLACE" v-model:value="form.place" /> <DictSelect width="100%" key-code="GODOS_PLACE" v-model:value="form.place" mode="tags" />
</a-form-item> </a-form-item>
<a-form-item label="上架状态" name="shelvesFlag"> <a-form-item label="上架状态" name="shelvesFlag">
<a-radio-group v-model:value="form.shelvesFlag"> <a-radio-group v-model:value="form.shelvesFlag">
@ -80,7 +80,7 @@
// //
goodsStatus: GOODS_STATUS_ENUM.APPOINTMENT.value, goodsStatus: GOODS_STATUS_ENUM.APPOINTMENT.value,
// //
place: undefined, place: [],
// //
price: undefined, price: undefined,
// //
@ -107,9 +107,8 @@
Object.assign(form, rowData); Object.assign(form, rowData);
} }
if (form.place && form.place.length > 0) { if (form.place && form.place.length > 0) {
form.place = form.place[0].valueCode; form.place = form.place.map((e) => e.valueCode);
} }
console.log(form);
visible.value = true; visible.value = true;
nextTick(() => { nextTick(() => {
formRef.value.clearValidate(); formRef.value.clearValidate();
@ -127,14 +126,10 @@
.then(async () => { .then(async () => {
SmartLoading.show(); SmartLoading.show();
try { try {
let params = _.cloneDeep(form);
if (params.place && Array.isArray(params.place) && params.place.length > 0) {
params.place = params.place[0].valueCode;
}
if (form.goodsId) { if (form.goodsId) {
await goodsApi.updateGoods(params); await goodsApi.updateGoods(form);
} else { } else {
await goodsApi.addGoods(params); await goodsApi.addGoods(form);
} }
message.success(`${form.goodsId ? '修改' : '添加'}成功`); message.success(`${form.goodsId ? '修改' : '添加'}成功`);
onClose(); onClose();

View File

@ -109,7 +109,7 @@
> >
<template #bodyCell="{ text, record, column }"> <template #bodyCell="{ text, record, column }">
<template v-if="column.dataIndex === 'place'"> <template v-if="column.dataIndex === 'place'">
<span>{{ text && text.length > 0 ? text[0].valueName : '' }}</span> <span>{{ text && text.length > 0 ? text.map((e) => e.valueName).join(',') : '' }}</span>
</template> </template>
<template v-if="column.dataIndex === 'goodsStatus'"> <template v-if="column.dataIndex === 'goodsStatus'">
<span>{{ $smartEnumPlugin.getDescByValue('GOODS_STATUS_ENUM', text) }}</span> <span>{{ $smartEnumPlugin.getDescByValue('GOODS_STATUS_ENUM', text) }}</span>

View File

@ -86,7 +86,7 @@ FrontComponentMap.set('varchar', 'Input');
FrontComponentMap.set('tinytext', 'Input'); FrontComponentMap.set('tinytext', 'Input');
FrontComponentMap.set('text', 'Textarea'); FrontComponentMap.set('text', 'Textarea');
FrontComponentMap.set('longtext', 'Textarea'); FrontComponentMap.set('longtext', 'Textarea');
FrontComponentMap.set('blob', 'Upload'); FrontComponentMap.set('blob', 'FileUpload');
FrontComponentMap.set('date', 'Date'); FrontComponentMap.set('date', 'Date');
FrontComponentMap.set('datetime', 'DateTime'); FrontComponentMap.set('datetime', 'DateTime');
@ -133,6 +133,7 @@ export const JAVA_FILE_LIST = [
'Dao.java', // 'Dao.java', //
'Mapper.xml', // 'Mapper.xml', //
...JAVA_DOMAIN_FILE_LIST, ...JAVA_DOMAIN_FILE_LIST,
'Menu.sql', //
]; ];
// -------------------------------- 枚举enum -------------------------------- // -------------------------------- 枚举enum --------------------------------

View File

@ -73,7 +73,7 @@
// //
let deleteInfo = config.deleteInfo; let deleteInfo = config.deleteInfo;
formData.isSupportDelete = deleteInfo && deleteInfo.isSupportDelete; formData.isSupportDelete = deleteInfo ? deleteInfo.isSupportDelete : true;
formData.isPhysicallyDeleted = deleteInfo && deleteInfo.isPhysicallyDeleted ? deleteInfo.isPhysicallyDeleted : !deletedFlagColumn; formData.isPhysicallyDeleted = deleteInfo && deleteInfo.isPhysicallyDeleted ? deleteInfo.isPhysicallyDeleted : !deletedFlagColumn;
formData.deleteEnum = deleteInfo && deleteInfo.deleteEnum ? deleteInfo.deleteEnum : CODE_DELETE_ENUM.SINGLE_AND_BATCH.value; formData.deleteEnum = deleteInfo && deleteInfo.deleteEnum ? deleteInfo.deleteEnum : CODE_DELETE_ENUM.SINGLE_AND_BATCH.value;
} }

View File

@ -11,6 +11,10 @@
<a-alert :closable="true" message="请务必将每一个字段的 “ 字段名词 ” 填写完整!!!" type="success" show-icon> <a-alert :closable="true" message="请务必将每一个字段的 “ 字段名词 ” 填写完整!!!" type="success" show-icon>
<template #icon><smile-outlined /></template> <template #icon><smile-outlined /></template>
</a-alert> </a-alert>
<!-- 为了方便再配置时中途新增字典后 可以重新刷新字典下拉 (需要先随便选择一个字典后才能看到最新的字典) -->
<div style="float: right; padding: 10px 0px">
<a-button type="primary" @click="refreshDict">刷新字典</a-button>
</div>
<a-table <a-table
:scroll="{ x: 1300 }" :scroll="{ x: 1300 }"
size="small" size="small"
@ -64,7 +68,7 @@
</template> </template>
<template v-if="column.dataIndex === 'dict'"> <template v-if="column.dataIndex === 'dict'">
<DictKeySelect v-model:value="record.dict" /> <DictKeySelect ref="dictRef" v-model:value="record.dict" />
</template> </template>
<template v-if="column.dataIndex === 'enumName'"> <template v-if="column.dataIndex === 'enumName'">
@ -81,6 +85,11 @@
import { convertUpperCamel, convertLowerCamel } from '/@/utils/str-util'; import { convertUpperCamel, convertLowerCamel } from '/@/utils/str-util';
import _ from 'lodash'; import _ from 'lodash';
const dictRef = ref();
function refreshDict() {
dictRef.value.queryDict();
}
//------------------------ --------------------- //------------------------ ---------------------
const tableInfo = inject('tableInfo'); const tableInfo = inject('tableInfo');

View File

@ -37,9 +37,9 @@
</template> </template>
<script setup> <script setup>
import { computed, nextTick, ref, watch } from 'vue'; import { computed, nextTick, ref } from 'vue';
import { codeGeneratorApi } from '/@/api/support/code-generator-api'; import { codeGeneratorApi } from '/@/api/support/code-generator-api';
import { JAVA_FILE_LIST, LANGUAGE_LIST, JS_FILE_LIST, TS_FILE_LIST, JAVA_DOMAIN_FILE_LIST } from '../../code-generator-util'; import { JAVA_FILE_LIST, LANGUAGE_LIST, JS_FILE_LIST, TS_FILE_LIST } from '../../code-generator-util';
import { smartSentry } from '/@/lib/smart-sentry'; import { smartSentry } from '/@/lib/smart-sentry';
import { lineNumbersBlock } from '/@/lib/highlight-line-number'; import { lineNumbersBlock } from '/@/lib/highlight-line-number';
import hljs from 'highlight.js'; import hljs from 'highlight.js';

View File

@ -6,7 +6,7 @@
</a-form-item> </a-form-item>
<a-form-item label="类型" class="smart-query-form-item"> <a-form-item label="类型" class="smart-query-form-item">
<smart-enum-select v-model:value="queryForm.messageType" placeholder="消息类型" enum-name="MESSAGE_TYPE_ENUM" /> <smart-enum-select style="width: 150px" v-model:value="queryForm.messageType" placeholder="消息类型" enum-name="MESSAGE_TYPE_ENUM" />
</a-form-item> </a-form-item>
<a-form-item label="消息时间" class="smart-query-form-item"> <a-form-item label="消息时间" class="smart-query-form-item">

View File

@ -61,7 +61,7 @@
<a-switch v-model:checked="form.visibleFlag" checked-children="显示" un-checked-children="不显示" /> <a-switch v-model:checked="form.visibleFlag" checked-children="显示" un-checked-children="不显示" />
</a-form-item> </a-form-item>
<a-form-item label="禁用状态" name="frameFlag"> <a-form-item label="禁用状态" name="frameFlag">
<a-switch v-model:checked="form.disabledFlag" checked-children="启用" un-checked-children="禁用" /> <a-switch v-model:checked="form.disabledFlag" :checkedValue="false" :unCheckedValue="true" checked-children="启用" un-checked-children="禁用" />
</a-form-item> </a-form-item>
</template> </template>
<!-- 目录 菜单 end --> <!-- 目录 菜单 end -->
@ -74,7 +74,7 @@
<MenuTreeSelect ref="contextMenuTreeSelect" v-model:value="form.contextMenuId" /> <MenuTreeSelect ref="contextMenuTreeSelect" v-model:value="form.contextMenuId" />
</a-form-item> </a-form-item>
<a-form-item label="功能点状态" name="frameFlag"> <a-form-item label="功能点状态" name="frameFlag">
<a-switch v-model:checked="form.disabledFlag" checked-children="启用" un-checked-children="禁用" /> <a-switch v-model:checked="form.disabledFlag" :checkedValue="false" :unCheckedValue="true" checked-children="启用" un-checked-children="禁用" />
</a-form-item> </a-form-item>
<a-form-item label="权限类型" name="permsType"> <a-form-item label="权限类型" name="permsType">
<a-radio-group v-model:value="form.permsType"> <a-radio-group v-model:value="form.permsType">