From 2a7642a05030f96f08394411910af1371c12d67d Mon Sep 17 00:00:00 2001 From: xinsin <2890826955@qq.com> Date: Fri, 28 Apr 2023 20:20:48 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9E=95=20Feat:=20=E9=83=A8=E7=BD=B2=E4=BA=8C?= =?UTF-8?q?=E6=9C=9F=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commerce_system.sql | 160 ++++++++++++++++++ pom.xml | 8 + .../xinsin/controller/AccountController.java | 4 +- .../controller/AuthorizeController.java | 16 +- .../interceptor/AuthorizeInterceptor.java | 12 +- .../java/top/xinsin/mapper/AccountMapper.java | 4 +- .../top/xinsin/mapper/PermissionsMapper.java | 4 +- .../java/top/xinsin/mapper/RolesMapper.java | 4 +- .../pojo/{Account.java => AuthAccount.java} | 4 +- ...{Permissions.java => AuthPermissions.java} | 4 +- .../pojo/{Roles.java => AuthRoles.java} | 4 +- .../top/xinsin/service/AccountService.java | 53 +++--- .../top/xinsin/service/CommissionService.java | 3 - .../java/top/xinsin/service/OrderService.java | 2 +- src/main/resources/application.yml | 10 +- src/main/resources/mapper/AccountMapper.xml | 2 +- .../resources/mapper/PermissionsMapper.xml | 2 +- src/main/resources/mapper/RolesMapper.xml | 2 +- src/main/resources/template/example.xlsx | Bin 0 -> 9922 bytes src/test/java/top/xinsin/MainTest.java | 2 +- 20 files changed, 231 insertions(+), 69 deletions(-) create mode 100644 commerce_system.sql rename src/main/java/top/xinsin/pojo/{Account.java => AuthAccount.java} (94%) rename src/main/java/top/xinsin/pojo/{Permissions.java => AuthPermissions.java} (93%) rename src/main/java/top/xinsin/pojo/{Roles.java => AuthRoles.java} (94%) create mode 100644 src/main/resources/template/example.xlsx 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 0000000000000000000000000000000000000000..ee9c302f4d2acc005ec3cfe495044c3e94e9e29b GIT binary patch literal 9922 zcmeHt1y`KO)^+0!jcag+hKArS0RjYf5?q42yEg6;+%0%;cMAjv?hq^lcPH>MbMJj; zCNtkJxVL((s@1EXeO5nJXV*D(b}7ojz~TVl0f+zqfC6B6lxe051pvgt0szCHcon~?sg`QIxKG1R^)lG(DXR~=;!DE*ZzxVpgeIzz84IXxPJX0z6Fw5t`R}x zJPa7bVpJ09>Pr|XHF}$6ZvK=Nb`KQG#kJu6gf+hG$$mO&R%2t`5D+@hs*D=pKh&kB zOU%vMKX^dXiBA~spsjVBgF`IBMyRJ3Wtt91v2W~E=6JO(DpO8mhKncUx0$&(sE)Zd z(2QEDUBWxG)cs9feHD{u_~R6Ca{_zX!kocV_k0s14I4q}xs2zcTc}8(sls5W-0X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