用户的增删改查,修改时没有将密码加密---未做

This commit is contained in:
bunny 2023-12-14 00:14:42 +08:00
parent 74d7519ed1
commit 0e1e444a7a
94 changed files with 1251 additions and 1063 deletions

View File

@ -0,0 +1,9 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,com.github.pagehelper.page.PageMethod,startPage" />
</inspection_tool>
<inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,17 +1,17 @@
package cn.bunny.exception;
import cn.bunny.spzx.model.vo.common.ResultCodeEnum;
import lombok.Data;
@Data
public class BunnyException extends RuntimeException {
private Integer code;
private String message;
private ResultCodeEnum resultCodeEnum;
public BunnyException(ResultCodeEnum resultCodeEnum) {
this.resultCodeEnum = resultCodeEnum;
this.code = resultCodeEnum.getCode();
this.message = resultCodeEnum.getMessage();
}
}
package cn.bunny.common.exception;
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
import lombok.Data;
@Data
public class BunnyException extends RuntimeException {
private Integer code;
private String message;
private ResultCodeEnum resultCodeEnum;
public BunnyException(ResultCodeEnum resultCodeEnum) {
this.resultCodeEnum = resultCodeEnum;
this.code = resultCodeEnum.getCode();
this.message = resultCodeEnum.getMessage();
}
}

View File

@ -1,25 +1,25 @@
package cn.bunny.exception;
import cn.bunny.spzx.model.vo.common.Result;
import cn.bunny.spzx.model.vo.common.ResultCodeEnum;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
public class GlobalExceptionHandler {
// 全局异常处理
@ExceptionHandler(Exception.class)
@ResponseBody
public Result error() {
return Result.build(null, ResultCodeEnum.SYSTEM_ERROR);
}
// 自定义异常处理
@ExceptionHandler
@ResponseBody
public Result error(BunnyException bunnyException) {
return Result.build(null, bunnyException.getResultCodeEnum());
}
}
package cn.bunny.common.exception;
import cn.bunny.common.spzx.model.vo.common.Result;
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
public class GlobalExceptionHandler {
// 全局异常处理
@ExceptionHandler(Exception.class)
@ResponseBody
public Result error() {
return Result.build(null, ResultCodeEnum.SYSTEM_ERROR);
}
// 自定义异常处理
@ExceptionHandler
@ResponseBody
public Result error(BunnyException bunnyException) {
return Result.build(null, bunnyException.getResultCodeEnum());
}
}

View File

@ -13,7 +13,7 @@ public class Knife4jConfig {
@Bean
public GroupedOpenApi adminApi() {// 创建API分组
return GroupedOpenApi.builder()
.group("admin-api")
.group("admin-api111")
.pathsToMatch("/admin/**")
.build();
}
@ -22,4 +22,5 @@ public class Knife4jConfig {
public OpenAPI customerOpenApi() {
return new OpenAPI().info(new Info().title("接口文档").version("1.0").contact(new Contact()
.name("bunny")));
}}
}
}

View File

@ -1,7 +0,0 @@
package cn.bunny;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

View File

@ -1,24 +1,24 @@
package cn.bunny;
import cn.bunny.spzx.model.entity.system.SysUser;
public class AuthContextUtil {
// 创建一个ThreadLocal对象
private static final ThreadLocal<SysUser> threadLocal = new ThreadLocal<>();
// 定义存储数据的静态方法
public static void set(SysUser sysUser) {
threadLocal.set(sysUser);
}
// 定义获取数据的方法
public static SysUser get() {
return threadLocal.get();
}
// 删除数据的方法
public static void remove() {
threadLocal.remove();
}
}
package cn.bunny.common;
import cn.bunny.common.spzx.model.entity.system.SysUser;
public class AuthContextUtil {
// 创建一个ThreadLocal对象
private static final ThreadLocal<SysUser> threadLocal = new ThreadLocal<>();
// 定义存储数据的静态方法
public static void set(SysUser sysUser) {
threadLocal.set(sysUser);
}
// 定义获取数据的方法
public static SysUser get() {
return threadLocal.get();
}
// 删除数据的方法
public static void remove() {
threadLocal.remove();
}
}

View File

@ -1,4 +1,4 @@
package cn.bunny;
package cn.bunny.common;
public class Main {
public static void main(String[] args) {

View File

@ -4,11 +4,10 @@ import cn.bunny.properties.UserProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@EnableConfigurationProperties(value = {UserProperties.class})
@ComponentScan(basePackages = "cn.bunny")
// @ComponentScan(basePackages = "cn.bunny")
public class MangerApplication {
public static void main(String[] args) {
SpringApplication.run(MangerApplication.class, args);

View File

@ -1,40 +1,40 @@
package cn.bunny.config;
import cn.bunny.interceptor.LoginAuthInterceptor;
import cn.bunny.properties.UserProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Component
public class WebMvcConfiguration implements WebMvcConfigurer {
@Autowired
private LoginAuthInterceptor loginAuthInterceptor;
@Autowired
private UserProperties userProperties;
// 拦截器注册
@Override
public void addInterceptors(InterceptorRegistry registry) {
// .excludePathPatterns("/admin/system/index/login", "/admin.system/index/generateValidateCode")
// registry.addInterceptor(loginAuthInterceptor)
// .addPathPatterns("/**")
// .excludePathPatterns(userProperties.getNoAuthUrls());
}
// 解决跨域
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowCredentials(true)
.allowedOriginPatterns("*")
.allowedMethods("*")
.allowedHeaders("*");
}
}
package cn.bunny.config;
import cn.bunny.interceptor.LoginAuthInterceptor;
import cn.bunny.properties.UserProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Component
public class WebMvcConfiguration implements WebMvcConfigurer {
@Autowired
private LoginAuthInterceptor loginAuthInterceptor;
@Autowired
private UserProperties userProperties;
// 拦截器注册
@Override
public void addInterceptors(InterceptorRegistry registry) {
// .excludePathPatterns("/admin/system/index/login", "/admin.system/index/generateValidateCode")
// registry.addInterceptor(loginAuthInterceptor)
// .addPathPatterns("/**")
// .excludePathPatterns(userProperties.getNoAuthUrls());
}
// 解决跨域
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowCredentials(true)
.allowedOriginPatterns("*")
.allowedMethods("*")
.allowedHeaders("*");
}
}

View File

@ -1,15 +1,15 @@
package cn.bunny.controller;
import cn.bunny.AuthContextUtil;
import cn.bunny.common.AuthContextUtil;
import cn.bunny.common.spzx.model.dto.system.LoginDto;
import cn.bunny.common.spzx.model.entity.system.SysUser;
import cn.bunny.common.spzx.model.entity.user.UserInfo;
import cn.bunny.common.spzx.model.vo.common.Result;
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
import cn.bunny.common.spzx.model.vo.system.LoginVo;
import cn.bunny.common.spzx.model.vo.system.ValidateCodeVo;
import cn.bunny.service.SysUserService;
import cn.bunny.service.ValidateCodeService;
import cn.bunny.spzx.model.dto.system.LoginDto;
import cn.bunny.spzx.model.entity.system.SysUser;
import cn.bunny.spzx.model.entity.user.UserInfo;
import cn.bunny.spzx.model.vo.common.Result;
import cn.bunny.spzx.model.vo.common.ResultCodeEnum;
import cn.bunny.spzx.model.vo.system.LoginVo;
import cn.bunny.spzx.model.vo.system.ValidateCodeVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;

View File

@ -1,10 +1,10 @@
package cn.bunny.controller;
import cn.bunny.common.spzx.model.dto.system.SysRoleDto;
import cn.bunny.common.spzx.model.entity.system.SysRole;
import cn.bunny.common.spzx.model.vo.common.Result;
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
import cn.bunny.service.SysRoleService;
import cn.bunny.spzx.model.dto.system.SysRoleDto;
import cn.bunny.spzx.model.entity.system.SysRole;
import cn.bunny.spzx.model.vo.common.Result;
import cn.bunny.spzx.model.vo.common.ResultCodeEnum;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

View File

@ -0,0 +1,49 @@
package cn.bunny.controller;
import cn.bunny.common.spzx.model.dto.system.SysUserDto;
import cn.bunny.common.spzx.model.entity.system.SysUser;
import cn.bunny.common.spzx.model.vo.common.Result;
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
import cn.bunny.service.SysUserService;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@Tag(name = "用户管理接口")
@RequestMapping(value = "/admin/system/sysUser")
public class SysUserController {
@Autowired
private SysUserService sysUserService;
@Operation(summary = "查询用户列表", description = "查询用户列表,包含关键字分页器")
@GetMapping(value = "findByPage/{pageNum}/{pageSize}")
public Result findByPage(@PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize, SysUserDto sysUserDto) {
PageInfo<SysUser> pageInfo = sysUserService.findByPage(pageNum, pageSize, sysUserDto);
return Result.build(pageInfo, ResultCodeEnum.SUCCESS);
}
@Operation(summary = "用户添加", description = "添加用户")
@PostMapping("saveSysuser")
public Result saveSysuser(@RequestBody SysUser sysUser) {
sysUserService.saveSysuser(sysUser);
return Result.build(null, ResultCodeEnum.SUCCESS);
}
@Operation(summary = "用户修改", description = "修改用户信息")
@PutMapping("updateSysUser")
public Result updateSysUser(@RequestBody SysUser sysUser) {
sysUserService.updateSysUser(sysUser);
return Result.build(null, ResultCodeEnum.SUCCESS);
}
@Operation(summary = "删除用户", description = "删除用户将status改为1")
@PutMapping("deleteUserById/{userId}")
public Result deleteUserById(@PathVariable("userId") Integer userId) {
sysUserService.deleteUserById(userId);
return Result.build(null, ResultCodeEnum.SUCCESS);
}
}

View File

@ -1,86 +1,86 @@
package cn.bunny.interceptor;
import cn.bunny.AuthContextUtil;
import cn.bunny.spzx.model.entity.system.SysUser;
import cn.bunny.spzx.model.vo.common.Result;
import cn.bunny.spzx.model.vo.common.ResultCodeEnum;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.concurrent.TimeUnit;
@Component
@Log4j2
public class LoginAuthInterceptor implements HandlerInterceptor {
@Autowired
private RedisTemplate<String, String> redisTemplate;
// 响应208给前端
public void respondNoLoginInfo(HttpServletResponse response) {
Result<Object> result = Result.build(null, ResultCodeEnum.LOGIN_AUTH);
PrintWriter writer = null;
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=utf-8");
try {
writer = response.getWriter();
writer.println(JSON.toJSONString(result));
} catch (IOException e) {
e.printStackTrace();
} finally {
if (writer != null) writer.close();
}
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 1. 获取方式
String method = request.getMethod();
if ("OPTIONS".equals(method)) {
return true;
}
// 2. 从请求中获取token
String token = request.getHeader("token");
// 3. 如果token为空返回错误提示
if (StrUtil.isEmpty(token)) {
respondNoLoginInfo((response));
return false;
}
// 4. 如果token不为空拿着token查询redis
String userinfoString = redisTemplate.opsForValue().get("user:login" + token);
// 如果redis查询不到数据返回错误提示
if (StrUtil.isEmpty(userinfoString)) {
respondNoLoginInfo(response);
return false;
}
// 如果redis查询到用户信息将信息放到ThreadLocal中
SysUser sysUser = JSON.parseObject(userinfoString, SysUser.class);
AuthContextUtil.set(sysUser);
// 吧redis用户信息数据更新过期时间
redisTemplate.expire("user:login" + token, 30, TimeUnit.MINUTES);
return true;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception {
AuthContextUtil.remove();
}
}
package cn.bunny.interceptor;
import cn.bunny.common.AuthContextUtil;
import cn.bunny.common.spzx.model.entity.system.SysUser;
import cn.bunny.common.spzx.model.vo.common.Result;
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.concurrent.TimeUnit;
@Component
@Log4j2
public class LoginAuthInterceptor implements HandlerInterceptor {
@Autowired
private RedisTemplate<String, String> redisTemplate;
// 响应208给前端
public void respondNoLoginInfo(HttpServletResponse response) {
Result<Object> result = Result.build(null, ResultCodeEnum.LOGIN_AUTH);
PrintWriter writer = null;
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=utf-8");
try {
writer = response.getWriter();
writer.println(JSON.toJSONString(result));
} catch (IOException e) {
e.printStackTrace();
} finally {
if (writer != null) writer.close();
}
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 1. 获取方式
String method = request.getMethod();
if ("OPTIONS".equals(method)) {
return true;
}
// 2. 从请求中获取token
String token = request.getHeader("token");
// 3. 如果token为空返回错误提示
if (StrUtil.isEmpty(token)) {
respondNoLoginInfo((response));
return false;
}
// 4. 如果token不为空拿着token查询redis
String userinfoString = redisTemplate.opsForValue().get("user:login" + token);
// 如果redis查询不到数据返回错误提示
if (StrUtil.isEmpty(userinfoString)) {
respondNoLoginInfo(response);
return false;
}
// 如果redis查询到用户信息将信息放到ThreadLocal中
SysUser sysUser = JSON.parseObject(userinfoString, SysUser.class);
AuthContextUtil.set(sysUser);
// 吧redis用户信息数据更新过期时间
redisTemplate.expire("user:login" + token, 30, TimeUnit.MINUTES);
return true;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception {
AuthContextUtil.remove();
}
}

View File

@ -1,7 +1,7 @@
package cn.bunny.mapper;
import cn.bunny.spzx.model.dto.system.SysRoleDto;
import cn.bunny.spzx.model.entity.system.SysRole;
import cn.bunny.common.spzx.model.dto.system.SysRoleDto;
import cn.bunny.common.spzx.model.entity.system.SysRole;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

View File

@ -1,10 +1,25 @@
package cn.bunny.mapper;
import cn.bunny.spzx.model.entity.system.SysUser;
import cn.bunny.common.spzx.model.dto.system.SysUserDto;
import cn.bunny.common.spzx.model.entity.system.SysUser;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SysUserMapper {
SysUser selectUserInfoByUserName(String userName);
// 用户条件分页查询
List<SysUser> findByPage(SysUserDto sysUserDto);
// 用户添加
void saveSysuser(SysUser sysUser);
// 用户修改
void updateUserInfo(SysUser sysUser);
// 删除用户
void deleteUserById(Integer id);
}

View File

@ -1,7 +1,7 @@
package cn.bunny.service;
import cn.bunny.spzx.model.dto.system.SysRoleDto;
import cn.bunny.spzx.model.entity.system.SysRole;
import cn.bunny.common.spzx.model.dto.system.SysRoleDto;
import cn.bunny.common.spzx.model.entity.system.SysRole;
import com.github.pagehelper.PageInfo;
public interface SysRoleService {

View File

@ -1,8 +1,10 @@
package cn.bunny.service;
import cn.bunny.spzx.model.dto.system.LoginDto;
import cn.bunny.spzx.model.entity.system.SysUser;
import cn.bunny.spzx.model.vo.system.LoginVo;
import cn.bunny.common.spzx.model.dto.system.LoginDto;
import cn.bunny.common.spzx.model.dto.system.SysUserDto;
import cn.bunny.common.spzx.model.entity.system.SysUser;
import cn.bunny.common.spzx.model.vo.system.LoginVo;
import com.github.pagehelper.PageInfo;
public interface SysUserService {
// 用户登录
@ -13,4 +15,16 @@ public interface SysUserService {
// 用户退出
void logout(String token);
// 用户条件分页查询
PageInfo<SysUser> findByPage(Integer pageNum, Integer pageSize, SysUserDto sysUserDto);
// 用户添加
void saveSysuser(SysUser sysUser);
// 用户修改
void updateSysUser(SysUser sysUser);
// 删除用户
void deleteUserById(Integer userId);
}

View File

@ -1,7 +1,7 @@
package cn.bunny.service;
import cn.bunny.spzx.model.vo.system.ValidateCodeVo;
public interface ValidateCodeService {
ValidateCodeVo generateValidateCode();
}
package cn.bunny.service;
import cn.bunny.common.spzx.model.vo.system.ValidateCodeVo;
public interface ValidateCodeService {
ValidateCodeVo generateValidateCode();
}

View File

@ -1,9 +1,9 @@
package cn.bunny.service.impl;
import cn.bunny.common.spzx.model.dto.system.SysRoleDto;
import cn.bunny.common.spzx.model.entity.system.SysRole;
import cn.bunny.mapper.SysRoleMapper;
import cn.bunny.service.SysRoleService;
import cn.bunny.spzx.model.dto.system.SysRoleDto;
import cn.bunny.spzx.model.entity.system.SysRole;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.log4j.Log4j2;

View File

@ -1,21 +1,25 @@
package cn.bunny.service.impl;
import cn.bunny.exception.BunnyException;
import cn.bunny.common.exception.BunnyException;
import cn.bunny.common.spzx.model.dto.system.LoginDto;
import cn.bunny.common.spzx.model.dto.system.SysUserDto;
import cn.bunny.common.spzx.model.entity.system.SysUser;
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
import cn.bunny.common.spzx.model.vo.system.LoginVo;
import cn.bunny.mapper.SysUserMapper;
import cn.bunny.service.SysUserService;
import cn.bunny.spzx.model.dto.system.LoginDto;
import cn.bunny.spzx.model.entity.system.SysUser;
import cn.bunny.spzx.model.vo.common.ResultCodeEnum;
import cn.bunny.spzx.model.vo.system.LoginVo;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@ -75,8 +79,7 @@ public class SysUserServiceImpl implements SysUserService {
@Override
public SysUser getUserInfo(String token) {
String userJson = redisTemplate.opsForValue().get("user:login" + token);
SysUser sysUser = JSON.parseObject(userJson, SysUser.class);
return sysUser;
return JSON.parseObject(userJson, SysUser.class);
}
// 用户退出
@ -84,4 +87,40 @@ public class SysUserServiceImpl implements SysUserService {
public void logout(String token) {
redisTemplate.delete("user:login" + token);
}
@Override
public PageInfo<SysUser> findByPage(Integer pageNum, Integer pageSize, SysUserDto sysUserDto) {
PageHelper.startPage(pageNum, pageSize);
List<SysUser> list = sysUserMapper.findByPage(sysUserDto);
return new PageInfo<>(list);
}
// 用户添加
@Override
public void saveSysuser(SysUser sysUser) {
// 判断用户名不重复
String userName = sysUser.getUserName();
SysUser dbUser = sysUserMapper.selectUserInfoByUserName(userName);
if (dbUser != null) {
throw new BunnyException(ResultCodeEnum.USER_NAME_IS_EXISTS);
}
String md5_password = DigestUtils.md5DigestAsHex(sysUser.getPassword().getBytes());
sysUser.setPassword(md5_password);
sysUserMapper.saveSysuser(sysUser);
}
// 用户修改
@Override
public void updateSysUser(SysUser sysUser) {
sysUserMapper.updateUserInfo(sysUser);
}
// 删除用户
@Override
public void deleteUserById(Integer userId) {
sysUserMapper.deleteUserById(userId);
}
}

View File

@ -1,7 +1,7 @@
package cn.bunny.service.impl;
import cn.bunny.common.spzx.model.vo.system.ValidateCodeVo;
import cn.bunny.service.ValidateCodeService;
import cn.bunny.spzx.model.vo.system.ValidateCodeVo;
import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.CircleCaptcha;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -3,7 +3,7 @@
<mapper namespace="cn.bunny.mapper.SysRoleMapper">
<!-- 映射查询到的字段 -->
<resultMap id="sysRoleMap" type="cn.bunny.spzx.model.entity.system.SysRole" autoMapping="true"/>
<resultMap id="sysRoleMap" type="cn.bunny.common.spzx.model.entity.system.SysRole" autoMapping="true"/>
<!-- 用于select查询公用抽取的列 -->
<sql id="columns">

View File

@ -7,10 +7,83 @@
id,username userName ,password,name,phone,avatar,description,status,create_time,update_time,is_deleted
</sql>
<!-- 用户添加 -->
<insert id="saveSysuser">
insert into sys_user (id,
username,
password,
name,
phone,
avatar,
description,
status)
values (#{id},
#{userName},
#{password},
#{name},
#{phone},
#{avatar},
#{description},
#{status})
</insert>
<select id="selectUserInfoByUserName" resultType="cn.bunny.spzx.model.entity.system.SysUser">
<!-- 用户修改 -->
<update id="updateUserInfo">
update sys_user set
<if test="userName != null and userName !=''">
username=#{userName},
</if>
<if test="password!=null and userName!=''">
password =#{password},
</if>
<if test="name!=null and name !=''">
name=#{name},
</if>
<if test="phone!=null and phone!=''">
phone=#{phone},
</if>
<if test="description !=null and description != ''">
description = #{description},
</if>
<if test="status !=null and status != ''">
status=#{status},
</if>
update_time = now()
where id=#{id}
</update>
<!-- 删除用户 -->
<update id="deleteUserById">
update sys_user
set is_deleted=1
where id = #{userId}
</update>
<!-- 查询用户名称 -->
<select id="selectUserInfoByUserName" resultType="cn.bunny.common.spzx.model.entity.system.SysUser">
SELECT
<include refid="columns"/>
FROM sys_user WHERE username=#{username}
FROM sys_user WHERE username=#{username} and is_deleted=0
</select>
<!-- 用户条件分页查询 -->
<select id="findByPage" resultType="cn.bunny.common.spzx.model.entity.system.SysUser">
select
<include refid="columns"/>
from sys_user
<where>
<if test="keyword !=null and keyword!= ''">
and username like CONCAT("%",${keyword},"%")
</if>
<if test="createTimeBegin !=null and createTimeBegin!= ''">
and create_time >=${createTimeBegin}
</if>
<if test="createTimeEnd !=null and createTimeEnd!= ''">
and create_time &lt;=#{createTimeEnd}
</if>
and is_deleted=0
</where>
order by id desc
</select>
</mapper>

View File

@ -1,6 +1,6 @@
package cn.bunny.spzx.model.dto.h5;
package cn.bunny.common.spzx.model.dto.h5;
import cn.bunny.spzx.model.entity.order.OrderItem;
import cn.bunny.common.spzx.model.entity.order.OrderItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.h5;
package cn.bunny.common.spzx.model.dto.h5;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.h5;
package cn.bunny.common.spzx.model.dto.h5;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.h5;
package cn.bunny.common.spzx.model.dto.h5;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.order;
package cn.bunny.common.spzx.model.dto.order;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.product;
package cn.bunny.common.spzx.model.dto.product;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,6 +1,6 @@
package cn.bunny.spzx.model.dto.product;
package cn.bunny.common.spzx.model.dto.product;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.product;
package cn.bunny.common.spzx.model.dto.product;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.system;
package cn.bunny.common.spzx.model.dto.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.system;
package cn.bunny.common.spzx.model.dto.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.system;
package cn.bunny.common.spzx.model.dto.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -8,15 +8,15 @@ import lombok.Data;
public class LoginDto {
@Schema(description = "用户名")
private String userName ;
private String userName;
@Schema(description = "密码")
private String password ;
private String password;
@Schema(description = "提交验证码")
private String captcha ;
private String captcha;
@Schema(description = "验证码key")
private String codeKey ;
private String codeKey;
}

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.system;
package cn.bunny.common.spzx.model.dto.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.dto.system;
package cn.bunny.common.spzx.model.dto.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -8,6 +8,6 @@ import lombok.Data;
public class SysRoleDto {
@Schema(description = "角色名称")
private String roleName ;
private String roleName;
}

View File

@ -1,19 +1,17 @@
package cn.bunny.spzx.model.dto.system;
package cn.bunny.common.spzx.model.dto.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@Data
@Schema(description = "请求参数实体类")
public class SysUserDto {
@Schema(description = "搜索关键字")
private String keyword ;
private String keyword;
@Schema(description = "开始时间")
private String createTimeBegin ;
private String createTimeBegin;
@Schema(description = "结束时间")
private String createTimeEnd;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.entity.base;
package cn.bunny.common.spzx.model.entity.base;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.entity.base;
package cn.bunny.common.spzx.model.entity.base;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -7,7 +7,7 @@ import lombok.Data;
@Schema(description = "产品单元实体类")
public class ProductUnit extends BaseEntity {
@Schema(description = "名称")
private String name;
@Schema(description = "名称")
private String name;
}

View File

@ -0,0 +1,22 @@
package cn.bunny.common.spzx.model.entity.base;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "区域实体类")
public class Region extends BaseEntity {
@Schema(description = "区域编码")
private String code;
@Schema(description = "父区域编码")
private Long parentCode;
@Schema(description = "父区名称")
private String name;
@Schema(description = "地区级别1-省、自治区、直辖市 2-地级市、地区、自治州、盟 3-市辖区、县级市、县")
private Integer level;
}

View File

@ -0,0 +1,36 @@
package cn.bunny.common.spzx.model.entity.h5;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "购物车实体类")
public class CartInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "用户id")
private Long userId;
@Schema(description = "skuid")
private Long skuId;
@Schema(description = "放入购物车时价格")
private BigDecimal cartPrice;
@Schema(description = "数量")
private Integer skuNum;
@Schema(description = "图片文件")
private String imgUrl;
@Schema(description = "sku名称 (冗余)")
private String skuName;
@Schema(description = "isChecked")
private Integer isChecked;
}

View File

@ -0,0 +1,89 @@
package cn.bunny.common.spzx.model.entity.order;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@Schema(description = "OrderInfo")
public class OrderInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "会员_id")
private Long userId;
@Schema(description = "昵称")
private String nickName;
@Schema(description = "订单号")
private String orderNo;
@Schema(description = "使用的优惠券")
private Long couponId;
@Schema(description = "订单总额")
private BigDecimal totalAmount;
@Schema(description = "优惠券")
private BigDecimal couponAmount;
@Schema(description = "原价金额")
private BigDecimal originalTotalAmount;
@Schema(description = "运费")
private BigDecimal feightFee;
@Schema(description = "支付方式【1->微信】")
private Integer payType;
@Schema(description = "订单状态【0->待付款1->待发货2->已发货3->待用户收货,已完成;-1->已取消】")
private Integer orderStatus;
@Schema(description = "收货人姓名")
private String receiverName;
@Schema(description = "收货人电话")
private String receiverPhone;
@Schema(description = "收货人地址标签")
private String receiverTagName;
@Schema(description = "省份/直辖市")
private String receiverProvince;
@Schema(description = "城市")
private String receiverCity;
@Schema(description = "")
private String receiverDistrict;
@Schema(description = "详细地址")
private String receiverAddress;
@Schema(description = "支付时间")
private Date paymentTime;
@Schema(description = "发货时间")
private Date deliveryTime;
@Schema(description = "确认收货时间")
private Date receiveTime;
@Schema(description = "订单备注")
private String remark;
@Schema(description = "取消订单时间")
private Date cancelTime;
@Schema(description = "取消订单原因")
private String cancelReason;
@Schema(description = "订单项列表")
private List<OrderItem> orderItemList;
}

View File

@ -0,0 +1,33 @@
package cn.bunny.common.spzx.model.entity.order;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "订单项实体类")
public class OrderItem extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "订单id")
private Long orderId;
@Schema(description = "商品sku编号")
private Long skuId;
@Schema(description = "商品sku名字")
private String skuName;
@Schema(description = "商品sku图片")
private String thumbImg;
@Schema(description = "商品sku价格")
private BigDecimal skuPrice;
@Schema(description = "商品购买的数量")
private Integer skuNum;
}

