--图书分类

This commit is contained in:
yc13649764453
2023-09-15 09:08:38 +08:00
parent 4deeb605f8
commit 8d3c128f3b
24 changed files with 862 additions and 473 deletions

712
.idea/workspace.xml generated

File diff suppressed because it is too large Load Diff

View File

@@ -26,8 +26,8 @@
2022-08-04 15:23:59.848 [INFO ] trationDelegate$BeanPostProcessorChecker : Bean 'OAuth2Realm' of type [com.peanut.modules.sys.oauth2.OAuth2Realm] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-08-04 15:23:59.872 [INFO ] trationDelegate$BeanPostProcessorChecker : Bean 'securityManager' of type [org.apache.shiro.web.mgt.DefaultWebSecurityManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-08-04 15:23:59.883 [INFO ] trationDelegate$BeanPostProcessorChecker : Bean 'authorizationAttributeSourceAdvisor' of type [org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-08-04 15:24:00.102 [INFO ] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9100 (http)
2022-08-04 15:24:00.111 [INFO ] o.a.coyote.http11.Http11NioProtocol : Initializing ProtocolHandler ["http-nio-9100"]
2022-08-04 15:24:00.102 [INFO ] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9200 (http)
2022-08-04 15:24:00.111 [INFO ] o.a.coyote.http11.Http11NioProtocol : Initializing ProtocolHandler ["http-nio-9200"]
2022-08-04 15:24:00.111 [INFO ] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-08-04 15:24:00.111 [INFO ] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.60]
2022-08-04 15:24:00.201 [INFO ] o.a.c.c.C.[Tomcat].[localhost].[/pb] : Initializing Spring embedded WebApplicationContext
@@ -37,20 +37,20 @@
2022-08-04 15:24:00.656 [INFO ] org.quartz.core.QuartzScheduler : Quartz Scheduler v.2.3.0 created.
2022-08-04 15:24:00.661 [INFO ] o.s.s.quartz.LocalDataSourceJobStore : Using db table-based data access locking (synchronization).
2022-08-04 15:24:00.662 [INFO ] o.s.s.quartz.LocalDataSourceJobStore : JobStoreCMT initialized.
2022-08-04 15:24:00.663 [INFO ] org.quartz.core.QuartzScheduler : Scheduler meta-data: Quartz Scheduler (v2.3.0) 'RenrenScheduler' with instanceId 'DESKTOP-MUPIBUO1659597840649'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 20 threads.
Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered.
2022-08-04 15:24:00.663 [INFO ] org.quartz.core.QuartzScheduler : Scheduler meta-data: Quartz Scheduler (v2.3.0) 'RenrenScheduler' with instanceId 'DESKTOP-MUPIBUO1659597840649'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 20 threads.
Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered.
2022-08-04 15:24:00.663 [INFO ] org.quartz.impl.StdSchedulerFactory : Quartz scheduler 'RenrenScheduler' initialized from an externally provided properties instance.
2022-08-04 15:24:00.664 [INFO ] org.quartz.impl.StdSchedulerFactory : Quartz scheduler version: 2.3.0
2022-08-04 15:24:00.665 [INFO ] org.quartz.core.QuartzScheduler : JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@baa9ce4
2022-08-04 15:24:01.683 [INFO ] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)]
2022-08-04 15:24:02.134 [INFO ] o.a.coyote.http11.Http11NioProtocol : Starting ProtocolHandler ["http-nio-9100"]
2022-08-04 15:24:02.148 [INFO ] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9100 (http) with context path '/pb'
2022-08-04 15:24:02.134 [INFO ] o.a.coyote.http11.Http11NioProtocol : Starting ProtocolHandler ["http-nio-9200"]
2022-08-04 15:24:02.148 [INFO ] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9200 (http) with context path '/pb'
2022-08-04 15:24:02.149 [INFO ] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2022-08-04 15:24:02.160 [INFO ] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2022-08-04 15:24:02.186 [INFO ] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references

View File

@@ -109,6 +109,7 @@
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.6.6" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.18" level="project" />
<orderEntry type="library" name="Maven: icu.mhb:mybatis-plus-join:1.3.4" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.28" level="project" />
<orderEntry type="library" name="Maven: org.redisson:redisson:3.12.5" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.75.Final" level="project" />

