Files
mp-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppConfigMapper.xml
T
gxwebsoft 3ea8e652bd feat(app): 添加应用配置管理功能
- 创建应用配置表及实体类
- 实现应用配置的增删改查接口
- 添加配置值加密解密功能
- 支持按应用ID批量获取配置映射
- 实现配置的批量保存和删除功能
- 添加分页查询和列表查询支持
- 集成租户隔离和软删除功能
2026-03-30 19:42:53 +08:00

67 lines
2.4 KiB
XML

<?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.gxwebsoft.app.mapper.AppConfigMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM app_config a
<where>
a.deleted = 0
<if test="param.configId != null">
AND a.config_id = #{param.configId}
</if>
<if test="param.websiteId != null">
AND a.website_id = #{param.websiteId}
</if>
<if test="param.configKey != null and param.configKey != ''">
AND a.config_key LIKE CONCAT('%', #{param.configKey}, '%')
</if>
<if test="param.configType != null and param.configType != ''">
AND a.config_type = #{param.configType}
</if>
<if test="param.isSecret != null">
AND a.is_secret = #{param.isSecret}
</if>
<if test="param.tenantId != null">
AND a.tenant_id = #{param.tenantId}
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null and param.keywords != ''">
AND a.config_key LIKE CONCAT('%', #{param.keywords}, '%')
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.app.entity.AppConfig">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.app.entity.AppConfig">
<include refid="selectSql"></include>
</select>
<!-- 批量获取应用配置(自动解密) -->
<select id="selectConfigsByWebsiteId" resultType="java.util.HashMap">
SELECT
config_key as configKey,
config_value as configValue,
config_type as configType,
is_encrypted as isEncrypted,
is_secret as isSecret,
description
FROM app_config
WHERE website_id = #{websiteId}
AND deleted = 0
ORDER BY config_type, sort_number, config_id
</select>
</mapper>