Merge remote-tracking branch 'origin/master'
# Conflicts: # maku-framework/src/main/resources/auth.yml
This commit is contained in:
commit
4b175b085b
|
@ -10,4 +10,3 @@ auth:
|
||||||
- /sys/third/callback/**
|
- /sys/third/callback/**
|
||||||
- /sys/third/render/**
|
- /sys/third/render/**
|
||||||
- /upload/**
|
- /upload/**
|
||||||
- /
|
|
|
@ -10,3 +10,5 @@ auth:
|
||||||
- /doc.html
|
- /doc.html
|
||||||
- /
|
- /
|
||||||
- /user/login
|
- /user/login
|
||||||
|
- /maku/t_book/list/search
|
||||||
|
- /maku/t_book/{id}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.maku.maku.controller;
|
package net.maku.maku.controller;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.maku.framework.common.utils.PageResult;
|
import net.maku.framework.common.utils.PageResult;
|
||||||
|
@ -30,6 +31,33 @@ import java.util.List;
|
||||||
public class TBookController {
|
public class TBookController {
|
||||||
private final TBookService tBookService;
|
private final TBookService tBookService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "列表")
|
||||||
|
public Result<List<TBookEntity>> list() {
|
||||||
|
List<TBookEntity> list = tBookService.list();
|
||||||
|
|
||||||
|
return Result.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("")
|
||||||
|
@Operation(summary = "书籍")
|
||||||
|
@Parameter
|
||||||
|
public Result<TBookEntity> getById(@PathVariable Long id){
|
||||||
|
TBookEntity entity = tBookService.getById(id);
|
||||||
|
|
||||||
|
return Result.ok(entity);
|
||||||
|
}
|
||||||
|
@GetMapping("/list/search")
|
||||||
|
@Operation(summary = "根据书名查询书籍")
|
||||||
|
@Parameter
|
||||||
|
public Result<TBookEntity> getByName(@RequestParam String name){
|
||||||
|
TBookEntity entity = tBookService.getByName(name);
|
||||||
|
|
||||||
|
return Result.ok(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
@PreAuthorize("hasAuthority('maku:t_book:page')")
|
@PreAuthorize("hasAuthority('maku:t_book:page')")
|
||||||
|
@ -39,12 +67,12 @@ 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')")
|
||||||
public Result<TBookVO> get(@PathVariable("id") Long id){
|
public Result<TBookVO> get(@PathVariable("id") Long id){
|
||||||
TBookEntity entity = tBookService.getById(id);
|
TBookEntity entity = tBookService.getById(id);
|
||||||
|
|
||||||
return Result.ok(TBookConvert.INSTANCE.convert(entity));
|
return Result.ok(TBookConvert.INSTANCE.convert(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package net.maku.maku.controller;
|
package net.maku.maku.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
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;
|
||||||
|
@ -10,7 +13,9 @@ 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.TUserVO;
|
import net.maku.maku.vo.TUserVO;
|
||||||
|
import oracle.jdbc.proxy.annotation.Post;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -29,6 +34,55 @@ import java.util.List;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TUserController {
|
public class TUserController {
|
||||||
private final TUserService tUserService;
|
private final TUserService tUserService;
|
||||||
|
private final RedisCache redisCache;
|
||||||
|
|
||||||
|
@PostMapping("/register")
|
||||||
|
@Operation(summary = "注册")
|
||||||
|
public ResponseEntity<Result<String>> register(@RequestBody TUserEntity entity) {
|
||||||
|
TUserEntity existingUser = tUserService.login(entity);
|
||||||
|
if (existingUser != null) {
|
||||||
|
return ResponseEntity.badRequest().body(Result.error("用户名已存在"));
|
||||||
|
} else {
|
||||||
|
tUserService.save(entity);
|
||||||
|
return ResponseEntity.ok(Result.ok("注册成功"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/login")
|
||||||
|
@Operation(summary = "登录")
|
||||||
|
public Result login(@RequestBody TUserEntity entity){
|
||||||
|
TUserEntity entity1 = tUserService.login(entity);
|
||||||
|
if(ObjectUtils.isNotNull(entity1)){
|
||||||
|
return Result.ok(entity1);
|
||||||
|
}else {
|
||||||
|
return Result.error("登录失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/updateUser")
|
||||||
|
@Operation(summary = "修改")
|
||||||
|
public Result<TUserVO> updateUser(@RequestBody TUserVO vo){
|
||||||
|
TUserVO tUserVO = tUserService.updateUser(vo);
|
||||||
|
|
||||||
|
return Result.ok(tUserVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/logout")
|
||||||
|
@Operation(summary = "退出登录")
|
||||||
|
public Result<String> logout(HttpServletRequest request) {
|
||||||
|
String token = request.getHeader("token");
|
||||||
|
if (token == null) {
|
||||||
|
return Result.error("token为空");
|
||||||
|
}
|
||||||
|
Object o = redisCache.get(token);
|
||||||
|
if (o != null) {
|
||||||
|
redisCache.delete(token);
|
||||||
|
return Result.ok("退出登录");
|
||||||
|
}
|
||||||
|
return Result.error("登录失败");
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
|
@ -74,4 +128,6 @@ public class TUserController {
|
||||||
|
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package net.maku.maku.entity;
|
package net.maku.maku.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
|
@ -18,4 +18,8 @@ import java.util.Date;
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Schema(description = "查询")
|
@Schema(description = "查询")
|
||||||
public class TBookCollectionQuery extends Query {
|
public class TBookCollectionQuery extends Query {
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
private Integer userId;
|
||||||
|
@Schema(description = "书本id")
|
||||||
|
private Integer bookId;
|
||||||
}
|
}
|
|
@ -18,4 +18,10 @@ import java.util.Date;
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Schema(description = "查询")
|
@Schema(description = "查询")
|
||||||
public class TBookCommentQuery extends Query {
|
public class TBookCommentQuery extends Query {
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
private Integer userId;
|
||||||
|
@Schema(description = "书籍id")
|
||||||
|
private Integer bookId;
|
||||||
|
@Schema(description = "用户名")
|
||||||
|
private String userName;
|
||||||
}
|
}
|
|
@ -19,4 +19,6 @@ import java.util.Date;
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Schema(description = "查询")
|
@Schema(description = "查询")
|
||||||
public class TBookQuery extends Query {
|
public class TBookQuery extends Query {
|
||||||
|
private String author;
|
||||||
|
private String bookName;
|
||||||
}
|
}
|
|
@ -18,4 +18,8 @@ import java.math.BigDecimal;
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Schema(description = "查询")
|
@Schema(description = "查询")
|
||||||
public class TPurchaseDetailsQuery extends Query {
|
public class TPurchaseDetailsQuery extends Query {
|
||||||
|
@Schema(description = "订单编号")
|
||||||
|
private Integer purchaseId;
|
||||||
|
@Schema(description = "书本编号")
|
||||||
|
private Integer bookId;
|
||||||
}
|
}
|
|
@ -19,4 +19,6 @@ import java.util.Date;
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Schema(description = "查询")
|
@Schema(description = "查询")
|
||||||
public class TPurchaseQuery extends Query {
|
public class TPurchaseQuery extends Query {
|
||||||
|
private Integer id;
|
||||||
|
private BigDecimal totalPrice;
|
||||||
}
|
}
|
|
@ -18,4 +18,6 @@ import java.util.Date;
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Schema(description = "查询")
|
@Schema(description = "查询")
|
||||||
public class TShoppingTrolleyQuery extends Query {
|
public class TShoppingTrolleyQuery extends Query {
|
||||||
|
private Integer userId;
|
||||||
|
private Integer bookId;
|
||||||
}
|
}
|
|
@ -19,4 +19,6 @@ import java.util.Date;
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Schema(description = "查询")
|
@Schema(description = "查询")
|
||||||
public class TUserQuery extends Query {
|
public class TUserQuery extends Query {
|
||||||
|
private String username;
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
|
@ -23,4 +23,6 @@ public interface TBookService extends BaseService<TBookEntity> {
|
||||||
void update(TBookVO vo);
|
void update(TBookVO vo);
|
||||||
|
|
||||||
void delete(List<Long> idList);
|
void delete(List<Long> idList);
|
||||||
|
|
||||||
|
TBookEntity getByName(String name);
|
||||||
}
|
}
|
|
@ -23,4 +23,9 @@ public interface TUserService extends BaseService<TUserEntity> {
|
||||||
void update(TUserVO vo);
|
void update(TUserVO vo);
|
||||||
|
|
||||||
void delete(List<Long> idList);
|
void delete(List<Long> idList);
|
||||||
|
|
||||||
|
TUserEntity login(TUserEntity entity);
|
||||||
|
|
||||||
|
TUserVO updateUser(TUserVO vo);
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package net.maku.maku.service.impl;
|
package net.maku.maku.service.impl;
|
||||||
|
|
||||||
|
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;
|
||||||
|
@ -36,7 +37,8 @@ public class TBookCollectionServiceImpl extends BaseServiceImpl<TBookCollectionD
|
||||||
|
|
||||||
private LambdaQueryWrapper<TBookCollectionEntity> getWrapper(TBookCollectionQuery query){
|
private LambdaQueryWrapper<TBookCollectionEntity> getWrapper(TBookCollectionQuery query){
|
||||||
LambdaQueryWrapper<TBookCollectionEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TBookCollectionEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(ObjectUtils.isNotNull(query.getUserId()),TBookCollectionEntity::getUserId,query.getUserId());
|
||||||
|
wrapper.eq(ObjectUtils.isNotNull(query.getBookId()),TBookCollectionEntity::getBookId,query.getBookId());
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.maku.maku.service.impl;
|
package net.maku.maku.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
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;
|
||||||
|
@ -36,6 +37,8 @@ public class TBookCommentServiceImpl extends BaseServiceImpl<TBookCommentDao, TB
|
||||||
|
|
||||||
private LambdaQueryWrapper<TBookCommentEntity> getWrapper(TBookCommentQuery query){
|
private LambdaQueryWrapper<TBookCommentEntity> getWrapper(TBookCommentQuery query){
|
||||||
LambdaQueryWrapper<TBookCommentEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TBookCommentEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(ObjectUtil.isNotNull(query.getUserId()), TBookCommentEntity::getUserId, query.getUserId());
|
||||||
|
wrapper.eq(ObjectUtil.isNotNull(query.getBookId()), TBookCommentEntity::getBookId, query.getBookId());
|
||||||
|
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ public class TBookServiceImpl extends BaseServiceImpl<TBookDao, TBookEntity> imp
|
||||||
|
|
||||||
private LambdaQueryWrapper<TBookEntity> getWrapper(TBookQuery query){
|
private LambdaQueryWrapper<TBookEntity> getWrapper(TBookQuery query){
|
||||||
LambdaQueryWrapper<TBookEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TBookEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.like(TBookEntity::getBookName, query.getBookName());
|
||||||
|
wrapper.like(TBookEntity::getAuthor, query.getAuthor());
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,4 +61,12 @@ public class TBookServiceImpl extends BaseServiceImpl<TBookDao, TBookEntity> imp
|
||||||
removeByIds(idList);
|
removeByIds(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TBookEntity getByName(String name) {
|
||||||
|
LambdaQueryWrapper<TBookEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(TBookEntity::getBookName, name);
|
||||||
|
return baseMapper.selectOne(wrapper);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package net.maku.maku.service.impl;
|
package net.maku.maku.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
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;
|
||||||
|
@ -36,7 +37,8 @@ public class TPurchaseDetailsServiceImpl extends BaseServiceImpl<TPurchaseDetail
|
||||||
|
|
||||||
private LambdaQueryWrapper<TPurchaseDetailsEntity> getWrapper(TPurchaseDetailsQuery query){
|
private LambdaQueryWrapper<TPurchaseDetailsEntity> getWrapper(TPurchaseDetailsQuery query){
|
||||||
LambdaQueryWrapper<TPurchaseDetailsEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TPurchaseDetailsEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(ObjectUtil.isNotNull(query.getPurchaseId()),TPurchaseDetailsEntity::getPurchaseId,query.getPurchaseId());
|
||||||
|
wrapper.eq(ObjectUtil.isNotNull(query.getBookId()),TPurchaseDetailsEntity::getBookId,query.getBookId());
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.maku.maku.service.impl;
|
package net.maku.maku.service.impl;
|
||||||
|
|
||||||
|
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;
|
||||||
|
@ -36,7 +37,8 @@ public class TPurchaseServiceImpl extends BaseServiceImpl<TPurchaseDao, TPurchas
|
||||||
|
|
||||||
private LambdaQueryWrapper<TPurchaseEntity> getWrapper(TPurchaseQuery query){
|
private LambdaQueryWrapper<TPurchaseEntity> getWrapper(TPurchaseQuery query){
|
||||||
LambdaQueryWrapper<TPurchaseEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TPurchaseEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(ObjectUtils.isNotNull(query.getId()),TPurchaseEntity::getId,query.getId());
|
||||||
|
wrapper.eq(ObjectUtils.isNotNull(query.getTotalPrice()),TPurchaseEntity::getTotalPrice, query.getTotalPrice());
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.maku.maku.service.impl;
|
package net.maku.maku.service.impl;
|
||||||
|
|
||||||
|
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;
|
||||||
|
@ -36,7 +37,8 @@ public class TShoppingTrolleyServiceImpl extends BaseServiceImpl<TShoppingTrolle
|
||||||
|
|
||||||
private LambdaQueryWrapper<TShoppingTrolleyEntity> getWrapper(TShoppingTrolleyQuery query){
|
private LambdaQueryWrapper<TShoppingTrolleyEntity> getWrapper(TShoppingTrolleyQuery query){
|
||||||
LambdaQueryWrapper<TShoppingTrolleyEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TShoppingTrolleyEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(ObjectUtils.isNotNull(query.getUserId()), TShoppingTrolleyEntity::getUserId,query.getUserId());
|
||||||
|
wrapper.eq(ObjectUtils.isNotNull(query.getBookId()),TShoppingTrolleyEntity::getBookId, query.getBookId());
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package net.maku.maku.service.impl;
|
package net.maku.maku.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
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;
|
||||||
|
@ -16,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -36,6 +39,8 @@ public class TUserServiceImpl extends BaseServiceImpl<TUserDao, TUserEntity> imp
|
||||||
|
|
||||||
private LambdaQueryWrapper<TUserEntity> getWrapper(TUserQuery query){
|
private LambdaQueryWrapper<TUserEntity> getWrapper(TUserQuery query){
|
||||||
LambdaQueryWrapper<TUserEntity> wrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TUserEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.like(TUserEntity::getUsername, query.getUsername());
|
||||||
|
wrapper.eq(ObjectUtil.isNotNull(query.getStatus()), TUserEntity::getStatus, query.getStatus());
|
||||||
|
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
@ -60,4 +65,28 @@ public class TUserServiceImpl extends BaseServiceImpl<TUserDao, TUserEntity> imp
|
||||||
removeByIds(idList);
|
removeByIds(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TUserEntity login(TUserEntity entity) {
|
||||||
|
LambdaQueryWrapper<TUserEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(TUserEntity::getUsername, entity.getUsername());
|
||||||
|
wrapper.eq(TUserEntity::getPassword, entity.getPassword());
|
||||||
|
TUserEntity one = getOne(wrapper);
|
||||||
|
if(ObjectUtils.isNotNull(one)) {
|
||||||
|
UUID uuid = UUID.randomUUID();
|
||||||
|
one.setAvatar(uuid.toString());
|
||||||
|
updateById(one);
|
||||||
|
return one;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TUserVO updateUser(TUserVO vo) {
|
||||||
|
TUserEntity entity = new TUserEntity();
|
||||||
|
entity.setUsername(vo.getUsername());
|
||||||
|
entity.setPassword(vo.getPassword());
|
||||||
|
updateById(entity);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,9 +2,9 @@ spring:
|
||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
database: 0
|
database: 0
|
||||||
host: 127.0.0.1
|
host: localhost
|
||||||
port: 6379
|
port: 6379
|
||||||
# password: wxbc5b16589b8f183e
|
# password: 123456
|
||||||
#timeout: 6000ms # 连接超时时长(毫秒)
|
#timeout: 6000ms # 连接超时时长(毫秒)
|
||||||
datasource:
|
datasource:
|
||||||
dynamic:
|
dynamic:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user