Fixing .gitignore
This commit is contained in:
@@ -1,171 +1,171 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BookEntity;
|
||||
import com.peanut.modules.book.entity.UserEbookBuyEntity;
|
||||
import com.peanut.modules.book.service.BookService;
|
||||
import com.peanut.modules.book.service.UserEbookBuyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* 用户购买书籍表
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("book/userebookbuy")
|
||||
public class UserEbookBuyController {
|
||||
@Autowired
|
||||
private UserEbookBuyService userEbookBuyService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
String userId = (String) params.get("userId");
|
||||
PageUtils page = userEbookBuyService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/appbooklist")
|
||||
|
||||
public R appbooklist(@RequestParam("userId") Integer userId) {
|
||||
String user = String.valueOf(userId);
|
||||
ArrayList<Object> maplist = new ArrayList<>();
|
||||
ArrayList<Integer> list = new ArrayList<>();
|
||||
|
||||
List<UserEbookBuyEntity> user_id = userEbookBuyService.getBaseMapper().selectList(new QueryWrapper<UserEbookBuyEntity>().eq("user_id", user));
|
||||
|
||||
if (user_id==null){
|
||||
return R.error("您打卡列表暂未添加内容");
|
||||
|
||||
}
|
||||
for (UserEbookBuyEntity userEbookBuyEntity : user_id) {
|
||||
Integer bookId = userEbookBuyEntity.getBookId();
|
||||
list.add(bookId);
|
||||
|
||||
}
|
||||
int index =0;
|
||||
|
||||
for (Object S : list) {
|
||||
|
||||
List<BookEntity> books = bookService.getBaseMapper().selectList(new QueryWrapper<BookEntity>()
|
||||
.eq("clock_in", 1)
|
||||
.eq("id", S));
|
||||
for (BookEntity book : books) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
Integer id = book.getId();
|
||||
|
||||
map.put("book",book);
|
||||
index++;
|
||||
maplist.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (maplist==null&&maplist.size() > 0){
|
||||
return R.error("您暂未参与打卡");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return R.ok().put("resultlist",maplist).put("total",index);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/buylist")
|
||||
public R buylist(@RequestParam Map<String, Object> params){
|
||||
String userId = (String) params.get("id");
|
||||
List list = new ArrayList<>();
|
||||
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 userId1 = userEbookBuyEntity.getUserId();
|
||||
Integer bookId = userEbookBuyEntity.getBookId();
|
||||
Integer buyId = userEbookBuyEntity.getBuyId();
|
||||
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",name1);
|
||||
map.put("buyId",buyId);
|
||||
map.put("image",images);
|
||||
// map.put("author",author);
|
||||
|
||||
list.add(map);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Collections.reverse(list);
|
||||
return R.ok().put("page", list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{buyId}")
|
||||
public R info(@PathVariable("buyId") Integer buyId){
|
||||
UserEbookBuyEntity userEbookBuy = userEbookBuyService.getById(buyId);
|
||||
|
||||
return R.ok().put("userEbookBuy", userEbookBuy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody UserEbookBuyEntity userEbookBuy){
|
||||
|
||||
userEbookBuyService.save(userEbookBuy);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody UserEbookBuyEntity userEbookBuy){
|
||||
userEbookBuyService.updateById(userEbookBuy);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] buyIds){
|
||||
userEbookBuyService.removeByIds(Arrays.asList(buyIds));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BookEntity;
|
||||
import com.peanut.modules.book.entity.UserEbookBuyEntity;
|
||||
import com.peanut.modules.book.service.BookService;
|
||||
import com.peanut.modules.book.service.UserEbookBuyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* 用户购买书籍表
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("book/userebookbuy")
|
||||
public class UserEbookBuyController {
|
||||
@Autowired
|
||||
private UserEbookBuyService userEbookBuyService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
String userId = (String) params.get("userId");
|
||||
PageUtils page = userEbookBuyService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/appbooklist")
|
||||
|
||||
public R appbooklist(@RequestParam("userId") Integer userId) {
|
||||
String user = String.valueOf(userId);
|
||||
ArrayList<Object> maplist = new ArrayList<>();
|
||||
ArrayList<Integer> list = new ArrayList<>();
|
||||
|
||||
List<UserEbookBuyEntity> user_id = userEbookBuyService.getBaseMapper().selectList(new QueryWrapper<UserEbookBuyEntity>().eq("user_id", user));
|
||||
|
||||
if (user_id==null){
|
||||
return R.error("您打卡列表暂未添加内容");
|
||||
|
||||
}
|
||||
for (UserEbookBuyEntity userEbookBuyEntity : user_id) {
|
||||
Integer bookId = userEbookBuyEntity.getBookId();
|
||||
list.add(bookId);
|
||||
|
||||
}
|
||||
int index =0;
|
||||
|
||||
for (Object S : list) {
|
||||
|
||||
List<BookEntity> books = bookService.getBaseMapper().selectList(new QueryWrapper<BookEntity>()
|
||||
.eq("clock_in", 1)
|
||||
.eq("id", S));
|
||||
for (BookEntity book : books) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
Integer id = book.getId();
|
||||
|
||||
map.put("book",book);
|
||||
index++;
|
||||
maplist.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (maplist==null&&maplist.size() > 0){
|
||||
return R.error("您暂未参与打卡");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return R.ok().put("resultlist",maplist).put("total",index);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/buylist")
|
||||
public R buylist(@RequestParam Map<String, Object> params){
|
||||
String userId = (String) params.get("id");
|
||||
List list = new ArrayList<>();
|
||||
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 userId1 = userEbookBuyEntity.getUserId();
|
||||
Integer bookId = userEbookBuyEntity.getBookId();
|
||||
Integer buyId = userEbookBuyEntity.getBuyId();
|
||||
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",name1);
|
||||
map.put("buyId",buyId);
|
||||
map.put("image",images);
|
||||
// map.put("author",author);
|
||||
|
||||
list.add(map);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Collections.reverse(list);
|
||||
return R.ok().put("page", list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{buyId}")
|
||||
public R info(@PathVariable("buyId") Integer buyId){
|
||||
UserEbookBuyEntity userEbookBuy = userEbookBuyService.getById(buyId);
|
||||
|
||||
return R.ok().put("userEbookBuy", userEbookBuy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody UserEbookBuyEntity userEbookBuy){
|
||||
|
||||
userEbookBuyService.save(userEbookBuy);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody UserEbookBuyEntity userEbookBuy){
|
||||
userEbookBuyService.updateById(userEbookBuy);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] buyIds){
|
||||
userEbookBuyService.removeByIds(Arrays.asList(buyIds));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user