View File

@ -0,0 +1,25 @@
package cn.bunny.common.spzx.model.entity.order;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "订单日志实体对象")
public class OrderLog extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "订单id")
private Long orderId;
@Schema(description = "操作人:用户;系统;后台管理员")
private String operateUser;
@Schema(description = "订单状态")
private Integer processStatus;
@Schema(description = "备注")
private String note;
}

View File

@ -1,6 +1,6 @@
package cn.bunny.spzx.model.entity.order;
package cn.bunny.common.spzx.model.entity.order;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
@ -12,5 +12,5 @@ public class OrderStatistics extends BaseEntity {
private Date orderDate;
private BigDecimal totalAmount;
private Integer totalNum;
}

View File

@ -0,0 +1,43 @@
package cn.bunny.common.spzx.model.entity.pay;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Schema(description = "支付信息实体类")
public class PaymentInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "用户id")
private Long userId;
@Schema(description = "订单号")
private String orderNo;
@Schema(description = "付款方式1-微信 2-支付宝")
private Integer payType;
@Schema(description = "交易编号(微信或支付)")
private String outTradeNo;
@Schema(description = "支付金额")
private BigDecimal amount;
@Schema(description = "交易内容")
private String content;
@Schema(description = "支付状态0-未支付 1-已支付")
private Integer paymentStatus;
@Schema(description = "回调时间")
private Date callbackTime;
@Schema(description = "回调信息")
private String callbackContent;
}

View File

@ -0,0 +1,17 @@
package cn.bunny.common.spzx.model.entity.product;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "品牌实体类")
public class Brand extends BaseEntity {
@Schema(description = "品牌名称")
private String name;
@Schema(description = "品牌logo")
private String logo;
}

View File

@ -0,0 +1,34 @@
package cn.bunny.common.spzx.model.entity.product;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@Schema(description = "分类实体类")
public class Category extends BaseEntity {
@Schema(description = "分类名称")
private String name;
@Schema(description = "分类图片url")
private String imageUrl;
@Schema(description = "父节点id")
private Long parentId;
@Schema(description = "分类状态: 是否显示[0-不显示1显示]")
private Integer status;
@Schema(description = "排序字段")
private Integer orderNum;
@Schema(description = "是否存在子节点")
private Boolean hasChildren;
@Schema(description = "子节点List集合")
private List<Category> children;
}

View File

@ -0,0 +1,26 @@
package cn.bunny.common.spzx.model.entity.product;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "分类品牌实体类")
public class CategoryBrand extends BaseEntity {
@Schema(description = "品牌id")
private Long brandId;
@Schema(description = "分类id")
private Long categoryId;
@Schema(description = "分类名称", required = false)
private String categoryName;
@Schema(description = "品牌名称", required = false)
private String brandName;
@Schema(description = "品牌logo", required = false)
private String logo;
}

