refactor(dify): 优化 AppEntityService 接口和实现类中的方法命名

- 简化了查询逻辑,使用 lambdaQuery链式调用
This commit is contained in:
vertoryao 2025-05-13 21:27:55 +08:00
parent 6cf9e2a3fd
commit 717bd036ba
3 changed files with 6 additions and 7 deletions

View File

@ -125,6 +125,6 @@ public class V1ServerController {
@PreAuthorize("hasAuthority('dify:server:query')") @PreAuthorize("hasAuthority('dify:server:query')")
@DataPermission @DataPermission
public List<AppEntity> getAppsByAppType(Integer appType){ public List<AppEntity> getAppsByAppType(Integer appType){
return appEntityService.getAppsByAppType(appType); return appEntityService.selectByAppType(appType);
} }
} }

View File

@ -13,5 +13,5 @@ public interface AppEntityService extends IService<AppEntity> {
String getApikey(String appId); String getApikey(String appId);
List<AppEntity> getAppsByAppType(Integer appType); List<AppEntity> selectByAppType(Integer appType);
} }

View File

@ -1,6 +1,5 @@
package com.zsc.edu.dify.modules.dify.service.Impl; package com.zsc.edu.dify.modules.dify.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zsc.edu.dify.exception.ConstraintException; import com.zsc.edu.dify.exception.ConstraintException;
@ -97,10 +96,10 @@ public class AppEntityServiceImpl extends ServiceImpl<AppEntityRepository, AppEn
* @return * @return
*/ */
@Override @Override
public List<AppEntity> getAppsByAppType(Integer appType) { public List<AppEntity> selectByAppType(Integer appType) {
LambdaQueryWrapper<AppEntity> queryWrapper = new LambdaQueryWrapper<>(); return this.lambdaQuery()
queryWrapper.eq(AppEntity::getAppType, appType).eq(AppEntity::isEnabled, true); .eq(AppEntity::getAppType, appType)
return this.list(queryWrapper); .list();
} }
} }