Commit 16277202 by hzc

优化

parent e7a21297
...@@ -24,4 +24,6 @@ public interface BaseIndDefMapper extends BaseMapper<BaseIndDef>{ ...@@ -24,4 +24,6 @@ public interface BaseIndDefMapper extends BaseMapper<BaseIndDef>{
public List<BaseIndDef> getByIdIn(@Param("indIds") List<String> indIds); public List<BaseIndDef> getByIdIn(@Param("indIds") List<String> indIds);
public void deleteByIdIn(@Param("indIds") List<String> indIds); public void deleteByIdIn(@Param("indIds") List<String> indIds);
List<BaseIndDef> selectByCatalogIdAndIndName(@Param("catalogId") Integer catalogId, @Param("indName")String indName);
} }
...@@ -30,10 +30,7 @@ public class BaseIndDefService { ...@@ -30,10 +30,7 @@ public class BaseIndDefService {
String catalogIdPath,String user,String isUpdate,String code) String catalogIdPath,String user,String isUpdate,String code)
throws Exception{ throws Exception{
//判断名称是否重复 //判断名称是否重复
BaseIndDef baseIndDefSql = new BaseIndDef(); List<BaseIndDef> select = baseIndDefMapper.selectByCatalogIdAndIndName(catalogId,baseIndDef.getIndName());
baseIndDefSql.setCatalogId(catalogId);
baseIndDefSql.setIndName(baseIndDef.getIndName());
List<BaseIndDef> select = baseIndDefMapper.select(baseIndDef);
if(select!=null&&select.size()>0&&!select.get(0).getIndId().equals(baseIndDef.getIndId())){ if(select!=null&&select.size()>0&&!select.get(0).getIndId().equals(baseIndDef.getIndId())){
throw new Exception("数据项名称已存在,操作失败!!"); throw new Exception("数据项名称已存在,操作失败!!");
} }
......
...@@ -21,12 +21,18 @@ public class LoggingEventServiceImpl implements LoggingEventService { ...@@ -21,12 +21,18 @@ public class LoggingEventServiceImpl implements LoggingEventService {
logQuery.setStartTime(this.getDateTime(logQuery.getStartDateStr())); logQuery.setStartTime(this.getDateTime(logQuery.getStartDateStr()));
logQuery.setEndTime(this.getDateTime(logQuery.getEndDateStr())); logQuery.setEndTime(this.getDateTime(logQuery.getEndDateStr()));
} }
List<LogStatistics> LogStatisticsList = loggingEventMapper.findClassNameAndCount(logQuery); List<LogStatistics> logStatisticsList = loggingEventMapper.findClassNameAndCount(logQuery);
Collections.sort(logStatisticsList, new Comparator<LogStatistics>() {
@Override
public int compare(LogStatistics o1, LogStatistics o2) {
return (int) (o2.getCount()-o1.getCount());
}
});
//如果大于五个取五个 //如果大于五个取五个
if (LogStatisticsList!=null&&LogStatisticsList.size()>5){ if (logStatisticsList!=null&&logStatisticsList.size()>5){
return LogStatisticsList.subList(0,5); return logStatisticsList.subList(0,5);
} }
return LogStatisticsList; return logStatisticsList;
} }
@Override @Override
......
...@@ -64,4 +64,9 @@ ...@@ -64,4 +64,9 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="selectByCatalogIdAndIndName" resultType="com.keymobile.indicators.model.entity.indicators.BaseIndDef" >
select *
from base_ind_def
where catalog_id=#{catalogId} and ind_name=#{indName}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment