Browse Source

1.添加图书管理模块

1 1 month ago
parent
commit
aa4f34b359
16 changed files with 1195 additions and 1 deletions
  1. 0 1
      imwork-assist/imwork-generator-service/src/main/resources/moudle/Dao.ftl
  2. 79 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/controller/cms/books/ContentsServiceController.java
  3. 225 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/convert/ContentsConvert.java
  4. 14 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/dao/ContentsDao.java
  5. 116 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/entity/Contents.java
  6. 112 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/bo/ContentsBO.java
  7. 19 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/bo/ContentsResultBO.java
  8. 112 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/dto/ContentsDTO.java
  9. 18 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/dto/ContentsListDTO.java
  10. 18 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/po/ContentsListParamVO.java
  11. 112 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/po/ContentsParamVO.java
  12. 19 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/vo/ContentsResultVO.java
  13. 113 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/vo/ContentsVO.java
  14. 52 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/service/IContentsService.java
  15. 106 0
      imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/service/impl/ContentsServiceImpl.java
  16. 80 0
      imwork-windows/imwork-silos/src/main/resources/mapper/cms/books/ContentsDao.xml

+ 0 - 1
imwork-assist/imwork-generator-service/src/main/resources/moudle/Dao.ftl

@@ -1,6 +1,5 @@
 package ${package}.${moduleName}.dao;
 
-top.imwork.commons.dao.base.BaseDao;
 import ${package}.commons.dao.base.BaseDao;
 import ${package}.${moduleName}.entity.${className};
 

+ 79 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/controller/cms/books/ContentsServiceController.java

@@ -0,0 +1,79 @@
+package top.imwork.window.silos.controller.cms.books;
+
+import jakarta.annotation.Resource;
+import jakarta.validation.Valid;
+import org.springframework.web.bind.annotation.*;
+
+import top.imwork.commons.core.base.BaseController;
+import top.imwork.commons.core.pojo.DeleteParams;
+import top.imwork.commons.core.pojo.ResponseMsg;
+import top.imwork.window.silos.convert.ContentsConvert;
+import top.imwork.window.silos.pojo.bo.ContentsBO;
+import top.imwork.window.silos.pojo.bo.ContentsResultBO;
+import top.imwork.window.silos.pojo.po.ContentsListParamVO;
+import top.imwork.window.silos.pojo.po.ContentsParamVO;
+import top.imwork.window.silos.service.IContentsService;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@RestController
+@RequestMapping("/contents")
+public class ContentsServiceController extends BaseController {
+
+    @Resource
+    public IContentsService contentsService;
+
+    /**
+     * 根据id查询数据
+     * @param id long类型的id
+     * @return 返回查询结果
+     */
+    @GetMapping("/info/{id}")
+    public ResponseMsg info(@PathVariable("id") Long id){
+        return ResponseMsg.buildResponse(contentsService.info(id));
+    }
+
+    /**
+     * 新增/修改info
+     * @param contentsParamVO 实体信息
+     * @return responseMsg 操作结果
+     */
+    @PostMapping("/save")
+    public ResponseMsg save(@RequestBody @Valid ContentsParamVO contentsParamVO){
+        ContentsBO contentsBO = contentsService.save(ContentsConvert.contentsParamVoToDto(contentsParamVO));
+        return ResponseMsg.buildResponse(ContentsConvert.contentsBoToVo(contentsBO));
+    }
+
+    /**
+     * 根据id删除图书内容表
+     * @param id id
+     * @return true/false 成功/失败
+     */
+    @DeleteMapping("/delete/{id}")
+    public ResponseMsg delete(@PathVariable("id") Long id){
+        return contentsService.delete(id)? ResponseMsg.ok() : ResponseMsg.fail();
+    }
+
+    /**
+     * 批量逻辑删除信息
+     *
+     * @param dto 删除条件
+     * @return true/false 是否删除成功
+     */
+    @DeleteMapping("/deleteByIds")
+    public ResponseMsg deleteByIds(@RequestBody DeleteParams dto){
+        String[] idArr = dto.getIds().split(",");
+        return contentsService.deleteByIds(idArr)? ResponseMsg.ok() : ResponseMsg.fail();
+    }
+
+    @PostMapping("/queryPage")
+    public ResponseMsg queryPage(@RequestBody @Valid ContentsListParamVO contentsListParamVO) {
+        ContentsResultBO contentsResultBO = contentsService.queryPage(ContentsConvert.contentsListParamVoToDTO(contentsListParamVO));
+        return ResponseMsg.buildResponse(ContentsConvert.contentsResultBoToVo(contentsResultBO));
+    }
+}

+ 225 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/convert/ContentsConvert.java

@@ -0,0 +1,225 @@
+package top.imwork.window.silos.convert;
+
+import org.springframework.util.ObjectUtils;
+import top.imwork.window.silos.entity.Contents;
+import top.imwork.window.silos.pojo.bo.ContentsBO;
+import top.imwork.window.silos.pojo.bo.ContentsResultBO;
+import top.imwork.window.silos.pojo.dto.ContentsListDTO;
+import top.imwork.window.silos.pojo.po.ContentsListParamVO;
+import top.imwork.window.silos.pojo.po.ContentsParamVO;
+import top.imwork.window.silos.pojo.vo.ContentsResultVO;
+import top.imwork.window.silos.pojo.vo.ContentsVO;
+import top.imwork.window.silos.pojo.dto.ContentsDTO;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 图书内容表
+ * 实体转换
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+public class ContentsConvert {
+    private ContentsConvert() {}
+
+    public static Contents contentsDtoToDo(ContentsDTO contentsDTO) {
+        if (contentsDTO == null) {
+            return null;
+        }
+        Contents contents = new Contents();
+        contents.setId(contentsDTO.getId());
+        contents.setBookInfoId(contentsDTO.getBookInfoId());
+        contents.setParentId(contentsDTO.getParentId());
+        contents.setChapterLevel(contentsDTO.getChapterLevel());
+        contents.setChapterNumber(contentsDTO.getChapterNumber());
+        contents.setChapterTitle(contentsDTO.getChapterTitle());
+        contents.setPageNumber(contentsDTO.getPageNumber());
+        contents.setContentType(contentsDTO.getContentType());
+        contents.setContentText(contentsDTO.getContentText());
+        contents.setContentHtml(contentsDTO.getContentHtml());
+        contents.setMediaUrl(contentsDTO.getMediaUrl());
+        contents.setWordCount(contentsDTO.getWordCount());
+        contents.setReadingTime(contentsDTO.getReadingTime());
+        contents.setSortOrder(contentsDTO.getSortOrder());
+        contents.setIsPublic(contentsDTO.getIsPublic());
+        contents.setHasChildren(contentsDTO.getHasChildren());
+        contents.setVersion(contentsDTO.getVersion());
+        contents.setDelFlag(contentsDTO.getDelFlag());
+        contents.setCreator(contentsDTO.getCreator());
+        contents.setCreateTime(contentsDTO.getCreateTime());
+        contents.setModifier(contentsDTO.getModifier());
+        contents.setUpdateTime(contentsDTO.getUpdateTime());
+        contents.setRemark(contentsDTO.getRemark());
+        return contents;
+    }
+
+    public static ContentsBO contentsDoToBo(Contents contents) {
+        if (contents == null) {
+            return null;
+        }
+        ContentsBO contentsBO = new ContentsBO();
+        contentsBO.setId(contents.getId());
+        contentsBO.setBookInfoId(contents.getBookInfoId());
+        contentsBO.setParentId(contents.getParentId());
+        contentsBO.setChapterLevel(contents.getChapterLevel());
+        contentsBO.setChapterNumber(contents.getChapterNumber());
+        contentsBO.setChapterTitle(contents.getChapterTitle());
+        contentsBO.setPageNumber(contents.getPageNumber());
+        contentsBO.setContentType(contents.getContentType());
+        contentsBO.setContentText(contents.getContentText());
+        contentsBO.setContentHtml(contents.getContentHtml());
+        contentsBO.setMediaUrl(contents.getMediaUrl());
+        contentsBO.setWordCount(contents.getWordCount());
+        contentsBO.setReadingTime(contents.getReadingTime());
+        contentsBO.setSortOrder(contents.getSortOrder());
+        contentsBO.setIsPublic(contents.getIsPublic());
+        contentsBO.setHasChildren(contents.getHasChildren());
+        contentsBO.setVersion(contents.getVersion());
+        contentsBO.setDelFlag(contents.getDelFlag());
+        contentsBO.setCreator(contents.getCreator());
+        contentsBO.setCreateTime(contents.getCreateTime());
+        contentsBO.setModifier(contents.getModifier());
+        contentsBO.setUpdateTime(contents.getUpdateTime());
+        contentsBO.setRemark(contents.getRemark());
+        return contentsBO;
+    }
+
+    public static ContentsDTO contentsParamVoToDto(ContentsParamVO contentsParamVO) {
+        if (contentsParamVO == null) {
+            return null;
+        }
+        ContentsDTO contentsDTO = new ContentsDTO();
+        contentsDTO.setId(contentsParamVO.getId());
+        contentsDTO.setBookInfoId(contentsParamVO.getBookInfoId());
+        contentsDTO.setParentId(contentsParamVO.getParentId());
+        contentsDTO.setChapterLevel(contentsParamVO.getChapterLevel());
+        contentsDTO.setChapterNumber(contentsParamVO.getChapterNumber());
+        contentsDTO.setChapterTitle(contentsParamVO.getChapterTitle());
+        contentsDTO.setPageNumber(contentsParamVO.getPageNumber());
+        contentsDTO.setContentType(contentsParamVO.getContentType());
+        contentsDTO.setContentText(contentsParamVO.getContentText());
+        contentsDTO.setContentHtml(contentsParamVO.getContentHtml());
+        contentsDTO.setMediaUrl(contentsParamVO.getMediaUrl());
+        contentsDTO.setWordCount(contentsParamVO.getWordCount());
+        contentsDTO.setReadingTime(contentsParamVO.getReadingTime());
+        contentsDTO.setSortOrder(contentsParamVO.getSortOrder());
+        contentsDTO.setIsPublic(contentsParamVO.getIsPublic());
+        contentsDTO.setHasChildren(contentsParamVO.getHasChildren());
+        contentsDTO.setVersion(contentsParamVO.getVersion());
+        contentsDTO.setDelFlag(contentsParamVO.getDelFlag());
+        contentsDTO.setCreator(contentsParamVO.getCreator());
+        contentsDTO.setCreateTime(contentsParamVO.getCreateTime());
+        contentsDTO.setModifier(contentsParamVO.getModifier());
+        contentsDTO.setUpdateTime(contentsParamVO.getUpdateTime());
+        contentsDTO.setRemark(contentsParamVO.getRemark());
+        return contentsDTO;
+    }
+
+    public static List<ContentsBO> contentsListToContentsBOList(List<Contents> records) {
+         if (ObjectUtils.isEmpty(records)) {
+             return new ArrayList<>();
+         }
+         List<ContentsBO> contentsBOList = new ArrayList<>();
+         for (Contents contents : records) {
+             contentsBOList.add(contentsDoToBo(contents));
+         }
+         return contentsBOList;
+    }
+
+    public static ContentsVO contentsBoToVo(ContentsBO contentsBO) {
+        if (contentsBO == null) {
+            return null;
+        }
+        ContentsVO contentsVO = new ContentsVO();
+        contentsVO.setId(contentsBO.getId());
+        contentsVO.setBookInfoId(contentsBO.getBookInfoId());
+        contentsVO.setParentId(contentsBO.getParentId());
+        contentsVO.setChapterLevel(contentsBO.getChapterLevel());
+        contentsVO.setChapterNumber(contentsBO.getChapterNumber());
+        contentsVO.setChapterTitle(contentsBO.getChapterTitle());
+        contentsVO.setPageNumber(contentsBO.getPageNumber());
+        contentsVO.setContentType(contentsBO.getContentType());
+        contentsVO.setContentText(contentsBO.getContentText());
+        contentsVO.setContentHtml(contentsBO.getContentHtml());
+        contentsVO.setMediaUrl(contentsBO.getMediaUrl());
+        contentsVO.setWordCount(contentsBO.getWordCount());
+        contentsVO.setReadingTime(contentsBO.getReadingTime());
+        contentsVO.setSortOrder(contentsBO.getSortOrder());
+        contentsVO.setIsPublic(contentsBO.getIsPublic());
+        contentsVO.setHasChildren(contentsBO.getHasChildren());
+        contentsVO.setVersion(contentsBO.getVersion());
+        contentsVO.setDelFlag(contentsBO.getDelFlag());
+        contentsVO.setCreator(contentsBO.getCreator());
+        contentsVO.setCreateTime(contentsBO.getCreateTime());
+        contentsVO.setModifier(contentsBO.getModifier());
+        contentsVO.setUpdateTime(contentsBO.getUpdateTime());
+        contentsVO.setRemark(contentsBO.getRemark());
+        return contentsVO;
+    }
+
+    public static ContentsListDTO contentsListParamVoToDTO(ContentsListParamVO contentsListParamVO) {
+        if (contentsListParamVO == null) {
+            return new ContentsListDTO();
+        }
+        ContentsListDTO contentsListDTO = new ContentsListDTO();
+        contentsListDTO.setContentsName(contentsListParamVO.getContentsName());
+        contentsListDTO.setPageNo(contentsListParamVO.getPageNo());
+        contentsListDTO.setPageRows(contentsListParamVO.getPageRows());
+        contentsListDTO.setDelFlag(contentsListParamVO.getDelFlag());
+        contentsListDTO.setCreator(contentsListParamVO.getCreator());
+        contentsListDTO.setCreateBeginTime(contentsListParamVO.getCreateBeginTime());
+        contentsListDTO.setCreateEndTime(contentsListParamVO.getCreateEndTime());
+        contentsListDTO.setModifier(contentsListParamVO.getModifier());
+        contentsListDTO.setUpdateBeginTime(contentsListParamVO.getUpdateBeginTime());
+        contentsListDTO.setUpdateEndTime(contentsListParamVO.getUpdateEndTime());
+        contentsListDTO.setRemark(contentsListParamVO.getRemark());
+        return contentsListDTO;
+    }
+        
+    public static ContentsListParamVO contentsListParamDtoToVo(ContentsListDTO contentsListDTO) {
+        if (contentsListDTO == null) {
+            return new ContentsListParamVO();
+        }
+        ContentsListParamVO contentsListParamVO = new ContentsListParamVO();
+        contentsListParamVO.setContentsName(contentsListDTO.getContentsName());
+        contentsListParamVO.setPageNo(contentsListDTO.getPageNo());
+        contentsListParamVO.setPageRows(contentsListDTO.getPageRows());
+        contentsListParamVO.setDelFlag(contentsListDTO.getDelFlag());
+        contentsListParamVO.setCreator(contentsListDTO.getCreator());
+        contentsListParamVO.setCreateBeginTime(contentsListDTO.getCreateBeginTime());
+        contentsListParamVO.setCreateEndTime(contentsListDTO.getCreateEndTime());
+        contentsListParamVO.setModifier(contentsListDTO.getModifier());
+        contentsListParamVO.setUpdateBeginTime(contentsListDTO.getUpdateBeginTime());
+        contentsListParamVO.setUpdateEndTime(contentsListDTO.getUpdateEndTime());
+        contentsListParamVO.setRemark(contentsListDTO.getRemark());
+        return contentsListParamVO;
+    }
+
+    private static List<ContentsVO> contentsBoListToContentsVoList(List<ContentsBO> dataList) {
+        if (ObjectUtils.isEmpty(dataList)) {
+            return new ArrayList<>();
+        }
+        List<ContentsVO> contentsVOList = new ArrayList<>();
+        for (ContentsBO contentsBO : dataList) {
+             contentsVOList.add(contentsBoToVo(contentsBO));
+        }
+        return contentsVOList;
+    }
+
+    public static ContentsResultVO contentsResultBoToVo(ContentsResultBO contentsResultBO) {
+        if (contentsResultBO == null) {
+            return new ContentsResultVO();
+        }
+        ContentsResultVO contentsResultVO = new ContentsResultVO();
+        contentsResultVO.setPageNo(contentsResultBO.getPageNo());
+        contentsResultVO.setPageRows(contentsResultBO.getPageRows());
+        contentsResultVO.setPageCount(contentsResultBO.getPageCount());
+        contentsResultVO.setTotalRows(contentsResultBO.getTotalRows());
+        contentsResultVO.setDataList(contentsBoListToContentsVoList(contentsResultBO.getDataList()));
+        contentsResultVO.setParams(contentsListParamDtoToVo(contentsResultBO.getParams()));
+        return contentsResultVO;
+    }
+}

+ 14 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/dao/ContentsDao.java

@@ -0,0 +1,14 @@
+package top.imwork.window.silos.dao;
+
+import top.imwork.commons.dao.base.BaseDao;
+import top.imwork.window.silos.entity.Contents;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+public interface ContentsDao extends BaseDao<Contents> {
+}

+ 116 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/entity/Contents.java

@@ -0,0 +1,116 @@
+package top.imwork.window.silos.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@Data
+@TableName("book_contents")
+public class Contents implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 1L;
+    /**
+     * 内容唯一标识符
+     */
+    @TableId
+    private Long id;
+    /**
+     * 关联的图书信息ID
+     */
+    private Long bookInfoId;
+    /**
+     * 父级内容ID
+     */
+    private Long parentId;
+    /**
+     * 章节层级:1=部,2=卷,3=章,4=节,5=小节
+     */
+    private Integer chapterLevel;
+    /**
+     * 章节编号
+     */
+    private String chapterNumber;
+    /**
+     * 章节标题
+     */
+    private String chapterTitle;
+    /**
+     * 起始页码
+     */
+    private Long pageNumber;
+    /**
+     * 内容类型
+     */
+    private String contentType;
+    /**
+     * 正文内容
+     */
+    private String contentText;
+    /**
+     * HTML格式内容
+     */
+    private String contentHtml;
+    /**
+     * 媒体文件路径
+     */
+    private String mediaUrl;
+    /**
+     * 字数统计
+     */
+    private Integer wordCount;
+    /**
+     * 阅读时长(分钟)
+     */
+    private Integer readingTime;
+    /**
+     * 排序序号
+     */
+    private Long sortOrder;
+    /**
+     * 是否公开:1=是,0=否
+     */
+    private Integer isPublic;
+    /**
+     * 是否有子章节:1=是,0=否
+     */
+    private Integer hasChildren;
+    /**
+     * 内容版本
+     */
+    private Integer version;
+    /**
+     * 是否删除默认N.未删除,Y已删除
+     */
+    private String delFlag;
+    /**
+     * 创建人
+     */
+    private String creator;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改人
+     */
+    private String modifier;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 112 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/bo/ContentsBO.java

