Commit 16277202 by hzc

优化

parent e7a21297
......@@ -24,4 +24,6 @@ public interface BaseIndDefMapper extends BaseMapper<BaseIndDef>{
public List<BaseIndDef> getByIdIn(@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 {
String catalogIdPath,String user,String isUpdate,String code)
throws Exception{
//判断名称是否重复
BaseIndDef baseIndDefSql = new BaseIndDef();
baseIndDefSql.setCatalogId(catalogId);
baseIndDefSql.setIndName(baseIndDef.getIndName());
List<BaseIndDef> select = baseIndDefMapper.select(baseIndDef);
List<BaseIndDef> select = baseIndDefMapper.selectByCatalogIdAndIndName(catalogId,baseIndDef.getIndName());
if(select!=null&&select.size()>0&&!select.get(0).getIndId().equals(baseIndDef.getIndId())){
throw new Exception("数据项名称已存在,操作失败!!");
}
......
......@@ -21,12 +21,18 @@ public class LoggingEventServiceImpl implements LoggingEventService {
logQuery.setStartTime(this.getDateTime(logQuery.getStartDateStr()));
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){
return LogStatisticsList.subList(0,5);
if (logStatisticsList!=null&&logStatisticsList.size()>5){
return logStatisticsList.subList(0,5);
}
return LogStatisticsList;
return logStatisticsList;
}
@Override
......
......@@ -64,4 +64,9 @@
#{id}
</foreach>
</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>
\ 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