View File

@ -0,0 +1,65 @@
package cn.bunny.common.spzx.model.entity.product;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@Schema(description = "商品实体类")
public class Product extends BaseEntity {
@Schema(description = "商品名称")
private String name; // 商品名称
@Schema(description = "品牌id")
private Long brandId; // 品牌ID
@Schema(description = "一级分类id")
private Long category1Id; // 一级分类id
@Schema(description = "二级分类id")
private Long category2Id; // 二级分类id
@Schema(description = "三级分类id")
private Long category3Id; // 三级分类id
@Schema(description = "计量单位")
private String unitName; // 计量单位
@Schema(description = "轮播图url")
private String sliderUrls; // 轮播图
@Schema(description = "商品规格值json串")
private String specValue; // 商品规格值json串
@Schema(description = "线上状态0-初始值1-上架,-1-自主下架")
private Integer status; // 线上状态0-初始值1-上架-1-自主下架
@Schema(description = "审核状态")
private Integer auditStatus; // 审核状态
@Schema(description = "审核信息")
private String auditMessage; // 审核信息
// 扩展的属性用来封装响应的数据
@Schema(description = "品牌名称")
private String brandName; // 品牌
@Schema(description = "一级分类名称")
private String category1Name; // 一级分类
@Schema(description = "二级分类名称")
private String category2Name; // 二级分类
@Schema(description = "三级分类名称")
private String category3Name; // 三级分类
@Schema(description = "sku列表集合")
private List<ProductSku> productSkuList; // sku列表集合
@Schema(description = "图片详情列表")
private String detailsImageUrls; // 图片详情列表
}

View File

@ -0,0 +1,12 @@
package cn.bunny.common.spzx.model.entity.product;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import lombok.Data;
@Data
public class ProductDetails extends BaseEntity {
private Long productId;
private String imageUrls;
}

View File

@ -0,0 +1,52 @@
package cn.bunny.common.spzx.model.entity.product;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "ProductSku")
public class ProductSku extends BaseEntity {
@Schema(description = "商品编号")
private String skuCode;
@Schema(description = "skuName")
private String skuName;
@Schema(description = "商品ID")
private Long productId;
@Schema(description = "缩略图路径")
private String thumbImg;
@Schema(description = "售价")
private BigDecimal salePrice;
@Schema(description = "市场价")
private BigDecimal marketPrice;
@Schema(description = "成本价")
private BigDecimal costPrice;
@Schema(description = "库存数")
private Integer stockNum;
@Schema(description = "销量")
private Integer saleNum;
@Schema(description = "sku规格信息json")
private String skuSpec;
@Schema(description = "重量")
private String weight;
@Schema(description = "体积")
private String volume;
@Schema(description = "线上状态0-初始值1-上架,-1-自主下架")
private Integer status;
}

View File

@ -0,0 +1,17 @@
package cn.bunny.common.spzx.model.entity.product;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "商品规格实体类")
public class ProductSpec extends BaseEntity {
@Schema(description = "规格名称")
private String specName; // 规格名称
@Schema(description = "规格值")
private String specValue; // 规格值
}

View File

@ -0,0 +1,32 @@
package cn.bunny.common.spzx.model.entity.system;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "系统菜单实体类")
@Data
public class SysMenu extends BaseEntity {
@Schema(description = "父节点id")
private Long parentId;
@Schema(description = "节点标题")
private String title;
@Schema(description = "组件名称")
private String component;
@Schema(description = "排序值")
private Integer sortValue;
@Schema(description = "状态(0:禁止,1:正常)")
private Integer status;
// 下级列表
@Schema(description = "子节点")
private List<SysMenu> children;
}

View File

