You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.9 KiB
46 lines
1.9 KiB
// 定义包名,指定该类所在的包路径
|
|
package com.yf.exam.modules.sys.system.service.impl;
|
|
|
|
// 导入系统字典映射器接口,用于与数据库进行交互
|
|
import com.yf.exam.modules.sys.system.mapper.SysDictMapper;
|
|
// 导入系统字典服务接口,定义了系统字典相关的业务方法
|
|
import com.yf.exam.modules.sys.system.service.SysDictService;
|
|
// 导入 Spring 框架的自动装配注解,用于依赖注入
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
// 导入 Spring 框架的服务注解,将该类标记为服务层组件
|
|
import org.springframework.stereotype.Service;
|
|
|
|
/**
|
|
* SysDictServiceImpl 类实现了 SysDictService 接口,
|
|
* 负责处理系统字典相关的业务逻辑,通过调用 SysDictMapper 与数据库进行交互。
|
|
*
|
|
* @author bool
|
|
*/
|
|
// 将该类标记为 Spring 服务组件,使其可以被 Spring 容器管理
|
|
@Service
|
|
public class SysDictServiceImpl implements SysDictService {
|
|
|
|
/**
|
|
* 注入系统字典映射器实例,用于执行数据库操作。
|
|
* 通过 Spring 的自动装配机制,将 SysDictMapper 的实例注入到该类中。
|
|
*/
|
|
@Autowired
|
|
private SysDictMapper sysDictMapper;
|
|
|
|
/**
|
|
* 根据传入的表名、文本、键和值,从数据库中查找对应的字典数据。
|
|
* 该方法调用了 SysDictMapper 的 findDict 方法来执行实际的数据库查询操作。
|
|
*
|
|
* @param table 要查询的数据库表名
|
|
* @param text 用于查询的文本条件
|
|
* @param key 用于查询的键条件
|
|
* @param value 用于查询的值条件
|
|
* @return 返回从数据库中查询到的字典数据,如果未找到则返回 null
|
|
*/
|
|
@Override
|
|
public String findDict(String table, String text, String key, String value) {
|
|
// 调用 SysDictMapper 的 findDict 方法执行数据库查询
|
|
return sysDictMapper.findDict(table, text, key, value);
|
|
}
|
|
}
|