补充
This commit is contained in:
parent
86bd9f610b
commit
f77fdb98e3
@ -0,0 +1,82 @@
|
||||
package xyz.playedu.api.controller.backend.jc;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.common.types.JsonResponse;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.Discussion;
|
||||
import xyz.playedu.jc.service.IDiscussionService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 讨论管理 后台接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/backend/v1/jc/discussion")
|
||||
public class DiscussionController {
|
||||
|
||||
@Autowired
|
||||
private IDiscussionService discussionService;
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
* GET /backend/v1/jc/discussion/index
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
public JsonResponse index(@RequestParam HashMap<String, Object> params) {
|
||||
PaginationResult<Discussion> result = discussionService.paginate(params);
|
||||
return JsonResponse.data(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 全量列表(慎用,只在数据量不大时使用)
|
||||
* GET /backend/v1/jc/discussion/list
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public JsonResponse list() {
|
||||
List<Discussion> list = discussionService.list();
|
||||
return JsonResponse.data(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* GET /backend/v1/jc/discussion/{id}
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public JsonResponse detail(@PathVariable("id") Integer id) {
|
||||
Discussion one = discussionService.getById(id);
|
||||
return JsonResponse.data(one);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增讨论
|
||||
* POST /backend/v1/jc/discussion
|
||||
*/
|
||||
@PostMapping
|
||||
public JsonResponse create(@RequestBody Discussion discussion) {
|
||||
discussionService.save(discussion);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改讨论
|
||||
* PUT /backend/v1/jc/discussion
|
||||
*/
|
||||
@PutMapping
|
||||
public JsonResponse update(@RequestBody Discussion discussion) {
|
||||
discussionService.updateById(discussion);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除讨论
|
||||
* DELETE /backend/v1/jc/discussion/{id}
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public JsonResponse delete(@PathVariable("id") Integer id) {
|
||||
discussionService.removeById(id);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package xyz.playedu.api.controller.backend.jc;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.common.annotation.Log;
|
||||
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||
import xyz.playedu.common.types.JsonResponse;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.DiscussionDetail;
|
||||
import xyz.playedu.jc.service.IDiscussionDetailService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 讨论明细管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/backend/v1/jc/discussion-detail")
|
||||
public class DiscussionDetailController {
|
||||
|
||||
@Autowired
|
||||
private IDiscussionDetailService discussionDetailService;
|
||||
|
||||
/** 分页列表 */
|
||||
@GetMapping("/index")
|
||||
public JsonResponse index(@RequestParam HashMap<String, Object> params) {
|
||||
PaginationResult<DiscussionDetail> result = discussionDetailService.paginate(params);
|
||||
return JsonResponse.data(result);
|
||||
}
|
||||
|
||||
/** 全量列表 */
|
||||
@GetMapping("/list")
|
||||
public JsonResponse list() {
|
||||
List<DiscussionDetail> list = discussionDetailService.list();
|
||||
return JsonResponse.data(list);
|
||||
}
|
||||
|
||||
/** 详情 */
|
||||
@GetMapping("/{id}")
|
||||
public JsonResponse detail(@PathVariable("id") Integer id) {
|
||||
DiscussionDetail detail = discussionDetailService.getById(id);
|
||||
return JsonResponse.data(detail);
|
||||
}
|
||||
|
||||
/** 新增 */
|
||||
@Log(title = "新增讨论明细", businessType = BusinessTypeConstant.INSERT)
|
||||
@PostMapping
|
||||
public JsonResponse store(@RequestBody DiscussionDetail detail) {
|
||||
discussionDetailService.save(detail);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
/** 修改 */
|
||||
@Log(title = "修改讨论明细", businessType = BusinessTypeConstant.UPDATE)
|
||||
@PutMapping
|
||||
public JsonResponse update(@RequestBody DiscussionDetail detail) {
|
||||
discussionDetailService.updateById(detail);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
@Log(title = "删除讨论明细", businessType = BusinessTypeConstant.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public JsonResponse destroy(@PathVariable("id") Integer id) {
|
||||
discussionDetailService.removeById(id);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package xyz.playedu.api.controller.backend.jc;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.common.annotation.Log;
|
||||
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||
import xyz.playedu.common.types.JsonResponse;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.Knowledge;
|
||||
import xyz.playedu.jc.service.IKnowledgeService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 知识点管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/backend/v1/jc/knowledge")
|
||||
public class KnowledgeController {
|
||||
|
||||
@Autowired
|
||||
private IKnowledgeService knowledgeService;
|
||||
|
||||
/** 分页列表 */
|
||||
@GetMapping("/index")
|
||||
public JsonResponse index(@RequestParam HashMap<String, Object> params) {
|
||||
PaginationResult<Knowledge> result = knowledgeService.paginate(params);
|
||||
return JsonResponse.data(result);
|
||||
}
|
||||
|
||||
/** 全量列表 */
|
||||
@GetMapping("/list")
|
||||
public JsonResponse list() {
|
||||
List<Knowledge> list = knowledgeService.list();
|
||||
return JsonResponse.data(list);
|
||||
}
|
||||
|
||||
/** 详情 */
|
||||
@GetMapping("/{id}")
|
||||
public JsonResponse detail(@PathVariable("id") Integer id) {
|
||||
Knowledge one = knowledgeService.getById(id);
|
||||
return JsonResponse.data(one);
|
||||
}
|
||||
|
||||
/** 新增 */
|
||||
@Log(title = "新增知识点", businessType = BusinessTypeConstant.INSERT)
|
||||
@PostMapping
|
||||
public JsonResponse store(@RequestBody Knowledge knowledge) {
|
||||
knowledgeService.save(knowledge);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
/** 修改 */
|
||||
@Log(title = "修改知识点", businessType = BusinessTypeConstant.UPDATE)
|
||||
@PutMapping
|
||||
public JsonResponse update(@RequestBody Knowledge knowledge) {
|
||||
knowledgeService.updateById(knowledge);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
@Log(title = "删除知识点", businessType = BusinessTypeConstant.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public JsonResponse destroy(@PathVariable("id") Integer id) {
|
||||
knowledgeService.removeById(id);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package xyz.playedu.api.controller.backend.jc;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.common.annotation.Log;
|
||||
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||
import xyz.playedu.common.types.JsonResponse;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.Note;
|
||||
import xyz.playedu.jc.service.INoteService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 笔记管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/backend/v1/jc/note")
|
||||
public class NoteController {
|
||||
|
||||
@Autowired
|
||||
private INoteService noteService;
|
||||
|
||||
/** 笔记分页列表 */
|
||||
@GetMapping("/index")
|
||||
public JsonResponse index(@RequestParam HashMap<String, Object> params) {
|
||||
PaginationResult<Note> result = noteService.paginate(params);
|
||||
return JsonResponse.data(result);
|
||||
}
|
||||
|
||||
/** 全量列表(慎用) */
|
||||
@GetMapping("/list")
|
||||
public JsonResponse list() {
|
||||
List<Note> list = noteService.list();
|
||||
return JsonResponse.data(list);
|
||||
}
|
||||
|
||||
/** 笔记详情 */
|
||||
@GetMapping("/{id}")
|
||||
public JsonResponse detail(@PathVariable("id") Integer id) {
|
||||
Note note = noteService.getById(id);
|
||||
return JsonResponse.data(note);
|
||||
}
|
||||
|
||||
/** 新增笔记 */
|
||||
@Log(title = "新增笔记", businessType = BusinessTypeConstant.INSERT)
|
||||
@PostMapping
|
||||
public JsonResponse store(@RequestBody Note note) {
|
||||
noteService.save(note);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
/** 修改笔记 */
|
||||
@Log(title = "修改笔记", businessType = BusinessTypeConstant.UPDATE)
|
||||
@PutMapping
|
||||
public JsonResponse update(@RequestBody Note note) {
|
||||
noteService.updateById(note);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
|
||||
/** 删除笔记 */
|
||||
@Log(title = "删除笔记", businessType = BusinessTypeConstant.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public JsonResponse destroy(@PathVariable("id") Integer id) {
|
||||
noteService.removeById(id);
|
||||
return JsonResponse.success();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package xyz.playedu.jc.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 讨论表
|
||||
* 对应表:jc_discussion
|
||||
*/
|
||||
@Data
|
||||
@TableName("jc_discussion")
|
||||
public class Discussion {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/** 教材ID */
|
||||
@TableField("book_id")
|
||||
private Integer bookId;
|
||||
|
||||
/** 章节ID */
|
||||
@TableField("chapter_id")
|
||||
private Integer chapterId;
|
||||
|
||||
/** 父级讨论ID(顶级为0或null) */
|
||||
@TableField("parent_id")
|
||||
private Integer parentId;
|
||||
|
||||
/** 发起人用户ID */
|
||||
@TableField("user_id")
|
||||
private Integer userId;
|
||||
|
||||
/** 讨论内容 */
|
||||
@TableField("content")
|
||||
private String content;
|
||||
|
||||
/** 点赞数 */
|
||||
@TableField("like_num")
|
||||
private Integer likeNum;
|
||||
|
||||
/** 回复数 */
|
||||
@TableField("reply_num")
|
||||
private Integer replyNum;
|
||||
|
||||
/** 状态:1-正常 0-删除/屏蔽 */
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/** 创建人(可以是用户名) */
|
||||
@TableField("creator")
|
||||
private String creator;
|
||||
|
||||
/** 更新人 */
|
||||
@TableField("updater")
|
||||
private String updater;
|
||||
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField("tenant_id")
|
||||
private String tenantId;
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package xyz.playedu.jc.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 课程讨论明细
|
||||
* 对应表:jc_discussion_detail
|
||||
*/
|
||||
@Data
|
||||
@TableName("jc_discussion_detail")
|
||||
public class DiscussionDetail {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/** 教材主键 */
|
||||
@TableField("book_id")
|
||||
private Integer bookId;
|
||||
|
||||
/** 章节id */
|
||||
@TableField("chapter_id")
|
||||
private Integer chapterId;
|
||||
|
||||
/** 讨论id(主讨论记录) */
|
||||
@TableField("dis_id")
|
||||
private Integer disId;
|
||||
|
||||
/** 用户主键 */
|
||||
@TableField("user_id")
|
||||
private Integer userId;
|
||||
|
||||
/** 等级(楼层/层级) */
|
||||
@TableField("level")
|
||||
private Integer level;
|
||||
|
||||
/** 回复id(被回复的那条记录ID) */
|
||||
@TableField("reply_id")
|
||||
private Integer replyId;
|
||||
|
||||
/** 讨论内容 */
|
||||
@TableField("content")
|
||||
private String content;
|
||||
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField("creator")
|
||||
private String creator;
|
||||
|
||||
@TableField("updater")
|
||||
private String updater;
|
||||
|
||||
@TableField("tenant_id")
|
||||
private String tenantId;
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package xyz.playedu.jc.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 知识点表
|
||||
* 对应表:jc_knowledge
|
||||
*/
|
||||
@Data
|
||||
@TableName("jc_knowledge")
|
||||
public class Knowledge {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/** 教材ID */
|
||||
@TableField("book_id")
|
||||
private Integer bookId;
|
||||
|
||||
/** 父节点ID */
|
||||
@TableField("parent_id")
|
||||
private Integer parentId;
|
||||
|
||||
/** 知识点名称 */
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
/** 知识点code(字段名拼写为 konwledge_code) */
|
||||
@TableField("konwledge_code")
|
||||
private String konwledgeCode;
|
||||
|
||||
/** 知识点介绍 */
|
||||
@TableField("desc")
|
||||
private String desc;
|
||||
|
||||
/** 层级 */
|
||||
@TableField("level")
|
||||
private String level;
|
||||
|
||||
/** 知识点类型 */
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
/** 当前层级排序 */
|
||||
@TableField("order_num")
|
||||
private Integer orderNum;
|
||||
|
||||
/** 预留JSON */
|
||||
@TableField("extra_json")
|
||||
private String extraJson;
|
||||
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField("creator")
|
||||
private String creator;
|
||||
|
||||
@TableField("updater")
|
||||
private String updater;
|
||||
|
||||
@TableField("tenant_id")
|
||||
private String tenantId;
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package xyz.playedu.jc.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 学员笔记
|
||||
* 对应表:jc_note
|
||||
*/
|
||||
@Data
|
||||
@TableName("jc_note")
|
||||
public class Note {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/** 教材主键 */
|
||||
@TableField("book_id")
|
||||
private Integer bookId;
|
||||
|
||||
/** 用户主键 */
|
||||
@TableField("user_id")
|
||||
private Integer userId;
|
||||
|
||||
/** 章节ID */
|
||||
@TableField("chapter_id")
|
||||
private Integer chapterId;
|
||||
|
||||
/** 笔记内容 */
|
||||
@TableField("content")
|
||||
private String content;
|
||||
|
||||
/** 笔记标记内容(高亮的那句/那段文本) */
|
||||
@TableField("txt")
|
||||
private String txt;
|
||||
|
||||
/** 所属内容ID(页面中某一块内容的ID) */
|
||||
@TableField("section_id")
|
||||
private String sectionId;
|
||||
|
||||
/** 所属原始内容ID */
|
||||
@TableField("section_origin_id")
|
||||
private String sectionOriginId;
|
||||
|
||||
/** 存储笔记信息的JSON(位置信息等) */
|
||||
@TableField("extra_json")
|
||||
private String extraJson;
|
||||
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField("creator")
|
||||
private String creator;
|
||||
|
||||
@TableField("updater")
|
||||
private String updater;
|
||||
|
||||
@TableField("tenant_id")
|
||||
private String tenantId;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package xyz.playedu.jc.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import xyz.playedu.jc.domain.DiscussionDetail;
|
||||
|
||||
/**
|
||||
* 讨论明细 Mapper
|
||||
*/
|
||||
public interface DiscussionDetailMapper extends BaseMapper<DiscussionDetail> {
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package xyz.playedu.jc.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import xyz.playedu.jc.domain.Discussion;
|
||||
|
||||
/**
|
||||
* 讨论 Mapper
|
||||
*/
|
||||
public interface DiscussionMapper extends BaseMapper<Discussion> {
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package xyz.playedu.jc.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import xyz.playedu.jc.domain.Knowledge;
|
||||
|
||||
/**
|
||||
* 知识点 Mapper
|
||||
*/
|
||||
public interface KnowledgeMapper extends BaseMapper<Knowledge> {
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package xyz.playedu.jc.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import xyz.playedu.jc.domain.Note;
|
||||
|
||||
/**
|
||||
* 笔记 Mapper
|
||||
*/
|
||||
public interface NoteMapper extends BaseMapper<Note> {
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package xyz.playedu.jc.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.DiscussionDetail;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 讨论明细 Service
|
||||
*/
|
||||
public interface IDiscussionDetailService extends IService<DiscussionDetail> {
|
||||
|
||||
PaginationResult<DiscussionDetail> paginate(HashMap<String, Object> params);
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package xyz.playedu.jc.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.Discussion;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 讨论 Service
|
||||
*/
|
||||
public interface IDiscussionService extends IService<Discussion> {
|
||||
|
||||
/**
|
||||
* 分页查询讨论列表
|
||||
* 支持按教材、章节、用户等条件过滤
|
||||
*/
|
||||
PaginationResult<Discussion> paginate(HashMap<String, Object> params);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package xyz.playedu.jc.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.Knowledge;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 知识点 Service
|
||||
*/
|
||||
public interface IKnowledgeService extends IService<Knowledge> {
|
||||
|
||||
PaginationResult<Knowledge> paginate(HashMap<String, Object> params);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package xyz.playedu.jc.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.Note;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 笔记 Service
|
||||
*/
|
||||
public interface INoteService extends IService<Note> {
|
||||
|
||||
PaginationResult<Note> paginate(HashMap<String, Object> params);
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
package xyz.playedu.jc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.DiscussionDetail;
|
||||
import xyz.playedu.jc.mapper.DiscussionDetailMapper;
|
||||
import xyz.playedu.jc.service.IDiscussionDetailService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 讨论明细 Service 实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DiscussionDetailServiceImpl
|
||||
extends ServiceImpl<DiscussionDetailMapper, DiscussionDetail>
|
||||
implements IDiscussionDetailService {
|
||||
|
||||
@Override
|
||||
public PaginationResult<DiscussionDetail> paginate(HashMap<String, Object> params) {
|
||||
try {
|
||||
Integer page = MapUtils.getInteger(params, "page", 1);
|
||||
Integer size = MapUtils.getInteger(params, "size", 10);
|
||||
|
||||
Page<DiscussionDetail> pageParam = new Page<>(page, size);
|
||||
LambdaQueryWrapper<DiscussionDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
Integer bookId = MapUtils.getInteger(params, "bookId");
|
||||
if (bookId != null) {
|
||||
queryWrapper.eq(DiscussionDetail::getBookId, bookId);
|
||||
}
|
||||
|
||||
Integer chapterId = MapUtils.getInteger(params, "chapterId");
|
||||
if (chapterId != null) {
|
||||
queryWrapper.eq(DiscussionDetail::getChapterId, chapterId);
|
||||
}
|
||||
|
||||
Integer disId = MapUtils.getInteger(params, "disId");
|
||||
if (disId != null) {
|
||||
queryWrapper.eq(DiscussionDetail::getDisId, disId);
|
||||
}
|
||||
|
||||
Integer userId = MapUtils.getInteger(params, "userId");
|
||||
if (userId != null) {
|
||||
queryWrapper.eq(DiscussionDetail::getUserId, userId);
|
||||
}
|
||||
|
||||
queryWrapper.orderByAsc(DiscussionDetail::getCreateTime);
|
||||
|
||||
IPage<DiscussionDetail> pageResult = this.page(pageParam, queryWrapper);
|
||||
|
||||
Long total = pageResult.getTotal();
|
||||
PaginationResult<DiscussionDetail> result = new PaginationResult<>();
|
||||
result.setData(pageResult.getRecords());
|
||||
result.setTotal(total);
|
||||
result.setCurrent(page);
|
||||
result.setSize(size);
|
||||
result.setPages((total + size - 1) / size);
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("分页查询讨论明细失败,参数:{}", params, e);
|
||||
PaginationResult<DiscussionDetail> emptyResult = new PaginationResult<>();
|
||||
emptyResult.setData(new ArrayList<>());
|
||||
emptyResult.setTotal(0L);
|
||||
emptyResult.setCurrent(MapUtils.getInteger(params, "page", 1));
|
||||
emptyResult.setSize(MapUtils.getInteger(params, "size", 10));
|
||||
emptyResult.setPages(0L);
|
||||
return emptyResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package xyz.playedu.jc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.Discussion;
|
||||
import xyz.playedu.jc.mapper.DiscussionMapper;
|
||||
import xyz.playedu.jc.service.IDiscussionService;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 讨论 Service 实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DiscussionServiceImpl
|
||||
extends ServiceImpl<DiscussionMapper, Discussion>
|
||||
implements IDiscussionService {
|
||||
|
||||
@Override
|
||||
public PaginationResult<Discussion> paginate(HashMap<String, Object> params) {
|
||||
try {
|
||||
// 分页参数,默认第1页,每页10条
|
||||
Integer page = MapUtils.getInteger(params, "page", 1);
|
||||
Integer size = MapUtils.getInteger(params, "size", 10);
|
||||
|
||||
Page<Discussion> pageParam = new Page<>(page, size);
|
||||
LambdaQueryWrapper<Discussion> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 按教材筛选
|
||||
Integer bookId = MapUtils.getInteger(params, "bookId");
|
||||
if (bookId != null) {
|
||||
queryWrapper.eq(Discussion::getBookId, bookId);
|
||||
}
|
||||
|
||||
// 按章节筛选
|
||||
Integer chapterId = MapUtils.getInteger(params, "chapterId");
|
||||
if (chapterId != null) {
|
||||
queryWrapper.eq(Discussion::getChapterId, chapterId);
|
||||
}
|
||||
|
||||
// 按用户筛选
|
||||
Integer userId = MapUtils.getInteger(params, "userId");
|
||||
if (userId != null) {
|
||||
queryWrapper.eq(Discussion::getUserId, userId);
|
||||
}
|
||||
|
||||
// 按状态筛选
|
||||
Integer status = MapUtils.getInteger(params, "status");
|
||||
if (status != null) {
|
||||
queryWrapper.eq(Discussion::getStatus, status);
|
||||
}
|
||||
|
||||
// 简单内容模糊查询(如果你想要)
|
||||
String keyword = MapUtils.getString(params, "keyword");
|
||||
if (keyword != null && !keyword.isEmpty()) {
|
||||
queryWrapper.like(Discussion::getContent, keyword);
|
||||
}
|
||||
|
||||
// 按创建时间倒序
|
||||
queryWrapper.orderByDesc(Discussion::getCreateTime);
|
||||
|
||||
IPage<Discussion> pageResult = this.page(pageParam, queryWrapper);
|
||||
|
||||
Long total = pageResult.getTotal();
|
||||
Long pages = (total + size - 1) / size;
|
||||
|
||||
PaginationResult<Discussion> result = new PaginationResult<>();
|
||||
result.setData(pageResult.getRecords());
|
||||
result.setTotal(total);
|
||||
result.setCurrent(page);
|
||||
result.setSize(size);
|
||||
result.setPages(pages);
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("分页查询讨论失败,参数:{}", params, e);
|
||||
return new PaginationResult<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package xyz.playedu.jc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.Knowledge;
|
||||
import xyz.playedu.jc.mapper.KnowledgeMapper;
|
||||
import xyz.playedu.jc.service.IKnowledgeService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 知识点 Service 实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class KnowledgeServiceImpl
|
||||
extends ServiceImpl<KnowledgeMapper, Knowledge>
|
||||
implements IKnowledgeService {
|
||||
|
||||
@Override
|
||||
public PaginationResult<Knowledge> paginate(HashMap<String, Object> params) {
|
||||
try {
|
||||
Integer page = MapUtils.getInteger(params, "page", 1);
|
||||
Integer size = MapUtils.getInteger(params, "size", 10);
|
||||
|
||||
Page<Knowledge> pageParam = new Page<>(page, size);
|
||||
LambdaQueryWrapper<Knowledge> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
Integer bookId = MapUtils.getInteger(params, "bookId");
|
||||
if (bookId != null) {
|
||||
queryWrapper.eq(Knowledge::getBookId, bookId);
|
||||
}
|
||||
|
||||
Integer parentId = MapUtils.getInteger(params, "parentId");
|
||||
if (parentId != null) {
|
||||
queryWrapper.eq(Knowledge::getParentId, parentId);
|
||||
}
|
||||
|
||||
String name = MapUtils.getString(params, "name");
|
||||
if (name != null && !name.isEmpty()) {
|
||||
queryWrapper.like(Knowledge::getName, name);
|
||||
}
|
||||
|
||||
queryWrapper.orderByAsc(Knowledge::getOrderNum);
|
||||
|
||||
IPage<Knowledge> pageResult = this.page(pageParam, queryWrapper);
|
||||
|
||||
Long total = pageResult.getTotal();
|
||||
PaginationResult<Knowledge> result = new PaginationResult<>();
|
||||
result.setData(pageResult.getRecords());
|
||||
result.setTotal(total);
|
||||
result.setCurrent(page);
|
||||
result.setSize(size);
|
||||
result.setPages((total + size - 1) / size);
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("分页查询知识点失败,参数:{}", params, e);
|
||||
PaginationResult<Knowledge> emptyResult = new PaginationResult<>();
|
||||
emptyResult.setData(new ArrayList<>());
|
||||
emptyResult.setTotal(0L);
|
||||
emptyResult.setCurrent(MapUtils.getInteger(params, "page", 1));
|
||||
emptyResult.setSize(MapUtils.getInteger(params, "size", 10));
|
||||
emptyResult.setPages(0L);
|
||||
return emptyResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package xyz.playedu.jc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
import xyz.playedu.jc.domain.Note;
|
||||
import xyz.playedu.jc.mapper.NoteMapper;
|
||||
import xyz.playedu.jc.service.INoteService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 笔记 Service 实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class NoteServiceImpl extends ServiceImpl<NoteMapper, Note> implements INoteService {
|
||||
|
||||
@Override
|
||||
public PaginationResult<Note> paginate(HashMap<String, Object> params) {
|
||||
try {
|
||||
Integer page = MapUtils.getInteger(params, "page", 1);
|
||||
Integer size = MapUtils.getInteger(params, "size", 10);
|
||||
|
||||
Page<Note> pageParam = new Page<>(page, size);
|
||||
LambdaQueryWrapper<Note> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
Integer bookId = MapUtils.getInteger(params, "bookId");
|
||||
if (bookId != null) {
|
||||
queryWrapper.eq(Note::getBookId, bookId);
|
||||
}
|
||||
|
||||
Integer chapterId = MapUtils.getInteger(params, "chapterId");
|
||||
if (chapterId != null) {
|
||||
queryWrapper.eq(Note::getChapterId, chapterId);
|
||||
}
|
||||
|
||||
Integer userId = MapUtils.getInteger(params, "userId");
|
||||
if (userId != null) {
|
||||
queryWrapper.eq(Note::getUserId, userId);
|
||||
}
|
||||
|
||||
// 按创建时间倒序
|
||||
queryWrapper.orderByDesc(Note::getCreateTime);
|
||||
|
||||
IPage<Note> pageResult = this.page(pageParam, queryWrapper);
|
||||
|
||||
Long total = pageResult.getTotal();
|
||||
PaginationResult<Note> result = new PaginationResult<>();
|
||||
result.setData(pageResult.getRecords());
|
||||
result.setTotal(total);
|
||||
result.setCurrent(page);
|
||||
result.setSize(size);
|
||||
result.setPages((total + size - 1) / size);
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("分页查询笔记失败,参数:{}", params, e);
|
||||
PaginationResult<Note> emptyResult = new PaginationResult<>();
|
||||
emptyResult.setData(new ArrayList<>());
|
||||
emptyResult.setTotal(0L);
|
||||
emptyResult.setCurrent(MapUtils.getInteger(params, "page", 1));
|
||||
emptyResult.setSize(MapUtils.getInteger(params, "size", 10));
|
||||
emptyResult.setPages(0L);
|
||||
return emptyResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
<?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="xyz.playedu.jc.mapper.DiscussionDetailMapper">
|
||||
|
||||
<resultMap id="DiscussionDetailResultMap" type="xyz.playedu.jc.domain.DiscussionDetail">
|
||||
<id column="id" property="id"/>
|
||||
<result column="book_id" property="bookId"/>
|
||||
<result column="chapter_id" property="chapterId"/>
|
||||
<result column="dis_id" property="disId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="level" property="level"/>
|
||||
<result column="reply_id" property="replyId"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="updater" property="updater"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
book_id,
|
||||
chapter_id,
|
||||
dis_id,
|
||||
user_id,
|
||||
level,
|
||||
reply_id,
|
||||
content,
|
||||
create_time,
|
||||
update_time,
|
||||
creator,
|
||||
updater,
|
||||
tenant_id
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,13 @@
|
||||
<?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="xyz.playedu.jc.mapper.DiscussionMapper">
|
||||
|
||||
<!--
|
||||
目前使用 MyBatis-Plus 的通用 CRUD,这里可以先留空。
|
||||
如果后续有复杂查询,可以在这里新增 <select> / <update> 等。
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,43 @@
|
||||
<?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="xyz.playedu.jc.mapper.KnowledgeMapper">
|
||||
|
||||
<resultMap id="KnowledgeResultMap" type="xyz.playedu.jc.domain.Knowledge">
|
||||
<id column="id" property="id"/>
|
||||
<result column="book_id" property="bookId"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="konwledge_code" property="konwledgeCode"/>
|
||||
<result column="desc" property="desc"/>
|
||||
<result column="level" property="level"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="order_num" property="orderNum"/>
|
||||
<result column="extra_json" property="extraJson"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="updater" property="updater"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
book_id,
|
||||
parent_id,
|
||||
name,
|
||||
konwledge_code,
|
||||
`desc`,
|
||||
`level`,
|
||||
`type`,
|
||||
order_num,
|
||||
extra_json,
|
||||
create_time,
|
||||
update_time,
|
||||
creator,
|
||||
updater,
|
||||
tenant_id
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,41 @@
|
||||
<?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="xyz.playedu.jc.mapper.NoteMapper">
|
||||
|
||||
<resultMap id="NoteResultMap" type="xyz.playedu.jc.domain.Note">
|
||||
<id column="id" property="id"/>
|
||||
<result column="book_id" property="bookId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="chapter_id" property="chapterId"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="txt" property="txt"/>
|
||||
<result column="section_id" property="sectionId"/>
|
||||
<result column="section_origin_id" property="sectionOriginId"/>
|
||||
<result column="extra_json" property="extraJson"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="updater" property="updater"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
book_id,
|
||||
user_id,
|
||||
chapter_id,
|
||||
content,
|
||||
txt,
|
||||
section_id,
|
||||
section_origin_id,
|
||||
extra_json,
|
||||
create_time,
|
||||
update_time,
|
||||
creator,
|
||||
updater,
|
||||
tenant_id
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user