@ -0,0 +1,48 @@
package cn.bunny.common.spzx.model.entity.system;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "SysOperLog")
public class SysOperLog extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "模块标题")
private String title;
@Schema(description = "方法名称")
private String method;
@Schema(description = "请求方式")
private String requestMethod;
private Integer businessType; // 业务类型0其它 1新增 2修改 3删除
@Schema(description = "操作类别0其它 1后台用户 2手机端用户")
private String operatorType;
@Schema(description = "操作人员")
private String operName;
@Schema(description = "请求URL")
private String operUrl;
@Schema(description = "主机地址")
private String operIp;
@Schema(description = "请求参数")
private String operParam;
@Schema(description = "返回参数")
private String jsonResult;
@Schema(description = "操作状态0正常 1异常")
private Integer status;
@Schema(description = "错误消息")
private String errorMsg;
}

View File

@ -1,6 +1,6 @@
package cn.bunny.spzx.model.entity.system;
package cn.bunny.common.spzx.model.entity.system;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,6 +1,6 @@
package cn.bunny.spzx.model.entity.system;
package cn.bunny.common.spzx.model.entity.system;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import lombok.Data;
@Data

View File

@ -0,0 +1,32 @@
package cn.bunny.common.spzx.model.entity.system;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "系统用户实体类")
public class SysUser extends BaseEntity {
@Schema(description = "用户名")
private String userName;
@Schema(description = "密码")
private String password;
@Schema(description = "昵称")
private String name;
@Schema(description = "手机号码")
private String phone;
@Schema(description = "图像")
private String avatar;
@Schema(description = "描述")
private String description;
@Schema(description = "状态1正常 0停用")
private Integer status;
}

View File

@ -0,0 +1,43 @@
package cn.bunny.common.spzx.model.entity.user;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "用户地址实体类")
public class UserAddress extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "name")
private String name;
@Schema(description = "电话")
private String phone;
@Schema(description = "标签名称")
private String tagName;
@Schema(description = "provinceCode")
private String provinceCode;
@Schema(description = "cityCode")
private String cityCode;
@Schema(description = "districtCode")
private String districtCode;
@Schema(description = "详细地址")
private String address;
@Schema(description = "完整地址")
private String fullAddress;
@Schema(description = "是否默认地址0否 1")
private Integer isDefault;
}

View File

@ -0,0 +1,51 @@
package cn.bunny.common.spzx.model.entity.user;
import cn.bunny.common.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
@Data
@Schema(description = "用户实体类")
public class UserInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "用户名")
private String username;
@Schema(description = "密码")
private String password;
@Schema(description = "昵称")
private String nickName;
@Schema(description = "头像")
private String avatar;
@Schema(description = "性别")
private Integer sex;
@Schema(description = "电话号码")
private String phone;
@Schema(description = "备注")
private String memo;
@Schema(description = "微信open id")
private String openId;
@Schema(description = "微信开放平台unionID")
private String unionId;
@Schema(description = "最后一次登录ip")
private String lastLoginIp;
@Schema(description = "最后一次登录时间")
private Date lastLoginTime;
@Schema(description = "状态1为正常0为禁止")
private Integer status;
}

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.vo.common;
package cn.bunny.common.spzx.model.vo.common;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -7,20 +7,21 @@ import lombok.Data;
@Schema(description = "响应结果实体类")
public class Result<T> {
//返回码
// 返回码
@Schema(description = "业务状态码")
private Integer code;
//返回消息
// 返回消息
@Schema(description = "响应消息")
private String message;
//返回数据
// 返回数据
@Schema(description = "业务数据")
private T data;
// 私有化构造
private Result() {}
private Result() {
}
// 返回数据
public static <T> Result<T> build(T body, Integer code, String message) {
@ -32,8 +33,8 @@ public class Result<T> {
}
// 通过枚举构造Result对象
public static <T> Result build(T body , ResultCodeEnum resultCodeEnum) {
return build(body , resultCodeEnum.getCode() , resultCodeEnum.getMessage()) ;
public static <T> Result build(T body, ResultCodeEnum resultCodeEnum) {
return build(body, resultCodeEnum.getCode(), resultCodeEnum.getMessage());
}
}

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.vo.common;
package cn.bunny.common.spzx.model.vo.common;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;

View File

@ -1,7 +1,7 @@
package cn.bunny.spzx.model.vo.h5;
package cn.bunny.common.spzx.model.vo.h5;
import cn.bunny.spzx.model.entity.product.Category;
import cn.bunny.spzx.model.entity.product.ProductSku;
import cn.bunny.common.spzx.model.entity.product.Category;
import cn.bunny.common.spzx.model.entity.product.ProductSku;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -0,0 +1,34 @@
package cn.bunny.common.spzx.model.vo.h5;
import cn.bunny.common.spzx.model.entity.product.Product;
import cn.bunny.common.spzx.model.entity.product.ProductSku;
import com.alibaba.fastjson.JSONArray;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
@Schema(description = "商品详情对象")
public class ProductItemVo {
@Schema(description = "商品sku信息")
private ProductSku productSku;
@Schema(description = "商品信息")
private Product product;
@Schema(description = "商品轮播图列表")
private List<String> sliderUrlList;
@Schema(description = "商品详情图片列表")
private List<String> detailsImageUrlList;
@Schema(description = "商品规格信息")
private JSONArray specValueList;
@Schema(description = "商品规格对应商品skuId信息")
private Map<String, Object> skuSpecValueMap;
}

View File

@ -1,6 +1,6 @@
package cn.bunny.spzx.model.vo.h5;
package cn.bunny.common.spzx.model.vo.h5;
import cn.bunny.spzx.model.entity.order.OrderItem;
import cn.bunny.common.spzx.model.entity.order.OrderItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -0,0 +1,16 @@
package cn.bunny.common.spzx.model.vo.h5;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "用户类")
public class UserInfoVo {
@Schema(description = "昵称")
private String nickName;
@Schema(description = "头像")
private String avatar;
}

View File

@ -1,10 +1,9 @@
package cn.bunny.spzx.model.vo.order;
package cn.bunny.common.spzx.model.vo.order;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@ -12,8 +11,8 @@ import java.util.List;
public class OrderStatisticsVo {
@Schema(description = "日期数据集合")
private List<String> dateList ;
private List<String> dateList;
@Schema(description = "总金额数据集合")
private List<BigDecimal> amountList ;
private List<BigDecimal> amountList;
}

View File

@ -0,0 +1,31 @@
package cn.bunny.common.spzx.model.vo.product;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CategoryExcelVo {
@ExcelProperty(value = "id", index = 0)
private Long id;
@ExcelProperty(value = "名称", index = 1)
private String name;
@ExcelProperty(value = "图片url", index = 2)
private String imageUrl;
@ExcelProperty(value = "上级id", index = 3)
private Long parentId;
@ExcelProperty(value = "状态", index = 4)
private Integer status;
@ExcelProperty(value = "排序", index = 5)
private Integer orderNum;
}

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.vo.system;
package cn.bunny.common.spzx.model.vo.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -8,9 +8,9 @@ import lombok.Data;
public class LoginVo {
@Schema(description = "令牌")
private String token ;
private String token;
@Schema(description = "刷新令牌,可以为空")
private String refresh_token ;
private String refresh_token;
}

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.vo.system;
package cn.bunny.common.spzx.model.vo.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.bunny.spzx.model.vo.system;
package cn.bunny.common.spzx.model.vo.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,22 +0,0 @@
package cn.bunny.spzx.model.entity.base;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "区域实体类")
public class Region extends BaseEntity {
@Schema(description = "区域编码")
private String code;
@Schema(description = "父区域编码")
private Long parentCode;
@Schema(description = "父区名称")
private String name;
@Schema(description = "地区级别1-省、自治区、直辖市 2-地级市、地区、自治州、盟 3-市辖区、县级市、县")
private Integer level;
}

