1414
1515import com .baomidou .mybatisplus .extension .service .impl .ServiceImpl ;
1616import com .tinyengine .it .common .base .Result ;
17+ import com .tinyengine .it .common .context .LoginUserContext ;
1718import com .tinyengine .it .common .enums .Enums ;
1819import com .tinyengine .it .common .exception .ExceptionEnum ;
1920import com .tinyengine .it .common .log .SystemServiceLog ;
2829import com .tinyengine .it .model .entity .App ;
2930import com .tinyengine .it .model .entity .I18nEntry ;
3031import com .tinyengine .it .model .entity .Platform ;
32+ import com .tinyengine .it .model .entity .Tenant ;
3133import com .tinyengine .it .service .app .AppService ;
3234import com .tinyengine .it .service .app .I18nEntryService ;
3335import com .tinyengine .it .service .app .impl .v1 .AppV1ServiceImpl ;
@@ -74,14 +76,17 @@ public class AppServiceImpl extends ServiceImpl<AppMapper, App> implements AppSe
7476 @ Autowired
7577 private AppV1ServiceImpl appV1ServiceImpl ;
7678
79+ @ Autowired
80+ private LoginUserContext loginUserContext ;
81+
7782 /**
7883 * 查询表t_app所有数据
7984 *
8085 * @return App
8186 */
8287 @ Override
8388 public List <App > queryAllApp () {
84- return baseMapper .queryAllApp ();
89+ return baseMapper .queryAllApp (loginUserContext . getTenantId () );
8590 }
8691
8792 /**
@@ -105,8 +110,9 @@ public AppDto queryAllAppByPage(Integer currentPage, Integer pageSize, String or
105110 }
106111 int offset = (currentPage - 1 ) * pageSize ;
107112 List <App > apps = this .baseMapper .queryAllAppByPage (pageSize , offset , app .getName (),
108- app .getIndustryId (), app .getSceneId (), app .getFramework (), orderBy , app .getCreatedBy ());
109- Integer total = this .baseMapper .queryAppTotal ();
113+ app .getIndustryId (), app .getSceneId (), app .getFramework (), orderBy , app .getCreatedBy (),
114+ loginUserContext .getTenantId ());
115+ Integer total = this .baseMapper .queryAppTotal (loginUserContext .getTenantId ());
110116 AppDto appDto = new AppDto ();
111117 appDto .setApps (apps );
112118 appDto .setTotal (total );
@@ -122,7 +128,7 @@ public AppDto queryAllAppByPage(Integer currentPage, Integer pageSize, String or
122128 @ Override
123129 @ SystemServiceLog (description = "通过id查询应用实现方法" )
124130 public Result <App > queryAppById (Integer id ) {
125- App app = baseMapper .queryAppById (id );
131+ App app = baseMapper .queryAppById (id , loginUserContext . getTenantId () );
126132 if (app == null ) {
127133 return Result .failed (ExceptionEnum .CM009 );
128134 }
@@ -149,8 +155,8 @@ public List<App> queryAppByCondition(App app) {
149155 @ Override
150156 @ SystemServiceLog (description = "应用删除实现方法" )
151157 public Result <App > deleteAppById (Integer id ) {
152- App app = baseMapper .queryAppById (id );
153- int result = baseMapper .deleteAppById (id );
158+ App app = baseMapper .queryAppById (id , loginUserContext . getTenantId () );
159+ int result = baseMapper .deleteAppById (id , loginUserContext . getTenantId () );
154160 if (result < 1 ) {
155161 return Result .failed (ExceptionEnum .CM009 );
156162 }
@@ -168,7 +174,7 @@ public Result<App> deleteAppById(Integer id) {
168174 public Result <App > updateAppById (App app ) {
169175 // 如果更新extend_config字段,从platform获取数据,继承非route部分
170176 if (app .getExtendConfig () != null && !app .getExtendConfig ().isEmpty ()) {
171- App appResult = baseMapper .queryAppById (app .getId ());
177+ App appResult = baseMapper .queryAppById (app .getId (), loginUserContext . getTenantId () );
172178 Platform platform = platformService .queryPlatformById (appResult .getPlatformId ());
173179 Map <String , Object > appExtendConfig = platform .getAppExtendConfig ();
174180 appExtendConfig .remove ("route" );
@@ -178,7 +184,7 @@ public Result<App> updateAppById(App app) {
178184 if (result < 1 ) {
179185 return Result .failed (ExceptionEnum .CM001 );
180186 }
181- App selectedApp = baseMapper .queryAppById (app .getId ());
187+ App selectedApp = baseMapper .queryAppById (app .getId (), loginUserContext . getTenantId () );
182188 return Result .success (selectedApp );
183189 }
184190
0 commit comments