diff --git a/commerce_system.sql b/commerce_system.sql
new file mode 100644
index 0000000..b86eea3
--- /dev/null
+++ b/commerce_system.sql
@@ -0,0 +1,160 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server : commerce_system
+ Source Server Type : MySQL
+ Source Server Version : 80024 (8.0.24)
+ Source Host : wzpmc.cn:3306
+ Source Schema : commerce_system
+
+ Target Server Type : MySQL
+ Target Server Version : 80024 (8.0.24)
+ File Encoding : 65001
+
+ Date: 27/04/2023 16:14:29
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for auth_account
+-- ----------------------------
+DROP TABLE IF EXISTS `auth_account`;
+CREATE TABLE `auth_account` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '#',
+ `username` varchar(20) COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名',
+ `email` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '邮箱',
+ `rel_name` varchar(5) COLLATE utf8mb4_general_ci NOT NULL COMMENT '真实姓名',
+ `password` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
+ `status` tinyint(1) DEFAULT '1' COMMENT '状态',
+ `role_id` int DEFAULT '0' COMMENT '角色',
+ `create_time` timestamp NOT NULL COMMENT '创建时间',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '最近更新时间',
+ `del` tinyint(1) DEFAULT '0' COMMENT '逻辑删除',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `username` (`username`),
+ UNIQUE KEY `email` (`email`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+-- ----------------------------
+-- Table structure for auth_permissions
+-- ----------------------------
+DROP TABLE IF EXISTS `auth_permissions`;
+CREATE TABLE `auth_permissions` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '#',
+ `permission_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限名',
+ `permission_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限代码',
+ `description` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '介绍',
+ `account_id` int NOT NULL COMMENT '创建者id',
+ `create_time` timestamp NOT NULL COMMENT '创建时间',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '最后更新时间',
+ `status` tinyint(1) DEFAULT '1' COMMENT '状态',
+ `del` tinyint(1) DEFAULT '0' COMMENT '逻辑删除',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `permission_name` (`permission_name`),
+ UNIQUE KEY `permission_code` (`permission_code`),
+ KEY `account_id` (`account_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+-- ----------------------------
+-- Table structure for auth_roles
+-- ----------------------------
+DROP TABLE IF EXISTS `auth_roles`;
+CREATE TABLE `auth_roles` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '#',
+ `role_name` varchar(20) COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名',
+ `description` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '简介',
+ `account_id` int NOT NULL COMMENT '创建者id',
+ `create_time` timestamp NOT NULL COMMENT '创建时间',
+ `update_time` timestamp NULL DEFAULT NULL COMMENT '最后更新时间',
+ `status` tinyint(1) DEFAULT '1' COMMENT '状态',
+ `del` tinyint(1) DEFAULT '0' COMMENT '逻辑删除',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `role_name` (`role_name`),
+ KEY `account_id` (`account_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+-- ----------------------------
+-- Table structure for auth_route
+-- ----------------------------
+DROP TABLE IF EXISTS `auth_route`;
+CREATE TABLE `auth_route` (
+ `id` int NOT NULL COMMENT '#',
+ `path` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '前端访问路径',
+ `name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '前端路由名称',
+ `parent_id` int DEFAULT NULL COMMENT '父组件id',
+ `component` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '前端本地组件路径',
+ `title` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '前端标题栏',
+ `status` blob COMMENT '状态',
+ `create_id` int DEFAULT NULL COMMENT '创建者id',
+ `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+ `update_id` int DEFAULT NULL COMMENT '最后修改者id',
+ `update_time` datetime DEFAULT NULL COMMENT '最后修改时间',
+ `remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
+ `del` int DEFAULT '0' COMMENT '逻辑删除',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+-- ----------------------------
+-- Table structure for commission
+-- ----------------------------
+DROP TABLE IF EXISTS `commission`;
+CREATE TABLE `commission` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '#',
+ `price_min` double(9,2) NOT NULL COMMENT '最小区间',
+ `price_max` double(9,2) NOT NULL COMMENT '最大区间',
+ `commission` double(5,2) NOT NULL COMMENT '佣金',
+ `store_id` int NOT NULL COMMENT '店铺名称',
+ `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+ `update_time` datetime DEFAULT NULL COMMENT '更新时间',
+ `del` int DEFAULT '0' COMMENT '逻辑删除',
+ `status` blob COMMENT '状态',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+-- ----------------------------
+-- Table structure for shop_order
+-- ----------------------------
+DROP TABLE IF EXISTS `shop_order`;
+CREATE TABLE `shop_order` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '#',
+ `order_no` varchar(30) COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单号',
+ `order_time` datetime NOT NULL COMMENT '下单时间',
+ `order_status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '订单状态',
+ `wang_no` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '旺旺号',
+ `wechat_no` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '微信账号',
+ `alipay_no` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '支付宝账号',
+ `pay_amt` double(10,2) NOT NULL COMMENT '付款金额',
+ `store_id` int NOT NULL COMMENT '店铺id',
+ `commission` double(10,2) DEFAULT NULL COMMENT '佣金',
+ `alipay_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '支付宝收款名称',
+ `rp_name` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '负责人',
+ `rp_wechat_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '负责放单人微信名',
+ `remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
+ `phone_number` varchar(11) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '买家电话',
+ `card_no` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '银行卡号',
+ `flag` int DEFAULT NULL COMMENT '插旗',
+ `flag_remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '插旗备注',
+ `pay_time` datetime DEFAULT NULL COMMENT '付款时间',
+ `address` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '收货地址',
+ `shop_id` int DEFAULT NULL COMMENT '商品id',
+ `sku` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'sku',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+-- ----------------------------
+-- Table structure for store
+-- ----------------------------
+DROP TABLE IF EXISTS `store`;
+CREATE TABLE `store` (
+ `id` int NOT NULL AUTO_INCREMENT COMMENT '#',
+ `name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '店铺名称',
+ `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+ `update_time` datetime DEFAULT NULL COMMENT '更新时间',
+ `del` int DEFAULT '0' COMMENT '逻辑删除',
+ `status` blob COMMENT '状态',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/pom.xml b/pom.xml
index 0e2a8aa..365e82a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,4 +129,12 @@
3.2.1
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
\ No newline at end of file
diff --git a/src/main/java/top/xinsin/controller/AccountController.java b/src/main/java/top/xinsin/controller/AccountController.java
index 78022de..f66c2a7 100644
--- a/src/main/java/top/xinsin/controller/AccountController.java
+++ b/src/main/java/top/xinsin/controller/AccountController.java
@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import top.xinsin.pojo.Account;
+import top.xinsin.pojo.AuthAccount;
import top.xinsin.service.AccountService;
import top.xinsin.util.R;
@@ -24,7 +24,7 @@ public class AccountController {
private AccountService accountService;
@RequestMapping(path = "/changeAccount", method = RequestMethod.POST)
- public R changeAccount(@RequestBody Account account) {return this.accountService.changeAccount(account);}
+ public R changeAccount(@RequestBody AuthAccount authAccount) {return this.accountService.changeAccount(authAccount);}
@RequestMapping(path = "/changeStatus", method = RequestMethod.GET)
public R changeStatus(@RequestParam("userId") Integer userId, @RequestParam("status") Boolean status) {return this.accountService.changeStatus(userId, status);}
diff --git a/src/main/java/top/xinsin/controller/AuthorizeController.java b/src/main/java/top/xinsin/controller/AuthorizeController.java
index 136cc8b..3484e69 100644
--- a/src/main/java/top/xinsin/controller/AuthorizeController.java
+++ b/src/main/java/top/xinsin/controller/AuthorizeController.java
@@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import top.xinsin.pojo.Account;
+import top.xinsin.pojo.AuthAccount;
import top.xinsin.service.AccountService;
import top.xinsin.util.R;
@@ -24,12 +24,12 @@ public class AuthorizeController {
@RequestMapping(path = "/register", method = RequestMethod.POST)
public R register(@RequestParam("username") String username, @RequestParam("relName") String relName, @RequestParam("email") String email, @RequestParam("password") String password, @RequestParam("roleId") Integer roleId) {
- Account account = new Account();
- account.setUsername(username);
- account.setPassword(password);
- account.setRelName(relName);
- account.setEmail(email);
- account.setRoleId(roleId);
- return this.accountService.register(account);
+ AuthAccount authAccount = new AuthAccount();
+ authAccount.setUsername(username);
+ authAccount.setPassword(password);
+ authAccount.setRelName(relName);
+ authAccount.setEmail(email);
+ authAccount.setRoleId(roleId);
+ return this.accountService.register(authAccount);
}
}
diff --git a/src/main/java/top/xinsin/interceptor/AuthorizeInterceptor.java b/src/main/java/top/xinsin/interceptor/AuthorizeInterceptor.java
index 21d5692..2dfede0 100644
--- a/src/main/java/top/xinsin/interceptor/AuthorizeInterceptor.java
+++ b/src/main/java/top/xinsin/interceptor/AuthorizeInterceptor.java
@@ -11,7 +11,7 @@ import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import top.xinsin.mapper.AccountMapper;
-import top.xinsin.pojo.Account;
+import top.xinsin.pojo.AuthAccount;
@Component
public class AuthorizeInterceptor implements HandlerInterceptor {
@@ -24,12 +24,12 @@ public class AuthorizeInterceptor implements HandlerInterceptor {
Authentication authentication = context.getAuthentication();
User user = (User)authentication.getPrincipal();
String username = user.getUsername();
- Account account = accountMapper.selectOne(new LambdaQueryWrapper()
- .eq(Account::getUsername,username)
+ AuthAccount authAccount = accountMapper.selectOne(new LambdaQueryWrapper()
+ .eq(AuthAccount::getUsername,username)
.or()
- .eq(Account::getEmail,username)
- .eq(Account::getStatus,true));
- request.getSession().setAttribute("account", account);
+ .eq(AuthAccount::getEmail,username)
+ .eq(AuthAccount::getStatus,true));
+ request.getSession().setAttribute("account", authAccount);
return true;
}
}
diff --git a/src/main/java/top/xinsin/mapper/AccountMapper.java b/src/main/java/top/xinsin/mapper/AccountMapper.java
index 02c661c..0878d16 100644
--- a/src/main/java/top/xinsin/mapper/AccountMapper.java
+++ b/src/main/java/top/xinsin/mapper/AccountMapper.java
@@ -2,7 +2,7 @@ package top.xinsin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
-import top.xinsin.pojo.Account;
+import top.xinsin.pojo.AuthAccount;
/**
* @author xinsin
@@ -10,5 +10,5 @@ import top.xinsin.pojo.Account;
* @version 1.0
*/
@Mapper
-public interface AccountMapper extends BaseMapper {
+public interface AccountMapper extends BaseMapper {
}
diff --git a/src/main/java/top/xinsin/mapper/PermissionsMapper.java b/src/main/java/top/xinsin/mapper/PermissionsMapper.java
index 48233e8..57b0082 100644
--- a/src/main/java/top/xinsin/mapper/PermissionsMapper.java
+++ b/src/main/java/top/xinsin/mapper/PermissionsMapper.java
@@ -2,7 +2,7 @@ package top.xinsin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
-import top.xinsin.pojo.Permissions;
+import top.xinsin.pojo.AuthPermissions;
/**
* @author xinsin
@@ -10,5 +10,5 @@ import top.xinsin.pojo.Permissions;
* @version 1.0
*/
@Mapper
-public interface PermissionsMapper extends BaseMapper {
+public interface PermissionsMapper extends BaseMapper {
}
diff --git a/src/main/java/top/xinsin/mapper/RolesMapper.java b/src/main/java/top/xinsin/mapper/RolesMapper.java
index b097e02..03cf517 100644
--- a/src/main/java/top/xinsin/mapper/RolesMapper.java
+++ b/src/main/java/top/xinsin/mapper/RolesMapper.java
@@ -2,7 +2,7 @@ package top.xinsin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
-import top.xinsin.pojo.Roles;
+import top.xinsin.pojo.AuthRoles;
/**
* @author xinsin
@@ -10,5 +10,5 @@ import top.xinsin.pojo.Roles;
* @version 1.0
*/
@Mapper
-public interface RolesMapper extends BaseMapper {
+public interface RolesMapper extends BaseMapper {
}
\ No newline at end of file
diff --git a/src/main/java/top/xinsin/pojo/Account.java b/src/main/java/top/xinsin/pojo/AuthAccount.java
similarity index 94%
rename from src/main/java/top/xinsin/pojo/Account.java
rename to src/main/java/top/xinsin/pojo/AuthAccount.java
index ff30575..90c0e28 100644
--- a/src/main/java/top/xinsin/pojo/Account.java
+++ b/src/main/java/top/xinsin/pojo/AuthAccount.java
@@ -15,8 +15,8 @@ import java.util.Date;
* @version 1.0
*/
@Data
-@TableName("account")
-public class Account implements Serializable {
+@TableName("auth_account")
+public class AuthAccount implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
diff --git a/src/main/java/top/xinsin/pojo/Permissions.java b/src/main/java/top/xinsin/pojo/AuthPermissions.java
similarity index 93%
rename from src/main/java/top/xinsin/pojo/Permissions.java
rename to src/main/java/top/xinsin/pojo/AuthPermissions.java
index b4ccc82..6692691 100644
--- a/src/main/java/top/xinsin/pojo/Permissions.java
+++ b/src/main/java/top/xinsin/pojo/AuthPermissions.java
@@ -15,8 +15,8 @@ import java.time.LocalDateTime;
* @version 1.0
*/
@Data
-@TableName("permissions")
-public class Permissions implements Serializable {
+@TableName("auth_permissions")
+public class AuthPermissions implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
diff --git a/src/main/java/top/xinsin/pojo/Roles.java b/src/main/java/top/xinsin/pojo/AuthRoles.java
similarity index 94%
rename from src/main/java/top/xinsin/pojo/Roles.java
rename to src/main/java/top/xinsin/pojo/AuthRoles.java
index e373619..c172885 100644
--- a/src/main/java/top/xinsin/pojo/Roles.java
+++ b/src/main/java/top/xinsin/pojo/AuthRoles.java
@@ -15,8 +15,8 @@ import java.time.LocalDateTime;
* @version 1.0
*/
@Data
-@TableName("roles")
-public class Roles implements Serializable {
+@TableName("auth_roles")
+public class AuthRoles implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
diff --git a/src/main/java/top/xinsin/service/AccountService.java b/src/main/java/top/xinsin/service/AccountService.java
index 15a5b9f..e62e4a4 100644
--- a/src/main/java/top/xinsin/service/AccountService.java
+++ b/src/main/java/top/xinsin/service/AccountService.java
@@ -1,12 +1,9 @@
package top.xinsin.service;
import com.alibaba.fastjson2.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
@@ -15,7 +12,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import top.xinsin.mapper.AccountMapper;
-import top.xinsin.pojo.Account;
+import top.xinsin.pojo.AuthAccount;
import top.xinsin.util.HttpCodes;
import top.xinsin.util.R;
@@ -42,37 +39,37 @@ public class AccountService implements UserDetailsService {
if (username == null) {
throw new UsernameNotFoundException("用户名不能为空");
} else {
- Account account = this.accountMapper.selectOne(new LambdaQueryWrapper().eq(Account::getUsername, username).or().eq(Account::getEmail, username).eq(Account::getStatus, true));
- if (account == null) {
+ AuthAccount authAccount = this.accountMapper.selectOne(new LambdaQueryWrapper().eq(AuthAccount::getUsername, username).or().eq(AuthAccount::getEmail, username).eq(AuthAccount::getStatus, true));
+ if (authAccount == null) {
throw new UsernameNotFoundException("用户名或密码错误");
} else {
- return User.withUsername(account.getUsername()).password(account.getPassword()).roles(new String[]{"role=" + account.getRoleId(), "id=" + account.getId()}).build();
+ return User.withUsername(authAccount.getUsername()).password(authAccount.getPassword()).roles(new String[]{"role=" + authAccount.getRoleId(), "id=" + authAccount.getId()}).build();
}
}
}
- public R register(Account account) {
- account.setCreateTime(new Date());
- account.setStatus(true);
- account.setPassword(this.encoder.encode(account.getPassword()));
- int insert = this.accountMapper.insert(account);
+ public R register(AuthAccount authAccount) {
+ authAccount.setCreateTime(new Date());
+ authAccount.setStatus(true);
+ authAccount.setPassword(this.encoder.encode(authAccount.getPassword()));
+ int insert = this.accountMapper.insert(authAccount);
return insert == 1 ? R.success("注册成功") : R.failed(HttpCodes.HTTP_CODES555, "注册失败,您的用户名或者邮箱已经被注册过了");
}
- public R changeAccount(Account account) {
- if (account.getPassword() != null) {
- account.setPassword(this.encoder.encode(account.getPassword()));
+ public R changeAccount(AuthAccount authAccount) {
+ if (authAccount.getPassword() != null) {
+ authAccount.setPassword(this.encoder.encode(authAccount.getPassword()));
}
- int update = this.accountMapper.updateById(account);
+ int update = this.accountMapper.updateById(authAccount);
return update == 1 ? R.success("修改用户信息成功") : R.failed(HttpCodes.HTTP_CODES555, "修改用户信息失败,请联系服务器管理员");
}
public R changeStatus(Integer userId, Boolean status) {
- Account account = new Account();
- account.setId(userId);
- account.setStatus(status);
- int i = this.accountMapper.updateById(account);
+ AuthAccount authAccount = new AuthAccount();
+ authAccount.setId(userId);
+ authAccount.setStatus(status);
+ int i = this.accountMapper.updateById(authAccount);
if (i == 1) {
return status ? R.success("启用该用户成功") : R.success("禁用该用户成功");
} else {
@@ -81,19 +78,19 @@ public class AccountService implements UserDetailsService {
}
public R changePassword(Integer userId, String oldPassword, String newPassword) {
- Account account = new Account();
- account.setPassword(this.encoder.encode(newPassword));
- LambdaQueryWrapper accountLambdaQueryWrapper = new LambdaQueryWrapper<>();
- accountLambdaQueryWrapper.eq(Account::getId, userId).eq(Account::getPassword, this.encoder.encode(oldPassword));
- int update = this.accountMapper.update(account, accountLambdaQueryWrapper);
+ AuthAccount authAccount = new AuthAccount();
+ authAccount.setPassword(this.encoder.encode(newPassword));
+ LambdaQueryWrapper accountLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ accountLambdaQueryWrapper.eq(AuthAccount::getId, userId).eq(AuthAccount::getPassword, this.encoder.encode(oldPassword));
+ int update = this.accountMapper.update(authAccount, accountLambdaQueryWrapper);
return update == 1 ? R.success("修改密码成功") : R.failed(HttpCodes.HTTP_CODES555, "修改密码失败,请联系服务器管理员");
}
public R getUser(Integer page, Integer num) {
- Page accountPage = new Page<>((long)page, (long)num);
- Page accountPage1 = this.accountMapper.selectPage(accountPage, null);
+ Page accountPage = new Page<>((long)page, (long)num);
+ Page accountPage1 = this.accountMapper.selectPage(accountPage, null);
JSONObject jsonObject = new JSONObject();
- List collect = accountPage1.getRecords().stream().peek((e) -> {
+ List collect = accountPage1.getRecords().stream().peek((e) -> {
e.setPassword((String)null);
}).toList();
jsonObject.fluentPut("info", collect).fluentPut("total", accountPage1.getTotal());
diff --git a/src/main/java/top/xinsin/service/CommissionService.java b/src/main/java/top/xinsin/service/CommissionService.java
index ef0b971..e69bf69 100644
--- a/src/main/java/top/xinsin/service/CommissionService.java
+++ b/src/main/java/top/xinsin/service/CommissionService.java
@@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.xinsin.mapper.CommissionMapper;
-import top.xinsin.pojo.Account;
import top.xinsin.pojo.Commission;
-import com.baomidou.mybatisplus.extension.service.IService;
-import top.xinsin.pojo.Store;
import top.xinsin.util.HttpCodes;
import top.xinsin.util.R;
diff --git a/src/main/java/top/xinsin/service/OrderService.java b/src/main/java/top/xinsin/service/OrderService.java
index 3c3d2d1..5a44411 100644
--- a/src/main/java/top/xinsin/service/OrderService.java
+++ b/src/main/java/top/xinsin/service/OrderService.java
@@ -149,7 +149,7 @@ public class OrderService {
@SneakyThrows
public void downloadTemplate(HttpServletResponse response) {
try {
- File file = new File("template/example.xlsx");
+ File file = new File("./template/example.xlsx");
FileInputStream fileInputStream = new FileInputStream(file);
BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
byte[] bytes = new byte[bufferedInputStream.available()];
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index e2a2c04..42fa8a2 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -2,9 +2,9 @@ server:
port: 8001
spring:
datasource:
- username: commerce_system
- password: Jix656dzD6St4YCn
- url: jdbc:mysql://www.wzpmc.cn:3306/commerce_system?serverTimezone=UTC-8
+ username: commerce
+ password: Jix656dzD6St4YCn_
+ url: jdbc:mysql://localhost:3306/commerce_system?serverTimezone=UTC-8
driver-class-name: com.mysql.cj.jdbc.Driver
# druid配置
type: com.alibaba.druid.pool.DruidDataSource
@@ -36,8 +36,8 @@ spring:
user:
password: 123456
mybatis-plus:
- configuration:
- log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+# configuration:
+# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
logic-delete-field: del # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2)
diff --git a/src/main/resources/mapper/AccountMapper.xml b/src/main/resources/mapper/AccountMapper.xml
index 79a23ac..5d1591c 100644
--- a/src/main/resources/mapper/AccountMapper.xml
+++ b/src/main/resources/mapper/AccountMapper.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/src/main/resources/mapper/PermissionsMapper.xml b/src/main/resources/mapper/PermissionsMapper.xml
index a99f96a..0e66b75 100644
--- a/src/main/resources/mapper/PermissionsMapper.xml
+++ b/src/main/resources/mapper/PermissionsMapper.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/src/main/resources/mapper/RolesMapper.xml b/src/main/resources/mapper/RolesMapper.xml
index 9dab3cc..5de7f0a 100644
--- a/src/main/resources/mapper/RolesMapper.xml
+++ b/src/main/resources/mapper/RolesMapper.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/src/main/resources/template/example.xlsx b/src/main/resources/template/example.xlsx
new file mode 100644
index 0000000..ee9c302
Binary files /dev/null and b/src/main/resources/template/example.xlsx differ
diff --git a/src/test/java/top/xinsin/MainTest.java b/src/test/java/top/xinsin/MainTest.java
index 17985cf..14ef63d 100644
--- a/src/test/java/top/xinsin/MainTest.java
+++ b/src/test/java/top/xinsin/MainTest.java
@@ -16,7 +16,7 @@ public class MainTest {
@Test
public void test01(){
- System.out.println(new BCryptPasswordEncoder().encode(DigestUtils.md5Hex("xinsin")));
+ System.out.println(new BCryptPasswordEncoder().encode(DigestUtils.md5Hex("12345678")));
System.out.println(DigestUtils.md5Hex("xinsin"));
}