View File

@ -1,36 +0,0 @@
package cn.bunny.spzx.model.entity.h5;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "购物车实体类")
public class CartInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "用户id")
private Long userId;
@Schema(description = "skuid")
private Long skuId;
@Schema(description = "放入购物车时价格")
private BigDecimal cartPrice;
@Schema(description = "数量")
private Integer skuNum;
@Schema(description = "图片文件")
private String imgUrl;
@Schema(description = "sku名称 (冗余)")
private String skuName;
@Schema(description = "isChecked")
private Integer isChecked;
}

View File

@ -1,89 +0,0 @@
package cn.bunny.spzx.model.entity.order;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@Schema(description = "OrderInfo")
public class OrderInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "会员_id")
private Long userId;
@Schema(description = "昵称")
private String nickName;
@Schema(description = "订单号")
private String orderNo;
@Schema(description = "使用的优惠券")
private Long couponId;
@Schema(description = "订单总额")
private BigDecimal totalAmount;
@Schema(description = "优惠券")
private BigDecimal couponAmount;
@Schema(description = "原价金额")
private BigDecimal originalTotalAmount;
@Schema(description = "运费")
private BigDecimal feightFee;
@Schema(description = "支付方式【1->微信】")
private Integer payType;
@Schema(description = "订单状态【0->待付款1->待发货2->已发货3->待用户收货,已完成;-1->已取消】")
private Integer orderStatus;
@Schema(description = "收货人姓名")
private String receiverName;
@Schema(description = "收货人电话")
private String receiverPhone;
@Schema(description = "收货人地址标签")
private String receiverTagName;
@Schema(description = "省份/直辖市")
private String receiverProvince;
@Schema(description = "城市")
private String receiverCity;
@Schema(description = "")
private String receiverDistrict;
@Schema(description = "详细地址")
private String receiverAddress;
@Schema(description = "支付时间")
private Date paymentTime;
@Schema(description = "发货时间")
private Date deliveryTime;
@Schema(description = "确认收货时间")
private Date receiveTime;
@Schema(description = "订单备注")
private String remark;
@Schema(description = "取消订单时间")
private Date cancelTime;
@Schema(description = "取消订单原因")
private String cancelReason;
@Schema(description = "订单项列表")
private List<OrderItem> orderItemList;
}

View File

@ -1,33 +0,0 @@
package cn.bunny.spzx.model.entity.order;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "订单项实体类")
public class OrderItem extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "订单id")
private Long orderId;
@Schema(description = "商品sku编号")
private Long skuId;
@Schema(description = "商品sku名字")
private String skuName;
@Schema(description = "商品sku图片")
private String thumbImg;
@Schema(description = "商品sku价格")
private BigDecimal skuPrice;
@Schema(description = "商品购买的数量")
private Integer skuNum;
}

View File

@ -1,25 +0,0 @@
package cn.bunny.spzx.model.entity.order;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "订单日志实体对象")
public class OrderLog extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "订单id")
private Long orderId;
@Schema(description = "操作人:用户;系统;后台管理员")
private String operateUser;
@Schema(description = "订单状态")
private Integer processStatus;
@Schema(description = "备注")
private String note;
}

View File

@ -1,43 +0,0 @@
package cn.bunny.spzx.model.entity.pay;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Schema(description = "支付信息实体类")
public class PaymentInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "用户id")
private Long userId;
@Schema(description = "订单号")
private String orderNo;
@Schema(description = "付款方式1-微信 2-支付宝")
private Integer payType;
@Schema(description = "交易编号(微信或支付)")
private String outTradeNo;
@Schema(description = "支付金额")
private BigDecimal amount;
@Schema(description = "交易内容")
private String content;
@Schema(description = "支付状态0-未支付 1-已支付")
private Integer paymentStatus;
@Schema(description = "回调时间")
private Date callbackTime;
@Schema(description = "回调信息")
private String callbackContent;
}

View File

@ -1,17 +0,0 @@
package cn.bunny.spzx.model.entity.product;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "品牌实体类")
public class Brand extends BaseEntity {
@Schema(description = "品牌名称")
private String name;
@Schema(description = "品牌logo")
private String logo;
}

View File

@ -1,34 +0,0 @@
package cn.bunny.spzx.model.entity.product;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@Schema(description = "分类实体类")
public class Category extends BaseEntity {
@Schema(description = "分类名称")
private String name;
@Schema(description = "分类图片url")
private String imageUrl;
@Schema(description = "父节点id")
private Long parentId;
@Schema(description = "分类状态: 是否显示[0-不显示1显示]")
private Integer status;
@Schema(description = "排序字段")
private Integer orderNum;
@Schema(description = "是否存在子节点")
private Boolean hasChildren;
@Schema(description = "子节点List集合")
private List<Category> children;
}

View File

@ -1,26 +0,0 @@
package cn.bunny.spzx.model.entity.product;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "分类品牌实体类")
public class CategoryBrand extends BaseEntity {
@Schema(description = "品牌id")
private Long brandId;
@Schema(description = "分类id")
private Long categoryId;
@Schema(description = "分类名称" , required = false)
private String categoryName;
@Schema(description = "品牌名称" , required = false)
private String brandName;
@Schema(description = "品牌logo" , required = false)
private String logo;
}

View File

@ -1,65 +0,0 @@
package cn.bunny.spzx.model.entity.product;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@Schema(description = "商品实体类")
public class Product extends BaseEntity {
@Schema(description = "商品名称")
private String name; // 商品名称
@Schema(description = "品牌id")
private Long brandId; // 品牌ID
@Schema(description = "一级分类id")
private Long category1Id; // 一级分类id
@Schema(description = "二级分类id")
private Long category2Id; // 二级分类id
@Schema(description = "三级分类id")
private Long category3Id; // 三级分类id
@Schema(description = "计量单位")
private String unitName; // 计量单位
@Schema(description = "轮播图url")
private String sliderUrls; // 轮播图
@Schema(description = "商品规格值json串")
private String specValue; // 商品规格值json串
@Schema(description = "线上状态0-初始值1-上架,-1-自主下架")
private Integer status; // 线上状态0-初始值1-上架-1-自主下架
@Schema(description = "审核状态")
private Integer auditStatus; // 审核状态
@Schema(description = "审核信息")
private String auditMessage; // 审核信息
// 扩展的属性用来封装响应的数据
@Schema(description = "品牌名称")
private String brandName; // 品牌
@Schema(description = "一级分类名称")
private String category1Name; // 一级分类
@Schema(description = "二级分类名称")
private String category2Name; // 二级分类
@Schema(description = "三级分类名称")
private String category3Name; // 三级分类
@Schema(description = "sku列表集合")
private List<ProductSku> productSkuList; // sku列表集合
@Schema(description = "图片详情列表")
private String detailsImageUrls; // 图片详情列表
}

