├── my-mall-admin ├── theme │ ├── form-item.css │ ├── menu-item.css │ ├── submenu.css │ ├── tab-pane.css │ ├── button-group.css │ ├── checkbox-group.css │ ├── collapse-item.css │ ├── dropdown-item.css │ ├── dropdown-menu.css │ ├── infiniteScroll.css │ ├── breadcrumb-item.css │ ├── checkbox-button.css │ ├── infinite-scroll.css │ ├── menu-item-group.css │ ├── fonts │ │ ├── element-icons.ttf │ │ └── element-icons.woff │ ├── element-variables.css │ ├── aside.css │ ├── steps.css │ └── container.css ├── .gitattributes ├── public │ └── favicon.ico ├── src │ ├── assets │ │ ├── my.png │ │ ├── logo.png │ │ └── shop.png │ ├── components │ │ ├── Footer.vue │ │ └── Header.vue │ ├── views │ │ ├── Introduce.vue │ │ └── Account.vue │ ├── utils │ │ ├── axios.js │ │ └── index.js │ ├── router │ │ └── index.js │ └── main.js ├── vue3-admin-server.js ├── config │ └── index.js ├── index.html ├── .gitignore ├── ecosystem.config.js ├── vite.config.js └── package.json ├── my-mall-api ├── .gitattributes ├── src │ └── main │ │ ├── resources │ │ ├── application.properties │ │ └── mapper │ │ │ ├── NewBeeMallUserTokenMapper.xml │ │ │ └── NewBeeAdminUserTokenMapper.xml │ │ └── java │ │ └── com │ │ └── my │ │ └── mall │ │ ├── entity │ │ ├── StockNumDTO.java │ │ ├── MallUserToken.java │ │ ├── AdminUserToken.java │ │ ├── AdminUser.java │ │ ├── NewBeeMallOrderAddress.java │ │ ├── NewBeeMallShoppingCartItem.java │ │ ├── NewBeeMallOrderItem.java │ │ ├── MallUser.java │ │ ├── MallUserAddress.java │ │ ├── Carousel.java │ │ ├── GoodsCategory.java │ │ ├── IndexConfig.java │ │ ├── NewBeeMallOrder.java │ │ └── NewBeeMallGoods.java │ │ ├── api │ │ ├── admin │ │ │ ├── param │ │ │ │ ├── BatchIdParam.java │ │ │ │ ├── UpdateAdminNameParam.java │ │ │ │ ├── UpdateAdminPasswordParam.java │ │ │ │ ├── AdminLoginParam.java │ │ │ │ ├── CarouselAddParam.java │ │ │ │ ├── CarouselEditParam.java │ │ │ │ ├── IndexConfigAddParam.java │ │ │ │ ├── GoodsCategoryAddParam.java │ │ │ │ ├── IndexConfigEditParam.java │ │ │ │ ├── GoodsCategoryEditParam.java │ │ │ │ ├── GoodsAddParam.java │ │ │ │ └── GoodsEditParam.java │ │ │ └── AdminRegisteUserAPI.java │ │ └── mall │ │ │ ├── param │ │ │ ├── SaveOrderParam.java │ │ │ ├── SaveCartItemParam.java │ │ │ ├── UpdateCartItemParam.java │ │ │ ├── MallUserUpdateParam.java │ │ │ ├── MallUserRegisterParam.java │ │ │ ├── MallUserLoginParam.java │ │ │ ├── SaveMallUserAddressParam.java │ │ │ └── UpdateMallUserAddressParam.java │ │ │ ├── vo │ │ │ ├── IndexCarouselVO.java │ │ │ ├── UserVO.java │ │ │ ├── ThirdLevelCategoryVO.java │ │ │ ├── IndexCategoryVO.java │ │ │ ├── OrderItemVO.java │ │ │ ├── IndexInfoVO.java │ │ │ ├── SearchGoodsVO.java │ │ │ ├── IndexConfigGoodsVO.java │ │ │ ├── ShoppingCartItemVO.java │ │ │ ├── SecondLevelCategoryVO.java │ │ │ ├── UserAddressVO.java │ │ │ ├── GoodsDetailVO.java │ │ │ ├── OrderListVO.java │ │ │ ├── OrderDetailVO.java │ │ │ └── SearchPageCategoryVO.java │ │ │ ├── NewBeeMallGoodsCategoryAPI.java │ │ │ └── NewBeeMallIndexAPI.java │ │ ├── config │ │ ├── annotation │ │ │ ├── TokenToMallUser.java │ │ │ └── TokenToAdminUser.java │ │ ├── Swagger3Config.java │ │ ├── NeeBeeMallWebMvcConfigurer.java │ │ ├── NewBeeMallExceptionHandler.java │ │ └── handler │ │ │ ├── TokenToAdminUserMethodArgumentResolver.java │ │ │ └── TokenToMallUserMethodArgumentResolver.java │ │ ├── MyMallAPIApplication.java │ │ ├── common │ │ ├── NewBeeMallException.java │ │ ├── PayTypeEnum.java │ │ ├── PayStatusEnum.java │ │ ├── NewBeeMallCategoryLevelEnum.java │ │ ├── IndexConfigTypeEnum.java │ │ ├── Constants.java │ │ ├── NewBeeMallOrderStatusEnum.java │ │ └── ServiceResultEnum.java │ │ ├── dao │ │ ├── NewBeeMallUserTokenMapper.java │ │ ├── NewBeeMallOrderAddressMapper.java │ │ ├── NewBeeAdminUserTokenMapper.java │ │ ├── MallUserAddressMapper.java │ │ ├── AdminUserMapper.java │ │ ├── CarouselMapper.java │ │ ├── MallUserMapper.java │ │ ├── IndexConfigMapper.java │ │ ├── GoodsCategoryMapper.java │ │ ├── NewBeeMallOrderMapper.java │ │ ├── NewBeeMallOrderItemMapper.java │ │ ├── NewBeeMallShoppingCartItemMapper.java │ │ └── NewBeeMallGoodsMapper.java │ │ ├── service │ │ ├── NewBeeMallCarouselService.java │ │ ├── NewBeeMallIndexConfigService.java │ │ ├── NewBeeMallCategoryService.java │ │ ├── AdminUserService.java │ │ ├── NewBeeMallUserAddressService.java │ │ ├── NewBeeMallUserService.java │ │ ├── NewBeeMallGoodsService.java │ │ ├── NewBeeMallShoppingCartService.java │ │ ├── NewBeeMallOrderService.java │ │ └── impl │ │ │ ├── NewBeeMallCarouselServiceImpl.java │ │ │ └── NewBeeMallUserAddressServiceImpl.java │ │ └── util │ │ ├── SystemUtil.java │ │ ├── PageQueryUtil.java │ │ ├── NumberUtil.java │ │ ├── MD5Util.java │ │ ├── Result.java │ │ ├── ResultGenerator.java │ │ ├── PageResult.java │ │ ├── NewBeeMallUtils.java │ │ └── BeanUtil.java ├── .gitignore └── pom.xml ├── my-mall-front ├── src │ ├── store │ │ ├── state.js │ │ ├── mutations.js │ │ ├── actions.js │ │ └── index.js │ ├── assets │ │ └── logo.png │ ├── common │ │ ├── img │ │ │ ├── 分类.png │ │ │ ├── 分类1.png │ │ │ ├── 分类2.png │ │ │ └── 购物车.png │ │ └── style │ │ │ ├── base.less │ │ │ └── mixin.less │ ├── service │ │ ├── home.js │ │ ├── good.js │ │ ├── user.js │ │ ├── cart.js │ │ ├── order.js │ │ └── address.js │ ├── views │ │ ├── About.vue │ │ ├── Setting.vue │ │ └── Address.vue │ ├── components │ │ ├── Swiper.vue │ │ ├── SimpleHeader.vue │ │ ├── ListScroll.vue │ │ ├── NavBar.vue │ │ └── VueImageVerify.vue │ ├── utils │ │ └── axios.js │ ├── main.js │ ├── App.vue │ └── router │ │ └── index.js ├── .gitattributes ├── public │ ├── favicon.ico │ └── index.html ├── myshop-v3-server.js ├── babel.config.js ├── postcss.config.js ├── .gitignore └── package.json ├── 关于系统.txt └── README.md /my-mall-admin/theme/form-item.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/menu-item.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/submenu.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/tab-pane.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/button-group.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/checkbox-group.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/collapse-item.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/dropdown-item.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/dropdown-menu.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/infiniteScroll.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/breadcrumb-item.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/checkbox-button.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/infinite-scroll.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-admin/theme/menu-item-group.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /my-mall-api/.gitattributes: -------------------------------------------------------------------------------- 1 | *.sql linguist-language=java 2 | -------------------------------------------------------------------------------- /my-mall-front/src/store/state.js: -------------------------------------------------------------------------------- 1 | export default { 2 | cartCount: 0 3 | } 4 | -------------------------------------------------------------------------------- /关于系统.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/关于系统.txt -------------------------------------------------------------------------------- /my-mall-admin/.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=vue 2 | 3 | *.css linguist-language=vue 4 | 5 | *.html linguist-language=vue -------------------------------------------------------------------------------- /my-mall-front/.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=vue 2 | 3 | *.css linguist-language=vue 4 | 5 | *.html linguist-language=vue -------------------------------------------------------------------------------- /my-mall-admin/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-admin/public/favicon.ico -------------------------------------------------------------------------------- /my-mall-admin/src/assets/my.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-admin/src/assets/my.png -------------------------------------------------------------------------------- /my-mall-front/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-front/public/favicon.ico -------------------------------------------------------------------------------- /my-mall-admin/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-admin/src/assets/logo.png -------------------------------------------------------------------------------- /my-mall-admin/src/assets/shop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-admin/src/assets/shop.png -------------------------------------------------------------------------------- /my-mall-front/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-front/src/assets/logo.png -------------------------------------------------------------------------------- /my-mall-front/src/common/img/分类.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-front/src/common/img/分类.png -------------------------------------------------------------------------------- /my-mall-front/src/store/mutations.js: -------------------------------------------------------------------------------- 1 | export default { 2 | addCart (state, payload) { 3 | state.cartCount = payload.count 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /my-mall-admin/vue3-admin-server.js: -------------------------------------------------------------------------------- 1 | const server = require('pushstate-server') 2 | 3 | server.start({ 4 | port: 5018, 5 | directory: './dist' 6 | }) -------------------------------------------------------------------------------- /my-mall-front/src/common/img/分类1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-front/src/common/img/分类1.png -------------------------------------------------------------------------------- /my-mall-front/src/common/img/分类2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-front/src/common/img/分类2.png -------------------------------------------------------------------------------- /my-mall-front/src/common/img/购物车.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-front/src/common/img/购物车.png -------------------------------------------------------------------------------- /my-mall-front/myshop-v3-server.js: -------------------------------------------------------------------------------- 1 | var server = require('pushstate-server'); 2 | 3 | server.start({ 4 | port: 5008, 5 | directory: './dist' 6 | }); 7 | -------------------------------------------------------------------------------- /my-mall-front/src/service/home.js: -------------------------------------------------------------------------------- 1 | import axios from '../utils/axios' 2 | 3 | export function getHome() { 4 | return axios.get('/index-infos'); 5 | } 6 | 7 | -------------------------------------------------------------------------------- /my-mall-admin/theme/fonts/element-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-admin/theme/fonts/element-icons.ttf -------------------------------------------------------------------------------- /my-mall-admin/theme/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-admin/theme/fonts/element-icons.woff -------------------------------------------------------------------------------- /my-mall-api/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Vue3.0_Springboot_Shopping/HEAD/my-mall-api/src/main/resources/application.properties -------------------------------------------------------------------------------- /my-mall-front/src/store/actions.js: -------------------------------------------------------------------------------- 1 | import { getCart } from '../service/cart' 2 | 3 | export default { 4 | async updateCart(ctx) { 5 | const { data } = await getCart() 6 | ctx.commit('addCart', { 7 | count: data.length || 0 8 | }) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /my-mall-front/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ], 5 | plugins: [ 6 | ['import', { 7 | libraryName: 'vant', 8 | libraryDirectory: 'es', 9 | style: true 10 | }, 'vant'] 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /my-mall-front/src/store/index.js: -------------------------------------------------------------------------------- 1 | import { createStore } from 'vuex' 2 | import state from './state' 3 | import actions from './actions' 4 | import mutations from './mutations' 5 | 6 | export default createStore({ 7 | state, 8 | mutations, 9 | actions, 10 | modules: {} 11 | }) -------------------------------------------------------------------------------- /my-mall-admin/config/index.js: -------------------------------------------------------------------------------- 1 | export default { 2 | development: { 3 | baseUrl: '/api' // 测试接口域名 4 | }, 5 | beta: { 6 | baseUrl: '//localhost:8008/manage-api/v1' // 测试接口域名 7 | }, 8 | release: { 9 | baseUrl: '//localhost:8008/manage-api/v1' // 正式接口域名 10 | } 11 | } -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/StockNumDTO.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 库存修改所需实体 7 | */ 8 | 9 | @Data 10 | public class StockNumDTO { 11 | private Long goodsId; 12 | 13 | private Integer goodsCount; 14 | } 15 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/BatchIdParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | @Data 9 | public class BatchIdParam implements Serializable { 10 | //id数组 11 | Long[] ids; 12 | } 13 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/MallUserToken.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class MallUserToken { 9 | private Long userId; 10 | 11 | private String token; 12 | 13 | private Date updateTime; 14 | 15 | private Date expireTime; 16 | } 17 | -------------------------------------------------------------------------------- /my-mall-front/src/service/good.js: -------------------------------------------------------------------------------- 1 | import axios from '../utils/axios' 2 | 3 | export function getDetail(id) { 4 | return axios.get(`/goods/detail/${id}`); 5 | } 6 | 7 | export function getCategory() { 8 | return axios.get('/categories'); 9 | } 10 | 11 | export function search(params) { 12 | return axios.get('/search', { params }); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/AdminUserToken.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class AdminUserToken { 9 | private Long adminUserId; 10 | 11 | private String token; 12 | 13 | private Date updateTime; 14 | 15 | private Date expireTime; 16 | } 17 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/AdminUser.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class AdminUser { 7 | private Long adminUserId; 8 | 9 | private String loginUserName; 10 | 11 | private String loginPassword; 12 | 13 | private String nickName; 14 | 15 | private Byte locked; 16 | } 17 | -------------------------------------------------------------------------------- /my-mall-api/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /my-mall-front/postcss.config.js: -------------------------------------------------------------------------------- 1 | // postcss.config.js 2 | // 用 vite 创建项目,配置 postcss 需要使用 post.config.js,之前使用的 .postcssrc.js 已经被抛弃 3 | // 具体配置可以去 postcss-pxtorem 仓库看看文档 4 | module.exports = { 5 | "plugins": { 6 | "postcss-pxtorem": { 7 | rootValue: 37.5, // Vant 官方根字体大小是 37.5 8 | propList: ['*'], 9 | selectorBlackList: ['.norem'] // 过滤掉.norem-开头的class,不进行rem转换 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/config/annotation/TokenToMallUser.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.config.annotation; 3 | 4 | import java.lang.annotation.*; 5 | 6 | @Target({ElementType.PARAMETER}) 7 | @Retention(RetentionPolicy.RUNTIME) 8 | @Documented 9 | public @interface TokenToMallUser { 10 | 11 | /** 12 | * 当前用户在request中的名字 13 | * 14 | * @return 15 | */ 16 | String value() default "user"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/UpdateAdminNameParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotEmpty; 7 | 8 | @Data 9 | public class UpdateAdminNameParam { 10 | 11 | @NotEmpty(message = "loginUserName不能为空") 12 | private String loginUserName; 13 | 14 | @NotEmpty(message = "nickName不能为空") 15 | private String nickName; 16 | } 17 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/config/annotation/TokenToAdminUser.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.config.annotation; 3 | 4 | import java.lang.annotation.*; 5 | 6 | @Target({ElementType.PARAMETER}) 7 | @Retention(RetentionPolicy.RUNTIME) 8 | @Documented 9 | public @interface TokenToAdminUser { 10 | 11 | /** 12 | * 当前用户在request中的名字 13 | * 14 | * @return 15 | */ 16 | String value() default "adminUser"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/UpdateAdminPasswordParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotEmpty; 7 | 8 | @Data 9 | public class UpdateAdminPasswordParam { 10 | 11 | @NotEmpty(message = "originalPassword不能为空") 12 | private String originalPassword; 13 | 14 | @NotEmpty(message = "newPassword不能为空") 15 | private String newPassword; 16 | } 17 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/NewBeeMallOrderAddress.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class NewBeeMallOrderAddress { 7 | private Long orderId; 8 | 9 | private String userName; 10 | 11 | private String userPhone; 12 | 13 | private String provinceName; 14 | 15 | private String cityName; 16 | 17 | private String regionName; 18 | 19 | private String detailAddress; 20 | } 21 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/param/SaveOrderParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 保存订单param 11 | */ 12 | @Data 13 | public class SaveOrderParam implements Serializable { 14 | 15 | @ApiModelProperty("订单项id数组") 16 | private Long[] cartItemIds; 17 | 18 | @ApiModelProperty("地址id") 19 | private Long addressId; 20 | } 21 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/NewBeeMallShoppingCartItem.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class NewBeeMallShoppingCartItem { 9 | private Long cartItemId; 10 | 11 | private Long userId; 12 | 13 | private Long goodsId; 14 | 15 | private Integer goodsCount; 16 | 17 | private Byte isDeleted; 18 | 19 | private Date createTime; 20 | 21 | private Date updateTime; 22 | } 23 | -------------------------------------------------------------------------------- /my-mall-admin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 我的商城后台 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/param/SaveCartItemParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 添加购物项param 11 | */ 12 | @Data 13 | public class SaveCartItemParam implements Serializable { 14 | 15 | @ApiModelProperty("商品数量") 16 | private Integer goodsCount; 17 | 18 | @ApiModelProperty("商品id") 19 | private Long goodsId; 20 | } 21 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/IndexCarouselVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 首页轮播图VO 11 | */ 12 | @Data 13 | public class IndexCarouselVO implements Serializable { 14 | 15 | @ApiModelProperty("轮播图图片地址") 16 | private String carouselUrl; 17 | 18 | @ApiModelProperty("轮播图点击后的跳转路径") 19 | private String redirectUrl; 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vue3.0_Springboot_Shopping 2 | 基于Vue3.0+Springboot华为商城购物网站设计 3 | 4 | 开发技术环境: Idea + Vscode + Mysql + Springboot + vue3.0 5 | 6 | 基于vue的购物商城网站分为前台功能和后台管理功能,前台功能主要包括基础功能模块、订单管理模块、商品列表模块、个人中心模块。基础功能包括用户登录和注册网站账号,商品列表模块包括查询产品,购买产品,个人中心模块包括地址管理,个人资料管理。后台管理功能主要包括用户管理模块、商品类型管理模块、商品管理模块、订单管理模块、评论管理模块、系统设置模块。用户管理是对用户进行查询和以及对用户地址进行管理;商品管理包括对商品的添加和删除;订单管理是对用户提交的订单进行发货处理;系统管理是对密码进行修改。 7 | 8 | 后台地址:http://localhost:3000/#/login 9 | 管理员账号密码:boss/123456 10 | 前台地址:http://localhost:8080/#/home 11 | 前台账号密码自行注册 12 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/param/UpdateCartItemParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 修改购物项param 11 | */ 12 | @Data 13 | public class UpdateCartItemParam implements Serializable { 14 | 15 | @ApiModelProperty("购物项id") 16 | private Long cartItemId; 17 | 18 | @ApiModelProperty("商品数量") 19 | private Integer goodsCount; 20 | } 21 | -------------------------------------------------------------------------------- /my-mall-admin/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | 4 | # local env files 5 | .env.local 6 | .env.*.local 7 | 8 | # Log files 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | pnpm-debug.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | 23 | ### IntelliJ IDEA ### 24 | .idea 25 | *.iws 26 | *.iml 27 | *.ipr 28 | 29 | ### NetBeans ### 30 | /nbproject/private/ 31 | /build/ 32 | /nbbuild/ 33 | /nbdist/ 34 | /.nb-gradle/ -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/UserVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | @Data 10 | public class UserVO implements Serializable { 11 | 12 | @ApiModelProperty("用户昵称") 13 | private String nickName; 14 | 15 | @ApiModelProperty("用户登录名") 16 | private String loginName; 17 | 18 | @ApiModelProperty("个性签名") 19 | private String introduceSign; 20 | } 21 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/MyMallAPIApplication.java: -------------------------------------------------------------------------------- 1 | package com.my.mall; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @MapperScan("com.my.mall.dao") 8 | @SpringBootApplication 9 | public class MyMallAPIApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(MyMallAPIApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/common/NewBeeMallException.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.common; 3 | 4 | public class NewBeeMallException extends RuntimeException { 5 | 6 | public NewBeeMallException() { 7 | } 8 | 9 | public NewBeeMallException(String message) { 10 | super(message); 11 | } 12 | 13 | /** 14 | * 丢出一个异常 15 | * 16 | * @param message 17 | */ 18 | public static void fail(String message) { 19 | throw new NewBeeMallException(message); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/NewBeeMallOrderItem.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class NewBeeMallOrderItem { 9 | private Long orderItemId; 10 | 11 | private Long orderId; 12 | 13 | private Long goodsId; 14 | 15 | private String goodsName; 16 | 17 | private String goodsCoverImg; 18 | 19 | private Integer sellingPrice; 20 | 21 | private Integer goodsCount; 22 | 23 | private Date createTime; 24 | } 25 | -------------------------------------------------------------------------------- /my-mall-front/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw? 23 | 24 | ### IntelliJ IDEA ### 25 | .idea 26 | *.iws 27 | *.iml 28 | *.ipr 29 | 30 | ### NetBeans ### 31 | /nbproject/private/ 32 | /build/ 33 | /nbbuild/ 34 | /dist/ 35 | /nbdist/ 36 | /.nb-gradle/ -------------------------------------------------------------------------------- /my-mall-front/src/service/user.js: -------------------------------------------------------------------------------- 1 | import axios from '../utils/axios' 2 | 3 | export function getUserInfo() { 4 | return axios.get('/user/info'); 5 | } 6 | 7 | export function EditUserInfo(params) { 8 | return axios.put('/user/info', params); 9 | } 10 | 11 | export function login(params) { 12 | return axios.post('/user/login', params); 13 | } 14 | 15 | export function logout() { 16 | return axios.post('/user/logout') 17 | } 18 | 19 | export function register(params) { 20 | return axios.post('/user/register', params); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /my-mall-front/src/service/cart.js: -------------------------------------------------------------------------------- 1 | import axios from '../utils/axios' 2 | 3 | export function addCart(params) { 4 | return axios.post('/shop-cart', params); 5 | } 6 | 7 | export function modifyCart(params) { 8 | return axios.put('/shop-cart', params); 9 | } 10 | 11 | export function getCart(params) { 12 | return axios.get('/shop-cart', { params }); 13 | } 14 | 15 | export function deleteCartItem(id) { 16 | return axios.delete(`/shop-cart/${id}`); 17 | } 18 | 19 | export function getByCartItemIds(params) { 20 | return axios.get('/shop-cart/settle', { params }); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/AdminLoginParam.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.api.admin.param; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotEmpty; 7 | import java.io.Serializable; 8 | 9 | @Data 10 | public class AdminLoginParam implements Serializable { 11 | 12 | @ApiModelProperty("登录名") 13 | @NotEmpty(message = "登录名不能为空") 14 | private String userName; 15 | 16 | @ApiModelProperty("用户密码(需要MD5加密)") 17 | @NotEmpty(message = "密码不能为空") 18 | private String passwordMd5; 19 | } 20 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/param/MallUserUpdateParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 用户修改param 10 | */ 11 | @Data 12 | public class MallUserUpdateParam implements Serializable { 13 | 14 | @ApiModelProperty("用户昵称") 15 | private String nickName; 16 | 17 | @ApiModelProperty("用户密码(需要MD5加密)") 18 | private String passwordMd5; 19 | 20 | @ApiModelProperty("个性签名") 21 | private String introduceSign; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/ThirdLevelCategoryVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 首页分类数据VO(第三级) 11 | */ 12 | @Data 13 | public class ThirdLevelCategoryVO implements Serializable { 14 | 15 | @ApiModelProperty("当前三级分类id") 16 | private Long categoryId; 17 | 18 | @ApiModelProperty("当前分类级别") 19 | private Byte categoryLevel; 20 | 21 | @ApiModelProperty("当前三级分类名称") 22 | private String categoryName; 23 | } 24 | -------------------------------------------------------------------------------- /my-mall-admin/src/components/Footer.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/NewBeeMallUserTokenMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.MallUserToken; 5 | 6 | public interface NewBeeMallUserTokenMapper { 7 | int deleteByPrimaryKey(Long userId); 8 | 9 | int insert(MallUserToken record); 10 | 11 | int insertSelective(MallUserToken record); 12 | 13 | MallUserToken selectByPrimaryKey(Long userId); 14 | 15 | MallUserToken selectByToken(String token); 16 | 17 | int updateByPrimaryKeySelective(MallUserToken record); 18 | 19 | int updateByPrimaryKey(MallUserToken record); 20 | } 21 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/NewBeeMallOrderAddressMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.NewBeeMallOrderAddress; 5 | 6 | public interface NewBeeMallOrderAddressMapper { 7 | int deleteByPrimaryKey(Long orderId); 8 | 9 | int insert(NewBeeMallOrderAddress record); 10 | 11 | int insertSelective(NewBeeMallOrderAddress record); 12 | 13 | NewBeeMallOrderAddress selectByPrimaryKey(Long orderId); 14 | 15 | int updateByPrimaryKeySelective(NewBeeMallOrderAddress record); 16 | 17 | int updateByPrimaryKey(NewBeeMallOrderAddress record); 18 | } 19 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/NewBeeAdminUserTokenMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.AdminUserToken; 5 | 6 | public interface NewBeeAdminUserTokenMapper { 7 | int deleteByPrimaryKey(Long userId); 8 | 9 | int insert(AdminUserToken record); 10 | 11 | int insertSelective(AdminUserToken record); 12 | 13 | AdminUserToken selectByPrimaryKey(Long userId); 14 | 15 | AdminUserToken selectByToken(String token); 16 | 17 | int updateByPrimaryKeySelective(AdminUserToken record); 18 | 19 | int updateByPrimaryKey(AdminUserToken record); 20 | } 21 | -------------------------------------------------------------------------------- /my-mall-front/src/views/About.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 16 | 17 | 32 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/param/MallUserRegisterParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 用户注册param 12 | */ 13 | @Data 14 | public class MallUserRegisterParam implements Serializable { 15 | 16 | @ApiModelProperty("登录名") 17 | @NotEmpty(message = "登录名不能为空") 18 | private String loginName; 19 | 20 | @ApiModelProperty("用户密码") 21 | @NotEmpty(message = "密码不能为空") 22 | private String password; 23 | } 24 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/param/MallUserLoginParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 用户登录param 12 | */ 13 | @Data 14 | public class MallUserLoginParam implements Serializable { 15 | 16 | @ApiModelProperty("登录名") 17 | @NotEmpty(message = "登录名不能为空") 18 | private String loginName; 19 | 20 | @ApiModelProperty("用户密码(需要MD5加密)") 21 | @NotEmpty(message = "密码不能为空") 22 | private String passwordMd5; 23 | } 24 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/MallUser.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | public class MallUser { 10 | private Long userId; 11 | 12 | private String nickName; 13 | 14 | private String loginName; 15 | 16 | private String passwordMd5; 17 | 18 | private String introduceSign; 19 | 20 | private Byte isDeleted; 21 | 22 | private Byte lockedFlag; 23 | 24 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 25 | private Date createTime; 26 | } 27 | -------------------------------------------------------------------------------- /my-mall-admin/ecosystem.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | apps: [ 3 | { 4 | name: 'vue3-admin', 5 | script: 'vue3-admin-server.js' 6 | }, 7 | ], 8 | deploy: { 9 | production: { 10 | user: 'root', 11 | host: '47.99.134.126', 12 | ref: 'origin/main', 13 | repo: 'git@git.zhlh6.cn:newbee-ltd/vue3-admin.git', 14 | path: '/workspace/vue3-admin', 15 | 'post-deploy': 'git reset --hard && git checkout main && git pull && npm i --production=false && pm2 startOrReload ecosystem.config.js', // -production=false 下载全量包 16 | env: { 17 | NODE_ENV: 'production' 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /my-mall-front/src/components/Swiper.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 21 | 22 | 30 | -------------------------------------------------------------------------------- /my-mall-admin/src/views/Introduce.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 22 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/MallUserAddress.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class MallUserAddress { 9 | private Long addressId; 10 | 11 | private Long userId; 12 | 13 | private String userName; 14 | 15 | private String userPhone; 16 | 17 | private Byte defaultFlag; 18 | 19 | private String provinceName; 20 | 21 | private String cityName; 22 | 23 | private String regionName; 24 | 25 | private String detailAddress; 26 | 27 | private Byte isDeleted; 28 | 29 | private Date createTime; 30 | 31 | private Date updateTime; 32 | } 33 | -------------------------------------------------------------------------------- /my-mall-front/src/service/order.js: -------------------------------------------------------------------------------- 1 | import axios from '../utils/axios' 2 | 3 | export function createOrder(params) { 4 | return axios.post('/saveOrder', params); 5 | } 6 | 7 | export function getOrderList(params) { 8 | return axios.get('/order', { params }); 9 | } 10 | 11 | export function getOrderDetail(id) { 12 | return axios.get(`/order/${id}`); 13 | } 14 | 15 | export function cancelOrder(id) { 16 | return axios.put(`/order/${id}/cancel`); 17 | } 18 | 19 | export function confirmOrder(id) { 20 | return axios.put(`/order/${id}/finish`) 21 | } 22 | 23 | export function payOrder(params) { 24 | return axios.get('/paySuccess', { params }) 25 | } 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /my-mall-front/src/service/address.js: -------------------------------------------------------------------------------- 1 | import axios from '../utils/axios' 2 | 3 | export function addAddress(params) { 4 | return axios.post('/address', params); 5 | } 6 | 7 | export function EditAddress(params) { 8 | return axios.put('/address', params); 9 | } 10 | 11 | export function DeleteAddress(id) { 12 | return axios.delete(`/address/${id}`); 13 | } 14 | 15 | export function getDefaultAddress() { 16 | return axios.get('/address/default'); 17 | } 18 | 19 | export function getAddressList() { 20 | return axios.get('/address', { pageNumber: 1, pageSize: 1000 }) 21 | } 22 | 23 | export function getAddressDetail(id) { 24 | return axios.get(`/address/${id}`) 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/IndexCategoryVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * 首页分类数据VO 12 | */ 13 | @Data 14 | public class IndexCategoryVO implements Serializable { 15 | 16 | @ApiModelProperty("当前一级分类id") 17 | private Long categoryId; 18 | 19 | @ApiModelProperty("当前分类级别") 20 | private Byte categoryLevel; 21 | 22 | @ApiModelProperty("当前一级分类名称") 23 | private String categoryName; 24 | 25 | @ApiModelProperty("二级分类列表") 26 | private List secondLevelCategoryVOS; 27 | } 28 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/OrderItemVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 订单详情页页面订单项VO 11 | */ 12 | @Data 13 | public class OrderItemVO implements Serializable { 14 | 15 | @ApiModelProperty("商品id") 16 | private Long goodsId; 17 | 18 | @ApiModelProperty("商品数量") 19 | private Integer goodsCount; 20 | 21 | @ApiModelProperty("商品名称") 22 | private String goodsName; 23 | 24 | @ApiModelProperty("商品图片") 25 | private String goodsCoverImg; 26 | 27 | @ApiModelProperty("商品价格") 28 | private Integer sellingPrice; 29 | } 30 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/IndexInfoVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | @Data 11 | public class IndexInfoVO implements Serializable { 12 | 13 | @ApiModelProperty("轮播图(列表)") 14 | private List carousels; 15 | 16 | @ApiModelProperty("首页热销商品(列表)") 17 | private List hotGoodses; 18 | 19 | @ApiModelProperty("首页新品推荐(列表)") 20 | private List newGoodses; 21 | 22 | @ApiModelProperty("首页推荐商品(列表)") 23 | private List recommendGoodses; 24 | } 25 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/SearchGoodsVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 搜索列表页商品VO 11 | */ 12 | @Data 13 | public class SearchGoodsVO implements Serializable { 14 | 15 | @ApiModelProperty("商品id") 16 | private Long goodsId; 17 | 18 | @ApiModelProperty("商品名称") 19 | private String goodsName; 20 | 21 | @ApiModelProperty("商品简介") 22 | private String goodsIntro; 23 | 24 | @ApiModelProperty("商品图片地址") 25 | private String goodsCoverImg; 26 | 27 | @ApiModelProperty("商品价格") 28 | private Integer sellingPrice; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/MallUserAddressMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.MallUserAddress; 5 | 6 | import java.util.List; 7 | 8 | public interface MallUserAddressMapper { 9 | int deleteByPrimaryKey(Long addressId); 10 | 11 | int insert(MallUserAddress record); 12 | 13 | int insertSelective(MallUserAddress record); 14 | 15 | MallUserAddress selectByPrimaryKey(Long addressId); 16 | 17 | MallUserAddress getMyDefaultAddress(Long userId); 18 | 19 | List findMyAddressList(Long userId); 20 | 21 | int updateByPrimaryKeySelective(MallUserAddress record); 22 | 23 | int updateByPrimaryKey(MallUserAddress record); 24 | } 25 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/AdminUserMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.AdminUser; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | public interface AdminUserMapper { 8 | int insert(AdminUser record); 9 | 10 | int insertSelective(AdminUser record); 11 | 12 | /** 13 | * 登陆方法 14 | * 15 | * @param userName 16 | * @param password 17 | * @return 18 | */ 19 | AdminUser login(@Param("userName") String userName, @Param("password") String password); 20 | 21 | AdminUser selectByPrimaryKey(Long adminUserId); 22 | 23 | int updateByPrimaryKeySelective(AdminUser record); 24 | 25 | int updateByPrimaryKey(AdminUser record); 26 | } 27 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/Carousel.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | public class Carousel { 10 | private Integer carouselId; 11 | 12 | private String carouselUrl; 13 | 14 | private String redirectUrl; 15 | 16 | private Integer carouselRank; 17 | 18 | private Byte isDeleted; 19 | 20 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 21 | private Date createTime; 22 | 23 | private Integer createUser; 24 | 25 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 26 | private Date updateTime; 27 | 28 | private Integer updateUser; 29 | } 30 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/IndexConfigGoodsVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 首页配置商品VO 11 | */ 12 | @Data 13 | public class IndexConfigGoodsVO implements Serializable { 14 | 15 | @ApiModelProperty("商品id") 16 | private Long goodsId; 17 | @ApiModelProperty("商品名称") 18 | private String goodsName; 19 | @ApiModelProperty("商品简介") 20 | private String goodsIntro; 21 | @ApiModelProperty("商品图片地址") 22 | private String goodsCoverImg; 23 | @ApiModelProperty("商品价格") 24 | private Integer sellingPrice; 25 | @ApiModelProperty("商品标签") 26 | private String tag; 27 | } 28 | -------------------------------------------------------------------------------- /my-mall-front/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 华为商城 9 | 10 | 11 | 12 | 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/ShoppingCartItemVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 购物车页面购物项VO 11 | */ 12 | @Data 13 | public class ShoppingCartItemVO implements Serializable { 14 | 15 | @ApiModelProperty("购物项id") 16 | private Long cartItemId; 17 | 18 | @ApiModelProperty("商品id") 19 | private Long goodsId; 20 | 21 | @ApiModelProperty("商品数量") 22 | private Integer goodsCount; 23 | 24 | @ApiModelProperty("商品名称") 25 | private String goodsName; 26 | 27 | @ApiModelProperty("商品图片") 28 | private String goodsCoverImg; 29 | 30 | @ApiModelProperty("商品价格") 31 | private Integer sellingPrice; 32 | } 33 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/SecondLevelCategoryVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * 首页分类数据VO(第二级) 12 | */ 13 | @Data 14 | public class SecondLevelCategoryVO implements Serializable { 15 | 16 | @ApiModelProperty("当前二级分类id") 17 | private Long categoryId; 18 | 19 | @ApiModelProperty("父级分类id") 20 | private Long parentId; 21 | 22 | @ApiModelProperty("当前分类级别") 23 | private Byte categoryLevel; 24 | 25 | @ApiModelProperty("当前二级分类名称") 26 | private String categoryName; 27 | 28 | @ApiModelProperty("三级分类列表") 29 | private List thirdLevelCategoryVOS; 30 | } 31 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/GoodsCategory.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | public class GoodsCategory { 10 | private Long categoryId; 11 | 12 | private Byte categoryLevel; 13 | 14 | private Long parentId; 15 | 16 | private String categoryName; 17 | 18 | private Integer categoryRank; 19 | 20 | private Byte isDeleted; 21 | 22 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 23 | private Date createTime; 24 | 25 | private Integer createUser; 26 | 27 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 28 | private Date updateTime; 29 | 30 | private Integer updateUser; 31 | } 32 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/IndexConfig.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | public class IndexConfig { 10 | private Long configId; 11 | 12 | private String configName; 13 | 14 | private Byte configType; 15 | 16 | private Long goodsId; 17 | 18 | private String redirectUrl; 19 | 20 | private Integer configRank; 21 | 22 | private Byte isDeleted; 23 | 24 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 25 | private Date createTime; 26 | 27 | private Integer createUser; 28 | 29 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 30 | private Date updateTime; 31 | 32 | private Integer updateUser; 33 | } 34 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/param/SaveMallUserAddressParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 添加收货地址param 9 | */ 10 | @Data 11 | public class SaveMallUserAddressParam { 12 | 13 | @ApiModelProperty("收件人名称") 14 | private String userName; 15 | 16 | @ApiModelProperty("收件人联系方式") 17 | private String userPhone; 18 | 19 | @ApiModelProperty("是否默认地址 0-不是 1-是") 20 | private Byte defaultFlag; 21 | 22 | @ApiModelProperty("省") 23 | private String provinceName; 24 | 25 | @ApiModelProperty("市") 26 | private String cityName; 27 | 28 | @ApiModelProperty("区/县") 29 | private String regionName; 30 | 31 | @ApiModelProperty("详细地址") 32 | private String detailAddress; 33 | } 34 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/NewBeeMallOrder.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | public class NewBeeMallOrder { 10 | private Long orderId; 11 | 12 | private String orderNo; 13 | 14 | private Long userId; 15 | 16 | private Integer totalPrice; 17 | 18 | private Byte payStatus; 19 | 20 | private Byte payType; 21 | 22 | private Date payTime; 23 | 24 | private Byte orderStatus; 25 | 26 | private String extraInfo; 27 | 28 | private Byte isDeleted; 29 | 30 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 31 | private Date createTime; 32 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 33 | private Date updateTime; 34 | } 35 | -------------------------------------------------------------------------------- /my-mall-front/src/common/style/base.less: -------------------------------------------------------------------------------- 1 | // *{ 2 | // margin: 0; 3 | // padding: 0; 4 | // } 5 | //移动端点击高亮 6 | html, 7 | body { 8 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 9 | } 10 | input { 11 | border: none; 12 | outline: none; 13 | -webkit-appearance: none; 14 | -webkit-appearance: none; 15 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 16 | } 17 | textarea { 18 | border: none; 19 | outline: none; 20 | } 21 | button { 22 | border: none; 23 | outline: none; 24 | } 25 | a { 26 | text-decoration: none; 27 | color: #333; 28 | } 29 | li { 30 | list-style-type: none; 31 | } 32 | //解决端遮罩层穿透 33 | body.dialog-open { 34 | position: fixed; 35 | width: 100%; 36 | } 37 | .page { 38 | padding: 0 50px; 39 | width: 100%; 40 | -webkit-box-sizing: border-box; 41 | -moz-box-sizing: border-box; 42 | box-sizing: border-box; 43 | } 44 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/CarouselMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.Carousel; 5 | import com.my.mall.util.PageQueryUtil; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface CarouselMapper { 11 | int deleteByPrimaryKey(Integer carouselId); 12 | 13 | int insert(Carousel record); 14 | 15 | int insertSelective(Carousel record); 16 | 17 | Carousel selectByPrimaryKey(Integer carouselId); 18 | 19 | int updateByPrimaryKeySelective(Carousel record); 20 | 21 | int updateByPrimaryKey(Carousel record); 22 | 23 | List findCarouselList(PageQueryUtil pageUtil); 24 | 25 | int getTotalCarousels(PageQueryUtil pageUtil); 26 | 27 | int deleteBatch(Long[] ids); 28 | 29 | List findCarouselsByNum(@Param("number") int number); 30 | } 31 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/CarouselAddParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Max; 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotEmpty; 10 | import javax.validation.constraints.NotNull; 11 | 12 | @Data 13 | public class CarouselAddParam { 14 | 15 | @ApiModelProperty("轮播图URL地址") 16 | @NotEmpty(message = "轮播图URL不能为空") 17 | private String carouselUrl; 18 | 19 | @ApiModelProperty("轮播图跳转地址") 20 | @NotEmpty(message = "轮播图跳转地址不能为空") 21 | private String redirectUrl; 22 | 23 | @ApiModelProperty("排序值") 24 | @Min(value = 1, message = "carouselRank最低为1") 25 | @Max(value = 200, message = "carouselRank最高为200") 26 | @NotNull(message = "carouselRank不能为空") 27 | private Integer carouselRank; 28 | } 29 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/NewBeeMallCarouselService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service; 3 | 4 | import com.my.mall.api.mall.vo.IndexCarouselVO; 5 | import com.my.mall.entity.Carousel; 6 | import com.my.mall.util.PageQueryUtil; 7 | import com.my.mall.util.PageResult; 8 | 9 | import java.util.List; 10 | 11 | public interface NewBeeMallCarouselService { 12 | 13 | /** 14 | * 返回固定数量的轮播图对象(首页调用) 15 | * 16 | * @param number 17 | * @return 18 | */ 19 | List getCarouselsForIndex(int number); 20 | 21 | /** 22 | * 后台分页 23 | * 24 | * @param pageUtil 25 | * @return 26 | */ 27 | PageResult getCarouselPage(PageQueryUtil pageUtil); 28 | 29 | String saveCarousel(Carousel carousel); 30 | 31 | String updateCarousel(Carousel carousel); 32 | 33 | Carousel getCarouselById(Integer id); 34 | 35 | Boolean deleteBatch(Long[] ids); 36 | } 37 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/UserAddressVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 收货地址VO 9 | */ 10 | @Data 11 | public class UserAddressVO { 12 | 13 | @ApiModelProperty("地址id") 14 | private Long addressId; 15 | 16 | @ApiModelProperty("用户id") 17 | private Long userId; 18 | 19 | @ApiModelProperty("收件人名称") 20 | private String userName; 21 | 22 | @ApiModelProperty("收件人联系方式") 23 | private String userPhone; 24 | 25 | @ApiModelProperty("是否默认地址 0-不是 1-是") 26 | private Byte defaultFlag; 27 | 28 | @ApiModelProperty("省") 29 | private String provinceName; 30 | 31 | @ApiModelProperty("市") 32 | private String cityName; 33 | 34 | @ApiModelProperty("区/县") 35 | private String regionName; 36 | 37 | @ApiModelProperty("详细地址") 38 | private String detailAddress; 39 | } 40 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/param/UpdateMallUserAddressParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 修改收货地址param 9 | */ 10 | @Data 11 | public class UpdateMallUserAddressParam { 12 | 13 | @ApiModelProperty("地址id") 14 | private Long addressId; 15 | 16 | @ApiModelProperty("用户id") 17 | private Long userId; 18 | 19 | @ApiModelProperty("收件人名称") 20 | private String userName; 21 | 22 | @ApiModelProperty("收件人联系方式") 23 | private String userPhone; 24 | 25 | @ApiModelProperty("是否默认地址 0-不是 1-是") 26 | private Byte defaultFlag; 27 | 28 | @ApiModelProperty("省") 29 | private String provinceName; 30 | 31 | @ApiModelProperty("市") 32 | private String cityName; 33 | 34 | @ApiModelProperty("区/县") 35 | private String regionName; 36 | 37 | @ApiModelProperty("详细地址") 38 | private String detailAddress; 39 | } 40 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/NewBeeMallIndexConfigService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service; 3 | 4 | import com.my.mall.api.mall.vo.IndexConfigGoodsVO; 5 | import com.my.mall.entity.IndexConfig; 6 | import com.my.mall.util.PageQueryUtil; 7 | import com.my.mall.util.PageResult; 8 | 9 | import java.util.List; 10 | 11 | public interface NewBeeMallIndexConfigService { 12 | 13 | /** 14 | * 返回固定数量的首页配置商品对象(首页调用) 15 | * 16 | * @param number 17 | * @return 18 | */ 19 | List getConfigGoodsesForIndex(int configType, int number); 20 | 21 | /** 22 | * 后台分页 23 | * 24 | * @param pageUtil 25 | * @return 26 | */ 27 | PageResult getConfigsPage(PageQueryUtil pageUtil); 28 | 29 | String saveIndexConfig(IndexConfig indexConfig); 30 | 31 | String updateIndexConfig(IndexConfig indexConfig); 32 | 33 | IndexConfig getIndexConfigById(Long id); 34 | 35 | Boolean deleteBatch(Long[] ids); 36 | } 37 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/MallUserMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.MallUser; 5 | import com.my.mall.util.PageQueryUtil; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface MallUserMapper { 11 | int deleteByPrimaryKey(Long userId); 12 | 13 | int insert(MallUser record); 14 | 15 | int insertSelective(MallUser record); 16 | 17 | MallUser selectByPrimaryKey(Long userId); 18 | 19 | MallUser selectByLoginName(String loginName); 20 | 21 | MallUser selectByLoginNameAndPasswd(@Param("loginName") String loginName, @Param("password") String password); 22 | 23 | int updateByPrimaryKeySelective(MallUser record); 24 | 25 | int updateByPrimaryKey(MallUser record); 26 | 27 | List findMallUserList(PageQueryUtil pageUtil); 28 | 29 | int getTotalMallUsers(PageQueryUtil pageUtil); 30 | 31 | int lockUserBatch(@Param("ids") Long[] ids, @Param("lockStatus") int lockStatus); 32 | } 33 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/GoodsDetailVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 商品详情页VO 11 | */ 12 | @Data 13 | public class GoodsDetailVO implements Serializable { 14 | 15 | @ApiModelProperty("商品id") 16 | private Long goodsId; 17 | 18 | @ApiModelProperty("商品名称") 19 | private String goodsName; 20 | 21 | @ApiModelProperty("商品简介") 22 | private String goodsIntro; 23 | 24 | @ApiModelProperty("商品图片地址") 25 | private String goodsCoverImg; 26 | 27 | @ApiModelProperty("商品价格") 28 | private Integer sellingPrice; 29 | 30 | @ApiModelProperty("商品标签") 31 | private String tag; 32 | 33 | @ApiModelProperty("商品图片") 34 | private String[] goodsCarouselList; 35 | 36 | @ApiModelProperty("商品原价") 37 | private Integer originalPrice; 38 | 39 | @ApiModelProperty("商品详情字段") 40 | private String goodsDetailContent; 41 | } 42 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/util/SystemUtil.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.util; 2 | 3 | import java.math.BigInteger; 4 | import java.security.MessageDigest; 5 | 6 | 7 | public class SystemUtil { 8 | 9 | private SystemUtil() { 10 | } 11 | 12 | 13 | /** 14 | * 登录或注册成功后,生成保持用户登录状态会话token值 15 | * 16 | * @param src:为用户最新一次登录时的now()+user.id+random(4) 17 | * @return 18 | */ 19 | public static String genToken(String src) { 20 | if (null == src || "".equals(src)) { 21 | return null; 22 | } 23 | try { 24 | MessageDigest md = MessageDigest.getInstance("MD5"); 25 | md.update(src.getBytes()); 26 | String result = new BigInteger(1, md.digest()).toString(16); 27 | if (result.length() == 31) { 28 | result = result + "-"; 29 | } 30 | System.out.println(result); 31 | return result; 32 | } catch (Exception e) { 33 | return null; 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/CarouselEditParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Max; 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotEmpty; 10 | import javax.validation.constraints.NotNull; 11 | 12 | @Data 13 | public class CarouselEditParam { 14 | 15 | @ApiModelProperty("待修改轮播图id") 16 | @NotNull(message = "轮播图id不能为空") 17 | @Min(1) 18 | private Integer carouselId; 19 | 20 | @ApiModelProperty("轮播图URL地址") 21 | @NotEmpty(message = "轮播图URL不能为空") 22 | private String carouselUrl; 23 | 24 | @ApiModelProperty("轮播图跳转地址") 25 | @NotEmpty(message = "轮播图跳转地址不能为空") 26 | private String redirectUrl; 27 | 28 | @ApiModelProperty("排序值") 29 | @Min(value = 1, message = "carouselRank最低为1") 30 | @Max(value = 200, message = "carouselRank最高为200") 31 | @NotNull(message = "carouselRank不能为空") 32 | private Integer carouselRank; 33 | } 34 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/entity/NewBeeMallGoods.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | public class NewBeeMallGoods { 10 | private Long goodsId; 11 | 12 | private String goodsName; 13 | 14 | private String goodsIntro; 15 | 16 | private Long goodsCategoryId; 17 | 18 | private String goodsCoverImg; 19 | 20 | private String goodsCarousel; 21 | 22 | private Integer originalPrice; 23 | 24 | private Integer sellingPrice; 25 | 26 | private Integer stockNum; 27 | 28 | private String tag; 29 | 30 | private Byte goodsSellStatus; 31 | 32 | private Integer createUser; 33 | 34 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 35 | private Date createTime; 36 | 37 | private Integer updateUser; 38 | 39 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 40 | private Date updateTime; 41 | 42 | private String goodsDetailContent; 43 | } 44 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/IndexConfigMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.IndexConfig; 5 | import com.my.mall.util.PageQueryUtil; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface IndexConfigMapper { 11 | int deleteByPrimaryKey(Long configId); 12 | 13 | int insert(IndexConfig record); 14 | 15 | int insertSelective(IndexConfig record); 16 | 17 | IndexConfig selectByPrimaryKey(Long configId); 18 | 19 | IndexConfig selectByTypeAndGoodsId(@Param("configType") int configType, @Param("goodsId") Long goodsId); 20 | 21 | int updateByPrimaryKeySelective(IndexConfig record); 22 | 23 | int updateByPrimaryKey(IndexConfig record); 24 | 25 | List findIndexConfigList(PageQueryUtil pageUtil); 26 | 27 | int getTotalIndexConfigs(PageQueryUtil pageUtil); 28 | 29 | int deleteBatch(Long[] ids); 30 | 31 | List findIndexConfigsByTypeAndNum(@Param("configType") int configType, @Param("number") int number); 32 | } 33 | -------------------------------------------------------------------------------- /my-mall-admin/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | import vitePluginImport from 'vite-plugin-babel-import'; 4 | import path from 'path' 5 | 6 | const baseUrl = { 7 | development: './', 8 | beta: './', 9 | release: './' 10 | } 11 | 12 | // https://vitejs.dev/config/ 13 | export default ({ mode }) => defineConfig({ 14 | plugins: [ 15 | vue(), 16 | vitePluginImport([ 17 | { 18 | libraryName: 'element-plus', 19 | libraryDirectory: 'es', 20 | style(name) { 21 | return `element-plus/lib/theme-chalk/${name}.css`; 22 | }, 23 | } 24 | ]) 25 | ], 26 | base: baseUrl[mode], 27 | resolve: { 28 | alias: { 29 | '~': path.resolve(__dirname, './'), 30 | '@': path.resolve(__dirname, 'src') 31 | } 32 | }, 33 | server: { 34 | proxy: { 35 | '/api': { 36 | target: 'http://localhost:8008/manage-api/v1', 37 | changeOrigin: true, 38 | rewrite: path => path.replace(/^\/api/, '') 39 | } 40 | } 41 | } 42 | }) 43 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/OrderListVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | import java.util.List; 11 | 12 | /** 13 | * 订单列表页面VO 14 | */ 15 | @Data 16 | public class OrderListVO implements Serializable { 17 | 18 | private Long orderId; 19 | 20 | @ApiModelProperty("订单号") 21 | private String orderNo; 22 | 23 | @ApiModelProperty("订单价格") 24 | private Integer totalPrice; 25 | 26 | @ApiModelProperty("订单支付方式") 27 | private Byte payType; 28 | 29 | @ApiModelProperty("订单状态码") 30 | private Byte orderStatus; 31 | 32 | @ApiModelProperty("订单状态") 33 | private String orderStatusString; 34 | 35 | @ApiModelProperty("创建时间") 36 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 37 | private Date createTime; 38 | 39 | @ApiModelProperty("订单项列表") 40 | private List newBeeMallOrderItemVOS; 41 | } 42 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/common/PayTypeEnum.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.common; 3 | 4 | 5 | public enum PayTypeEnum { 6 | 7 | DEFAULT(-1, "ERROR"), 8 | NOT_PAY(0, "无"), 9 | ALI_PAY(1, "支付宝"), 10 | WEIXIN_PAY(2, "微信支付"); 11 | 12 | private int payType; 13 | 14 | private String name; 15 | 16 | PayTypeEnum(int payType, String name) { 17 | this.payType = payType; 18 | this.name = name; 19 | } 20 | 21 | public static PayTypeEnum getPayTypeEnumByType(int payType) { 22 | for (PayTypeEnum payTypeEnum : PayTypeEnum.values()) { 23 | if (payTypeEnum.getPayType() == payType) { 24 | return payTypeEnum; 25 | } 26 | } 27 | return DEFAULT; 28 | } 29 | 30 | public int getPayType() { 31 | return payType; 32 | } 33 | 34 | public void setPayType(int payType) { 35 | this.payType = payType; 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/common/PayStatusEnum.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.common; 3 | 4 | 5 | public enum PayStatusEnum { 6 | 7 | DEFAULT(-1, "支付失败"), 8 | PAY_ING(0, "支付中"), 9 | PAY_SUCCESS(1, "支付成功"); 10 | 11 | private int payStatus; 12 | 13 | private String name; 14 | 15 | PayStatusEnum(int payStatus, String name) { 16 | this.payStatus = payStatus; 17 | this.name = name; 18 | } 19 | 20 | public static PayStatusEnum getPayStatusEnumByStatus(int payStatus) { 21 | for (PayStatusEnum payStatusEnum : PayStatusEnum.values()) { 22 | if (payStatusEnum.getPayStatus() == payStatus) { 23 | return payStatusEnum; 24 | } 25 | } 26 | return DEFAULT; 27 | } 28 | 29 | public int getPayStatus() { 30 | return payStatus; 31 | } 32 | 33 | public void setPayStatus(int payStatus) { 34 | this.payStatus = payStatus; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/GoodsCategoryMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.GoodsCategory; 5 | import com.my.mall.util.PageQueryUtil; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface GoodsCategoryMapper { 11 | int deleteByPrimaryKey(Long categoryId); 12 | 13 | int insert(GoodsCategory record); 14 | 15 | int insertSelective(GoodsCategory record); 16 | 17 | GoodsCategory selectByPrimaryKey(Long categoryId); 18 | 19 | GoodsCategory selectByLevelAndName(@Param("categoryLevel") Byte categoryLevel, @Param("categoryName") String categoryName); 20 | 21 | int updateByPrimaryKeySelective(GoodsCategory record); 22 | 23 | int updateByPrimaryKey(GoodsCategory record); 24 | 25 | List findGoodsCategoryList(PageQueryUtil pageUtil); 26 | 27 | int getTotalGoodsCategories(PageQueryUtil pageUtil); 28 | 29 | int deleteBatch(Long[] ids); 30 | 31 | List selectByLevelAndParentIdsAndNumber(@Param("parentIds") List parentIds, @Param("categoryLevel") int categoryLevel, @Param("number") int number); 32 | } 33 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/IndexConfigAddParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Max; 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotEmpty; 10 | import javax.validation.constraints.NotNull; 11 | 12 | @Data 13 | public class IndexConfigAddParam { 14 | 15 | @ApiModelProperty("配置项名称") 16 | @NotEmpty(message = "configName不能为空") 17 | private String configName; 18 | 19 | @ApiModelProperty("配置类别") 20 | @NotNull(message = "configType不能为空") 21 | @Min(value = 1, message = "configType最小为1") 22 | @Max(value = 5, message = "configType最大为5") 23 | private Byte configType; 24 | 25 | @ApiModelProperty("商品id") 26 | @NotNull(message = "商品id不能为空") 27 | @Min(value = 1, message = "商品id不能为空") 28 | private Long goodsId; 29 | 30 | @ApiModelProperty("排序值") 31 | @Min(value = 1, message = "configRank最低为1") 32 | @Max(value = 200, message = "configRank最高为200") 33 | @NotNull(message = "configRank不能为空") 34 | private Integer configRank; 35 | } 36 | -------------------------------------------------------------------------------- /my-mall-admin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue3-admin", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite --mode development", 6 | "build:beta": "vite build --mode beta", 7 | "build:release": "vite build --mode release", 8 | "serve": "vite preview" 9 | }, 10 | "dependencies": { 11 | "@sentry/browser": "^6.3.1", 12 | "@sentry/tracing": "^6.3.1", 13 | "axios": "^0.21.1", 14 | "element-plus": "^1.0.2-beta.33", 15 | "js-md5": "^0.7.3", 16 | "pushstate-server": "^3.1.0", 17 | "qs": "^6.9.6", 18 | "vue": "^3.0.5", 19 | "vue-router": "^4.0.4", 20 | "wangeditor": "^4.6.10" 21 | }, 22 | "devDependencies": { 23 | "@babel/core": "^7.13.8", 24 | "@babel/runtime": "^7.13.8", 25 | "@rollup/plugin-babel": "^5.3.0", 26 | "@vitejs/plugin-vue": "^1.1.4", 27 | "@vue/compiler-sfc": "^3.0.5", 28 | "babel": "^6.23.0", 29 | "babel-plugin-component": "^1.1.1", 30 | "babel-plugin-import": "^1.13.3", 31 | "element-theme-chalk": "^2.15.1", 32 | "vite": "^2.0.1", 33 | "vite-babel-plugin": "^0.0.2", 34 | "vite-plugin-babel-import": "^2.0.2", 35 | "vite-plugin-imp": "^2.0.4" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /my-mall-admin/src/utils/axios.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import { ElMessage } from 'element-plus' 3 | import router from '@/router/index' 4 | import { localGet } from './index' 5 | import config from '~/config' 6 | 7 | 8 | // 这边由于后端没有区分测试和正式,姑且都写成一个接口。 9 | axios.defaults.baseURL = config[import.meta.env.MODE].baseUrl 10 | // 携带 cookie,对目前的项目没有什么作用,因为我们是 token 鉴权 11 | axios.defaults.withCredentials = true 12 | // 请求头,headers 信息 13 | axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest' 14 | axios.defaults.headers['token'] = localGet('token') || '' 15 | // 默认 post 请求,使用 application/json 形式 16 | axios.defaults.headers.post['Content-Type'] = 'application/json' 17 | 18 | // 请求拦截器,内部根据返回值,重新组装,统一管理。 19 | axios.interceptors.response.use(res => { 20 | if (typeof res.data !== 'object') { 21 | ElMessage.error('服务端异常!') 22 | return Promise.reject(res) 23 | } 24 | if (res.data.resultCode != 200) { 25 | if (res.data.message) ElMessage.info(res.data.message) 26 | if (res.data.resultCode == 419) { 27 | router.push({ path: '/login' }) 28 | } 29 | return Promise.reject(res.data) 30 | } 31 | 32 | return res.data.data 33 | }) 34 | 35 | export default axios -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/NewBeeMallCategoryService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service; 3 | 4 | import com.my.mall.api.mall.vo.IndexCategoryVO; 5 | import com.my.mall.entity.GoodsCategory; 6 | import com.my.mall.util.PageQueryUtil; 7 | import com.my.mall.util.PageResult; 8 | 9 | import java.util.List; 10 | 11 | public interface NewBeeMallCategoryService { 12 | 13 | String saveCategory(GoodsCategory goodsCategory); 14 | 15 | String updateGoodsCategory(GoodsCategory goodsCategory); 16 | 17 | GoodsCategory getGoodsCategoryById(Long id); 18 | 19 | Boolean deleteBatch(Long[] ids); 20 | 21 | /** 22 | * 返回分类数据(首页调用) 23 | * 24 | * @return 25 | */ 26 | List getCategoriesForIndex(); 27 | 28 | /** 29 | * 后台分页 30 | * 31 | * @param pageUtil 32 | * @return 33 | */ 34 | PageResult getCategorisPage(PageQueryUtil pageUtil); 35 | 36 | /** 37 | * 根据parentId和level获取分类列表 38 | * 39 | * @param parentIds 40 | * @param categoryLevel 41 | * @return 42 | */ 43 | List selectByLevelAndParentIdsAndNumber(List parentIds, int categoryLevel); 44 | } 45 | -------------------------------------------------------------------------------- /my-mall-front/src/utils/axios.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import { Toast } from 'vant' 3 | import { setLocal } from '@/common/js/utils' 4 | import router from '../router' 5 | 6 | axios.defaults.baseURL = process.env.NODE_ENV == 'development' ? '//localhost:8008/api/v1' : '//backend-api-01.newbee.ltd/api/v1' 7 | axios.defaults.withCredentials = true 8 | axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest' 9 | axios.defaults.headers['token'] = localStorage.getItem('token') || '' 10 | axios.defaults.headers.post['Content-Type'] = 'application/json' 11 | 12 | axios.interceptors.response.use(res => { 13 | if (typeof res.data !== 'object') { 14 | Toast.fail('服务端异常!') 15 | return Promise.reject(res) 16 | } 17 | if (res.data.resultCode != 200) { 18 | if (res.data.message) Toast.fail(res.data.message) 19 | if (res.data.resultCode == 416) { 20 | router.push({ path: '/login' }) 21 | } 22 | if (res.data.data && window.location.hash == '#/login') { 23 | setLocal('token', res.data.data) 24 | axios.defaults.headers['token'] = res.data.data 25 | } 26 | return Promise.reject(res.data) 27 | } 28 | 29 | return res.data 30 | }) 31 | 32 | export default axios 33 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/NewBeeMallOrderMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.NewBeeMallOrder; 5 | import com.my.mall.util.PageQueryUtil; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface NewBeeMallOrderMapper { 11 | int deleteByPrimaryKey(Long orderId); 12 | 13 | int insert(NewBeeMallOrder record); 14 | 15 | int insertSelective(NewBeeMallOrder record); 16 | 17 | NewBeeMallOrder selectByPrimaryKey(Long orderId); 18 | 19 | NewBeeMallOrder selectByOrderNo(String orderNo); 20 | 21 | int updateByPrimaryKeySelective(NewBeeMallOrder record); 22 | 23 | int updateByPrimaryKey(NewBeeMallOrder record); 24 | 25 | List findNewBeeMallOrderList(PageQueryUtil pageUtil); 26 | 27 | int getTotalNewBeeMallOrders(PageQueryUtil pageUtil); 28 | 29 | List selectByPrimaryKeys(@Param("orderIds") List orderIds); 30 | 31 | int checkOut(@Param("orderIds") List orderIds); 32 | 33 | int closeOrder(@Param("orderIds") List orderIds, @Param("orderStatus") int orderStatus); 34 | 35 | int checkDone(@Param("orderIds") List asList); 36 | } 37 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/AdminUserService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service; 3 | 4 | import com.my.mall.entity.AdminUser; 5 | 6 | public interface AdminUserService { 7 | 8 | /** 9 | * 登录 10 | * @param userName 11 | * @param password 12 | * @return 13 | */ 14 | String login(String userName, String password); 15 | 16 | /** 17 | * 获取用户信息 18 | * 19 | * @param loginUserId 20 | * @return 21 | */ 22 | AdminUser getUserDetailById(Long loginUserId); 23 | 24 | /** 25 | * 修改当前登录用户的密码 26 | * 27 | * @param loginUserId 28 | * @param originalPassword 29 | * @param newPassword 30 | * @return 31 | */ 32 | Boolean updatePassword(Long loginUserId, String originalPassword, String newPassword); 33 | 34 | /** 35 | * 修改当前登录用户的名称信息 36 | * 37 | * @param loginUserId 38 | * @param loginUserName 39 | * @param nickName 40 | * @return 41 | */ 42 | Boolean updateName(Long loginUserId, String loginUserName, String nickName); 43 | 44 | /** 45 | * 登出接口 46 | * @param adminUserId 47 | * @return 48 | */ 49 | Boolean logout(Long adminUserId); 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/common/NewBeeMallCategoryLevelEnum.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.common; 3 | 4 | 5 | public enum NewBeeMallCategoryLevelEnum { 6 | 7 | DEFAULT(0, "ERROR"), 8 | LEVEL_ONE(1, "一级分类"), 9 | LEVEL_TWO(2, "二级分类"), 10 | LEVEL_THREE(3, "三级分类"); 11 | 12 | private int level; 13 | 14 | private String name; 15 | 16 | NewBeeMallCategoryLevelEnum(int level, String name) { 17 | this.level = level; 18 | this.name = name; 19 | } 20 | 21 | public static NewBeeMallCategoryLevelEnum getNewBeeMallOrderStatusEnumByLevel(int level) { 22 | for (NewBeeMallCategoryLevelEnum newBeeMallCategoryLevelEnum : NewBeeMallCategoryLevelEnum.values()) { 23 | if (newBeeMallCategoryLevelEnum.getLevel() == level) { 24 | return newBeeMallCategoryLevelEnum; 25 | } 26 | } 27 | return DEFAULT; 28 | } 29 | 30 | public int getLevel() { 31 | return level; 32 | } 33 | 34 | public void setLevel(int level) { 35 | this.level = level; 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/NewBeeMallOrderItemMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.NewBeeMallOrderItem; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface NewBeeMallOrderItemMapper { 10 | int deleteByPrimaryKey(Long orderItemId); 11 | 12 | int insert(NewBeeMallOrderItem record); 13 | 14 | int insertSelective(NewBeeMallOrderItem record); 15 | 16 | NewBeeMallOrderItem selectByPrimaryKey(Long orderItemId); 17 | 18 | /** 19 | * 根据订单id获取订单项列表 20 | * 21 | * @param orderId 22 | * @return 23 | */ 24 | List selectByOrderId(Long orderId); 25 | 26 | /** 27 | * 根据订单ids获取订单项列表 28 | * 29 | * @param orderIds 30 | * @return 31 | */ 32 | List selectByOrderIds(@Param("orderIds") List orderIds); 33 | 34 | /** 35 | * 批量insert订单项数据 36 | * 37 | * @param orderItems 38 | * @return 39 | */ 40 | int insertBatch(@Param("orderItems") List orderItems); 41 | 42 | int updateByPrimaryKeySelective(NewBeeMallOrderItem record); 43 | 44 | int updateByPrimaryKey(NewBeeMallOrderItem record); 45 | } 46 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/util/PageQueryUtil.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.util; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Map; 5 | 6 | 7 | public class PageQueryUtil extends LinkedHashMap { 8 | //当前页码 9 | private int page; 10 | //每页条数 11 | private int limit; 12 | 13 | public PageQueryUtil(Map params) { 14 | this.putAll(params); 15 | 16 | //分页参数 17 | this.page = Integer.parseInt(params.get("page").toString()); 18 | this.limit = Integer.parseInt(params.get("limit").toString()); 19 | this.put("start", (page - 1) * limit); 20 | this.put("page", page); 21 | this.put("limit", limit); 22 | } 23 | 24 | 25 | public int getPage() { 26 | return page; 27 | } 28 | 29 | public void setPage(int page) { 30 | this.page = page; 31 | } 32 | 33 | public int getLimit() { 34 | return limit; 35 | } 36 | 37 | public void setLimit(int limit) { 38 | this.limit = limit; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "PageUtil{" + 44 | "page=" + page + 45 | ", limit=" + limit + 46 | '}'; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/GoodsCategoryAddParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import org.hibernate.validator.constraints.Length; 7 | 8 | import javax.validation.constraints.Max; 9 | import javax.validation.constraints.Min; 10 | import javax.validation.constraints.NotEmpty; 11 | import javax.validation.constraints.NotNull; 12 | 13 | @Data 14 | public class GoodsCategoryAddParam { 15 | 16 | @ApiModelProperty("分类层级") 17 | @NotNull(message = "categoryLevel不能为空") 18 | @Min(value = 1, message = "分类级别最低为1") 19 | @Max(value = 3, message = "分类级别最高为3") 20 | private Byte categoryLevel; 21 | 22 | @ApiModelProperty("父类id") 23 | @NotNull(message = "parentId不能为空") 24 | @Min(value = 0, message = "parentId最低为0") 25 | private Long parentId; 26 | 27 | @ApiModelProperty("分类名称") 28 | @NotEmpty(message = "categoryName不能为空") 29 | @Length(max = 16,message = "分类名称过长") 30 | private String categoryName; 31 | 32 | @ApiModelProperty("排序值") 33 | @Min(value = 1, message = "categoryRank最低为1") 34 | @Max(value = 200, message = "categoryRank最高为200") 35 | @NotNull(message = "categoryRank不能为空") 36 | private Integer categoryRank; 37 | } 38 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/common/IndexConfigTypeEnum.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.common; 3 | 4 | public enum IndexConfigTypeEnum { 5 | 6 | DEFAULT(0, "DEFAULT"), 7 | INDEX_SEARCH_HOTS(1, "INDEX_SEARCH_HOTS"), 8 | INDEX_SEARCH_DOWN_HOTS(2, "INDEX_SEARCH_DOWN_HOTS"), 9 | INDEX_GOODS_HOT(3, "INDEX_GOODS_HOTS"), 10 | INDEX_GOODS_NEW(4, "INDEX_GOODS_NEW"), 11 | INDEX_GOODS_RECOMMOND(5, "INDEX_GOODS_RECOMMOND"); 12 | 13 | private int type; 14 | 15 | private String name; 16 | 17 | IndexConfigTypeEnum(int type, String name) { 18 | this.type = type; 19 | this.name = name; 20 | } 21 | 22 | public static IndexConfigTypeEnum getIndexConfigTypeEnumByType(int type) { 23 | for (IndexConfigTypeEnum indexConfigTypeEnum : IndexConfigTypeEnum.values()) { 24 | if (indexConfigTypeEnum.getType() == type) { 25 | return indexConfigTypeEnum; 26 | } 27 | } 28 | return DEFAULT; 29 | } 30 | 31 | public int getType() { 32 | return type; 33 | } 34 | 35 | public void setType(int type) { 36 | this.type = type; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/NewBeeMallUserAddressService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service; 3 | 4 | import com.my.mall.api.mall.vo.UserAddressVO; 5 | import com.my.mall.entity.MallUserAddress; 6 | 7 | import java.util.List; 8 | 9 | public interface NewBeeMallUserAddressService { 10 | 11 | /** 12 | * 获取我的收货地址 13 | * 14 | * @param userId 15 | * @return 16 | */ 17 | List getMyAddresses(Long userId); 18 | 19 | /** 20 | * 保存收货地址 21 | * 22 | * @param mallUserAddress 23 | * @return 24 | */ 25 | Boolean saveUserAddress(MallUserAddress mallUserAddress); 26 | 27 | /** 28 | * 修改收货地址 29 | * 30 | * @param mallUserAddress 31 | * @return 32 | */ 33 | Boolean updateMallUserAddress(MallUserAddress mallUserAddress); 34 | 35 | /** 36 | * 获取收货地址详情 37 | * 38 | * @param addressId 39 | * @return 40 | */ 41 | MallUserAddress getMallUserAddressById(Long addressId); 42 | 43 | /** 44 | * 获取我的默认收货地址 45 | * 46 | * @param userId 47 | * @return 48 | */ 49 | MallUserAddress getMyDefaultAddressByUserId(Long userId); 50 | 51 | /** 52 | * 删除收货地址 53 | * 54 | * @param addressId 55 | * @return 56 | */ 57 | Boolean deleteById(Long addressId); 58 | } 59 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/IndexConfigEditParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Max; 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotEmpty; 10 | import javax.validation.constraints.NotNull; 11 | 12 | @Data 13 | public class IndexConfigEditParam { 14 | 15 | @ApiModelProperty("待修改配置id") 16 | @NotNull(message = "configId不能为空") 17 | @Min(value = 1, message = "configId不能为空") 18 | private Long configId; 19 | 20 | @ApiModelProperty("配置的名称") 21 | @NotEmpty(message = "configName不能为空") 22 | private String configName; 23 | 24 | @ApiModelProperty("配置类别") 25 | @NotNull(message = "configType不能为空") 26 | @Min(value = 1, message = "configType最小为1") 27 | @Max(value = 5, message = "configType最大为5") 28 | private Byte configType; 29 | 30 | @ApiModelProperty("商品id") 31 | @NotNull(message = "商品id不能为空") 32 | @Min(value = 1, message = "商品id不能为空") 33 | private Long goodsId; 34 | 35 | @ApiModelProperty("排序值") 36 | @Min(value = 1, message = "configRank最低为1") 37 | @Max(value = 200, message = "configRank最高为200") 38 | @NotNull(message = "configRank不能为空") 39 | private Integer configRank; 40 | } 41 | -------------------------------------------------------------------------------- /my-mall-admin/src/utils/index.js: -------------------------------------------------------------------------------- 1 | export function localGet (key) { 2 | const value = window.localStorage.getItem(key) 3 | try { 4 | return JSON.parse(window.localStorage.getItem(key)) 5 | } catch (error) { 6 | return value 7 | } 8 | } 9 | 10 | export function localSet (key, value) { 11 | window.localStorage.setItem(key, JSON.stringify(value)) 12 | } 13 | 14 | export function localRemove (key) { 15 | window.localStorage.removeItem(key) 16 | } 17 | 18 | // 判断内容是否含有表情字符,现有数据库不支持。 19 | export function hasEmoji (str = '') { 20 | const reg = /[^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n]/g; 21 | return str.match(reg) && str.match(reg).length 22 | } 23 | 24 | // 单张图片上传 25 | export const uploadImgServer = 'http://localhost:8008/manage-api/v1/upload/file' 26 | // 多张图片上传 27 | export const uploadImgsServer = 'http://localhost:8008/manage-api/v1/upload/files' 28 | 29 | export const pathMap = { 30 | login: '登录', 31 | introduce: '系统介绍', 32 | dashboard: '大盘数据', 33 | add: '添加商品', 34 | swiper: '轮播图配置', 35 | hot: '热销商品配置', 36 | new: '新品上线配置', 37 | recommend: '为你推荐配置', 38 | category: '分类管理', 39 | level2: '分类二级管理', 40 | level3: '分类三级管理', 41 | good: '商品管理', 42 | guest: '会员管理', 43 | order: '订单管理', 44 | order_detail: '订单详情', 45 | account: '修改账户' 46 | } -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/OrderDetailVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | import java.util.List; 11 | 12 | /** 13 | * 订单详情页页面VO 14 | */ 15 | @Data 16 | public class OrderDetailVO implements Serializable { 17 | 18 | @ApiModelProperty("订单号") 19 | private String orderNo; 20 | 21 | @ApiModelProperty("订单价格") 22 | private Integer totalPrice; 23 | 24 | @ApiModelProperty("订单支付状态码") 25 | private Byte payStatus; 26 | 27 | @ApiModelProperty("订单支付方式") 28 | private Byte payType; 29 | 30 | @ApiModelProperty("订单支付方式") 31 | private String payTypeString; 32 | 33 | @ApiModelProperty("订单支付时间") 34 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 35 | private Date payTime; 36 | 37 | @ApiModelProperty("订单状态码") 38 | private Byte orderStatus; 39 | 40 | @ApiModelProperty("订单状态") 41 | private String orderStatusString; 42 | 43 | @ApiModelProperty("创建时间") 44 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 45 | private Date createTime; 46 | 47 | @ApiModelProperty("订单项列表") 48 | private List newBeeMallOrderItemVOS; 49 | } 50 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/NewBeeMallUserService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service; 3 | 4 | import com.my.mall.api.mall.param.MallUserUpdateParam; 5 | import com.my.mall.util.PageQueryUtil; 6 | import com.my.mall.util.PageResult; 7 | 8 | public interface NewBeeMallUserService { 9 | 10 | /** 11 | * 用户注册 12 | * 13 | * @param loginName 14 | * @param password 15 | * @return 16 | */ 17 | String register(String loginName, String password); 18 | 19 | 20 | /** 21 | * 登录 22 | * 23 | * @param loginName 24 | * @param passwordMD5 25 | * @return 26 | */ 27 | String login(String loginName, String passwordMD5); 28 | 29 | /** 30 | * 用户信息修改 31 | * 32 | * @param mallUser 33 | * @return 34 | */ 35 | Boolean updateUserInfo(MallUserUpdateParam mallUser, Long userId); 36 | 37 | /** 38 | * 登出接口 39 | * @param userId 40 | * @return 41 | */ 42 | Boolean logout(Long userId); 43 | 44 | /** 45 | * 用户禁用与解除禁用(0-未锁定 1-已锁定) 46 | * 47 | * @param ids 48 | * @param lockStatus 49 | * @return 50 | */ 51 | Boolean lockUsers(Long[] ids, int lockStatus); 52 | 53 | /** 54 | * 后台分页 55 | * 56 | * @param pageUtil 57 | * @return 58 | */ 59 | PageResult getNewBeeMallUsersPage(PageQueryUtil pageUtil); 60 | } 61 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/common/Constants.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.common; 3 | 4 | 5 | public class Constants { 6 | //public final static String FILE_UPLOAD_DIC = "/opt/newbee/upload/";//上传文件的默认url前缀,根据部署设置自行修改 7 | public final static String FILE_UPLOAD_DIC = "D:\\upload\\";//上传文件的默认url前缀,根据部署设置自行修改 8 | 9 | public final static int INDEX_CAROUSEL_NUMBER = 5;//首页轮播图数量(可根据自身需求修改) 10 | 11 | public final static int INDEX_CATEGORY_NUMBER = 10;//首页一级分类的最大数量 12 | 13 | public final static int INDEX_GOODS_HOT_NUMBER = 4;//首页热卖商品数量 14 | public final static int INDEX_GOODS_NEW_NUMBER = 5;//首页新品数量 15 | public final static int INDEX_GOODS_RECOMMOND_NUMBER = 10;//首页推荐商品数量 16 | 17 | public final static int SHOPPING_CART_ITEM_TOTAL_NUMBER = 20;//购物车中商品的最大数量(可根据自身需求修改) 18 | 19 | public final static int SHOPPING_CART_ITEM_LIMIT_NUMBER = 5;//购物车中单个商品的最大购买数量(可根据自身需求修改) 20 | 21 | public final static int GOODS_SEARCH_PAGE_LIMIT = 10;//搜索分页的默认条数(每页10条) 22 | 23 | public final static int SHOPPING_CART_PAGE_LIMIT = 5;//购物车分页的默认条数(每页5条) 24 | 25 | public final static int ORDER_SEARCH_PAGE_LIMIT = 5;//我的订单列表分页的默认条数(每页5条) 26 | 27 | public final static int SELL_STATUS_UP = 0;//商品上架状态 28 | public final static int SELL_STATUS_DOWN = 1;//商品下架状态 29 | 30 | public final static int TOKEN_LENGTH = 32;//token字段长度 31 | 32 | public final static String USER_INTRO = "华而不实,为所欲为";//默认简介 33 | } 34 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/util/NumberUtil.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.util; 2 | 3 | import java.util.regex.Matcher; 4 | import java.util.regex.Pattern; 5 | 6 | 7 | public class NumberUtil { 8 | 9 | private NumberUtil() { 10 | } 11 | 12 | 13 | /** 14 | * 判断是否为11位电话号码 15 | * 16 | * @param phone 17 | * @return 18 | */ 19 | public static boolean isPhone(String phone) { 20 | Pattern pattern = Pattern.compile("^((13[0-9])|(14[5,7])|(15[^4,\\D])|(17[0-8])|(18[0-9]))\\d{8}$"); 21 | Matcher matcher = pattern.matcher(phone); 22 | return matcher.matches(); 23 | } 24 | 25 | /** 26 | * 生成指定长度的随机数 27 | * 28 | * @param length 29 | * @return 30 | */ 31 | public static int genRandomNum(int length) { 32 | int num = 1; 33 | double random = Math.random(); 34 | if (random < 0.1) { 35 | random = random + 0.1; 36 | } 37 | for (int i = 0; i < length; i++) { 38 | num = num * 10; 39 | } 40 | return (int) ((random * num)); 41 | } 42 | 43 | /** 44 | * 生成订单流水号 45 | * 46 | * @return 47 | */ 48 | public static String genOrderNo() { 49 | StringBuffer buffer = new StringBuffer(String.valueOf(System.currentTimeMillis())); 50 | int num = genRandomNum(4); 51 | buffer.append(num); 52 | return buffer.toString(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/GoodsCategoryEditParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import org.hibernate.validator.constraints.Length; 7 | 8 | import javax.validation.constraints.Max; 9 | import javax.validation.constraints.Min; 10 | import javax.validation.constraints.NotEmpty; 11 | import javax.validation.constraints.NotNull; 12 | 13 | @Data 14 | public class GoodsCategoryEditParam { 15 | 16 | @ApiModelProperty("待修改分类id") 17 | @NotNull(message = "分类id不能为空") 18 | @Min(value = 1, message = "分类id不能为空") 19 | private Long categoryId; 20 | 21 | @ApiModelProperty("分类层级") 22 | @NotNull(message = "categoryLevel不能为空") 23 | @Min(value = 1, message = "分类级别最低为1") 24 | @Max(value = 3, message = "分类级别最高为3") 25 | private Byte categoryLevel; 26 | 27 | @ApiModelProperty("父类id") 28 | @NotNull(message = "parentId不能为空") 29 | @Min(value = 0, message = "parentId最低为0") 30 | private Long parentId; 31 | 32 | @ApiModelProperty("分类名称") 33 | @NotEmpty(message = "categoryName不能为空") 34 | @Length(max = 16,message = "分类名称过长") 35 | private String categoryName; 36 | 37 | @ApiModelProperty("排序值") 38 | @Min(value = 1, message = "categoryRank最低为1") 39 | @Max(value = 200, message = "categoryRank最高为200") 40 | @NotNull(message = "categoryRank不能为空") 41 | private Integer categoryRank; 42 | } 43 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/NewBeeMallShoppingCartItemMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.NewBeeMallShoppingCartItem; 5 | import com.my.mall.util.PageQueryUtil; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | public interface NewBeeMallShoppingCartItemMapper { 11 | int deleteByPrimaryKey(Long cartItemId); 12 | 13 | int insert(NewBeeMallShoppingCartItem record); 14 | 15 | int insertSelective(NewBeeMallShoppingCartItem record); 16 | 17 | NewBeeMallShoppingCartItem selectByPrimaryKey(Long cartItemId); 18 | 19 | NewBeeMallShoppingCartItem selectByUserIdAndGoodsId(@Param("newBeeMallUserId") Long newBeeMallUserId, @Param("goodsId") Long goodsId); 20 | 21 | List selectByUserId(@Param("newBeeMallUserId") Long newBeeMallUserId, @Param("number") int number); 22 | 23 | List selectByUserIdAndCartItemIds(@Param("newBeeMallUserId") Long newBeeMallUserId, @Param("cartItemIds") List cartItemIds); 24 | 25 | int selectCountByUserId(Long newBeeMallUserId); 26 | 27 | int updateByPrimaryKeySelective(NewBeeMallShoppingCartItem record); 28 | 29 | int updateByPrimaryKey(NewBeeMallShoppingCartItem record); 30 | 31 | int deleteBatch(List ids); 32 | 33 | List findMyNewBeeMallCartItems(PageQueryUtil pageUtil); 34 | 35 | int getTotalMyNewBeeMallCartItems(PageQueryUtil pageUtil); 36 | } 37 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/common/NewBeeMallOrderStatusEnum.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.common; 3 | 4 | 5 | public enum NewBeeMallOrderStatusEnum { 6 | 7 | DEFAULT(-9, "ERROR"), 8 | ORDER_PRE_PAY(0, "待支付"), 9 | ORDER_PAID(1, "已支付"), 10 | ORDER_PACKAGED(2, "配货完成"), 11 | ORDER_EXPRESS(3, "出库成功"), 12 | ORDER_SUCCESS(4, "交易成功"), 13 | ORDER_CLOSED_BY_MALLUSER(-1, "手动关闭"), 14 | ORDER_CLOSED_BY_EXPIRED(-2, "超时关闭"), 15 | ORDER_CLOSED_BY_JUDGE(-3, "商家关闭"); 16 | 17 | private int orderStatus; 18 | 19 | private String name; 20 | 21 | NewBeeMallOrderStatusEnum(int orderStatus, String name) { 22 | this.orderStatus = orderStatus; 23 | this.name = name; 24 | } 25 | 26 | public static NewBeeMallOrderStatusEnum getNewBeeMallOrderStatusEnumByStatus(int orderStatus) { 27 | for (NewBeeMallOrderStatusEnum newBeeMallOrderStatusEnum : NewBeeMallOrderStatusEnum.values()) { 28 | if (newBeeMallOrderStatusEnum.getOrderStatus() == orderStatus) { 29 | return newBeeMallOrderStatusEnum; 30 | } 31 | } 32 | return DEFAULT; 33 | } 34 | 35 | public int getOrderStatus() { 36 | return orderStatus; 37 | } 38 | 39 | public void setOrderStatus(int orderStatus) { 40 | this.orderStatus = orderStatus; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/NewBeeMallGoodsService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service; 3 | 4 | import com.my.mall.entity.NewBeeMallGoods; 5 | import com.my.mall.util.PageQueryUtil; 6 | import com.my.mall.util.PageResult; 7 | 8 | import java.util.List; 9 | 10 | public interface NewBeeMallGoodsService { 11 | /** 12 | * 后台分页 13 | * 14 | * @param pageUtil 15 | * @return 16 | */ 17 | PageResult getNewBeeMallGoodsPage(PageQueryUtil pageUtil); 18 | 19 | /** 20 | * 添加商品 21 | * 22 | * @param goods 23 | * @return 24 | */ 25 | String saveNewBeeMallGoods(NewBeeMallGoods goods); 26 | 27 | /** 28 | * 批量新增商品数据 29 | * 30 | * @param newBeeMallGoodsList 31 | * @return 32 | */ 33 | void batchSaveNewBeeMallGoods(List newBeeMallGoodsList); 34 | 35 | /** 36 | * 修改商品信息 37 | * 38 | * @param goods 39 | * @return 40 | */ 41 | String updateNewBeeMallGoods(NewBeeMallGoods goods); 42 | 43 | /** 44 | * 批量修改销售状态(上架下架) 45 | * 46 | * @param ids 47 | * @return 48 | */ 49 | Boolean batchUpdateSellStatus(Long[] ids, int sellStatus); 50 | 51 | /** 52 | * 获取商品详情 53 | * 54 | * @param id 55 | * @return 56 | */ 57 | NewBeeMallGoods getNewBeeMallGoodsById(Long id); 58 | 59 | /** 60 | * 商品搜索 61 | * 62 | * @param pageUtil 63 | * @return 64 | */ 65 | PageResult searchNewBeeMallGoods(PageQueryUtil pageUtil); 66 | } 67 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/NewBeeMallGoodsCategoryAPI.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall; 3 | 4 | import com.my.mall.common.NewBeeMallException; 5 | import com.my.mall.common.ServiceResultEnum; 6 | import com.my.mall.util.Result; 7 | import com.my.mall.util.ResultGenerator; 8 | import io.swagger.annotations.Api; 9 | import io.swagger.annotations.ApiOperation; 10 | import com.my.mall.api.mall.vo.IndexCategoryVO; 11 | import com.my.mall.service.NewBeeMallCategoryService; 12 | import org.springframework.util.CollectionUtils; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RestController; 16 | 17 | import javax.annotation.Resource; 18 | import java.util.List; 19 | 20 | @RestController 21 | @Api(value = "v1", tags = "3.新蜂商城分类页面接口") 22 | @RequestMapping("/api/v1") 23 | public class NewBeeMallGoodsCategoryAPI { 24 | 25 | @Resource 26 | private NewBeeMallCategoryService newBeeMallCategoryService; 27 | 28 | @GetMapping("/categories") 29 | @ApiOperation(value = "获取分类数据", notes = "分类页面使用") 30 | public Result> getCategories() { 31 | List categories = newBeeMallCategoryService.getCategoriesForIndex(); 32 | if (CollectionUtils.isEmpty(categories)) { 33 | NewBeeMallException.fail(ServiceResultEnum.DATA_NOT_EXIST.getResult()); 34 | } 35 | return ResultGenerator.genSuccessResult(categories); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/util/MD5Util.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.util; 2 | 3 | import java.security.MessageDigest; 4 | 5 | 6 | public class MD5Util { 7 | 8 | private static String byteArrayToHexString(byte b[]) { 9 | StringBuffer resultSb = new StringBuffer(); 10 | for (int i = 0; i < b.length; i++) 11 | resultSb.append(byteToHexString(b[i])); 12 | 13 | return resultSb.toString(); 14 | } 15 | 16 | private static String byteToHexString(byte b) { 17 | int n = b; 18 | if (n < 0) 19 | n += 256; 20 | int d1 = n / 16; 21 | int d2 = n % 16; 22 | return hexDigits[d1] + hexDigits[d2]; 23 | } 24 | 25 | public static String MD5Encode(String origin, String charsetname) { 26 | String resultString = null; 27 | try { 28 | resultString = new String(origin); 29 | MessageDigest md = MessageDigest.getInstance("MD5"); 30 | if (charsetname == null || "".equals(charsetname)) 31 | resultString = byteArrayToHexString(md.digest(resultString 32 | .getBytes())); 33 | else 34 | resultString = byteArrayToHexString(md.digest(resultString 35 | .getBytes(charsetname))); 36 | } catch (Exception exception) { 37 | } 38 | return resultString; 39 | } 40 | 41 | private static final String hexDigits[] = {"0", "1", "2", "3", "4", "5", 42 | "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; 43 | } 44 | -------------------------------------------------------------------------------- /my-mall-front/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "newbee-mall-vue3-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.20.0", 12 | "better-scroll": "^2.3.0", 13 | "core-js": "^3.6.5", 14 | "js-md5": "^0.7.3", 15 | "lib-flexible": "^0.3.2", 16 | "pushstate-server": "^3.1.0", 17 | "vant": "^3.0.0-beta.5", 18 | "vue": "^3.0.0", 19 | "vue-router": "^4.0.0-beta.13", 20 | "vue2-verify": "^1.1.5", 21 | "vuex": "^4.0.0-beta.4" 22 | }, 23 | "devDependencies": { 24 | "@vue/cli-plugin-babel": "~4.5.0", 25 | "@vue/cli-plugin-eslint": "~4.5.0", 26 | "@vue/cli-service": "~4.5.0", 27 | "@vue/compiler-sfc": "^3.0.0", 28 | "babel-eslint": "^10.1.0", 29 | "babel-plugin-import": "^1.13.1", 30 | "eslint": "^6.7.2", 31 | "eslint-plugin-vue": "^7.0.0-0", 32 | "less": "^3.12.2", 33 | "less-loader": "^7.0.2", 34 | "postcss-pxtorem": "^5.1.1", 35 | "vue-loader-v16": "^16.0.0-beta.5.4" 36 | }, 37 | "eslintConfig": { 38 | "root": true, 39 | "env": { 40 | "node": true 41 | }, 42 | "extends": [ 43 | "plugin:vue/vue3-essential", 44 | "eslint:recommended" 45 | ], 46 | "parserOptions": { 47 | "parser": "babel-eslint" 48 | }, 49 | "rules": {} 50 | }, 51 | "browserslist": [ 52 | "> 1%", 53 | "last 2 versions", 54 | "not dead" 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /my-mall-front/src/main.js: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import { ActionBar, ActionBarIcon, ActionBarButton, Divider, Popup, Overlay, Loading, Dialog, ContactCard, Form, AddressEdit, AddressList, Field, CellGroup, Cell, SwipeCell, Icon, Stepper, Card, Checkbox, CheckboxGroup, Button, Swipe, SwipeItem, PullRefresh, List, Tab, Tabs, SubmitBar, Toast, Skeleton } from 'vant' 3 | import App from './App.vue' 4 | import store from './store' 5 | import router from './router' 6 | import 'lib-flexible/flexible' 7 | import 'vant/lib/index.css'; // 全局引入样式 8 | 9 | const app = createApp(App) // 创建实例 10 | 11 | // 全局过滤器 12 | app.config.globalProperties.$filters = { 13 | prefix(url) { 14 | if (url && url.startsWith('http')) { 15 | return url 16 | } else { 17 | url = `http://backend-api-01.newbee.ltd${url}` 18 | return url 19 | } 20 | } 21 | } 22 | 23 | app.use(ActionBarButton) 24 | .use(ActionBarIcon) 25 | .use(ActionBar) 26 | .use(Divider) 27 | .use(Popup) 28 | .use(Overlay) 29 | .use(Loading) 30 | .use(Dialog) 31 | .use(Toast) 32 | .use(ContactCard) 33 | .use(Form) 34 | .use(AddressEdit) 35 | .use(AddressList) 36 | .use(Field) 37 | .use(CellGroup) 38 | .use(Cell) 39 | .use(SwipeCell) 40 | .use(Icon) 41 | .use(Stepper) 42 | .use(Card) 43 | .use(Button) 44 | .use(Swipe) 45 | .use(SwipeItem) 46 | .use(PullRefresh) 47 | .use(List) 48 | .use(Tab) 49 | .use(Tabs) 50 | .use(SubmitBar) 51 | .use(Checkbox) 52 | .use(CheckboxGroup) 53 | .use(Skeleton) 54 | 55 | app.use(router) 56 | app.use(store) 57 | 58 | app.mount('#app') -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/util/Result.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.util; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | 5 | import java.io.Serializable; 6 | 7 | 8 | public class Result implements Serializable { 9 | private static final long serialVersionUID = 1L; 10 | 11 | //业务码,比如成功、失败、权限不足等 code,可自行定义 12 | @ApiModelProperty("返回码") 13 | private int resultCode; 14 | //返回信息,后端在进行业务处理后返回给前端一个提示信息,可自行定义 15 | @ApiModelProperty("返回信息") 16 | private String message; 17 | //数据结果,泛型,可以是列表、单个对象、数字、布尔值等 18 | @ApiModelProperty("返回数据") 19 | private T data; 20 | 21 | public Result() { 22 | } 23 | 24 | public Result(int resultCode, String message) { 25 | this.resultCode = resultCode; 26 | this.message = message; 27 | } 28 | 29 | public int getResultCode() { 30 | return resultCode; 31 | } 32 | 33 | public void setResultCode(int resultCode) { 34 | this.resultCode = resultCode; 35 | } 36 | 37 | public String getMessage() { 38 | return message; 39 | } 40 | 41 | public void setMessage(String message) { 42 | this.message = message; 43 | } 44 | 45 | public T getData() { 46 | return data; 47 | } 48 | 49 | public void setData(T data) { 50 | this.data = data; 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return "Result{" + 56 | "resultCode=" + resultCode + 57 | ", message='" + message + '\'' + 58 | ", data=" + data + 59 | '}'; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/dao/NewBeeMallGoodsMapper.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.dao; 3 | 4 | import com.my.mall.entity.NewBeeMallGoods; 5 | import com.my.mall.entity.StockNumDTO; 6 | import com.my.mall.util.PageQueryUtil; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.List; 10 | 11 | public interface NewBeeMallGoodsMapper { 12 | int deleteByPrimaryKey(Long goodsId); 13 | 14 | int insert(NewBeeMallGoods record); 15 | 16 | int insertSelective(NewBeeMallGoods record); 17 | 18 | NewBeeMallGoods selectByPrimaryKey(Long goodsId); 19 | 20 | NewBeeMallGoods selectByCategoryIdAndName(@Param("goodsName") String goodsName, @Param("goodsCategoryId") Long goodsCategoryId); 21 | 22 | int updateByPrimaryKeySelective(NewBeeMallGoods record); 23 | 24 | int updateByPrimaryKeyWithBLOBs(NewBeeMallGoods record); 25 | 26 | int updateByPrimaryKey(NewBeeMallGoods record); 27 | 28 | List findNewBeeMallGoodsList(PageQueryUtil pageUtil); 29 | 30 | int getTotalNewBeeMallGoods(PageQueryUtil pageUtil); 31 | 32 | List selectByPrimaryKeys(List goodsIds); 33 | 34 | List findNewBeeMallGoodsListBySearch(PageQueryUtil pageUtil); 35 | 36 | int getTotalNewBeeMallGoodsBySearch(PageQueryUtil pageUtil); 37 | 38 | int batchInsert(@Param("newBeeMallGoodsList") List newBeeMallGoodsList); 39 | 40 | int updateStockNum(@Param("stockNumDTOS") List stockNumDTOS); 41 | 42 | int batchUpdateSellStatus(@Param("orderIds")Long[] orderIds,@Param("sellStatus") int sellStatus); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /my-mall-front/src/components/SimpleHeader.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 48 | 49 | 71 | -------------------------------------------------------------------------------- /my-mall-front/src/common/style/mixin.less: -------------------------------------------------------------------------------- 1 | @import "./base.less"; 2 | // @primary: #1baeae; // 主题色 3 | @primary: #e43130; // 主题色 4 | @orange: #ff6b01; 5 | @bc: #f7f7f7; 6 | @fc: #fff; 7 | 8 | // // 背景图片地址和大小 9 | .bis(@url) { 10 | background-image: url(@url); 11 | background-repeat: no-repeat; 12 | background-size: 100% 100%; 13 | } 14 | 15 | // //圆角 16 | .borderRadius(@radius) { 17 | -webkit-border-radius: @radius; 18 | -moz-border-radius: @radius; 19 | -ms-border-radius: @radius; 20 | -o-border-radius: @radius; 21 | border-radius: @radius; 22 | } 23 | 24 | // //1px底部边框 25 | .border-1px(@color) { 26 | position: relative; 27 | &:after { 28 | display: block; 29 | position: absolute; 30 | left: 0; 31 | bottom: 0; 32 | width: 100%; 33 | border-top: 1px solid @color; 34 | content: ""; 35 | } 36 | } 37 | // //定位全屏 38 | .allcover { 39 | position: absolute; 40 | top: 0; 41 | right: 0; 42 | } 43 | 44 | // //定位上下左右居中 45 | .center { 46 | position: absolute; 47 | top: 50%; 48 | left: 50%; 49 | transform: translate(-50%, -50%); 50 | } 51 | 52 | // //定位上下居中 53 | .ct { 54 | position: absolute; 55 | top: 50%; 56 | transform: translateY(-50%); 57 | } 58 | 59 | // //定位左右居中 60 | .cl { 61 | position: absolute; 62 | left: 50%; 63 | transform: translateX(-50%); 64 | } 65 | 66 | // //宽高 67 | .wh(@width, @height) { 68 | width: @width; 69 | height: @height; 70 | } 71 | 72 | // //字体大小,颜色 73 | .sc(@size, @color) { 74 | font-size: @size; 75 | color: @color; 76 | } 77 | 78 | .boxSizing { 79 | -webkit-box-sizing: border-box; 80 | -moz-box-sizing: border-box; 81 | box-sizing: border-box; 82 | } 83 | 84 | // //flex 布局和 子元素 对其方式 85 | .fj(@type: space-between) { 86 | display: flex; 87 | justify-content: @type; 88 | } 89 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/util/ResultGenerator.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.util; 2 | 3 | import org.springframework.util.StringUtils; 4 | 5 | 6 | public class ResultGenerator { 7 | private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS"; 8 | private static final String DEFAULT_FAIL_MESSAGE = "FAIL"; 9 | private static final int RESULT_CODE_SUCCESS = 200; 10 | private static final int RESULT_CODE_SERVER_ERROR = 500; 11 | 12 | public static Result genSuccessResult() { 13 | Result result = new Result(); 14 | result.setResultCode(RESULT_CODE_SUCCESS); 15 | result.setMessage(DEFAULT_SUCCESS_MESSAGE); 16 | return result; 17 | } 18 | 19 | public static Result genSuccessResult(String message) { 20 | Result result = new Result(); 21 | result.setResultCode(RESULT_CODE_SUCCESS); 22 | result.setMessage(message); 23 | return result; 24 | } 25 | 26 | public static Result genSuccessResult(Object data) { 27 | Result result = new Result(); 28 | result.setResultCode(RESULT_CODE_SUCCESS); 29 | result.setMessage(DEFAULT_SUCCESS_MESSAGE); 30 | result.setData(data); 31 | return result; 32 | } 33 | 34 | public static Result genFailResult(String message) { 35 | Result result = new Result(); 36 | result.setResultCode(RESULT_CODE_SERVER_ERROR); 37 | if (StringUtils.isEmpty(message)) { 38 | result.setMessage(DEFAULT_FAIL_MESSAGE); 39 | } else { 40 | result.setMessage(message); 41 | } 42 | return result; 43 | } 44 | 45 | public static Result genErrorResult(int code, String message) { 46 | Result result = new Result(); 47 | result.setResultCode(code); 48 | result.setMessage(message); 49 | return result; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/vo/SearchPageCategoryVO.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall.vo; 3 | 4 | import com.my.mall.entity.GoodsCategory; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | /** 10 | * 搜索页面分类数据VO 11 | */ 12 | public class SearchPageCategoryVO implements Serializable { 13 | 14 | private String firstLevelCategoryName; 15 | 16 | private List secondLevelCategoryList; 17 | 18 | private String secondLevelCategoryName; 19 | 20 | private List thirdLevelCategoryList; 21 | 22 | private String currentCategoryName; 23 | 24 | public String getFirstLevelCategoryName() { 25 | return firstLevelCategoryName; 26 | } 27 | 28 | public void setFirstLevelCategoryName(String firstLevelCategoryName) { 29 | this.firstLevelCategoryName = firstLevelCategoryName; 30 | } 31 | 32 | public List getSecondLevelCategoryList() { 33 | return secondLevelCategoryList; 34 | } 35 | 36 | public void setSecondLevelCategoryList(List secondLevelCategoryList) { 37 | this.secondLevelCategoryList = secondLevelCategoryList; 38 | } 39 | 40 | public String getSecondLevelCategoryName() { 41 | return secondLevelCategoryName; 42 | } 43 | 44 | public void setSecondLevelCategoryName(String secondLevelCategoryName) { 45 | this.secondLevelCategoryName = secondLevelCategoryName; 46 | } 47 | 48 | public List getThirdLevelCategoryList() { 49 | return thirdLevelCategoryList; 50 | } 51 | 52 | public void setThirdLevelCategoryList(List thirdLevelCategoryList) { 53 | this.thirdLevelCategoryList = thirdLevelCategoryList; 54 | } 55 | 56 | public String getCurrentCategoryName() { 57 | return currentCategoryName; 58 | } 59 | 60 | public void setCurrentCategoryName(String currentCategoryName) { 61 | this.currentCategoryName = currentCategoryName; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/util/PageResult.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.util; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | 5 | import java.io.Serializable; 6 | import java.util.List; 7 | 8 | 9 | public class PageResult implements Serializable { 10 | 11 | @ApiModelProperty("总记录数") 12 | private int totalCount; 13 | 14 | @ApiModelProperty("每页记录数") 15 | private int pageSize; 16 | 17 | @ApiModelProperty("总页数") 18 | private int totalPage; 19 | 20 | @ApiModelProperty("当前页数") 21 | private int currPage; 22 | 23 | @ApiModelProperty("列表数据") 24 | private List list; 25 | 26 | /** 27 | * 分页 28 | * 29 | * @param list 列表数据 30 | * @param totalCount 总记录数 31 | * @param pageSize 每页记录数 32 | * @param currPage 当前页数 33 | */ 34 | public PageResult(List list, int totalCount, int pageSize, int currPage) { 35 | this.list = list; 36 | this.totalCount = totalCount; 37 | this.pageSize = pageSize; 38 | this.currPage = currPage; 39 | this.totalPage = (int) Math.ceil((double) totalCount / pageSize); 40 | } 41 | 42 | public int getTotalCount() { 43 | return totalCount; 44 | } 45 | 46 | public void setTotalCount(int totalCount) { 47 | this.totalCount = totalCount; 48 | } 49 | 50 | public int getPageSize() { 51 | return pageSize; 52 | } 53 | 54 | public void setPageSize(int pageSize) { 55 | this.pageSize = pageSize; 56 | } 57 | 58 | public int getTotalPage() { 59 | return totalPage; 60 | } 61 | 62 | public void setTotalPage(int totalPage) { 63 | this.totalPage = totalPage; 64 | } 65 | 66 | public int getCurrPage() { 67 | return currPage; 68 | } 69 | 70 | public void setCurrPage(int currPage) { 71 | this.currPage = currPage; 72 | } 73 | 74 | public List getList() { 75 | return list; 76 | } 77 | 78 | public void setList(List list) { 79 | this.list = list; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/NewBeeMallShoppingCartService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service; 3 | 4 | import com.my.mall.api.mall.param.SaveCartItemParam; 5 | import com.my.mall.api.mall.param.UpdateCartItemParam; 6 | import com.my.mall.entity.NewBeeMallShoppingCartItem; 7 | import com.my.mall.util.PageQueryUtil; 8 | import com.my.mall.util.PageResult; 9 | import com.my.mall.api.mall.vo.ShoppingCartItemVO; 10 | 11 | import java.util.List; 12 | 13 | public interface NewBeeMallShoppingCartService { 14 | 15 | /** 16 | * 保存商品至购物车中 17 | * 18 | * @param saveCartItemParam 19 | * @param userId 20 | * @return 21 | */ 22 | String saveNewBeeMallCartItem(SaveCartItemParam saveCartItemParam, Long userId); 23 | 24 | /** 25 | * 修改购物车中的属性 26 | * 27 | * @param updateCartItemParam 28 | * @param userId 29 | * @return 30 | */ 31 | String updateNewBeeMallCartItem(UpdateCartItemParam updateCartItemParam, Long userId); 32 | 33 | /** 34 | * 获取购物项详情 35 | * 36 | * @param newBeeMallShoppingCartItemId 37 | * @return 38 | */ 39 | NewBeeMallShoppingCartItem getNewBeeMallCartItemById(Long newBeeMallShoppingCartItemId); 40 | 41 | /** 42 | * 删除购物车中的商品 43 | * 44 | * 45 | * @param shoppingCartItemId 46 | * @param userId 47 | * @return 48 | */ 49 | Boolean deleteById(Long shoppingCartItemId, Long userId); 50 | 51 | /** 52 | * 获取我的购物车中的列表数据 53 | * 54 | * @param newBeeMallUserId 55 | * @return 56 | */ 57 | List getMyShoppingCartItems(Long newBeeMallUserId); 58 | 59 | /** 60 | * 根据userId和cartItemIds获取对应的购物项记录 61 | * 62 | * @param cartItemIds 63 | * @param newBeeMallUserId 64 | * @return 65 | */ 66 | List getCartItemsForSettle(List cartItemIds, Long newBeeMallUserId); 67 | 68 | /** 69 | * 我的购物车(分页数据) 70 | * 71 | * @param pageUtil 72 | * @return 73 | */ 74 | PageResult getMyShoppingCartItems(PageQueryUtil pageUtil); 75 | } 76 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/GoodsAddParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import org.hibernate.validator.constraints.Length; 7 | 8 | import javax.validation.constraints.Max; 9 | import javax.validation.constraints.Min; 10 | import javax.validation.constraints.NotEmpty; 11 | import javax.validation.constraints.NotNull; 12 | 13 | @Data 14 | public class GoodsAddParam { 15 | 16 | @ApiModelProperty("商品名称") 17 | @NotEmpty(message = "商品名称不能为空") 18 | @Length(max = 128,message = "商品名称内容过长") 19 | private String goodsName; 20 | 21 | @ApiModelProperty("商品简介") 22 | @NotEmpty(message = "商品简介不能为空") 23 | @Length(max = 200,message = "商品简介内容过长") 24 | private String goodsIntro; 25 | 26 | @ApiModelProperty("分类id") 27 | @NotNull(message = "分类id不能为空") 28 | @Min(value = 1, message = "分类id最低为1") 29 | private Long goodsCategoryId; 30 | 31 | @ApiModelProperty("商品主图") 32 | @NotEmpty(message = "商品主图不能为空") 33 | private String goodsCoverImg; 34 | 35 | @ApiModelProperty("originalPrice") 36 | @NotNull(message = "originalPrice不能为空") 37 | @Min(value = 1, message = "originalPrice最低为1") 38 | @Max(value = 1000000, message = "originalPrice最高为1000000") 39 | private Integer originalPrice; 40 | 41 | @ApiModelProperty("sellingPrice") 42 | @NotNull(message = "sellingPrice不能为空") 43 | @Min(value = 1, message = "sellingPrice最低为1") 44 | @Max(value = 1000000, message = "sellingPrice最高为1000000") 45 | private Integer sellingPrice; 46 | 47 | @ApiModelProperty("库存") 48 | @NotNull(message = "库存不能为空") 49 | @Min(value = 1, message = "库存最低为1") 50 | @Max(value = 100000, message = "库存最高为100000") 51 | private Integer stockNum; 52 | 53 | @ApiModelProperty("商品标签") 54 | @NotEmpty(message = "商品标签不能为空") 55 | @Length(max = 16,message = "商品标签内容过长") 56 | private String tag; 57 | 58 | private Byte goodsSellStatus; 59 | 60 | @ApiModelProperty("商品详情") 61 | @NotEmpty(message = "商品详情不能为空") 62 | private String goodsDetailContent; 63 | } 64 | -------------------------------------------------------------------------------- /my-mall-front/src/components/ListScroll.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 87 | 88 | -------------------------------------------------------------------------------- /my-mall-front/src/views/Setting.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 66 | 67 | 75 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/param/GoodsEditParam.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin.param; 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import org.hibernate.validator.constraints.Length; 7 | 8 | import javax.validation.constraints.Max; 9 | import javax.validation.constraints.Min; 10 | import javax.validation.constraints.NotEmpty; 11 | import javax.validation.constraints.NotNull; 12 | 13 | @Data 14 | public class GoodsEditParam { 15 | 16 | @ApiModelProperty("待修改商品id") 17 | @NotNull(message = "商品id不能为空") 18 | @Min(value = 1, message = "商品id不能为空") 19 | private Long goodsId; 20 | 21 | @ApiModelProperty("商品名称") 22 | @NotEmpty(message = "商品名称不能为空") 23 | @Length(max = 128,message = "商品名称内容过长") 24 | private String goodsName; 25 | 26 | @ApiModelProperty("商品简介") 27 | @NotEmpty(message = "商品简介不能为空") 28 | @Length(max = 200,message = "商品简介内容过长") 29 | private String goodsIntro; 30 | 31 | @ApiModelProperty("分类id") 32 | @NotNull(message = "分类id不能为空") 33 | @Min(value = 1, message = "分类id最低为1") 34 | private Long goodsCategoryId; 35 | 36 | @ApiModelProperty("商品主图") 37 | @NotEmpty(message = "商品主图不能为空") 38 | private String goodsCoverImg; 39 | 40 | @ApiModelProperty("originalPrice") 41 | @NotNull(message = "originalPrice不能为空") 42 | @Min(value = 1, message = "originalPrice最低为1") 43 | @Max(value = 1000000, message = "originalPrice最高为1000000") 44 | private Integer originalPrice; 45 | 46 | @ApiModelProperty("sellingPrice") 47 | @NotNull(message = "sellingPrice不能为空") 48 | @Min(value = 1, message = "sellingPrice最低为1") 49 | @Max(value = 1000000, message = "sellingPrice最高为1000000") 50 | private Integer sellingPrice; 51 | 52 | @ApiModelProperty("库存") 53 | @NotNull(message = "库存不能为空") 54 | @Min(value = 1, message = "库存最低为1") 55 | @Max(value = 100000, message = "库存最高为100000") 56 | private Integer stockNum; 57 | 58 | @ApiModelProperty("商品标签") 59 | @NotEmpty(message = "商品标签不能为空") 60 | @Length(max = 16,message = "商品标签内容过长") 61 | private String tag; 62 | 63 | private Byte goodsSellStatus; 64 | 65 | @ApiModelProperty("商品详情") 66 | @NotEmpty(message = "商品详情不能为空") 67 | private String goodsDetailContent; 68 | } 69 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/common/ServiceResultEnum.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.common; 3 | 4 | public enum ServiceResultEnum { 5 | ERROR("error"), 6 | 7 | SUCCESS("success"), 8 | 9 | DATA_NOT_EXIST("未查询到记录!"), 10 | 11 | PARAM_ERROR("参数错误!"), 12 | 13 | SAME_CATEGORY_EXIST("已存在同级同名的分类!"), 14 | 15 | SAME_LOGIN_NAME_EXIST("用户名已存在!"), 16 | 17 | LOGIN_NAME_NULL("请输入登录名!"), 18 | 19 | LOGIN_NAME_IS_NOT_PHONE("请输入正确的手机号!"), 20 | 21 | LOGIN_PASSWORD_NULL("请输入密码!"), 22 | 23 | LOGIN_VERIFY_CODE_NULL("请输入验证码!"), 24 | 25 | LOGIN_VERIFY_CODE_ERROR("验证码错误!"), 26 | 27 | SAME_INDEX_CONFIG_EXIST("已存在相同的首页配置项!"), 28 | 29 | GOODS_CATEGORY_ERROR("分类数据异常!"), 30 | 31 | SAME_GOODS_EXIST("已存在相同的商品信息!"), 32 | 33 | GOODS_NOT_EXIST("商品不存在!"), 34 | 35 | GOODS_PUT_DOWN("商品已下架!"), 36 | 37 | SHOPPING_CART_ITEM_LIMIT_NUMBER_ERROR("超出单个商品的最大购买数量!"), 38 | 39 | SHOPPING_CART_ITEM_NUMBER_ERROR("商品数量不能小于 1 !"), 40 | 41 | SHOPPING_CART_ITEM_TOTAL_NUMBER_ERROR("超出购物车最大容量!"), 42 | 43 | SHOPPING_CART_ITEM_EXIST_ERROR("已存在!无需重复添加!"), 44 | 45 | LOGIN_ERROR("登录失败!"), 46 | 47 | NOT_LOGIN_ERROR("未登录!"), 48 | 49 | ADMIN_NOT_LOGIN_ERROR("管理员未登录!"), 50 | 51 | TOKEN_EXPIRE_ERROR("无效认证!请重新登录!"), 52 | 53 | ADMIN_TOKEN_EXPIRE_ERROR("管理员登录过期!请重新登录!"), 54 | 55 | USER_NULL_ERROR("无效用户!请重新登录!"), 56 | 57 | LOGIN_USER_LOCKED_ERROR("用户已被禁止登录!"), 58 | 59 | ORDER_NOT_EXIST_ERROR("订单不存在!"), 60 | 61 | ORDER_ITEM_NOT_EXIST_ERROR("订单项不存在!"), 62 | 63 | NULL_ADDRESS_ERROR("地址不能为空!"), 64 | 65 | ORDER_PRICE_ERROR("订单价格异常!"), 66 | 67 | ORDER_ITEM_NULL_ERROR("订单项异常!"), 68 | 69 | ORDER_GENERATE_ERROR("生成订单异常!"), 70 | 71 | SHOPPING_ITEM_ERROR("购物车数据异常!"), 72 | 73 | SHOPPING_ITEM_COUNT_ERROR("库存不足!"), 74 | 75 | ORDER_STATUS_ERROR("订单状态异常!"), 76 | 77 | OPERATE_ERROR("操作失败!"), 78 | 79 | REQUEST_FORBIDEN_ERROR("禁止该操作!"), 80 | 81 | NO_PERMISSION_ERROR("无权限!"), 82 | 83 | DB_ERROR("database error"); 84 | 85 | private String result; 86 | 87 | ServiceResultEnum(String result) { 88 | this.result = result; 89 | } 90 | 91 | public String getResult() { 92 | return result; 93 | } 94 | 95 | public void setResult(String result) { 96 | this.result = result; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /my-mall-front/src/App.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 37 | 38 | 94 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/util/NewBeeMallUtils.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.util; 2 | 3 | import org.springframework.util.StringUtils; 4 | 5 | import java.net.URI; 6 | 7 | 8 | public class NewBeeMallUtils { 9 | 10 | public static URI getHost(URI uri) { 11 | URI effectiveURI = null; 12 | try { 13 | effectiveURI = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), null, null, null); 14 | } catch (Throwable var4) { 15 | effectiveURI = null; 16 | } 17 | return effectiveURI; 18 | } 19 | 20 | public static String cleanString(String value) { 21 | if (StringUtils.isEmpty(value)) { 22 | return ""; 23 | } 24 | value = value.toLowerCase(); 25 | value = value.replaceAll("<", "& lt;").replaceAll(">", "& gt;"); 26 | value = value.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;"); 27 | value = value.replaceAll("'", "& #39;"); 28 | value = value.replaceAll("onload", "0nl0ad"); 29 | value = value.replaceAll("xml", "xm1"); 30 | value = value.replaceAll("window", "wind0w"); 31 | value = value.replaceAll("click", "cl1ck"); 32 | value = value.replaceAll("var", "v0r"); 33 | value = value.replaceAll("let", "1et"); 34 | value = value.replaceAll("function", "functi0n"); 35 | value = value.replaceAll("return", "retu1n"); 36 | value = value.replaceAll("$", ""); 37 | value = value.replaceAll("document", "d0cument"); 38 | value = value.replaceAll("const", "c0nst"); 39 | value = value.replaceAll("eval\\((.*)\\)", ""); 40 | value = value.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']", "\"\""); 41 | value = value.replaceAll("script", "scr1pt"); 42 | value = value.replaceAll("insert", "1nsert"); 43 | value = value.replaceAll("drop", "dr0p"); 44 | value = value.replaceAll("create", "cre0ate"); 45 | value = value.replaceAll("update", "upd0ate"); 46 | value = value.replaceAll("alter", "a1ter"); 47 | value = value.replaceAll("from", "fr0m"); 48 | value = value.replaceAll("where", "wh1re"); 49 | value = value.replaceAll("database", "data1base"); 50 | value = value.replaceAll("table", "tab1e"); 51 | value = value.replaceAll("tb", "tb0"); 52 | return value; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/mall/NewBeeMallIndexAPI.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.mall; 3 | 4 | import com.my.mall.common.Constants; 5 | import com.my.mall.common.IndexConfigTypeEnum; 6 | import com.my.mall.util.Result; 7 | import com.my.mall.util.ResultGenerator; 8 | import io.swagger.annotations.Api; 9 | import io.swagger.annotations.ApiOperation; 10 | import com.my.mall.api.mall.vo.IndexInfoVO; 11 | import com.my.mall.api.mall.vo.IndexCarouselVO; 12 | import com.my.mall.api.mall.vo.IndexConfigGoodsVO; 13 | import com.my.mall.service.NewBeeMallCarouselService; 14 | import com.my.mall.service.NewBeeMallIndexConfigService; 15 | import org.springframework.web.bind.annotation.GetMapping; 16 | import org.springframework.web.bind.annotation.RequestMapping; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import javax.annotation.Resource; 20 | import java.util.List; 21 | 22 | @RestController 23 | @Api(value = "v1", tags = "1.新蜂商城首页接口") 24 | @RequestMapping("/api/v1") 25 | public class NewBeeMallIndexAPI { 26 | 27 | @Resource 28 | private NewBeeMallCarouselService newBeeMallCarouselService; 29 | 30 | @Resource 31 | private NewBeeMallIndexConfigService newBeeMallIndexConfigService; 32 | 33 | @GetMapping("/index-infos") 34 | @ApiOperation(value = "获取首页数据", notes = "轮播图、新品、推荐等") 35 | public Result indexInfo() { 36 | IndexInfoVO indexInfoVO = new IndexInfoVO(); 37 | List carousels = newBeeMallCarouselService.getCarouselsForIndex(Constants.INDEX_CAROUSEL_NUMBER); 38 | List hotGoodses = newBeeMallIndexConfigService.getConfigGoodsesForIndex(IndexConfigTypeEnum.INDEX_GOODS_HOT.getType(), Constants.INDEX_GOODS_HOT_NUMBER); 39 | List newGoodses = newBeeMallIndexConfigService.getConfigGoodsesForIndex(IndexConfigTypeEnum.INDEX_GOODS_NEW.getType(), Constants.INDEX_GOODS_NEW_NUMBER); 40 | List recommendGoodses = newBeeMallIndexConfigService.getConfigGoodsesForIndex(IndexConfigTypeEnum.INDEX_GOODS_RECOMMOND.getType(), Constants.INDEX_GOODS_RECOMMOND_NUMBER); 41 | indexInfoVO.setCarousels(carousels); 42 | indexInfoVO.setHotGoodses(hotGoodses); 43 | indexInfoVO.setNewGoodses(newGoodses); 44 | indexInfoVO.setRecommendGoodses(recommendGoodses); 45 | return ResultGenerator.genSuccessResult(indexInfoVO); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/config/Swagger3Config.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.config; 3 | 4 | import com.my.mall.entity.AdminUserToken; 5 | import com.my.mall.entity.MallUser; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import springfox.documentation.builders.ApiInfoBuilder; 9 | import springfox.documentation.builders.PathSelectors; 10 | import springfox.documentation.builders.RequestHandlerSelectors; 11 | import springfox.documentation.builders.RequestParameterBuilder; 12 | import springfox.documentation.oas.annotations.EnableOpenApi; 13 | import springfox.documentation.schema.ScalarType; 14 | import springfox.documentation.service.ApiInfo; 15 | import springfox.documentation.service.ParameterType; 16 | import springfox.documentation.service.RequestParameter; 17 | import springfox.documentation.spi.DocumentationType; 18 | import springfox.documentation.spring.web.plugins.Docket; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | @Configuration 24 | @EnableOpenApi 25 | public class Swagger3Config { 26 | 27 | @Bean 28 | public Docket api() { 29 | return new Docket(DocumentationType.OAS_30) 30 | .apiInfo(apiInfo()) 31 | .ignoredParameterTypes(MallUser.class, AdminUserToken.class) 32 | .select() 33 | .apis(RequestHandlerSelectors.basePackage("ltd.newbee.mall.api")) 34 | .paths(PathSelectors.any()) 35 | .build() 36 | .globalRequestParameters(getGlobalRequestParameters()); 37 | } 38 | 39 | //生成全局通用参数 40 | private List getGlobalRequestParameters() { 41 | List parameters = new ArrayList<>(); 42 | parameters.add(new RequestParameterBuilder() 43 | .name("token") 44 | .description("登录认证token") 45 | .required(false) // 非必传 46 | .in(ParameterType.HEADER) //请求头中的参数,其它类型可以点进ParameterType类中查看 47 | .query(q -> q.model(m -> m.scalarModel(ScalarType.STRING))) 48 | .build()); 49 | return parameters; 50 | } 51 | 52 | private ApiInfo apiInfo() { 53 | return new ApiInfoBuilder() 54 | .title("新蜂商城接口文档") 55 | .description("swagger接口文档") 56 | .version("2.0") 57 | .build(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/config/NeeBeeMallWebMvcConfigurer.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.config; 3 | 4 | import com.my.mall.config.handler.TokenToAdminUserMethodArgumentResolver; 5 | import com.my.mall.config.handler.TokenToMallUserMethodArgumentResolver; 6 | import com.my.mall.common.Constants; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.web.method.support.HandlerMethodArgumentResolver; 10 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 11 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 12 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; 13 | 14 | import java.util.List; 15 | 16 | @Configuration 17 | public class NeeBeeMallWebMvcConfigurer extends WebMvcConfigurationSupport { 18 | 19 | @Autowired 20 | private TokenToMallUserMethodArgumentResolver tokenToMallUserMethodArgumentResolver; 21 | @Autowired 22 | private TokenToAdminUserMethodArgumentResolver tokenToAdminUserMethodArgumentResolver; 23 | 24 | /** 25 | * @param argumentResolvers 26 | * @tip @TokenToMallUser @TokenToAdminUser 注解处理方法 27 | */ 28 | public void addArgumentResolvers(List argumentResolvers) { 29 | argumentResolvers.add(tokenToMallUserMethodArgumentResolver); 30 | argumentResolvers.add(tokenToAdminUserMethodArgumentResolver); 31 | } 32 | 33 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 34 | registry.addResourceHandler("/upload/**").addResourceLocations("file:" + Constants.FILE_UPLOAD_DIC); 35 | registry.addResourceHandler("/goods-img/**").addResourceLocations("file:" + Constants.FILE_UPLOAD_DIC); 36 | 37 | registry. 38 | addResourceHandler("/swagger-ui/**") 39 | .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/") 40 | .resourceChain(false); 41 | } 42 | 43 | /** 44 | * 跨域配置 45 | * 46 | * @param registry 47 | */ 48 | @Override 49 | public void addCorsMappings(CorsRegistry registry) { 50 | registry.addMapping("/**").allowedOriginPatterns("*") 51 | .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS") 52 | .allowCredentials(true).maxAge(3600); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/config/NewBeeMallExceptionHandler.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.config; 3 | 4 | import com.my.mall.common.NewBeeMallException; 5 | import com.my.mall.common.ServiceResultEnum; 6 | import com.my.mall.util.Result; 7 | import org.springframework.validation.BindException; 8 | import org.springframework.validation.BindingResult; 9 | import org.springframework.web.bind.MethodArgumentNotValidException; 10 | import org.springframework.web.bind.annotation.ExceptionHandler; 11 | import org.springframework.web.bind.annotation.RestControllerAdvice; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | import java.util.Objects; 15 | 16 | /** 17 | * 全局异常处理 18 | */ 19 | @RestControllerAdvice 20 | public class NewBeeMallExceptionHandler { 21 | 22 | @ExceptionHandler(BindException.class) 23 | public Object bindException(BindException e) { 24 | Result result = new Result(); 25 | result.setResultCode(510); 26 | BindingResult bindingResult = e.getBindingResult(); 27 | result.setMessage(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); 28 | return result; 29 | } 30 | 31 | @ExceptionHandler(MethodArgumentNotValidException.class) 32 | public Object bindException(MethodArgumentNotValidException e) { 33 | Result result = new Result(); 34 | result.setResultCode(510); 35 | BindingResult bindingResult = e.getBindingResult(); 36 | result.setMessage(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); 37 | return result; 38 | } 39 | 40 | @ExceptionHandler(Exception.class) 41 | public Object handleException(Exception e, HttpServletRequest req) { 42 | Result result = new Result(); 43 | result.setResultCode(500); 44 | //区分是否为自定义异常 45 | if (e instanceof NewBeeMallException) { 46 | result.setMessage(e.getMessage()); 47 | if (e.getMessage().equals(ServiceResultEnum.NOT_LOGIN_ERROR.getResult()) || e.getMessage().equals(ServiceResultEnum.TOKEN_EXPIRE_ERROR.getResult())) { 48 | result.setResultCode(416); 49 | } else if (e.getMessage().equals(ServiceResultEnum.ADMIN_NOT_LOGIN_ERROR.getResult()) || e.getMessage().equals(ServiceResultEnum.ADMIN_TOKEN_EXPIRE_ERROR.getResult())) { 50 | result.setResultCode(419); 51 | } 52 | } else { 53 | e.printStackTrace(); 54 | result.setMessage("未知异常,请查看控制台日志并检查配置文件。"); 55 | } 56 | return result; 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/config/handler/TokenToAdminUserMethodArgumentResolver.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.config.handler; 3 | 4 | import com.my.mall.config.annotation.TokenToAdminUser; 5 | import com.my.mall.entity.AdminUserToken; 6 | import com.my.mall.common.Constants; 7 | import com.my.mall.common.NewBeeMallException; 8 | import com.my.mall.common.ServiceResultEnum; 9 | import com.my.mall.dao.NewBeeAdminUserTokenMapper; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.core.MethodParameter; 12 | import org.springframework.stereotype.Component; 13 | import org.springframework.web.bind.support.WebDataBinderFactory; 14 | import org.springframework.web.context.request.NativeWebRequest; 15 | import org.springframework.web.method.support.HandlerMethodArgumentResolver; 16 | import org.springframework.web.method.support.ModelAndViewContainer; 17 | 18 | @Component 19 | public class TokenToAdminUserMethodArgumentResolver implements HandlerMethodArgumentResolver { 20 | 21 | @Autowired 22 | private NewBeeAdminUserTokenMapper newBeeAdminUserTokenMapper; 23 | 24 | public TokenToAdminUserMethodArgumentResolver() { 25 | } 26 | 27 | public boolean supportsParameter(MethodParameter parameter) { 28 | if (parameter.hasParameterAnnotation(TokenToAdminUser.class)) { 29 | return true; 30 | } 31 | return false; 32 | } 33 | 34 | public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) { 35 | if (parameter.getParameterAnnotation(TokenToAdminUser.class) instanceof TokenToAdminUser) { 36 | String token = webRequest.getHeader("token"); 37 | if (null != token && !"".equals(token) && token.length() == Constants.TOKEN_LENGTH) { 38 | AdminUserToken adminUserToken = newBeeAdminUserTokenMapper.selectByToken(token); 39 | if (adminUserToken == null) { 40 | NewBeeMallException.fail(ServiceResultEnum.ADMIN_NOT_LOGIN_ERROR.getResult()); 41 | } else if (adminUserToken.getExpireTime().getTime() <= System.currentTimeMillis()) { 42 | NewBeeMallException.fail(ServiceResultEnum.ADMIN_TOKEN_EXPIRE_ERROR.getResult()); 43 | } 44 | return adminUserToken; 45 | } else { 46 | NewBeeMallException.fail(ServiceResultEnum.ADMIN_NOT_LOGIN_ERROR.getResult()); 47 | } 48 | } 49 | return null; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/NewBeeMallOrderService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service; 3 | 4 | import com.my.mall.api.mall.vo.OrderDetailVO; 5 | import com.my.mall.entity.MallUser; 6 | import com.my.mall.entity.MallUserAddress; 7 | import com.my.mall.entity.NewBeeMallOrder; 8 | import com.my.mall.util.PageQueryUtil; 9 | import com.my.mall.util.PageResult; 10 | import com.my.mall.api.mall.vo.OrderItemVO; 11 | import com.my.mall.api.mall.vo.ShoppingCartItemVO; 12 | 13 | import java.util.List; 14 | 15 | public interface NewBeeMallOrderService { 16 | /** 17 | * 获取订单详情 18 | * 19 | * @param orderId 20 | * @return 21 | */ 22 | OrderDetailVO getOrderDetailByOrderId(Long orderId); 23 | 24 | /** 25 | * 获取订单详情 26 | * 27 | * @param orderNo 28 | * @param userId 29 | * @return 30 | */ 31 | OrderDetailVO getOrderDetailByOrderNo(String orderNo, Long userId); 32 | 33 | /** 34 | * 我的订单列表 35 | * 36 | * @param pageUtil 37 | * @return 38 | */ 39 | PageResult getMyOrders(PageQueryUtil pageUtil); 40 | 41 | /** 42 | * 手动取消订单 43 | * 44 | * @param orderNo 45 | * @param userId 46 | * @return 47 | */ 48 | String cancelOrder(String orderNo, Long userId); 49 | 50 | /** 51 | * 确认收货 52 | * 53 | * @param orderNo 54 | * @param userId 55 | * @return 56 | */ 57 | String finishOrder(String orderNo, Long userId); 58 | 59 | String paySuccess(String orderNo, int payType); 60 | 61 | String saveOrder(MallUser loginMallUser, MallUserAddress address, List itemsForSave); 62 | 63 | /** 64 | * 后台分页 65 | * 66 | * @param pageUtil 67 | * @return 68 | */ 69 | PageResult getNewBeeMallOrdersPage(PageQueryUtil pageUtil); 70 | 71 | /** 72 | * 订单信息修改 73 | * 74 | * @param newBeeMallOrder 75 | * @return 76 | */ 77 | String updateOrderInfo(NewBeeMallOrder newBeeMallOrder); 78 | 79 | /** 80 | * 配货 81 | * 82 | * @param ids 83 | * @return 84 | */ 85 | String checkDone(Long[] ids); 86 | 87 | /** 88 | * 出库 89 | * 90 | * @param ids 91 | * @return 92 | */ 93 | String checkOut(Long[] ids); 94 | 95 | /** 96 | * 关闭订单 97 | * 98 | * @param ids 99 | * @return 100 | */ 101 | String closeOrder(Long[] ids); 102 | 103 | List getOrderItems(Long orderId); 104 | } 105 | -------------------------------------------------------------------------------- /my-mall-front/src/components/NavBar.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 50 | 51 | 92 | -------------------------------------------------------------------------------- /my-mall-front/src/views/Address.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 82 | 83 | 97 | -------------------------------------------------------------------------------- /my-mall-admin/src/router/index.js: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHashHistory } from 'vue-router' 2 | 3 | const router = createRouter({ 4 | history: createWebHashHistory(), // hash模式:createWebHashHistory,history模式:createWebHistory 5 | routes: [ 6 | { 7 | path: '/', 8 | redirect: '/add' 9 | }, 10 | { 11 | path: '/login', 12 | name: 'login', 13 | component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue') 14 | }, 15 | { 16 | path: '/add', 17 | name: 'add', 18 | component: () => import(/* webpackChunkName: "add" */ '../views/AddGood.vue') 19 | }, 20 | { 21 | path: '/swiper', 22 | name: 'swiper', 23 | component: () => import(/* webpackChunkName: "swiper" */ '../views/Swiper.vue') 24 | }, 25 | { 26 | path: '/hot', 27 | name: 'hot', 28 | component: () => import(/* webpackChunkName: "hot" */ '../views/IndexConfig.vue') 29 | }, 30 | { 31 | path: '/new', 32 | name: 'new', 33 | component: () => import(/* webpackChunkName: "new" */ '../views/IndexConfig.vue') 34 | }, 35 | { 36 | path: '/recommend', 37 | name: 'recommend', 38 | component: () => import(/* webpackChunkName: "recommend" */ '../views/IndexConfig.vue') 39 | }, 40 | { 41 | path: '/category', 42 | name: 'category', 43 | component: () => import(/* webpackChunkName: "category" */ '../views/Category.vue'), 44 | children: [ 45 | { 46 | path: '/category/level2', 47 | name: 'level2', 48 | component: () => import(/* webpackChunkName: "level2" */ '../views/Category.vue'), 49 | }, 50 | { 51 | path: '/category/level3', 52 | name: 'level3', 53 | component: () => import(/* webpackChunkName: "level3" */ '../views/Category.vue'), 54 | } 55 | ] 56 | }, 57 | { 58 | path: '/good', 59 | name: 'good', 60 | component: () => import(/* webpackChunkName: "new" */ '../views/Good.vue') 61 | }, 62 | { 63 | path: '/guest', 64 | name: 'guest', 65 | component: () => import(/* webpackChunkName: "guest" */ '../views/Guest.vue') 66 | }, 67 | { 68 | path: '/order', 69 | name: 'order', 70 | component: () => import(/* webpackChunkName: "order" */ '../views/Order.vue') 71 | }, 72 | { 73 | path: '/order_detail', 74 | name: 'order_detail', 75 | component: () => import(/* webpackChunkName: "order_detail" */ '../views/OrderDetail.vue') 76 | }, 77 | { 78 | path: '/account', 79 | name: 'account', 80 | component: () => import(/* webpackChunkName: "account" */ '../views/Account.vue') 81 | } 82 | ] 83 | }) 84 | 85 | export default router -------------------------------------------------------------------------------- /my-mall-admin/src/main.js: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import { ElButton, ElContainer, ElAside, ElHeader, ElMain, ElFooter, ElMenu, ElSubmenu, ElMenuItemGroup, ElMenuItem, ElForm, ElFormItem, ElInput, ElPopover, ElTag, ElCard, ElTable, ElTableColumn, ElPagination, ElDialog, ElPopconfirm, ElUpload, ElLoading, ElSelect, ElOption, ElRadioGroup, ElRadio, ElCascader, ElCheckbox, ElInputNumber } from 'element-plus' 3 | import * as Sentry from "@sentry/browser"; 4 | import { Integrations } from "@sentry/tracing"; 5 | import App from './App.vue' 6 | import router from './router/index' 7 | 8 | // import 'element-plus/lib/theme-chalk/index.css' 9 | 10 | // 修改后的主题样式必须放在最后面 11 | import '../theme/index.css' 12 | 13 | const orderStatus = { 14 | 0: '待支付', 15 | 1: '已支付', 16 | 2: '配货完成', 17 | 3: '出库成功', 18 | 4: '交易成功', 19 | '-1': '手动关闭', 20 | '-2': '超时关闭', 21 | '-3': '商家关闭' 22 | } 23 | 24 | const app = createApp(App) 25 | // 全局过滤器 26 | app.config.globalProperties.$filters = { 27 | orderMap(status) { 28 | return orderStatus[status] || '未知状态' 29 | }, 30 | prefix(url) { 31 | if (url && url.startsWith('http')) { 32 | return url 33 | } else { 34 | url = `http://localhost:8008${url}` 35 | return url 36 | } 37 | }, 38 | resetImgUrl(imgObj, imgSrc, maxErrorNum) { 39 | if (maxErrorNum > 0) { 40 | imgObj.onerror = function() { 41 | resetImgUrl(imgObj, imgSrc, maxErrorNum - 1) 42 | } 43 | setTimeout(function() { 44 | imgObj.src = imgSrc 45 | }, 500) 46 | } else { 47 | imgObj.onerror = null 48 | imgObj.src = imgSrc 49 | } 50 | } 51 | } 52 | 53 | app.use(router) 54 | 55 | app.use(ElButton) 56 | .use(ElContainer) 57 | .use(ElAside) 58 | .use(ElHeader) 59 | .use(ElMain) 60 | .use(ElFooter) 61 | .use(ElMenu) 62 | .use(ElSubmenu) 63 | .use(ElMenuItemGroup) 64 | .use(ElMenuItem) 65 | .use(ElForm) 66 | .use(ElFormItem) 67 | .use(ElInput) 68 | .use(ElPopover) 69 | .use(ElTag) 70 | .use(ElCard) 71 | .use(ElTable) 72 | .use(ElTableColumn) 73 | .use(ElPagination) 74 | .use(ElDialog) 75 | .use(ElPopconfirm) 76 | .use(ElUpload) 77 | .use(ElLoading) 78 | .use(ElSelect) 79 | .use(ElOption) 80 | .use(ElRadioGroup) 81 | .use(ElRadio) 82 | .use(ElCascader) 83 | .use(ElCheckbox) 84 | .use(ElInputNumber) 85 | 86 | Sentry.init({ 87 | dsn: "https://f866b695d21d467ba523f1adf14e0a24@o584908.ingest.sentry.io/5737358", 88 | integrations: [new Integrations.BrowserTracing()], 89 | 90 | // Set tracesSampleRate to 1.0 to capture 100% 91 | // of transactions for performance monitoring. 92 | // We recommend adjusting this value in production 93 | tracesSampleRate: 1.0, 94 | }); 95 | 96 | app.mount('#app') -------------------------------------------------------------------------------- /my-mall-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | jar 7 | ltd.newbee.mall 8 | newbee-mall-api 9 | 3.0.0-SNAPSHOT 10 | newbee-mall-api 11 | NEWBEE商城 API 12 | 13 | 14 | org.springframework.boot 15 | spring-boot-starter-parent 16 | 2.6.3 17 | 18 | 19 | 20 | 21 | UTF-8 22 | UTF-8 23 | 1.8 24 | 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-web 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-starter-validation 34 | 35 | 36 | org.mybatis.spring.boot 37 | mybatis-spring-boot-starter 38 | 2.2.2 39 | 40 | 41 | 42 | org.projectlombok 43 | lombok 44 | 1.18.16 45 | provided 46 | 47 | 48 | 49 | io.springfox 50 | springfox-boot-starter 51 | 3.0.0 52 | 53 | 54 | 55 | mysql 56 | mysql-connector-java 57 | runtime 58 | 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-starter-test 63 | test 64 | 65 | 66 | 67 | 68 | 69 | 70 | org.springframework.boot 71 | spring-boot-maven-plugin 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /my-mall-admin/theme/element-variables.css: -------------------------------------------------------------------------------- 1 | /* Element Chalk Variables */ 2 | /* Transition 3 | -------------------------- */ 4 | /* Color 5 | -------------------------- */ 6 | /* 53a8ff */ 7 | /* 66b1ff */ 8 | /* 79bbff */ 9 | /* 8cc5ff */ 10 | /* a0cfff */ 11 | /* b3d8ff */ 12 | /* c6e2ff */ 13 | /* d9ecff */ 14 | /* ecf5ff */ 15 | /* Link 16 | -------------------------- */ 17 | /* Border 18 | -------------------------- */ 19 | /* Fill 20 | -------------------------- */ 21 | /* Typography 22 | -------------------------- */ 23 | /* Size 24 | -------------------------- */ 25 | /* z-index 26 | -------------------------- */ 27 | /* Disable base 28 | -------------------------- */ 29 | /* Icon 30 | -------------------------- */ 31 | /* Checkbox 32 | -------------------------- */ 33 | /* Radio 34 | -------------------------- */ 35 | /* Select 36 | -------------------------- */ 37 | /* Alert 38 | -------------------------- */ 39 | /* MessageBox 40 | -------------------------- */ 41 | /* Message 42 | -------------------------- */ 43 | /* Notification 44 | -------------------------- */ 45 | /* Input 46 | -------------------------- */ 47 | /* Cascader 48 | -------------------------- */ 49 | /* Group 50 | -------------------------- */ 51 | /* Tab 52 | -------------------------- */ 53 | /* Button 54 | -------------------------- */ 55 | /* cascader 56 | -------------------------- */ 57 | /* Switch 58 | -------------------------- */ 59 | /* Dialog 60 | -------------------------- */ 61 | /* Table 62 | -------------------------- */ 63 | /* Pagination 64 | -------------------------- */ 65 | /* Popup 66 | -------------------------- */ 67 | /* Popover 68 | -------------------------- */ 69 | /* Tooltip 70 | -------------------------- */ 71 | /* Tag 72 | -------------------------- */ 73 | /* Tree 74 | -------------------------- */ 75 | /* Dropdown 76 | -------------------------- */ 77 | /* Badge 78 | -------------------------- */ 79 | /* Card 80 | --------------------------*/ 81 | /* Slider 82 | --------------------------*/ 83 | /* Steps 84 | --------------------------*/ 85 | /* Menu 86 | --------------------------*/ 87 | /* Rate 88 | --------------------------*/ 89 | /* DatePicker 90 | --------------------------*/ 91 | /* Loading 92 | --------------------------*/ 93 | /* Scrollbar 94 | --------------------------*/ 95 | /* Carousel 96 | --------------------------*/ 97 | /* Collapse 98 | --------------------------*/ 99 | /* Transfer 100 | --------------------------*/ 101 | /* Header 102 | --------------------------*/ 103 | /* Footer 104 | --------------------------*/ 105 | /* Main 106 | --------------------------*/ 107 | /* Timeline 108 | --------------------------*/ 109 | /* Backtop 110 | --------------------------*/ 111 | /* Link 112 | --------------------------*/ 113 | /* Calendar 114 | --------------------------*/ 115 | /* Form 116 | -------------------------- */ 117 | /* Avatar 118 | --------------------------*/ 119 | /* Break-point 120 | --------------------------*/ 121 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/impl/NewBeeMallCarouselServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.service.impl; 2 | 3 | import com.my.mall.api.mall.vo.IndexCarouselVO; 4 | import com.my.mall.common.ServiceResultEnum; 5 | import com.my.mall.dao.CarouselMapper; 6 | import com.my.mall.entity.Carousel; 7 | import com.my.mall.util.BeanUtil; 8 | import com.my.mall.util.PageQueryUtil; 9 | import com.my.mall.util.PageResult; 10 | import com.my.mall.service.NewBeeMallCarouselService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.util.CollectionUtils; 14 | 15 | import java.util.ArrayList; 16 | import java.util.Date; 17 | import java.util.List; 18 | 19 | @Service 20 | public class NewBeeMallCarouselServiceImpl implements NewBeeMallCarouselService { 21 | 22 | @Autowired 23 | private CarouselMapper carouselMapper; 24 | 25 | 26 | @Override 27 | public PageResult getCarouselPage(PageQueryUtil pageUtil) { 28 | List carousels = carouselMapper.findCarouselList(pageUtil); 29 | int total = carouselMapper.getTotalCarousels(pageUtil); 30 | PageResult pageResult = new PageResult(carousels, total, pageUtil.getLimit(), pageUtil.getPage()); 31 | return pageResult; 32 | } 33 | 34 | @Override 35 | public String saveCarousel(Carousel carousel) { 36 | if (carouselMapper.insertSelective(carousel) > 0) { 37 | return ServiceResultEnum.SUCCESS.getResult(); 38 | } 39 | return ServiceResultEnum.DB_ERROR.getResult(); 40 | } 41 | 42 | @Override 43 | public String updateCarousel(Carousel carousel) { 44 | Carousel temp = carouselMapper.selectByPrimaryKey(carousel.getCarouselId()); 45 | if (temp == null) { 46 | return ServiceResultEnum.DATA_NOT_EXIST.getResult(); 47 | } 48 | temp.setCarouselRank(carousel.getCarouselRank()); 49 | temp.setRedirectUrl(carousel.getRedirectUrl()); 50 | temp.setCarouselUrl(carousel.getCarouselUrl()); 51 | temp.setUpdateTime(new Date()); 52 | if (carouselMapper.updateByPrimaryKeySelective(temp) > 0) { 53 | return ServiceResultEnum.SUCCESS.getResult(); 54 | } 55 | return ServiceResultEnum.DB_ERROR.getResult(); 56 | } 57 | 58 | @Override 59 | public Carousel getCarouselById(Integer id) { 60 | return carouselMapper.selectByPrimaryKey(id); 61 | } 62 | 63 | @Override 64 | public Boolean deleteBatch(Long[] ids) { 65 | if (ids.length < 1) { 66 | return false; 67 | } 68 | //删除数据 69 | return carouselMapper.deleteBatch(ids) > 0; 70 | } 71 | 72 | @Override 73 | public List getCarouselsForIndex(int number) { 74 | List newBeeMallIndexCarouselVOS = new ArrayList<>(number); 75 | List carousels = carouselMapper.findCarouselsByNum(number); 76 | if (!CollectionUtils.isEmpty(carousels)) { 77 | newBeeMallIndexCarouselVOS = BeanUtil.copyList(carousels, IndexCarouselVO.class); 78 | } 79 | return newBeeMallIndexCarouselVOS; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/api/admin/AdminRegisteUserAPI.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.api.admin; 3 | 4 | import com.my.mall.api.admin.param.BatchIdParam; 5 | import com.my.mall.config.annotation.TokenToAdminUser; 6 | import com.my.mall.entity.AdminUserToken; 7 | import com.my.mall.util.PageQueryUtil; 8 | import com.my.mall.util.Result; 9 | import com.my.mall.util.ResultGenerator; 10 | import io.swagger.annotations.Api; 11 | import io.swagger.annotations.ApiOperation; 12 | import io.swagger.annotations.ApiParam; 13 | import com.my.mall.service.NewBeeMallUserService; 14 | import org.slf4j.Logger; 15 | import org.slf4j.LoggerFactory; 16 | import org.springframework.web.bind.annotation.*; 17 | 18 | import javax.annotation.Resource; 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | 23 | @RestController 24 | @Api(value = "v1", tags = "8-6.后台管理系统注册用户模块接口") 25 | @RequestMapping("/manage-api/v1") 26 | public class AdminRegisteUserAPI { 27 | 28 | private static final Logger logger = LoggerFactory.getLogger(AdminRegisteUserAPI.class); 29 | 30 | @Resource 31 | private NewBeeMallUserService newBeeMallUserService; 32 | 33 | /** 34 | * 列表 35 | */ 36 | @RequestMapping(value = "/users", method = RequestMethod.GET) 37 | @ApiOperation(value = "商城注册用户列表", notes = "商城注册用户列表") 38 | public Result list(@RequestParam(required = false) @ApiParam(value = "页码") Integer pageNumber, 39 | @RequestParam(required = false) @ApiParam(value = "每页条数") Integer pageSize, 40 | @RequestParam(required = false) @ApiParam(value = "用户状态") Integer lockStatus, @TokenToAdminUser AdminUserToken adminUser) { 41 | logger.info("adminUser:{}", adminUser.toString()); 42 | if (pageNumber == null || pageNumber < 1 || pageSize == null || pageSize < 10) { 43 | return ResultGenerator.genFailResult("参数异常!"); 44 | } 45 | Map params = new HashMap(8); 46 | params.put("page", pageNumber); 47 | params.put("limit", pageSize); 48 | if (lockStatus != null) { 49 | params.put("orderStatus", lockStatus); 50 | } 51 | PageQueryUtil pageUtil = new PageQueryUtil(params); 52 | return ResultGenerator.genSuccessResult(newBeeMallUserService.getNewBeeMallUsersPage(pageUtil)); 53 | } 54 | 55 | /** 56 | * 用户禁用与解除禁用(0-未锁定 1-已锁定) 57 | */ 58 | @RequestMapping(value = "/users/{lockStatus}", method = RequestMethod.PUT) 59 | @ApiOperation(value = "修改用户状态", notes = "批量修改,用户禁用与解除禁用(0-未锁定 1-已锁定)") 60 | public Result lockUser(@RequestBody BatchIdParam batchIdParam, @PathVariable int lockStatus, @TokenToAdminUser AdminUserToken adminUser) { 61 | logger.info("adminUser:{}", adminUser.toString()); 62 | if (batchIdParam==null||batchIdParam.getIds().length < 1) { 63 | return ResultGenerator.genFailResult("参数异常!"); 64 | } 65 | if (lockStatus != 0 && lockStatus != 1) { 66 | return ResultGenerator.genFailResult("操作非法!"); 67 | } 68 | if (newBeeMallUserService.lockUsers(batchIdParam.getIds(), lockStatus)) { 69 | return ResultGenerator.genSuccessResult(); 70 | } else { 71 | return ResultGenerator.genFailResult("禁用失败"); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /my-mall-admin/theme/aside.css: -------------------------------------------------------------------------------- 1 | /* BEM support Func 2 | -------------------------- */ 3 | /* Element Chalk Variables */ 4 | /* Transition 5 | -------------------------- */ 6 | /* Color 7 | -------------------------- */ 8 | /* 53a8ff */ 9 | /* 66b1ff */ 10 | /* 79bbff */ 11 | /* 8cc5ff */ 12 | /* a0cfff */ 13 | /* b3d8ff */ 14 | /* c6e2ff */ 15 | /* d9ecff */ 16 | /* ecf5ff */ 17 | /* Link 18 | -------------------------- */ 19 | /* Border 20 | -------------------------- */ 21 | /* Fill 22 | -------------------------- */ 23 | /* Typography 24 | -------------------------- */ 25 | /* Size 26 | -------------------------- */ 27 | /* z-index 28 | -------------------------- */ 29 | /* Disable base 30 | -------------------------- */ 31 | /* Icon 32 | -------------------------- */ 33 | /* Checkbox 34 | -------------------------- */ 35 | /* Radio 36 | -------------------------- */ 37 | /* Select 38 | -------------------------- */ 39 | /* Alert 40 | -------------------------- */ 41 | /* MessageBox 42 | -------------------------- */ 43 | /* Message 44 | -------------------------- */ 45 | /* Notification 46 | -------------------------- */ 47 | /* Input 48 | -------------------------- */ 49 | /* Cascader 50 | -------------------------- */ 51 | /* Group 52 | -------------------------- */ 53 | /* Tab 54 | -------------------------- */ 55 | /* Button 56 | -------------------------- */ 57 | /* cascader 58 | -------------------------- */ 59 | /* Switch 60 | -------------------------- */ 61 | /* Dialog 62 | -------------------------- */ 63 | /* Table 64 | -------------------------- */ 65 | /* Pagination 66 | -------------------------- */ 67 | /* Popup 68 | -------------------------- */ 69 | /* Popover 70 | -------------------------- */ 71 | /* Tooltip 72 | -------------------------- */ 73 | /* Tag 74 | -------------------------- */ 75 | /* Tree 76 | -------------------------- */ 77 | /* Dropdown 78 | -------------------------- */ 79 | /* Badge 80 | -------------------------- */ 81 | /* Card 82 | --------------------------*/ 83 | /* Slider 84 | --------------------------*/ 85 | /* Steps 86 | --------------------------*/ 87 | /* Menu 88 | --------------------------*/ 89 | /* Rate 90 | --------------------------*/ 91 | /* DatePicker 92 | --------------------------*/ 93 | /* Loading 94 | --------------------------*/ 95 | /* Scrollbar 96 | --------------------------*/ 97 | /* Carousel 98 | --------------------------*/ 99 | /* Collapse 100 | --------------------------*/ 101 | /* Transfer 102 | --------------------------*/ 103 | /* Header 104 | --------------------------*/ 105 | /* Footer 106 | --------------------------*/ 107 | /* Main 108 | --------------------------*/ 109 | /* Timeline 110 | --------------------------*/ 111 | /* Backtop 112 | --------------------------*/ 113 | /* Link 114 | --------------------------*/ 115 | /* Calendar 116 | --------------------------*/ 117 | /* Form 118 | -------------------------- */ 119 | /* Avatar 120 | --------------------------*/ 121 | /* Break-point 122 | --------------------------*/ 123 | /* Break-points 124 | -------------------------- */ 125 | /* Scrollbar 126 | -------------------------- */ 127 | /* Placeholder 128 | -------------------------- */ 129 | /* BEM 130 | -------------------------- */ 131 | .el-aside { 132 | overflow: auto; 133 | -webkit-box-sizing: border-box; 134 | box-sizing: border-box; 135 | -ms-flex-negative: 0; 136 | flex-shrink: 0; } 137 | -------------------------------------------------------------------------------- /my-mall-front/src/router/index.js: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHashHistory } from 'vue-router' 2 | 3 | const router = createRouter({ 4 | history: createWebHashHistory(), // hash模式:createWebHashHistory,history模式:createWebHistory 5 | routes: [ 6 | { 7 | path: '/', 8 | redirect: '/home' 9 | }, 10 | { 11 | path: '/home', 12 | name: 'home', 13 | component: () => import(/* webpackChunkName: "home" */ '@/views/Home.vue'), 14 | meta: { 15 | index: 1 16 | } 17 | }, 18 | { 19 | path: '/login', 20 | name: 'login', 21 | component: () => import(/* webpackChunkName: "login" */ '@/views/Login.vue'), 22 | meta: { 23 | index: 1 24 | } 25 | }, 26 | { 27 | path: '/about', 28 | name: 'about', 29 | component: () => import(/* webpackChunkName: "about" */ '@/views/About.vue'), 30 | meta: { 31 | index: 2 32 | } 33 | }, 34 | { 35 | path: '/category', 36 | name: 'category', 37 | component: () => import(/* webpackChunkName: "category" */ '@/views/Category.vue'), 38 | meta: { 39 | index: 1 40 | } 41 | }, 42 | { 43 | path: '/product-list', 44 | name: 'product-list', 45 | component: () => import(/* webpackChunkName: "product-list" */ '@/views/ProductList.vue'), 46 | meta: { 47 | index: 2 48 | } 49 | }, 50 | { 51 | path: '/product/:id', 52 | name: 'product', 53 | component: () => import(/* webpackChunkName: "product" */ '@/views/ProductDetail.vue'), 54 | meta: { 55 | index: 3 56 | } 57 | }, 58 | { 59 | path: '/cart', 60 | name: 'cart', 61 | component: () => import(/* webpackChunkName: "cart" */ '@/views/Cart.vue'), 62 | meta: { 63 | index: 1 64 | } 65 | }, 66 | { 67 | path: '/create-order', 68 | name: 'create-order', 69 | component: () => import(/* webpackChunkName: "create-order" */ '@/views/CreateOrder.vue'), 70 | meta: { 71 | index: 2 72 | } 73 | }, 74 | { 75 | path: '/order', 76 | name: 'order', 77 | component: () => import(/* webpackChunkName: "order" */ '@/views/Order.vue'), 78 | meta: { 79 | index: 2 80 | } 81 | }, 82 | { 83 | path: '/order-detail', 84 | name: 'order-detail', 85 | component: () => import(/* webpackChunkName: "order-detail" */ '@/views/OrderDetail.vue'), 86 | meta: { 87 | index: 3 88 | } 89 | }, 90 | { 91 | path: '/user', 92 | name: 'user', 93 | component: () => import(/* webpackChunkName: "user" */ '@/views/User.vue'), 94 | meta: { 95 | index: 1 96 | } 97 | }, 98 | { 99 | path: '/setting', 100 | name: 'setting', 101 | component: () => import(/* webpackChunkName: "setting" */ '@/views/Setting.vue'), 102 | meta: { 103 | index: 2 104 | } 105 | }, 106 | { 107 | path: '/address', 108 | name: 'address', 109 | component: () => import(/* webpackChunkName: "address" */ '@/views/Address.vue'), 110 | meta: { 111 | index: 2 112 | } 113 | }, 114 | { 115 | path: '/address-edit', 116 | name: 'address-edit', 117 | component: () => import(/* webpackChunkName: "address-edit" */ '@/views/AddressEdit.vue'), 118 | meta: { 119 | index: 3 120 | } 121 | }, 122 | ] 123 | }) 124 | 125 | export default router -------------------------------------------------------------------------------- /my-mall-admin/src/components/Header.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 81 | 82 | 106 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/util/BeanUtil.java: -------------------------------------------------------------------------------- 1 | package com.my.mall.util; 2 | 3 | import org.springframework.beans.BeanUtils; 4 | import org.springframework.beans.BeanWrapper; 5 | import org.springframework.beans.BeanWrapperImpl; 6 | import org.springframework.beans.PropertyAccessorFactory; 7 | 8 | import java.beans.PropertyDescriptor; 9 | import java.lang.reflect.Field; 10 | import java.util.*; 11 | 12 | public abstract class BeanUtil { 13 | 14 | public static Object copyProperties(Object source, Object target, String... ignoreProperties) { 15 | if (source == null) { 16 | return target; 17 | } 18 | BeanUtils.copyProperties(source, target, ignoreProperties); 19 | return target; 20 | } 21 | 22 | public static List copyList(List sources, Class clazz) { 23 | return copyList(sources, clazz, null); 24 | } 25 | 26 | public static List copyList(List sources, Class clazz, Callback callback) { 27 | List targetList = new ArrayList<>(); 28 | if (sources != null) { 29 | try { 30 | for (Object source : sources) { 31 | T target = clazz.newInstance(); 32 | copyProperties(source, target); 33 | if (callback != null) { 34 | callback.set(source, target); 35 | } 36 | targetList.add(target); 37 | } 38 | } catch (InstantiationException e) { 39 | e.printStackTrace(); 40 | } catch (IllegalAccessException e) { 41 | e.printStackTrace(); 42 | } 43 | } 44 | return targetList; 45 | } 46 | 47 | public static Map toMap(Object bean, String... ignoreProperties) { 48 | Map map = new LinkedHashMap<>(); 49 | List ignoreList = new ArrayList<>(Arrays.asList(ignoreProperties)); 50 | ignoreList.add("class"); 51 | BeanWrapper beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(bean); 52 | for (PropertyDescriptor pd : beanWrapper.getPropertyDescriptors()) { 53 | if (!ignoreList.contains(pd.getName()) && beanWrapper.isReadableProperty(pd.getName())) { 54 | Object propertyValue = beanWrapper.getPropertyValue(pd.getName()); 55 | map.put(pd.getName(), propertyValue); 56 | } 57 | } 58 | return map; 59 | } 60 | 61 | public static T toBean(Map map, Class beanType) { 62 | BeanWrapper beanWrapper = new BeanWrapperImpl(beanType); 63 | map.forEach((key, value) -> { 64 | if (beanWrapper.isWritableProperty(key)) { 65 | beanWrapper.setPropertyValue(key, value); 66 | } 67 | }); 68 | return (T) beanWrapper.getWrappedInstance(); 69 | } 70 | 71 | public static interface Callback { 72 | void set(Object source, T target); 73 | } 74 | 75 | //检查Pojo对象是否有null字段 76 | public static boolean checkPojoNullField(Object o, Class clz) { 77 | try { 78 | Field[] fields = clz.getDeclaredFields(); 79 | for (Field field : fields) { 80 | field.setAccessible(true); 81 | if (field.get(o) == null) { 82 | return false; 83 | } 84 | } 85 | if (clz.getSuperclass() != Object.class) { 86 | return checkPojoNullField(o, clz.getSuperclass()); 87 | } 88 | return true; 89 | } catch (IllegalAccessException e) { 90 | return false; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /my-mall-api/src/main/resources/mapper/NewBeeMallUserTokenMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | user_id, token, update_time, expire_time 13 | 14 | 20 | 26 | 27 | delete from tb_newbee_mall_user_token 28 | where user_id = #{userId,jdbcType=BIGINT} 29 | 30 | 31 | insert into tb_newbee_mall_user_token (user_id, token, update_time, 32 | expire_time) 33 | values (#{userId,jdbcType=BIGINT}, #{token,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 34 | #{expireTime,jdbcType=TIMESTAMP}) 35 | 36 | 37 | insert into tb_newbee_mall_user_token 38 | 39 | 40 | user_id, 41 | 42 | 43 | token, 44 | 45 | 46 | update_time, 47 | 48 | 49 | expire_time, 50 | 51 | 52 | 53 | 54 | #{userId,jdbcType=BIGINT}, 55 | 56 | 57 | #{token,jdbcType=VARCHAR}, 58 | 59 | 60 | #{updateTime,jdbcType=TIMESTAMP}, 61 | 62 | 63 | #{expireTime,jdbcType=TIMESTAMP}, 64 | 65 | 66 | 67 | 68 | update tb_newbee_mall_user_token 69 | 70 | 71 | token = #{token,jdbcType=VARCHAR}, 72 | 73 | 74 | update_time = #{updateTime,jdbcType=TIMESTAMP}, 75 | 76 | 77 | expire_time = #{expireTime,jdbcType=TIMESTAMP}, 78 | 79 | 80 | where user_id = #{userId,jdbcType=BIGINT} 81 | 82 | 83 | update tb_newbee_mall_user_token 84 | set token = #{token,jdbcType=VARCHAR}, 85 | update_time = #{updateTime,jdbcType=TIMESTAMP}, 86 | expire_time = #{expireTime,jdbcType=TIMESTAMP} 87 | where user_id = #{userId,jdbcType=BIGINT} 88 | 89 | 90 | -------------------------------------------------------------------------------- /my-mall-admin/theme/steps.css: -------------------------------------------------------------------------------- 1 | /* BEM support Func 2 | -------------------------- */ 3 | /* Element Chalk Variables */ 4 | /* Transition 5 | -------------------------- */ 6 | /* Color 7 | -------------------------- */ 8 | /* 53a8ff */ 9 | /* 66b1ff */ 10 | /* 79bbff */ 11 | /* 8cc5ff */ 12 | /* a0cfff */ 13 | /* b3d8ff */ 14 | /* c6e2ff */ 15 | /* d9ecff */ 16 | /* ecf5ff */ 17 | /* Link 18 | -------------------------- */ 19 | /* Border 20 | -------------------------- */ 21 | /* Fill 22 | -------------------------- */ 23 | /* Typography 24 | -------------------------- */ 25 | /* Size 26 | -------------------------- */ 27 | /* z-index 28 | -------------------------- */ 29 | /* Disable base 30 | -------------------------- */ 31 | /* Icon 32 | -------------------------- */ 33 | /* Checkbox 34 | -------------------------- */ 35 | /* Radio 36 | -------------------------- */ 37 | /* Select 38 | -------------------------- */ 39 | /* Alert 40 | -------------------------- */ 41 | /* MessageBox 42 | -------------------------- */ 43 | /* Message 44 | -------------------------- */ 45 | /* Notification 46 | -------------------------- */ 47 | /* Input 48 | -------------------------- */ 49 | /* Cascader 50 | -------------------------- */ 51 | /* Group 52 | -------------------------- */ 53 | /* Tab 54 | -------------------------- */ 55 | /* Button 56 | -------------------------- */ 57 | /* cascader 58 | -------------------------- */ 59 | /* Switch 60 | -------------------------- */ 61 | /* Dialog 62 | -------------------------- */ 63 | /* Table 64 | -------------------------- */ 65 | /* Pagination 66 | -------------------------- */ 67 | /* Popup 68 | -------------------------- */ 69 | /* Popover 70 | -------------------------- */ 71 | /* Tooltip 72 | -------------------------- */ 73 | /* Tag 74 | -------------------------- */ 75 | /* Tree 76 | -------------------------- */ 77 | /* Dropdown 78 | -------------------------- */ 79 | /* Badge 80 | -------------------------- */ 81 | /* Card 82 | --------------------------*/ 83 | /* Slider 84 | --------------------------*/ 85 | /* Steps 86 | --------------------------*/ 87 | /* Menu 88 | --------------------------*/ 89 | /* Rate 90 | --------------------------*/ 91 | /* DatePicker 92 | --------------------------*/ 93 | /* Loading 94 | --------------------------*/ 95 | /* Scrollbar 96 | --------------------------*/ 97 | /* Carousel 98 | --------------------------*/ 99 | /* Collapse 100 | --------------------------*/ 101 | /* Transfer 102 | --------------------------*/ 103 | /* Header 104 | --------------------------*/ 105 | /* Footer 106 | --------------------------*/ 107 | /* Main 108 | --------------------------*/ 109 | /* Timeline 110 | --------------------------*/ 111 | /* Backtop 112 | --------------------------*/ 113 | /* Link 114 | --------------------------*/ 115 | /* Calendar 116 | --------------------------*/ 117 | /* Form 118 | -------------------------- */ 119 | /* Avatar 120 | --------------------------*/ 121 | /* Break-point 122 | --------------------------*/ 123 | /* Break-points 124 | -------------------------- */ 125 | /* Scrollbar 126 | -------------------------- */ 127 | /* Placeholder 128 | -------------------------- */ 129 | /* BEM 130 | -------------------------- */ 131 | .el-steps { 132 | display: -webkit-box; 133 | display: -ms-flexbox; 134 | display: flex; } 135 | .el-steps--simple { 136 | padding: 13px 8%; 137 | border-radius: 4px; 138 | background: #F5F7FA; } 139 | .el-steps--horizontal { 140 | white-space: nowrap; } 141 | .el-steps--vertical { 142 | height: 100%; 143 | -webkit-box-orient: vertical; 144 | -webkit-box-direction: normal; 145 | -ms-flex-flow: column; 146 | flex-flow: column; } 147 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/config/handler/TokenToMallUserMethodArgumentResolver.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.config.handler; 3 | 4 | import com.my.mall.config.annotation.TokenToMallUser; 5 | import com.my.mall.entity.MallUser; 6 | import com.my.mall.entity.MallUserToken; 7 | import com.my.mall.common.Constants; 8 | import com.my.mall.common.NewBeeMallException; 9 | import com.my.mall.common.ServiceResultEnum; 10 | import com.my.mall.dao.MallUserMapper; 11 | import com.my.mall.dao.NewBeeMallUserTokenMapper; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.core.MethodParameter; 14 | import org.springframework.stereotype.Component; 15 | import org.springframework.web.bind.support.WebDataBinderFactory; 16 | import org.springframework.web.context.request.NativeWebRequest; 17 | import org.springframework.web.method.support.HandlerMethodArgumentResolver; 18 | import org.springframework.web.method.support.ModelAndViewContainer; 19 | 20 | import javax.servlet.http.HttpServletRequest; 21 | import java.io.IOException; 22 | 23 | @Component 24 | public class TokenToMallUserMethodArgumentResolver implements HandlerMethodArgumentResolver { 25 | 26 | @Autowired 27 | private MallUserMapper mallUserMapper; 28 | @Autowired 29 | private NewBeeMallUserTokenMapper newBeeMallUserTokenMapper; 30 | 31 | public TokenToMallUserMethodArgumentResolver() { 32 | } 33 | 34 | public boolean supportsParameter(MethodParameter parameter) { 35 | if (parameter.hasParameterAnnotation(TokenToMallUser.class)) { 36 | return true; 37 | } 38 | return false; 39 | } 40 | 41 | public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) { 42 | if (parameter.getParameterAnnotation(TokenToMallUser.class) instanceof TokenToMallUser) { 43 | MallUser mallUser = null; 44 | String token = webRequest.getHeader("token"); 45 | if (null != token && !"".equals(token) && token.length() == Constants.TOKEN_LENGTH) { 46 | MallUserToken mallUserToken = newBeeMallUserTokenMapper.selectByToken(token); 47 | if (mallUserToken == null || mallUserToken.getExpireTime().getTime() <= System.currentTimeMillis()) { 48 | NewBeeMallException.fail(ServiceResultEnum.TOKEN_EXPIRE_ERROR.getResult()); 49 | } 50 | mallUser = mallUserMapper.selectByPrimaryKey(mallUserToken.getUserId()); 51 | if (mallUser == null) { 52 | NewBeeMallException.fail(ServiceResultEnum.USER_NULL_ERROR.getResult()); 53 | } 54 | if (mallUser.getLockedFlag().intValue() == 1) { 55 | NewBeeMallException.fail(ServiceResultEnum.LOGIN_USER_LOCKED_ERROR.getResult()); 56 | } 57 | return mallUser; 58 | } else { 59 | NewBeeMallException.fail(ServiceResultEnum.NOT_LOGIN_ERROR.getResult()); 60 | } 61 | } 62 | return null; 63 | } 64 | 65 | public static byte[] getRequestPostBytes(HttpServletRequest request) 66 | throws IOException { 67 | int contentLength = request.getContentLength(); 68 | if (contentLength < 0) { 69 | return null; 70 | } 71 | byte buffer[] = new byte[contentLength]; 72 | for (int i = 0; i < contentLength; ) { 73 | int readlen = request.getInputStream().read(buffer, i, 74 | contentLength - i); 75 | if (readlen == -1) { 76 | break; 77 | } 78 | i += readlen; 79 | } 80 | return buffer; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /my-mall-api/src/main/resources/mapper/NewBeeAdminUserTokenMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | admin_user_id, token, update_time, expire_time 13 | 14 | 20 | 26 | 27 | delete from tb_newbee_mall_admin_user_token 28 | where admin_user_id = #{adminUserId,jdbcType=BIGINT} 29 | 30 | 31 | insert into tb_newbee_mall_admin_user_token (admin_user_id, token, update_time, 32 | expire_time) 33 | values (#{adminUserId,jdbcType=BIGINT}, #{token,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 34 | #{expireTime,jdbcType=TIMESTAMP}) 35 | 36 | 37 | insert into tb_newbee_mall_admin_user_token 38 | 39 | 40 | admin_user_id, 41 | 42 | 43 | token, 44 | 45 | 46 | update_time, 47 | 48 | 49 | expire_time, 50 | 51 | 52 | 53 | 54 | #{adminUserId,jdbcType=BIGINT}, 55 | 56 | 57 | #{token,jdbcType=VARCHAR}, 58 | 59 | 60 | #{updateTime,jdbcType=TIMESTAMP}, 61 | 62 | 63 | #{expireTime,jdbcType=TIMESTAMP}, 64 | 65 | 66 | 67 | 68 | update tb_newbee_mall_admin_user_token 69 | 70 | 71 | token = #{token,jdbcType=VARCHAR}, 72 | 73 | 74 | update_time = #{updateTime,jdbcType=TIMESTAMP}, 75 | 76 | 77 | expire_time = #{expireTime,jdbcType=TIMESTAMP}, 78 | 79 | 80 | where admin_user_id = #{adminUserId,jdbcType=BIGINT} 81 | 82 | 83 | update tb_newbee_mall_admin_user_token 84 | set token = #{token,jdbcType=VARCHAR}, 85 | update_time = #{updateTime,jdbcType=TIMESTAMP}, 86 | expire_time = #{expireTime,jdbcType=TIMESTAMP} 87 | where admin_user_id = #{adminUserId,jdbcType=BIGINT} 88 | 89 | 90 | -------------------------------------------------------------------------------- /my-mall-admin/src/views/Account.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 108 | 109 | -------------------------------------------------------------------------------- /my-mall-admin/theme/container.css: -------------------------------------------------------------------------------- 1 | /* BEM support Func 2 | -------------------------- */ 3 | /* Element Chalk Variables */ 4 | /* Transition 5 | -------------------------- */ 6 | /* Color 7 | -------------------------- */ 8 | /* 53a8ff */ 9 | /* 66b1ff */ 10 | /* 79bbff */ 11 | /* 8cc5ff */ 12 | /* a0cfff */ 13 | /* b3d8ff */ 14 | /* c6e2ff */ 15 | /* d9ecff */ 16 | /* ecf5ff */ 17 | /* Link 18 | -------------------------- */ 19 | /* Border 20 | -------------------------- */ 21 | /* Fill 22 | -------------------------- */ 23 | /* Typography 24 | -------------------------- */ 25 | /* Size 26 | -------------------------- */ 27 | /* z-index 28 | -------------------------- */ 29 | /* Disable base 30 | -------------------------- */ 31 | /* Icon 32 | -------------------------- */ 33 | /* Checkbox 34 | -------------------------- */ 35 | /* Radio 36 | -------------------------- */ 37 | /* Select 38 | -------------------------- */ 39 | /* Alert 40 | -------------------------- */ 41 | /* MessageBox 42 | -------------------------- */ 43 | /* Message 44 | -------------------------- */ 45 | /* Notification 46 | -------------------------- */ 47 | /* Input 48 | -------------------------- */ 49 | /* Cascader 50 | -------------------------- */ 51 | /* Group 52 | -------------------------- */ 53 | /* Tab 54 | -------------------------- */ 55 | /* Button 56 | -------------------------- */ 57 | /* cascader 58 | -------------------------- */ 59 | /* Switch 60 | -------------------------- */ 61 | /* Dialog 62 | -------------------------- */ 63 | /* Table 64 | -------------------------- */ 65 | /* Pagination 66 | -------------------------- */ 67 | /* Popup 68 | -------------------------- */ 69 | /* Popover 70 | -------------------------- */ 71 | /* Tooltip 72 | -------------------------- */ 73 | /* Tag 74 | -------------------------- */ 75 | /* Tree 76 | -------------------------- */ 77 | /* Dropdown 78 | -------------------------- */ 79 | /* Badge 80 | -------------------------- */ 81 | /* Card 82 | --------------------------*/ 83 | /* Slider 84 | --------------------------*/ 85 | /* Steps 86 | --------------------------*/ 87 | /* Menu 88 | --------------------------*/ 89 | /* Rate 90 | --------------------------*/ 91 | /* DatePicker 92 | --------------------------*/ 93 | /* Loading 94 | --------------------------*/ 95 | /* Scrollbar 96 | --------------------------*/ 97 | /* Carousel 98 | --------------------------*/ 99 | /* Collapse 100 | --------------------------*/ 101 | /* Transfer 102 | --------------------------*/ 103 | /* Header 104 | --------------------------*/ 105 | /* Footer 106 | --------------------------*/ 107 | /* Main 108 | --------------------------*/ 109 | /* Timeline 110 | --------------------------*/ 111 | /* Backtop 112 | --------------------------*/ 113 | /* Link 114 | --------------------------*/ 115 | /* Calendar 116 | --------------------------*/ 117 | /* Form 118 | -------------------------- */ 119 | /* Avatar 120 | --------------------------*/ 121 | /* Break-point 122 | --------------------------*/ 123 | /* Break-points 124 | -------------------------- */ 125 | /* Scrollbar 126 | -------------------------- */ 127 | /* Placeholder 128 | -------------------------- */ 129 | /* BEM 130 | -------------------------- */ 131 | .el-container { 132 | display: -webkit-box; 133 | display: -ms-flexbox; 134 | display: flex; 135 | -webkit-box-orient: horizontal; 136 | -webkit-box-direction: normal; 137 | -ms-flex-direction: row; 138 | flex-direction: row; 139 | -webkit-box-flex: 1; 140 | -ms-flex: 1; 141 | flex: 1; 142 | -ms-flex-preferred-size: auto; 143 | flex-basis: auto; 144 | -webkit-box-sizing: border-box; 145 | box-sizing: border-box; 146 | min-width: 0; } 147 | .el-container.is-vertical { 148 | -webkit-box-orient: vertical; 149 | -webkit-box-direction: normal; 150 | -ms-flex-direction: column; 151 | flex-direction: column; } 152 | -------------------------------------------------------------------------------- /my-mall-front/src/components/VueImageVerify.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 118 | -------------------------------------------------------------------------------- /my-mall-api/src/main/java/com/my/mall/service/impl/NewBeeMallUserAddressServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.my.mall.service.impl; 3 | 4 | import com.my.mall.common.NewBeeMallException; 5 | import com.my.mall.common.ServiceResultEnum; 6 | import com.my.mall.dao.MallUserAddressMapper; 7 | import com.my.mall.entity.MallUserAddress; 8 | import com.my.mall.util.BeanUtil; 9 | import com.my.mall.api.mall.vo.UserAddressVO; 10 | import com.my.mall.service.NewBeeMallUserAddressService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.transaction.annotation.Transactional; 14 | 15 | import java.util.Date; 16 | import java.util.List; 17 | 18 | @Service 19 | public class NewBeeMallUserAddressServiceImpl implements NewBeeMallUserAddressService { 20 | 21 | @Autowired 22 | private MallUserAddressMapper userAddressMapper; 23 | 24 | @Override 25 | public List getMyAddresses(Long userId) { 26 | List myAddressList = userAddressMapper.findMyAddressList(userId); 27 | List newBeeMallUserAddressVOS = BeanUtil.copyList(myAddressList, UserAddressVO.class); 28 | return newBeeMallUserAddressVOS; 29 | } 30 | 31 | @Override 32 | @Transactional 33 | public Boolean saveUserAddress(MallUserAddress mallUserAddress) { 34 | Date now = new Date(); 35 | if (mallUserAddress.getDefaultFlag().intValue() == 1) { 36 | //添加默认地址,需要将原有的默认地址修改掉 37 | MallUserAddress defaultAddress = userAddressMapper.getMyDefaultAddress(mallUserAddress.getUserId()); 38 | if (defaultAddress != null) { 39 | defaultAddress.setDefaultFlag((byte) 0); 40 | defaultAddress.setUpdateTime(now); 41 | int updateResult = userAddressMapper.updateByPrimaryKeySelective(defaultAddress); 42 | if (updateResult < 1) { 43 | //未更新成功 44 | NewBeeMallException.fail(ServiceResultEnum.DB_ERROR.getResult()); 45 | } 46 | } 47 | } 48 | return userAddressMapper.insertSelective(mallUserAddress) > 0; 49 | } 50 | 51 | @Override 52 | public Boolean updateMallUserAddress(MallUserAddress mallUserAddress) { 53 | MallUserAddress tempAddress = getMallUserAddressById(mallUserAddress.getAddressId()); 54 | Date now = new Date(); 55 | if (mallUserAddress.getDefaultFlag().intValue() == 1) { 56 | //修改为默认地址,需要将原有的默认地址修改掉 57 | MallUserAddress defaultAddress = userAddressMapper.getMyDefaultAddress(mallUserAddress.getUserId()); 58 | if (defaultAddress != null && !defaultAddress.getAddressId().equals(tempAddress)) { 59 | //存在默认地址且默认地址并不是当前修改的地址 60 | defaultAddress.setDefaultFlag((byte) 0); 61 | defaultAddress.setUpdateTime(now); 62 | int updateResult = userAddressMapper.updateByPrimaryKeySelective(defaultAddress); 63 | if (updateResult < 1) { 64 | //未更新成功 65 | NewBeeMallException.fail(ServiceResultEnum.DB_ERROR.getResult()); 66 | } 67 | } 68 | } 69 | mallUserAddress.setUpdateTime(now); 70 | return userAddressMapper.updateByPrimaryKeySelective(mallUserAddress) > 0; 71 | } 72 | 73 | @Override 74 | public MallUserAddress getMallUserAddressById(Long addressId) { 75 | MallUserAddress mallUserAddress = userAddressMapper.selectByPrimaryKey(addressId); 76 | if (mallUserAddress == null) { 77 | NewBeeMallException.fail(ServiceResultEnum.DATA_NOT_EXIST.getResult()); 78 | } 79 | return mallUserAddress; 80 | } 81 | 82 | @Override 83 | public MallUserAddress getMyDefaultAddressByUserId(Long userId) { 84 | return userAddressMapper.getMyDefaultAddress(userId); 85 | } 86 | 87 | @Override 88 | public Boolean deleteById(Long addressId) { 89 | return userAddressMapper.deleteByPrimaryKey(addressId) > 0; 90 | } 91 | } 92 | --------------------------------------------------------------------------------