zyh
This commit is contained in:
parent
49d75b44e1
commit
c60d3bdc64
|
@ -44,12 +44,12 @@ public abstract class BaseEntity implements TransPojo {
|
|||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
@Version
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Integer version;
|
||||
// /**
|
||||
// * 版本号
|
||||
// */
|
||||
// @Version
|
||||
// @TableField(fill = FieldFill.INSERT)
|
||||
// private Integer version;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
|
|
|
@ -8,11 +8,7 @@ auth:
|
|||
- /swagger-ui.html
|
||||
- /swagger-ui/**
|
||||
- /doc.html
|
||||
- /maku/t_user/login
|
||||
- /maku/t_user/updateUser
|
||||
- /maku/t_user/register
|
||||
- /maku/t_user/logout
|
||||
- /maku/t_user/info
|
||||
- /maku/t_user/**
|
||||
- /maku/t_book/list/search
|
||||
- /maku/t_book/{id}
|
||||
- /maku/t_book/{id}
|
||||
|
|
|
@ -47,7 +47,6 @@ public class TBookController {
|
|||
@Operation(summary = "列表")
|
||||
public Result<List<TBookEntity>> list() {
|
||||
List<TBookEntity> list = tBookService.list();
|
||||
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
|
@ -56,7 +55,6 @@ public class TBookController {
|
|||
@Parameter
|
||||
public Result<TBookEntity> getById(@PathVariable Long id){
|
||||
TBookEntity entity = tBookService.getById(id);
|
||||
|
||||
return Result.ok(entity);
|
||||
}
|
||||
@GetMapping("/list/search")
|
||||
|
@ -64,11 +62,11 @@ public class TBookController {
|
|||
@Parameter
|
||||
public Result<TBookEntity> getByName(@RequestParam String name){
|
||||
TBookEntity entity = tBookService.getByName(name);
|
||||
|
||||
return Result.ok(entity);
|
||||
}
|
||||
|
||||
@GetMapping("/collection")
|
||||
@Operation(summary = "收藏图书")
|
||||
public Result setbookcollection(HttpServletRequest request, @RequestParam Integer bookId) {
|
||||
// 首先验证token的有效性,然后从Redis中获取用户信息
|
||||
String token = request.getHeader("token");
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package net.maku.maku.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -11,25 +9,18 @@ import net.maku.framework.common.cache.RedisCache;
|
|||
import net.maku.framework.common.utils.PageResult;
|
||||
import net.maku.framework.common.utils.Result;
|
||||
import net.maku.maku.convert.TUserConvert;
|
||||
import net.maku.maku.entity.TBookCollectionEntity;
|
||||
import net.maku.maku.entity.TUserEntity;
|
||||
import net.maku.maku.service.TUserService;
|
||||
import net.maku.maku.query.TUserQuery;
|
||||
import net.maku.maku.vo.TBookCollectionVO;
|
||||
import net.maku.maku.vo.TUserVO;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static java.util.Collections.list;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
@ -129,7 +120,6 @@ public class TUserController {
|
|||
|
||||
return Result.ok(TUserConvert.INSTANCE.convert(entity));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
@PreAuthorize("hasAuthority('maku:t_user:save')")
|
||||
|
@ -138,7 +128,6 @@ public class TUserController {
|
|||
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
@PreAuthorize("hasAuthority('maku:t_user:update')")
|
||||
|
|
|
@ -3,6 +3,8 @@ package net.maku.maku.entity;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import net.maku.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -15,9 +17,9 @@ import java.util.Date;
|
|||
|
||||
@Data
|
||||
@TableName("t_book")
|
||||
public class TBookEntity {
|
||||
@TableId
|
||||
private Integer id;
|
||||
public class TBookEntity extends BaseEntity {
|
||||
|
||||
|
||||
|
||||
private String bookName;
|
||||
|
||||
|
@ -29,12 +31,11 @@ public class TBookEntity {
|
|||
|
||||
private String introduction;
|
||||
|
||||
private Integer category;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer store;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
package net.maku.maku.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.maku.framework.common.exception.ServerException;
|
||||
import net.maku.framework.common.utils.PageResult;
|
||||
import net.maku.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.maku.maku.convert.TBookConvert;
|
||||
|
@ -65,7 +67,12 @@ public class TBookServiceImpl extends BaseServiceImpl<TBookDao, TBookEntity> imp
|
|||
public TBookEntity getByName(String bookName) {
|
||||
LambdaQueryWrapper<TBookEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TBookEntity::getBookName, bookName);
|
||||
return baseMapper.selectOne(wrapper);
|
||||
TBookEntity tBookEntity = baseMapper.selectOne(wrapper);
|
||||
if (ObjectUtil.isNull(tBookEntity)){
|
||||
throw new ServerException("没有找到书籍");
|
||||
}
|
||||
tBookEntity.setBookCover("obhhi");
|
||||
return tBookEntity;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ public class TBookVO implements Serializable {
|
|||
|
||||
private String bookCover;
|
||||
|
||||
private String category;
|
||||
|
||||
private String introduction;
|
||||
|
||||
private String description;
|
||||
|
|
Loading…
Reference in New Issue
Block a user