View File

@ -1,12 +0,0 @@
package cn.bunny.spzx.model.entity.product;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import lombok.Data;
@Data
public class ProductDetails extends BaseEntity {
private Long productId;
private String imageUrls;
}

View File

@ -1,53 +0,0 @@
package cn.bunny.spzx.model.entity.product;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
@Schema(description = "ProductSku")
public class ProductSku extends BaseEntity {
@Schema(description = "商品编号")
private String skuCode;
@Schema(description = "skuName")
private String skuName;
@Schema(description = "商品ID")
private Long productId;
@Schema(description = "缩略图路径")
private String thumbImg;
@Schema(description = "售价")
private BigDecimal salePrice;
@Schema(description = "市场价")
private BigDecimal marketPrice;
@Schema(description = "成本价")
private BigDecimal costPrice;
@Schema(description = "库存数")
private Integer stockNum;
@Schema(description = "销量")
private Integer saleNum;
@Schema(description = "sku规格信息json")
private String skuSpec;
@Schema(description = "重量")
private String weight;
@Schema(description = "体积")
private String volume;
@Schema(description = "线上状态0-初始值1-上架,-1-自主下架")
private Integer status;
}

View File

@ -1,17 +0,0 @@
package cn.bunny.spzx.model.entity.product;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "商品规格实体类")
public class ProductSpec extends BaseEntity {
@Schema(description = "规格名称")
private String specName; // 规格名称
@Schema(description = "规格值")
private String specValue; // 规格值
}

View File

@ -1,32 +0,0 @@
package cn.bunny.spzx.model.entity.system;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "系统菜单实体类")
@Data
public class SysMenu extends BaseEntity {
@Schema(description = "父节点id")
private Long parentId;
@Schema(description = "节点标题")
private String title;
@Schema(description = "组件名称")
private String component;
@Schema(description = "排序值")
private Integer sortValue;
@Schema(description = "状态(0:禁止,1:正常)")
private Integer status;
// 下级列表
@Schema(description = "子节点")
private List<SysMenu> children;
}

View File

@ -1,48 +0,0 @@
package cn.bunny.spzx.model.entity.system;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "SysOperLog")
public class SysOperLog extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "模块标题")
private String title;
@Schema(description = "方法名称")
private String method;
@Schema(description = "请求方式")
private String requestMethod;
private Integer businessType ; // 业务类型0其它 1新增 2修改 3删除
@Schema(description = "操作类别0其它 1后台用户 2手机端用户")
private String operatorType;
@Schema(description = "操作人员")
private String operName;
@Schema(description = "请求URL")
private String operUrl;
@Schema(description = "主机地址")
private String operIp;
@Schema(description = "请求参数")
private String operParam;
@Schema(description = "返回参数")
private String jsonResult;
@Schema(description = "操作状态0正常 1异常")
private Integer status;
@Schema(description = "错误消息")
private String errorMsg;
}

View File

@ -1,32 +0,0 @@
package cn.bunny.spzx.model.entity.system;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "系统用户实体类")
public class SysUser extends BaseEntity {
@Schema(description = "用户名")
private String userName;
@Schema(description = "密码")
private String password;
@Schema(description = "昵称")
private String name;
@Schema(description = "手机号码")
private String phone;
@Schema(description = "图像")
private String avatar;
@Schema(description = "描述")
private String description;
@Schema(description = "状态1正常 0停用")
private Integer status;
}

View File

@ -1,43 +0,0 @@
package cn.bunny.spzx.model.entity.user;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "用户地址实体类")
public class UserAddress extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "name")
private String name;
@Schema(description = "电话")
private String phone;
@Schema(description = "标签名称")
private String tagName;
@Schema(description = "provinceCode")
private String provinceCode;
@Schema(description = "cityCode")
private String cityCode;
@Schema(description = "districtCode")
private String districtCode;
@Schema(description = "详细地址")
private String address;
@Schema(description = "完整地址")
private String fullAddress;
@Schema(description = "是否默认地址0否 1")
private Integer isDefault;
}

View File

@ -1,51 +0,0 @@
package cn.bunny.spzx.model.entity.user;
import cn.bunny.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
@Data
@Schema(description = "用户实体类")
public class UserInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(description = "用户名")
private String username;
@Schema(description = "密码")
private String password;
@Schema(description = "昵称")
private String nickName;
@Schema(description = "头像")
private String avatar;
@Schema(description = "性别")
private Integer sex;
@Schema(description = "电话号码")
private String phone;
@Schema(description = "备注")
private String memo;
@Schema(description = "微信open id")
private String openId;
@Schema(description = "微信开放平台unionID")
private String unionId;
@Schema(description = "最后一次登录ip")
private String lastLoginIp;
@Schema(description = "最后一次登录时间")
private Date lastLoginTime;
@Schema(description = "状态1为正常0为禁止")
private Integer status;
}

View File

@ -1,34 +0,0 @@
package cn.bunny.spzx.model.vo.h5;
import com.alibaba.fastjson.JSONArray;
import cn.bunny.spzx.model.entity.product.Product;
import cn.bunny.spzx.model.entity.product.ProductSku;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
@Schema(description = "商品详情对象")
public class ProductItemVo {
@Schema(description = "商品sku信息")
private ProductSku productSku;
@Schema(description = "商品信息")
private Product product;
@Schema(description = "商品轮播图列表")
private List<String> sliderUrlList;
@Schema(description = "商品详情图片列表")
private List<String> detailsImageUrlList;
@Schema(description = "商品规格信息")
private JSONArray specValueList;
@Schema(description = "商品规格对应商品skuId信息")
private Map<String,Object> skuSpecValueMap;
}

View File

@ -1,16 +0,0 @@
package cn.bunny.spzx.model.vo.h5;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "用户类")
public class UserInfoVo {
@Schema(description = "昵称")
private String nickName;
@Schema(description = "头像")
private String avatar;
}

View File

@ -1,31 +0,0 @@
package cn.bunny.spzx.model.vo.product;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CategoryExcelVo {
@ExcelProperty(value = "id" ,index = 0)
private Long id;
@ExcelProperty(value = "名称" ,index = 1)
private String name;
@ExcelProperty(value = "图片url" ,index = 2)
private String imageUrl ;
@ExcelProperty(value = "上级id" ,index = 3)
private Long parentId;
@ExcelProperty(value = "状态" ,index = 4)
private Integer status;
@ExcelProperty(value = "排序" ,index = 5)
private Integer orderNum;
}