View File

@@ -125,6 +125,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>icu.mhb</groupId>
<artifactId>mybatis-plus-join</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>

View File

@@ -0,0 +1,115 @@
package com.peanut.modules.book.controller;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.BookCategoryEntity;
import com.peanut.modules.book.entity.ShopCategoryEntity;
import com.peanut.modules.book.service.BookCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 图书分类
*
*/
@RestController
@RequestMapping("book/bookCategory")
public class BookCategoryController {
@Autowired
private BookCategoryService bookCategoryService;
/**
* 分页列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = bookCategoryService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
BookCategoryEntity bookCategoryEntity = bookCategoryService.getById(id);
return R.ok().put("bookCategoryEntity", bookCategoryEntity);
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody BookCategoryEntity bookCategoryEntity){
bookCategoryEntity.setDelFlag(0);
bookCategoryService.save(bookCategoryEntity);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody BookCategoryEntity bookCategoryEntity){
bookCategoryService.updateById(bookCategoryEntity);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
bookCategoryService.removeByIds(Arrays.asList(ids));
return R.ok();
}
/**
* 删除前检查
*/
@RequestMapping("/deleteCheck")
public R deleteCheck(@RequestBody String[] oids){
bookCategoryService.removeCheckByIds(Arrays.asList(oids));
return R.ok();
}
/**
* 获取图书 一级分类
*/
@RequestMapping("/getOneLevel")
public R getOneLevel(){
List<BookCategoryEntity> list = bookCategoryService.getOneLevel();
return R.ok().put("list",list);
}
/**
* 获取图书 二级分类
*/
@RequestMapping("/getTwoLevel")
public R getTwoLevel(){
List<BookCategoryEntity> listTree = bookCategoryService.listTree();
return R.ok().put("data",listTree);
}
}

View File

@@ -63,6 +63,12 @@ public class BookChapterController {
return R.ok().put("bookChapter", bookChapter);
}
/**
* 保存
*/
@@ -71,34 +77,18 @@ public class BookChapterController {
BookChapterEntity bookChapterEntity = new BookChapterEntity();
Integer number = bookChapter.getNumber();
Integer bookId = bookChapter.getBookId();
if (number == 0) {
return R.error("章节号不可为0请输入正确章节号");
}
List<BookChapterEntity> bookChapterEntities = this.bookChapterService.getBaseMapper().selectList(new QueryWrapper<BookChapterEntity>()
.eq("book_id", bookId)
.ge("number", number));
for(BookChapterEntity entity: bookChapterEntities){
entity.setNumber(entity.getNumber() + 1);
this.bookChapterService.updateById(entity);
}
bookChapterService.save(bookChapter);
// if (number != null && bookId != null) {
// BookChapterEntity chapter = bookChapterService.getBaseMapper().selectOne(new QueryWrapper<BookChapterEntity>()
// .eq("number", number)
// .eq("book_id", bookId));
// if (chapter != null) {
// return R.error("该章节已存在,请修改或重新上传");
// } else {
// bookChapterEntity.setBookId(bookChapter.getBookId());
// bookChapterEntity.setNumber(bookChapter.getNumber());
// bookChapterEntity.setContent(bookChapter.getContent());
// bookChapterEntity.setChapter(bookChapter.getChapter());
// bookChapterEntity.setVoices(bookChapter.getVoices());
// bookChapterService.save(bookChapterEntity);
// }
//
// }
return R.ok();
}

View File

