clock打卡

This commit is contained in:
wangjinlei
2023-10-10 14:04:34 +08:00
parent 4de14d9eed
commit 9d700af56e
3 changed files with 88 additions and 5 deletions

View File

@@ -0,0 +1,76 @@
package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.BookClockEntryEntity;
import com.peanut.modules.book.service.BookClockEntryChatService;
import com.peanut.modules.book.service.BookClockEntryService;
import com.peanut.modules.book.service.UserBookClockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("book/clock")
public class UserClockController {
@Autowired
private UserBookClockService userBookClockService;
@Autowired
private BookClockEntryService bookClockEntryService;
@Autowired
private BookClockEntryChatService bookClockEntryChatService;
/**
* 获取书打卡列表
* @param bookId
* @param limit
* @param page
* @return
*/
@RequestMapping("/getBookClocks")
public R getBookClocks(@RequestParam Integer bookId,@RequestParam Integer limit,@RequestParam Integer page){
LambdaQueryWrapper<BookClockEntryEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookClockEntryEntity::getBookId,bookId);
wrapper.eq(BookClockEntryEntity::getDelFlag,0);
wrapper.orderByAsc(BookClockEntryEntity::getDay);
Page<BookClockEntryEntity> bookClockEntryEntityPage = bookClockEntryService.getBaseMapper().selectPage(new Page<BookClockEntryEntity>(page, limit), wrapper);
return R.ok().put("page",bookClockEntryEntityPage);
}
/**
* 新增读书打卡
* @param bookClockEntry
* @return
*/
@RequestMapping("/addBookClock")
public R addBookClock(@RequestBody BookClockEntryEntity bookClockEntry){
bookClockEntryService.save(bookClockEntry);
return R.ok();
}
/**
* 删除读书打卡
* @param entryId
* @return
*/
@RequestMapping("/delBookClock")
public R delBookClock(@RequestParam Integer entryId){
bookClockEntryService.removeById(entryId);
return R.ok();
}
/**
* 修改读书打卡
* @return
*/
@RequestMapping("/updateBookClock")
public R updateBookClock(@RequestBody BookClockEntryEntity bookClockEntry){
bookClockEntryService.updateById(bookClockEntry);
return R.ok();
}
}

View File

@@ -9,7 +9,7 @@ import java.io.Serializable;
import java.util.Date;
@Data
@TableName("user_clock_entry")
@TableName("book_clock_entry")
public class BookClockEntryEntity implements Serializable {
private static final long serialVersionUID = 1L;
@@ -19,6 +19,10 @@ public class BookClockEntryEntity implements Serializable {
private Integer bookId;
private String image;
private String video;
private String content;
private Date createTime;