Merge branch 'develop' of https://gitee.com/youlaiorg/youlai-boot into develop
This commit is contained in:
@@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +31,6 @@ public class GeneratorProperties {
|
|||||||
*/
|
*/
|
||||||
private Map<String, TemplateConfig> templateConfigs = MapUtil.newHashMap(true);
|
private Map<String, TemplateConfig> templateConfigs = MapUtil.newHashMap(true);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 后端应用名
|
* 后端应用名
|
||||||
*/
|
*/
|
||||||
@@ -42,6 +42,11 @@ public class GeneratorProperties {
|
|||||||
*/
|
*/
|
||||||
private String frontendAppName;
|
private String frontendAppName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排除数据表
|
||||||
|
*/
|
||||||
|
private List<String> excludeTables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板配置
|
* 模板配置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -44,6 +44,13 @@ public class SysDictController {
|
|||||||
return PageResult.success(result);
|
return PageResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "字典列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<Option>> getDictList() {
|
||||||
|
List<Option> list = dictService.getDictList();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "字典数据项列表")
|
@Operation(summary = "字典数据项列表")
|
||||||
@GetMapping("/{code}/options")
|
@GetMapping("/{code}/options")
|
||||||
public Result<List<Option>> getDictOptions(
|
public Result<List<Option>> getDictOptions(
|
||||||
|
|||||||
@@ -96,4 +96,10 @@ public class GenFieldConfig extends BaseEntity {
|
|||||||
private String tsType;
|
private String tsType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典类型
|
||||||
|
*/
|
||||||
|
private String dictType;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -81,5 +81,8 @@ public class GenConfigForm {
|
|||||||
@Schema(description = "查询类型")
|
@Schema(description = "查询类型")
|
||||||
private QueryTypeEnum queryType;
|
private QueryTypeEnum queryType;
|
||||||
|
|
||||||
|
@Schema(description = "字典类型")
|
||||||
|
private String dictType;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.youlai.system.model.query;
|
package com.youlai.system.model.query;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.youlai.system.common.base.BasePageQuery;
|
import com.youlai.system.common.base.BasePageQuery;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据表分页查询对象
|
* 数据表分页查询对象
|
||||||
*
|
*
|
||||||
@@ -19,4 +22,10 @@ public class TablePageQuery extends BasePageQuery {
|
|||||||
@Schema(description="关键字(表名)")
|
@Schema(description="关键字(表名)")
|
||||||
private String keywords;
|
private String keywords;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排除的表名
|
||||||
|
*/
|
||||||
|
@JsonIgnore
|
||||||
|
private List<String> excludeTables;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,4 +72,10 @@ public interface SysDictService extends IService<SysDict> {
|
|||||||
List<Option> listDictItemsByCode(String code);
|
List<Option> listDictItemsByCode(String code);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Option> getDictList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||||||
*/
|
*/
|
||||||
public Page<TablePageVO> getTablePage(TablePageQuery queryParams) {
|
public Page<TablePageVO> getTablePage(TablePageQuery queryParams) {
|
||||||
Page<TablePageVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
|
Page<TablePageVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
|
||||||
|
// 设置排除的表
|
||||||
|
List<String> excludeTables = generatorProperties.getExcludeTables();
|
||||||
|
queryParams.setExcludeTables(excludeTables);
|
||||||
|
|
||||||
return databaseMapper.getTablePage(page, queryParams);
|
return databaseMapper.getTablePage(page, queryParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,18 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||||||
return dictItemConverter.convertToOption(dictItems);
|
return dictItemConverter.convertToOption(dictItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Option> getDictList() {
|
||||||
|
return this.list(new LambdaQueryWrapper<SysDict>()
|
||||||
|
.eq(SysDict::getStatus, 1)
|
||||||
|
.select(SysDict::getName, SysDict::getCode)
|
||||||
|
).stream()
|
||||||
|
.map(dict -> new Option(dict.getCode(), dict.getName()))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
# 代码生成器配置
|
# 代码生成器配置
|
||||||
generator:
|
generator:
|
||||||
|
# 后端项目名称
|
||||||
|
backendAppName: youlai-boot
|
||||||
|
# 前端项目名称
|
||||||
|
frontendAppName: vue3-element-admin
|
||||||
|
# 默认配置
|
||||||
defaultConfig:
|
defaultConfig:
|
||||||
author: youlaitech
|
author: youlaitech
|
||||||
backendAppName: youlai-boot
|
# 排除数据表
|
||||||
frontendAppName: vue3-element-admin
|
excludeTables:
|
||||||
|
- gen_config
|
||||||
|
- gen_field_config
|
||||||
## 模板配置
|
## 模板配置
|
||||||
templateConfigs:
|
templateConfigs:
|
||||||
Controller:
|
Controller:
|
||||||
|
|||||||
@@ -20,6 +20,13 @@
|
|||||||
<if test="queryParams.keywords != null and queryParams.keywords.trim() neq ''">
|
<if test="queryParams.keywords != null and queryParams.keywords.trim() neq ''">
|
||||||
AND TABLE_NAME LIKE CONCAT('%',#{queryParams.keywords},'%')
|
AND TABLE_NAME LIKE CONCAT('%',#{queryParams.keywords},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 排除的表 -->
|
||||||
|
<if test="queryParams.excludeTables != null and queryParams.excludeTables.size() > 0">
|
||||||
|
AND TABLE_NAME NOT IN
|
||||||
|
<foreach collection="queryParams.excludeTables" item="excludeTable" open="(" close=")" separator=",">
|
||||||
|
#{excludeTable}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
CREATE_TIME DESC
|
CREATE_TIME DESC
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -4,14 +4,19 @@
|
|||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
#foreach($fieldConfig in $fieldConfigs)
|
#foreach($fieldConfig in $fieldConfigs)
|
||||||
#if($fieldConfig.isShowInQuery == 1)
|
#if($fieldConfig.isShowInQuery == 1)
|
||||||
<el-form-item :label="$fieldConfig.fieldComment" :key="$fieldConfig.fieldName">
|
<el-form-item label="$fieldConfig.fieldComment" prop="$fieldConfig.fieldName">
|
||||||
#if($fieldConfig.formType == "INPUT")
|
#if($fieldConfig.formType == "INPUT")
|
||||||
<el-input v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" clearable @keyup.enter="handleQuery" />
|
||||||
#elseif($fieldConfig.formType == "SELECT")
|
#elseif($fieldConfig.formType == "SELECT")
|
||||||
<el-select v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" clearable>
|
#if($fieldConfig.dictType != "")
|
||||||
<!-- 这里可以根据具体需求生成select options -->
|
<dictionary v-model="formData.$fieldConfig.fieldName" code="$fieldConfig.dictType" />
|
||||||
<el-option v-for="option in $fieldConfig.options" :key="option.value" :label="option.label" :value="option.value"></el-option>
|
#else
|
||||||
|
<el-select v-model="formData.$fieldConfig.fieldName" :placeholder="'请选择$fieldConfig.fieldComment">
|
||||||
|
<el-option :key="1" :value="1" label="下拉项1"/>
|
||||||
|
<el-option :key="2" :value="2" label="下拉项2"/>
|
||||||
|
<el-option :key="3" :value="3" label="下拉项3"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
#end
|
||||||
#elseif($fieldConfig.formType == "RADIO")
|
#elseif($fieldConfig.formType == "RADIO")
|
||||||
<el-radio-group v-model="queryParams.$fieldConfig.fieldName">
|
<el-radio-group v-model="queryParams.$fieldConfig.fieldName">
|
||||||
<el-radio v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
<el-radio v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
||||||
@@ -88,14 +93,19 @@
|
|||||||
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-width="100px">
|
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-width="100px">
|
||||||
#foreach($fieldConfig in $fieldConfigs)
|
#foreach($fieldConfig in $fieldConfigs)
|
||||||
#if($fieldConfig.isShowInForm == 1)
|
#if($fieldConfig.isShowInForm == 1)
|
||||||
<el-form-item :label="$fieldConfig.fieldComment" :key="$fieldConfig.fieldName">
|
<el-form-item abel="$fieldConfig.fieldComment" prop="$fieldConfig.fieldName">
|
||||||
#if($fieldConfig.formType == "INPUT")
|
#if($fieldConfig.formType == "INPUT")
|
||||||
<el-input v-model="formData.$fieldConfig.fieldName" :placeholder="'请输入$fieldConfig.fieldComment" />
|
<el-input v-model="formData.$fieldConfig.fieldName" :placeholder="'请输入$fieldConfig.fieldComment" />
|
||||||
#elseif($fieldConfig.formType == "SELECT")
|
#elseif($fieldConfig.formType == "SELECT")
|
||||||
|
#if($fieldConfig.dictType != "")
|
||||||
|
<dictionary v-model="formData.$fieldConfig.fieldName" code="$fieldConfig.dictType" />
|
||||||
|
#else
|
||||||
<el-select v-model="formData.$fieldConfig.fieldName" :placeholder="'请选择$fieldConfig.fieldComment">
|
<el-select v-model="formData.$fieldConfig.fieldName" :placeholder="'请选择$fieldConfig.fieldComment">
|
||||||
<!-- 这里可以根据具体需求生成select options -->
|
<el-option :key="1" :value="1" label="下拉项1"/>
|
||||||
<el-option v-for="option in $fieldConfig.options" :key="option.value" :label="option.label" :value="option.value"></el-option>
|
<el-option :key="2" :value="2" label="下拉项2"/>
|
||||||
|
<el-option :key="3" :value="3" label="下拉项3"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
#end
|
||||||
#elseif($fieldConfig.formType == "RADIO")
|
#elseif($fieldConfig.formType == "RADIO")
|
||||||
<el-radio-group v-model="formData.$fieldConfig.fieldName">
|
<el-radio-group v-model="formData.$fieldConfig.fieldName">
|
||||||
<el-radio v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
<el-radio v-for="option in $fieldConfig.options" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
||||||
|
|||||||
Reference in New Issue
Block a user