@@ -0,0 +1,112 @@
+package top.imwork.window.silos.pojo.bo;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@Data
+public class ContentsBO implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 1L;
+    /**
+     * 内容唯一标识符
+     */
+    private Long id;
+    /**
+     * 关联的图书信息ID
+     */
+    private Long bookInfoId;
+    /**
+     * 父级内容ID
+     */
+    private Long parentId;
+    /**
+     * 章节层级:1=部,2=卷,3=章,4=节,5=小节
+     */
+    private Integer chapterLevel;
+    /**
+     * 章节编号
+     */
+    private String chapterNumber;
+    /**
+     * 章节标题
+     */
+    private String chapterTitle;
+    /**
+     * 起始页码
+     */
+    private Long pageNumber;
+    /**
+     * 内容类型
+     */
+    private String contentType;
+    /**
+     * 正文内容
+     */
+    private String contentText;
+    /**
+     * HTML格式内容
+     */
+    private String contentHtml;
+    /**
+     * 媒体文件路径
+     */
+    private String mediaUrl;
+    /**
+     * 字数统计
+     */
+    private Integer wordCount;
+    /**
+     * 阅读时长(分钟)
+     */
+    private Integer readingTime;
+    /**
+     * 排序序号
+     */
+    private Long sortOrder;
+    /**
+     * 是否公开:1=是,0=否
+     */
+    private Integer isPublic;
+    /**
+     * 是否有子章节:1=是,0=否
+     */
+    private Integer hasChildren;
+    /**
+     * 内容版本
+     */
+    private Integer version;
+    /**
+     * 是否删除默认N.未删除,Y已删除
+     */
+    private String delFlag;
+    /**
+     * 创建人
+     */
+    private String creator;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改人
+     */
+    private String modifier;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 19 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/bo/ContentsResultBO.java