@@ -122,7 +122,7 @@ public class BookClockinController {
.eq("user_id", userId)
);
if (bookClockinPunchEntity==null) {
return R.error("您尚未签到,签到完成即可发表内容");
return R.error("当天打卡内容未发布");
}
BookClockinEntity bookClockin = bookClockinService.getBaseMapper().selectOne(new QueryWrapper<BookClockinEntity>()
.eq("book_id", bookId)

View File

@@ -59,18 +59,6 @@ public class BookController {
return R.ok().put("page", page);
}
/**
* 信息
*/
@@ -92,8 +80,7 @@ public class BookController {
@PathVariable("userId") Integer userId) {
System.out.println("++++++id"+id);
System.out.println("++++++userId"+userId);
// 判断用户是否够买书籍
BookEntity book = bookService.getById(id);

View File

@@ -52,42 +52,51 @@ public class BookForumArticlesServiceController {
List list = new ArrayList<>();
List<BookForumArticlesEntity> newBookList_all = bookForumArticlesService.getBaseMapper().selectList(new QueryWrapper<BookForumArticlesEntity>()
.orderByDesc("create_time"));
Set<BookForumArticlesEntity> uniqueSet = new HashSet<>();
System.out.println();
for (BookForumArticlesEntity entity : newBookList_all) {
boolean isUnique = true;
for (BookForumArticlesEntity uniqueEntity : uniqueSet) {
if (entity.getBookid().equals(uniqueEntity.getBookid())) {
isUnique = false;
break;
}
}
if (isUnique) {
uniqueSet.add(entity);
}
}
List<BookForumArticlesEntity> newBookList_unique = new ArrayList<>(uniqueSet);
List<BookForumArticlesEntity> newBookList = new ArrayList<>();
int start = (page-1)*2;
int end = (page-1)*2+2;
if((page-1)*2 >= newBookList_all.size()){
start = newBookList_all.size();
if((page-1)*2 >= newBookList_unique.size()){
start = newBookList_unique.size();
}
if((page-1)*2+2 >= newBookList_all.size()){
end = newBookList_all.size();
if((page-1)*2+2 >= newBookList_unique.size()){
end = newBookList_unique.size();
}
newBookList = newBookList_all.subList(start,end);
newBookList = newBookList_unique.subList(start,end);
for (BookForumArticlesEntity book : newBookList) {
String bookid = "";
String publisherName = "";
BookForumArticlesVO bookForumArticlesVO = new BookForumArticlesVO();
String bookid1 = String.valueOf(book.getBookid());
String image = book.getImage();
String content = book.getContent();
String title = book.getTitle();
Date createTime = book.getCreateTime();
String[] authorIds = bookid1.split(",");
List<String> bookids = Arrays.asList(authorIds);
List<BookEntity> id = bookService.getBaseMapper().selectList(new QueryWrapper<BookEntity>().in("id", bookids));
List<BookEntity> id = bookService.getBaseMapper().selectList(new QueryWrapper<BookEntity>().in("id", bookid1));
System.out.println("id==========="+id);
for (BookEntity bookentity : id) {
String authorName = "";
String images = bookentity.getImages();
String name = bookentity.getName();
Integer id1 = bookentity.getId();
String authorId = bookentity.getAuthorId();
String[] author = authorId.split(",");
List<String> authorList = Arrays.asList(author);
List<AuthorEntity> authorEntities = authorService.getBaseMapper().selectList(new QueryWrapper<AuthorEntity>().in("id", authorList));
@@ -107,7 +116,7 @@ public class BookForumArticlesServiceController {
publisherName += "," + publisherEntity.getPublisherName();
}
publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName;
bookForumArticlesVO.setBookid(bookid1);
bookForumArticlesVO.setBookid(String.valueOf(bookid1));
bookForumArticlesVO.setAuthorName(authorName);
bookForumArticlesVO.setPublisherName(publisherName);
bookForumArticlesVO.setBookName(name);

View File

@@ -5,6 +5,7 @@ import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peanut.modules.book.entity.BookEntity;
import com.peanut.modules.book.entity.BuyOrderDetailEntity;
import com.peanut.modules.book.entity.ShopCategoryEntity;
import com.peanut.modules.book.service.BookService;
import com.peanut.modules.book.service.BuyOrderDetailService;
import com.peanut.modules.book.service.ShopCategoryService;
@@ -67,7 +68,7 @@ public class ShopProductController {
@RequestMapping("/list")
// @RequiresPermissions("book:shopproduct:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = shopProductService.queryPage(params);
PageUtils page = shopProductService.appQueryPage(params);
return R.ok().put("page", page);
}
@@ -192,12 +193,14 @@ public class ShopProductController {
/**
* 信息
* @param productId
* @param productId 9.13商品详情原接口
* @return
*/
@RequestMapping("/info/{productId}")
public R info(@PathVariable("productId") Integer productId){
ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProductEntity>().eq("product_id", productId));
ArrayList<Map<String, String>> imagesUrl = new ArrayList<Map<String,String>>();
ArrayList<Map<String, String>> imagesUrls = new ArrayList<Map<String,String>>();
Integer poid = shopProductEntity.getProductPid();
String bookids = shopProductEntity.getBookId();
List<Integer> poids = shopCategoryService.findPoid(poid);
@@ -206,31 +209,41 @@ public class ShopProductController {
String bookId = shopProductEntity.getBookId();
list.add(bookId);
shopProductEntity.setBookids(list);
String bookId1 = shopProductEntity.getBookId();
ArrayList<Map<String, String>> imagesUrl = new ArrayList<Map<String,String>>();
ArrayList<Map<String, String>> imagesUrls = new ArrayList<Map<String,String>>();
Boolean canListen=null;
for(String s : bookId1.split(",")){
if(null != s && !"".equals(s)){
BookEntity book = this.bookService.getById(s);
String canListen1 =String.valueOf(book.getCanListen()) ;
Map<String, String> urlMap = new HashMap<String, String>();
urlMap.put("id",s);
//如果图书删除了,商品页面会报错
urlMap.put("images",book.getImages());
urlMap.put("name",book.getName());
urlMap.put("canListen",canListen1);
imagesUrl.add(urlMap)
;
//TODO 判定
if (shopProductEntity.getBookId() != null) {
String bookId1 = shopProductEntity.getBookId();
for(String s : bookId1.split(",")){
if(null != s && !"".equals(s)){
BookEntity book = this.bookService.getById(s);
String canListen1 =String.valueOf(book.getCanListen()) ;
Map<String, String> urlMap = new HashMap<String, String>();
urlMap.put("id",s);
//如果图书删除了,商品页面会报错
urlMap.put("images",book.getImages());
urlMap.put("name",book.getName());
urlMap.put("canListen",canListen1);
imagesUrl.add(urlMap)
;
}
}
}else {
ShopProductEntity shopProduct = shopProductService.getById(productId);
return R.ok().put("shopProduct", shopProduct);
}
Boolean canListen=null;
shopProductEntity.setBookidsimages(imagesUrl);
return R.ok().put("shopProduct", shopProductEntity);
}
/**
* 保存
*/
@@ -246,8 +259,10 @@ public class ShopProductController {
if (bkids!=null &&!bkids.isEmpty()){
String substring = bkids.substring(0, bkids.length() - 1);
shopProduct.setBookId(substring);
}else {
shopProduct.setBookId("");
}
shopProduct.setBookId("");
shopProduct.setCreateTime(new Date());
shopProductService.save(shopProduct);
return R.ok();
@@ -301,10 +316,18 @@ public class ShopProductController {
*/
@RequestMapping("/appGetCategoryList")
public R appGetCategoryList(@RequestParam("catId") Integer catId){
System.out.println("catId======================"+catId);
List<ShopCategoryEntity> list1 = shopCategoryService.getBaseMapper().selectList(new QueryWrapper<ShopCategoryEntity>()
.eq("cat_id",catId));
if (catId == null) {
}
if(catId == 0){
catId = null;
}
List<ShopProductEntity> list = shopProductService.appGetCategoryList(catId);
System.out.println("list==========================="+list);
return R.ok().put("list", list);
}

View File

@@ -97,23 +97,24 @@ public class UserEbookBuyController {
List<UserEbookBuyEntity> user_id = userEbookBuyService.getBaseMapper().selectList(new QueryWrapper<UserEbookBuyEntity>().eq("user_id", userId));
for (UserEbookBuyEntity userEbookBuyEntity : user_id) {
Map<String, Object> map = new HashMap<>();
Integer bookId = userEbookBuyEntity.getBookId();
Integer userId1 = userEbookBuyEntity.getUserId();
String bookName = userEbookBuyEntity.getBookName();
Integer bookId = userEbookBuyEntity.getBookId();
Integer buyId = userEbookBuyEntity.getBuyId();
String image = userEbookBuyEntity.getImage();
String author = userEbookBuyEntity.getAuthor();
List<BookEntity> id = bookService.getBaseMapper().selectList(new QueryWrapper<BookEntity>().eq("id", bookId));
for (BookEntity bookEntity : id) {
String images = bookEntity.getImages();
Integer id1 = bookEntity.getId();
String name1 = bookEntity.getName();
String name = bookEntity.getName();
Boolean canListen = bookEntity.getCanListen();
map.put("canListen", canListen);
map.put("bookId",bookId);
map.put("userId",userId1);
map.put("bookName",bookName);
map.put("bookName",name1);
map.put("buyId",buyId);
map.put("image",image);
map.put("author",author);
map.put("image",images);
// map.put("author",author);
list.add(map);

View File

@@ -52,50 +52,60 @@ public class UserRecordController {
@RequestMapping("/All")
public R All(@RequestBody UserRecordEntity userRecordEntity) {
List list = new ArrayList<>();
//此处bookid实际传的是商品id
List<UserRecordEntity> bookid = userRecordService.getBaseMapper().selectList(new QueryWrapper<UserRecordEntity>().eq("bookid", userRecordEntity.getBookid()).orderByDesc("create_date"));
for (UserRecordEntity userRecord : bookid) {
HashMap<Object, Object> map = new HashMap<>();
Integer bookid1 = userRecord.getBookid();
Integer userid1 = userRecord.getUserid();
Integer id1 = userRecord.getId();
List<MyUserEntity> id = myUserService.getBaseMapper().selectList(new QueryWrapper<MyUserEntity>().eq("id", userid1));
String usser = "";
String name = "";
for (MyUserEntity user : id) {
usser = user.getAvatar();
name = user.getNickname();
}
List<UserFollowUpEntity> followUpEntity = userFollowUpService.getBaseMapper().selectList(new QueryWrapper<UserFollowUpEntity>()
.eq("oid", id1)
.eq("userId", userid1)
.orderByDesc("create_date"));
String conTent = "";
Date date = null;
for (UserFollowUpEntity followUp : followUpEntity) {
conTent = followUp.getConTent();
date = followUp.getCreateDate();
if (bookid != null) {
for (UserRecordEntity userRecord : bookid) {
HashMap<Object, Object> map = new HashMap<>();
Integer bookid1 = userRecord.getBookid();
Integer userid1 = userRecord.getUserid();
Integer id1 = userRecord.getId();
List<MyUserEntity> id = myUserService.getBaseMapper().selectList(new QueryWrapper<MyUserEntity>().eq("id", userid1));
String usser = "";
String name = "";
for (MyUserEntity user : id) {
usser = user.getAvatar();
name = user.getNickname();
}
List<UserFollowUpEntity> followUpEntity = userFollowUpService.getBaseMapper().selectList(new QueryWrapper<UserFollowUpEntity>()
.eq("oid", id1)
.eq("userId", userid1)
.orderByDesc("create_date"));
String conTent = "";
Date date = null;
for (UserFollowUpEntity followUp : followUpEntity) {
conTent = followUp.getConTent();
date = followUp.getCreateDate();
}
map.put("followUpdate", date);
map.put("followUpcontent", conTent);
map.put("avatar", usser);
map.put("name", name);
map.put("bookid", bookid1);
map.put("orderSn", userRecord.getOrderSn());
map.put("userid", userid1);
map.put("content", userRecord.getContent());
map.put("images", userRecord.getImages());
map.put("starlevel", userRecord.getStarLevel());
map.put("createdate", userRecord.getCreateDate());
list.add(map);
}
map.put("followUpdate", date);
map.put("followUpcontent", conTent);
map.put("avatar", usser);
map.put("name", name);
map.put("bookid", bookid1);
map.put("orderSn", userRecord.getOrderSn());
map.put("userid", userid1);
map.put("content", userRecord.getContent());
map.put("images", userRecord.getImages());
map.put("starlevel", userRecord.getStarLevel());
map.put("createdate", userRecord.getCreateDate());
list.add(map);
return R.ok().put("list", list);
}
return R.ok().put("list", list);
return R.error("该商品暂无评论");
}

View File

@@ -0,0 +1,13 @@
package com.peanut.modules.book.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.peanut.modules.book.entity.BookCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BookCategoryDao extends BaseMapper<BookCategoryEntity> {
}

View File

@@ -0,0 +1,70 @@
package com.peanut.modules.book.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.List;
/**
* 图书二级分类
*
*/
@Data
@TableName("book_category")
public class BookCategoryEntity {
/**
* 分类id
*/
@TableId
private Integer id;
/**
* 分类名称
*/
@TableField("name")
private String name;
/**
* 父分类id
*/
@TableField("book_cid")
private Integer bookCid;
/**
* 层级
*/
@TableField("book_level")
private Integer bookLevel;
/**
* 删除标记
*/
@TableLogic
private Integer delFlag;
/**
* 排序
*/
@TableField("sort")
private Integer sort;
/**
* 商品数量
*/
@TableField("book_count")
private Integer bookCount;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private List<BookCategoryEntity> children;
}

View File

@@ -18,11 +18,7 @@ import java.util.Date;
@TableName("book_clockin")
public class BookClockinEntity implements Serializable {
/**
* id book_id user_id content clockin_sum
* clockin_days create_time update_time del_flag
* images voices like like_sum comment_sum
*/
/**
*

View File

@@ -1,9 +1,6 @@
package com.peanut.modules.book.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import java.math.BigDecimal;
import java.io.Serializable;
@@ -90,6 +87,7 @@ public class ShopProductEntity implements Serializable {
/**
* 删除标记
*/
@TableLogic
private Integer delFlag;
/**
* 排序

View File

@@ -0,0 +1,22 @@
package com.peanut.modules.book.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.common.utils.PageUtils;
import com.peanut.modules.book.entity.BookCategoryEntity;
import com.peanut.modules.book.entity.ShopCategoryEntity;
import java.util.List;
import java.util.Map;
public interface BookCategoryService extends IService<BookCategoryEntity> {
PageUtils queryPage(Map<String, Object> params);
List<BookCategoryEntity> getOneLevel();
void removeCheckByIds(List<String> asList);
List<BookCategoryEntity> listTree();
}

View File

@@ -0,0 +1,75 @@
package com.peanut.modules.book.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.Query;
import com.peanut.modules.book.dao.BookCategoryDao;
import com.peanut.modules.book.entity.BookCategoryEntity;
import com.peanut.modules.book.entity.ShopCategoryEntity;
import com.peanut.modules.book.service.BookCategoryService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service("bookCategoryService")
public class BookCategoryServiceImpl extends ServiceImpl<BookCategoryDao, BookCategoryEntity> implements BookCategoryService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
//分页
IPage<BookCategoryEntity> page = this.page(
new Query<BookCategoryEntity>().getPage(params),
new QueryWrapper<BookCategoryEntity>()
);
return new PageUtils(page);
}
@Override
public List<BookCategoryEntity> getOneLevel() {
//获取一级分类
return null;
}
@Override
public void removeCheckByIds(List<String> asList) {
//删除前查看是否有子目录
}
@Override
public List<BookCategoryEntity> listTree() {
List<BookCategoryEntity> entities = baseMapper.selectList(null);
List<BookCategoryEntity> level1 = entities.stream().filter((catalogueEntity) ->
catalogueEntity.getBookCid() == 0
).map((menu)->{
menu.setChildren(getChildrens(menu,entities));
return menu;
}).sorted((menu1,menu2)->{
return (menu1.getSort() == null? 0 : menu1.getSort()) - (menu2.getSort()==null?0:menu2.getSort());
}).collect(Collectors.toList());
return level1;
}
private List<BookCategoryEntity> getChildrens(BookCategoryEntity root,List<BookCategoryEntity> all){
List<BookCategoryEntity> children = all.stream().filter(catalogueEntity -> {
return root.getId().equals(catalogueEntity.getBookCid());
}).map(catalogueEntity -> {
catalogueEntity.setChildren(getChildrens(catalogueEntity, all));
return catalogueEntity;
}).sorted((menu1,menu2)->{
return (menu1.getSort()==null?0:menu1.getSort()) - (menu2.getSort()==null?0:menu2.getSort());
}).collect(Collectors.toList());
return children;
}
}

View File

@@ -1,7 +1,5 @@
package com.peanut.modules.book.service.impl;
import com.peanut.common.utils.FileDownloadUtil;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.BookChapterEntity;
import com.peanut.modules.book.entity.BookEntity;
import com.peanut.modules.book.service.BookChapterService;
@@ -12,7 +10,6 @@ import com.spire.doc.documents.Paragraph;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.text.BreakIterator;
import java.util.List;
@@ -22,13 +19,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.Query;
import com.peanut.modules.book.dao.BookChapterContentDao;
import com.peanut.modules.book.entity.BookChapterContentEntity;
import com.peanut.modules.book.service.BookChapterContentService;
import org.springframework.util.CollectionUtils;
@Service("bookChapterContentService")
public class BookChapterContentServiceImpl extends ServiceImpl<BookChapterContentDao, BookChapterContentEntity> implements BookChapterContentService {

View File

@@ -31,7 +31,7 @@ public class BookChapterServiceImpl extends ServiceImpl<BookChapterDao, BookChap
IPage<BookChapterEntity> page = this.page(
new Query<BookChapterEntity>().getPage(params),
//8.24修改根据number升序 排序
new QueryWrapper<BookChapterEntity>().eq("book_id",bookid).orderByAsc("number")
new QueryWrapper<BookChapterEntity>().eq("book_id",bookid).orderByDesc("number")
);
return new PageUtils(page);

View File

@@ -58,8 +58,10 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryDao, ShopCa
@Override
public List<ShopCategoryEntity> getOneLevel() {
// List<ShopCategoryEntity> list = this.list(new QueryWrapper<ShopCategoryEntity>().eq("parent_cid", 1).eq("show_status", 1));
List<ShopCategoryEntity> list = this.list(new QueryWrapper<ShopCategoryEntity>().eq("name", "医学视频").eq("show_status", 1));
List<ShopCategoryEntity> list = this.list(new QueryWrapper<ShopCategoryEntity>().eq("parent_cid", 1).eq("show_status", 1));
System.out.println("list=================================="+list);
// List<ShopCategoryEntity> list = this.list(new QueryWrapper<ShopCategoryEntity>().eq("name", "医学视频").eq("show_status", 1));
return list;
}

View File

@@ -26,7 +26,7 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new ExcludeEmptyQueryWrapper<ShopProductEntity>().like("product_name", params.get("key"))
.notLike("book_ids",",")
.notLike("book_ids",",").orderByDesc("sum_sales").eq("del_flag",0)
);
return new PageUtils(page);
}
@@ -35,7 +35,7 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
public PageUtils appQueryPage(Map<String, Object> params) {
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>()
new QueryWrapper<ShopProductEntity>().orderByDesc("create_time")
);
return new PageUtils(page);
}

View File

@@ -32,7 +32,6 @@ public class OssServiceImpl implements OssService {
InputStream inputStream = file.getInputStream();
//获取文件名称
String fileName = file.getOriginalFilename();
//1 在文件名称里面添加随机唯一的值
String uuid = UUID.randomUUID().toString().replaceAll("-","");
// yuy76t5rew01.jpg
@@ -59,6 +58,7 @@ public class OssServiceImpl implements OssService {
//需要把上传到阿里云oss路径手动拼接出来
// https://edu-guli-1010.oss-cn-beijing.aliyuncs.com/01.jpg
String url = "https://"+bucketName+"."+endpoint+"/"+fileName;
return url;
}catch(Exception e) {
e.printStackTrace();

View File

@@ -0,0 +1,20 @@
<?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="com.peanut.modules.book.dao.BookClockinCommentDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.peanut.modules.book.entity.BookCategoryEntity" id="categoryEntity">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="bookCid" column="book_cid"/>
<result property="bookLevel" column="book_level"/>
<result property="delFlag" column="del_flag"/>
<result property="sort" column="sort"/>
<result property="bookCount" column="book_count"/>
</resultMap>
</mapper>