mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
增加文档管理接口
This commit is contained in:
@@ -11,6 +11,8 @@ import cn.lihongjie.coal.dictionary.entity.DictionaryItemEntity;
|
||||
import cn.lihongjie.coal.file.entity.FileEntity;
|
||||
import cn.lihongjie.coal.meter.entity.MeterEntity;
|
||||
import cn.lihongjie.coal.meterLog.entity.MeterLogEntity;
|
||||
import cn.lihongjie.coal.noteBook.entity.NoteBookEntity;
|
||||
import cn.lihongjie.coal.noteBookChapter.entity.NoteBookChapterEntity;
|
||||
import cn.lihongjie.coal.organization.entity.OrganizationEntity;
|
||||
import cn.lihongjie.coal.permission.entity.PermissionEntity;
|
||||
import cn.lihongjie.coal.resource.entity.ResourceEntity;
|
||||
@@ -214,6 +216,28 @@ public interface CommonMapper {
|
||||
e.setId(id);
|
||||
return e;
|
||||
}
|
||||
|
||||
default NoteBookChapterEntity createNoteBookChapter(String id) {
|
||||
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
|
||||
return null;
|
||||
}
|
||||
var e = new NoteBookChapterEntity();
|
||||
e.setId(id);
|
||||
return e;
|
||||
}
|
||||
|
||||
default NoteBookEntity createNoteBook(String id) {
|
||||
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
|
||||
return null;
|
||||
}
|
||||
var e = new NoteBookEntity();
|
||||
e.setId(id);
|
||||
return e;
|
||||
}
|
||||
default String toString(Object o) {
|
||||
|
||||
if (o == null) {
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.lihongjie.coal.noteBook.controller;
|
||||
|
||||
import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.noteBook.dto.CreateNoteBookDto;
|
||||
import cn.lihongjie.coal.noteBook.dto.NoteBookDto;
|
||||
import cn.lihongjie.coal.noteBook.dto.UpdateNoteBookDto;
|
||||
import cn.lihongjie.coal.noteBook.service.NoteBookService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/noteBook")
|
||||
@SysLog(
|
||||
module = "文档管理"
|
||||
)
|
||||
@Slf4j
|
||||
public class NoteBookController {
|
||||
@Autowired
|
||||
private NoteBookService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public NoteBookDto create(@RequestBody CreateNoteBookDto request) {
|
||||
return this.service.create(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public NoteBookDto update(@RequestBody UpdateNoteBookDto request) {
|
||||
return this.service.update(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public NoteBookDto getById(@RequestBody IdRequest request) {
|
||||
return this.service.getById(request.getId())
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<NoteBookDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.lihongjie.coal.noteBook.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CreateNoteBookDto extends CommonDto {
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.lihongjie.coal.noteBook.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.NoteBookChapterDto;
|
||||
|
||||
import jakarta.persistence.OneToMany;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.FilterJoinTable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class NoteBookDto extends CommonDto {
|
||||
@OneToMany
|
||||
@FilterJoinTable(name = "root", condition = "parent_id is null")
|
||||
private List<NoteBookChapterDto> chapters;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.lihongjie.coal.noteBook.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateNoteBookDto extends CommonDto {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.lihongjie.coal.noteBook.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.CommonEntity;
|
||||
import cn.lihongjie.coal.noteBookChapter.entity.NoteBookChapterEntity;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.OneToMany;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
public class NoteBookEntity extends CommonEntity {
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "noteBook")
|
||||
private List<NoteBookChapterEntity> chapters;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.lihongjie.coal.noteBook.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.noteBook.dto.CreateNoteBookDto;
|
||||
import cn.lihongjie.coal.noteBook.dto.NoteBookDto;
|
||||
import cn.lihongjie.coal.noteBook.dto.UpdateNoteBookDto;
|
||||
import cn.lihongjie.coal.noteBook.entity.NoteBookEntity;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class},
|
||||
mappingControl = DeepClone.class
|
||||
)
|
||||
public interface NoteBookMapper extends BaseMapper<NoteBookEntity, NoteBookDto, CreateNoteBookDto, UpdateNoteBookDto> {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package cn.lihongjie.coal.noteBook.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.noteBook.entity.NoteBookEntity;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface NoteBookRepository extends BaseRepository<NoteBookEntity> {
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package cn.lihongjie.coal.noteBook.service;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.noteBook.dto.CreateNoteBookDto;
|
||||
import cn.lihongjie.coal.noteBook.dto.NoteBookDto;
|
||||
import cn.lihongjie.coal.noteBook.dto.UpdateNoteBookDto;
|
||||
import cn.lihongjie.coal.noteBook.entity.NoteBookEntity;
|
||||
import cn.lihongjie.coal.noteBook.mapper.NoteBookMapper;
|
||||
import cn.lihongjie.coal.noteBook.repository.NoteBookRepository;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional
|
||||
public class NoteBookService extends BaseService<NoteBookEntity, NoteBookRepository> {
|
||||
@Autowired
|
||||
private NoteBookRepository repository;
|
||||
|
||||
@Autowired
|
||||
private NoteBookMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private ConversionService conversionService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public NoteBookDto create(CreateNoteBookDto request) {
|
||||
NoteBookEntity entity = mapper.toEntity(request);
|
||||
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
|
||||
public NoteBookDto update(UpdateNoteBookDto request) {
|
||||
NoteBookEntity entity = this.repository.get(request.getId());
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
this.repository.deleteAllById(request.getIds())
|
||||
;
|
||||
}
|
||||
|
||||
public NoteBookDto getById(String id) {
|
||||
NoteBookEntity entity = repository.get(id);
|
||||
|
||||
|
||||
return mapper.toDto(entity)
|
||||
;
|
||||
}
|
||||
|
||||
public Page<NoteBookDto> list(CommonQuery query) {
|
||||
Page<NoteBookEntity> page = repository.findAll(query.specification(conversionService), PageRequest.of(query.getPageNo(), query.getPageSize(), Sort.by(query.getOrders())));
|
||||
|
||||
|
||||
return page.map(this.mapper::toDto)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.lihongjie.coal.noteBookChapter.controller;
|
||||
|
||||
import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.CreateNoteBookChapterDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.NoteBookChapterDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.NoteBookChapterTreeDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.UpdateNoteBookChapterDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.service.NoteBookChapterService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/noteBookChapter")
|
||||
@SysLog(
|
||||
module = "章节管理"
|
||||
)
|
||||
@Slf4j
|
||||
public class NoteBookChapterController {
|
||||
@Autowired
|
||||
private NoteBookChapterService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public NoteBookChapterDto create(@RequestBody CreateNoteBookChapterDto request) {
|
||||
return this.service.create(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public NoteBookChapterDto update(@RequestBody UpdateNoteBookChapterDto request) {
|
||||
return this.service.update(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public NoteBookChapterDto getById(@RequestBody IdRequest request) {
|
||||
return this.service.getById(request.getId())
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<NoteBookChapterTreeDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.lihongjie.coal.noteBookChapter.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
@Data
|
||||
public class CreateNoteBookChapterDto extends CommonDto {
|
||||
@Comment("标题")
|
||||
private String title;
|
||||
|
||||
|
||||
@Comment("内容类型 0 html 1 markdown")
|
||||
private String contentType;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'notebook.contentType'\n"
|
||||
+ " and i.code = content_type)")
|
||||
private String contentTypeName;
|
||||
|
||||
@Comment("内容")
|
||||
private String content;
|
||||
|
||||
|
||||
|
||||
|
||||
@Comment("父节点")
|
||||
private String parent;
|
||||
|
||||
|
||||
private String noteBook;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.lihongjie.coal.noteBookChapter.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class NoteBookChapterDto extends CommonDto {
|
||||
@Comment("标题")
|
||||
private String title;
|
||||
|
||||
|
||||
@Comment("内容类型 0 html 1 markdown")
|
||||
private String contentType;
|
||||
|
||||
private String contentTypeName;
|
||||
|
||||
@Comment("内容")
|
||||
private String content;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.lihongjie.coal.noteBookChapter.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class NoteBookChapterTreeDto extends CommonDto {
|
||||
@Comment("标题")
|
||||
private String title;
|
||||
|
||||
|
||||
@Comment("内容类型 0 html 1 markdown")
|
||||
private String contentType;
|
||||
|
||||
private String contentTypeName;
|
||||
|
||||
@Comment("内容")
|
||||
private String content;
|
||||
|
||||
private List<NoteBookChapterTreeDto> children;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.lihongjie.coal.noteBookChapter.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
@Data
|
||||
public class UpdateNoteBookChapterDto extends CommonDto {
|
||||
@Comment("标题")
|
||||
private String title;
|
||||
|
||||
|
||||
@Comment("内容类型 0 html 1 markdown")
|
||||
private String contentType;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'notebook.contentType'\n"
|
||||
+ " and i.code = content_type)")
|
||||
private String contentTypeName;
|
||||
|
||||
@Comment("内容")
|
||||
private String content;
|
||||
|
||||
|
||||
|
||||
|
||||
@Comment("父节点")
|
||||
private String parent;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.lihongjie.coal.noteBookChapter.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.CommonEntity;
|
||||
import cn.lihongjie.coal.noteBook.entity.NoteBookEntity;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToMany;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
public class NoteBookChapterEntity extends CommonEntity {
|
||||
@Comment("标题")
|
||||
private String title;
|
||||
|
||||
|
||||
@Comment("内容类型 0 html 1 markdown")
|
||||
private String contentType;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'notebook.contentType'\n"
|
||||
+ " and i.code = content_type)")
|
||||
private String contentTypeName;
|
||||
|
||||
@Comment("内容")
|
||||
private String content;
|
||||
|
||||
|
||||
@Comment("子节点")
|
||||
@OneToMany(cascade = {CascadeType.REMOVE}, mappedBy = "parent")
|
||||
private List<NoteBookChapterEntity> children;
|
||||
|
||||
|
||||
|
||||
@ManyToOne
|
||||
@Comment("父节点")
|
||||
private NoteBookChapterEntity parent;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private NoteBookEntity noteBook;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.lihongjie.coal.noteBookChapter.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.CreateNoteBookChapterDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.NoteBookChapterDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.NoteBookChapterTreeDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.UpdateNoteBookChapterDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.entity.NoteBookChapterEntity;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class},
|
||||
mappingControl = DeepClone.class
|
||||
)
|
||||
public interface NoteBookChapterMapper extends BaseMapper<NoteBookChapterEntity, NoteBookChapterDto, CreateNoteBookChapterDto, UpdateNoteBookChapterDto> {
|
||||
NoteBookChapterTreeDto toTreeDto(NoteBookChapterEntity noteBookChapterEntity);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package cn.lihongjie.coal.noteBookChapter.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.noteBookChapter.entity.NoteBookChapterEntity;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface NoteBookChapterRepository extends BaseRepository<NoteBookChapterEntity> {
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.lihongjie.coal.noteBookChapter.service;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.CreateNoteBookChapterDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.NoteBookChapterDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.NoteBookChapterTreeDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.dto.UpdateNoteBookChapterDto;
|
||||
import cn.lihongjie.coal.noteBookChapter.entity.NoteBookChapterEntity;
|
||||
import cn.lihongjie.coal.noteBookChapter.mapper.NoteBookChapterMapper;
|
||||
import cn.lihongjie.coal.noteBookChapter.repository.NoteBookChapterRepository;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional
|
||||
public class NoteBookChapterService
|
||||
extends BaseService<NoteBookChapterEntity, NoteBookChapterRepository> {
|
||||
@Autowired private NoteBookChapterRepository repository;
|
||||
|
||||
@Autowired private NoteBookChapterMapper mapper;
|
||||
|
||||
@Autowired private ConversionService conversionService;
|
||||
|
||||
public NoteBookChapterDto create(CreateNoteBookChapterDto request) {
|
||||
NoteBookChapterEntity entity = mapper.toEntity(request);
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public NoteBookChapterDto update(UpdateNoteBookChapterDto request) {
|
||||
NoteBookChapterEntity entity = this.repository.get(request.getId());
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
this.repository.deleteAll(this.repository.findAllById(request.getIds()));
|
||||
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
}
|
||||
|
||||
public NoteBookChapterDto getById(String id) {
|
||||
NoteBookChapterEntity entity = repository.get(id);
|
||||
|
||||
return mapper.toDto(entity);
|
||||
}
|
||||
|
||||
public Page<NoteBookChapterTreeDto> list(CommonQuery query) {
|
||||
Page<NoteBookChapterEntity> page =
|
||||
repository.findAll(
|
||||
query.specification(conversionService),
|
||||
PageRequest.of(
|
||||
query.getPageNo(),
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toTreeDto);
|
||||
}
|
||||
}
|
||||
@@ -1675,6 +1675,20 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "notebook.contentType",
|
||||
"name": "章节内容类型",
|
||||
"item": [
|
||||
{
|
||||
"code": "0",
|
||||
"name": "HTML"
|
||||
},
|
||||
{
|
||||
"code": "1",
|
||||
"name": "MarkDown"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "cronJob.execStatus",
|
||||
"name": "定时任务执行状态",
|
||||
|
||||
Reference in New Issue
Block a user