@@ -0,0 +1,19 @@
+package top.imwork.window.silos.pojo.bo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import top.imwork.commons.core.pojo.BaseResult;
+import top.imwork.window.silos.pojo.dto.ContentsListDTO;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ContentsResultBO extends BaseResult<ContentsBO, ContentsListDTO> {
+
+}

+ 112 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/dto/ContentsDTO.java

@@ -0,0 +1,112 @@
+package top.imwork.window.silos.pojo.dto;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@Data
+public class ContentsDTO implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 1L;
+    /**
+     * 内容唯一标识符
+     */
+    private Long id;
+    /**
+     * 关联的图书信息ID
+     */
+    private Long bookInfoId;
+    /**
+     * 父级内容ID
+     */
+    private Long parentId;
+    /**
+     * 章节层级:1=部,2=卷,3=章,4=节,5=小节
+     */
+    private Integer chapterLevel;
+    /**
+     * 章节编号
+     */
+    private String chapterNumber;
+    /**
+     * 章节标题
+     */
+    private String chapterTitle;
+    /**
+     * 起始页码
+     */
+    private Long pageNumber;
+    /**
+     * 内容类型
+     */
+    private String contentType;
+    /**
+     * 正文内容
+     */
+    private String contentText;
+    /**
+     * HTML格式内容
+     */
+    private String contentHtml;
+    /**
+     * 媒体文件路径
+     */
+    private String mediaUrl;
+    /**
+     * 字数统计
+     */
+    private Integer wordCount;
+    /**
+     * 阅读时长(分钟)
+     */
+    private Integer readingTime;
+    /**
+     * 排序序号
+     */
+    private Long sortOrder;
+    /**
+     * 是否公开:1=是,0=否
+     */
+    private Integer isPublic;
+    /**
+     * 是否有子章节:1=是,0=否
+     */
+    private Integer hasChildren;
+    /**
+     * 内容版本
+     */
+    private Integer version;
+    /**
+     * 是否删除默认N.未删除,Y已删除
+     */
+    private String delFlag;
+    /**
+     * 创建人
+     */
+    private String creator;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改人
+     */
+    private String modifier;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 18 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/dto/ContentsListDTO.java

@@ -0,0 +1,18 @@
+package top.imwork.window.silos.pojo.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import top.imwork.commons.core.pojo.BaseParams;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ContentsListDTO extends BaseParams {
+    private String contentsName;
+}

+ 18 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/po/ContentsListParamVO.java

@@ -0,0 +1,18 @@
+package top.imwork.window.silos.pojo.po;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import top.imwork.commons.core.pojo.BaseParams;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ContentsListParamVO extends BaseParams {
+    private String ContentsName;
+}

+ 112 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/po/ContentsParamVO.java

@@ -0,0 +1,112 @@
+package top.imwork.window.silos.pojo.po;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@Data
+public class ContentsParamVO implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 1L;
+    /**
+     * 内容唯一标识符
+     */
+    private Long id;
+    /**
+     * 关联的图书信息ID
+     */
+    private Long bookInfoId;
+    /**
+     * 父级内容ID
+     */
+    private Long parentId;
+    /**
+     * 章节层级:1=部,2=卷,3=章,4=节,5=小节
+     */
+    private Integer chapterLevel;
+    /**
+     * 章节编号
+     */
+    private String chapterNumber;
+    /**
+     * 章节标题
+     */
+    private String chapterTitle;
+    /**
+     * 起始页码
+     */
+    private Long pageNumber;
+    /**
+     * 内容类型
+     */
+    private String contentType;
+    /**
+     * 正文内容
+     */
+    private String contentText;
+    /**
+     * HTML格式内容
+     */
+    private String contentHtml;
+    /**
+     * 媒体文件路径
+     */
+    private String mediaUrl;
+    /**
+     * 字数统计
+     */
+    private Integer wordCount;
+    /**
+     * 阅读时长(分钟)
+     */
+    private Integer readingTime;
+    /**
+     * 排序序号
+     */
+    private Long sortOrder;
+    /**
+     * 是否公开:1=是,0=否
+     */
+    private Integer isPublic;
+    /**
+     * 是否有子章节:1=是,0=否
+     */
+    private Integer hasChildren;
+    /**
+     * 内容版本
+     */
+    private Integer version;
+    /**
+     * 是否删除默认N.未删除,Y已删除
+     */
+    private String delFlag;
+    /**
+     * 创建人
+     */
+    private String creator;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改人
+     */
+    private String modifier;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 19 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/vo/ContentsResultVO.java

@@ -0,0 +1,19 @@
+package top.imwork.window.silos.pojo.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import top.imwork.commons.core.pojo.BaseResult;
+import top.imwork.window.silos.pojo.po.ContentsListParamVO;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ContentsResultVO extends BaseResult<ContentsVO, ContentsListParamVO> {
+
+}

+ 113 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/pojo/vo/ContentsVO.java

@@ -0,0 +1,113 @@
+package top.imwork.window.silos.pojo.vo;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *〈功能简述〉
+ * 图书内容表响应消息体
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+@Data
+public class ContentsVO implements Serializable{
+    @Serial
+    private static final long serialVersionUID = 1L;
+    /**
+     * 内容唯一标识符
+     */
+    private Long id;
+    /**
+     * 关联的图书信息ID
+     */
+    private Long bookInfoId;
+    /**
+     * 父级内容ID
+     */
+    private Long parentId;
+    /**
+     * 章节层级:1=部,2=卷,3=章,4=节,5=小节
+     */
+    private Integer chapterLevel;
+    /**
+     * 章节编号
+     */
+    private String chapterNumber;
+    /**
+     * 章节标题
+     */
+    private String chapterTitle;
+    /**
+     * 起始页码
+     */
+    private Long pageNumber;
+    /**
+     * 内容类型
+     */
+    private String contentType;
+    /**
+     * 正文内容
+     */
+    private String contentText;
+    /**
+     * HTML格式内容
+     */
+    private String contentHtml;
+    /**
+     * 媒体文件路径
+     */
+    private String mediaUrl;
+    /**
+     * 字数统计
+     */
+    private Integer wordCount;
+    /**
+     * 阅读时长(分钟)
+     */
+    private Integer readingTime;
+    /**
+     * 排序序号
+     */
+    private Long sortOrder;
+    /**
+     * 是否公开:1=是,0=否
+     */
+    private Integer isPublic;
+    /**
+     * 是否有子章节:1=是,0=否
+     */
+    private Integer hasChildren;
+    /**
+     * 内容版本
+     */
+    private Integer version;
+    /**
+     * 是否删除默认N.未删除,Y已删除
+     */
+    private String delFlag;
+    /**
+     * 创建人
+     */
+    private String creator;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改人
+     */
+    private String modifier;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 52 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/service/IContentsService.java

@@ -0,0 +1,52 @@
+package top.imwork.window.silos.service;
+
+import top.imwork.window.silos.pojo.bo.ContentsBO;
+import top.imwork.window.silos.pojo.bo.ContentsResultBO;
+import top.imwork.window.silos.pojo.dto.ContentsListDTO;
+import top.imwork.window.silos.pojo.dto.ContentsDTO;
+
+/**
+ * 图书内容表
+ *
+ * @author jiangxiaowei
+ * email: e-jiangxiaowei@outlook.com
+ * date: 2025-11-04 17:46:32
+ */
+public interface IContentsService{
+
+    /**
+     * 根据图书内容表id获取图书内容表详情
+     * @param id 图书内容表id
+     * @return ContentsBO 图书内容表详情
+     */
+    ContentsBO info(Long id);
+
+    /**
+     * 新增/修改 信息
+     * @param contentsDTO 要保存的信息
+     * @return ContentsBO 保存后的信息
+     */
+    ContentsBO save(ContentsDTO contentsDTO);
+
+    /**
+     * 根据id删除信息
+     * @param id id
+     * @return true/false 是否删除成功
+     */
+    Boolean delete(Long id);
+
+    /**
+     * 根据ids删除信息
+     * @param ids ids
+     * @return true/false 是否删除成功
+     */
+    Boolean deleteByIds(String[] ids);
+
+    /**
+     * 分页查询信息
+     * @param contentsListDTO 分页信息
+     * @return ContentsResultBO 查询结果
+     */
+    ContentsResultBO queryPage(ContentsListDTO contentsListDTO);
+}
+

+ 106 - 0
imwork-windows/imwork-silos/src/main/java/top/imwork/window/silos/service/impl/ContentsServiceImpl.java

@@ -0,0 +1,106 @@
+package top.imwork.window.silos.service.impl;
+
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+import jakarta.annotation.Resource;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import top.imwork.commons.core.utils.StringUtils;
+import top.imwork.window.silos.dao.ContentsDao;
+import top.imwork.window.silos.entity.Contents;
+import top.imwork.window.silos.pojo.bo.ContentsBO;
+import top.imwork.window.silos.pojo.bo.ContentsResultBO;
+import top.imwork.window.silos.pojo.dto.ContentsDTO;
+import top.imwork.window.silos.pojo.dto.ContentsListDTO;
+import top.imwork.window.silos.service.IContentsService;
+import top.imwork.window.silos.convert.ContentsConvert;
+
+@Service("contentsService")
+public class ContentsServiceImpl extends ServiceImpl<ContentsDao,Contents> implements IContentsService {
+    @Resource
+    private ContentsDao contentsDao;
+
+    /**
+     * 根据id获取信息
+     * @param id 用户id
+     * @return ContentsBO 响应信息
+     */
+    @Override
+    public ContentsBO info(Long id) {
+        Contents contents = contentsDao.info(id);
+        return ContentsConvert.contentsDoToBo(contents);
+    }
+
+    /**
+     * 新增/更新信息
+     * @param contentsDTO 信息
+     * @return contentsBO 更新后信息
+     */
+    @Override
+    public ContentsBO save(ContentsDTO contentsDTO) {
+        Contents contents = ContentsConvert.contentsDtoToDo(contentsDTO);
+        if (ObjectUtils.isEmpty(contents.getId())) {
+            contentsDao.insert(contents);
+        } else {
+            contentsDao.updateById(contents);
+        }
+        return ContentsConvert.contentsDoToBo(contents);
+    }
+
+    /**
+     * 根据id删除信息
+     * @param id id
+     * @return true/false 是否删除成功
+     */
+    @Override
+    public Boolean delete(Long id) {
+        return contentsDao.deleteById(id) == 1 ? Boolean.TRUE : Boolean.FALSE;
+    }
+
+    @Override
+    public Boolean deleteByIds(String[] ids) {
+        return contentsDao.deleteByIds(ids) > 0 ? Boolean.TRUE : Boolean.FALSE;
+    }
+
+    @Override
+    public ContentsResultBO queryPage(ContentsListDTO contentsListDTO) {
+        QueryWrapper<Contents> queryWrapper = new QueryWrapper<>();
+
+        if (!StringUtils.isEmpty(contentsListDTO.getContentsName())) {
+            queryWrapper.like("contents_name", contentsListDTO.getContentsName());
+        }
+
+        if (!StringUtils.isEmpty(contentsListDTO.getCreateBeginTime())) {
+            queryWrapper.apply("create_time >= '" + contentsListDTO.getCreateBeginTime() + "'");
+        }
+
+        if (!StringUtils.isEmpty(contentsListDTO.getCreateEndTime())) {
+            queryWrapper.apply("create_time <= '" + contentsListDTO.getCreateEndTime() + "'");
+        }
+
+        if (!StringUtils.isEmpty(contentsListDTO.getUpdateBeginTime())) {
+            queryWrapper.apply("update_time >= '" + contentsListDTO.getUpdateBeginTime() + "'");
+        }
+
+        if (!StringUtils.isEmpty(contentsListDTO.getUpdateEndTime())) {
+            queryWrapper.apply("update_time <= '" + contentsListDTO.getUpdateEndTime() + "'");
+        }
+
+        Page<Contents> page = new Page<>(contentsListDTO.getPageNo(), contentsListDTO.getPageRows());
+        IPage<Contents> iPage = contentsDao.queryPage(page, queryWrapper);
+
+        ContentsResultBO resultBO = new ContentsResultBO();
+        resultBO.setPageNo(contentsListDTO.getPageNo());
+        resultBO.setPageRows(contentsListDTO.getPageRows());
+        resultBO.setPageCount((int) iPage.getPages());
+        resultBO.setTotalRows((int) iPage.getTotal());
+        resultBO.setDataList(ContentsConvert.contentsListToContentsBOList(iPage.getRecords()));
+        resultBO.setParams(contentsListDTO);
+
+        return resultBO;
+    }
+}

+ 80 - 0
imwork-windows/imwork-silos/src/main/resources/mapper/cms/books/ContentsDao.xml

@@ -0,0 +1,80 @@
+<?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="top.imwork.window.silos.dao.ContentsDao">
+    <resultMap type="top.imwork.window.silos.entity.Contents" id="BaseResultMap">
+            <result property="id" column="id"/>
+            <result property="bookInfoId" column="book_info_id"/>
+            <result property="parentId" column="parent_id"/>
+            <result property="chapterLevel" column="chapter_level"/>
+            <result property="chapterNumber" column="chapter_number"/>
+            <result property="chapterTitle" column="chapter_title"/>
+            <result property="pageNumber" column="page_number"/>
+            <result property="contentType" column="content_type"/>
+            <result property="contentText" column="content_text"/>
+            <result property="contentHtml" column="content_html"/>
+            <result property="mediaUrl" column="media_url"/>
+            <result property="wordCount" column="word_count"/>
+            <result property="readingTime" column="reading_time"/>
+            <result property="sortOrder" column="sort_order"/>
+            <result property="isPublic" column="is_public"/>
+            <result property="hasChildren" column="has_children"/>
+            <result property="version" column="version"/>
+            <result property="delFlag" column="del_flag"/>
+            <result property="creator" column="creator"/>
+            <result property="createTime" column="create_time"/>
+            <result property="modifier" column="modifier"/>
+            <result property="updateTime" column="update_time"/>
+            <result property="remark" column="remark"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,
+        book_info_id,
+        parent_id,
+        chapter_level,
+        chapter_number,
+        chapter_title,
+        page_number,
+        content_type,
+        content_text,
+        content_html,
+        media_url,
+        word_count,
+        reading_time,
+        sort_order,
+        is_public,
+        has_children,
+        version,
+        del_flag,
+        creator,
+        create_time,
+        modifier,
+        update_time,
+        remark
+    </sql>
+
+    <!--根据ids批量删除-->
+    <update id="deleteByIds" parameterType="ArrayList">
+        update book_contents
+        set del_flag = 'Y'
+        where id in
+        <foreach item="ids" collection="array" open="(" separator=","  close=")">
+            #{ids}
+        </foreach>
+    </update>
+
+    <!--根据id查询信息-->
+    <select id="info" resultMap="BaseResultMap" parameterType="long">
+        select *
+        from book_contents
+        where 1 = 1
+        and id = #{id}
+    </select>
+
+    <!--分页查询-->
+    <select id="queryPage" resultType="top.imwork.window.silos.entity.Contents">
+        select *
+        from book_contents ${ew.customSqlSegment}
+    </select>
+</mapper>