Merge branch 'master' into feature/sysconfig
This commit is contained in:
@@ -6,6 +6,7 @@ import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -30,7 +31,6 @@ public class GeneratorProperties {
|
||||
*/
|
||||
private Map<String, TemplateConfig> templateConfigs = MapUtil.newHashMap(true);
|
||||
|
||||
|
||||
/**
|
||||
* 后端应用名
|
||||
*/
|
||||
@@ -42,6 +42,11 @@ public class GeneratorProperties {
|
||||
*/
|
||||
private String frontendAppName;
|
||||
|
||||
/**
|
||||
* 排除数据表
|
||||
*/
|
||||
private List<String> excludeTables;
|
||||
|
||||
/**
|
||||
* 模板配置
|
||||
*/
|
||||
|
||||
@@ -44,6 +44,13 @@ public class SysDictController {
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典列表")
|
||||
@GetMapping("/list")
|
||||
public Result<List<Option>> getDictList() {
|
||||
List<Option> list = dictService.getDictList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典数据项列表")
|
||||
@GetMapping("/{code}/options")
|
||||
public Result<List<Option>> getDictOptions(
|
||||
|
||||
20
src/main/java/com/youlai/system/mapper/GenConfigMapper.java
Normal file
20
src/main/java/com/youlai/system/mapper/GenConfigMapper.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.youlai.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.system.model.entity.GenConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 代码生成基础配置访问层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface GenConfigMapper extends BaseMapper<GenConfig> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.youlai.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.system.model.entity.GenFieldConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 代码生成字段配置访问层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface GenFieldConfigMapper extends BaseMapper<GenFieldConfig> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -96,4 +96,10 @@ public class GenFieldConfig extends BaseEntity {
|
||||
private String tsType;
|
||||
|
||||
|
||||
/**
|
||||
* 字典类型
|
||||
*/
|
||||
private String dictType;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.youlai.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import com.youlai.system.common.base.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -16,11 +13,6 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SysDept extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.youlai.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.youlai.system.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -13,11 +11,6 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class SysDict extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.youlai.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.youlai.system.common.base.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -15,11 +13,6 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SysRole extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.youlai.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.youlai.system.common.base.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -12,11 +10,6 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SysUser extends BaseEntity {
|
||||
/**
|
||||
* 用户 ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
|
||||
@@ -81,5 +81,8 @@ public class GenConfigForm {
|
||||
@Schema(description = "查询类型")
|
||||
private QueryTypeEnum queryType;
|
||||
|
||||
@Schema(description = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.youlai.system.model.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.youlai.system.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据表分页查询对象
|
||||
*
|
||||
@@ -19,4 +22,10 @@ public class TablePageQuery extends BasePageQuery {
|
||||
@Schema(description="关键字(表名)")
|
||||
private String keywords;
|
||||
|
||||
/**
|
||||
* 排除的表名
|
||||
*/
|
||||
@JsonIgnore
|
||||
private List<String> excludeTables;
|
||||
|
||||
}
|
||||
|
||||
@@ -72,4 +72,10 @@ public interface SysDictService extends IService<SysDict> {
|
||||
List<Option> listDictItemsByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Option> getDictList();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.youlai.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.system.mapper.GenConfigMapper;
|
||||
import com.youlai.system.model.entity.GenConfig;
|
||||
import com.youlai.system.service.GenConfigService;
|
||||
|
||||
@@ -60,6 +60,10 @@ public class GeneratorServiceImpl implements GeneratorService {
|
||||
*/
|
||||
public Page<TablePageVO> getTablePage(TablePageQuery queryParams) {
|
||||
Page<TablePageVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
|
||||
// 设置排除的表
|
||||
List<String> excludeTables = generatorProperties.getExcludeTables();
|
||||
queryParams.setExcludeTables(excludeTables);
|
||||
|
||||
return databaseMapper.getTablePage(page, queryParams);
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,18 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
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:
|
||||
# 后端项目名称
|
||||
backendAppName: youlai-boot
|
||||
# 前端项目名称
|
||||
frontendAppName: vue3-element-admin
|
||||
# 默认配置
|
||||
defaultConfig:
|
||||
author: youlaitech
|
||||
backendAppName: youlai-boot
|
||||
frontendAppName: vue3-element-admin
|
||||
# 排除数据表
|
||||
excludeTables:
|
||||
- gen_config
|
||||
- gen_field_config
|
||||
## 模板配置
|
||||
templateConfigs:
|
||||
Controller:
|
||||
|
||||
@@ -20,6 +20,13 @@
|
||||
<if test="queryParams.keywords != null and queryParams.keywords.trim() neq ''">
|
||||
AND TABLE_NAME LIKE CONCAT('%',#{queryParams.keywords},'%')
|
||||
</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
|
||||
CREATE_TIME DESC
|
||||
</select>
|
||||
|
||||
7
src/main/resources/mapper/GenConfigMapper.xml
Normal file
7
src/main/resources/mapper/GenConfigMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.youlai.system.mapper.GenConfigMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -4,14 +4,19 @@
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
#foreach($fieldConfig in $fieldConfigs)
|
||||
#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")
|
||||
<el-input v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" clearable @keyup.enter="handleQuery" />
|
||||
#elseif($fieldConfig.formType == "SELECT")
|
||||
<el-select v-model="queryParams.$fieldConfig.fieldName" :placeholder="$fieldConfig.fieldComment" clearable>
|
||||
<!-- 这里可以根据具体需求生成select options -->
|
||||
<el-option v-for="option in $fieldConfig.options" :key="option.value" :label="option.label" :value="option.value"></el-option>
|
||||
</el-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-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>
|
||||
#end
|
||||
#elseif($fieldConfig.formType == "RADIO")
|
||||
<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>
|
||||
@@ -88,14 +93,19 @@
|
||||
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-width="100px">
|
||||
#foreach($fieldConfig in $fieldConfigs)
|
||||
#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")
|
||||
<el-input v-model="formData.$fieldConfig.fieldName" :placeholder="'请输入$fieldConfig.fieldComment" />
|
||||
#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">
|
||||
<!-- 这里可以根据具体需求生成select options -->
|
||||
<el-option v-for="option in $fieldConfig.options" :key="option.value" :label="option.label" :value="option.value"></el-option>
|
||||
<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>
|
||||
#end
|
||||
#elseif($fieldConfig.formType == "RADIO")
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user