mirror of
https://github.com/201206030/novel-cloud.git
synced 2025-08-24 17:42:42 +00:00
refactor: 基于 novel 项目 & Spring Cloud 2022 & Spring Cloud Alibaba 2022 重构
This commit is contained in:
35
novel-user/novel-user-api/pom.xml
Normal file
35
novel-user/novel-user-api/pom.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>novel-user</artifactId>
|
||||
<groupId>io.github.xxyopen</groupId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>novel-user-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.github.xxyopen</groupId>
|
||||
<artifactId>novel-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@@ -0,0 +1,26 @@
|
||||
package io.github.xxyopen.novel.user.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户信息 DTO
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/18
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class UserInfoDto implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Integer status;
|
||||
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package io.github.xxyopen.novel.user.dto.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* 用户信息更新 请求DTO
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/17
|
||||
*/
|
||||
@Data
|
||||
public class UserInfoUptReqDto {
|
||||
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "昵称")
|
||||
@Length(min = 2,max = 10)
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "头像地址")
|
||||
@Pattern(regexp="^/[^\s]{10,}\\.(png|PNG|jpg|JPG|jpeg|JPEG|gif|GIF|bpm|BPM)$")
|
||||
private String userPhoto;
|
||||
|
||||
@Schema(description = "性别")
|
||||
@Min(value = 0)
|
||||
@Max(value = 1)
|
||||
private Integer userSex;
|
||||
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package io.github.xxyopen.novel.user.dto.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户登录 请求DTO
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/16
|
||||
*/
|
||||
@Data
|
||||
public class UserLoginReqDto {
|
||||
|
||||
@Schema(description = "手机号", required = true, example = "18888888888")
|
||||
@NotBlank(message = "手机号不能为空!")
|
||||
@Pattern(regexp = "^1[3|4|5|6|7|8|9][0-9]{9}$", message = "手机号格式不正确!")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "密码", required = true, example = "123456")
|
||||
@NotBlank(message = "密码不能为空!")
|
||||
private String password;
|
||||
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package io.github.xxyopen.novel.user.dto.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* 用户注册 请求DTO
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/16
|
||||
*/
|
||||
@Data
|
||||
public class UserRegisterReqDto {
|
||||
|
||||
@Schema(description = "手机号", required = true)
|
||||
@NotBlank(message="手机号不能为空!")
|
||||
@Pattern(regexp="^1[3|4|5|6|7|8|9][0-9]{9}$",message="手机号格式不正确!")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "密码", required = true)
|
||||
@NotBlank(message="密码不能为空!")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "验证码", required = true)
|
||||
@NotBlank(message="验证码不能为空!")
|
||||
@Pattern(regexp="^\\d{4}$",message="验证码格式不正确!")
|
||||
private String velCode;
|
||||
|
||||
/**
|
||||
* 请求会话标识,用来标识图形验证码属于哪个会话
|
||||
* */
|
||||
@Schema(description = "sessionId", required = true)
|
||||
@NotBlank
|
||||
@Length(min = 32,max = 32)
|
||||
private String sessionId;
|
||||
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package io.github.xxyopen.novel.user.dto.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户信息 响应DTO
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/22
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class UserInfoRespDto {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
* */
|
||||
@Schema(description = "昵称")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
* */
|
||||
@Schema(description = "用户头像")
|
||||
private String userPhoto;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
* */
|
||||
@Schema(description = "用户性别")
|
||||
private Integer userSex;
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package io.github.xxyopen.novel.user.dto.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户登录 响应DTO
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class UserLoginRespDto {
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "用户昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "用户token")
|
||||
private String token;
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package io.github.xxyopen.novel.user.dto.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户注册 响应DTO
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class UserRegisterRespDto {
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "用户token")
|
||||
private String token;
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package io.github.xxyopen.novel.user.feign;
|
||||
|
||||
import io.github.xxyopen.novel.common.constant.ApiRouterConsts;
|
||||
import io.github.xxyopen.novel.common.resp.RestResp;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserInfoRespDto;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户微服务调用客户端
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2023/3/29
|
||||
*/
|
||||
@Component
|
||||
@FeignClient(value = "novel-user-service", fallback = UserFeign.UserFeignFallback.class)
|
||||
public interface UserFeign {
|
||||
|
||||
/**
|
||||
* 批量查询用户信息
|
||||
*/
|
||||
@PostMapping(ApiRouterConsts.API_INNER_USER_URL_PREFIX + "/listUserInfoByIds")
|
||||
RestResp<List<UserInfoRespDto>> listUserInfoByIds(List<Long> userIds);
|
||||
|
||||
@Component
|
||||
class UserFeignFallback implements UserFeign {
|
||||
|
||||
@Override
|
||||
public RestResp<List<UserInfoRespDto>> listUserInfoByIds(List<Long> userIds) {
|
||||
|
||||
return RestResp.ok(new ArrayList<>(0));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
53
novel-user/novel-user-service/pom.xml
Normal file
53
novel-user/novel-user-service/pom.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>novel-user</artifactId>
|
||||
<groupId>io.github.xxyopen</groupId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>novel-user-service</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.github.xxyopen</groupId>
|
||||
<artifactId>novel-book-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.xxyopen</groupId>
|
||||
<artifactId>novel-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.xxyopen</groupId>
|
||||
<artifactId>novel-user-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@@ -0,0 +1,22 @@
|
||||
package io.github.xxyopen.novel.user;
|
||||
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"io.github.xxyopen.novel"})
|
||||
@MapperScan("io.github.xxyopen.novel.user.dao.mapper")
|
||||
@EnableCaching
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = {"io.github.xxyopen.novel.book.feign"})
|
||||
public class NovelUserApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(NovelUserApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
package io.github.xxyopen.novel.user.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.github.xxyopen.novel.common.auth.JwtUtils;
|
||||
import io.github.xxyopen.novel.common.auth.UserHolder;
|
||||
import io.github.xxyopen.novel.common.constant.ErrorCodeEnum;
|
||||
import io.github.xxyopen.novel.common.constant.SystemConfigConsts;
|
||||
import io.github.xxyopen.novel.config.exception.BusinessException;
|
||||
import io.github.xxyopen.novel.user.dto.UserInfoDto;
|
||||
import io.github.xxyopen.novel.user.manager.cache.UserInfoCacheManager;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 认证授权 拦截器:为了注入其它的 Spring beans,需要通过 @Component 注解将该拦截器注册到 Spring 上下文
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/18
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AuthInterceptor implements HandlerInterceptor {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
private final UserInfoCacheManager userInfoCacheManager;
|
||||
|
||||
/**
|
||||
* handle 执行前调用
|
||||
*/
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler) throws Exception {
|
||||
// 获取登录 JWT
|
||||
String token = request.getHeader(SystemConfigConsts.HTTP_AUTH_HEADER_NAME);
|
||||
|
||||
// 开始认证
|
||||
if (!StringUtils.hasText(token)) {
|
||||
// token 为空
|
||||
throw new BusinessException(ErrorCodeEnum.USER_LOGIN_EXPIRED);
|
||||
}
|
||||
Long userId = JwtUtils.parseToken(token, SystemConfigConsts.NOVEL_FRONT_KEY);
|
||||
if (Objects.isNull(userId)) {
|
||||
// token 解析失败
|
||||
throw new BusinessException(ErrorCodeEnum.USER_LOGIN_EXPIRED);
|
||||
}
|
||||
UserInfoDto userInfo = userInfoCacheManager.getUser(userId);
|
||||
if (Objects.isNull(userInfo)) {
|
||||
// 用户不存在
|
||||
throw new BusinessException(ErrorCodeEnum.USER_ACCOUNT_NOT_EXIST);
|
||||
}
|
||||
// 设置 userId 到当前线程
|
||||
UserHolder.setUserId(userId);
|
||||
return HandlerInterceptor.super.preHandle(request, response, handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* handler 执行后调用,出现异常不调用
|
||||
*/
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
ModelAndView modelAndView) throws Exception {
|
||||
HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
|
||||
}
|
||||
|
||||
/**
|
||||
* DispatcherServlet 完全处理完请求后调用,出现异常照常调用
|
||||
*/
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
|
||||
throws Exception {
|
||||
// 清理当前线程保存的用户数据
|
||||
UserHolder.clear();
|
||||
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package io.github.xxyopen.novel.user.config;
|
||||
|
||||
import io.github.xxyopen.novel.common.constant.ApiRouterConsts;
|
||||
import io.github.xxyopen.novel.config.interceptor.TokenParseInterceptor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* Spring Web Mvc 相关配置不要加 @EnableWebMvc 注解,否则会导致 jackson 的全局配置失效。因为 @EnableWebMvc 注解会导致 WebMvcAutoConfiguration 自动配置失效
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/18
|
||||
*/
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
private final AuthInterceptor authInterceptor;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
|
||||
// 权限认证拦截
|
||||
registry.addInterceptor(authInterceptor)
|
||||
// 拦截会员中心相关请求接口
|
||||
.addPathPatterns(ApiRouterConsts.API_FRONT_USER_URL_PREFIX + "/**")
|
||||
// 放行登录注册相关请求接口
|
||||
.excludePathPatterns(ApiRouterConsts.API_FRONT_USER_URL_PREFIX + "/register",
|
||||
ApiRouterConsts.API_FRONT_USER_URL_PREFIX + "/login")
|
||||
.order(2);
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,140 @@
|
||||
package io.github.xxyopen.novel.user.controller.front;
|
||||
|
||||
import io.github.xxyopen.novel.book.dto.req.BookCommentReqDto;
|
||||
import io.github.xxyopen.novel.common.auth.UserHolder;
|
||||
import io.github.xxyopen.novel.common.constant.ApiRouterConsts;
|
||||
import io.github.xxyopen.novel.common.constant.SystemConfigConsts;
|
||||
import io.github.xxyopen.novel.common.resp.RestResp;
|
||||
import io.github.xxyopen.novel.user.dto.req.UserInfoUptReqDto;
|
||||
import io.github.xxyopen.novel.user.dto.req.UserLoginReqDto;
|
||||
import io.github.xxyopen.novel.user.dto.req.UserRegisterReqDto;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserInfoRespDto;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserLoginRespDto;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserRegisterRespDto;
|
||||
import io.github.xxyopen.novel.user.manager.feign.BookFeignManager;
|
||||
import io.github.xxyopen.novel.user.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 前台门户-会员模块 API 控制器
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/17
|
||||
*/
|
||||
@Tag(name = "UserController", description = "前台门户-会员模块")
|
||||
@SecurityRequirement(name = SystemConfigConsts.HTTP_AUTH_HEADER_NAME)
|
||||
@RestController
|
||||
@RequestMapping(ApiRouterConsts.API_FRONT_USER_URL_PREFIX)
|
||||
@RequiredArgsConstructor
|
||||
public class FrontUserController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
private final BookFeignManager bookFeignManager;
|
||||
|
||||
/**
|
||||
* 用户注册接口
|
||||
*/
|
||||
@Operation(summary = "用户注册接口")
|
||||
@PostMapping("register")
|
||||
public RestResp<UserRegisterRespDto> register(@Valid @RequestBody UserRegisterReqDto dto) {
|
||||
return userService.register(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录接口
|
||||
*/
|
||||
@Operation(summary = "用户登录接口")
|
||||
@PostMapping("login")
|
||||
public RestResp<UserLoginRespDto> login(@Valid @RequestBody UserLoginReqDto dto) {
|
||||
return userService.login(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息查询接口
|
||||
*/
|
||||
@Operation(summary = "用户信息查询接口")
|
||||
@GetMapping
|
||||
public RestResp<UserInfoRespDto> getUserInfo() {
|
||||
return userService.getUserInfo(UserHolder.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息修改接口
|
||||
*/
|
||||
@Operation(summary = "用户信息修改接口")
|
||||
@PutMapping
|
||||
public RestResp<Void> updateUserInfo(@Valid @RequestBody UserInfoUptReqDto dto) {
|
||||
dto.setUserId(UserHolder.getUserId());
|
||||
return userService.updateUserInfo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户反馈提交接口
|
||||
*/
|
||||
@Operation(summary = "用户反馈提交接口")
|
||||
@PostMapping("feedback")
|
||||
public RestResp<Void> submitFeedback(@RequestBody String content) {
|
||||
return userService.saveFeedback(UserHolder.getUserId(), content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户反馈删除接口
|
||||
*/
|
||||
@Operation(summary = "用户反馈删除接口")
|
||||
@DeleteMapping("feedback/{id}")
|
||||
public RestResp<Void> deleteFeedback(@Parameter(description = "反馈ID") @PathVariable Long id) {
|
||||
return userService.deleteFeedback(UserHolder.getUserId(), id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发表评论接口
|
||||
*/
|
||||
@Operation(summary = "发表评论接口")
|
||||
@PostMapping("comment")
|
||||
public RestResp<Void> comment(@Valid @RequestBody BookCommentReqDto dto) {
|
||||
return bookFeignManager.publishComment(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评论接口
|
||||
*/
|
||||
@Operation(summary = "修改评论接口")
|
||||
@PutMapping("comment/{id}")
|
||||
public RestResp<Void> updateComment(@Parameter(description = "评论ID") @PathVariable Long id,
|
||||
String content) {
|
||||
BookCommentReqDto dto = new BookCommentReqDto();
|
||||
dto.setUserId(UserHolder.getUserId());
|
||||
dto.setCommentId(id);
|
||||
dto.setCommentContent(content);
|
||||
return bookFeignManager.updateComment(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评论接口
|
||||
*/
|
||||
@Operation(summary = "删除评论接口")
|
||||
@DeleteMapping("comment/{id}")
|
||||
public RestResp<Void> deleteComment(@Parameter(description = "评论ID") @PathVariable Long id) {
|
||||
BookCommentReqDto dto = new BookCommentReqDto();
|
||||
dto.setUserId(UserHolder.getUserId());
|
||||
dto.setCommentId(id);
|
||||
return bookFeignManager.deleteComment(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询书架状态接口 0-不在书架 1-已在书架
|
||||
*/
|
||||
@Operation(summary = "查询书架状态接口")
|
||||
@GetMapping("bookshelf_status")
|
||||
public RestResp<Integer> getBookshelfStatus(@Parameter(description = "小说ID") String bookId) {
|
||||
return userService.getBookshelfStatus(UserHolder.getUserId(), bookId);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package io.github.xxyopen.novel.user.controller.inner;
|
||||
|
||||
import io.github.xxyopen.novel.common.constant.ApiRouterConsts;
|
||||
import io.github.xxyopen.novel.common.resp.RestResp;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserInfoRespDto;
|
||||
import io.github.xxyopen.novel.user.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户微服务内部调用接口
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2023/3/29
|
||||
*/
|
||||
@Tag(name = "InnerBookController", description = "内部调用-用户模块")
|
||||
@RestController
|
||||
@RequestMapping(ApiRouterConsts.API_INNER_USER_URL_PREFIX)
|
||||
@RequiredArgsConstructor
|
||||
public class InnerUserController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
/**
|
||||
* 批量查询用户信息
|
||||
*/
|
||||
@Operation(summary = "批量查询用户信息")
|
||||
@PostMapping("listUserInfoByIds")
|
||||
RestResp<List<UserInfoRespDto>> listUserInfoByIds(@RequestBody List<Long> userIds) {
|
||||
return userService.listUserInfoByIds(userIds);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,114 @@
|
||||
package io.github.xxyopen.novel.user.dao.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户书架
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
@TableName("user_bookshelf")
|
||||
public class UserBookshelf implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 小说ID
|
||||
*/
|
||||
private Long bookId;
|
||||
|
||||
/**
|
||||
* 上一次阅读的章节内容表ID
|
||||
*/
|
||||
private Long preContentId;
|
||||
|
||||
/**
|
||||
* 创建时间;
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间;
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
public void setBookId(Long bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
public Long getPreContentId() {
|
||||
return preContentId;
|
||||
}
|
||||
|
||||
public void setPreContentId(Long preContentId) {
|
||||
this.preContentId = preContentId;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserBookshelf{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", bookId=" + bookId +
|
||||
", preContentId=" + preContentId +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@@ -0,0 +1,142 @@
|
||||
package io.github.xxyopen.novel.user.dao.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户评论
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
@TableName("user_comment")
|
||||
public class UserComment implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 评论用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 评论小说ID
|
||||
*/
|
||||
private Long bookId;
|
||||
|
||||
/**
|
||||
* 评价内容
|
||||
*/
|
||||
private String commentContent;
|
||||
|
||||
/**
|
||||
* 回复数量
|
||||
*/
|
||||
private Integer replyCount;
|
||||
|
||||
/**
|
||||
* 审核状态;0-待审核 1-审核通过 2-审核不通过
|
||||
*/
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
public void setBookId(Long bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
public String getCommentContent() {
|
||||
return commentContent;
|
||||
}
|
||||
|
||||
public void setCommentContent(String commentContent) {
|
||||
this.commentContent = commentContent;
|
||||
}
|
||||
|
||||
public Integer getReplyCount() {
|
||||
return replyCount;
|
||||
}
|
||||
|
||||
public void setReplyCount(Integer replyCount) {
|
||||
this.replyCount = replyCount;
|
||||
}
|
||||
|
||||
public Integer getAuditStatus() {
|
||||
return auditStatus;
|
||||
}
|
||||
|
||||
public void setAuditStatus(Integer auditStatus) {
|
||||
this.auditStatus = auditStatus;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserComment{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", bookId=" + bookId +
|
||||
", commentContent=" + commentContent +
|
||||
", replyCount=" + replyCount +
|
||||
", auditStatus=" + auditStatus +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@@ -0,0 +1,125 @@
|
||||
package io.github.xxyopen.novel.user.dao.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户评论回复
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
@TableName("user_comment_reply")
|
||||
public class UserCommentReply implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 评论ID
|
||||
*/
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 回复用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
private String replyContent;
|
||||
|
||||
/**
|
||||
* 审核状态;0-待审核 1-审核通过 2-审核不通过
|
||||
*/
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getCommentId() {
|
||||
return commentId;
|
||||
}
|
||||
|
||||
public void setCommentId(Long commentId) {
|
||||
this.commentId = commentId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getReplyContent() {
|
||||
return replyContent;
|
||||
}
|
||||
|
||||
public void setReplyContent(String replyContent) {
|
||||
this.replyContent = replyContent;
|
||||
}
|
||||
|
||||
public Integer getAuditStatus() {
|
||||
return auditStatus;
|
||||
}
|
||||
|
||||
public void setAuditStatus(Integer auditStatus) {
|
||||
this.auditStatus = auditStatus;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserCommentReply{" +
|
||||
"id=" + id +
|
||||
", commentId=" + commentId +
|
||||
", userId=" + userId +
|
||||
", replyContent=" + replyContent +
|
||||
", auditStatus=" + auditStatus +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@@ -0,0 +1,156 @@
|
||||
package io.github.xxyopen.novel.user.dao.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户消费记录
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
@TableName("user_consume_log")
|
||||
public class UserConsumeLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 消费用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 消费使用的金额;单位:屋币
|
||||
*/
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* 消费商品类型;0-小说VIP章节
|
||||
*/
|
||||
private Integer productType;
|
||||
|
||||
/**
|
||||
* 消费的的商品ID;例如:章节ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 消费的的商品名;例如:章节名
|
||||
*/
|
||||
private String producName;
|
||||
|
||||
/**
|
||||
* 消费的的商品值;例如:1
|
||||
*/
|
||||
private Integer producValue;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(Integer amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Integer getProductType() {
|
||||
return productType;
|
||||
}
|
||||
|
||||
public void setProductType(Integer productType) {
|
||||
this.productType = productType;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProducName() {
|
||||
return producName;
|
||||
}
|
||||
|
||||
public void setProducName(String producName) {
|
||||
this.producName = producName;
|
||||
}
|
||||
|
||||
public Integer getProducValue() {
|
||||
return producValue;
|
||||
}
|
||||
|
||||
public void setProducValue(Integer producValue) {
|
||||
this.producValue = producValue;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserConsumeLog{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", amount=" + amount +
|
||||
", productType=" + productType +
|
||||
", productId=" + productId +
|
||||
", producName=" + producName +
|
||||
", producValue=" + producValue +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@@ -0,0 +1,97 @@
|
||||
package io.github.xxyopen.novel.user.dao.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户反馈
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
@TableName("user_feedback")
|
||||
public class UserFeedback implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 反馈用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 反馈内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserFeedback{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", content=" + content +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@@ -0,0 +1,181 @@
|
||||
package io.github.xxyopen.novel.user.dao.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户信息
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
@TableName("user_info")
|
||||
public class UserInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 登录名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 登录密码-加密
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 加密盐值
|
||||
*/
|
||||
private String salt;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String userPhoto;
|
||||
|
||||
/**
|
||||
* 用户性别;0-男 1-女
|
||||
*/
|
||||
private Integer userSex;
|
||||
|
||||
/**
|
||||
* 账户余额
|
||||
*/
|
||||
private Long accountBalance;
|
||||
|
||||
/**
|
||||
* 用户状态;0-正常
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public void setSalt(String salt) {
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public String getUserPhoto() {
|
||||
return userPhoto;
|
||||
}
|
||||
|
||||
public void setUserPhoto(String userPhoto) {
|
||||
this.userPhoto = userPhoto;
|
||||
}
|
||||
|
||||
public Integer getUserSex() {
|
||||
return userSex;
|
||||
}
|
||||
|
||||
public void setUserSex(Integer userSex) {
|
||||
this.userSex = userSex;
|
||||
}
|
||||
|
||||
public Long getAccountBalance() {
|
||||
return accountBalance;
|
||||
}
|
||||
|
||||
public void setAccountBalance(Long accountBalance) {
|
||||
this.accountBalance = accountBalance;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInfo{" +
|
||||
"id=" + id +
|
||||
", username=" + username +
|
||||
", password=" + password +
|
||||
", salt=" + salt +
|
||||
", nickName=" + nickName +
|
||||
", userPhoto=" + userPhoto +
|
||||
", userSex=" + userSex +
|
||||
", accountBalance=" + accountBalance +
|
||||
", status=" + status +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@@ -0,0 +1,195 @@
|
||||
package io.github.xxyopen.novel.user.dao.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值记录
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
@TableName("user_pay_log")
|
||||
public class UserPayLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 充值用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 充值方式;0-支付宝 1-微信
|
||||
*/
|
||||
private Integer payChannel;
|
||||
|
||||
/**
|
||||
* 商户订单号
|
||||
*/
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 充值金额;单位:分
|
||||
*/
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* 充值商品类型;0-屋币 1-包年VIP
|
||||
*/
|
||||
private Integer productType;
|
||||
|
||||
/**
|
||||
* 充值商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 充值商品名;示例值:屋币
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 充值商品值;示例值:255
|
||||
*/
|
||||
private Integer productValue;
|
||||
|
||||
/**
|
||||
* 充值时间
|
||||
*/
|
||||
private LocalDateTime payTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getPayChannel() {
|
||||
return payChannel;
|
||||
}
|
||||
|
||||
public void setPayChannel(Integer payChannel) {
|
||||
this.payChannel = payChannel;
|
||||
}
|
||||
|
||||
public String getOutTradeNo() {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public Integer getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(Integer amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Integer getProductType() {
|
||||
return productType;
|
||||
}
|
||||
|
||||
public void setProductType(Integer productType) {
|
||||
this.productType = productType;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public Integer getProductValue() {
|
||||
return productValue;
|
||||
}
|
||||
|
||||
public void setProductValue(Integer productValue) {
|
||||
this.productValue = productValue;
|
||||
}
|
||||
|
||||
public LocalDateTime getPayTime() {
|
||||
return payTime;
|
||||
}
|
||||
|
||||
public void setPayTime(LocalDateTime payTime) {
|
||||
this.payTime = payTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserPayLog{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", payChannel=" + payChannel +
|
||||
", outTradeNo=" + outTradeNo +
|
||||
", amount=" + amount +
|
||||
", productType=" + productType +
|
||||
", productId=" + productId +
|
||||
", productName=" + productName +
|
||||
", productValue=" + productValue +
|
||||
", payTime=" + payTime +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@@ -0,0 +1,114 @@
|
||||
package io.github.xxyopen.novel.user.dao.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户阅读历史
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
@TableName("user_read_history")
|
||||
public class UserReadHistory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 小说ID
|
||||
*/
|
||||
private Long bookId;
|
||||
|
||||
/**
|
||||
* 上一次阅读的章节内容表ID
|
||||
*/
|
||||
private Long preContentId;
|
||||
|
||||
/**
|
||||
* 创建时间;
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间;
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
public void setBookId(Long bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
public Long getPreContentId() {
|
||||
return preContentId;
|
||||
}
|
||||
|
||||
public void setPreContentId(Long preContentId) {
|
||||
this.preContentId = preContentId;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserReadHistory{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", bookId=" + bookId +
|
||||
", preContentId=" + preContentId +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package io.github.xxyopen.novel.user.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserBookshelf;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户书架 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
public interface UserBookshelfMapper extends BaseMapper<UserBookshelf> {
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package io.github.xxyopen.novel.user.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserComment;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户评论 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
public interface UserCommentMapper extends BaseMapper<UserComment> {
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package io.github.xxyopen.novel.user.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserCommentReply;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户评论回复 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
public interface UserCommentReplyMapper extends BaseMapper<UserCommentReply> {
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package io.github.xxyopen.novel.user.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserConsumeLog;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户消费记录 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
public interface UserConsumeLogMapper extends BaseMapper<UserConsumeLog> {
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package io.github.xxyopen.novel.user.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserFeedback;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户反馈 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
public interface UserFeedbackMapper extends BaseMapper<UserFeedback> {
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package io.github.xxyopen.novel.user.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserInfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户信息 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
public interface UserInfoMapper extends BaseMapper<UserInfo> {
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package io.github.xxyopen.novel.user.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserPayLog;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值记录 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
public interface UserPayLogMapper extends BaseMapper<UserPayLog> {
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package io.github.xxyopen.novel.user.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserReadHistory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户阅读历史 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/05/11
|
||||
*/
|
||||
public interface UserReadHistoryMapper extends BaseMapper<UserReadHistory> {
|
||||
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package io.github.xxyopen.novel.user.manager.cache;
|
||||
|
||||
import io.github.xxyopen.novel.common.constant.CacheConsts;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserInfo;
|
||||
import io.github.xxyopen.novel.user.dao.mapper.UserInfoMapper;
|
||||
import io.github.xxyopen.novel.user.dto.UserInfoDto;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户信息 缓存管理类
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/12
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class UserInfoCacheManager {
|
||||
|
||||
private final UserInfoMapper userInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询用户信息,并放入缓存中
|
||||
*/
|
||||
@Cacheable(cacheManager = CacheConsts.REDIS_CACHE_MANAGER,
|
||||
value = CacheConsts.USER_INFO_CACHE_NAME)
|
||||
public UserInfoDto getUser(Long userId) {
|
||||
UserInfo userInfo = userInfoMapper.selectById(userId);
|
||||
if (Objects.isNull(userInfo)) {
|
||||
return null;
|
||||
}
|
||||
return UserInfoDto.builder()
|
||||
.id(userInfo.getId())
|
||||
.status(userInfo.getStatus()).build();
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package io.github.xxyopen.novel.user.manager.feign;
|
||||
|
||||
import io.github.xxyopen.novel.book.dto.req.BookCommentReqDto;
|
||||
import io.github.xxyopen.novel.book.feign.BookFeign;
|
||||
import io.github.xxyopen.novel.common.auth.UserHolder;
|
||||
import io.github.xxyopen.novel.common.resp.RestResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 小说微服务调用 Feign 客户端管理
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2023/3/29
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class BookFeignManager {
|
||||
|
||||
private final BookFeign bookFeign;
|
||||
|
||||
public RestResp<Void> publishComment(BookCommentReqDto dto) {
|
||||
dto.setUserId(UserHolder.getUserId());
|
||||
return bookFeign.publishComment(dto);
|
||||
}
|
||||
|
||||
public RestResp<Void> updateComment(BookCommentReqDto dto) {
|
||||
dto.setUserId(UserHolder.getUserId());
|
||||
return bookFeign.updateComment(dto);
|
||||
}
|
||||
|
||||
public RestResp<Void> deleteComment(BookCommentReqDto dto) {
|
||||
dto.setUserId(UserHolder.getUserId());
|
||||
return bookFeign.deleteComment(dto);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package io.github.xxyopen.novel.user.manager.redis;
|
||||
|
||||
import io.github.xxyopen.novel.common.constant.CacheConsts;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 验证码 管理类
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/12
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class VerifyCodeManager {
|
||||
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
/**
|
||||
* 校验图形验证码
|
||||
*/
|
||||
public boolean imgVerifyCodeOk(String sessionId, String verifyCode) {
|
||||
return Objects.equals(stringRedisTemplate.opsForValue()
|
||||
.get(CacheConsts.IMG_VERIFY_CODE_CACHE_KEY + sessionId), verifyCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 Redis 中删除验证码
|
||||
*/
|
||||
public void removeImgVerifyCode(String sessionId) {
|
||||
stringRedisTemplate.delete(CacheConsts.IMG_VERIFY_CODE_CACHE_KEY + sessionId);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
package io.github.xxyopen.novel.user.service;
|
||||
|
||||
|
||||
import io.github.xxyopen.novel.book.dto.resp.BookEsRespDto;
|
||||
import io.github.xxyopen.novel.common.resp.RestResp;
|
||||
import io.github.xxyopen.novel.user.dto.req.UserInfoUptReqDto;
|
||||
import io.github.xxyopen.novel.user.dto.req.UserLoginReqDto;
|
||||
import io.github.xxyopen.novel.user.dto.req.UserRegisterReqDto;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserInfoRespDto;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserLoginRespDto;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserRegisterRespDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员模块 服务类
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/17
|
||||
*/
|
||||
public interface UserService {
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
*
|
||||
* @param dto 注册参数
|
||||
* @return JWT
|
||||
*/
|
||||
RestResp<UserRegisterRespDto> register(UserRegisterReqDto dto);
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
*
|
||||
* @param dto 登录参数
|
||||
* @return JWT + 昵称
|
||||
*/
|
||||
RestResp<UserLoginRespDto> login(UserLoginReqDto dto);
|
||||
|
||||
/**
|
||||
* 用户反馈
|
||||
*
|
||||
* @param userId 反馈用户ID
|
||||
* @param content 反馈内容
|
||||
* @return void
|
||||
*/
|
||||
RestResp<Void> saveFeedback(Long userId, String content);
|
||||
|
||||
/**
|
||||
* 用户信息修改
|
||||
*
|
||||
* @param dto 用户信息
|
||||
* @return void
|
||||
*/
|
||||
RestResp<Void> updateUserInfo(UserInfoUptReqDto dto);
|
||||
|
||||
/**
|
||||
* 用户反馈删除
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param id 反馈ID
|
||||
* @return void
|
||||
*/
|
||||
RestResp<Void> deleteFeedback(Long userId, Long id);
|
||||
|
||||
/**
|
||||
* 查询书架状态接口
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param bookId 小说ID
|
||||
* @return 0-不在书架 1-已在书架
|
||||
*/
|
||||
RestResp<Integer> getBookshelfStatus(Long userId, String bookId);
|
||||
|
||||
/**
|
||||
* 用户信息查询
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户信息
|
||||
*/
|
||||
RestResp<UserInfoRespDto> getUserInfo(Long userId);
|
||||
|
||||
/**
|
||||
* 批量查询用户信息
|
||||
*
|
||||
* @param userIds 用户ID列表
|
||||
* @return 用户信息列表
|
||||
*/
|
||||
RestResp<List<UserInfoRespDto>> listUserInfoByIds(List<Long> userIds);
|
||||
}
|
@@ -0,0 +1,184 @@
|
||||
package io.github.xxyopen.novel.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.github.xxyopen.novel.common.auth.JwtUtils;
|
||||
import io.github.xxyopen.novel.common.constant.CommonConsts;
|
||||
import io.github.xxyopen.novel.common.constant.DatabaseConsts;
|
||||
import io.github.xxyopen.novel.common.constant.ErrorCodeEnum;
|
||||
import io.github.xxyopen.novel.common.constant.SystemConfigConsts;
|
||||
import io.github.xxyopen.novel.common.resp.RestResp;
|
||||
import io.github.xxyopen.novel.config.exception.BusinessException;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserBookshelf;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserFeedback;
|
||||
import io.github.xxyopen.novel.user.dao.entity.UserInfo;
|
||||
import io.github.xxyopen.novel.user.dao.mapper.UserBookshelfMapper;
|
||||
import io.github.xxyopen.novel.user.dao.mapper.UserFeedbackMapper;
|
||||
import io.github.xxyopen.novel.user.dao.mapper.UserInfoMapper;
|
||||
import io.github.xxyopen.novel.user.dto.req.UserInfoUptReqDto;
|
||||
import io.github.xxyopen.novel.user.dto.req.UserLoginReqDto;
|
||||
import io.github.xxyopen.novel.user.dto.req.UserRegisterReqDto;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserInfoRespDto;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserLoginRespDto;
|
||||
import io.github.xxyopen.novel.user.dto.resp.UserRegisterRespDto;
|
||||
import io.github.xxyopen.novel.user.manager.redis.VerifyCodeManager;
|
||||
import io.github.xxyopen.novel.user.service.UserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 会员模块 服务实现类
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/17
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
private final UserInfoMapper userInfoMapper;
|
||||
|
||||
private final VerifyCodeManager verifyCodeManager;
|
||||
|
||||
private final UserFeedbackMapper userFeedbackMapper;
|
||||
|
||||
private final UserBookshelfMapper userBookshelfMapper;
|
||||
|
||||
@Override
|
||||
public RestResp<UserRegisterRespDto> register(UserRegisterReqDto dto) {
|
||||
// 校验图形验证码是否正确
|
||||
if (!verifyCodeManager.imgVerifyCodeOk(dto.getSessionId(), dto.getVelCode())) {
|
||||
// 图形验证码校验失败
|
||||
throw new BusinessException(ErrorCodeEnum.USER_VERIFY_CODE_ERROR);
|
||||
}
|
||||
|
||||
// 校验手机号是否已注册
|
||||
QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(DatabaseConsts.UserInfoTable.COLUMN_USERNAME, dto.getUsername())
|
||||
.last(DatabaseConsts.SqlEnum.LIMIT_1.getSql());
|
||||
if (userInfoMapper.selectCount(queryWrapper) > 0) {
|
||||
// 手机号已注册
|
||||
throw new BusinessException(ErrorCodeEnum.USER_NAME_EXIST);
|
||||
}
|
||||
|
||||
// 注册成功,保存用户信息
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setPassword(
|
||||
DigestUtils.md5DigestAsHex(dto.getPassword().getBytes(StandardCharsets.UTF_8)));
|
||||
userInfo.setUsername(dto.getUsername());
|
||||
userInfo.setNickName(dto.getUsername());
|
||||
userInfo.setCreateTime(LocalDateTime.now());
|
||||
userInfo.setUpdateTime(LocalDateTime.now());
|
||||
userInfo.setSalt("0");
|
||||
userInfoMapper.insert(userInfo);
|
||||
|
||||
// 删除验证码
|
||||
verifyCodeManager.removeImgVerifyCode(dto.getSessionId());
|
||||
|
||||
// 生成JWT 并返回
|
||||
return RestResp.ok(
|
||||
UserRegisterRespDto.builder()
|
||||
.token(JwtUtils.generateToken(userInfo.getId(), SystemConfigConsts.NOVEL_FRONT_KEY))
|
||||
.uid(userInfo.getId())
|
||||
.build()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResp<UserLoginRespDto> login(UserLoginReqDto dto) {
|
||||
// 查询用户信息
|
||||
QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(DatabaseConsts.UserInfoTable.COLUMN_USERNAME, dto.getUsername())
|
||||
.last(DatabaseConsts.SqlEnum.LIMIT_1.getSql());
|
||||
UserInfo userInfo = userInfoMapper.selectOne(queryWrapper);
|
||||
if (Objects.isNull(userInfo)) {
|
||||
// 用户不存在
|
||||
throw new BusinessException(ErrorCodeEnum.USER_ACCOUNT_NOT_EXIST);
|
||||
}
|
||||
|
||||
// 判断密码是否正确
|
||||
if (!Objects.equals(userInfo.getPassword()
|
||||
, DigestUtils.md5DigestAsHex(dto.getPassword().getBytes(StandardCharsets.UTF_8)))) {
|
||||
// 密码错误
|
||||
throw new BusinessException(ErrorCodeEnum.USER_PASSWORD_ERROR);
|
||||
}
|
||||
|
||||
// 登录成功,生成JWT并返回
|
||||
return RestResp.ok(UserLoginRespDto.builder()
|
||||
.token(JwtUtils.generateToken(userInfo.getId(), SystemConfigConsts.NOVEL_FRONT_KEY))
|
||||
.uid(userInfo.getId())
|
||||
.nickName(userInfo.getNickName()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResp<Void> saveFeedback(Long userId, String content) {
|
||||
UserFeedback userFeedback = new UserFeedback();
|
||||
userFeedback.setUserId(userId);
|
||||
userFeedback.setContent(content);
|
||||
userFeedback.setCreateTime(LocalDateTime.now());
|
||||
userFeedback.setUpdateTime(LocalDateTime.now());
|
||||
userFeedbackMapper.insert(userFeedback);
|
||||
return RestResp.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResp<Void> updateUserInfo(UserInfoUptReqDto dto) {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setId(dto.getUserId());
|
||||
userInfo.setNickName(dto.getNickName());
|
||||
userInfo.setUserPhoto(dto.getUserPhoto());
|
||||
userInfo.setUserSex(dto.getUserSex());
|
||||
userInfoMapper.updateById(userInfo);
|
||||
return RestResp.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResp<Void> deleteFeedback(Long userId, Long id) {
|
||||
QueryWrapper<UserFeedback> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(DatabaseConsts.CommonColumnEnum.ID.getName(), id)
|
||||
.eq(DatabaseConsts.UserFeedBackTable.COLUMN_USER_ID, userId);
|
||||
userFeedbackMapper.delete(queryWrapper);
|
||||
return RestResp.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResp<Integer> getBookshelfStatus(Long userId, String bookId) {
|
||||
QueryWrapper<UserBookshelf> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(DatabaseConsts.UserBookshelfTable.COLUMN_USER_ID, userId)
|
||||
.eq(DatabaseConsts.UserBookshelfTable.COLUMN_BOOK_ID, bookId);
|
||||
return RestResp.ok(
|
||||
userBookshelfMapper.selectCount(queryWrapper) > 0
|
||||
? CommonConsts.YES
|
||||
: CommonConsts.NO
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResp<UserInfoRespDto> getUserInfo(Long userId) {
|
||||
UserInfo userInfo = userInfoMapper.selectById(userId);
|
||||
return RestResp.ok(UserInfoRespDto.builder()
|
||||
.nickName(userInfo.getNickName())
|
||||
.userSex(userInfo.getUserSex())
|
||||
.userPhoto(userInfo.getUserPhoto())
|
||||
.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResp<List<UserInfoRespDto>> listUserInfoByIds(List<Long> userIds) {
|
||||
QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in(DatabaseConsts.CommonColumnEnum.ID.getName(), userIds);
|
||||
return RestResp.ok(
|
||||
userInfoMapper.selectList(queryWrapper).stream().map(v -> UserInfoRespDto.builder()
|
||||
.id(v.getId())
|
||||
.username(v.getUsername())
|
||||
.userPhoto(v.getUserPhoto())
|
||||
.build()).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
server:
|
||||
port: 9060
|
||||
spring:
|
||||
profiles:
|
||||
include: common
|
||||
active: dev
|
||||
|
||||
management:
|
||||
# 端点启用配置
|
||||
endpoint:
|
||||
logfile:
|
||||
# 启用返回日志文件内容的端点
|
||||
enabled: true
|
||||
# 外部日志文件路径
|
||||
external-file: logs/novel-user-service.log
|
@@ -0,0 +1,6 @@
|
||||
spring:
|
||||
application:
|
||||
name: novel-user-service
|
||||
profiles:
|
||||
include: common
|
||||
|
@@ -1,20 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
|
||||
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,%i索引【从数字0开始递增】,,, -->
|
||||
<!-- appender是configuration的子节点,是负责写日志的组件。 -->
|
||||
<!-- ConsoleAppender:把日志输出到控制台 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<!--
|
||||
<pattern>%d %p (%file:%line\)- %m%n</pattern>
|
||||
-->
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
<!-- 控制台也要使用UTF-8,不要使用GBK,否则会中文乱码 -->
|
||||
<charset>UTF-8</charset>
|
||||
@@ -26,7 +26,7 @@
|
||||
<!-- 2.如果日期没有发生变化,但是当前日志的文件大小超过1KB时,对当前日志进行分割 重命名 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
|
||||
<File>logs/user-service.log</File>
|
||||
<File>logs/novel-user-service.log</File>
|
||||
<!-- rollingPolicy:当发生滚动时,决定 RollingFileAppender 的行为,涉及文件移动和重命名。 -->
|
||||
<!-- TimeBasedRollingPolicy: 最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
@@ -49,24 +49,31 @@
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--输出到logstash的appender-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!--可以访问的logstash日志收集端口-->
|
||||
<destination>198.245.61.51:4560</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
|
||||
</appender>
|
||||
<!-- 控制台输出日志级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
<appender-ref ref="LOGSTASH"/>
|
||||
</root>
|
||||
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
||||
<!-- com.maijinjie.springboot 为根包,也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
|
||||
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
||||
<logger name="com.java2nb" level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
<appender-ref ref="LOGSTASH"/>
|
||||
</logger>
|
||||
<springProfile name="dev">
|
||||
<!-- ROOT 日志级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
||||
<!-- com.maijinjie.springboot 为根包,也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
|
||||
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
||||
<logger name="io.github.xxyopen" level="DEBUG" additivity="false">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</logger>
|
||||
</springProfile>
|
||||
|
||||
<springProfile name="prod">
|
||||
<!-- ROOT 日志级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
|
||||
<!-- com.maijinjie.springboot 为根包,也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
|
||||
<!-- 级别依次为【从高到低】:FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
|
||||
<logger name="io.github.xxyopen" level="ERROR" additivity="false">
|
||||
<appender-ref ref="FILE"/>
|
||||
</logger>
|
||||
</springProfile>
|
||||
</configuration>
|
@@ -4,17 +4,31 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>novel-cloud</artifactId>
|
||||
<groupId>com.java2nb.novel</groupId>
|
||||
<version>1.3.0</version>
|
||||
<groupId>io.github.xxyopen</groupId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>novel-user</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>user-api</module>
|
||||
<module>user-service</module>
|
||||
<module>novel-user-api</module>
|
||||
<module>novel-user-service</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.github.xxyopen</groupId>
|
||||
<artifactId>novel-common</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.xxyopen</groupId>
|
||||
<artifactId>novel-config</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>novel-user</artifactId>
|
||||
<groupId>com.java2nb.novel</groupId>
|
||||
<version>1.3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>user-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.java2nb.novel</groupId>
|
||||
<artifactId>novel-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@@ -1,37 +0,0 @@
|
||||
package com.java2nb.novel.user.api;
|
||||
|
||||
|
||||
import com.java2nb.novel.user.entity.User;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户微服务API接口定义(内部)
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
public interface UserApi {
|
||||
|
||||
/**
|
||||
* 根据用户名密码查询用户表记录
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 用户对象,不存在返回null
|
||||
* */
|
||||
@GetMapping("api/user/queryByUsernameAndPassword")
|
||||
User queryByUsernameAndPassword(@RequestParam("username") String username, @RequestParam("password") String password);
|
||||
|
||||
/**
|
||||
* 根据用户名ID集合查询用户集合信息
|
||||
* @param ids 用户ID集合
|
||||
* @return 用户集合对象
|
||||
* */
|
||||
@GetMapping("api/user/queryById")
|
||||
List<User> queryById(@RequestBody List<Long> ids);
|
||||
|
||||
|
||||
}
|
@@ -1,167 +0,0 @@
|
||||
package com.java2nb.novel.user.entity;
|
||||
|
||||
import com.java2nb.novel.common.valid.AddGroup;
|
||||
import com.java2nb.novel.common.valid.UpdateGroup;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class User implements Serializable {
|
||||
|
||||
@Null(groups = {AddGroup.class, UpdateGroup.class})
|
||||
@ApiModelProperty(value = "主键")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@NotBlank(groups = {AddGroup.class},message="手机号不能为空!")
|
||||
@Pattern(groups = {AddGroup.class},regexp="^1[3|4|5|6|7|8|9][0-9]{9}$",message="手机号格式不正确!")
|
||||
@ApiModelProperty(value = "登录名")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String username;
|
||||
|
||||
@NotBlank(groups = {AddGroup.class},message="密码不能为空!")
|
||||
@Null(groups = {UpdateGroup.class})
|
||||
@ApiModelProperty(value = "登录密码")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String password;
|
||||
|
||||
@Null(groups = {AddGroup.class})
|
||||
@ApiModelProperty(value = "昵称")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String nickName;
|
||||
|
||||
@Null(groups = {AddGroup.class})
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String userPhoto;
|
||||
|
||||
@Null(groups = {AddGroup.class})
|
||||
@Min(value = 0,groups = {UpdateGroup.class})
|
||||
@Max(value = 1,groups = {UpdateGroup.class})
|
||||
@ApiModelProperty(value = "用户性别,0:男,1:女")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte userSex;
|
||||
|
||||
@Null(groups = {AddGroup.class,UpdateGroup.class})
|
||||
@ApiModelProperty(value = "账户余额")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long accountBalance;
|
||||
|
||||
@Null(groups = {AddGroup.class,UpdateGroup.class})
|
||||
@ApiModelProperty(value = "用户状态,0:正常")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte status;
|
||||
|
||||
@Null(groups = {AddGroup.class,UpdateGroup.class})
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@Null(groups = {AddGroup.class,UpdateGroup.class})
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUsername(String username) {
|
||||
this.username = username == null ? null : username.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setPassword(String password) {
|
||||
this.password = password == null ? null : password.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName == null ? null : nickName.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getUserPhoto() {
|
||||
return userPhoto;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserPhoto(String userPhoto) {
|
||||
this.userPhoto = userPhoto == null ? null : userPhoto.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getUserSex() {
|
||||
return userSex;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserSex(Byte userSex) {
|
||||
this.userSex = userSex;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getAccountBalance() {
|
||||
return accountBalance;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setAccountBalance(Long accountBalance) {
|
||||
this.accountBalance = accountBalance;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setStatus(Byte status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
@@ -1,90 +0,0 @@
|
||||
package com.java2nb.novel.user.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserBookshelf {
|
||||
@ApiModelProperty(value = "主键")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "小说ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long bookId;
|
||||
|
||||
@ApiModelProperty(value = "上一次阅读的章节内容表ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long preContentId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookId(Long bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getPreContentId() {
|
||||
return preContentId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setPreContentId(Long preContentId) {
|
||||
this.preContentId = preContentId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
@@ -1,120 +0,0 @@
|
||||
package com.java2nb.novel.user.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserBuyRecord {
|
||||
@ApiModelProperty(value = "主键")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "购买的小说ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long bookId;
|
||||
|
||||
@ApiModelProperty(value = "购买的小说名")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String bookName;
|
||||
|
||||
@ApiModelProperty(value = "购买的章节ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long bookIndexId;
|
||||
|
||||
@ApiModelProperty(value = "购买的章节名")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String bookIndexName;
|
||||
|
||||
@ApiModelProperty(value = "购买使用的屋币数量")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Integer buyAmount;
|
||||
|
||||
@ApiModelProperty(value = "购买时间")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookId(Long bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getBookName() {
|
||||
return bookName;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookName(String bookName) {
|
||||
this.bookName = bookName == null ? null : bookName.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getBookIndexId() {
|
||||
return bookIndexId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookIndexId(Long bookIndexId) {
|
||||
this.bookIndexId = bookIndexId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getBookIndexName() {
|
||||
return bookIndexName;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookIndexName(String bookIndexName) {
|
||||
this.bookIndexName = bookIndexName == null ? null : bookIndexName.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Integer getBuyAmount() {
|
||||
return buyAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBuyAmount(Integer buyAmount) {
|
||||
this.buyAmount = buyAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
package com.java2nb.novel.user.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserFeedback {
|
||||
@ApiModelProperty(value = "主键id")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "反馈内容")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "反馈时间")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setContent(String content) {
|
||||
this.content = content == null ? null : content.trim();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
@@ -1,106 +0,0 @@
|
||||
package com.java2nb.novel.user.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserPayRecord {
|
||||
@ApiModelProperty(value = "主键")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "充值用户ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "充值方式,1:支付宝,2:微信")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Byte payChannel;
|
||||
|
||||
@ApiModelProperty(value = "商户订单号")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long outTradeNo;
|
||||
|
||||
@ApiModelProperty(value = "充值金额(单位元)")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Integer totalAmount;
|
||||
|
||||
@ApiModelProperty(value = "获得屋币")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Integer wuAmount;
|
||||
|
||||
@ApiModelProperty(value = "充值时间")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date payTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Byte getPayChannel() {
|
||||
return payChannel;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setPayChannel(Byte payChannel) {
|
||||
this.payChannel = payChannel;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getOutTradeNo() {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setOutTradeNo(Long outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Integer getTotalAmount() {
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setTotalAmount(Integer totalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Integer getWuAmount() {
|
||||
return wuAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setWuAmount(Integer wuAmount) {
|
||||
this.wuAmount = wuAmount;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getPayTime() {
|
||||
return payTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setPayTime(Date payTime) {
|
||||
this.payTime = payTime;
|
||||
}
|
||||
}
|
@@ -1,90 +0,0 @@
|
||||
package com.java2nb.novel.user.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserReadHistory {
|
||||
@ApiModelProperty(value = "主键")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "小说ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long bookId;
|
||||
|
||||
@ApiModelProperty(value = "上一次阅读的章节内容表ID")
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Long preContentId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
private Date updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setBookId(Long bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Long getPreContentId() {
|
||||
return preContentId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setPreContentId(Long preContentId) {
|
||||
this.preContentId = preContentId;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
package com.java2nb.novel.user.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.java2nb.novel.user.entity.UserReadHistory;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 小说阅读记录VO对象
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
@Data
|
||||
public class BookReadHistoryVO extends UserReadHistory {
|
||||
|
||||
private Integer catId;
|
||||
private String catName;
|
||||
private Long lastIndexId;
|
||||
|
||||
private String lastIndexName;
|
||||
private String bookName;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "MM/dd HH:mm:ss")
|
||||
private Date lastIndexUpdateTime;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
package com.java2nb.novel.user.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.java2nb.novel.user.entity.UserBookshelf;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 小说书架VO对象
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
@Data
|
||||
public class BookShelfVO extends UserBookshelf {
|
||||
|
||||
private Integer catId;
|
||||
private String catName;
|
||||
private Long lastIndexId;
|
||||
|
||||
private String lastIndexName;
|
||||
private String bookName;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "MM/dd HH:mm:ss")
|
||||
private Date lastIndexUpdateTime;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>novel-user</artifactId>
|
||||
<groupId>com.java2nb.novel</groupId>
|
||||
<version>1.3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>user-service</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.java2nb.novel</groupId>
|
||||
<artifactId>user-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.java2nb.novel</groupId>
|
||||
<artifactId>book-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-netflix-hystrix</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<!--<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>${docker.maven.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-image</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<imageName>201206030/${project.artifactId}:${project.version}</imageName>
|
||||
<dockerHost>${docker.host}</dockerHost>
|
||||
<baseImage>java:8</baseImage>
|
||||
<entryPoint>["java", "-jar","/${project.build.finalName}.jar"]</entryPoint>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/</targetPath>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>-->
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
@@ -1,20 +0,0 @@
|
||||
package com.java2nb.novel;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 用户微服务启动器
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
public class UserApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(UserApplication.class);
|
||||
}
|
||||
}
|
@@ -1,299 +0,0 @@
|
||||
package com.java2nb.novel.user.controller;
|
||||
|
||||
import com.java2nb.novel.book.entity.BookComment;
|
||||
import com.java2nb.novel.common.base.BaseController;
|
||||
import com.java2nb.novel.common.bean.ResultBean;
|
||||
import com.java2nb.novel.common.bean.UserDetails;
|
||||
import com.java2nb.novel.common.cache.CacheService;
|
||||
import com.java2nb.novel.common.enums.ResponseStatus;
|
||||
import com.java2nb.novel.common.utils.RandomValidateCodeUtil;
|
||||
import com.java2nb.novel.common.valid.AddGroup;
|
||||
import com.java2nb.novel.common.valid.UpdateGroup;
|
||||
import com.java2nb.novel.user.entity.User;
|
||||
import com.java2nb.novel.user.feign.BookFeignClient;
|
||||
import com.java2nb.novel.user.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户微服务Controller
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("user")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Api(tags = "用户相关接口")
|
||||
public class UserController extends BaseController {
|
||||
|
||||
|
||||
private final CacheService cacheService;
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
private final BookFeignClient bookFeignClient;
|
||||
|
||||
/**
|
||||
* 登陆
|
||||
*/
|
||||
@ApiOperation("用户登陆接口")
|
||||
@GetMapping("login")
|
||||
public ResultBean<Map<String, Object>> login(User user) {
|
||||
//登陆
|
||||
UserDetails userDetails = userService.login(user);
|
||||
|
||||
Map<String, Object> data = new HashMap<>(1);
|
||||
data.put("token", jwtTokenUtil.generateToken(userDetails));
|
||||
|
||||
return ResultBean.ok(data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
@ApiOperation("用户注册接口")
|
||||
@PostMapping("register")
|
||||
public ResultBean<?> register(@Validated({AddGroup.class}) User user, @RequestParam(value = "velCode", defaultValue = "") String velCode) {
|
||||
|
||||
|
||||
//判断验证码是否正确
|
||||
if (!velCode.equals(cacheService.get(RandomValidateCodeUtil.RANDOM_CODE_KEY))) {
|
||||
return ResultBean.fail(ResponseStatus.VEL_CODE_ERROR);
|
||||
}
|
||||
|
||||
//注册
|
||||
UserDetails userDetails = userService.register(user);
|
||||
Map<String, Object> data = new HashMap<>(1);
|
||||
data.put("token", jwtTokenUtil.generateToken(userDetails));
|
||||
|
||||
return ResultBean.ok(data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
@ApiOperation("token刷新接口")
|
||||
@PostMapping("refreshToken")
|
||||
public ResultBean<?> refreshToken(HttpServletRequest request) {
|
||||
String token = getToken(request);
|
||||
if (jwtTokenUtil.canRefresh(token)) {
|
||||
token = jwtTokenUtil.refreshToken(token);
|
||||
Map<String, Object> data = new HashMap<>(2);
|
||||
data.put("token", token);
|
||||
UserDetails userDetail = jwtTokenUtil.getUserDetailsFromToken(token);
|
||||
data.put("username", userDetail.getUsername());
|
||||
data.put("nickName", userDetail.getNickName());
|
||||
return ResultBean.ok(data);
|
||||
|
||||
} else {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小说是否已加入书架
|
||||
*/
|
||||
@ApiOperation("小说加入书架状态查询接口")
|
||||
@GetMapping("queryIsInShelf")
|
||||
public ResultBean<?> queryIsInShelf(Long bookId, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
return ResultBean.ok(userService.queryIsInShelf(userDetails.getId(), bookId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入书架
|
||||
* */
|
||||
@ApiOperation("小说加入书架接口")
|
||||
@PostMapping("addToBookShelf")
|
||||
public ResultBean<?> addToBookShelf(Long bookId,Long preContentId, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
userService.addToBookShelf(userDetails.getId(),bookId,preContentId);
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 移出书架
|
||||
* */
|
||||
@ApiOperation("小说移出书架接口")
|
||||
@DeleteMapping("removeFromBookShelf")
|
||||
public ResultBean<?> removeFromBookShelf(Long bookId, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
userService.removeFromBookShelf(userDetails.getId(),bookId);
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询书架
|
||||
* */
|
||||
@ApiOperation("书架列表分页查询接口")
|
||||
@GetMapping("listBookShelfByPage")
|
||||
public ResultBean<?> listBookShelfByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
return ResultBean.ok(userService.listBookShelfByPage(userDetails.getId(),page,pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询阅读记录
|
||||
* */
|
||||
@ApiOperation("阅读记录分页查询接口")
|
||||
@GetMapping("listReadHistoryByPage")
|
||||
public ResultBean<?> listReadHistoryByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
return ResultBean.ok(userService.listReadHistoryByPage(userDetails.getId(),page,pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加阅读记录
|
||||
* */
|
||||
@ApiOperation("阅读记录添加接口")
|
||||
@PostMapping("addReadHistory")
|
||||
public ResultBean<?> addReadHistory(Long bookId,Long preContentId, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
userService.addReadHistory(userDetails.getId(),bookId,preContentId);
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加反馈
|
||||
* */
|
||||
@ApiOperation("反馈添加接口")
|
||||
@PostMapping("addFeedBack")
|
||||
public ResultBean<?> addFeedBack(String content, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
userService.addFeedBack(userDetails.getId(),content);
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询我的反馈列表
|
||||
* */
|
||||
@ApiOperation("反馈列表分页查询接口")
|
||||
@GetMapping("listUserFeedBackByPage")
|
||||
public ResultBean<?> listUserFeedBackByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize, HttpServletRequest request){
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
return ResultBean.ok(userService.listUserFeedBackByPage(userDetails.getId(),page,pageSize));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询个人信息
|
||||
* */
|
||||
@ApiOperation("人信息查询接口")
|
||||
@GetMapping("userInfo")
|
||||
public ResultBean<?> userInfo(HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
return ResultBean.ok(userService.userInfo(userDetails.getId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新个人信息
|
||||
* */
|
||||
@ApiOperation("人信息更新接口")
|
||||
@PostMapping("updateUserInfo")
|
||||
public ResultBean<?> updateUserInfo(@Validated({UpdateGroup.class}) User user, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
userService.updateUserInfo(userDetails.getId(),user);
|
||||
if(user.getNickName() != null){
|
||||
userDetails.setNickName(user.getNickName());
|
||||
Map<String, Object> data = new HashMap<>(1);
|
||||
data.put("token", jwtTokenUtil.generateToken(userDetails));
|
||||
return ResultBean.ok(data);
|
||||
}
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新密码
|
||||
* */
|
||||
@ApiOperation("更新密码接口")
|
||||
@PostMapping("updatePassword")
|
||||
public ResultBean<?> updatePassword(String oldPassword,String newPassword1,String newPassword2,HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
if(!(StringUtils.isNotBlank(newPassword1) && newPassword1.equals(newPassword2))){
|
||||
ResultBean.fail(ResponseStatus.TWO_PASSWORD_DIFF);
|
||||
}
|
||||
userService.updatePassword(userDetails.getId(),oldPassword,newPassword1);
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布评价
|
||||
* */
|
||||
@ApiOperation("发布评价接口")
|
||||
@PostMapping("addBookComment")
|
||||
public ResultBean<?> addBookComment(BookComment comment, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
bookFeignClient.addBookComment(userDetails.getId(),comment);
|
||||
return ResultBean.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户书评分页查询
|
||||
* */
|
||||
@ApiOperation("用户书评分页查询接口")
|
||||
@GetMapping("listCommentByPage")
|
||||
public ResultBean<?> listCommentByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize,HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
}
|
||||
return ResultBean.ok(bookFeignClient.listUserCommentByPage(userDetails.getId(),page,pageSize));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
package com.java2nb.novel.user.controller.api;
|
||||
|
||||
|
||||
import com.java2nb.novel.user.entity.User;
|
||||
import com.java2nb.novel.user.service.UserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户微服务API接口(内部调用)
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/user")
|
||||
@RequiredArgsConstructor
|
||||
@ApiIgnore
|
||||
public class UserApi {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户名密码查询记录
|
||||
* */
|
||||
@GetMapping("queryByUsernameAndPassword")
|
||||
public User queryByUsernameAndPassword(String username, String password){
|
||||
return userService.queryByUsernameAndPassword(username,password);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户名ID集合查询用户集合信息
|
||||
* @param ids 用户ID集合
|
||||
* @return 用户集合对象
|
||||
* */
|
||||
@GetMapping("queryById")
|
||||
List<User> queryById(@RequestBody List<Long> ids){
|
||||
return userService.queryById(ids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package com.java2nb.novel.user.feign;
|
||||
|
||||
import com.java2nb.novel.book.api.BookApi;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
/**
|
||||
* 小说服务Feign客户端
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/28
|
||||
*/
|
||||
@FeignClient("book-service")
|
||||
public interface BookFeignClient extends BookApi {
|
||||
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
|
||||
public final class UserBookshelfDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final UserBookshelf userBookshelf = new UserBookshelf();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = userBookshelf.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> userId = userBookshelf.userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> bookId = userBookshelf.bookId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> preContentId = userBookshelf.preContentId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = userBookshelf.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> updateTime = userBookshelf.updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class UserBookshelf extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> bookId = column("book_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> preContentId = column("pre_content_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public UserBookshelf() {
|
||||
super("user_bookshelf");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,177 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import com.java2nb.novel.user.entity.UserBookshelf;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSL;
|
||||
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategy;
|
||||
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSL;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.List;
|
||||
|
||||
import static com.java2nb.novel.user.mapper.UserBookshelfDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
|
||||
@Mapper
|
||||
public interface UserBookshelfMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<UserBookshelf> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("UserBookshelfResult")
|
||||
UserBookshelf selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="UserBookshelfResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="book_id", property="bookId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="pre_content_id", property="preContentId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<UserBookshelf> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
|
||||
return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
|
||||
.from(userBookshelf);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userBookshelf);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userBookshelf)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(UserBookshelf record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userBookshelf)
|
||||
.map(id).toProperty("id")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(bookId).toProperty("bookId")
|
||||
.map(preContentId).toProperty("preContentId")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(updateTime).toProperty("updateTime")
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(UserBookshelf record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userBookshelf)
|
||||
.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||
.map(bookId).toPropertyWhenPresent("bookId", record::getBookId)
|
||||
.map(preContentId).toPropertyWhenPresent("preContentId", record::getPreContentId)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
.map(updateTime).toPropertyWhenPresent("updateTime", record::getUpdateTime)
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserBookshelf>>> selectByExample() {
|
||||
return SelectDSL.selectWithMapper(this::selectMany, id, userId, bookId, preContentId, createTime, updateTime)
|
||||
.from(userBookshelf);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserBookshelf>>> selectDistinctByExample() {
|
||||
return SelectDSL.selectDistinctWithMapper(this::selectMany, id, userId, bookId, preContentId, createTime, updateTime)
|
||||
.from(userBookshelf);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UserBookshelf selectByPrimaryKey(Long id_) {
|
||||
return SelectDSL.selectWithMapper(this::selectOne, id, userId, bookId, preContentId, createTime, updateTime)
|
||||
.from(userBookshelf)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(UserBookshelf record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userBookshelf)
|
||||
.set(id).equalTo(record::getId)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(bookId).equalTo(record::getBookId)
|
||||
.set(preContentId).equalTo(record::getPreContentId)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(UserBookshelf record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userBookshelf)
|
||||
.set(id).equalToWhenPresent(record::getId)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||
.set(preContentId).equalToWhenPresent(record::getPreContentId)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(UserBookshelf record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userBookshelf)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(bookId).equalTo(record::getBookId)
|
||||
.set(preContentId).equalTo(record::getPreContentId)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(UserBookshelf record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userBookshelf)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||
.set(preContentId).equalToWhenPresent(record::getPreContentId)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
|
||||
public final class UserBuyRecordDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final UserBuyRecord userBuyRecord = new UserBuyRecord();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = userBuyRecord.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> userId = userBuyRecord.userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> bookId = userBuyRecord.bookId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> bookName = userBuyRecord.bookName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> bookIndexId = userBuyRecord.bookIndexId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> bookIndexName = userBuyRecord.bookIndexName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Integer> buyAmount = userBuyRecord.buyAmount;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = userBuyRecord.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class UserBuyRecord extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> bookId = column("book_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> bookName = column("book_name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Long> bookIndexId = column("book_index_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> bookIndexName = column("book_index_name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Integer> buyAmount = column("buy_amount", JDBCType.INTEGER);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public UserBuyRecord() {
|
||||
super("user_buy_record");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,191 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import com.java2nb.novel.user.entity.UserBuyRecord;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSL;
|
||||
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategy;
|
||||
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSL;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.List;
|
||||
|
||||
import static com.java2nb.novel.user.mapper.UserBuyRecordDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
|
||||
@Mapper
|
||||
public interface UserBuyRecordMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<UserBuyRecord> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("UserBuyRecordResult")
|
||||
UserBuyRecord selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="UserBuyRecordResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="book_id", property="bookId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="book_name", property="bookName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="book_index_id", property="bookIndexId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="book_index_name", property="bookIndexName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="buy_amount", property="buyAmount", jdbcType=JdbcType.INTEGER),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<UserBuyRecord> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
|
||||
return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
|
||||
.from(userBuyRecord);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userBuyRecord);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userBuyRecord)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(UserBuyRecord record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userBuyRecord)
|
||||
.map(id).toProperty("id")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(bookId).toProperty("bookId")
|
||||
.map(bookName).toProperty("bookName")
|
||||
.map(bookIndexId).toProperty("bookIndexId")
|
||||
.map(bookIndexName).toProperty("bookIndexName")
|
||||
.map(buyAmount).toProperty("buyAmount")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(UserBuyRecord record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userBuyRecord)
|
||||
.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||
.map(bookId).toPropertyWhenPresent("bookId", record::getBookId)
|
||||
.map(bookName).toPropertyWhenPresent("bookName", record::getBookName)
|
||||
.map(bookIndexId).toPropertyWhenPresent("bookIndexId", record::getBookIndexId)
|
||||
.map(bookIndexName).toPropertyWhenPresent("bookIndexName", record::getBookIndexName)
|
||||
.map(buyAmount).toPropertyWhenPresent("buyAmount", record::getBuyAmount)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserBuyRecord>>> selectByExample() {
|
||||
return SelectDSL.selectWithMapper(this::selectMany, id, userId, bookId, bookName, bookIndexId, bookIndexName, buyAmount, createTime)
|
||||
.from(userBuyRecord);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserBuyRecord>>> selectDistinctByExample() {
|
||||
return SelectDSL.selectDistinctWithMapper(this::selectMany, id, userId, bookId, bookName, bookIndexId, bookIndexName, buyAmount, createTime)
|
||||
.from(userBuyRecord);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UserBuyRecord selectByPrimaryKey(Long id_) {
|
||||
return SelectDSL.selectWithMapper(this::selectOne, id, userId, bookId, bookName, bookIndexId, bookIndexName, buyAmount, createTime)
|
||||
.from(userBuyRecord)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(UserBuyRecord record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userBuyRecord)
|
||||
.set(id).equalTo(record::getId)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(bookId).equalTo(record::getBookId)
|
||||
.set(bookName).equalTo(record::getBookName)
|
||||
.set(bookIndexId).equalTo(record::getBookIndexId)
|
||||
.set(bookIndexName).equalTo(record::getBookIndexName)
|
||||
.set(buyAmount).equalTo(record::getBuyAmount)
|
||||
.set(createTime).equalTo(record::getCreateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(UserBuyRecord record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userBuyRecord)
|
||||
.set(id).equalToWhenPresent(record::getId)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||
.set(bookName).equalToWhenPresent(record::getBookName)
|
||||
.set(bookIndexId).equalToWhenPresent(record::getBookIndexId)
|
||||
.set(bookIndexName).equalToWhenPresent(record::getBookIndexName)
|
||||
.set(buyAmount).equalToWhenPresent(record::getBuyAmount)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(UserBuyRecord record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userBuyRecord)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(bookId).equalTo(record::getBookId)
|
||||
.set(bookName).equalTo(record::getBookName)
|
||||
.set(bookIndexId).equalTo(record::getBookIndexId)
|
||||
.set(bookIndexName).equalTo(record::getBookIndexName)
|
||||
.set(buyAmount).equalTo(record::getBuyAmount)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(UserBuyRecord record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userBuyRecord)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||
.set(bookName).equalToWhenPresent(record::getBookName)
|
||||
.set(bookIndexId).equalToWhenPresent(record::getBookIndexId)
|
||||
.set(bookIndexName).equalToWhenPresent(record::getBookIndexName)
|
||||
.set(buyAmount).equalToWhenPresent(record::getBuyAmount)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
}
|
@@ -1,70 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
|
||||
public final class UserDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final User user = new User();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = user.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> username = user.username;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> password = user.password;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> nickName = user.nickName;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> userPhoto = user.userPhoto;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> userSex = user.userSex;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> accountBalance = user.accountBalance;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> status = user.status;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = user.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> updateTime = user.updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class User extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> username = column("username", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> password = column("password", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> nickName = column("nick_name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> userPhoto = column("user_photo", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Byte> userSex = column("user_sex", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Long> accountBalance = column("account_balance", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Byte> status = column("status", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public User() {
|
||||
super("user");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
|
||||
public final class UserFeedbackDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final UserFeedback userFeedback = new UserFeedback();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = userFeedback.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> userId = userFeedback.userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<String> content = userFeedback.content;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = userFeedback.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class UserFeedback extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> content = column("content", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public UserFeedback() {
|
||||
super("user_feedback");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,163 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import com.java2nb.novel.user.entity.UserFeedback;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSL;
|
||||
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategy;
|
||||
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSL;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.List;
|
||||
|
||||
import static com.java2nb.novel.user.mapper.UserFeedbackDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
|
||||
@Mapper
|
||||
public interface UserFeedbackMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<UserFeedback> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("UserFeedbackResult")
|
||||
UserFeedback selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="UserFeedbackResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<UserFeedback> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
|
||||
return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
|
||||
.from(userFeedback);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userFeedback);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userFeedback)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(UserFeedback record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userFeedback)
|
||||
.map(id).toProperty("id")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(content).toProperty("content")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(UserFeedback record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userFeedback)
|
||||
.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||
.map(content).toPropertyWhenPresent("content", record::getContent)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserFeedback>>> selectByExample() {
|
||||
return SelectDSL.selectWithMapper(this::selectMany, id, userId, content, createTime)
|
||||
.from(userFeedback);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserFeedback>>> selectDistinctByExample() {
|
||||
return SelectDSL.selectDistinctWithMapper(this::selectMany, id, userId, content, createTime)
|
||||
.from(userFeedback);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UserFeedback selectByPrimaryKey(Long id_) {
|
||||
return SelectDSL.selectWithMapper(this::selectOne, id, userId, content, createTime)
|
||||
.from(userFeedback)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(UserFeedback record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userFeedback)
|
||||
.set(id).equalTo(record::getId)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(content).equalTo(record::getContent)
|
||||
.set(createTime).equalTo(record::getCreateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(UserFeedback record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userFeedback)
|
||||
.set(id).equalToWhenPresent(record::getId)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(content).equalToWhenPresent(record::getContent)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(UserFeedback record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userFeedback)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(content).equalTo(record::getContent)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(UserFeedback record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userFeedback)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(content).equalToWhenPresent(record::getContent)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
}
|
@@ -1,205 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import com.java2nb.novel.user.entity.User;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSL;
|
||||
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategy;
|
||||
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSL;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.List;
|
||||
|
||||
import static com.java2nb.novel.user.mapper.UserDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<User> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("UserResult")
|
||||
User selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="UserResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="username", property="username", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="nick_name", property="nickName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="user_photo", property="userPhoto", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="user_sex", property="userSex", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="account_balance", property="accountBalance", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<User> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
|
||||
return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
|
||||
.from(user);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, user);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, user)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(User record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(user)
|
||||
.map(id).toProperty("id")
|
||||
.map(username).toProperty("username")
|
||||
.map(password).toProperty("password")
|
||||
.map(nickName).toProperty("nickName")
|
||||
.map(userPhoto).toProperty("userPhoto")
|
||||
.map(userSex).toProperty("userSex")
|
||||
.map(accountBalance).toProperty("accountBalance")
|
||||
.map(status).toProperty("status")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(updateTime).toProperty("updateTime")
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(User record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(user)
|
||||
.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(username).toPropertyWhenPresent("username", record::getUsername)
|
||||
.map(password).toPropertyWhenPresent("password", record::getPassword)
|
||||
.map(nickName).toPropertyWhenPresent("nickName", record::getNickName)
|
||||
.map(userPhoto).toPropertyWhenPresent("userPhoto", record::getUserPhoto)
|
||||
.map(userSex).toPropertyWhenPresent("userSex", record::getUserSex)
|
||||
.map(accountBalance).toPropertyWhenPresent("accountBalance", record::getAccountBalance)
|
||||
.map(status).toPropertyWhenPresent("status", record::getStatus)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
.map(updateTime).toPropertyWhenPresent("updateTime", record::getUpdateTime)
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<User>>> selectByExample() {
|
||||
return SelectDSL.selectWithMapper(this::selectMany, id, username, password, nickName, userPhoto, userSex, accountBalance, status, createTime, updateTime)
|
||||
.from(user);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<User>>> selectDistinctByExample() {
|
||||
return SelectDSL.selectDistinctWithMapper(this::selectMany, id, username, password, nickName, userPhoto, userSex, accountBalance, status, createTime, updateTime)
|
||||
.from(user);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default User selectByPrimaryKey(Long id_) {
|
||||
return SelectDSL.selectWithMapper(this::selectOne, id, username, password, nickName, userPhoto, userSex, accountBalance, status, createTime, updateTime)
|
||||
.from(user)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(User record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, user)
|
||||
.set(id).equalTo(record::getId)
|
||||
.set(username).equalTo(record::getUsername)
|
||||
.set(password).equalTo(record::getPassword)
|
||||
.set(nickName).equalTo(record::getNickName)
|
||||
.set(userPhoto).equalTo(record::getUserPhoto)
|
||||
.set(userSex).equalTo(record::getUserSex)
|
||||
.set(accountBalance).equalTo(record::getAccountBalance)
|
||||
.set(status).equalTo(record::getStatus)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(User record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, user)
|
||||
.set(id).equalToWhenPresent(record::getId)
|
||||
.set(username).equalToWhenPresent(record::getUsername)
|
||||
.set(password).equalToWhenPresent(record::getPassword)
|
||||
.set(nickName).equalToWhenPresent(record::getNickName)
|
||||
.set(userPhoto).equalToWhenPresent(record::getUserPhoto)
|
||||
.set(userSex).equalToWhenPresent(record::getUserSex)
|
||||
.set(accountBalance).equalToWhenPresent(record::getAccountBalance)
|
||||
.set(status).equalToWhenPresent(record::getStatus)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(User record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, user)
|
||||
.set(username).equalTo(record::getUsername)
|
||||
.set(password).equalTo(record::getPassword)
|
||||
.set(nickName).equalTo(record::getNickName)
|
||||
.set(userPhoto).equalTo(record::getUserPhoto)
|
||||
.set(userSex).equalTo(record::getUserSex)
|
||||
.set(accountBalance).equalTo(record::getAccountBalance)
|
||||
.set(status).equalTo(record::getStatus)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(User record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, user)
|
||||
.set(username).equalToWhenPresent(record::getUsername)
|
||||
.set(password).equalToWhenPresent(record::getPassword)
|
||||
.set(nickName).equalToWhenPresent(record::getNickName)
|
||||
.set(userPhoto).equalToWhenPresent(record::getUserPhoto)
|
||||
.set(userSex).equalToWhenPresent(record::getUserSex)
|
||||
.set(accountBalance).equalToWhenPresent(record::getAccountBalance)
|
||||
.set(status).equalToWhenPresent(record::getStatus)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
}
|
@@ -1,55 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
|
||||
public final class UserPayRecordDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final UserPayRecord userPayRecord = new UserPayRecord();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = userPayRecord.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> userId = userPayRecord.userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Byte> payChannel = userPayRecord.payChannel;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> outTradeNo = userPayRecord.outTradeNo;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Integer> totalAmount = userPayRecord.totalAmount;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Integer> wuAmount = userPayRecord.wuAmount;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> payTime = userPayRecord.payTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class UserPayRecord extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Byte> payChannel = column("pay_channel", JDBCType.TINYINT);
|
||||
|
||||
public final SqlColumn<Long> outTradeNo = column("out_trade_no", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Integer> totalAmount = column("total_amount", JDBCType.INTEGER);
|
||||
|
||||
public final SqlColumn<Integer> wuAmount = column("wu_amount", JDBCType.INTEGER);
|
||||
|
||||
public final SqlColumn<Date> payTime = column("pay_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public UserPayRecord() {
|
||||
super("user_pay_record");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,184 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import com.java2nb.novel.user.entity.UserPayRecord;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSL;
|
||||
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategy;
|
||||
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSL;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.List;
|
||||
|
||||
import static com.java2nb.novel.user.mapper.UserPayRecordDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
|
||||
@Mapper
|
||||
public interface UserPayRecordMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<UserPayRecord> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("UserPayRecordResult")
|
||||
UserPayRecord selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="UserPayRecordResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="pay_channel", property="payChannel", jdbcType=JdbcType.TINYINT),
|
||||
@Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="total_amount", property="totalAmount", jdbcType=JdbcType.INTEGER),
|
||||
@Result(column="wu_amount", property="wuAmount", jdbcType=JdbcType.INTEGER),
|
||||
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<UserPayRecord> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
|
||||
return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
|
||||
.from(userPayRecord);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userPayRecord);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userPayRecord)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(UserPayRecord record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userPayRecord)
|
||||
.map(id).toProperty("id")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(payChannel).toProperty("payChannel")
|
||||
.map(outTradeNo).toProperty("outTradeNo")
|
||||
.map(totalAmount).toProperty("totalAmount")
|
||||
.map(wuAmount).toProperty("wuAmount")
|
||||
.map(payTime).toProperty("payTime")
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(UserPayRecord record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userPayRecord)
|
||||
.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||
.map(payChannel).toPropertyWhenPresent("payChannel", record::getPayChannel)
|
||||
.map(outTradeNo).toPropertyWhenPresent("outTradeNo", record::getOutTradeNo)
|
||||
.map(totalAmount).toPropertyWhenPresent("totalAmount", record::getTotalAmount)
|
||||
.map(wuAmount).toPropertyWhenPresent("wuAmount", record::getWuAmount)
|
||||
.map(payTime).toPropertyWhenPresent("payTime", record::getPayTime)
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserPayRecord>>> selectByExample() {
|
||||
return SelectDSL.selectWithMapper(this::selectMany, id, userId, payChannel, outTradeNo, totalAmount, wuAmount, payTime)
|
||||
.from(userPayRecord);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserPayRecord>>> selectDistinctByExample() {
|
||||
return SelectDSL.selectDistinctWithMapper(this::selectMany, id, userId, payChannel, outTradeNo, totalAmount, wuAmount, payTime)
|
||||
.from(userPayRecord);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UserPayRecord selectByPrimaryKey(Long id_) {
|
||||
return SelectDSL.selectWithMapper(this::selectOne, id, userId, payChannel, outTradeNo, totalAmount, wuAmount, payTime)
|
||||
.from(userPayRecord)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(UserPayRecord record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userPayRecord)
|
||||
.set(id).equalTo(record::getId)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(payChannel).equalTo(record::getPayChannel)
|
||||
.set(outTradeNo).equalTo(record::getOutTradeNo)
|
||||
.set(totalAmount).equalTo(record::getTotalAmount)
|
||||
.set(wuAmount).equalTo(record::getWuAmount)
|
||||
.set(payTime).equalTo(record::getPayTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(UserPayRecord record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userPayRecord)
|
||||
.set(id).equalToWhenPresent(record::getId)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(payChannel).equalToWhenPresent(record::getPayChannel)
|
||||
.set(outTradeNo).equalToWhenPresent(record::getOutTradeNo)
|
||||
.set(totalAmount).equalToWhenPresent(record::getTotalAmount)
|
||||
.set(wuAmount).equalToWhenPresent(record::getWuAmount)
|
||||
.set(payTime).equalToWhenPresent(record::getPayTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(UserPayRecord record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userPayRecord)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(payChannel).equalTo(record::getPayChannel)
|
||||
.set(outTradeNo).equalTo(record::getOutTradeNo)
|
||||
.set(totalAmount).equalTo(record::getTotalAmount)
|
||||
.set(wuAmount).equalTo(record::getWuAmount)
|
||||
.set(payTime).equalTo(record::getPayTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(UserPayRecord record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userPayRecord)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(payChannel).equalToWhenPresent(record::getPayChannel)
|
||||
.set(outTradeNo).equalToWhenPresent(record::getOutTradeNo)
|
||||
.set(totalAmount).equalToWhenPresent(record::getTotalAmount)
|
||||
.set(wuAmount).equalToWhenPresent(record::getWuAmount)
|
||||
.set(payTime).equalToWhenPresent(record::getPayTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
|
||||
public final class UserReadHistoryDynamicSqlSupport {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final UserReadHistory userReadHistory = new UserReadHistory();
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> id = userReadHistory.id;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> userId = userReadHistory.userId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> bookId = userReadHistory.bookId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Long> preContentId = userReadHistory.preContentId;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> createTime = userReadHistory.createTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final SqlColumn<Date> updateTime = userReadHistory.updateTime;
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
public static final class UserReadHistory extends SqlTable {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> bookId = column("book_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Long> preContentId = column("pre_content_id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public UserReadHistory() {
|
||||
super("user_read_history");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,177 +0,0 @@
|
||||
package com.java2nb.novel.user.mapper;
|
||||
|
||||
import com.java2nb.novel.user.entity.UserReadHistory;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSL;
|
||||
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategy;
|
||||
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSL;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.List;
|
||||
|
||||
import static com.java2nb.novel.user.mapper.UserReadHistoryDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
|
||||
@Mapper
|
||||
public interface UserReadHistoryMapper {
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
long count(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||
int delete(DeleteStatementProvider deleteStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||
int insert(InsertStatementProvider<UserReadHistory> insertStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("UserReadHistoryResult")
|
||||
UserReadHistory selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="UserReadHistoryResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="book_id", property="bookId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="pre_content_id", property="preContentId", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
|
||||
})
|
||||
List<UserReadHistory> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||
int update(UpdateStatementProvider updateStatement);
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
|
||||
return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
|
||||
.from(userReadHistory);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userReadHistory);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return DeleteDSL.deleteFromWithMapper(this::delete, userReadHistory)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insert(UserReadHistory record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userReadHistory)
|
||||
.map(id).toProperty("id")
|
||||
.map(userId).toProperty("userId")
|
||||
.map(bookId).toProperty("bookId")
|
||||
.map(preContentId).toProperty("preContentId")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(updateTime).toProperty("updateTime")
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int insertSelective(UserReadHistory record) {
|
||||
return insert(SqlBuilder.insert(record)
|
||||
.into(userReadHistory)
|
||||
.map(id).toPropertyWhenPresent("id", record::getId)
|
||||
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||
.map(bookId).toPropertyWhenPresent("bookId", record::getBookId)
|
||||
.map(preContentId).toPropertyWhenPresent("preContentId", record::getPreContentId)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||
.map(updateTime).toPropertyWhenPresent("updateTime", record::getUpdateTime)
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserReadHistory>>> selectByExample() {
|
||||
return SelectDSL.selectWithMapper(this::selectMany, id, userId, bookId, preContentId, createTime, updateTime)
|
||||
.from(userReadHistory);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserReadHistory>>> selectDistinctByExample() {
|
||||
return SelectDSL.selectDistinctWithMapper(this::selectMany, id, userId, bookId, preContentId, createTime, updateTime)
|
||||
.from(userReadHistory);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UserReadHistory selectByPrimaryKey(Long id_) {
|
||||
return SelectDSL.selectWithMapper(this::selectOne, id, userId, bookId, preContentId, createTime, updateTime)
|
||||
.from(userReadHistory)
|
||||
.where(id, isEqualTo(id_))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(UserReadHistory record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userReadHistory)
|
||||
.set(id).equalTo(record::getId)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(bookId).equalTo(record::getBookId)
|
||||
.set(preContentId).equalTo(record::getPreContentId)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(UserReadHistory record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userReadHistory)
|
||||
.set(id).equalToWhenPresent(record::getId)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||
.set(preContentId).equalToWhenPresent(record::getPreContentId)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime);
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKey(UserReadHistory record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userReadHistory)
|
||||
.set(userId).equalTo(record::getUserId)
|
||||
.set(bookId).equalTo(record::getBookId)
|
||||
.set(preContentId).equalTo(record::getPreContentId)
|
||||
.set(createTime).equalTo(record::getCreateTime)
|
||||
.set(updateTime).equalTo(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||
default int updateByPrimaryKeySelective(UserReadHistory record) {
|
||||
return UpdateDSL.updateWithMapper(this::update, userReadHistory)
|
||||
.set(userId).equalToWhenPresent(record::getUserId)
|
||||
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||
.set(preContentId).equalToWhenPresent(record::getPreContentId)
|
||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
|
||||
.where(id, isEqualTo(record::getId))
|
||||
.build()
|
||||
.execute();
|
||||
}
|
||||
}
|
@@ -1,151 +0,0 @@
|
||||
package com.java2nb.novel.user.service;
|
||||
|
||||
|
||||
import com.java2nb.novel.common.bean.PageBean;
|
||||
import com.java2nb.novel.common.bean.UserDetails;
|
||||
import com.java2nb.novel.user.entity.User;
|
||||
import com.java2nb.novel.user.entity.UserBookshelf;
|
||||
import com.java2nb.novel.user.entity.UserFeedback;
|
||||
import com.java2nb.novel.user.entity.UserReadHistory;
|
||||
import com.java2nb.novel.user.vo.BookReadHistoryVO;
|
||||
import com.java2nb.novel.user.vo.BookShelfVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户服务接口
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/28
|
||||
*/
|
||||
public interface UserService {
|
||||
|
||||
/**
|
||||
* 根据用户名密码查询记录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 用户对象,不存在返回null
|
||||
*/
|
||||
User queryByUsernameAndPassword(String username, String password);
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
* @param user 用户注册信息类
|
||||
* @return jwt载体信息类
|
||||
* */
|
||||
UserDetails register(User user);
|
||||
|
||||
/**
|
||||
* 用户登陆
|
||||
* @param user 用户登陆信息类
|
||||
* @return jwt载体信息类
|
||||
* */
|
||||
UserDetails login(User user);
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户名ID集合查询用户集合信息
|
||||
*
|
||||
* @param ids 用户ID集合
|
||||
* @return 用户集合对象
|
||||
*/
|
||||
List<User> queryById(List<Long> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 查询小说是否已加入书架
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param bookId 小说ID
|
||||
* @return true:已加入书架,未加入书架
|
||||
*/
|
||||
Boolean queryIsInShelf(Long userId, Long bookId);
|
||||
|
||||
/**
|
||||
* 加入书架
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param bookId 小说ID
|
||||
* @param preContentId 阅读的内容ID
|
||||
*/
|
||||
void addToBookShelf(Long userId, Long bookId, Long preContentId);
|
||||
|
||||
/**
|
||||
* 移出书架
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param bookId 小说ID
|
||||
*/
|
||||
void removeFromBookShelf(Long userId, Long bookId);
|
||||
|
||||
/**
|
||||
* 查询书架
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return 书架分页集合
|
||||
*/
|
||||
PageBean<UserBookshelf> listBookShelfByPage(Long userId, int page, int pageSize);
|
||||
|
||||
/**
|
||||
* 分页查询阅读记录
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param page 页码
|
||||
* @param pageSize 分页大小
|
||||
* @return
|
||||
*/
|
||||
PageBean<UserReadHistory> listReadHistoryByPage(Long userId, int page, int pageSize);
|
||||
|
||||
/**
|
||||
* 添加阅读记录
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param bookId 书籍id
|
||||
* @param preContentId 阅读的目录id
|
||||
*/
|
||||
void addReadHistory(Long userId, Long bookId, Long preContentId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加反馈
|
||||
* @param userId 用户id
|
||||
* @param content 反馈内容
|
||||
* */
|
||||
void addFeedBack(Long userId, String content);
|
||||
|
||||
/**
|
||||
* 分页查询我的反馈列表
|
||||
* @param userId 用户ID
|
||||
* @param page 页码
|
||||
* @param pageSize 分页大小
|
||||
* @return 反馈集合
|
||||
* */
|
||||
PageBean<UserFeedback> listUserFeedBackByPage(Long userId, int page, int pageSize);
|
||||
|
||||
/**
|
||||
* 查询个人信息
|
||||
* @param userId 用户id
|
||||
* @return 用户信息
|
||||
* */
|
||||
User userInfo(Long userId);
|
||||
|
||||
/**
|
||||
* 更新个人信息
|
||||
* @param userId 用户id
|
||||
* @param user 需要更新的信息
|
||||
* */
|
||||
void updateUserInfo(Long userId, User user);
|
||||
|
||||
/**
|
||||
* 更新密码
|
||||
* @param userId 用户id
|
||||
* @param oldPassword 旧密码
|
||||
* @param newPassword 新密码
|
||||
* */
|
||||
void updatePassword(Long userId, String oldPassword, String newPassword);
|
||||
|
||||
}
|
@@ -1,334 +0,0 @@
|
||||
package com.java2nb.novel.user.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.java2nb.novel.book.entity.Book;
|
||||
import com.java2nb.novel.common.bean.PageBean;
|
||||
import com.java2nb.novel.common.bean.UserDetails;
|
||||
import com.java2nb.novel.common.enums.ResponseStatus;
|
||||
import com.java2nb.novel.common.exception.BusinessException;
|
||||
import com.java2nb.novel.common.utils.IdWorker;
|
||||
import com.java2nb.novel.common.utils.MD5Util;
|
||||
import com.java2nb.novel.user.entity.User;
|
||||
import com.java2nb.novel.user.entity.UserBookshelf;
|
||||
import com.java2nb.novel.user.entity.UserFeedback;
|
||||
import com.java2nb.novel.user.entity.UserReadHistory;
|
||||
import com.java2nb.novel.user.feign.BookFeignClient;
|
||||
import com.java2nb.novel.user.mapper.*;
|
||||
import com.java2nb.novel.user.service.UserService;
|
||||
import com.java2nb.novel.user.vo.BookReadHistoryVO;
|
||||
import com.java2nb.novel.user.vo.BookShelfVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.Charsets;
|
||||
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.java2nb.novel.user.mapper.UserBookshelfDynamicSqlSupport.userBookshelf;
|
||||
import static com.java2nb.novel.user.mapper.UserReadHistoryDynamicSqlSupport.userReadHistory;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
import static org.mybatis.dynamic.sql.select.SelectDSL.select;
|
||||
|
||||
/**
|
||||
* 小说服务接口实现
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @version 1.0
|
||||
* @since 2020/5/28
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
private final UserMapper userMapper;
|
||||
|
||||
private final UserBookshelfMapper userBookshelfMapper;
|
||||
|
||||
private final UserReadHistoryMapper userReadHistoryMapper;
|
||||
|
||||
private final UserFeedbackMapper userFeedbackMapper;
|
||||
|
||||
private final BookFeignClient bookFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public User queryByUsernameAndPassword(String username, String password) {
|
||||
|
||||
List<User> users = userMapper.selectMany(
|
||||
select(UserDynamicSqlSupport.id, UserDynamicSqlSupport.username, UserDynamicSqlSupport.nickName)
|
||||
.from(UserDynamicSqlSupport.user)
|
||||
.where(UserDynamicSqlSupport.username, isEqualTo(username))
|
||||
.and(UserDynamicSqlSupport.password, isEqualTo(MD5Util.MD5Encode(password, Charsets.UTF_8.name())))
|
||||
.limit(1)
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
return users.size() > 0 ? users.get(0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDetails login(User user) {
|
||||
//根据用户名密码查询记录
|
||||
user = queryByUsernameAndPassword(user.getUsername(), user.getPassword());
|
||||
if (user == null) {
|
||||
throw new BusinessException(ResponseStatus.USERNAME_PASS_ERROR);
|
||||
}
|
||||
//生成UserDetail对象并返回
|
||||
UserDetails userDetails = new UserDetails();
|
||||
userDetails.setId(user.getId());
|
||||
userDetails.setNickName(user.getNickName());
|
||||
userDetails.setUsername(user.getUsername());
|
||||
return userDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> queryById(List<Long> ids) {
|
||||
return userMapper.selectMany(
|
||||
select(UserDynamicSqlSupport.id, UserDynamicSqlSupport.username,
|
||||
UserDynamicSqlSupport.userPhoto)
|
||||
.from(UserDynamicSqlSupport.user)
|
||||
.where(UserDynamicSqlSupport.id, isIn(ids)).build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDetails register(User user) {
|
||||
//查询用户名是否已注册
|
||||
SelectStatementProvider selectStatement = select(count(UserDynamicSqlSupport.id))
|
||||
.from(UserDynamicSqlSupport.user)
|
||||
.where(UserDynamicSqlSupport.username, isEqualTo(user.getUsername()))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
long count = userMapper.count(selectStatement);
|
||||
if (count > 0) {
|
||||
//用户名已注册
|
||||
throw new BusinessException(ResponseStatus.USERNAME_EXIST);
|
||||
}
|
||||
User entity = new User();
|
||||
BeanUtils.copyProperties(user, entity);
|
||||
//数据库生成注册记录
|
||||
Long id = new IdWorker().nextId();
|
||||
entity.setId(id);
|
||||
entity.setNickName(entity.getUsername());
|
||||
Date currentDate = new Date();
|
||||
entity.setCreateTime(currentDate);
|
||||
entity.setUpdateTime(currentDate);
|
||||
entity.setPassword(MD5Util.MD5Encode(entity.getPassword(), Charsets.UTF_8.name()));
|
||||
userMapper.insertSelective(entity);
|
||||
//生成UserDetail对象并返回
|
||||
UserDetails userDetails = new UserDetails();
|
||||
userDetails.setId(id);
|
||||
userDetails.setUsername(entity.getUsername());
|
||||
userDetails.setNickName(entity.getNickName());
|
||||
return userDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean queryIsInShelf(Long userId, Long bookId) {
|
||||
SelectStatementProvider selectStatement = select(count(UserBookshelfDynamicSqlSupport.id))
|
||||
.from(userBookshelf)
|
||||
.where(UserBookshelfDynamicSqlSupport.userId, isEqualTo(userId))
|
||||
.and(UserBookshelfDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
|
||||
return userBookshelfMapper.count(selectStatement) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToBookShelf(Long userId, Long bookId, Long preContentId) {
|
||||
if (!queryIsInShelf(userId, bookId)) {
|
||||
UserBookshelf shelf = new UserBookshelf();
|
||||
shelf.setUserId(userId);
|
||||
shelf.setBookId(bookId);
|
||||
shelf.setPreContentId(preContentId);
|
||||
shelf.setCreateTime(new Date());
|
||||
userBookshelfMapper.insert(shelf);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromBookShelf(Long userId, Long bookId) {
|
||||
DeleteStatementProvider deleteStatement = deleteFrom(userBookshelf)
|
||||
.where(UserBookshelfDynamicSqlSupport.userId, isEqualTo(userId))
|
||||
.and(UserBookshelfDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
userBookshelfMapper.delete(deleteStatement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageBean<UserBookshelf> listBookShelfByPage(Long userId, int page, int pageSize) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<UserBookshelf> userBookshelves = userBookshelfMapper.selectMany(
|
||||
select(UserBookshelfDynamicSqlSupport.bookId, UserBookshelfDynamicSqlSupport.preContentId)
|
||||
.from(userBookshelf)
|
||||
.where(UserBookshelfDynamicSqlSupport.userId, isEqualTo(userId))
|
||||
.orderBy(UserBookshelfDynamicSqlSupport.createTime.descending())
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
|
||||
List<Book> books = bookFeignClient.queryBookByIds(userBookshelves.stream().map(UserBookshelf::getBookId).collect(Collectors.toList()));
|
||||
Map<Long, Book> booksById = books.stream().collect(Collectors.toMap(Book::getId, Function.identity(), (key1, key2) -> key2));
|
||||
|
||||
//TODO 书架表增加书籍相关的冗余字段,书籍信息更新后小说服务通过mq发送message,其他服务消费message更新所有的冗余字段
|
||||
List<BookShelfVO> resultList = new ArrayList<>(booksById.size());
|
||||
userBookshelves.forEach(bookshelf->{
|
||||
BookShelfVO bookShelfVO = new BookShelfVO();
|
||||
BeanUtils.copyProperties(bookshelf, bookShelfVO);
|
||||
Book book = booksById.get(bookshelf.getBookId());
|
||||
if (book != null) {
|
||||
BeanUtils.copyProperties(book, bookShelfVO);
|
||||
resultList.add(bookShelfVO);
|
||||
}
|
||||
});
|
||||
PageBean<UserBookshelf> pageBean = new PageBean<>(userBookshelves);
|
||||
pageBean.setList(resultList);
|
||||
|
||||
return pageBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageBean<UserReadHistory> listReadHistoryByPage(Long userId, int page, int pageSize) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<UserReadHistory> userReadHistories = userReadHistoryMapper.selectMany(
|
||||
select(UserReadHistoryDynamicSqlSupport.bookId, UserReadHistoryDynamicSqlSupport.preContentId)
|
||||
.from(userReadHistory)
|
||||
.where(UserReadHistoryDynamicSqlSupport.userId, isEqualTo(userId))
|
||||
.orderBy(UserReadHistoryDynamicSqlSupport.createTime.descending())
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
|
||||
List<Book> books = bookFeignClient.queryBookByIds(userReadHistories.stream().map(UserReadHistory::getBookId).collect(Collectors.toList()));
|
||||
|
||||
Map<Long, Book> booksById = books.stream().collect(Collectors.toMap(Book::getId, Function.identity(), (key1, key2) -> key2));
|
||||
|
||||
List<BookReadHistoryVO> resultList = new ArrayList<>(booksById.size());
|
||||
userReadHistories.forEach(readHistory->{
|
||||
BookReadHistoryVO readHistoryVO = new BookReadHistoryVO();
|
||||
BeanUtils.copyProperties(readHistory, readHistoryVO);
|
||||
Book book = booksById.get(readHistory.getBookId());
|
||||
if (book != null) {
|
||||
BeanUtils.copyProperties(book, readHistoryVO);
|
||||
resultList.add(readHistoryVO);
|
||||
}
|
||||
});
|
||||
PageBean<UserReadHistory> pageBean = new PageBean<>(userReadHistories);
|
||||
pageBean.setList(resultList);
|
||||
return pageBean;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void addReadHistory(Long userId, Long bookId, Long preContentId) {
|
||||
|
||||
Date currentDate = new Date();
|
||||
//删除该书以前的历史记录
|
||||
DeleteStatementProvider deleteStatement = deleteFrom(userReadHistory)
|
||||
.where(UserReadHistoryDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||
.and(UserReadHistoryDynamicSqlSupport.userId, isEqualTo(userId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
userReadHistoryMapper.delete(deleteStatement);
|
||||
|
||||
//插入该书新的历史记录
|
||||
UserReadHistory userReadHistory = new UserReadHistory();
|
||||
userReadHistory.setBookId(bookId);
|
||||
userReadHistory.setUserId(userId);
|
||||
userReadHistory.setPreContentId(preContentId);
|
||||
userReadHistory.setCreateTime(currentDate);
|
||||
userReadHistory.setUpdateTime(currentDate);
|
||||
userReadHistoryMapper.insertSelective(userReadHistory);
|
||||
|
||||
|
||||
//更新书架的阅读历史
|
||||
UpdateStatementProvider updateStatement = update(userBookshelf)
|
||||
.set(UserBookshelfDynamicSqlSupport.preContentId)
|
||||
.equalTo(preContentId)
|
||||
.set(UserBookshelfDynamicSqlSupport.updateTime)
|
||||
.equalTo(currentDate)
|
||||
.where(UserBookshelfDynamicSqlSupport.userId, isEqualTo(userId))
|
||||
.and(UserBookshelfDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
|
||||
userBookshelfMapper.update(updateStatement);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFeedBack(Long userId, String content) {
|
||||
UserFeedback feedback = new UserFeedback();
|
||||
feedback.setUserId(userId);
|
||||
feedback.setContent(content);
|
||||
feedback.setCreateTime(new Date());
|
||||
userFeedbackMapper.insertSelective(feedback);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageBean<UserFeedback> listUserFeedBackByPage(Long userId, int page, int pageSize) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
return new PageBean<>(userFeedbackMapper.selectMany(select(UserFeedbackDynamicSqlSupport.content, UserFeedbackDynamicSqlSupport.createTime)
|
||||
.from(UserFeedbackDynamicSqlSupport.userFeedback)
|
||||
.where(UserFeedbackDynamicSqlSupport.userId, isEqualTo(userId))
|
||||
.orderBy(UserFeedbackDynamicSqlSupport.id.descending())
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public User userInfo(Long userId) {
|
||||
SelectStatementProvider selectStatement = select(UserDynamicSqlSupport.username, UserDynamicSqlSupport.nickName,
|
||||
UserDynamicSqlSupport.userPhoto, UserDynamicSqlSupport.userSex, UserDynamicSqlSupport.accountBalance)
|
||||
.from(UserDynamicSqlSupport.user)
|
||||
.where(UserDynamicSqlSupport.id, isEqualTo(userId))
|
||||
.limit(1)
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
return userMapper.selectMany(selectStatement).get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserInfo(Long userId, User user) {
|
||||
user.setId(userId);
|
||||
user.setUpdateTime(new Date());
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePassword(Long userId, String oldPassword, String newPassword) {
|
||||
SelectStatementProvider selectStatement = select(UserDynamicSqlSupport.password)
|
||||
.from(UserDynamicSqlSupport.user)
|
||||
.where(UserDynamicSqlSupport.id, isEqualTo(userId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
if (!userMapper.selectMany(selectStatement).get(0).getPassword().equals(MD5Util.MD5Encode(oldPassword, Charsets.UTF_8.name()))) {
|
||||
throw new BusinessException(ResponseStatus.OLD_PASSWORD_ERROR);
|
||||
}
|
||||
UpdateStatementProvider updateStatement = update(UserDynamicSqlSupport.user)
|
||||
.set(UserDynamicSqlSupport.password)
|
||||
.equalTo(MD5Util.MD5Encode(newPassword, Charsets.UTF_8.name()))
|
||||
.where(UserDynamicSqlSupport.id, isEqualTo(userId))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3);
|
||||
userMapper.update(updateStatement);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@@ -1,4 +0,0 @@
|
||||
spring:
|
||||
profiles:
|
||||
include: [common]
|
||||
|
@@ -1,17 +0,0 @@
|
||||
spring:
|
||||
application:
|
||||
name: user-service
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
ext‐config[0]:
|
||||
data‐id: novel-jwt.yml
|
||||
group: novel-common
|
||||
refresh: true
|
||||
ext‐config[1]:
|
||||
data‐id: novel-redis.yml
|
||||
group: novel-common
|
||||
refresh: true
|
||||
profiles:
|
||||
active: dev
|
||||
|
Reference in New Issue
Block a user