获取sys_logs表的日志容量 需要传入数据库名
This commit is contained in:
parent
70036e012c
commit
d68ceae87c
|
|
@ -90,7 +90,7 @@ public interface SysLogMapper {
|
||||||
* 查询日志容量
|
* 查询日志容量
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String getLogsRl();
|
String getLogsRl(String schemaName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询全部日志细腻系
|
* 查询全部日志细腻系
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import com.bonus.system.api.model.LoginUser;
|
||||||
import com.bonus.system.mapper.SysLogMapper;
|
import com.bonus.system.mapper.SysLogMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -41,6 +42,9 @@ import java.util.Map;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SysLogServiceImpl implements ISysLogService {
|
public class SysLogServiceImpl implements ISysLogService {
|
||||||
|
|
||||||
|
@Value("${sql.schemaName}")
|
||||||
|
private String schemaName;
|
||||||
|
|
||||||
@Resource(name = "SysLogMapper")
|
@Resource(name = "SysLogMapper")
|
||||||
private SysLogMapper mapper;
|
private SysLogMapper mapper;
|
||||||
|
|
||||||
|
|
@ -283,7 +287,7 @@ public class SysLogServiceImpl implements ISysLogService {
|
||||||
public void logWarn() {
|
public void logWarn() {
|
||||||
try {
|
try {
|
||||||
double bfb=0.9;
|
double bfb=0.9;
|
||||||
String rl=mapper.getLogsRl();
|
String rl=mapper.getLogsRl(schemaName);
|
||||||
String city=mapper.getLogsSet();
|
String city=mapper.getLogsSet();
|
||||||
Double d=Double.parseDouble(rl);
|
Double d=Double.parseDouble(rl);
|
||||||
Double max=Double.parseDouble(city)*bfb;
|
Double max=Double.parseDouble(city)*bfb;
|
||||||
|
|
|
||||||
|
|
@ -223,11 +223,11 @@
|
||||||
where log_type=2
|
where log_type=2
|
||||||
and DATE_FORMAT(oper_time,'%Y-%m-%d')=CURRENT_DATE
|
and DATE_FORMAT(oper_time,'%Y-%m-%d')=CURRENT_DATE
|
||||||
</select>
|
</select>
|
||||||
<select id="getLogsRl" resultType="java.lang.String">
|
<select id="getLogsRl" parameterType="java.lang.String" resultType="java.lang.String" >
|
||||||
SELECT
|
SELECT
|
||||||
round(((data_length + index_length) / 1024 / 1024 / 1024), 2) AS 'Size in GB'
|
round(((data_length + index_length) / 1024 / 1024 / 1024), 2) AS 'Size in GB'
|
||||||
FROM information_schema.TABLES
|
FROM information_schema.TABLES
|
||||||
WHERE table_schema = 'bns-cloud' AND table_name = 'sys_logs'
|
WHERE table_schema = #{schemaName} AND table_name = 'sys_logs'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAllLogs" resultType="com.bonus.system.api.domain.SysLogsVo">
|
<select id="getAllLogs" resultType="com.bonus.system.api.domain.SysLogsVo">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue