|
@ -0,0 +1,83 @@
|
|
|
package com.yihu.jw.gateway.methlog;
|
|
|
|
|
|
|
|
|
import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
|
|
|
import com.yihu.jw.gateway.methlog.dao.BaseExceptionDictDao;
|
|
|
import com.yihu.jw.gateway.methlog.dao.BaseExceptionLogDao;
|
|
|
import com.yihu.jw.gateway.methlog.dao.BaseExceptionServerDictDao;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Component
|
|
|
public class BaseExceptionService {
|
|
|
@Autowired
|
|
|
private BaseExceptionDictDao baseExceptionDictDao;
|
|
|
@Autowired
|
|
|
private BaseExceptionLogDao baseExceptionLogDao;
|
|
|
@Autowired
|
|
|
private BaseExceptionServerDictDao baseExceptionServerDictDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
public String findServiceByPath(String path){
|
|
|
BaseExceptionServerDictDO baseExceptionServerDictDO = baseExceptionServerDictDao.findServiceByPath(path);
|
|
|
String id ="";
|
|
|
if (baseExceptionServerDictDO !=null){
|
|
|
id = baseExceptionServerDictDO.getId();
|
|
|
}
|
|
|
return id;
|
|
|
}
|
|
|
public List<Map<String,Object>> findExceptionDict(String id,String code,String exceptionType,String isDel){
|
|
|
String sql = "select t.id as \"id\"," +
|
|
|
" t.code as \"code\"," +
|
|
|
" t.exception_message as \"exceptionMessage\"," +
|
|
|
" t.create_time as \"createTime\"," +
|
|
|
" t.is_del \"isDel\"," +
|
|
|
" t.model_name as \"modelName\"," +
|
|
|
" t.exception_type as \"exceptionType\"," +
|
|
|
" t.exception_type_name as \"exceptionTypeName\"," +
|
|
|
" t.remind_content as \"remindContent\"" +
|
|
|
" from base_exception_dict t where 1=1";
|
|
|
if (!StringUtils.isEmpty(id)){
|
|
|
sql+=" and t.id ='"+id+"'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(code)){
|
|
|
sql+=" and t.code ='"+code+"'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(exceptionType)){
|
|
|
sql+=" and t.exception_type ='"+exceptionType+"'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(isDel)){
|
|
|
sql+=" and t.is_del ='"+isDel+"'";
|
|
|
}
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
public List<Map<String,Object>> findExceptionService(String id,String name,String isDel,String pathUrl){
|
|
|
String sql = "select t.id as \"id\"," +
|
|
|
" t.name as \"name\"," +
|
|
|
" t.create_time as \"createTime\"," +
|
|
|
" t.update_time as \"updateTime\"," +
|
|
|
" t.is_del as \"isDel\"," +
|
|
|
" t.path_url as \"pathUrl\"" +
|
|
|
" from base_exception_server_dict t where 1=1 ";
|
|
|
if (!StringUtils.isEmpty(id)){
|
|
|
sql+=" and t.id ='"+id+"'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(name)){
|
|
|
sql+=" and t.name ='"+name+"'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(isDel)){
|
|
|
sql+=" and t.is_del ='"+isDel+"'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(pathUrl)){
|
|
|
sql+=" and t.path_url ='"+pathUrl+"'";
|
|
|
}
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
}
|