我的收藏根据用户查询所有收藏

main
liushujing 5 months ago
parent e81059ac90
commit e30fac271f

@ -27,7 +27,7 @@ import java.util.Map;
* @since 1.0.0 2024-12-13
*/
@RestController
@RequestMapping("robot/appaiassistant")
@RequestMapping(Constant.BASE_PATH+"appaiassistant")
@Api(tags="AI助手表")
public class AppAiAssistantController {
@ -51,7 +51,7 @@ public class AppAiAssistantController {
}
@GetMapping("getAllAiAssistant")
@ApiOperation("获取所有收藏")
public Result<List<Map<String, Object>>> getAllAiAssistant(@PathVariable("userid") String userid){
public Result<List<Map<String, Object>>> getAllAiAssistant(@RequestParam("userid") String userid){
List<Map<String, Object>> allTools = appAiAssistantService.getAllAiTools(userid);
return new Result<List<Map<String, Object>>>().ok(allTools);
}
@ -70,7 +70,7 @@ public class AppAiAssistantController {
appAiAssistantService.save(dto);
return new Result();
return new Result<AppAiAssistantDTO>().ok(dto);
}
@PutMapping

@ -27,7 +27,7 @@ import java.util.Map;
* @since 1.0.0 2024-12-12
*/
@RestController
@RequestMapping("robot/apptoolstype")
@RequestMapping(Constant.BASE_PATH+"apptoolstype")
@Api(tags="AI应用工具集分类表")
public class AppToolsTypeController {

@ -37,7 +37,7 @@ public class AppAiAssistantServiceImpl extends CrudServiceImpl<AppAiAssistantDao
QueryWrapper<AppAiAssistantEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(userid), "userid", userid);
wrapper.orderByDesc("createAt","createdAt");
wrapper.orderByDesc("create_at","created_at");
return wrapper;
}
@Override
@ -47,7 +47,7 @@ public class AppAiAssistantServiceImpl extends CrudServiceImpl<AppAiAssistantDao
List<AppAiAssistantEntity> entityList = baseDao.selectList(getWrapperAll(params));
params.clear();
List<Map<String, Object>> retList = new ArrayList<>();
if(retList!=null && retList.size()>0) {
if(entityList!=null && entityList.size()>0) {
for (AppAiAssistantEntity entity : entityList) {
Map<String, Object> mapx = MapUtils.objectToMap(entity);
retList.add(mapx);

@ -0,0 +1,66 @@
/**
* Copyright (c) 2018 All rights reserved.
* <p>
* https://www.renren.io
* <p>
*
*/
package test.com.pjilisense.flxai.controller;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import test.com.pjilisense.flxai.TestUtils;
import java.util.HashMap;
import java.util.Map;
public class AppAiAssistantControllerTest {
@BeforeEach
public void setUpTestDataWithinTransaction() {
// set up test data within the transaction
}
@AfterEach
public void tearDownWithinTransaction() {
// execute "tear down" logic within the transaction
}
@Test
public void testAppAiAssistantSave() {
String url = TestUtils.WebconnectURL+"/api/robot/appaiassistant";
String charset = TestUtils.UTF8;
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("author","sharkbear212a");
params.put("homepage","https://github.com/sharkbear212a");
params.put("identifier","japan-language-helpera");
params.put("avatar","avatara");
params.put("description","擅长日语五十音平假名片假名单词和短语解释与记忆技巧a");
params.put("tags","解释,记忆技巧,日语教学a");
params.put("title","日语帮助记忆师a");
params.put("category","education");
params.put("schemaVersion","1");
params.put("createAt","2024-12-04");
params.put("createdAt","2024-12-04");
params.put("userid","flx");
String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
System.out.println(body);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testGetAllAiAssistant() {
String url = TestUtils.WebconnectURL+"/api/robot/appaiassistant/getAllAiAssistant?userid=flx";
String charset = TestUtils.UTF8;
try {
String body = TestUtils.doGet(url, charset);
System.out.println(body);
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -27,7 +27,6 @@ public class AppToolsSetControllerTest {
// execute "tear down" logic within the transaction
}
String token="c047b2a8a72d495abc350489b691c683";
@Test
public void testGetAllAiTools() {
String url = TestUtils.WebconnectURL+"/api/robot/apptoolsset/getAllAiTools";

Loading…
Cancel
Save