Skip to content

Commit 966b079

Browse files
committed
fix: fix bug
1 parent 0a5423b commit 966b079

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

base/src/main/java/com/tinyengine/it/mapper/AppMapper.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ public interface AppMapper extends BaseMapper<App> {
4848
List<App> queryAllAppByPage(Integer pageSize, Integer offset, String name, Integer industryId,
4949
Integer sceneId, String framework, String orderBy, String createdBy, String tenantId);
5050

51+
/**
52+
* 根据条件查询表t_app数据总数
53+
* @param name
54+
* @param industryId
55+
* @param sceneId
56+
* @param framework
57+
* @param createdBy
58+
* @param tenantId
59+
* @return
60+
*/
61+
Long queryAppCount(String name, Integer industryId, Integer sceneId, String framework, String createdBy, String tenantId);
62+
5163
/**
5264
* 查询表t_app 应用总数
5365
*

base/src/main/java/com/tinyengine/it/service/app/impl/AppServiceImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
package com.tinyengine.it.service.app.impl;
1414

15+
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
1516
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
1617
import com.tinyengine.it.common.base.Result;
1718
import com.tinyengine.it.common.context.LoginUserContext;
@@ -112,10 +113,14 @@ public AppDto queryAllAppByPage(Integer currentPage, Integer pageSize, String or
112113
List<App> apps = this.baseMapper.queryAllAppByPage(pageSize, offset, app.getName(),
113114
app.getIndustryId(), app.getSceneId(), app.getFramework(), orderBy, app.getCreatedBy(),
114115
tenantId);
115-
Integer total = this.baseMapper.queryAppTotal(tenantId);
116+
// Query total count directly
117+
Long totalCount = this.baseMapper.queryAppCount(app.getName(), app.getIndustryId(),
118+
app.getSceneId(), app.getFramework(), app.getCreatedBy(), tenantId);
119+
120+
// Integer total = this.baseMapper.queryAppTotal(tenantId);
116121
AppDto appDto = new AppDto();
117122
appDto.setApps(apps);
118-
appDto.setTotal(total);
123+
appDto.setTotal(Math.toIntExact(totalCount));
119124
return appDto;
120125
}
121126

base/src/main/java/com/tinyengine/it/service/app/impl/PageServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public boolean setAppHomePage(int appId, int pageId) {
438438
App app = new App();
439439
app.setId(appId);
440440
app.setHomePage(pageId);
441-
441+
app.setTenantId(loginUserContext.getTenantId());
442442
int result = appMapper.updateAppById(app);
443443
return result >= 1;
444444
}

base/src/main/resources/mappers/AppMapper.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,29 @@
469469
LIMIT #{pageSize} OFFSET #{offset}
470470
</select>
471471

472+
<select id="queryAppCount" resultType="long">
473+
SELECT COUNT(*)
474+
<include refid="Common_Join"/>
475+
WHERE A.is_template IS NOT TRUE
476+
<if test="name != null and name != ''">
477+
AND A.name LIKE CONCAT('%', #{name}, '%')
478+
</if>
479+
<if test="industryId != null">
480+
AND A.industry_id = #{industryId}
481+
</if>
482+
<if test="sceneId != null">
483+
AND A.scene_id = #{sceneId}
484+
</if>
485+
<if test="framework != null">
486+
AND A.framework = #{framework}
487+
</if>
488+
<if test="createdBy != null">
489+
AND A.created_by = #{createdBy}
490+
</if>
491+
<if test="tenantId != null">
492+
AND A.tenant_id = #{tenantId}
493+
</if>
494+
</select>
472495
<!-- 查询应用模版所有数据 -->
473496
<select id="queryAllAppTemplate" resultMap="AppMap">
474497
SELECT

0 commit comments

Comments
 (0)