diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/mapper/SysLogMapper.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/mapper/SysLogMapper.java index 81d4ab7..e71d083 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/mapper/SysLogMapper.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/mapper/SysLogMapper.java @@ -90,7 +90,7 @@ public interface SysLogMapper { * 查询日志容量 * @return */ - String getLogsRl(); + String getLogsRl(String schemaName); /** * 查询全部日志细腻系 diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysLogServiceImpl.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysLogServiceImpl.java index 906ee11..f6002dd 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysLogServiceImpl.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysLogServiceImpl.java @@ -18,6 +18,7 @@ import com.bonus.system.api.model.LoginUser; import com.bonus.system.mapper.SysLogMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationEventPublisher; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -41,6 +42,9 @@ import java.util.Map; @Slf4j public class SysLogServiceImpl implements ISysLogService { + @Value("${sql.schemaName}") + private String schemaName; + @Resource(name = "SysLogMapper") private SysLogMapper mapper; @@ -283,7 +287,7 @@ public class SysLogServiceImpl implements ISysLogService { public void logWarn() { try { double bfb=0.9; - String rl=mapper.getLogsRl(); + String rl=mapper.getLogsRl(schemaName); String city=mapper.getLogsSet(); Double d=Double.parseDouble(rl); Double max=Double.parseDouble(city)*bfb; diff --git a/bonus-modules/bonus-system/src/main/resources/mapper/system/SysLogMapper.xml b/bonus-modules/bonus-system/src/main/resources/mapper/system/SysLogMapper.xml index 1617650..ad4528b 100644 --- a/bonus-modules/bonus-system/src/main/resources/mapper/system/SysLogMapper.xml +++ b/bonus-modules/bonus-system/src/main/resources/mapper/system/SysLogMapper.xml @@ -223,11 +223,11 @@ where log_type=2 and DATE_FORMAT(oper_time,'%Y-%m-%d')=CURRENT_DATE - SELECT round(((data_length + index_length) / 1024 / 1024 / 1024), 2) AS 'Size in GB' FROM information_schema.TABLES - WHERE table_schema = 'bns-cloud' AND table_name = 'sys_logs' + WHERE table_schema = #{schemaName} AND table_name = 'sys_logs'