获取sys_logs表的日志容量 需要传入数据库名
This commit is contained in:
parent
70036e012c
commit
d68ceae87c
|
|
@ -90,7 +90,7 @@ public interface SysLogMapper {
|
|||
* 查询日志容量
|
||||
* @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 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;
|
||||
|
|
|
|||
|
|
@ -223,11 +223,11 @@
|
|||
where log_type=2
|
||||
and DATE_FORMAT(oper_time,'%Y-%m-%d')=CURRENT_DATE
|
||||
</select>
|
||||
<select id="getLogsRl" resultType="java.lang.String">
|
||||
<select id="getLogsRl" parameterType="java.lang.String" resultType="java.lang.String" >
|
||||
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'
|
||||
</select>
|
||||
|
||||
<select id="getAllLogs" resultType="com.bonus.system.api.domain.SysLogsVo">
|
||||
|
|
|
|||
Loading…
Reference in New Issue