feat: 🎸 讨论列表接口修改

This commit is contained in:
GoCo 2025-09-20 10:21:12 +08:00
parent 5da9d2135a
commit b8e649c13c
3 changed files with 78 additions and 18 deletions

View File

@ -210,30 +210,19 @@ public class AiolDiscussionController extends JeecgController<AiolDiscussion, IA
return super.importExcel(request, response, AiolDiscussion.class); return super.importExcel(request, response, AiolDiscussion.class);
} }
@AutoLog(value = "讨论-查询用户讨论列表") @AutoLog(value = "讨论-查询课程下的讨论列表")
@Operation(summary = "查询用户讨论列表", description = "查询当前登录用户创建的讨论列表") @Operation(summary = "查询课程讨论列表", description = "查询课程讨论列表")
@GetMapping(value = "/teacher_list") @GetMapping(value = "/teacher_list")
public Result<List<AiolDiscussion>> queryTeacherDiscussions(HttpServletRequest request) { public Result<List<AiolDiscussion>> queryCourseDiscussions(HttpServletRequest request, @RequestParam(value = "courseId") String courseId) {
try { try {
// 1. 获取当前登录用户信息 // 2. 查询课程下的讨论列表
String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN);
String username = JwtUtil.getUsername(token);
LoginUser sysUser = sysBaseApi.getUserByName(username);
if (sysUser == null) {
return Result.error("用户未登录或登录已过期");
}
// 2. 查询当前用户创建的讨论列表
QueryWrapper<AiolDiscussion> queryWrapper = new QueryWrapper<>(); QueryWrapper<AiolDiscussion> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("create_by", sysUser.getUsername()) queryWrapper.eq("course_id", courseId)
.orderByDesc("create_time"); .orderByDesc("create_time");
List<AiolDiscussion> discussionList = aiolDiscussionService.list(queryWrapper); List<AiolDiscussion> discussionList = aiolDiscussionService.list(queryWrapper);
log.info("查询用户讨论列表成功: userId={}, 讨论数量={}", sysUser.getId(), discussionList.size());
return Result.OK(discussionList); return Result.OK(discussionList);
} catch (Exception e) { } catch (Exception e) {
log.error("查询用户讨论列表失败: error={}", e.getMessage(), e); log.error("查询用户讨论列表失败: error={}", e.getMessage(), e);
return Result.error("查询用户讨论列表失败: " + e.getMessage()); return Result.error("查询用户讨论列表失败: " + e.getMessage());

View File

@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
/** /**
* @Description: 讨论 * @Description: 讨论
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2025-09-19 * @Date: 2025-09-20
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
@ -45,6 +45,10 @@ public class AiolDiscussion implements Serializable {
@Excel(name = "讨论描述", width = 15) @Excel(name = "讨论描述", width = 15)
@Schema(description = "讨论描述") @Schema(description = "讨论描述")
private java.lang.String description; private java.lang.String description;
/**课程id*/
@Excel(name = "课程id", width = 15)
@Schema(description = "课程id")
private java.lang.String courseId;
/**创建人*/ /**创建人*/
@Schema(description = "创建人") @Schema(description = "创建人")
private java.lang.String createBy; private java.lang.String createBy;

View File

@ -0,0 +1,67 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//
export const columns: BasicColumn[] = [
{
title: '讨论标题',
align:"center",
dataIndex: 'title'
},
{
title: '讨论描述',
align:"center",
dataIndex: 'description'
},
{
title: '课程id',
align:"center",
dataIndex: 'courseId'
},
];
//
export const searchFormSchema: FormSchema[] = [
];
//
export const formSchema: FormSchema[] = [
{
label: '讨论标题',
field: 'title',
component: 'Input',
},
{
label: '讨论描述',
field: 'description',
component: 'Input',
},
{
label: '课程id',
field: 'courseId',
component: 'Input',
},
// TODO ID
{
label: '',
field: 'id',
component: 'Input',
show: false
},
];
//
export const superQuerySchema = {
title: {title: '讨论标题',order: 0,view: 'text', type: 'string',},
description: {title: '讨论描述',order: 1,view: 'text', type: 'string',},
courseId: {title: '课程id',order: 2,view: 'text', type: 'string',},
};
/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// formSchema
return formSchema;
}