Merge remote-tracking branch 'origin/main' into main
commit
f512e5022e
@ -0,0 +1,16 @@
|
|||||||
|
package com.pjilisense.flxai.dao;
|
||||||
|
|
||||||
|
import com.pjilisense.flxai.base.dao.BaseDao;
|
||||||
|
import com.pjilisense.flxai.entity.AppAiAssistantEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AI助手表
|
||||||
|
*
|
||||||
|
* @author liushujing liushujing@philisense.com
|
||||||
|
* @since 1.0.0 2024-12-13
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AppAiAssistantDao extends BaseDao<AppAiAssistantEntity> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package com.pjilisense.flxai.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AI助手表
|
||||||
|
*
|
||||||
|
* @author liushujing liushujing@philisense.com
|
||||||
|
* @since 1.0.0 2024-12-13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "AI助手表")
|
||||||
|
public class AppAiAssistantDTO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "作者")
|
||||||
|
private String author;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主页地址")
|
||||||
|
private String homepage;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标识")
|
||||||
|
private String identifier;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "avatar")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标签")
|
||||||
|
private String tags;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分类")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "Version")
|
||||||
|
private String schemaVersion;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private String createAt;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "时间")
|
||||||
|
private String createdAt;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户ID")
|
||||||
|
private String userid;
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.pjilisense.flxai.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AI助手表
|
||||||
|
*
|
||||||
|
* @author liushujing liushujing@philisense.com
|
||||||
|
* @since 1.0.0 2024-12-13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("app_ai_assistant")
|
||||||
|
public class AppAiAssistantEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 作者
|
||||||
|
*/
|
||||||
|
private String author;
|
||||||
|
/**
|
||||||
|
* 主页地址
|
||||||
|
*/
|
||||||
|
private String homepage;
|
||||||
|
/**
|
||||||
|
* 标识
|
||||||
|
*/
|
||||||
|
private String identifier;
|
||||||
|
/**
|
||||||
|
* avatar
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
/**
|
||||||
|
* 标签
|
||||||
|
*/
|
||||||
|
private String tags;
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 分类
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
|
/**
|
||||||
|
* Version
|
||||||
|
*/
|
||||||
|
private String schemaVersion;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String createAt;
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private String createdAt;
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private String userid;
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.pjilisense.flxai.service;
|
||||||
|
|
||||||
|
import com.pjilisense.flxai.base.service.CrudService;
|
||||||
|
import com.pjilisense.flxai.dto.AppAiAssistantDTO;
|
||||||
|
import com.pjilisense.flxai.entity.AppAiAssistantEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AI助手表
|
||||||
|
*
|
||||||
|
* @author liushujing liushujing@philisense.com
|
||||||
|
* @since 1.0.0 2024-12-13
|
||||||
|
*/
|
||||||
|
public interface AppAiAssistantService extends CrudService<AppAiAssistantEntity, AppAiAssistantDTO> {
|
||||||
|
|
||||||
|
List<Map<String, Object>> getAllAiTools(String userid);
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.pjilisense.flxai.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.pjilisense.flxai.base.service.impl.CrudServiceImpl;
|
||||||
|
import com.pjilisense.flxai.dao.AppAiAssistantDao;
|
||||||
|
import com.pjilisense.flxai.dto.AppAiAssistantDTO;
|
||||||
|
import com.pjilisense.flxai.entity.AppAiAssistantEntity;
|
||||||
|
import com.pjilisense.flxai.entity.AppToolsSetEntity;
|
||||||
|
import com.pjilisense.flxai.service.AppAiAssistantService;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.pjilisense.flxai.utils.MapUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AI助手表
|
||||||
|
*
|
||||||
|
* @author liushujing liushujing@philisense.com
|
||||||
|
* @since 1.0.0 2024-12-13
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AppAiAssistantServiceImpl extends CrudServiceImpl<AppAiAssistantDao, AppAiAssistantEntity, AppAiAssistantDTO> implements AppAiAssistantService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryWrapper<AppAiAssistantEntity> getWrapper(Map<String, Object> params){
|
||||||
|
String id = (String)params.get("id");
|
||||||
|
|
||||||
|
QueryWrapper<AppAiAssistantEntity> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq(StrUtil.isNotBlank(id), "id", id);
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QueryWrapper<AppAiAssistantEntity> getWrapperAll(Map<String, Object> params){
|
||||||
|
String userid = (String)params.get("userid");
|
||||||
|
|
||||||
|
QueryWrapper<AppAiAssistantEntity> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq(StrUtil.isNotBlank(userid), "userid", userid);
|
||||||
|
wrapper.orderByDesc("create_at","created_at");
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getAllAiTools(String userid) {
|
||||||
|
Map<String, Object> params =new HashMap<>();
|
||||||
|
params.put("userid",userid);
|
||||||
|
List<AppAiAssistantEntity> entityList = baseDao.selectList(getWrapperAll(params));
|
||||||
|
params.clear();
|
||||||
|
List<Map<String, Object>> retList = new ArrayList<>();
|
||||||
|
if(entityList!=null && entityList.size()>0) {
|
||||||
|
for (AppAiAssistantEntity entity : entityList) {
|
||||||
|
Map<String, Object> mapx = MapUtils.objectToMap(entity);
|
||||||
|
retList.add(mapx);
|
||||||
|
HashMap<String, Object> meta = new HashMap<>();
|
||||||
|
mapx.put("meta", meta);
|
||||||
|
meta.put("avatar", mapx.get("avatar"));
|
||||||
|
meta.put("description", mapx.get("description"));
|
||||||
|
meta.put("title", mapx.get("title"));
|
||||||
|
meta.put("category", mapx.get("category"));
|
||||||
|
String tags = (String) mapx.get("tags");
|
||||||
|
if (tags.length() > 0) {
|
||||||
|
meta.put("tags", Arrays.asList(tags.split("\\,")));
|
||||||
|
} else {
|
||||||
|
meta.put("tags", new ArrayList<>());
|
||||||
|
}
|
||||||
|
mapx.remove("avatar");
|
||||||
|
mapx.remove("description");
|
||||||
|
mapx.remove("title");
|
||||||
|
mapx.remove("category");
|
||||||
|
mapx.remove("tags");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retList;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.pjilisense.flxai.dao.AppAiAssistantDao">
|
||||||
|
|
||||||
|
<resultMap type="com.pjilisense.flxai.entity.AppAiAssistantEntity" id="appAiAssistantMap">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="author" column="author"/>
|
||||||
|
<result property="homepage" column="homepage"/>
|
||||||
|
<result property="identifier" column="identifier"/>
|
||||||
|
<result property="avatar" column="avatar"/>
|
||||||
|
<result property="description" column="description"/>
|
||||||
|
<result property="tags" column="tags"/>
|
||||||
|
<result property="title" column="title"/>
|
||||||
|
<result property="category" column="category"/>
|
||||||
|
<result property="schemaVersion" column="schema_version"/>
|
||||||
|
<result property="createAt" column="create_at"/>
|
||||||
|
<result property="createdAt" column="created_at"/>
|
||||||
|
<result property="userid" column="userid"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue