Commit 3e32ec29 by 宋珺琪

添加各个模块的统计计数接口

parent a9ed9df6
package com.founder.servicebase.logs;
import lombok.Data;
@Data
public class LogMoudleCount {
/**
* 计数
*/
private Integer count ;
/**
* 模块名称
*/
private String moudle;
public LogMoudleCount() {
}
public LogMoudleCount(Integer count, String moudle) {
this.count = count;
this.moudle = moudle;
}
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.commonutils.util.DateUtil;
import com.founder.commonutils.util.StringUtil;
import com.founder.servicebase.logs.LogMoudleCount;
import com.founder.servicebase.logs.SkSysLog;
import com.founder.servicebase.logs.param.LogCountParam;
import com.founder.servicebase.logs.param.LogParam;
......@@ -82,4 +83,19 @@ public class SkSysLogController {
return new MapRestResult(service.countTotal(param));
}
/**
* 各个模块接口的统计计数
* @param param
* @return
* @throws ParseException
*/
@PostMapping("countMoudle")
public MapRestResult countMoudle(@RequestBody LogCountParam param) throws ParseException {
List<LogMoudleCount> logMoudleCounts = service.countMoudle(param);
return new MapRestResult(200,"ok",logMoudleCounts.size(),logMoudleCounts);
}
}
......@@ -2,6 +2,7 @@ package com.founder.servicebase.logs.mapper.mysqlMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.servicebase.logs.LogCount;
import com.founder.servicebase.logs.LogMoudleCount;
import com.founder.servicebase.logs.SkSysLog;
import com.founder.servicebase.logs.param.LogCountParam;
import org.apache.ibatis.annotations.Mapper;
......@@ -17,4 +18,6 @@ public interface SkSysLogMapper extends BaseMapper<SkSysLog> {
public List<LogCount> countTotal(LogCountParam param);
LogCount countOne(@Param("date") String date);
List<LogMoudleCount> countMoudle(LogCountParam param);
}
......@@ -26,6 +26,18 @@
and str_to_date(#{date},'%Y-%m-%d') <![CDATA[ = ]]> date_format(createDate,'%Y-%m-%d')
</if>
</select>
<select id="countMoudle" resultType="com.founder.servicebase.logs.LogMoudleCount" parameterType="com.founder.servicebase.logs.param.LogCountParam">
select COUNT(*) as count ,SUBSTRING_INDEX(message,'_',1) as moudle from sk_sys_log
where
SUBSTRING_INDEX(message,'_',1) in ('以人侦查','以案侦查','以车侦查','以图研判','区域管控','态势分析','轨迹分析','主题研判','点位校验')
<if test="startTime!=null and startTime!='' ">
and str_to_date(#{startTime},'%Y-%m-%d') <![CDATA[ <= ]]> date_format(createDate,'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!='' ">
and str_to_date(#{endTime},'%Y-%m-%d') <![CDATA[ >= ]]> date_format(createDate,'%Y-%m-%d')
</if>
and
message is not NULL group by SUBSTRING_INDEX(message,'_',1)
</select>
</mapper>
......@@ -3,6 +3,7 @@ package com.founder.servicebase.logs.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.servicebase.logs.LogCount;
import com.founder.servicebase.logs.LogMoudleCount;
import com.founder.servicebase.logs.SkSysLog;
import com.founder.servicebase.logs.param.LogCountParam;
......@@ -11,4 +12,6 @@ import java.util.List;
public interface SkSysLogService extends IService<SkSysLog> {
List<LogCount> countTotal(LogCountParam param) throws ParseException;
List<LogMoudleCount> countMoudle(LogCountParam param);
}
......@@ -3,6 +3,7 @@ package com.founder.servicebase.logs.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.servicebase.logs.LogCount;
import com.founder.servicebase.logs.LogMoudleCount;
import com.founder.servicebase.logs.SkSysLog;
import com.founder.servicebase.logs.mapper.mysqlMapper.SkSysLogMapper;
import com.founder.servicebase.logs.param.LogCountParam;
......@@ -38,6 +39,10 @@ public class SkSysLogServiceImpl extends ServiceImpl<SkSysLogMapper, SkSysLog> i
return all;
}
@Override
public List<LogMoudleCount> countMoudle(LogCountParam param) {
return baseMapper.countMoudle(param);
}
/**
......
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