18586361686
2025-05-21 79eb9230af58c39f220979a642f3e83dd4ba2a22
feat: 新增插件分类接口
3个文件已修改
13个文件已添加
287 ■■■■■ 已修改文件
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiPluginCategoriesController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiPluginCategoryRelationController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiPluginController.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/AiPluginCategories.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/AiPluginCategoryRelation.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/base/AiPluginCategoriesBase.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/base/AiPluginCategoryRelationBase.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/mapper/AiPluginCategoriesMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/mapper/AiPluginCategoryRelationMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/AiPluginCategoriesService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/AiPluginCategoryRelationService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/AiPluginService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/impl/AiPluginCategoriesServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/impl/AiPluginCategoryRelationServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/impl/AiPluginServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-ui-react/src/pages/ai/plugin/less/plugin.less 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiPluginCategoriesController.java
New file
@@ -0,0 +1,22 @@
package tech.aiflowy.ai.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.aiflowy.ai.entity.AiPluginCategories;
import tech.aiflowy.ai.service.AiPluginCategoriesService;
import tech.aiflowy.common.web.controller.BaseCurdController;
/**
 *  控制层。
 *
 * @author wangGangQiang
 * @since 2025-05-21
 */
@RestController
@RequestMapping("/api/v1/aiPluginCategories")
public class AiPluginCategoriesController extends BaseCurdController<AiPluginCategoriesService, AiPluginCategories> {
    public AiPluginCategoriesController(AiPluginCategoriesService service) {
        super(service);
    }
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiPluginCategoryRelationController.java
New file
@@ -0,0 +1,22 @@
package tech.aiflowy.ai.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.aiflowy.ai.entity.AiPluginCategoryRelation;
import tech.aiflowy.ai.service.AiPluginCategoryRelationService;
import tech.aiflowy.common.web.controller.BaseCurdController;
/**
 *  控制层。
 *
 * @author wangGangQiang
 * @since 2025-05-21
 */
@RestController
@RequestMapping("/api/v1/aiPluginCategoryRelation")
public class AiPluginCategoryRelationController extends BaseCurdController<AiPluginCategoryRelationService, AiPluginCategoryRelation> {
    public AiPluginCategoryRelationController(AiPluginCategoryRelationService service) {
        super(service);
    }
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiPluginController.java
@@ -2,6 +2,7 @@
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import tech.aiflowy.common.domain.Result;
import tech.aiflowy.common.web.controller.BaseCurdController;
@@ -12,6 +13,7 @@
import tech.aiflowy.common.web.jsonbody.JsonBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
 *  控制层。
@@ -60,6 +62,24 @@
        return aiPluginService.getList();
    }
    @GetMapping("/pageByCategory")
    public Result pageByCategory(HttpServletRequest request, String sortKey, String sortType, Long pageNumber, Long pageSize, int category) {
        if (pageNumber == null || pageNumber < 1) {
            pageNumber = 1L;
        }
        if (pageSize == null || pageSize < 1) {
            pageSize = 10L;
        }
        if (category == 0){
            QueryWrapper queryWrapper = buildQueryWrapper(request);
            queryWrapper.orderBy(buildOrderBy(sortKey, sortType, getDefaultOrderBy()));
            return Result.success(queryPage(new Page<>(pageNumber, pageSize), queryWrapper));
        } else {
            aiPluginService.pageByCategory(pageNumber, pageSize, category);
        }
        return Result.fail();
    }
    @Override
    protected Page<AiPlugin> queryPage(Page<AiPlugin> page, QueryWrapper queryWrapper) {
        return service.getMapper().paginateWithRelations(page, queryWrapper);
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/AiPluginCategories.java
New file
@@ -0,0 +1,15 @@
package tech.aiflowy.ai.entity;
import com.mybatisflex.annotation.Table;
import tech.aiflowy.ai.entity.base.AiPluginCategoriesBase;
/**
 *  实体类。
 *
 * @author Administrator
 * @since 2025-05-21
 */
@Table("tb_ai_plugin_categories")
public class AiPluginCategories extends AiPluginCategoriesBase {
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/AiPluginCategoryRelation.java
New file
@@ -0,0 +1,15 @@
package tech.aiflowy.ai.entity;
import com.mybatisflex.annotation.Table;
import tech.aiflowy.ai.entity.base.AiPluginCategoryRelationBase;
/**
 *  实体类。
 *
 * @author Administrator
 * @since 2025-05-21
 */
@Table("tb_ai_plugin_category_relation")
public class AiPluginCategoryRelation extends AiPluginCategoryRelationBase {
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/base/AiPluginCategoriesBase.java
New file
@@ -0,0 +1,44 @@
package tech.aiflowy.ai.entity.base;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import java.io.Serializable;
import java.sql.Timestamp;
public class AiPluginCategoriesBase implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id(keyType = KeyType.Auto, value = "snowFlakeId")
    private Integer id;
    private String name;
    private Timestamp createdAt;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Timestamp getCreatedAt() {
        return createdAt;
    }
    public void setCreatedAt(Timestamp createdAt) {
        this.createdAt = createdAt;
    }
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/base/AiPluginCategoryRelationBase.java
New file
@@ -0,0 +1,33 @@
package tech.aiflowy.ai.entity.base;
import com.mybatisflex.annotation.Id;
import java.io.Serializable;
public class AiPluginCategoryRelationBase implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    private Long pluginId;
    @Id
    private Integer categoryId;
    public Long getPluginId() {
        return pluginId;
    }
    public void setPluginId(Long pluginId) {
        this.pluginId = pluginId;
    }
    public Integer getCategoryId() {
        return categoryId;
    }
    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/mapper/AiPluginCategoriesMapper.java
New file
@@ -0,0 +1,14 @@
package tech.aiflowy.ai.mapper;
import com.mybatisflex.core.BaseMapper;
import tech.aiflowy.ai.entity.AiPluginCategories;
/**
 *  映射层。
 *
 * @author Administrator
 * @since 2025-05-21
 */
public interface AiPluginCategoriesMapper extends BaseMapper<AiPluginCategories> {
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/mapper/AiPluginCategoryRelationMapper.java
New file
@@ -0,0 +1,14 @@
package tech.aiflowy.ai.mapper;
import com.mybatisflex.core.BaseMapper;
import tech.aiflowy.ai.entity.AiPluginCategoryRelation;
/**
 *  映射层。
 *
 * @author Administrator
 * @since 2025-05-21
 */
public interface AiPluginCategoryRelationMapper extends BaseMapper<AiPluginCategoryRelation> {
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/AiPluginCategoriesService.java
New file
@@ -0,0 +1,14 @@
package tech.aiflowy.ai.service;
import com.mybatisflex.core.service.IService;
import tech.aiflowy.ai.entity.AiPluginCategories;
/**
 *  服务层。
 *
 * @author Administrator
 * @since 2025-05-21
 */
public interface AiPluginCategoriesService extends IService<AiPluginCategories> {
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/AiPluginCategoryRelationService.java
New file
@@ -0,0 +1,14 @@
package tech.aiflowy.ai.service;
import com.mybatisflex.core.service.IService;
import tech.aiflowy.ai.entity.AiPluginCategoryRelation;
/**
 *  服务层。
 *
 * @author Administrator
 * @since 2025-05-21
 */
public interface AiPluginCategoryRelationService extends IService<AiPluginCategoryRelation> {
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/AiPluginService.java
@@ -19,4 +19,6 @@
    Result updatePlugin(AiPlugin aiPlugin);
    Result getList();
    void pageByCategory(Long pageNumber, Long pageSize, int category);
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/impl/AiPluginCategoriesServiceImpl.java
New file
@@ -0,0 +1,18 @@
package tech.aiflowy.ai.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import tech.aiflowy.ai.entity.AiPluginCategories;
import tech.aiflowy.ai.mapper.AiPluginCategoriesMapper;
import tech.aiflowy.ai.service.AiPluginCategoriesService;
import org.springframework.stereotype.Service;
/**
 *  服务层实现。
 *
 * @author Administrator
 * @since 2025-05-21
 */
@Service
public class AiPluginCategoriesServiceImpl extends ServiceImpl<AiPluginCategoriesMapper, AiPluginCategories>  implements AiPluginCategoriesService{
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/impl/AiPluginCategoryRelationServiceImpl.java
New file
@@ -0,0 +1,18 @@
package tech.aiflowy.ai.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import tech.aiflowy.ai.entity.AiPluginCategoryRelation;
import tech.aiflowy.ai.mapper.AiPluginCategoryRelationMapper;
import tech.aiflowy.ai.service.AiPluginCategoryRelationService;
import org.springframework.stereotype.Service;
/**
 *  服务层实现。
 *
 * @author Administrator
 * @since 2025-05-21
 */
@Service
public class AiPluginCategoryRelationServiceImpl extends ServiceImpl<AiPluginCategoryRelationMapper, AiPluginCategoryRelation>  implements AiPluginCategoryRelationService{
}
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/service/impl/AiPluginServiceImpl.java
@@ -66,4 +66,10 @@
        List<AiPlugin> aiPlugins = aiPluginMapper.selectListByQueryAs(queryWrapper, AiPlugin.class);
        return Result.success(aiPlugins);
    }
    @Override
    public void pageByCategory(Long pageNumber, Long pageSize, int category) {
    }
}
aiflowy-ui-react/src/pages/ai/plugin/less/plugin.less
New file
@@ -0,0 +1,16 @@
.category-item {
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  color: #333;
}
.category-item:hover {
  background-color: #E8EBF2;
}
.category-item.selected {
  background-color: #F7F7FC;
}