Compare commits
4 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
f38d059212 | |
|
|
acbb57fd9d | |
|
|
1d250e979a | |
|
|
e7bd6688a4 |
12
pom.xml
12
pom.xml
|
|
@ -71,6 +71,18 @@
|
|||
<artifactId>ruoyi-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Flyway Database Migration -->
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Flyway MySQL Support -->
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-mysql</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -84,6 +84,16 @@ public class SysDictDataController extends BaseController
|
|||
return success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型和值获取字典标签
|
||||
*/
|
||||
@GetMapping(value = "/label/{dictType}/{dictValue}")
|
||||
public AjaxResult dictLabel(@PathVariable String dictType, @PathVariable String dictValue)
|
||||
{
|
||||
String label = dictTypeService.selectDictLabel(dictType, dictValue);
|
||||
return success(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,6 +34,15 @@ public interface ISysDictTypeService
|
|||
*/
|
||||
public List<SysDictData> selectDictDataByType(String dictType);
|
||||
|
||||
/**
|
||||
* 根据字典类型和值获取字典标签
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典值
|
||||
* @return 字典标签
|
||||
*/
|
||||
public String selectDictLabel(String dictType, String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -87,6 +87,31 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型和值获取字典标签
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典值
|
||||
* @return 字典标签
|
||||
*/
|
||||
@Override
|
||||
public String selectDictLabel(String dictType, String dictValue)
|
||||
{
|
||||
// 从缓存查询
|
||||
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);;
|
||||
if (StringUtils.isNotEmpty(dictDatas))
|
||||
{
|
||||
for (SysDictData dictData : dictDatas)
|
||||
{
|
||||
if (dictValue.equals(dictData.getDictValue()))
|
||||
{
|
||||
return dictData.getDictLabel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return dictValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ spring:
|
|||
profiles:
|
||||
# 环境配置
|
||||
active: prod
|
||||
flyway:
|
||||
table: flyway_system_schema_history # 自定义历史表名
|
||||
baseline-on-migrate: true
|
||||
baseline-version: 0
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
-- Initial setup for ruoyi-system module
|
||||
-- This is a placeholder migration file
|
||||
-- Add your initial database schema here
|
||||
|
||||
-- Example:
|
||||
-- CREATE TABLE IF NOT EXISTS example_table (
|
||||
-- id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
-- name VARCHAR(100) NOT NULL,
|
||||
-- created_time DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
-- );
|
||||
Loading…
Reference in New Issue