优化应用查询接口

This commit is contained in:
daiqy88
2025-12-22 19:52:32 +08:00
parent efbfb7070c
commit 71755132a6
5 changed files with 20 additions and 8 deletions

View File

@@ -10,7 +10,6 @@ import java.util.List;
@Data
public class GetFlowTemplateReq {
public String templateName;
public String templateType;

View File

@@ -37,9 +37,9 @@ public class SimulationAppCenterController {
@GetMapping(value = "/queryAllApplication")
@ResponseBody
SdmResponse queryAllSimulationApplication()
SdmResponse queryAllSimulationApplication(@RequestParam("appName")String appName,@RequestParam("current")int current,@RequestParam("size")int size)
{
return service.querySimulationAllApp();
return service.querySimulationAllApp(appName,current,size);
}
@GetMapping(value = "/queryApplicationByType")

View File

@@ -21,6 +21,9 @@ public interface SimulationAppManageMapper {
@Select("SELECT * FROM simulation_app_repository WHERE ${condition}")
List<AppCenterItemBean> querySimulationAppByCondition(@Param("condition") String condition);
@Select("SELECT COUNT(*) FROM simulation_app_repository WHERE ${condition}")
int querySimulationAppByConditionCount(@Param("condition") String condition);
@Insert("INSERT INTO simulation_app_configure(appId,appName,configName,configType,configValue,comment,creator) VALUES(#{appConfig.appId},#{appConfig.appName},#{appConfig.configName},#{appConfig.configType},#{appConfig.configValue},#{appConfig.comment},#{appConfig.creator})")
int addSimulationAppConfig(@Param("appConfig")AppConfigureBean appConfig);

View File

@@ -40,7 +40,7 @@ public interface ISimulatinoAppCenterService {
* 查询应用中心所有应用
* @return
*/
SdmResponse querySimulationAllApp();
SdmResponse querySimulationAllApp(String appName,int current,int size);
/**
* 根据类型查询应用

View File

@@ -2,8 +2,8 @@ package com.sdm.system.service.impl;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.common.ThreadLocalContext;
import com.sdm.common.entity.bo.DataPageInfo;
import com.sdm.common.service.BaseService;
import com.sdm.common.utils.excel.*;
import com.sdm.system.dao.SimulationAppManageMapper;
import com.sdm.system.model.entity.AppCenterItemBean;
import com.sdm.system.model.entity.AppConfigureBean;
@@ -109,11 +109,21 @@ public class SimulationAppCenterServiceImpl extends BaseService implements ISimu
* @return
*/
@Override
public SdmResponse querySimulationAllApp() {
public SdmResponse querySimulationAllApp(String appName,int current,int size) {
SdmResponse response = SdmResponse.success();
String queryCondition = "true";
List<AppCenterItemBean> appBeans = appManageMapper.querySimulationAppByCondition(queryCondition);
response.setData(appBeans);
if(appName != null && !appName.isEmpty())
{
queryCondition += " AND appName LIKE '%"+appName+"%'" ;
}
int total = appManageMapper.querySimulationAppByConditionCount(queryCondition);
int offset = (current - 1) * size;
String limitQueryCondition = queryCondition+" LIMIT "+offset+", "+size;
List<AppCenterItemBean> appBeans = appManageMapper.querySimulationAppByCondition(limitQueryCondition);
DataPageInfo pageInfo = new DataPageInfo();
pageInfo.total = total;
pageInfo.data = appBeans;
response.setData(pageInfo);
return response;
}