Compare commits
No commits in common. "ce0d641770e1ac8428378960e2e0764b27e05576" and "a487ac06f6251ff67a85a8aabcfe28c910b65141" have entirely different histories.
ce0d641770
...
a487ac06f6
|
@ -13,5 +13,4 @@ auth:
|
||||||
- /maku/t_user/updateUser
|
- /maku/t_user/updateUser
|
||||||
- /maku/t_user/register
|
- /maku/t_user/register
|
||||||
- /maku/t_user/logout
|
- /maku/t_user/logout
|
||||||
- /maku/t_user/info
|
- /maku/t_user/info
|
||||||
- /maku/t_user/recharge
|
|
|
@ -29,11 +29,6 @@ import java.util.List;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TBookCollectionController {
|
public class TBookCollectionController {
|
||||||
private final TBookCollectionService tBookCollectionService;
|
private final TBookCollectionService tBookCollectionService;
|
||||||
@GetMapping("/book/buy")
|
|
||||||
@Operation(summary = "购买书籍")
|
|
||||||
public Result<List<TBookCollectionVO>> getBookCollectionByUserId(@PathVariable Long id) {
|
|
||||||
return Result.ok(tBookCollectionService.getPhoneByUseId(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
|
|
|
@ -48,11 +48,12 @@ public class TBookCommentController {
|
||||||
return Result.ok(TBookCommentConvert.INSTANCE.convert(entity));
|
return Result.ok(TBookCommentConvert.INSTANCE.convert(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/comment")
|
@PostMapping
|
||||||
@Operation(summary = "保存")
|
@Operation(summary = "保存")
|
||||||
@PreAuthorize("hasAuthority('maku:t_book_comment:save')")
|
@PreAuthorize("hasAuthority('maku:t_book_comment:save')")
|
||||||
public Result<String> save(@RequestBody TBookCommentVO vo){
|
public Result<String> save(@RequestBody TBookCommentVO vo){
|
||||||
tBookCommentService.save(vo);
|
tBookCommentService.save(vo);
|
||||||
|
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,14 @@ public class TBookController {
|
||||||
@GetMapping("/list/search")
|
@GetMapping("/list/search")
|
||||||
@Operation(summary = "根据书名查询书籍")
|
@Operation(summary = "根据书名查询书籍")
|
||||||
@Parameter
|
@Parameter
|
||||||
public Result<TBookEntity> getByName(@RequestParam String bookName){
|
public Result<TBookEntity> getByName(@RequestParam String name){
|
||||||
TBookEntity entity = tBookService.getByName(bookName);
|
TBookEntity entity = tBookService.getByName(name);
|
||||||
|
|
||||||
return Result.ok(entity);
|
return Result.ok(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
@PreAuthorize("hasAuthority('maku:t_book:page')")
|
@PreAuthorize("hasAuthority('maku:t_book:page')")
|
||||||
|
@ -62,6 +66,8 @@ public class TBookController {
|
||||||
|
|
||||||
return Result.ok(page);
|
return Result.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@Operation(summary = "信息")
|
@Operation(summary = "信息")
|
||||||
// @PreAuthorize("hasAuthority('maku:t_book:info')")
|
// @PreAuthorize("hasAuthority('maku:t_book:info')")
|
||||||
|
@ -69,6 +75,7 @@ public class TBookController {
|
||||||
TBookEntity entity = tBookService.getById(id);
|
TBookEntity entity = tBookService.getById(id);
|
||||||
return Result.ok(TBookConvert.INSTANCE.convert(entity));
|
return Result.ok(TBookConvert.INSTANCE.convert(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Operation(summary = "保存")
|
@Operation(summary = "保存")
|
||||||
@PreAuthorize("hasAuthority('maku:t_book:save')")
|
@PreAuthorize("hasAuthority('maku:t_book:save')")
|
||||||
|
|
|
@ -11,11 +11,9 @@ import net.maku.framework.common.cache.RedisCache;
|
||||||
import net.maku.framework.common.utils.PageResult;
|
import net.maku.framework.common.utils.PageResult;
|
||||||
import net.maku.framework.common.utils.Result;
|
import net.maku.framework.common.utils.Result;
|
||||||
import net.maku.maku.convert.TUserConvert;
|
import net.maku.maku.convert.TUserConvert;
|
||||||
import net.maku.maku.entity.TBookCollectionEntity;
|
|
||||||
import net.maku.maku.entity.TUserEntity;
|
import net.maku.maku.entity.TUserEntity;
|
||||||
import net.maku.maku.service.TUserService;
|
import net.maku.maku.service.TUserService;
|
||||||
import net.maku.maku.query.TUserQuery;
|
import net.maku.maku.query.TUserQuery;
|
||||||
import net.maku.maku.vo.TBookCollectionVO;
|
|
||||||
import net.maku.maku.vo.TUserVO;
|
import net.maku.maku.vo.TUserVO;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
@ -28,8 +26,6 @@ import java.time.Duration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static java.util.Collections.list;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -60,7 +56,7 @@ public class TUserController {
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@Operation(summary = "登录")
|
@Operation(summary = "登录")
|
||||||
public Result<String> login(@RequestBody TUserEntity entity){
|
public Result login(@RequestBody TUserEntity entity){
|
||||||
TUserEntity entity1 = tUserService.login(entity);
|
TUserEntity entity1 = tUserService.login(entity);
|
||||||
if(ObjectUtils.isNotNull(entity1)){
|
if(ObjectUtils.isNotNull(entity1)){
|
||||||
String token = UUID.randomUUID()+"";
|
String token = UUID.randomUUID()+"";
|
||||||
|
@ -82,23 +78,12 @@ public class TUserController {
|
||||||
|
|
||||||
@GetMapping("/info")
|
@GetMapping("/info")
|
||||||
@Operation(summary = "用户中心")
|
@Operation(summary = "用户中心")
|
||||||
public Result<TUserEntity> findByUsername(HttpServletRequest request){
|
public Result findByUsername(HttpServletRequest request){
|
||||||
String token = request.getHeader("token");
|
String token = request.getHeader("token");
|
||||||
TUserEntity entity = (TUserEntity) redisCache.get(token);
|
TUserEntity entity = (TUserEntity) redisCache.get(token);
|
||||||
return Result.ok(entity);
|
return Result.ok(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/recharge")
|
|
||||||
@Operation(summary = "充值")
|
|
||||||
public Result<String> recharge(HttpServletRequest request,@RequestParam(value = "balance",required =false) int balance){
|
|
||||||
String token = request.getHeader("token");
|
|
||||||
TUserEntity entity = (TUserEntity) redisCache.get(token);;
|
|
||||||
int money=entity.getBalance();
|
|
||||||
entity.setBalance(money+balance);
|
|
||||||
tUserService.updateById(entity);
|
|
||||||
return Result.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/logout")
|
@PostMapping("/logout")
|
||||||
@Operation(summary = "退出登录")
|
@Operation(summary = "退出登录")
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class TUserEntity {
|
||||||
|
|
||||||
private String avatar;
|
private String avatar;
|
||||||
|
|
||||||
private int balance;
|
private BigDecimal balance;
|
||||||
|
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,4 @@ public interface TBookCollectionService extends BaseService<TBookCollectionEntit
|
||||||
void update(TBookCollectionVO vo);
|
void update(TBookCollectionVO vo);
|
||||||
|
|
||||||
void delete(List<Long> idList);
|
void delete(List<Long> idList);
|
||||||
|
|
||||||
List<TBookCollectionVO> getPhoneByUseId(Long id);
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,5 +24,5 @@ public interface TBookService extends BaseService<TBookEntity> {
|
||||||
|
|
||||||
void delete(List<Long> idList);
|
void delete(List<Long> idList);
|
||||||
|
|
||||||
TBookEntity getByName(String bookName);
|
TBookEntity getByName(String name);
|
||||||
}
|
}
|
|
@ -4,23 +4,18 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.maku.framework.common.utils.PageResult;
|
import net.maku.framework.common.utils.PageResult;
|
||||||
import net.maku.framework.mybatis.service.impl.BaseServiceImpl;
|
import net.maku.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
import net.maku.maku.convert.TBookCollectionConvert;
|
import net.maku.maku.convert.TBookCollectionConvert;
|
||||||
import net.maku.maku.entity.TBookCollectionEntity;
|
import net.maku.maku.entity.TBookCollectionEntity;
|
||||||
import net.maku.maku.entity.TBookEntity;
|
|
||||||
import net.maku.maku.entity.TUserEntity;
|
|
||||||
import net.maku.maku.query.TBookCollectionQuery;
|
import net.maku.maku.query.TBookCollectionQuery;
|
||||||
import net.maku.maku.service.TUserService;
|
|
||||||
import net.maku.maku.vo.TBookCollectionVO;
|
import net.maku.maku.vo.TBookCollectionVO;
|
||||||
import net.maku.maku.dao.TBookCollectionDao;
|
import net.maku.maku.dao.TBookCollectionDao;
|
||||||
import net.maku.maku.service.TBookCollectionService;
|
import net.maku.maku.service.TBookCollectionService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +28,6 @@ import java.util.List;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TBookCollectionServiceImpl extends BaseServiceImpl<TBookCollectionDao, TBookCollectionEntity> implements TBookCollectionService {
|
public class TBookCollectionServiceImpl extends BaseServiceImpl<TBookCollectionDao, TBookCollectionEntity> implements TBookCollectionService {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<TBookCollectionVO> page(TBookCollectionQuery query) {
|
public PageResult<TBookCollectionVO> page(TBookCollectionQuery query) {
|
||||||
IPage<TBookCollectionEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
IPage<TBookCollectionEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||||
|
@ -68,10 +62,4 @@ public class TBookCollectionServiceImpl extends BaseServiceImpl<TBookCollectionD
|
||||||
removeByIds(idList);
|
removeByIds(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TBookCollectionVO> getPhoneByUseId(Long id) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -62,9 +62,9 @@ public class TBookServiceImpl extends BaseServiceImpl<TBookDao, TBookEntity> imp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TBookEntity getByName(String bookName) {
|
public TBookEntity getByName(String name) {
|
||||||
LambdaQueryWrapper<TBookEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TBookEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
wrapper.eq(TBookEntity::getBookName, bookName);
|
wrapper.eq(TBookEntity::getBookName, name);
|
||||||
return baseMapper.selectOne(wrapper);
|
return baseMapper.selectOne(wrapper);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ spring:
|
||||||
database: 0
|
database: 0
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 6379
|
port: 6379
|
||||||
password: 123456
|
# password: 123456
|
||||||
#timeout: 6000ms # 连接超时时长(毫秒)
|
#timeout: 6000ms # 连接超时时长(毫秒)
|
||||||
datasource:
|
datasource:
|
||||||
dynamic:
|
dynamic:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user