添加仿真应用调用统计接口
This commit is contained in:
@@ -84,5 +84,28 @@ public class SimulationAppCenterController {
|
||||
return service.querySimulationAppConfig(appId);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/addApplicationCallRecord")
|
||||
@ResponseBody
|
||||
SdmResponse addSimulationAppCallRecord(@RequestBody AppCenterItemBean appBean)
|
||||
{
|
||||
return service.addSimulationAppCallRecord(appBean);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/queryAllApplicationCallRecord")
|
||||
@ResponseBody
|
||||
SdmResponse queryAllSimulationAppCallRecord()
|
||||
{
|
||||
return service.queryAllSimulationAppCallRecord();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/queryApplicationCallRecord")
|
||||
@ResponseBody
|
||||
SdmResponse querySimulationAppCallRecord(@RequestParam("appName")String appName,@RequestParam("appType")int appType)
|
||||
{
|
||||
return service.querySimulationAppCallRecord(appName,appType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sdm.system.dao;
|
||||
|
||||
import com.sdm.system.model.entity.AppCenterItemBean;
|
||||
import com.sdm.system.model.entity.AppConfigureBean;
|
||||
import com.sdm.system.model.entity.AppItemStatisticInfo;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -42,4 +43,13 @@ public interface SimulationAppManageMapper {
|
||||
@Select("SELECT * FROM simulation_app_configure WHERE ${condition}")
|
||||
List<AppConfigureBean> querySimulationAppConfigByCondition(@Param("condition") String condition);
|
||||
|
||||
@Insert("INSERT INTO simulation_app_call_record(appName,appType,creator) VALUES (#{appName},#{appType},#{creator})")
|
||||
int addSimulationAppCallRecord(@Param("appName")String appName,@Param("appType")int appType,@Param("creator")long creator);
|
||||
|
||||
@Select("SELECT appName,appType,COUNT(*)callTimes FROM simulation_app_call_record GROUP BY appName,appType")
|
||||
List<AppItemStatisticInfo> queryAllSimulationAppCallRecord();
|
||||
|
||||
@Select("SELECT COUNT(*) FROM simulation_app_call_record WHERE appName=#{appName} AND appType=#{appType}")
|
||||
int querySimulationAppCallRecordCount(@Param("appName")String appName,@Param("appType")int appType);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.sdm.system.model.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
public class AppItemStatisticInfo {
|
||||
|
||||
@Schema(description = "应用名称")
|
||||
public String appName;
|
||||
|
||||
@Schema(description = "应用类型")
|
||||
public int appType;
|
||||
|
||||
@Schema(description = "调用次数")
|
||||
public int callTimes;
|
||||
}
|
||||
@@ -87,5 +87,26 @@ public interface ISimulatinoAppCenterService {
|
||||
*/
|
||||
SdmResponse querySimulationAppConfig(String appId);
|
||||
|
||||
/**
|
||||
* 添加应用调用记录
|
||||
* @param appBean
|
||||
* @return
|
||||
*/
|
||||
SdmResponse addSimulationAppCallRecord(AppCenterItemBean appBean);
|
||||
|
||||
/**
|
||||
* 查询系统中所有仿真工具调用记录
|
||||
* @return
|
||||
*/
|
||||
SdmResponse queryAllSimulationAppCallRecord();
|
||||
|
||||
|
||||
/**
|
||||
* 查询系统中具体仿真工具的调用记录
|
||||
* @param appName
|
||||
* @param appType
|
||||
* @return
|
||||
*/
|
||||
SdmResponse querySimulationAppCallRecord(String appName,int appType);
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.sdm.common.service.BaseService;
|
||||
import com.sdm.system.dao.SimulationAppManageMapper;
|
||||
import com.sdm.system.model.entity.AppCenterItemBean;
|
||||
import com.sdm.system.model.entity.AppConfigureBean;
|
||||
import com.sdm.system.model.entity.AppItemStatisticInfo;
|
||||
import com.sdm.system.service.ISimulatinoAppCenterService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -294,4 +295,44 @@ public class SimulationAppCenterServiceImpl extends BaseService implements ISimu
|
||||
response.setData(configureBeans);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse addSimulationAppCallRecord(AppCenterItemBean appBean)
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
if(appManageMapper.addSimulationAppCallRecord(appBean.appName,appBean.appType,appBean.creator) <= 0)
|
||||
{
|
||||
response = SdmResponse.failed("添加app调用记录失败");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询系统中所有仿真工具调用记录
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SdmResponse queryAllSimulationAppCallRecord()
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
List<AppItemStatisticInfo> statisticInfos = appManageMapper.queryAllSimulationAppCallRecord();
|
||||
response.setData(statisticInfos);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询系统中具体仿真工具的调用记录
|
||||
* @param appName
|
||||
* @param appType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SdmResponse querySimulationAppCallRecord(String appName,int appType)
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
int count = appManageMapper.querySimulationAppCallRecordCount(appName,appType);
|
||||
response.setData(count);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user