├── .gitignore ├── README.md ├── files └── schema │ └── db_groupbuy.sql ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── xj │ │ └── groupbuy │ │ ├── GroupbuyApplication.java │ │ ├── common │ │ ├── config │ │ │ ├── CorsConfig.java │ │ │ ├── DruidDataSourceConfig.java │ │ │ ├── MyBatisConfig.java │ │ │ ├── TransactionConfig.java │ │ │ ├── UtilConfig.java │ │ │ └── WebConfig.java │ │ ├── exception │ │ │ └── CustomExceptionResolver.java │ │ ├── interceptor │ │ │ └── RedisUrlCountInterceptor.java │ │ ├── properties │ │ │ └── FileProperties.java │ │ ├── security │ │ │ ├── AuthenticationAccessDeniedHandler.java │ │ │ ├── LoginFilter.java │ │ │ ├── MyFilterInvocationSecurityMetadataSource.java │ │ │ ├── MyPersistentTokenBasedRememberMeServices.java │ │ │ ├── MyUrlDecisionManager.java │ │ │ └── WebSecurityConfig.java │ │ ├── util │ │ │ ├── CloneUtil.java │ │ │ ├── CodeGenerator.java │ │ │ ├── CreateTableGenerator.java │ │ │ ├── DateUtil.java │ │ │ ├── FileNameUtil.java │ │ │ ├── FileUtil.java │ │ │ ├── NullUtils.java │ │ │ ├── OfficeUtil.java │ │ │ ├── TreeUtil.java │ │ │ ├── UserUtil.java │ │ │ └── VerificationCode.java │ │ ├── vo │ │ │ └── CommonVO.java │ │ └── wrapper │ │ │ └── MyQueryWrapper.java │ │ ├── controller │ │ ├── admin │ │ │ ├── ManageUserController.java │ │ │ ├── TestController.java │ │ │ └── UserRoleController.java │ │ ├── grouper │ │ │ └── GrouperGoodsController.java │ │ ├── manager │ │ │ ├── CommunityController.java │ │ │ ├── ManagerNoticeController.java │ │ │ ├── StaffController.java │ │ │ ├── StaffRewardController.java │ │ │ ├── StaffScoreController.java │ │ │ ├── StaffScoreLogController.java │ │ │ ├── StaffTrainController.java │ │ │ └── TrainFileController.java │ │ ├── staff │ │ │ └── StaffNoticeController.java │ │ ├── store │ │ │ ├── StoreAnalysisController.java │ │ │ ├── StoreGoodsController.java │ │ │ └── StoreOrderController.java │ │ ├── system │ │ │ ├── CategoryController.java │ │ │ ├── FileController.java │ │ │ ├── LoginController.java │ │ │ ├── MenuController.java │ │ │ ├── MenuRoleController.java │ │ │ ├── RegionController.java │ │ │ └── RoleController.java │ │ └── user │ │ │ ├── CartController.java │ │ │ ├── UserController.java │ │ │ ├── UserFunctionController.java │ │ │ ├── UserGoodsController.java │ │ │ ├── UserGoodsEvaluateController.java │ │ │ └── UserOrderController.java │ │ ├── entity │ │ ├── Cart.java │ │ ├── CartItem.java │ │ ├── Category.java │ │ ├── Community.java │ │ ├── CommunityGoods.java │ │ ├── Goods.java │ │ ├── GoodsEvaluate.java │ │ ├── Menu.java │ │ ├── Meta.java │ │ ├── Notice.java │ │ ├── Order.java │ │ ├── OrderItem.java │ │ ├── Role.java │ │ ├── RoleMenu.java │ │ ├── StaffReward.java │ │ ├── StaffScore.java │ │ ├── StaffScoreLog.java │ │ ├── StaffTrain.java │ │ ├── TTest.java │ │ ├── TrainFile.java │ │ ├── TreeEntity.java │ │ ├── User.java │ │ ├── UserApply.java │ │ └── UserRole.java │ │ ├── mapper │ │ ├── CartItemMapper.java │ │ ├── CartMapper.java │ │ ├── CategoryMapper.java │ │ ├── CommunityGoodsMapper.java │ │ ├── CommunityMapper.java │ │ ├── GoodsEvaluateMapper.java │ │ ├── GoodsMapper.java │ │ ├── LoginMapper.java │ │ ├── MenuMapper.java │ │ ├── NoticeMapper.java │ │ ├── OrderItemMapper.java │ │ ├── OrderMapper.java │ │ ├── RegionMapper.java │ │ ├── RoleMapper.java │ │ ├── RoleMenuMapper.java │ │ ├── StaffRewardMapper.java │ │ ├── StaffScoreLogMapper.java │ │ ├── StaffScoreMapper.java │ │ ├── StaffTrainMapper.java │ │ ├── TestMapper.java │ │ ├── TrainFileMapper.java │ │ ├── UserApplyMapper.java │ │ ├── UserMapper.java │ │ └── UserRoleMapper.java │ │ └── service │ │ ├── ICartItemService.java │ │ ├── ICartService.java │ │ ├── ICategoryService.java │ │ ├── ICommunityGoodsService.java │ │ ├── ICommunityService.java │ │ ├── IDataAnalysisService.java │ │ ├── IGoodsEvaluateService.java │ │ ├── IGoodsService.java │ │ ├── ILoginService.java │ │ ├── IMenuService.java │ │ ├── INoticeService.java │ │ ├── IOrderItemService.java │ │ ├── IOrderService.java │ │ ├── IRegionService.java │ │ ├── IRoleMenuService.java │ │ ├── IRoleService.java │ │ ├── IStaffRewardService.java │ │ ├── IStaffScoreLogService.java │ │ ├── IStaffScoreService.java │ │ ├── IStaffTrainService.java │ │ ├── ITrainFileService.java │ │ ├── IUserApplyService.java │ │ ├── IUserRoleService.java │ │ ├── IUserService.java │ │ └── impl │ │ ├── CartItemServiceImpl.java │ │ ├── CartServiceImpl.java │ │ ├── CategoryServiceImpl.java │ │ ├── CommunityGoodsServiceImpl.java │ │ ├── CommunityServiceImpl.java │ │ ├── DataAnalysisServiceImpl.java │ │ ├── GoodsEvaluateServiceImpl.java │ │ ├── GoodsServiceImpl.java │ │ ├── LoginServiceImpl.java │ │ ├── MenuServiceImpl.java │ │ ├── NoticeServiceImpl.java │ │ ├── OrderItemServiceImpl.java │ │ ├── OrderServiceImpl.java │ │ ├── RegionServiceImpl.java │ │ ├── RoleMenuServiceImpl.java │ │ ├── RoleServiceImpl.java │ │ ├── StaffRewardServiceImpl.java │ │ ├── StaffScoreLogServiceImpl.java │ │ ├── StaffScoreServiceImpl.java │ │ ├── StaffTrainServiceImpl.java │ │ ├── TestService.java │ │ ├── TrainFileServiceImpl.java │ │ ├── UserApplyServiceImpl.java │ │ ├── UserRoleServiceImpl.java │ │ └── UserServiceImpl.java └── resources │ ├── application.properties │ ├── application.yml │ ├── mapper │ ├── CartItemMapper.xml │ ├── CartMapper.xml │ ├── CategoryMapper.xml │ ├── CommunityGoodsMapper.xml │ ├── CommunityMapper.xml │ ├── GoodsEvaluateMapper.xml │ ├── GoodsMapper.xml │ ├── LoginMapper.xml │ ├── MenuMapper.xml │ ├── MenuRoleMapper.xml │ ├── NoticeMapper.xml │ ├── OrderItemMapper.xml │ ├── OrderMapper.xml │ ├── RegionMapper.xml │ ├── RoleMapper.xml │ ├── StaffRewardMapper.xml │ ├── StaffScoreLogMapper.xml │ ├── StaffScoreMapper.xml │ ├── StaffTrainMapper.xml │ ├── TestMapper.xml │ ├── TrainFileMapper.xml │ ├── UserApplyMapper.xml │ ├── UserMapper.xml │ └── UserRoleMapper.xml │ └── mybatis │ └── mybatis-config.xml └── test └── java └── com └── xj └── groupbuy └── GroupbuyApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | src/main/resources/static/* 2 | target/* 3 | .idea 4 | *.iml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # groupbuy_SpringBoot 2 | 奇奇怪怪的毕设之社区团购管理系统 3 | 4 | ![image](https://user-images.githubusercontent.com/35026627/227847997-395eec23-0fd4-4495-9a0b-6b23253f7cef.png) 5 | 6 | 如何启动? 7 | 8 | 拉取项目后,修改 `application.yml` 中的数据库连接信息后启动即可 9 | 10 | 默认用户名密码 admin(123456) 11 | 12 | 如果不正确,可以再测试类 `GroupbuyApplicationTests.java` 中,加密密码后,直接改数据库 `user` 表中的 `password` 字段即可。 13 | 14 | 前端项目详见 https://github.com/cornerbear/groupbuy_Vue 15 | 16 | ## 2023-03-27 回复:数据库表已找到,在files/schema下 17 | 18 | 2022-04-26 回复:数据库表已经丢失,有需要的话可以根据mapper的和entity去自己创建数据库 19 | 20 | 0.13.1 :new: 增加登出功能 21 | 22 | 0.13.0 :new: 增加登录页判断已登录则跳转功能 23 | 24 | ## 0.12 :tada: 统计中心完成 25 | 26 | ## 0.11 :tada: 公告管理完成 27 | 28 | ## 0.10 :tada: 评论管理完成 29 | 30 | 0.10.0 :new: 评论商品功能待完善 31 | 32 | ## 0.9 :tada: 销售管理完成 33 | 34 | 0.9.5 :new: 支付订单和发货功能 35 | 36 | 0.9.4 :bug: 修复生成订单bug 37 | 38 | 0.9.3 :new: 生成订单完成 39 | 40 | 0.9.2 :new: ​​ 添加订单模块 41 | 42 | 0.9.1 :new: :bug: 用户添加商品到购物车,修改用户权限部分bug 43 | 44 | 0.9.0 :new: 团长可以对社区商品进行添加,移除 45 | 46 | ## 0.8 :tada: 商品管理完成 47 | 48 | 0.8.2 :new: :bug: 修改商品已完善,修改文件上传部分bug 49 | 50 | 0.8.1 :new: 修改商品接口已完成,待完善业务 51 | 52 | 0.8.0 :heavy_plus_sign: 添加fastjson依赖 53 | 54 | ## 0.7 :tada: 社区管理完成 55 | 56 | 0.7.1 :new: 社区的添加,修改,删除 57 | 58 | 0.7.0 :new: 提供省市区街的查询 59 | 60 | ## 0.6 :tada: 奖励管理完成 61 | 62 | 63 | 64 | ## 0.5 :tada: 重新完成考核管理 65 | 66 | 67 | 68 | ## 0.4 :tada: 员工管理,考核管理已完成 69 | 70 | 0.4.5 🆕 +员工奖惩功能 71 | 72 | 0.4.4 :new: +查询员工分数功能 73 | 74 | 0.4.3 :new: +删除员工功能 75 | 76 | 0.4.2 :new: +单独以及批量新增员工功能 77 | 78 | 0.4.1 :heavy_plus_sign: +添加poi依赖,用于解析xls 79 | 80 | 0.4.0 :new: 员工管理功能,完成显示员工功能 81 | 82 | --- 83 | 84 | ## 0.3 🎉 培训管理已完成 85 | 86 | 0.3.4 🆕 添加删除培训功能 87 | 88 | 0.3.3 🐛 修复上传文件发送两次请求的bug,增加文件下载的功能 89 | 90 | 0.3.2 +培训展示功能 91 | 92 | 0.3.1 +文件上传功能基本完成 93 | 94 | 0.3.0 +文件上传功能 95 | 96 | --- 97 | 98 | ## 0.2 权限管理功能已完成 99 | 100 | 101 | 0.2.3 +用户角色管理完成 … 102 | 103 | 0.2.2 +用户角色管理基本完成 104 | 105 | 0.2.1 +权限管理大部分功能 106 | 107 | --- 108 | 109 | ## 0.1 系统管理完成 110 | 111 | 0.1.10 +个人信息管理 112 | 113 | 0.1.9 +记住我功能,前端暂未实现 … 114 | 115 | 0.1.8 +Menu:单击树形触发修改Table 116 | 117 | 0.1.7 +修改菜单 118 | 119 | 0.1.6 增加事务管理,删除菜单功能完成 120 | 121 | 0.1.5 修复权限菜单管理的小bug 122 | 123 | 0.1.4 增加菜单管理 修复一些小bug … 124 | 125 | 0.1.3 菜单及权限完成 … 126 | 127 | 0.1.2 登录解决 … 128 | 129 | 0.1.1 项目结构修改 130 | 131 | 0.1.0 axios封装完成,登录完成,验证码功能完成 132 | 133 | --- 134 | 135 | ## 0.1.0 权限认证测试版0.1 136 | 137 | 0.0.12 权限认证0.1 138 | 139 | 0.0.11 添加权限认证功能,未完成 … 140 | 141 | 142 | 0.0.10 bug修复:解决线程并发的问题 … 143 | 144 | 0.0.9 bug修复:解决数据存储中文显示??的问题 … 145 | 146 | 0.0.8 类别管理简单实现 … 147 | 148 | 149 | 0.0.7 类别管理初步完成 … 150 | 151 | 0.0.6 商品添加 test pass … 152 | 153 | 154 | 0.0.5 修改代码生成器 … 155 | 156 | 0.0.4 项目结构整理 157 | 158 | 0.0.3 mybatis generator … 159 | 160 | 0.0.2 跨域完成,分页完成 … 161 | 162 | 0.0.1 跨域解决 163 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/GroupbuyApplication.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.web.server.ConfigurableWebServerFactory; 7 | import org.springframework.boot.web.server.ErrorPage; 8 | import org.springframework.boot.web.server.WebServerFactoryCustomizer; 9 | import org.springframework.context.ConfigurableApplicationContext; 10 | import org.springframework.context.annotation.Bean; 11 | import org.springframework.http.HttpStatus; 12 | 13 | import java.util.Arrays; 14 | 15 | @SpringBootApplication 16 | @MapperScan("com.xj.groupbuy.mapper") 17 | public class GroupbuyApplication { 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(GroupbuyApplication.class, args); 21 | // ConfigurableApplicationContext run = 22 | // String[] names = run.getBeanDefinitionNames(); 23 | // for (String name : names) { 24 | // System.out.println(name); 25 | // } 26 | } 27 | @Bean 28 | public WebServerFactoryCustomizer webServerFactoryCustomizer() { 29 | return factory -> { 30 | ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/index.html"); 31 | factory.addErrorPages(error404Page); 32 | }; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | import org.springframework.web.filter.CorsFilter; 8 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | /** 15 | * Author : zhangxiaojian 16 | * Date : 2021/3/5 17 | * 18 | * 跨域解决 19 | */ 20 | @Configuration 21 | public class CorsConfig implements WebMvcConfigurer { 22 | 23 | @Override 24 | public void addCorsMappings(CorsRegistry registry) { 25 | registry.addMapping("/**") 26 | .allowedOriginPatterns("*") 27 | // .allowedOrigins("*") 28 | .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE","OPTIONS") 29 | .allowCredentials(true) 30 | .maxAge(3600) 31 | .allowedHeaders("*"); 32 | 33 | } 34 | 35 | private CorsConfiguration addCorsConfig() { 36 | CorsConfiguration corsConfiguration = new CorsConfiguration(); 37 | List list = new ArrayList<>(); 38 | list.add("*"); 39 | corsConfiguration.setAllowedOrigins(list); 40 | /* 41 | // 请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等) 42 | */ 43 | corsConfiguration.addAllowedOrigin("*"); 44 | corsConfiguration.addAllowedHeader("*"); 45 | corsConfiguration.addAllowedMethod("*"); 46 | corsConfiguration.addExposedHeader("Authorization"); 47 | return corsConfiguration; 48 | } 49 | 50 | @Bean 51 | public CorsFilter corsFilter() { 52 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 53 | source.registerCorsConfiguration("/**", addCorsConfig()); 54 | return new CorsFilter(source); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/config/DruidDataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import com.alibaba.druid.support.http.StatViewServlet; 5 | import com.alibaba.druid.support.http.WebStatFilter; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 8 | import org.springframework.boot.web.servlet.ServletRegistrationBean; 9 | import org.springframework.context.annotation.Bean; 10 | 11 | import javax.sql.DataSource; 12 | import java.sql.SQLException; 13 | import java.util.Arrays; 14 | 15 | /** 16 | * Author : zhangxiaojian 17 | * Date : 2021/3/1 18 | */ 19 | @Deprecated 20 | //@Configuration 21 | public class DruidDataSourceConfig { 22 | 23 | /** 24 | * 添加数据源 25 | */ 26 | @Bean 27 | @ConfigurationProperties("spring.datasource") 28 | public DataSource dataSource() throws SQLException { 29 | DruidDataSource druidDataSource = new DruidDataSource(); 30 | 31 | // 加入监控功能 32 | druidDataSource.setFilters("stat,wall"); 33 | return druidDataSource; 34 | } 35 | 36 | /** 37 | * 数据源监控页 38 | */ 39 | @Bean 40 | public ServletRegistrationBean statViewServlet(){ 41 | StatViewServlet statViewServlet = new StatViewServlet(); 42 | return new ServletRegistrationBean<>(statViewServlet,"/druid/*"); 43 | } 44 | /** 45 | * webstatFiLter用于采集web-jdbc关联监控的数据。 46 | */ 47 | @Bean 48 | public FilterRegistrationBean webStatFilter(){ 49 | WebStatFilter webStatFilter = new WebStatFilter(); 50 | FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean<>(webStatFilter); 51 | filterRegistrationBean.setUrlPatterns(Arrays.asList("/*")); 52 | filterRegistrationBean.addInitParameter("exclusions","*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"); 53 | return filterRegistrationBean; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/config/MyBatisConfig.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; 4 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * Author : zhangxiaojian 10 | * Date : 2021/3/2 11 | */ 12 | @Configuration 13 | public class MyBatisConfig { 14 | 15 | @Bean 16 | public MybatisPlusInterceptor paginationInterceptor() { 17 | MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); 18 | //设置请求的页面大于最大页后操作, true调回到首页,false继续请求默认false 19 | //paginationInterceptor.setOverFlow(false); 20 | //设置最大单页限制数量,默认580条,-1不受限制 21 | // paginationInterceptor.setLimit( 500 ) ; 22 | //开启count 的join优化,只针对部分Left join 23 | 24 | // 分页拦截器 25 | PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); 26 | paginationInnerInterceptor.setOverflow(true); 27 | mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor); 28 | 29 | return mybatisPlusInterceptor; 30 | } 31 | 32 | // @Primary 33 | // @Bean 34 | // public SqlSessionFactory sqlSessionFactory(@Qualifier("sysDataSource")DataSource dataSource) throws Exception { 35 | // MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean(); 36 | // bean.setDataSource(dataSource); 37 | // return bean.getObject(); 38 | // } 39 | 40 | } -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/config/TransactionConfig.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.config; 2 | 3 | import org.springframework.aop.aspectj.AspectJExpressionPointcut; 4 | import org.springframework.aop.support.DefaultPointcutAdvisor; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; 9 | import org.springframework.transaction.TransactionDefinition; 10 | import org.springframework.transaction.TransactionManager; 11 | import org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource; 12 | import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute; 13 | import org.springframework.transaction.interceptor.TransactionAttribute; 14 | import org.springframework.transaction.interceptor.TransactionInterceptor; 15 | 16 | import javax.sql.DataSource; 17 | import java.util.HashMap; 18 | import java.util.Map; 19 | 20 | /** 21 | * Author : zhangxiaojian 22 | * Date : 2021/3/24 23 | */ 24 | 25 | @Configuration 26 | public class TransactionConfig { 27 | 28 | @Autowired 29 | private DataSource dataSource; 30 | 31 | /** 32 | * 向容器中注入事务管理器 33 | * 注意,要给该bean取一个名字,名字不要是transactionManager,否则会报错 34 | */ 35 | @Bean("transactionManager") 36 | public TransactionManager transactionManager(){ 37 | return new DataSourceTransactionManager(dataSource); 38 | } 39 | 40 | /** 41 | * 向容器中注入TransactionInterceptor, 42 | * TransactionInterceptor会完成事务切面的逻辑 43 | * 注意,要给该bean取一个名字,名字不要是transactionInterceptor,否则会报错 44 | */ 45 | @Bean("txAdvice") 46 | public TransactionInterceptor transactionInterceptor(TransactionManager transactionManager){ 47 | NameMatchTransactionAttributeSource source = new NameMatchTransactionAttributeSource(); 48 | 49 | //非只读事务 50 | RuleBasedTransactionAttribute requiredTx = new RuleBasedTransactionAttribute(); 51 | requiredTx.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); 52 | 53 | //只读事务 54 | RuleBasedTransactionAttribute readOnlyTx = new RuleBasedTransactionAttribute(); 55 | readOnlyTx.setReadOnly(true); 56 | 57 | //配置加事务的规则,没有匹配到的方法将不会有事务,这些方法指的是Pointcut匹配到的方法 58 | Map map = new HashMap<>(); 59 | map.put("add*", requiredTx);//Pointcut匹配到的方法中所有add开头的方法 60 | map.put("save*", requiredTx);//Pointcut匹配到的方法中所有save开头的方法 61 | map.put("create*", requiredTx);//Pointcut匹配到的方法中所有save开头的方法 62 | map.put("insert*", requiredTx); 63 | map.put("update*", requiredTx); 64 | map.put("delete*", requiredTx); 65 | map.put("select*", readOnlyTx); 66 | map.put("get*", readOnlyTx); 67 | source.setNameMap(map); 68 | return new TransactionInterceptor(transactionManager, source); 69 | } 70 | 71 | 72 | /** 73 | * 向容器中注入切入点 74 | */ 75 | @Bean 76 | public DefaultPointcutAdvisor defaultPointcutAdvisor(TransactionInterceptor txAdvice){ 77 | DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor(); 78 | advisor.setAdvice(txAdvice); 79 | AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); 80 | pointcut.setExpression("execution (* com.xj.groupbuy.service.impl.*.*(..))"); 81 | advisor.setPointcut(pointcut); 82 | return advisor; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/config/UtilConfig.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.config; 2 | 3 | /** 4 | * Author : zhangxiaojian 5 | * Date : 2021/4/6 6 | */ 7 | //@Configuration 8 | public class UtilConfig { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.config; 2 | 3 | import com.xj.groupbuy.common.interceptor.RedisUrlCountInterceptor; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.boot.web.server.ConfigurableWebServerFactory; 6 | import org.springframework.boot.web.server.ErrorPage; 7 | import org.springframework.boot.web.server.WebServerFactoryCustomizer; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.web.multipart.MultipartResolver; 12 | import org.springframework.web.multipart.commons.CommonsMultipartResolver; 13 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 14 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 15 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 16 | 17 | /** 18 | * Author : zhangxiaojian 19 | * Date : 2021/3/2 20 | */ 21 | //@Configuration 22 | public class WebConfig implements WebMvcConfigurer { 23 | 24 | 25 | // @Autowired 26 | // RedisUrlCountInterceptor redisUrlCountInterceptor; 27 | // 28 | // @Override 29 | // public void addInterceptors(InterceptorRegistry registry) { 30 | // registry.addInterceptor(redisUrlCountInterceptor) 31 | // .addPathPatterns("/**") 32 | // .excludePathPatterns("/","/login","/css/**","/fonts/**","/images/**","/js/**","/verifyCode"); 33 | // } 34 | // @Bean 35 | // public MultipartResolver multipartResolver(){ 36 | // return new CommonsMultipartResolver(); 37 | // } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/exception/CustomExceptionResolver.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.exception; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.dao.DataIntegrityViolationException; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.servlet.HandlerExceptionResolver; 7 | import org.springframework.web.servlet.ModelAndView; 8 | import org.springframework.web.servlet.view.json.MappingJackson2JsonView; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | 15 | /** 16 | * Author : zhangxiaojian 17 | * Date : 2021/3/11 18 | */ 19 | @Component 20 | @Slf4j 21 | public class CustomExceptionResolver implements HandlerExceptionResolver { 22 | @Override 23 | public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse response, Object o, Exception e) { 24 | ModelAndView mv = new ModelAndView(new MappingJackson2JsonView()); 25 | Map map = new HashMap<>(); 26 | map.put("status", "error"); 27 | map.put("exception", e); 28 | log.info("CustomExceptionResolver捕获到异常",e); 29 | if (e instanceof DataIntegrityViolationException) { 30 | map.put("msg", "该角色尚有关联的资源或用户,删除失败!"); 31 | } 32 | mv.addAllObjects(map); 33 | return mv; 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/interceptor/RedisUrlCountInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.interceptor; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.data.redis.core.StringRedisTemplate; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.servlet.HandlerInterceptor; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | /** 12 | * Author : zhangxiaojian 13 | * Date : 2021/3/2 14 | */ 15 | //@Component 16 | public class RedisUrlCountInterceptor implements HandlerInterceptor { 17 | 18 | @Autowired 19 | private StringRedisTemplate redisTemplate; 20 | 21 | @Override 22 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 23 | 24 | String uri = request.getRequestURI(); 25 | 26 | redisTemplate.opsForValue().increment(uri); 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/properties/FileProperties.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.properties; 2 | 3 | import lombok.Data; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.context.annotation.PropertySource; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * Author : zhangxiaojian 12 | * Date : 2021/4/7 13 | */ 14 | @Data 15 | @Component 16 | @ConfigurationProperties(prefix = "upload") 17 | public class FileProperties { 18 | 19 | private String path; 20 | 21 | } -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/security/AuthenticationAccessDeniedHandler.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.security; 2 | 3 | import org.springframework.security.access.AccessDeniedException; 4 | import org.springframework.security.web.access.AccessDeniedHandler; 5 | import org.springframework.stereotype.Component; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | 13 | /** 14 | * Author : zhangxiaojian 15 | * Date : 2021/3/11 16 | */ 17 | @Component 18 | public class AuthenticationAccessDeniedHandler implements AccessDeniedHandler { 19 | 20 | @Override 21 | public void handle(HttpServletRequest httpServletRequest, HttpServletResponse resp, AccessDeniedException e) throws IOException, ServletException { 22 | resp.setStatus(HttpServletResponse.SC_FORBIDDEN); 23 | resp.setCharacterEncoding("UTF-8"); 24 | PrintWriter out = resp.getWriter(); 25 | out.write("{\"status\":\"error\",\"msg\":\"权限不足,请联系管理员!\"}"); 26 | out.flush(); 27 | out.close(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/security/MyFilterInvocationSecurityMetadataSource.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.security; 2 | 3 | import com.xj.groupbuy.entity.Menu; 4 | import com.xj.groupbuy.entity.Role; 5 | import com.xj.groupbuy.service.IMenuService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.security.access.ConfigAttribute; 8 | import org.springframework.security.web.FilterInvocation; 9 | import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; 10 | import org.springframework.stereotype.Component; 11 | import org.springframework.util.AntPathMatcher; 12 | import org.springframework.security.access.SecurityConfig; 13 | 14 | import java.util.Collection; 15 | import java.util.List; 16 | 17 | /** 18 | * Author : zhangxiaojian 19 | * Date : 2021/3/11 20 | * 该类的主要功能就是通过当前的请求地址,获取该地址需要的用户角色 21 | */ 22 | @Component 23 | public class MyFilterInvocationSecurityMetadataSource implements FilterInvocationSecurityMetadataSource { 24 | 25 | @Autowired 26 | private IMenuService menuService; 27 | 28 | AntPathMatcher antPathMatcher = new AntPathMatcher(); 29 | 30 | @Override 31 | public Collection getAttributes(Object object) throws IllegalArgumentException { 32 | String requestUrl = ((FilterInvocation) object).getRequestUrl(); 33 | List menus = menuService.getAllMenusWithRole(); 34 | for (Menu menu : menus) { 35 | if (antPathMatcher.match(menu.getUrl(), requestUrl)) { 36 | List roles = menu.getRoles(); 37 | String[] str = new String[roles.size()]; 38 | for (int i = 0; i < roles.size(); i++) { 39 | str[i] = roles.get(i).getName(); 40 | } 41 | return SecurityConfig.createList(str); 42 | } 43 | } 44 | return SecurityConfig.createList("ROLE_LOGIN"); 45 | } 46 | 47 | @Override 48 | public Collection getAllConfigAttributes() { 49 | return null; 50 | } 51 | 52 | @Override 53 | public boolean supports(Class clazz) { 54 | return true; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/security/MyPersistentTokenBasedRememberMeServices.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.security; 2 | 3 | import org.springframework.core.log.LogMessage; 4 | import org.springframework.security.core.userdetails.UserDetailsService; 5 | import org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices; 6 | import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | 10 | /** 11 | * Author : zhangxiaojian 12 | * Date : 2021/3/28 13 | */ 14 | public class MyPersistentTokenBasedRememberMeServices extends PersistentTokenBasedRememberMeServices { 15 | public MyPersistentTokenBasedRememberMeServices(String key, UserDetailsService userDetailsService, PersistentTokenRepository tokenRepository) { 16 | super(key, userDetailsService, tokenRepository); 17 | } 18 | 19 | // rememberMeRequested 20 | 21 | @Override 22 | protected boolean rememberMeRequested(HttpServletRequest request, String parameter) { 23 | 24 | String paramValue = request.getAttribute(parameter).toString(); 25 | if (paramValue != null) { 26 | if (paramValue.equalsIgnoreCase("true") || paramValue.equalsIgnoreCase("on") 27 | || paramValue.equalsIgnoreCase("yes") || paramValue.equals("1")) { 28 | return true; 29 | } 30 | } 31 | this.logger.debug( 32 | LogMessage.format("Did not send remember-me cookie (principal did not set parameter '%s')", parameter)); 33 | return false; 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/security/MyUrlDecisionManager.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.security; 2 | 3 | import org.springframework.security.access.AccessDecisionManager; 4 | import org.springframework.security.access.AccessDeniedException; 5 | import org.springframework.security.access.ConfigAttribute; 6 | import org.springframework.security.authentication.AnonymousAuthenticationToken; 7 | import org.springframework.security.authentication.BadCredentialsException; 8 | import org.springframework.security.authentication.InsufficientAuthenticationException; 9 | import org.springframework.security.core.Authentication; 10 | import org.springframework.security.core.GrantedAuthority; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.util.Collection; 14 | import java.util.Iterator; 15 | 16 | /** 17 | * Author : zhangxiaojian 18 | * Date : 2021/3/11 19 | */ 20 | @Component 21 | public class MyUrlDecisionManager implements AccessDecisionManager { 22 | @Override 23 | public void decide(Authentication authentication, Object object, Collection configAttributes) throws AccessDeniedException, InsufficientAuthenticationException { 24 | Iterator iterator = configAttributes.iterator(); 25 | while (iterator.hasNext()) { 26 | ConfigAttribute ca = iterator.next(); 27 | //当前请求需要的权限 28 | String needRole = ca.getAttribute(); 29 | if ("ROLE_LOGIN".equals(needRole)) { 30 | if (authentication instanceof AnonymousAuthenticationToken) { 31 | throw new BadCredentialsException("未登录"); 32 | } else 33 | return; 34 | } 35 | //当前用户所具有的权限 36 | Collection authorities = authentication.getAuthorities(); 37 | for (GrantedAuthority authority : authorities) { 38 | if (authority.getAuthority().equals(needRole)) { 39 | return; 40 | } 41 | } 42 | } 43 | throw new AccessDeniedException("权限不足!"); 44 | } 45 | 46 | @Override 47 | public boolean supports(ConfigAttribute attribute) { 48 | return true; 49 | } 50 | 51 | @Override 52 | public boolean supports(Class clazz) { 53 | return true; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/util/CloneUtil.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.util; 2 | 3 | import org.springframework.beans.BeanUtils; 4 | import org.springframework.util.CollectionUtils; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | /** 10 | * Author : zhangxiaojian 11 | * Date : 2021/4/22 12 | */ 13 | public class CloneUtil { 14 | 15 | /** 16 | * 复制对象 17 | */ 18 | public static T clone(K source, Class clazz) { 19 | T t = BeanUtils.instantiateClass(clazz); 20 | BeanUtils.copyProperties(source, t); 21 | return t; 22 | } 23 | 24 | /** 25 | * 复制集合 26 | */ 27 | // public static List copyList(List sourceList, Class clazz) { 28 | // if (CollectionUtils.isEmpty(sourceList)) { 29 | // return null; 30 | // } 31 | // return Lists2.transform(sourceList,input -> convert(input, clazz)); 32 | // } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/util/FileNameUtil.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.util; 2 | 3 | import java.util.UUID; 4 | 5 | /** 6 | * Author : zhangxiaojian 7 | * Date : 2021/4/7 8 | */ 9 | public class FileNameUtil { 10 | 11 | /** 12 | * 获取文件后缀 13 | * @param fileName 文件名 14 | * @return 15 | */ 16 | public static String getSuffix(String fileName){ 17 | return fileName.substring(fileName.lastIndexOf(".")); 18 | } 19 | public static String getPrefix(String fileName){ 20 | return fileName.substring(0,fileName.lastIndexOf(".")); 21 | } 22 | 23 | /** 24 | * 生成新的文件名 25 | * @param fileOriginName 源文件名 26 | * @return 27 | */ 28 | public static String getFileName(String fileOriginName){ 29 | String prefix = FileNameUtil.getPrefix(fileOriginName); 30 | String uuid = "_" + UUID.randomUUID().toString().substring(26); 31 | String suffix = FileNameUtil.getSuffix(fileOriginName); 32 | return prefix + uuid + suffix; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/util/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.util; 2 | 3 | import org.springframework.core.io.InputStreamResource; 4 | import org.springframework.http.HttpHeaders; 5 | import org.springframework.http.MediaType; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.multipart.MultipartFile; 8 | 9 | import java.io.File; 10 | import java.io.FileInputStream; 11 | import java.io.IOException; 12 | 13 | /** 14 | * Author : zhangxiaojian 15 | * Date : 2021/4/7 16 | */ 17 | public class FileUtil { 18 | 19 | /** 20 | * @param file 文件 21 | * @param path 文件存放路径 22 | * @param fileName 源文件名 23 | * @return 24 | */ 25 | public static String upload(MultipartFile file, String path, String fileName) { 26 | 27 | // 生成新的文件名 28 | String realFileName = FileNameUtil.getFileName(fileName); 29 | String realPath = path + realFileName; 30 | 31 | //使用原文件名 32 | // String realPath = path + "/" + fileName; 33 | 34 | File dest = new File(realPath); 35 | 36 | //判断文件父目录是否存在 37 | if (!dest.getParentFile().exists()) { 38 | dest.getParentFile().mkdir(); 39 | } 40 | try { 41 | //保存文件 42 | file.transferTo(dest); 43 | return realFileName; 44 | } catch (IllegalStateException e) { 45 | // TODO Auto-generated catch block 46 | e.printStackTrace(); 47 | return null; 48 | } catch (IOException e) { 49 | // TODO Auto-generated catch block 50 | e.printStackTrace(); 51 | return null; 52 | } 53 | 54 | } 55 | 56 | public static ResponseEntity download(String path,String fileName) { 57 | 58 | File file = new File(path + fileName); 59 | InputStreamResource resource = null; 60 | try { 61 | resource = new InputStreamResource(new FileInputStream(file)); 62 | } catch (Exception e) { 63 | e.printStackTrace(); 64 | } 65 | HttpHeaders headers = new HttpHeaders(); 66 | headers.add("Content-Disposition", String.format("attachment;filename=\"%s", fileName)); 67 | headers.add("Cache-Control", "no-cache,no-store,must-revalidate"); 68 | headers.add("Pragma", "no-cache"); 69 | headers.add("Expires", "0"); 70 | ResponseEntity responseEntity = ResponseEntity.ok() 71 | .headers(headers) 72 | .contentLength(file.length()) 73 | .contentType(MediaType.parseMediaType("application/octet-stream")) 74 | .body(resource); 75 | return responseEntity; 76 | } 77 | 78 | public static boolean delete(String filePath) { 79 | File file = new File(filePath); 80 | if (!file.exists()) { 81 | return false; 82 | } else { 83 | if (file.delete()) { 84 | return true; 85 | } else { 86 | return false; 87 | } 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/util/TreeUtil.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.util; 2 | 3 | import com.xj.groupbuy.entity.TreeEntity; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * Author : zhangxiaojian 10 | * Date : 2021/3/23 11 | */ 12 | public class TreeUtil{ 13 | 14 | public static > List getTreeList(Integer topId, List entityList) { 15 | List resultList=new ArrayList<>(); 16 | 17 | //获取顶层元素集合 18 | Integer parentId; 19 | for (E entity : entityList) { 20 | 21 | if(entity.isTreeEnabled()){ 22 | parentId=entity.getTreeParentId(); 23 | if(parentId==null||topId.equals(parentId)){ 24 | resultList.add(entity); 25 | } 26 | } 27 | 28 | } 29 | 30 | //获取每个顶层元素的子数据集合 31 | for (E entity : resultList) { 32 | entity.setTreeChildren(getSubList(entity.getTreeId(),entityList)); 33 | } 34 | return resultList; 35 | } 36 | 37 | private static > List getSubList(Integer id, List entityList) { 38 | List childList=new ArrayList<>(); 39 | Integer parentId; 40 | 41 | //子集的直接子对象 42 | for (E entity : entityList) { 43 | parentId=entity.getTreeParentId(); 44 | if(id.equals(parentId)){ 45 | childList.add(entity); 46 | } 47 | } 48 | 49 | //子集的间接子对象 50 | for (E entity : childList) { 51 | entity.setTreeChildren(getSubList(entity.getTreeId(), entityList)); 52 | } 53 | 54 | //递归退出条件 55 | if(childList.size()==0){ 56 | return null; 57 | } 58 | 59 | return childList; 60 | } 61 | } -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/util/UserUtil.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.util; 2 | 3 | import com.xj.groupbuy.entity.User; 4 | import org.springframework.security.core.context.SecurityContextHolder; 5 | 6 | /** 7 | * Author : zhangxiaojian 8 | * Date : 2021/3/11 9 | */ 10 | public class UserUtil { 11 | 12 | public static User getCurrentUser() { 13 | return ((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal()); 14 | } 15 | 16 | public static String getUserId() { 17 | return UserUtil.getCurrentUser().getUserId(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/vo/CommonVO.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class CommonVO { 7 | 8 | //交易成功失败表示 9 | private boolean success; 10 | private Integer status; 11 | //交易结果描述 12 | private String msg; 13 | //返回数据 14 | private Object data; 15 | 16 | public CommonVO() { 17 | } 18 | 19 | public CommonVO(boolean success, String msg) { 20 | this.success = success; 21 | this.msg = msg; 22 | } 23 | 24 | public CommonVO(boolean success, String msg, Object data) { 25 | this.success = success; 26 | this.msg = msg; 27 | this.data = data; 28 | } 29 | 30 | public CommonVO(boolean success, Object data) { 31 | this.success = success; 32 | this.data = data; 33 | } 34 | public CommonVO(boolean success,Integer status,String msg, Object data) { 35 | this.success = success; 36 | this.status = status; 37 | this.msg = msg; 38 | this.data = data; 39 | } 40 | 41 | public static Object ok(String msg) { 42 | return new CommonVO(true,200,msg,null); 43 | } 44 | public static CommonVO ok(String msg, Object data) { 45 | return new CommonVO(true,200,msg,data); 46 | } 47 | 48 | public static CommonVO error(String msg) { 49 | return new CommonVO(false,500,msg,null); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/common/wrapper/MyQueryWrapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.common.wrapper; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.enums.SqlKeyword; 5 | import com.xj.groupbuy.common.util.NullUtils; 6 | 7 | 8 | /** 9 | * Author : zhangxiaojian 10 | * Date : 2021/4/15 11 | */ 12 | public class MyQueryWrapper extends QueryWrapper { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | @Override 17 | protected QueryWrapper addCondition(boolean condition, String column, SqlKeyword sqlKeyword, Object val) { 18 | if(NullUtils.isEmpty(val)){ 19 | condition = false; 20 | } 21 | return super.addCondition(condition, column, sqlKeyword, val); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/admin/ManageUserController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.admin; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.User; 5 | import com.xj.groupbuy.service.IUserRoleService; 6 | import com.xj.groupbuy.service.IUserService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | /** 12 | * Author : zhangxiaojian 13 | * Date : 2021/4/5 14 | */ 15 | @RestController 16 | @RequestMapping("admin/user") 17 | public class ManageUserController { 18 | 19 | @Autowired 20 | private IUserService userService; 21 | 22 | @GetMapping("{userId}") 23 | public CommonVO getUser(@PathVariable String userId){ 24 | return userService.getUserAndRoleById(userId); 25 | } 26 | 27 | @PutMapping 28 | public CommonVO updateUser(@RequestBody User user){ 29 | boolean b = userService.updateById(user); 30 | return new CommonVO(b,b?"修改成功":"修改失败"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/admin/TestController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.admin; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.xj.groupbuy.entity.TTest; 5 | import com.xj.groupbuy.service.impl.TestService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.ResponseBody; 11 | 12 | /** 13 | * Author : zhangxiaojian 14 | * Date : 2021/3/1 15 | */ 16 | @Controller 17 | public class TestController { 18 | 19 | @Autowired 20 | private TestService testService; 21 | 22 | @GetMapping("test/{id}") 23 | @ResponseBody 24 | public TTest getTestById(@PathVariable String id){ 25 | TTest testById = testService.getTestById(id); 26 | return testById; 27 | } 28 | 29 | @GetMapping("tests/{pageNo}/{pageSize}") 30 | @ResponseBody 31 | public Page getTestS(@PathVariable(value = "pageNo") Integer pageNo,@PathVariable(value = "pageSize") Integer pageSize){ 32 | 33 | // 分页查询数据 第几页,每页几个 34 | Page testPage = new Page<>(pageNo,pageSize); 35 | Page page = testService.page(testPage, null); 36 | return page; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/admin/UserRoleController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.admin; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.xj.groupbuy.common.vo.CommonVO; 6 | import com.xj.groupbuy.entity.User; 7 | import com.xj.groupbuy.service.IUserRoleService; 8 | import com.xj.groupbuy.service.IUserService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 前端控制器 18 | *

19 | * 20 | * @author zhangxiaojian 21 | * @since 2021-04-02 22 | */ 23 | @RestController 24 | @RequestMapping("/admin/userRole") 25 | public class UserRoleController { 26 | 27 | @Autowired 28 | private IUserService userService; 29 | @Autowired 30 | private IUserRoleService userRoleService; 31 | 32 | @PutMapping 33 | public CommonVO updateUserRoleById(@RequestParam(value="userId") String userId,@RequestParam(value="roleIds") List roleIds){ 34 | return userRoleService.updateUserRoleById(userId,roleIds); 35 | } 36 | 37 | @GetMapping("{userId}") 38 | public CommonVO getUserRoleById(@PathVariable String userId){ 39 | return userRoleService.getUserRoleById(userId); 40 | } 41 | 42 | @GetMapping("all/{pageNo}/{pageSize}") 43 | public IPage getUserRoleTable(String userId, String name, @PathVariable Integer pageNo, @PathVariable Integer pageSize){ 44 | return userService.userRoleTable(userId,name,pageNo,pageSize); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/grouper/GrouperGoodsController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.grouper; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.xj.groupbuy.common.util.UserUtil; 6 | import com.xj.groupbuy.common.vo.CommonVO; 7 | import com.xj.groupbuy.entity.CommunityGoods; 8 | import com.xj.groupbuy.entity.Goods; 9 | import com.xj.groupbuy.service.ICommunityGoodsService; 10 | import com.xj.groupbuy.service.IGoodsService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | /** 15 | * Author : zhangxiaojian 16 | * Date : 2021/4/20 17 | */ 18 | @RestController 19 | @RequestMapping("grouper/goods") 20 | public class GrouperGoodsController { 21 | 22 | @Autowired 23 | private IGoodsService goodsService; 24 | @Autowired 25 | private ICommunityGoodsService communityGoodsService; 26 | 27 | @GetMapping("all/{pageNo}/{pageSize}/{select}") 28 | public Page getCommunityGoods(@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize, @PathVariable(value = "select") Boolean select){ 29 | 30 | Page page = new Page<>(pageNo,pageSize); 31 | return goodsService.getCommunityGoods(select,page); 32 | } 33 | @DeleteMapping("deleteCommunityGoods/{id}") 34 | public CommonVO deleteCommunityGoods(@PathVariable Integer id){ 35 | boolean remove = communityGoodsService.remove(new QueryWrapper().eq("goods_id", id).eq("community_id", UserUtil.getCurrentUser().getCommunityId())); 36 | return new CommonVO(remove,remove?"删除成功":"删除失败"); 37 | } 38 | @PostMapping("addCommunityGoods/{id}") 39 | public CommonVO addCommunityGoods(@PathVariable Integer id){ 40 | int count = communityGoodsService.count(new QueryWrapper().eq("goods_id", id).eq("community_id", UserUtil.getCurrentUser().getCommunityId())); 41 | if(count == 0){ 42 | 43 | boolean save = communityGoodsService.save(new CommunityGoods(id, UserUtil.getCurrentUser().getCommunityId())); 44 | return new CommonVO(save,save?"添加成功":"添加失败"); 45 | } else { 46 | return new CommonVO(false,"社区已存在该商品"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/manager/CommunityController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.manager; 2 | 3 | 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.Community; 6 | import com.xj.groupbuy.service.ICommunityService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | /** 11 | *

12 | * 前端控制器 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-04-15 17 | */ 18 | @RestController 19 | @RequestMapping("manager/community") 20 | public class CommunityController { 21 | 22 | @Autowired 23 | private ICommunityService communityService; 24 | 25 | @PostMapping 26 | public CommonVO addCommunity(@RequestBody Community community){ 27 | boolean save = communityService.save(community); 28 | return new CommonVO(save,save?"保存成功":"保存失败"); 29 | } 30 | 31 | @PutMapping 32 | public CommonVO updateCommunity(@RequestBody Community community){ 33 | boolean update = communityService.updateById(community); 34 | return new CommonVO(update,update?"修改成功":"修改失败"); 35 | } 36 | 37 | @DeleteMapping("{id}") 38 | public CommonVO deleteCommunity(@PathVariable Integer id){ 39 | boolean remove = communityService.removeById(id); 40 | return new CommonVO(remove,remove?"删除成功":"删除失败"); 41 | } 42 | 43 | @GetMapping("{id}") 44 | public CommonVO getCommunity(@PathVariable Integer id){ 45 | Community byId = communityService.getById(id); 46 | return new CommonVO(true,byId); 47 | } 48 | 49 | @GetMapping("table") 50 | public CommonVO table(String level,String parentCode, Integer pageNo, Integer pageSize){ 51 | return new CommonVO(true,communityService.table(level,parentCode,pageNo,pageSize)); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/manager/ManagerNoticeController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.manager; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.xj.groupbuy.common.vo.CommonVO; 7 | import com.xj.groupbuy.entity.Notice; 8 | import com.xj.groupbuy.service.INoticeService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | /** 13 | *

14 | * 前端控制器 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-25 19 | */ 20 | @RestController 21 | @RequestMapping("manager/notice") 22 | public class ManagerNoticeController { 23 | 24 | @Autowired 25 | private INoticeService noticeService; 26 | 27 | @PostMapping 28 | public CommonVO addNotice(@RequestBody Notice notice){ 29 | return noticeService.addNotice(notice); 30 | } 31 | @DeleteMapping("{id}") 32 | public CommonVO deleteNotice(@PathVariable Integer id){ 33 | boolean b = noticeService.removeById(id); 34 | return new CommonVO(b,b?"删除成功":"删除失败"); 35 | } 36 | 37 | @GetMapping("all/{pageNo}/{pageSize}") 38 | public IPage getNotices(Integer mode,@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize) { 39 | return noticeService.getNotices(mode,pageNo,pageSize); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/manager/StaffController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.manager; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.service.IUserRoleService; 6 | import com.xj.groupbuy.service.IUserService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | import org.springframework.web.multipart.MultipartFile; 10 | 11 | import java.util.Map; 12 | 13 | /** 14 | * Author : zhangxiaojian 15 | * Date : 2021/4/11 16 | */ 17 | 18 | @RestController 19 | @RequestMapping("manager/grouper") 20 | public class StaffController { 21 | 22 | @Autowired 23 | private IUserService userService; 24 | @Autowired 25 | private IUserRoleService userRoleService; 26 | 27 | @GetMapping("all/{pageNo}/{pageSize}") 28 | public IPage getAllStaff(@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize) { 29 | return userService.getUsersByRole("ROLE_GROUPER",pageNo,pageSize); 30 | } 31 | @DeleteMapping("{userId}") 32 | public CommonVO deleteStaff(@PathVariable String userId){ 33 | return userRoleService.deleteRole(userId,"ROLE_GROUPER"); 34 | } 35 | 36 | @PostMapping("batchAdd") 37 | public CommonVO addStaffBatch(@RequestParam("files") MultipartFile[] files){ 38 | try { 39 | return userRoleService.addRoleBatch(files,"ROLE_GROUPER"); 40 | } catch (Exception e) { 41 | e.printStackTrace(); 42 | return new CommonVO(false,"文件上传失败,请检查格式"); 43 | } 44 | } 45 | 46 | @PostMapping("singleAdd/{userId}") 47 | public CommonVO addStaffSingle(@PathVariable String userId){ 48 | try { 49 | return userRoleService.addRoleSingle(userId,"ROLE_GROUPER"); 50 | 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | return new CommonVO(false,"文件上传失败,请检查格式"); 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/manager/StaffRewardController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.manager; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.xj.groupbuy.common.vo.CommonVO; 8 | import com.xj.groupbuy.common.wrapper.MyQueryWrapper; 9 | import com.xj.groupbuy.entity.StaffReward; 10 | import com.xj.groupbuy.entity.StaffScoreLog; 11 | import com.xj.groupbuy.service.IStaffRewardService; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | /** 16 | *

17 | * 前端控制器 18 | *

19 | * 20 | * @author zhangxiaojian 21 | * @since 2021-04-14 22 | */ 23 | @RestController 24 | @RequestMapping("manager/staffReward") 25 | public class StaffRewardController { 26 | 27 | @Autowired 28 | private IStaffRewardService staffRewardService; 29 | 30 | 31 | @GetMapping("all/{pageNo}/{pageSize}") 32 | public IPage getAllStaffReward(@RequestParam(required = false) String userId, @PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize) { 33 | 34 | Page page = new Page<>(pageNo, pageSize); 35 | 36 | return staffRewardService.page(page, new MyQueryWrapper().eq("user_id", userId)); 37 | } 38 | 39 | @GetMapping("{id}") 40 | public CommonVO getStaffReward(@PathVariable Integer id){ 41 | StaffReward byId = staffRewardService.getById(id); 42 | return new CommonVO(true,byId); 43 | } 44 | @PostMapping 45 | public CommonVO saveStaffReward(@RequestBody StaffReward staffReward) { 46 | return staffRewardService.saveStaffReward(staffReward); 47 | } 48 | @PutMapping 49 | public CommonVO updateStaffReward(@RequestBody StaffReward staffReward){ 50 | boolean b = staffRewardService.updateById(staffReward); 51 | return new CommonVO(b,b?"修改成功":"修改失败"); 52 | } 53 | @DeleteMapping("{id}") 54 | public CommonVO deleteStaffReward(@PathVariable Integer id){ 55 | boolean b = staffRewardService.removeById(id); 56 | return new CommonVO(b,b?"删除成功":"删除失败"); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/manager/StaffScoreController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.manager; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.xj.groupbuy.common.vo.CommonVO; 7 | import com.xj.groupbuy.entity.StaffScore; 8 | import com.xj.groupbuy.service.IStaffScoreService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.GetMapping; 11 | import org.springframework.web.bind.annotation.PathVariable; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | /** 17 | *

18 | * 前端控制器 19 | *

20 | * 21 | * @author zhangxiaojian 22 | * @since 2021-04-12 23 | */ 24 | @RestController 25 | @RequestMapping("manager/staffScore") 26 | public class StaffScoreController { 27 | 28 | @Autowired 29 | private IStaffScoreService staffScoreService; 30 | 31 | @GetMapping("{userId}") 32 | public CommonVO getStaffScore(@PathVariable String userId){ 33 | 34 | return staffScoreService.gotStaffScore(userId); 35 | } 36 | 37 | @GetMapping("all/{pageNo}/{pageSize}") 38 | public IPage getAllStaffScore(@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize) { 39 | return staffScoreService.getStaffScores(pageNo,pageSize); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/manager/StaffScoreLogController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.manager; 2 | 3 | 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.StaffScoreLog; 6 | import com.xj.groupbuy.service.IStaffScoreLogService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | /** 11 | *

12 | * 前端控制器 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-04-12 17 | */ 18 | @RestController 19 | @RequestMapping("manager/staffScoreLog") 20 | public class StaffScoreLogController { 21 | 22 | @Autowired 23 | private IStaffScoreLogService staffScoreLogService; 24 | 25 | @GetMapping("{userId}") 26 | public CommonVO getStaffScoreLogs(@PathVariable String userId){ 27 | 28 | return staffScoreLogService.getStaffScoreLogs(userId); 29 | } 30 | 31 | @PostMapping 32 | public CommonVO insertStaffScoreLog(@RequestBody StaffScoreLog staffScoreLog){ 33 | return staffScoreLogService.insertStaffScoreLog(staffScoreLog); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/manager/TrainFileController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.manager; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.xj.groupbuy.common.vo.CommonVO; 6 | import com.xj.groupbuy.entity.TrainFile; 7 | import com.xj.groupbuy.service.ITrainFileService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.PathVariable; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | *

19 | * 前端控制器 20 | *

21 | * 22 | * @author zhangxiaojian 23 | * @since 2021-04-07 24 | */ 25 | 26 | @RestController 27 | @RequestMapping("manager/trainFile") 28 | public class TrainFileController { 29 | 30 | @Autowired 31 | private ITrainFileService trainFileService; 32 | 33 | 34 | @GetMapping("byTrainId/{trainId}") 35 | public CommonVO getTrainFilesByTrainId(@PathVariable Integer trainId){ 36 | List trainFiles = trainFileService.list(new QueryWrapper().eq("train_id", trainId)); 37 | return new CommonVO(true,trainFiles); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/staff/StaffNoticeController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.staff; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.xj.groupbuy.common.vo.CommonVO; 6 | import com.xj.groupbuy.entity.Notice; 7 | import com.xj.groupbuy.service.INoticeService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | /** 12 | *

13 | * 前端控制器 14 | *

15 | * 16 | * @author zhangxiaojian 17 | * @since 2021-04-25 18 | */ 19 | @RestController 20 | @RequestMapping("staff/notice") 21 | public class StaffNoticeController { 22 | 23 | @Autowired 24 | private INoticeService noticeService; 25 | 26 | @GetMapping("all/{pageNo}/{pageSize}") 27 | public IPage getNotices(Integer mode,@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize) { 28 | return noticeService.getNotices(mode,pageNo,pageSize); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/store/StoreAnalysisController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.store; 2 | 3 | import com.xj.groupbuy.common.util.UserUtil; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.service.IDataAnalysisService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | /** 12 | * Author : zhangxiaojian 13 | * Date : 2021/4/26 14 | */ 15 | @RestController 16 | @RequestMapping("store/analysis") 17 | public class StoreAnalysisController { 18 | 19 | @Autowired 20 | private IDataAnalysisService dataAnalysisService; 21 | 22 | @GetMapping("day") 23 | public CommonVO getStoreDayAnalysis(){ 24 | return dataAnalysisService.getStoreDayAnalysis(UserUtil.getUserId()); 25 | } 26 | @GetMapping("month") 27 | public CommonVO getStoreMonthAnalysis(){ 28 | return dataAnalysisService.getStoreMonthAnalysis(UserUtil.getUserId()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/store/StoreGoodsController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.store; 2 | 3 | 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.xj.groupbuy.common.util.DateUtil; 8 | import com.xj.groupbuy.common.util.FileUtil; 9 | import com.xj.groupbuy.common.util.UserUtil; 10 | import com.xj.groupbuy.entity.Goods; 11 | import com.xj.groupbuy.service.ICategoryService; 12 | import com.xj.groupbuy.service.IGoodsService; 13 | import com.xj.groupbuy.common.vo.CommonVO; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.web.bind.annotation.*; 16 | import org.springframework.web.multipart.MultipartFile; 17 | 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | /** 22 | *

23 | * 前端控制器 24 | *

25 | * 26 | * @author zhangxiaojian 27 | * @since 2021-03-08 28 | */ 29 | @RestController 30 | @RequestMapping("store/goods") 31 | public class StoreGoodsController { 32 | 33 | @Autowired 34 | private IGoodsService goodsService; 35 | @Autowired 36 | private ICategoryService categoryService; 37 | 38 | @PostMapping 39 | public CommonVO saveGoods(@RequestBody Goods goods){ 40 | 41 | goods.setGoodsStoreId(UserUtil.getUserId()); 42 | goods.setUpdateTime(DateUtil.getCurrentDate()); 43 | 44 | boolean save = goodsService.save(goods); 45 | String resMsg = save?"保存成功":"保存失败"; 46 | return new CommonVO(save,resMsg); 47 | } 48 | 49 | @DeleteMapping("{id}") 50 | public CommonVO deleteGoods(@PathVariable Integer id){ 51 | 52 | return goodsService.deleteGoods(id); 53 | } 54 | @PostMapping("update") 55 | public CommonVO updateGoods(@RequestParam(value = "files",required = false) MultipartFile[] multipartFiles,@RequestParam("goods") String goodsJson){ 56 | Goods goods = JSONObject.parseObject(goodsJson, Goods.class); 57 | return goodsService.updateGoods(multipartFiles,goods); 58 | } 59 | @GetMapping("{id}") 60 | public CommonVO getGoods(@PathVariable Integer id){ 61 | 62 | Goods goods = goodsService.getById(id); 63 | return new CommonVO(true,goods); 64 | } 65 | @GetMapping("all/{pageNo}/{pageSize}") 66 | public Page getGoodsAll(@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize){ 67 | 68 | Page page = new Page<>(pageNo,pageSize); 69 | return goodsService.page(page,new QueryWrapper().eq("GOODS_STORE_ID",UserUtil.getUserId())); 70 | } 71 | 72 | @GetMapping("category/{id}") 73 | public CommonVO getAllLevelByCatId(@PathVariable Integer id){ 74 | return categoryService.getAllLevelByCatId(id); 75 | } 76 | 77 | @GetMapping("category/two/{id}") 78 | public CommonVO getTwoByOne(@PathVariable Integer id){ 79 | List> twoByOne = categoryService.getTwoByOne(id); 80 | return new CommonVO(true,twoByOne); 81 | } 82 | 83 | @GetMapping("category/three/{id}") 84 | public CommonVO getThreeByTwo(@PathVariable Integer id){ 85 | List> threeByTwo = categoryService.getThreeByTwo(id); 86 | return new CommonVO(true,threeByTwo); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/store/StoreOrderController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.store; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.xj.groupbuy.common.util.UserUtil; 7 | import com.xj.groupbuy.common.vo.CommonVO; 8 | import com.xj.groupbuy.entity.Order; 9 | import com.xj.groupbuy.service.IOrderService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.ui.Model; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import java.util.Map; 15 | 16 | /** 17 | * Author : zhangxiaojian 18 | * Date : 2021/4/23 19 | */ 20 | @RestController 21 | @RequestMapping("store/order") 22 | public class StoreOrderController { 23 | 24 | @Autowired 25 | private IOrderService orderService; 26 | 27 | @PutMapping("confirmArrived/{orderId}") 28 | public CommonVO confirmArrived(@PathVariable Integer orderId){ 29 | return orderService.confirmArrived(orderId); 30 | } 31 | 32 | @PutMapping("deliver") 33 | public CommonVO deliver(@RequestBody Map map){ 34 | return orderService.deliver(map); 35 | } 36 | 37 | @GetMapping("all/{pageNo}/{pageSize}") 38 | public IPage getStoreOrderTable(@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize){ 39 | 40 | return orderService.getStoreOrderTable(UserUtil.getUserId(),pageNo,pageSize); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/system/CategoryController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.system; 2 | 3 | 4 | import com.xj.groupbuy.entity.Category; 5 | import com.xj.groupbuy.service.ICategoryService; 6 | import com.xj.groupbuy.common.vo.CommonVO; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | *

14 | * 前端控制器 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-03-09 19 | */ 20 | @RestController 21 | @RequestMapping("admin") 22 | @CrossOrigin 23 | public class CategoryController { 24 | 25 | @Autowired 26 | private ICategoryService categoryService; 27 | 28 | @RequestMapping("categoryAll") 29 | public List getCategoryAll(){ 30 | return categoryService.list(); 31 | } 32 | 33 | @RequestMapping("categoryTree") 34 | public CommonVO getCategoryTree(){ 35 | List list = categoryService.getCategoryTree(); 36 | return new CommonVO(true,list); 37 | } 38 | 39 | @PostMapping("category") 40 | public CommonVO addCategory(@RequestBody Category category){ 41 | 42 | boolean save = categoryService.save(category); 43 | return new CommonVO(save,save?"保存成功":"保存失败"); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/system/FileController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.system; 2 | 3 | import com.xj.groupbuy.common.properties.FileProperties; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.http.MediaType; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import java.io.File; 13 | import java.io.FileInputStream; 14 | import java.io.IOException; 15 | 16 | /** 17 | * Author : zhangxiaojian 18 | * Date : 2021/4/19 19 | */ 20 | @Controller 21 | @RequestMapping("file") 22 | public class FileController { 23 | 24 | @Autowired 25 | private FileProperties fileProperties; 26 | 27 | @ResponseBody 28 | @RequestMapping(value = "image",produces = MediaType.IMAGE_JPEG_VALUE) 29 | public byte[] getImage(@RequestParam String filePath) throws IOException { 30 | 31 | FileInputStream is = null; 32 | byte[] bytes; 33 | try { 34 | File file = new File(fileProperties.getPath() + filePath); 35 | is = new FileInputStream(file); 36 | bytes = new byte[is.available()]; 37 | is.read(bytes, 0, is.available()); 38 | return bytes; 39 | } catch (Exception e) { 40 | e.printStackTrace(); 41 | } finally { 42 | if(is!=null){ 43 | is.close(); 44 | } 45 | } 46 | return null; 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/system/MenuController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.system; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.xj.groupbuy.common.vo.CommonVO; 6 | import com.xj.groupbuy.entity.Goods; 7 | import com.xj.groupbuy.entity.Menu; 8 | import com.xj.groupbuy.service.IMenuService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import java.util.List; 14 | 15 | /** 16 | *

17 | * 前端控制器 18 | *

19 | * 20 | * @author zhangxiaojian 21 | * @since 2021-03-11 22 | */ 23 | @RestController 24 | @RequestMapping("system/menu") 25 | public class MenuController { 26 | 27 | 28 | @Autowired 29 | IMenuService menuService; 30 | 31 | /** 32 | * 根据id删除菜单 33 | */ 34 | @DeleteMapping 35 | public CommonVO deleteMenu(Integer id){ 36 | return menuService.deleteMenu(id); 37 | } 38 | 39 | /** 40 | * 保存菜单 41 | */ 42 | @PostMapping 43 | public CommonVO saveMenu(@RequestBody Menu menu){ 44 | boolean save = menuService.saveMenu(menu); 45 | return new CommonVO(save,save?"保存成功":"保存失败"); 46 | } 47 | 48 | /** 49 | * 根据id查询单个菜单 50 | */ 51 | @GetMapping("{id}") 52 | public CommonVO getMenu(@PathVariable Integer id){ 53 | return new CommonVO(true,menuService.getById(id)); 54 | } 55 | 56 | /** 57 | * 更新菜单 58 | */ 59 | @PutMapping 60 | public CommonVO updateMenu(@RequestBody Menu menu){ 61 | if(menu.getParentId() == null){ 62 | menu.setParentId(0); 63 | } 64 | boolean update = menuService.updateById(menu); 65 | return new CommonVO(update,update?"修改成功":"修改失败"); 66 | } 67 | 68 | /** 69 | * 系统初始化左侧菜单 70 | * @return 树形菜单 71 | */ 72 | @GetMapping("initLeftMenu") 73 | public List getMenusByUserId() { 74 | return menuService.getMenusByUserId(); 75 | } 76 | 77 | /** 78 | * 获取所有菜单的id和name 79 | * @return 用于菜单权限管理 80 | */ 81 | @GetMapping("IdAndName") 82 | public List getAllMenusIdAndName() { 83 | return menuService.getAllMenusIdAndName(); 84 | } 85 | 86 | /** 87 | * 获取菜单表格 88 | * @return 用于菜单管理的表格展示 89 | */ 90 | @GetMapping("table") 91 | public CommonVO menuTable(String parentId, Integer pageNo, Integer pageSize, HttpServletRequest request){ 92 | return new CommonVO(true,menuService.menuTable(parentId,pageNo,pageSize)); 93 | } 94 | 95 | /** 96 | * 获取菜单树 97 | * @return 用于菜单管理的树状展示 98 | */ 99 | @GetMapping("tree") 100 | public CommonVO menuTree(){ 101 | return new CommonVO(true,menuService.menuTree()); 102 | } 103 | 104 | /** 105 | * 获取简单菜单树 106 | * @return 用于菜单管理的树状展示 107 | */ 108 | @GetMapping("easyTree") 109 | public CommonVO menuEasyTree(){ 110 | return new CommonVO(true,menuService.getMenuEasyTree()); 111 | } 112 | 113 | /** 114 | * 获取某个角色所对应的菜单 ID 115 | * @return 用于菜单权限管理的树状选择 116 | */ 117 | @GetMapping("ids/{roleId}") 118 | public List getMenuIdsByRoleId(@PathVariable Integer roleId) { 119 | return menuService.getLeafMenuIdsByRoleId(roleId); 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/system/MenuRoleController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.system; 2 | 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | /** 9 | *

10 | * 前端控制器 11 | *

12 | * 13 | * @author zhangxiaojian 14 | * @since 2021-03-24 15 | */ 16 | @RestController 17 | @RequestMapping("system/menuRole") 18 | public class MenuRoleController { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/system/RegionController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.system; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.service.IRegionService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import javax.servlet.http.HttpServletRequest; 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | * Author : zhangxiaojian 17 | * Date : 2021/4/16 18 | */ 19 | @RestController 20 | @RequestMapping("system/region") 21 | public class RegionController { 22 | 23 | @Autowired 24 | private IRegionService regionService; 25 | 26 | @GetMapping("allLevel/{id}") 27 | public CommonVO getAllLevelByCommunityId(@PathVariable Integer id){ 28 | return regionService.getAllLevelByCommunityId(id); 29 | } 30 | 31 | @GetMapping("province") 32 | public CommonVO getAllProvinces(){ 33 | List> result = regionService.getAllProvinces(); 34 | return new CommonVO(true,result); 35 | } 36 | 37 | @GetMapping("city/{provinceCode}") 38 | public CommonVO getCitysByProvinceCode(@PathVariable String provinceCode){ 39 | List> result = regionService.getCitysByProvinceCode(provinceCode); 40 | return new CommonVO(true,result); 41 | } 42 | @GetMapping("area/{cityCode}") 43 | public CommonVO getAreasByCityCode(@PathVariable String cityCode){ 44 | List> result = regionService.getAreasByCityCode(cityCode); 45 | return new CommonVO(true,result); 46 | } 47 | @GetMapping("street/{areaCode}") 48 | public CommonVO getStreetsByAreaCode(@PathVariable String areaCode){ 49 | List> result = regionService.getStreetsByAreaCode(areaCode); 50 | return new CommonVO(true,result); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/system/RoleController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.system; 2 | 3 | 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.Role; 6 | import com.xj.groupbuy.service.IRoleMenuService; 7 | import com.xj.groupbuy.service.IRoleService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | *

15 | * 前端控制器 16 | *

17 | * 18 | * @author zhangxiaojian 19 | * @since 2021-03-11 20 | */ 21 | @RestController 22 | @RequestMapping("system/role") 23 | public class RoleController { 24 | 25 | @Autowired 26 | private IRoleService roleService; 27 | @Autowired 28 | private IRoleMenuService roleMenuService; 29 | 30 | @PostMapping 31 | public CommonVO saveRole(@RequestBody Role role){ 32 | role.setName("ROLE_"+role.getName()); 33 | boolean save = roleService.save(role); 34 | return new CommonVO(save,save?"保存成功":"保存失败"); 35 | } 36 | @PutMapping 37 | public CommonVO updateRole(@RequestBody Role role){ 38 | boolean save = roleService.updateById(role); 39 | return new CommonVO(save,save?"修改成功":"修改失败"); 40 | } 41 | @GetMapping("{roleId}") 42 | public CommonVO getRole(@PathVariable Integer roleId){ 43 | Role byId = roleService.getById(roleId); 44 | return new CommonVO(true,byId); 45 | } 46 | @DeleteMapping("{roleId}") 47 | public CommonVO deleteRole(@PathVariable Integer roleId){ 48 | return roleService.deleteRole(roleId); 49 | } 50 | @RequestMapping("all") 51 | public CommonVO getAllRoles(){ 52 | List list = roleService.list(); 53 | return new CommonVO(true,list); 54 | } 55 | 56 | @PutMapping("roleMenu") 57 | public CommonVO updateRoleMenu(@RequestParam(value="roleId")Integer roleId,@RequestParam(value="menuIds") List menuIds){ 58 | 59 | return roleMenuService.updateRoleMenu(roleId,menuIds); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/user/CartController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.user; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.CartItem; 6 | import com.xj.groupbuy.entity.Goods; 7 | import com.xj.groupbuy.service.ICartService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | /** 12 | * Author : zhangxiaojian 13 | * Date : 2021/4/21 14 | */ 15 | @RestController 16 | @RequestMapping("user/cart") 17 | public class CartController { 18 | 19 | @Autowired 20 | private ICartService cartService; 21 | 22 | 23 | @GetMapping("checkHaveGoods") 24 | public CommonVO checkHaveGoods(){ 25 | return cartService.checkHaveGoods(); 26 | } 27 | @PostMapping("{goodsId}") 28 | public CommonVO addGoodsToCart(@PathVariable Integer goodsId){ 29 | return cartService.addGoodsToCart(goodsId); 30 | } 31 | 32 | @DeleteMapping("{cartItemId}") 33 | public CommonVO removeGoodsFromCart(@PathVariable Integer cartItemId){ 34 | return cartService.removeGoodsFromCart(cartItemId); 35 | } 36 | 37 | @GetMapping("all/{pageNo}/{pageSize}") 38 | public CommonVO getUserCart(@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize){ 39 | 40 | return cartService.haveUserCartWithItems(pageNo,pageSize); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/user/UserController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.user; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 4 | import com.xj.groupbuy.common.util.UserUtil; 5 | import com.xj.groupbuy.common.vo.CommonVO; 6 | import com.xj.groupbuy.entity.User; 7 | import com.xj.groupbuy.service.IUserService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.security.core.parameters.P; 10 | import org.springframework.security.crypto.password.PasswordEncoder; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.Map; 14 | 15 | /** 16 | * Author : zhangxiaojian 17 | * Date : 2021/3/28 18 | */ 19 | @RestController 20 | @RequestMapping("user") 21 | public class UserController { 22 | 23 | @Autowired 24 | private IUserService userService; 25 | @Autowired 26 | PasswordEncoder passwordEncoder; 27 | 28 | @GetMapping 29 | public CommonVO getUserDetail(){ 30 | User currentUser = UserUtil.getCurrentUser(); 31 | User user = userService.getById(currentUser.getUserId()); 32 | user.setPassword(null); 33 | return new CommonVO(true,user); 34 | } 35 | @PutMapping 36 | public CommonVO updateUserDetail(@RequestBody User user){ 37 | 38 | User currentUser = UserUtil.getCurrentUser(); 39 | 40 | if(!user.getUserId().equals(currentUser.getUserId())){ 41 | return new CommonVO(false,"异常操作"); 42 | } else { 43 | boolean update = userService.updateById(user); 44 | return new CommonVO(update,update?"更新成功":"更新失败"); 45 | } 46 | } 47 | @PutMapping("updatePassword") 48 | public CommonVO updatePassword(@RequestBody Map map){ 49 | String oldPassword = map.get("oldPassword").toString(); 50 | String newPassword = map.get("newPassword").toString(); 51 | String newPassword1 = map.get("newPassword1").toString(); 52 | 53 | User currentUser = UserUtil.getCurrentUser(); 54 | if(currentUser.getPassword().equals(passwordEncoder.encode(oldPassword))){ 55 | if(newPassword.equals(newPassword1)){ 56 | int i = userService.updatePassword(currentUser.getUserId(), passwordEncoder.encode(newPassword)); 57 | return new CommonVO(i == 1,i == 1?"修改成功":"修改失败"+i); 58 | } else { 59 | return new CommonVO(false,"两次输入密码不一样"); 60 | } 61 | } else { 62 | return new CommonVO(false,"旧密码不正确"); 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/user/UserFunctionController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.user; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.service.IRegionService; 5 | import com.xj.groupbuy.service.IUserApplyService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | /** 10 | * Author : zhangxiaojian 11 | * Date : 2021/4/20 12 | */ 13 | @RestController 14 | @RequestMapping("user") 15 | public class UserFunctionController { 16 | 17 | @Autowired 18 | private IUserApplyService userApplyService; 19 | 20 | @Autowired 21 | private IRegionService regionService; 22 | 23 | @GetMapping("community/{streetCode}") 24 | public CommonVO getCommunityByStreetCode(@PathVariable String streetCode){ 25 | return new CommonVO(true,regionService.getCommunityByStreetCode(streetCode)); 26 | } 27 | 28 | @PostMapping("apply/grouper") 29 | public CommonVO applyGrouper(){ 30 | return userApplyService.apply("grouper"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/user/UserGoodsController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.user; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.Goods; 6 | import com.xj.groupbuy.entity.GoodsEvaluate; 7 | import com.xj.groupbuy.service.ICartService; 8 | import com.xj.groupbuy.service.IGoodsService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | /** 13 | * Author : zhangxiaojian 14 | * Date : 2021/4/21 15 | */ 16 | @RestController 17 | @RequestMapping("user/goods") 18 | public class UserGoodsController { 19 | 20 | @Autowired 21 | private IGoodsService goodsService; 22 | 23 | @GetMapping("all/{pageNo}/{pageSize}") 24 | public Page getCommunityGoods(@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize){ 25 | 26 | Page page = new Page<>(pageNo,pageSize); 27 | return goodsService.getUserCommunityGoods(page); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/user/UserGoodsEvaluateController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.user; 2 | 3 | 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.GoodsEvaluate; 6 | import com.xj.groupbuy.service.IGoodsEvaluateService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | /** 11 | *

12 | * 前端控制器 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-04-24 17 | */ 18 | @RestController 19 | @RequestMapping("user/goods/evaluate") 20 | public class UserGoodsEvaluateController { 21 | 22 | @Autowired 23 | private IGoodsEvaluateService goodsEvaluateService; 24 | 25 | @GetMapping("{goodsId}") 26 | public CommonVO getGoodsEvaluate(@PathVariable Integer goodsId){ 27 | return goodsEvaluateService.getGoodsEvaluate(goodsId); 28 | } 29 | 30 | @PostMapping 31 | public CommonVO saveUserGoodsEvaluate(@RequestBody GoodsEvaluate goodsEvaluate){ 32 | return goodsEvaluateService.saveUserGoodsEvaluate(goodsEvaluate); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/controller/user/UserOrderController.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.controller.user; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.xj.groupbuy.common.util.UserUtil; 6 | import com.xj.groupbuy.common.vo.CommonVO; 7 | import com.xj.groupbuy.entity.Order; 8 | import com.xj.groupbuy.entity.OrderItem; 9 | import com.xj.groupbuy.service.IOrderItemService; 10 | import com.xj.groupbuy.service.IOrderService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * Author : zhangxiaojian 18 | * Date : 2021/4/21 19 | */ 20 | @RestController 21 | @RequestMapping("user/order") 22 | public class UserOrderController { 23 | 24 | @Autowired 25 | private IOrderService orderService; 26 | @Autowired 27 | private IOrderItemService orderItemService; 28 | 29 | @GetMapping("confirmOrderFinish/{orderItemId}") 30 | public CommonVO confirmOrderFinish(@PathVariable Integer orderItemId){ 31 | return orderService.confirmOrderFinish(orderItemId); 32 | } 33 | 34 | @PutMapping("confirmReceive/{orderId}") 35 | public CommonVO confirmReceive(@PathVariable Integer orderId){ 36 | return orderService.confirmReceive(orderId); 37 | } 38 | 39 | @PutMapping("payForOrder/{orderId}") 40 | public CommonVO payForOrder(@PathVariable Integer orderId){ 41 | return orderService.payForOrder(orderId); 42 | } 43 | 44 | @PutMapping("cancelOrder/{orderId}") 45 | public CommonVO cancelOrder(@PathVariable Integer orderId){ 46 | return orderService.cancelOrder(orderId); 47 | } 48 | 49 | @PostMapping 50 | public CommonVO createOrder(@RequestBody Order order){ 51 | return orderService.createOrder(order); 52 | } 53 | 54 | @GetMapping("createOrderDetail") 55 | public CommonVO getCreateOrderDetail(){ 56 | return orderService.createOrderDetail(); 57 | } 58 | 59 | @GetMapping("orderItems/{orderId}") 60 | public CommonVO getOrderItems(@PathVariable Integer orderId){ 61 | return orderItemService.getOrderItems(orderId); 62 | } 63 | 64 | @GetMapping("all/{pageNo}/{pageSize}") 65 | public IPage getTable(@PathVariable(value = "pageNo") Integer pageNo, @PathVariable(value = "pageSize") Integer pageSize){ 66 | 67 | return orderService.getTable(pageNo,pageSize); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/Cart.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.baomidou.mybatisplus.annotation.IdType; 6 | import com.baomidou.mybatisplus.annotation.TableId; 7 | import com.baomidou.mybatisplus.annotation.TableField; 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | import com.baomidou.mybatisplus.annotation.TableName; 12 | import lombok.Data; 13 | import lombok.EqualsAndHashCode; 14 | 15 | /** 16 | *

17 | * 18 | *

19 | * 20 | * @author zhangxiaojian 21 | * @since 2021-03-07 22 | */ 23 | @Data 24 | @EqualsAndHashCode(callSuper = false) 25 | @TableName("CART") 26 | public class Cart implements Serializable { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | @TableId(value = "ID",type = IdType.AUTO) 31 | private Integer id; 32 | 33 | @TableField("USER_ID") 34 | private String userId; 35 | 36 | @TableField("TOTAL_PRICE") 37 | private BigDecimal totalPrice; 38 | 39 | @TableField("GOODS_NUM") 40 | private Integer goodsNum; 41 | 42 | @TableField(exist = false) 43 | private List cartItems; 44 | 45 | public Cart(String userId) { 46 | this.userId = userId; 47 | this.totalPrice = BigDecimal.ZERO; 48 | this.goodsNum = 0; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/CartItem.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.baomidou.mybatisplus.annotation.IdType; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | 9 | import com.baomidou.mybatisplus.annotation.TableId; 10 | import com.baomidou.mybatisplus.annotation.TableName; 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author zhangxiaojian 20 | * @since 2021-04-20 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @TableName("CART_ITEM") 25 | public class CartItem implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @TableId(value = "ID",type = IdType.AUTO) 30 | private Integer id; 31 | 32 | @TableField("CART_ID") 33 | private Integer cartId; 34 | 35 | @TableField("GOODS_ID") 36 | private Integer goodsId; 37 | 38 | @TableField("GOODS_STORE_ID") 39 | private String goodsStoreId; 40 | 41 | @TableField("GOODS_NUM") 42 | private Integer goodsNum; 43 | 44 | @TableField("SPEC_KEY") 45 | private String specKey; 46 | 47 | @TableField("SPEC_KEY_NAME") 48 | private String specKeyName; 49 | 50 | public CartItem(Integer cartId, Integer goodsId, String goodsStoreId) { 51 | this.cartId = cartId; 52 | this.goodsId = goodsId; 53 | this.goodsStoreId = goodsStoreId; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/Category.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | import com.baomidou.mybatisplus.annotation.TableName; 10 | import lombok.Data; 11 | import lombok.EqualsAndHashCode; 12 | 13 | /** 14 | *

15 | * 16 | *

17 | * 18 | * @author zhangxiaojian 19 | * @since 2021-03-09 20 | */ 21 | @Data 22 | @EqualsAndHashCode(callSuper = false) 23 | @TableName("CATEGORY") 24 | public class Category implements Serializable,TreeEntity { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "CAT_ID",type = IdType.AUTO) 29 | private Integer catId; 30 | 31 | @TableField("CAT_NAME") 32 | private String catName; 33 | 34 | @TableField("PARENT_CAT_ID") 35 | private Integer parentCatId; 36 | 37 | @TableField("SORT") 38 | private int sort; 39 | 40 | @TableField(exist = false) 41 | private List children; 42 | 43 | @Override 44 | public Integer getTreeId() { 45 | return this.catId; 46 | } 47 | 48 | @Override 49 | public Integer getTreeParentId() { 50 | return this.parentCatId; 51 | } 52 | 53 | @Override 54 | public void setTreeChildren(List children) { 55 | this.children = children; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/Community.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | import com.baomidou.mybatisplus.annotation.TableName; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-17 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @TableName("COMMUNITY") 23 | public class Community implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "ID",type = IdType.AUTO) 28 | private Integer id; 29 | 30 | /** 31 | * 街道 32 | */ 33 | @TableField("STREET_CODE") 34 | private Long streetCode; 35 | 36 | /** 37 | * 社区名 38 | */ 39 | @TableField("NAME") 40 | private String name; 41 | 42 | /** 43 | * 详细位置 44 | */ 45 | @TableField("DETAIL_LOCATION") 46 | private String detailLocation; 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/CommunityGoods.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | import com.baomidou.mybatisplus.annotation.TableName; 9 | import com.xj.groupbuy.common.util.DateUtil; 10 | import com.xj.groupbuy.common.util.UserUtil; 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author zhangxiaojian 20 | * @since 2021-04-20 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @TableName("COMMUNITY_GOODS") 25 | public class CommunityGoods implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @TableId(value = "ID",type = IdType.AUTO) 30 | private Integer id; 31 | 32 | @TableField("COMMUNITY_ID") 33 | private Integer communityId; 34 | 35 | @TableField("GOODS_ID") 36 | private Integer goodsId; 37 | 38 | @TableField("ACTION_USER_ID") 39 | private String actionUserId; 40 | 41 | @TableField("ADD_TIME") 42 | private String addTime; 43 | 44 | 45 | public CommunityGoods(Integer id, Integer communityId) { 46 | this.goodsId = id; 47 | this.communityId = communityId; 48 | this.addTime = DateUtil.getCurrentDate(); 49 | this.actionUserId = UserUtil.getUserId(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/Goods.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.baomidou.mybatisplus.annotation.IdType; 6 | import com.baomidou.mybatisplus.annotation.TableId; 7 | import com.baomidou.mybatisplus.annotation.TableField; 8 | import java.io.Serializable; 9 | 10 | import com.baomidou.mybatisplus.annotation.TableName; 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author zhangxiaojian 20 | * @since 2021-03-08 21 | */ 22 | @Data 23 | @TableName("GOODS") 24 | public class Goods implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "ID",type = IdType.AUTO) 29 | private Integer id; 30 | 31 | @TableField("GOODS_STORE_ID") 32 | private String goodsStoreId; 33 | 34 | @TableField("GOODS_NAME") 35 | private String goodsName; 36 | 37 | @TableField("GOODS_CAT") 38 | private Integer goodsCat; 39 | 40 | @TableField("GOODS_EASY_DESC") 41 | private String goodsEasyDesc; 42 | 43 | @TableField("GOODS_DESC") 44 | private String goodsDesc; 45 | 46 | @TableField("GOODS_STOCK") 47 | private Integer goodsStock; 48 | 49 | @TableField("GOODS_WEIGHT") 50 | private String goodsWeight; 51 | 52 | @TableField("GOODS_UNIT") 53 | private String goodsUnit; 54 | 55 | @TableField("GOODS_PRICE") 56 | private BigDecimal goodsPrice; 57 | 58 | @TableField("GOODS_IMG") 59 | private String goodsImg; 60 | 61 | /** 62 | * 是否上架 63 | */ 64 | @TableField("IS_ON_SALE") 65 | private Boolean isOnSale; 66 | 67 | /** 68 | * 是否包邮0否1是 69 | */ 70 | @TableField("IS_FREE_SHIPPING") 71 | private Boolean isFreeShipping; 72 | 73 | /** 74 | * 是否推荐 75 | */ 76 | @TableField("IS_RECOMMEND") 77 | private Boolean isRecommend; 78 | 79 | /** 80 | * 是否新品 81 | */ 82 | @TableField("IS_NEW") 83 | private Boolean isNew; 84 | 85 | /** 86 | * 更新时间 87 | */ 88 | @TableField("UPDATE_TIME") 89 | private String updateTime; 90 | 91 | /** 92 | * 售出数量 93 | */ 94 | @TableField("SALE_COUNT") 95 | private Integer saleCount; 96 | 97 | /** 98 | * 奖励积分 99 | */ 100 | @TableField("INTEGRAL") 101 | private Integer integral; 102 | 103 | 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/GoodsEvaluate.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | import com.baomidou.mybatisplus.annotation.TableName; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-24 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @TableName("GOODS_EVALUATE") 23 | public class GoodsEvaluate implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "ID",type = IdType.AUTO) 28 | private Integer id; 29 | 30 | @TableField("ORDER_ITEM_ID") 31 | private Integer orderItemId; 32 | 33 | /** 34 | * 评价等级 35 | */ 36 | @TableField("LEVEL") 37 | private Integer level; 38 | 39 | /** 40 | * 用户评价内容 41 | */ 42 | @TableField("USER_NOTE") 43 | private String userNote; 44 | 45 | /** 46 | * 商家评价内容 47 | */ 48 | @TableField("STORE_NOTE") 49 | private String storeNote; 50 | 51 | @TableField("CREATE_TIME") 52 | private String createTime; 53 | 54 | @TableField("UPDATE_TIME") 55 | private String updateTime; 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/Menu.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | import com.baomidou.mybatisplus.annotation.TableName; 10 | import com.fasterxml.jackson.annotation.JsonIgnore; 11 | import lombok.AccessLevel; 12 | import lombok.Data; 13 | import lombok.EqualsAndHashCode; 14 | import lombok.Getter; 15 | 16 | /** 17 | *

18 | * 19 | *

20 | * 21 | * @author zhangxiaojian 22 | * @since 2021-03-11 23 | */ 24 | @Data 25 | @EqualsAndHashCode(callSuper = false) 26 | @TableName("menu") 27 | public class Menu implements Serializable,TreeEntity { 28 | 29 | private static final long serialVersionUID = 1L; 30 | 31 | @TableId(value = "ID",type = IdType.AUTO) 32 | private Integer id; 33 | 34 | @TableField("URL") 35 | private String url; 36 | 37 | @TableField("PATH") 38 | private String path; 39 | 40 | @TableField("COMPONENT") 41 | private String component; 42 | 43 | @TableField("NAME") 44 | private String name; 45 | 46 | @TableField("ICON_CLS") 47 | private String iconCls; 48 | 49 | @TableField("PARENT_ID") 50 | private Integer parentId; 51 | 52 | @TableField("ENABLED") 53 | private Boolean enabled; 54 | 55 | @TableField("SORT") 56 | private Integer sort; 57 | 58 | @TableField(exist = false) 59 | private Meta meta; 60 | 61 | @TableField(exist = false) 62 | private List children; 63 | 64 | @TableField(exist = false) 65 | private List roles; 66 | 67 | 68 | @Override 69 | @JsonIgnore 70 | public Integer getTreeId() { 71 | return this.id; 72 | } 73 | 74 | @Override 75 | @JsonIgnore 76 | public Integer getTreeParentId() { 77 | return this.parentId; 78 | } 79 | 80 | @Override 81 | @JsonIgnore 82 | public boolean isTreeEnabled() { 83 | return this.enabled; 84 | } 85 | 86 | @Override 87 | public void setTreeChildren(List children) { 88 | this.children = children; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/Meta.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * Author : zhangxiaojian 9 | * Date : 2021/3/20 10 | */ 11 | 12 | @Data 13 | public class Meta implements Serializable { 14 | 15 | private static final long serialVersionUID = 4481526064896844012L; 16 | 17 | private Boolean keepAlive; 18 | 19 | private Boolean requireAuth; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/Notice.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | import com.baomidou.mybatisplus.annotation.TableName; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-25 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @TableName("NOTICE") 23 | public class Notice implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "ID",type = IdType.AUTO) 28 | private Integer id; 29 | 30 | @TableField("ACTION_USER_ID") 31 | private String actionUserId; 32 | 33 | @TableField("TITLE") 34 | private String title; 35 | 36 | @TableField("CONTENT") 37 | private String content; 38 | 39 | @TableField("REASON") 40 | private String reason; 41 | 42 | @TableField("CREATE_TIME") 43 | private String createTime; 44 | 45 | /** 46 | * 公告类型:1.重要,2.奖励,3.处罚 47 | */ 48 | @TableField("MODE") 49 | private Integer mode; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/Order.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.baomidou.mybatisplus.annotation.IdType; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | 9 | import com.baomidou.mybatisplus.annotation.TableId; 10 | import com.baomidou.mybatisplus.annotation.TableName; 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author zhangxiaojian 20 | * @since 2021-04-21 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @TableName("`order`") 25 | public class Order implements Serializable,Cloneable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @TableId(value = "ID",type = IdType.AUTO) 30 | private Integer id; 31 | 32 | @TableField("USER_ID") 33 | private String userId; 34 | 35 | @TableField("STORE_ID") 36 | private String storeId; 37 | 38 | @TableField("PARENT_ORDER_ID") 39 | private Integer parentOrderId; 40 | 41 | @TableField("COUPON_ID") 42 | private Integer couponId; 43 | 44 | @TableField("CREATE_TIME") 45 | private String createTime; 46 | 47 | @TableField("CONSIGNEE") 48 | private String consignee; 49 | 50 | @TableField("ADDRESS") 51 | private String address; 52 | 53 | /** 54 | * 折扣 55 | */ 56 | @TableField("DISCOUNT") 57 | private String discount; 58 | 59 | @TableField("USE_INTEGRAL") 60 | private String useIntegral; 61 | 62 | @TableField("USE_INTEGRAL_MONEY") 63 | private String useIntegralMoney; 64 | 65 | @TableField("PHONE") 66 | private String phone; 67 | 68 | @TableField("TOTAL_PRICE") 69 | private BigDecimal totalPrice; 70 | 71 | @TableField("GOODS_PRICE") 72 | private BigDecimal goodsPrice; 73 | 74 | @TableField("SHIPPING_PRICE") 75 | private BigDecimal shippingPrice; 76 | 77 | @TableField("PAY_PRICE") 78 | private BigDecimal payPrice; 79 | 80 | @TableField("COUPON_PRICE") 81 | private BigDecimal couponPrice; 82 | 83 | @TableField("ORDER_STATUS") 84 | private String orderStatus; 85 | 86 | @TableField("PAY_CODE") 87 | private String payCode; 88 | 89 | @TableField("PAY_NAME") 90 | private String payName; 91 | 92 | @TableField("PAY_TIME") 93 | private String payTime; 94 | 95 | @TableField("SHIPPING_CODE") 96 | private String shippingCode; 97 | 98 | @TableField("SHIPPING_NAME") 99 | private String shippingName; 100 | 101 | @TableField("SHIPPING_STATUS") 102 | private String shippingStatus; 103 | 104 | @TableField("SHIPPING_TIME") 105 | private String shippingTime; 106 | 107 | @TableField("USER_NOTE") 108 | private String userNote; 109 | 110 | @Override 111 | protected Object clone() throws CloneNotSupportedException { 112 | return super.clone(); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/OrderItem.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.baomidou.mybatisplus.annotation.IdType; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | 9 | import com.baomidou.mybatisplus.annotation.TableId; 10 | import com.baomidou.mybatisplus.annotation.TableName; 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author zhangxiaojian 20 | * @since 2021-04-21 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @TableName("ORDER_ITEM") 25 | public class OrderItem implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @TableId(value = "ID",type = IdType.AUTO) 30 | private Integer id; 31 | 32 | @TableField("ORDER_ID") 33 | private Integer orderId; 34 | 35 | @TableField("GOODS_ID") 36 | private Integer goodsId; 37 | 38 | @TableField("GOODS_NUM") 39 | private Integer goodsNum; 40 | 41 | @TableField("GOODS_PRICE") 42 | private BigDecimal goodsPrice; 43 | 44 | @TableField("GOODS_UNIT") 45 | private String goodsUnit; 46 | 47 | @TableField("SPEC_KEY") 48 | private String specKey; 49 | 50 | @TableField("SPEC_KEY_NAME") 51 | private String specKeyName; 52 | 53 | public OrderItem(){} 54 | 55 | public OrderItem(Integer orderId , CartItem cartItem) { 56 | this.orderId = orderId; 57 | this.goodsId = cartItem.getGoodsId(); 58 | this.goodsNum = cartItem.getGoodsNum(); 59 | this.specKey = cartItem.getSpecKey(); 60 | this.specKeyName = cartItem.getSpecKeyName(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/Role.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import java.io.Serializable; 7 | 8 | import com.baomidou.mybatisplus.annotation.TableName; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-03-11 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @TableName("role") 23 | public class Role implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "ROLE_ID",type = IdType.AUTO) 28 | private Integer roleId; 29 | 30 | @TableField("NAME") 31 | private String name; 32 | 33 | @TableField("nameZh") 34 | private String nameZh; 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/RoleMenu.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | import com.baomidou.mybatisplus.annotation.TableName; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-03-24 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @TableName("role_menu") 23 | public class RoleMenu implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "ID",type = IdType.AUTO) 28 | private Integer id; 29 | 30 | @TableField("MENU_ID") 31 | private Integer menuId; 32 | 33 | @TableField("ROLE_ID") 34 | private Integer roleId; 35 | 36 | 37 | public RoleMenu(Integer roleId, Integer menuId) { 38 | this.roleId = roleId; 39 | this.menuId = menuId; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/StaffReward.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | import com.baomidou.mybatisplus.annotation.TableName; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-14 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @TableName("STAFF_REWARD") 23 | public class StaffReward implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "ID",type = IdType.AUTO) 28 | private Integer id; 29 | 30 | @TableField("USER_ID") 31 | private String userId; 32 | 33 | @TableField("REWARD_NAME") 34 | private String rewardName; 35 | 36 | @TableField("REWARD_DESC") 37 | private String rewardDesc; 38 | 39 | @TableField("CREATE_TIME") 40 | private String createTime; 41 | 42 | @TableField("ACTION_USER_ID") 43 | private String actionUserId; 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/StaffScore.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.baomidou.mybatisplus.annotation.IdType; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | 9 | import com.baomidou.mybatisplus.annotation.TableId; 10 | import com.baomidou.mybatisplus.annotation.TableName; 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author zhangxiaojian 20 | * @since 2021-04-12 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @TableName("STAFF_SCORE") 25 | public class StaffScore implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @TableId(value = "ID",type = IdType.AUTO) 30 | private String ID; 31 | 32 | /** 33 | * 员工ID 34 | */ 35 | @TableField("USER_ID") 36 | private String userId; 37 | 38 | /** 39 | * 员工奖惩考核分数 40 | */ 41 | @TableField("SCORE") 42 | private BigDecimal score; 43 | 44 | 45 | public StaffScore(String userId) { 46 | this.userId = userId; 47 | this.score = BigDecimal.valueOf(100); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/StaffScoreLog.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.baomidou.mybatisplus.annotation.IdType; 6 | import com.baomidou.mybatisplus.annotation.TableField; 7 | import java.io.Serializable; 8 | 9 | import com.baomidou.mybatisplus.annotation.TableId; 10 | import com.baomidou.mybatisplus.annotation.TableName; 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * ?. 19 | * @author zhangxiaojian 20 | q1` 21 | * @since 2021-04-12 22 | */ 23 | @Data 24 | @EqualsAndHashCode(callSuper = false) 25 | @TableName("STAFF_SCORE_LOG") 26 | public class StaffScoreLog implements Serializable { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | @TableId(value = "ID",type = IdType.AUTO) 31 | private String ID; 32 | 33 | @TableField("USER_ID") 34 | private String userId; 35 | 36 | /** 37 | * 操作前分数 38 | */ 39 | @TableField("CHANGE_SCORE") 40 | private BigDecimal changeScore; 41 | 42 | /** 43 | * 操作前分数 44 | */ 45 | @TableField("BEFORE_SCORE") 46 | private BigDecimal beforeScore; 47 | 48 | /** 49 | * 操作后分数 50 | */ 51 | @TableField("AFTER_SCORE") 52 | private BigDecimal afterScore; 53 | 54 | /** 55 | * 操作人ID 56 | */ 57 | @TableField("ACTION_USER_ID") 58 | private String actionUserId; 59 | 60 | /** 61 | * 分数变更原因 62 | */ 63 | @TableField("REASON") 64 | private String reason; 65 | 66 | /** 67 | * 记录时间 68 | */ 69 | @TableField("LOG_TIME") 70 | private String logTime; 71 | 72 | /** 73 | * 1增长,0减少 74 | */ 75 | @TableField("ACTION") 76 | private Boolean action; 77 | 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/StaffTrain.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | import java.util.List; 7 | 8 | import com.baomidou.mybatisplus.annotation.TableId; 9 | import com.baomidou.mybatisplus.annotation.TableName; 10 | import com.xj.groupbuy.common.util.DateUtil; 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author zhangxiaojian 20 | * @since 2021-04-07 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @TableName("staff_train") 25 | public class StaffTrain implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | 30 | @TableId(value = "ID",type = IdType.AUTO) 31 | private Integer id; 32 | 33 | @TableField("TRAIN_NAME") 34 | private String trainName; 35 | 36 | @TableField("TRAIN_CONTENT") 37 | private String trainContent; 38 | 39 | @TableField("CREATE_TIME") 40 | private String createTime; 41 | 42 | @TableField("CREATE_USER_ID") 43 | private String createUserId; 44 | 45 | @TableField(exist = false) 46 | private List files; 47 | 48 | 49 | public StaffTrain(String trainName, String trainContent, String userId) { 50 | this.trainName = trainName; 51 | this.trainContent = trainContent; 52 | this.createUserId = userId; 53 | this.createTime = DateUtil.getCurrentDate(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/TTest.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import lombok.Data; 6 | 7 | /** 8 | * Author : zhangxiaojian 9 | * Date : 2021/3/1 10 | */ 11 | @Data 12 | @TableName("T_TEST") 13 | public class TTest { 14 | 15 | private String id; 16 | private String name; 17 | private int age; 18 | 19 | @TableField(exist = false) 20 | private String userName; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/TrainFile.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-07 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @TableName("train_file") 23 | public class TrainFile implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "ID",type = IdType.AUTO) 28 | private Integer id; 29 | 30 | @TableField("TRAIN_ID") 31 | private Integer trainId; 32 | 33 | @TableField("FILE_PATH") 34 | private String filePath; 35 | 36 | 37 | public TrainFile(Integer trainId, String uploadFileName) { 38 | this.trainId = trainId; 39 | this.filePath = uploadFileName; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/TreeEntity.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Author : zhangxiaojian 7 | * Date : 2021/3/23 8 | */ 9 | public interface TreeEntity { 10 | Integer getTreeId(); 11 | Integer getTreeParentId(); 12 | default boolean isTreeEnabled(){ 13 | return true; 14 | } 15 | void setTreeChildren(List children); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import java.io.Serializable; 7 | import java.util.ArrayList; 8 | import java.util.Collection; 9 | import java.util.List; 10 | 11 | import com.baomidou.mybatisplus.annotation.TableName; 12 | import com.fasterxml.jackson.annotation.JsonIgnore; 13 | import lombok.AccessLevel; 14 | import lombok.Data; 15 | import lombok.EqualsAndHashCode; 16 | import lombok.Getter; 17 | import org.springframework.security.core.GrantedAuthority; 18 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 19 | import org.springframework.security.core.userdetails.UserDetails; 20 | 21 | /** 22 | *

23 | * 24 | *

25 | * 26 | * @author zhangxiaojian 27 | * @since 2021-03-07 28 | */ 29 | @Data 30 | @EqualsAndHashCode(callSuper = false) 31 | @TableName("`USER`") 32 | public class User implements Serializable, UserDetails { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | @TableId(value = "USER_ID",type = IdType.ASSIGN_ID) 37 | private String userId; 38 | 39 | @TableField("COMMUNITY_ID") 40 | private Integer communityId; 41 | 42 | @TableField("NAME") 43 | private String name; 44 | 45 | @TableField("USERNAME") 46 | private String username; 47 | 48 | @TableField("PASSWORD") 49 | private String password; 50 | 51 | @TableField("SEX") 52 | private Boolean sex; 53 | 54 | @TableField("PHONE") 55 | private String phone; 56 | 57 | @TableField("detail_ADDRESS") 58 | private String detailAddress; 59 | 60 | @TableField("ENABLED") 61 | @Getter(AccessLevel.NONE) 62 | private Boolean enabled; 63 | 64 | @TableField(exist = false) 65 | private List roles; 66 | 67 | 68 | public User() { 69 | 70 | } 71 | public User(String username, String password) { 72 | this.username = username; 73 | this.password = password; 74 | } 75 | 76 | 77 | @Override 78 | @JsonIgnore 79 | public Collection getAuthorities() { 80 | List authorities = new ArrayList<>(); 81 | for (Role role : roles) { 82 | authorities.add(new SimpleGrantedAuthority(role.getName())); 83 | } 84 | return authorities; 85 | } 86 | 87 | @Override 88 | public String getPassword() { 89 | return this.password; 90 | } 91 | 92 | @Override 93 | public String getUsername() { 94 | return this.username; 95 | } 96 | 97 | @Override 98 | public boolean isAccountNonExpired() { 99 | return true; 100 | } 101 | 102 | @Override 103 | public boolean isAccountNonLocked() { 104 | return true; 105 | } 106 | 107 | @Override 108 | public boolean isCredentialsNonExpired() { 109 | return true; 110 | } 111 | 112 | @Override 113 | public boolean isEnabled() { 114 | return true; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/UserApply.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | import com.baomidou.mybatisplus.annotation.TableName; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-20 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @TableName("USER_APPLY") 23 | public class UserApply implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "ID",type = IdType.AUTO) 28 | private Integer id; 29 | 30 | @TableField("USER_ID") 31 | private String userId; 32 | 33 | @TableField("ROLE") 34 | private String role; 35 | 36 | 37 | public UserApply(String userId, String role) { 38 | this.userId = userId; 39 | this.role = role; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/entity/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import java.io.Serializable; 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | import com.baomidou.mybatisplus.annotation.TableName; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-02 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @TableName("USER_ROLE") 23 | public class UserRole implements Serializable { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @TableId(value = "id",type = IdType.AUTO) 28 | private Integer id; 29 | 30 | @TableField("USER_ID") 31 | private String userId; 32 | 33 | @TableField("ROLE_ID") 34 | private Integer roleId; 35 | 36 | 37 | public UserRole(String userId, Integer roleId) { 38 | this.userId = userId; 39 | this.roleId = roleId; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/CartItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.xj.groupbuy.entity.CartItem; 6 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 7 | import org.apache.ibatis.annotations.Mapper; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | *

14 | * Mapper 接口 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-20 19 | */ 20 | @Mapper 21 | public interface CartItemMapper extends BaseMapper { 22 | 23 | IPage getCartItems(Integer cartId, Page> page); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/CartMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.Cart; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-03-07 14 | */ 15 | @Mapper 16 | public interface CartMapper extends BaseMapper { 17 | 18 | Cart selectCartWithItems(String userId); 19 | 20 | Integer selectStoreCount(Integer cartId); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/CategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.Category; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * Mapper 接口 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-03-09 17 | */ 18 | @Mapper 19 | public interface CategoryMapper extends BaseMapper { 20 | 21 | Map getParentLevelId(Integer id); 22 | 23 | List> getAllOne(); 24 | 25 | List> getTwoByOne(Integer one); 26 | 27 | List> getThreeByTwo(Integer two); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/CommunityGoodsMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.CommunityGoods; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-20 14 | */ 15 | @Mapper 16 | public interface CommunityGoodsMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/CommunityMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.xj.groupbuy.entity.Community; 6 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 7 | import org.apache.ibatis.annotations.Mapper; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | *

14 | * Mapper 接口 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-04-15 19 | */ 20 | @Mapper 21 | public interface CommunityMapper extends BaseMapper { 22 | 23 | IPage getTable(String provinceCode, String cityCode, String areaCode, String streetCode, Page> page); 24 | 25 | Map getParentLevelId(Integer id); 26 | 27 | Map getParentLevelName(Integer id); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/GoodsEvaluateMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.GoodsEvaluate; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author zhangxiaojian 15 | * @since 2021-04-24 16 | */ 17 | @Mapper 18 | public interface GoodsEvaluateMapper extends BaseMapper { 19 | 20 | List getGoodsEvaluate(Integer goodsId); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/GoodsMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.xj.groupbuy.entity.Goods; 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import org.apache.ibatis.annotations.Mapper; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author zhangxiaojian 17 | * @since 2021-03-08 18 | */ 19 | @Mapper 20 | public interface GoodsMapper extends BaseMapper { 21 | 22 | Page getCommunityGoods(Integer communityId, Page page); 23 | 24 | Page getStoreGoods(Page page); 25 | 26 | List> getStoreDayData(String storeId,String date); 27 | 28 | List> getStoreMonthAnalysis(String storeId, String date); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/LoginMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import org.apache.ibatis.annotations.Mapper; 4 | 5 | /** 6 | * Author : zhangxiaojian 7 | * Date : 2021/4/26 8 | */ 9 | @Mapper 10 | public interface LoginMapper { 11 | String checkLogin(String token); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/MenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.Menu; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author zhangxiaojian 15 | * @since 2021-03-11 16 | */ 17 | @Mapper 18 | public interface MenuMapper extends BaseMapper { 19 | 20 | List getAllMenusWithRole(); 21 | 22 | List getMenusByUserId(String userId); 23 | 24 | List getAllMenusIdAndName(); 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/NoticeMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.Notice; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-25 14 | */ 15 | @Mapper 16 | public interface NoticeMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/OrderItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.OrderItem; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author zhangxiaojian 15 | * @since 2021-04-21 16 | */ 17 | @Mapper 18 | public interface OrderItemMapper extends BaseMapper { 19 | 20 | List getOrderItems(Integer orderId); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.xj.groupbuy.entity.Order; 6 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 7 | import org.apache.ibatis.annotations.Mapper; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author zhangxiaojian 17 | * @since 2021-04-21 18 | */ 19 | @Mapper 20 | public interface OrderMapper extends BaseMapper { 21 | 22 | IPage getTable(String userId,Page page); 23 | 24 | IPage getStoreOrderTable(String storeId, Page page); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/RegionMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import org.apache.ibatis.annotations.Mapper; 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | /** 9 | * Author : zhangxiaojian 10 | * Date : 2021/4/16 11 | */ 12 | @Mapper 13 | public interface RegionMapper { 14 | List> getAllProvinces(); 15 | 16 | List> getCitysByProvinceCode(String provinceCode); 17 | 18 | List> getAreasByCityCode(String cityCode); 19 | 20 | List> getStreetsByAreaCode(String areaCode); 21 | 22 | List> getCommunityByStreetCode(String streetCode); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.Role; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-03-11 14 | */ 15 | @Mapper 16 | public interface RoleMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/RoleMenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.xj.groupbuy.entity.RoleMenu; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author zhangxiaojian 15 | * @since 2021-03-24 16 | */ 17 | @Mapper 18 | public interface RoleMenuMapper extends BaseMapper { 19 | 20 | List getMenuIdsByRoleId(Integer roleId,boolean onlyLeaf); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/StaffRewardMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.StaffReward; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-14 14 | */ 15 | @Mapper 16 | public interface StaffRewardMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/StaffScoreLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.StaffScoreLog; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-12 14 | */ 15 | @Mapper 16 | public interface StaffScoreLogMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/StaffScoreMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.xj.groupbuy.entity.StaffScore; 6 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 7 | import com.xj.groupbuy.entity.User; 8 | import org.apache.ibatis.annotations.Mapper; 9 | 10 | /** 11 | *

12 | * Mapper 接口 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-04-12 17 | */ 18 | @Mapper 19 | public interface StaffScoreMapper extends BaseMapper { 20 | 21 | IPage getStaffScores(Page page); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/StaffTrainMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.StaffTrain; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author zhangxiaojian 15 | * @since 2021-04-07 16 | */ 17 | @Mapper 18 | public interface StaffTrainMapper extends BaseMapper { 19 | 20 | List getStaffTrainDetail(Integer trainId); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/TestMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.xj.groupbuy.entity.TTest; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * Author : zhangxiaojian 9 | * Date : 2021/3/1 10 | */ 11 | //@Repository 12 | @Mapper 13 | public interface TestMapper extends BaseMapper { 14 | 15 | 16 | TTest getTest(String id); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/TrainFileMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.TrainFile; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-07 14 | */ 15 | @Mapper 16 | public interface TrainFileMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/UserApplyMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.UserApply; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-20 14 | */ 15 | @Mapper 16 | public interface UserApplyMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.Wrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.core.toolkit.Constants; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.xj.groupbuy.entity.Role; 8 | import com.xj.groupbuy.entity.User; 9 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 10 | import org.apache.ibatis.annotations.Mapper; 11 | import org.apache.ibatis.annotations.Param; 12 | 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | *

18 | * Mapper 接口 19 | *

20 | * 21 | * @author zhangxiaojian 22 | * @since 2021-03-07 23 | */ 24 | @Mapper 25 | public interface UserMapper extends BaseMapper { 26 | 27 | List getUserRolesById(String userId); 28 | 29 | IPage getAllUserSimple(String name, String userId, 30 | Page page); 31 | 32 | IPage getUsersByRole(String userRole, Page userPage); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/mapper/UserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.mapper; 2 | 3 | import com.xj.groupbuy.entity.UserRole; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * Mapper 接口 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-04-02 17 | */ 18 | @Mapper 19 | public interface UserRoleMapper extends BaseMapper { 20 | 21 | List getUserRolesIdById(String userId); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/ICartItemService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.entity.CartItem; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author zhangxiaojian 12 | * @since 2021-04-20 13 | */ 14 | public interface ICartItemService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/ICartService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.Cart; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | import com.xj.groupbuy.entity.CartItem; 8 | import com.xj.groupbuy.entity.Goods; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-03-07 17 | */ 18 | public interface ICartService extends IService { 19 | 20 | CommonVO addGoodsToCart(Integer goodsId); 21 | 22 | Cart haveUserCart(); 23 | 24 | CommonVO haveUserCartWithItems(Integer pageNo,Integer pageSize); 25 | 26 | CommonVO removeGoodsFromCart(Integer cartItemId); 27 | 28 | Boolean clearCart(Integer cartId); 29 | 30 | CommonVO checkHaveGoods(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/ICategoryService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.Category; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-03-09 17 | */ 18 | public interface ICategoryService extends IService { 19 | 20 | List getCategoryTree(); 21 | 22 | CommonVO getAllLevelByCatId(Integer id); 23 | 24 | List> getAllOne(); 25 | 26 | List> getTwoByOne(Integer one); 27 | 28 | List> getThreeByTwo(Integer two); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/ICommunityGoodsService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.entity.CommunityGoods; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author zhangxiaojian 12 | * @since 2021-04-20 13 | */ 14 | public interface ICommunityGoodsService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/ICommunityService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.xj.groupbuy.entity.Community; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-15 14 | */ 15 | public interface ICommunityService extends IService { 16 | 17 | IPage table(String level, String parentCode, Integer pageNo, Integer pageSize); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IDataAnalysisService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | 5 | /** 6 | * Author : zhangxiaojian 7 | * Date : 2021/4/26 8 | */ 9 | public interface IDataAnalysisService { 10 | CommonVO getStoreDayAnalysis(String storeId); 11 | 12 | CommonVO getStoreMonthAnalysis(String storeId); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IGoodsEvaluateService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.GoodsEvaluate; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-24 14 | */ 15 | public interface IGoodsEvaluateService extends IService { 16 | 17 | CommonVO saveUserGoodsEvaluate(GoodsEvaluate goodsEvaluate); 18 | 19 | CommonVO getGoodsEvaluate(Integer goodsId); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IGoodsService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.Goods; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | import org.springframework.web.multipart.MultipartFile; 8 | 9 | /** 10 | *

11 | * 服务类 12 | *

13 | * 14 | * @author zhangxiaojian 15 | * @since 2021-03-08 16 | */ 17 | public interface IGoodsService extends IService { 18 | 19 | CommonVO updateGoods(MultipartFile[] multipartFiles, Goods goods); 20 | 21 | CommonVO deleteGoods(Integer id); 22 | 23 | Page getCommunityGoods(Boolean select, Page page); 24 | 25 | Page getUserCommunityGoods(Page page); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/ILoginService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | /** 9 | * Author : zhangxiaojian 10 | * Date : 2021/4/26 11 | */ 12 | public interface ILoginService { 13 | CommonVO checkLogin(HttpServletRequest request,HttpServletResponse response); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IMenuService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.xj.groupbuy.common.vo.CommonVO; 6 | import com.xj.groupbuy.entity.Goods; 7 | import com.xj.groupbuy.entity.Menu; 8 | import com.baomidou.mybatisplus.extension.service.IService; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | *

14 | * 服务类 15 | *

16 | * 17 | * @author zhangxiaojian 18 | * @since 2021-03-11 19 | */ 20 | public interface IMenuService extends IService { 21 | 22 | List getAllMenusWithRole(); 23 | 24 | List getMenusByUserId(); 25 | 26 | List getAllMenusIdAndName(); 27 | 28 | List getLeafMenuIdsByRoleId(Integer roleId); 29 | 30 | IPage menuTable(String parentId, Integer pageNo, Integer pageSize); 31 | 32 | List menuTree(); 33 | 34 | boolean saveMenu(Menu menu); 35 | 36 | CommonVO deleteMenu(Integer id); 37 | 38 | List getMenuEasyTree(); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/INoticeService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.Notice; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author zhangxiaojian 14 | * @since 2021-04-25 15 | */ 16 | public interface INoticeService extends IService { 17 | 18 | CommonVO addNotice(Notice notice); 19 | 20 | IPage getNotices(Integer mode, Integer pageNo, Integer pageSize); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IOrderItemService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.OrderItem; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-21 14 | */ 15 | public interface IOrderItemService extends IService { 16 | 17 | CommonVO getOrderItems(Integer orderId); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IOrderService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.Order; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | import org.springframework.ui.Model; 8 | 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * 服务类 14 | *

15 | * 16 | * @author zhangxiaojian 17 | * @since 2021-04-21 18 | */ 19 | public interface IOrderService extends IService { 20 | 21 | CommonVO createOrder(Order order); 22 | 23 | CommonVO createOrderDetail(); 24 | 25 | IPage getTable(Integer pageNo, Integer pageSize); 26 | 27 | CommonVO payForOrder(Integer orderId); 28 | 29 | CommonVO cancelOrder(Integer orderId); 30 | 31 | IPage getStoreOrderTable(String storeId, Integer pageNo, Integer pageSize); 32 | 33 | CommonVO deliver(Map map); 34 | 35 | CommonVO confirmArrived(Integer orderId); 36 | 37 | CommonVO confirmReceive(Integer orderId); 38 | 39 | CommonVO confirmOrderFinish(Integer orderItemId); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IRegionService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.mapper.RegionMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * Author : zhangxiaojian 13 | * Date : 2021/4/16 14 | */ 15 | public interface IRegionService { 16 | 17 | List> getAllProvinces(); 18 | 19 | List> getCitysByProvinceCode(String provinceCode); 20 | 21 | List> getAreasByCityCode(String cityCode); 22 | 23 | List> getStreetsByAreaCode(String areaCode); 24 | 25 | CommonVO getAllLevelByCommunityId(Integer id); 26 | 27 | List> getCommunityByStreetCode(String streetCode); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IRoleMenuService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.RoleMenu; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * 服务类 12 | *

13 | * 14 | * @author zhangxiaojian 15 | * @since 2021-03-24 16 | */ 17 | public interface IRoleMenuService extends IService { 18 | 19 | CommonVO updateRoleMenu(Integer roleId, List menuIds); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IRoleService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.Role; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-03-11 14 | */ 15 | public interface IRoleService extends IService { 16 | 17 | CommonVO deleteRole(Integer roleId); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IStaffRewardService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.StaffReward; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author zhangxiaojian 14 | * @since 2021-04-14 15 | */ 16 | public interface IStaffRewardService extends IService { 17 | 18 | CommonVO saveStaffReward(StaffReward staffReward); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IStaffScoreLogService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.StaffScoreLog; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-12 14 | */ 15 | public interface IStaffScoreLogService extends IService { 16 | 17 | CommonVO getStaffScoreLogs(String userId); 18 | 19 | CommonVO insertStaffScoreLog(StaffScoreLog staffScoreLog); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IStaffScoreService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.StaffScore; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author zhangxiaojian 14 | * @since 2021-04-12 15 | */ 16 | public interface IStaffScoreService extends IService { 17 | 18 | CommonVO gotStaffScore(String userId); 19 | 20 | IPage getStaffScores(Integer pageNo, Integer pageSize); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IStaffTrainService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.StaffTrain; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author zhangxiaojian 14 | * @since 2021-04-07 15 | */ 16 | public interface IStaffTrainService extends IService { 17 | 18 | CommonVO getStaffTrainDetail(Integer trainId); 19 | 20 | CommonVO saveTrainAndUpload(MultipartFile[] multipartFiles, String trainName, String trainContent); 21 | 22 | CommonVO deleteStaffTrain(Integer trainId); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/ITrainFileService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.entity.TrainFile; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author zhangxiaojian 12 | * @since 2021-04-07 13 | */ 14 | public interface ITrainFileService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IUserApplyService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.UserApply; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author zhangxiaojian 13 | * @since 2021-04-20 14 | */ 15 | public interface IUserApplyService extends IService { 16 | 17 | CommonVO apply(String grouper); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IUserRoleService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.UserRole; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-04-02 17 | */ 18 | public interface IUserRoleService extends IService { 19 | 20 | CommonVO getUserRoleById(String userId); 21 | 22 | CommonVO updateUserRoleById(String userId, List roleIds); 23 | 24 | CommonVO addRoleBatch(MultipartFile[] files, String userRoleName); 25 | 26 | CommonVO addRoleSingle(String userId, String userRoleName); 27 | 28 | CommonVO deleteRole(String userId, String userRoleName); 29 | 30 | boolean checkRole(String userId, String userRoleName); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.User; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | import org.springframework.security.core.userdetails.UserDetailsService; 8 | import org.springframework.web.multipart.MultipartFile; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | *

15 | * 服务类 16 | *

17 | * 18 | * @author zhangxiaojian 19 | * @since 2021-03-07 20 | */ 21 | public interface IUserService extends IService, UserDetailsService { 22 | 23 | int updatePassword(String userId,String newPassword); 24 | 25 | int checkUser(String username); 26 | 27 | IPage userRoleTable(String userId, String name, Integer pageNo, Integer pageSize); 28 | 29 | CommonVO getUserAndRoleById(String userId); 30 | 31 | IPage getUsersByRole(String userRole, Integer pageNo, Integer pageSize); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/CartItemServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.xj.groupbuy.entity.CartItem; 4 | import com.xj.groupbuy.mapper.CartItemMapper; 5 | import com.xj.groupbuy.service.ICartItemService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.context.annotation.Primary; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | *

12 | * 服务实现类 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-04-20 17 | */ 18 | @Service 19 | @Primary 20 | public class CartItemServiceImpl extends ServiceImpl implements ICartItemService { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.xj.groupbuy.common.util.TreeUtil; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.Category; 6 | import com.xj.groupbuy.mapper.CategoryMapper; 7 | import com.xj.groupbuy.service.ICategoryService; 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.context.annotation.Primary; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | import java.util.concurrent.CopyOnWriteArrayList; 17 | 18 | /** 19 | *

20 | * 服务实现类 21 | *

22 | * 23 | * @author zhangxiaojian 24 | * @since 2021-03-09 25 | */ 26 | @Service 27 | @Primary 28 | public class CategoryServiceImpl extends ServiceImpl implements ICategoryService { 29 | 30 | @Autowired 31 | private CategoryMapper categoryMapper; 32 | 33 | @Override 34 | public List getCategoryTree() { 35 | List list = this.list(); 36 | 37 | return TreeUtil.getTreeList(0, list); 38 | 39 | } 40 | 41 | @Override 42 | public CommonVO getAllLevelByCatId(Integer id) { 43 | Map parentLevelId = categoryMapper.getParentLevelId(id); 44 | Map result = new HashMap<>(); 45 | 46 | result.put("oneOptions",this.getAllOne()); 47 | if(parentLevelId != null){ 48 | result.put("twoOptions",this.getTwoByOne(Integer.parseInt(parentLevelId.get("one").toString()))); 49 | result.put("threeOptions",this.getThreeByTwo(Integer.parseInt(parentLevelId.get("two").toString()))); 50 | result.put("checkPath",parentLevelId); 51 | } 52 | 53 | return new CommonVO(true,result); 54 | } 55 | 56 | @Override 57 | public List> getAllOne() { 58 | return categoryMapper.getAllOne(); 59 | } 60 | 61 | @Override 62 | public List> getTwoByOne(Integer one) { 63 | return categoryMapper.getTwoByOne(one); 64 | } 65 | 66 | @Override 67 | public List> getThreeByTwo(Integer two) { 68 | return categoryMapper.getThreeByTwo(two); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/CommunityGoodsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.xj.groupbuy.entity.CommunityGoods; 4 | import com.xj.groupbuy.mapper.CommunityGoodsMapper; 5 | import com.xj.groupbuy.service.ICommunityGoodsService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.context.annotation.Primary; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | *

12 | * 服务实现类 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-04-20 17 | */ 18 | @Service 19 | @Primary 20 | public class CommunityGoodsServiceImpl extends ServiceImpl implements ICommunityGoodsService { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/CommunityServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.xj.groupbuy.entity.Community; 6 | import com.xj.groupbuy.mapper.CommunityMapper; 7 | import com.xj.groupbuy.service.ICommunityService; 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.context.annotation.Primary; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 服务实现类 18 | *

19 | * 20 | * @author zhangxiaojian 21 | * @since 2021-04-15 22 | */ 23 | @Service 24 | @Primary 25 | public class CommunityServiceImpl extends ServiceImpl implements ICommunityService { 26 | 27 | @Autowired 28 | private CommunityMapper communityMapper; 29 | 30 | @Override 31 | public IPage table(String level, String parentCode, Integer pageNo, Integer pageSize) { 32 | 33 | Page> page = new Page<>(pageNo,pageSize); 34 | 35 | if("province".equals(level)){ 36 | return communityMapper.getTable(parentCode,null,null,null,page); 37 | } else if("city".equals(level)){ 38 | return communityMapper.getTable(null,parentCode,null,null,page); 39 | } else if("area".equals(level)){ 40 | return communityMapper.getTable(null,null,parentCode,null,page); 41 | } else if("street".equals(level)){ 42 | return communityMapper.getTable(null,null,null,parentCode,page); 43 | } else { 44 | return communityMapper.getTable(null,null,null,null,page); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/DataAnalysisServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.xj.groupbuy.common.util.DateUtil; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.mapper.GoodsMapper; 6 | import com.xj.groupbuy.service.IDataAnalysisService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.context.annotation.Primary; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.text.SimpleDateFormat; 12 | import java.util.*; 13 | 14 | /** 15 | * Author : zhangxiaojian 16 | * Date : 2021/4/26 17 | */ 18 | @Service 19 | @Primary 20 | public class DataAnalysisServiceImpl implements IDataAnalysisService { 21 | 22 | @Autowired 23 | private GoodsMapper goodsMapper; 24 | 25 | @Override 26 | public CommonVO getStoreDayAnalysis(String storeId) { 27 | 28 | String date = DateUtil.format(new Date(), "yyyy-MM-dd"); 29 | List> data = goodsMapper.getStoreDayData(storeId,date); 30 | List goodsNames = new ArrayList<>(); 31 | List goodsSales = new ArrayList<>(); 32 | List goodsMoneys = new ArrayList<>(); 33 | for (Map map : data) { 34 | goodsNames.add(map.get("goodsName")); 35 | goodsSales.add(map.get("goodsSale")); 36 | goodsMoneys.add(map.get("goodsMoney")); 37 | } 38 | Map result = new HashMap<>(); 39 | result.put("goodsNames",goodsNames); 40 | result.put("goodsSales",goodsSales); 41 | result.put("goodsMoneys",goodsMoneys); 42 | return new CommonVO(true,result); 43 | } 44 | 45 | @Override 46 | public CommonVO getStoreMonthAnalysis(String storeId) { 47 | Calendar c = Calendar.getInstance(); 48 | c.setTime(new Date()); 49 | c.add(Calendar.MONTH, -1); 50 | Date m = c.getTime(); 51 | String date = new SimpleDateFormat("yyyy-MM-dd").format(m); 52 | 53 | List> data = goodsMapper.getStoreMonthAnalysis(storeId,date); 54 | List goodsNames = new ArrayList<>(); 55 | List goodsSales = new ArrayList<>(); 56 | List goodsMoneys = new ArrayList<>(); 57 | for (Map map : data) { 58 | goodsNames.add(map.get("goodsName")); 59 | goodsSales.add(map.get("goodsSale")); 60 | goodsMoneys.add(map.get("goodsMoney")); 61 | } 62 | Map result = new HashMap<>(); 63 | result.put("goodsNames",goodsNames); 64 | result.put("goodsSales",goodsSales); 65 | result.put("goodsMoneys",goodsMoneys); 66 | return new CommonVO(true,result); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/GoodsEvaluateServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.xj.groupbuy.common.util.DateUtil; 5 | import com.xj.groupbuy.common.vo.CommonVO; 6 | import com.xj.groupbuy.entity.GoodsEvaluate; 7 | import com.xj.groupbuy.mapper.GoodsEvaluateMapper; 8 | import com.xj.groupbuy.service.IGoodsEvaluateService; 9 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.context.annotation.Primary; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | *

18 | * 服务实现类 19 | *

20 | * 21 | * @author zhangxiaojian 22 | * @since 2021-04-24 23 | */ 24 | @Service 25 | @Primary 26 | public class GoodsEvaluateServiceImpl extends ServiceImpl implements IGoodsEvaluateService { 27 | 28 | @Autowired 29 | private GoodsEvaluateMapper goodsEvaluateMapper; 30 | 31 | @Override 32 | public CommonVO saveUserGoodsEvaluate(GoodsEvaluate goodsEvaluate) { 33 | 34 | goodsEvaluate.setCreateTime(DateUtil.getCurrentDate()); 35 | goodsEvaluate.setUpdateTime(DateUtil.getCurrentDate()); 36 | 37 | int insert = goodsEvaluateMapper.insert(goodsEvaluate); 38 | 39 | return new CommonVO(insert==1,insert==1?"评价成功":"评价失败"); 40 | } 41 | 42 | @Override 43 | public CommonVO getGoodsEvaluate(Integer goodsId) { 44 | List goodsEvaluates = goodsEvaluateMapper.getGoodsEvaluate(goodsId); 45 | return new CommonVO(true,goodsEvaluates); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/GoodsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.xj.groupbuy.common.properties.FileProperties; 5 | import com.xj.groupbuy.common.util.DateUtil; 6 | import com.xj.groupbuy.common.util.FileUtil; 7 | import com.xj.groupbuy.common.util.NullUtils; 8 | import com.xj.groupbuy.common.util.UserUtil; 9 | import com.xj.groupbuy.common.vo.CommonVO; 10 | import com.xj.groupbuy.entity.Goods; 11 | import com.xj.groupbuy.mapper.GoodsMapper; 12 | import com.xj.groupbuy.service.IGoodsService; 13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.context.annotation.Primary; 16 | import org.springframework.stereotype.Service; 17 | import org.springframework.web.multipart.MultipartFile; 18 | 19 | /** 20 | *

21 | * 服务实现类 22 | *

23 | * 24 | * @author zhangxiaojian 25 | * @since 2021-03-08 26 | */ 27 | @Service 28 | @Primary 29 | public class GoodsServiceImpl extends ServiceImpl implements IGoodsService { 30 | 31 | @Autowired 32 | private FileProperties fileProperties; 33 | @Autowired 34 | private GoodsMapper goodsMapper; 35 | @Override 36 | public CommonVO updateGoods(MultipartFile[] multipartFiles, Goods goods) { 37 | 38 | if(multipartFiles != null){ 39 | 40 | String uploadPath = null; 41 | for (MultipartFile multipartFile : multipartFiles) { 42 | uploadPath = FileUtil.upload(multipartFile, fileProperties.getPath(), multipartFile.getOriginalFilename()); 43 | } 44 | if(NullUtils.isNotEmpty(goods.getGoodsImg())){ 45 | // 删除旧照片 46 | FileUtil.delete(goods.getGoodsImg()); 47 | } 48 | goods.setGoodsImg(uploadPath); 49 | } 50 | goods.setUpdateTime(DateUtil.getCurrentDate()); 51 | int i = goodsMapper.updateById(goods); 52 | return new CommonVO(i==1,i==1?"修改成功":"修改失败"); 53 | } 54 | 55 | @Override 56 | public CommonVO deleteGoods(Integer id) { 57 | Goods goods = goodsMapper.selectById(id); 58 | String imgPath = goods.getGoodsImg(); 59 | int i = goodsMapper.deleteById(id); 60 | if(i == 1){ 61 | FileUtil.delete(imgPath); 62 | return new CommonVO(true,"删除成功"); 63 | } else { 64 | return new CommonVO(false,"删除失败"); 65 | } 66 | } 67 | 68 | @Override 69 | public Page getCommunityGoods(Boolean select, Page page) { 70 | 71 | if(select){ 72 | Integer communityId = UserUtil.getCurrentUser().getCommunityId(); 73 | return goodsMapper.getCommunityGoods(communityId,page); 74 | } else { 75 | return goodsMapper.getStoreGoods(page); 76 | } 77 | } 78 | 79 | @Override 80 | public Page getUserCommunityGoods(Page page) { 81 | Integer communityId = UserUtil.getCurrentUser().getCommunityId(); 82 | return goodsMapper.getCommunityGoods(communityId,page); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/LoginServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.User; 6 | import com.xj.groupbuy.mapper.LoginMapper; 7 | import com.xj.groupbuy.mapper.UserMapper; 8 | import com.xj.groupbuy.service.ILoginService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.context.annotation.Primary; 11 | import org.springframework.security.core.Authentication; 12 | import org.springframework.security.web.authentication.RememberMeServices; 13 | import org.springframework.stereotype.Service; 14 | 15 | import javax.servlet.http.Cookie; 16 | import javax.servlet.http.HttpServletRequest; 17 | import javax.servlet.http.HttpServletResponse; 18 | import java.nio.charset.StandardCharsets; 19 | import java.util.Base64; 20 | 21 | /** 22 | * Author : zhangxiaojian 23 | * Date : 2021/4/26 24 | */ 25 | @Service 26 | @Primary 27 | public class LoginServiceImpl implements ILoginService { 28 | 29 | @Autowired 30 | private LoginMapper loginMapper; 31 | @Autowired 32 | private UserMapper userMapper; 33 | @Autowired 34 | private RememberMeServices rememberMeServices; 35 | 36 | @Override 37 | public CommonVO checkLogin(HttpServletRequest request, HttpServletResponse response) { 38 | Cookie[] cookies = request.getCookies(); 39 | if (cookies == null) { 40 | return new CommonVO(false, ""); 41 | } 42 | Authentication authentication = rememberMeServices.autoLogin(request, response); 43 | if (authentication != null) { 44 | User user = (User) authentication.getPrincipal(); 45 | user.setPassword(null); 46 | return new CommonVO(true, authentication.getPrincipal()); 47 | } 48 | return new CommonVO(false, ""); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/NoticeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.xj.groupbuy.common.util.DateUtil; 7 | import com.xj.groupbuy.common.util.UserUtil; 8 | import com.xj.groupbuy.common.vo.CommonVO; 9 | import com.xj.groupbuy.entity.Notice; 10 | import com.xj.groupbuy.mapper.NoticeMapper; 11 | import com.xj.groupbuy.service.INoticeService; 12 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.context.annotation.Primary; 15 | import org.springframework.stereotype.Service; 16 | 17 | /** 18 | *

19 | * 服务实现类 20 | *

21 | * 22 | * @author zhangxiaojian 23 | * @since 2021-04-25 24 | */ 25 | @Service 26 | @Primary 27 | public class NoticeServiceImpl extends ServiceImpl implements INoticeService { 28 | 29 | @Autowired 30 | private NoticeMapper noticeMapper; 31 | 32 | @Override 33 | public CommonVO addNotice(Notice notice) { 34 | notice.setActionUserId(UserUtil.getUserId()); 35 | notice.setCreateTime(DateUtil.getCurrentDate()); 36 | 37 | int insert = noticeMapper.insert(notice); 38 | return new CommonVO(insert==1,insert==1?"添加成功":"添加失败"); 39 | } 40 | 41 | @Override 42 | public IPage getNotices(Integer mode, Integer pageNo, Integer pageSize) { 43 | Page page = new Page<>(pageNo, pageSize); 44 | if(mode == null || mode == 0){ 45 | return noticeMapper.selectPage(page,null); 46 | } else { 47 | return noticeMapper.selectPage(page,new QueryWrapper().eq("mode",mode)); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/OrderItemServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.xj.groupbuy.common.vo.CommonVO; 4 | import com.xj.groupbuy.entity.OrderItem; 5 | import com.xj.groupbuy.mapper.OrderItemMapper; 6 | import com.xj.groupbuy.service.IOrderItemService; 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.context.annotation.Primary; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | *

16 | * 服务实现类 17 | *

18 | * 19 | * @author zhangxiaojian 20 | * @since 2021-04-21 21 | */ 22 | @Service 23 | @Primary 24 | public class OrderItemServiceImpl extends ServiceImpl implements IOrderItemService { 25 | 26 | @Autowired 27 | private OrderItemMapper orderItemMapper; 28 | 29 | @Override 30 | public CommonVO getOrderItems(Integer orderId) { 31 | List orderItems = orderItemMapper.getOrderItems(orderId); 32 | return new CommonVO(true,orderItems); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/RegionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.xj.groupbuy.common.vo.CommonVO; 7 | import com.xj.groupbuy.entity.Menu; 8 | import com.xj.groupbuy.mapper.CommunityMapper; 9 | import com.xj.groupbuy.mapper.RegionMapper; 10 | import com.xj.groupbuy.service.IRegionService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.context.annotation.Primary; 13 | import org.springframework.stereotype.Service; 14 | 15 | import java.util.HashMap; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | * Author : zhangxiaojian 21 | * Date : 2021/4/16 22 | */ 23 | @Service 24 | @Primary 25 | public class RegionServiceImpl implements IRegionService { 26 | 27 | @Autowired 28 | private RegionMapper regionMapper; 29 | @Autowired 30 | private CommunityMapper communityMapper; 31 | 32 | @Override 33 | public List> getAllProvinces() { 34 | return regionMapper.getAllProvinces(); 35 | } 36 | 37 | @Override 38 | public List> getCitysByProvinceCode(String provinceCode) { 39 | return regionMapper.getCitysByProvinceCode(provinceCode); 40 | } 41 | 42 | @Override 43 | public List> getAreasByCityCode(String cityCode) { 44 | return regionMapper.getAreasByCityCode(cityCode); 45 | } 46 | 47 | @Override 48 | public List> getStreetsByAreaCode(String areaCode) { 49 | return regionMapper.getStreetsByAreaCode(areaCode); 50 | } 51 | 52 | @Override 53 | public CommonVO getAllLevelByCommunityId(Integer id) { 54 | Map parentLevelId = communityMapper.getParentLevelId(id); 55 | Map result = new HashMap<>(); 56 | 57 | result.put("provinceOptions",this.getAllProvinces()); 58 | if(parentLevelId != null){ 59 | result.put("cityOptions",this.getCitysByProvinceCode(parentLevelId.get("provinceCode").toString())); 60 | result.put("areaOptions",this.getAreasByCityCode(parentLevelId.get("cityCode").toString())); 61 | result.put("streetOptions",this.getStreetsByAreaCode(parentLevelId.get("areaCode").toString())); 62 | result.put("checkPath",parentLevelId); 63 | } 64 | 65 | return new CommonVO(true,result); 66 | } 67 | 68 | @Override 69 | public List> getCommunityByStreetCode(String streetCode) { 70 | return regionMapper.getCommunityByStreetCode(streetCode); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/RoleMenuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.xj.groupbuy.common.util.NullUtils; 5 | import com.xj.groupbuy.common.util.UserUtil; 6 | import com.xj.groupbuy.common.vo.CommonVO; 7 | import com.xj.groupbuy.entity.Role; 8 | import com.xj.groupbuy.entity.RoleMenu; 9 | import com.xj.groupbuy.mapper.RoleMenuMapper; 10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 11 | import com.xj.groupbuy.service.IRoleMenuService; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.context.annotation.Primary; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.util.ArrayList; 17 | import java.util.Collections; 18 | import java.util.List; 19 | 20 | /** 21 | *

22 | * 服务实现类 23 | *

24 | * 25 | * @author zhangxiaojian 26 | * @since 2021-03-24 27 | */ 28 | @Service 29 | @Primary 30 | public class RoleMenuServiceImpl extends ServiceImpl implements IRoleMenuService { 31 | 32 | @Autowired 33 | private RoleMenuMapper roleMenuMapper; 34 | 35 | @Override 36 | public CommonVO updateRoleMenu(Integer roleId, List menuIds) { 37 | 38 | // menuIds: 3 4 8 9 39 | // 已存在: 1 3 4 6 40 | // 1. 先根据roleId查询出对应的menuIds 41 | List menuIdsByRoleId = roleMenuMapper.getMenuIdsByRoleId(roleId, false); 42 | 43 | if (!this.checkBaseMenu(roleId, menuIds)) { 44 | return new CommonVO(false, "该角色的 【角色相关菜单权限】 不可删除"); 45 | } 46 | 47 | if (NullUtils.notEmpty(menuIds)) { 48 | // 3. 先删除不该存在的 id 先删除 1,3 49 | roleMenuMapper.delete(new QueryWrapper().eq("role_id", roleId).notIn("menu_id", menuIds)); 50 | 51 | // 4. 保存不存在的 id 8,9 52 | for (Integer menuId : menuIds) { 53 | if (!menuIdsByRoleId.contains(menuId)) { 54 | RoleMenu roleMenu = new RoleMenu(roleId, menuId); 55 | roleMenuMapper.insert(roleMenu); 56 | } 57 | } 58 | } else { 59 | // 将该角色的角色菜单全部删除 60 | roleMenuMapper.delete(new QueryWrapper().eq("role_id", roleId)); 61 | } 62 | 63 | return new CommonVO(true, "修改成功"); 64 | } 65 | 66 | private boolean checkBaseMenu(Integer roleId, List changeMenuIds) { 67 | // 管理员的某几项权限是不可被删除的 68 | // 在这里做校验,如果是管理员 69 | if (roleId == 1) { 70 | if (changeMenuIds == null) 71 | return false; 72 | 73 | return changeMenuIds.contains(7) && changeMenuIds.contains(8) && changeMenuIds.contains(10) && changeMenuIds.contains(2); 74 | } 75 | return true; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.Role; 6 | import com.xj.groupbuy.entity.RoleMenu; 7 | import com.xj.groupbuy.mapper.RoleMapper; 8 | import com.xj.groupbuy.mapper.RoleMenuMapper; 9 | import com.xj.groupbuy.service.IRoleService; 10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.context.annotation.Primary; 13 | import org.springframework.stereotype.Service; 14 | 15 | /** 16 | *

17 | * 服务实现类 18 | *

19 | * 20 | * @author zhangxiaojian 21 | * @since 2021-03-11 22 | */ 23 | @Service 24 | @Primary 25 | public class RoleServiceImpl extends ServiceImpl implements IRoleService { 26 | 27 | @Autowired 28 | private RoleMapper roleMapper; 29 | @Autowired 30 | private RoleMenuMapper roleMenuMapper; 31 | 32 | @Override 33 | public CommonVO deleteRole(Integer roleId) { 34 | 35 | Integer roleMenuCount = roleMenuMapper.selectCount(new QueryWrapper().eq("role_id", roleId)); 36 | if(roleMenuCount != 0){ 37 | return new CommonVO(false,"该角色下仍有某些菜单权限,请清除后再删除角色"); 38 | } else { 39 | int i = roleMapper.deleteById(roleId); 40 | return new CommonVO(i == 1,i==1?"删除成功":"删除失败"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/StaffRewardServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.xj.groupbuy.common.util.DateUtil; 6 | import com.xj.groupbuy.common.util.UserUtil; 7 | import com.xj.groupbuy.common.vo.CommonVO; 8 | import com.xj.groupbuy.entity.StaffReward; 9 | import com.xj.groupbuy.mapper.StaffRewardMapper; 10 | import com.xj.groupbuy.service.IStaffRewardService; 11 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.context.annotation.Primary; 14 | import org.springframework.stereotype.Service; 15 | 16 | /** 17 | *

18 | * 服务实现类 19 | *

20 | * 21 | * @author zhangxiaojian 22 | * @since 2021-04-14 23 | */ 24 | @Service 25 | @Primary 26 | public class StaffRewardServiceImpl extends ServiceImpl implements IStaffRewardService { 27 | 28 | @Autowired 29 | private StaffRewardMapper staffRewardMapper; 30 | 31 | @Override 32 | public CommonVO saveStaffReward(StaffReward staffReward) { 33 | staffReward.setActionUserId(UserUtil.getUserId()); 34 | staffReward.setCreateTime(DateUtil.getCurrentDate()); 35 | int insert = staffRewardMapper.insert(staffReward); 36 | return new CommonVO(insert==1,insert==1?"发放成功":"发放失败"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/StaffScoreLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.xj.groupbuy.common.util.DateUtil; 5 | import com.xj.groupbuy.common.util.UserUtil; 6 | import com.xj.groupbuy.common.vo.CommonVO; 7 | import com.xj.groupbuy.entity.StaffScore; 8 | import com.xj.groupbuy.entity.StaffScoreLog; 9 | import com.xj.groupbuy.mapper.StaffScoreLogMapper; 10 | import com.xj.groupbuy.mapper.StaffScoreMapper; 11 | import com.xj.groupbuy.service.IStaffScoreLogService; 12 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.math.BigDecimal; 17 | import java.util.List; 18 | 19 | /** 20 | *

21 | * 服务实现类 22 | *

23 | * 24 | * @author zhangxiaojian 25 | * @since 2021-04-12 26 | */ 27 | @Service 28 | public class StaffScoreLogServiceImpl extends ServiceImpl implements IStaffScoreLogService { 29 | 30 | @Autowired 31 | private StaffScoreLogMapper staffScoreLogMapper; 32 | @Autowired 33 | private StaffScoreMapper staffScoreMapper; 34 | 35 | @Override 36 | public CommonVO getStaffScoreLogs(String userId) { 37 | 38 | List logs = staffScoreLogMapper.selectList(new QueryWrapper().eq("user_id", userId)); 39 | return new CommonVO(true,logs); 40 | } 41 | 42 | @Override 43 | public CommonVO insertStaffScoreLog(StaffScoreLog staffScoreLog) { 44 | 45 | String userId = staffScoreLog.getUserId(); 46 | StaffScore staffScore = staffScoreMapper.selectOne(new QueryWrapper().eq("user_id", userId)); 47 | staffScoreLog.setBeforeScore(staffScore.getScore()); 48 | BigDecimal afterScore; 49 | if(staffScoreLog.getAction()){ 50 | // 增加 51 | afterScore = staffScore.getScore().add(staffScoreLog.getChangeScore()); 52 | } else { 53 | // 减少 54 | afterScore = staffScore.getScore().subtract(staffScoreLog.getChangeScore()); 55 | } 56 | 57 | staffScoreLog.setAfterScore(afterScore); 58 | staffScoreLog.setLogTime(DateUtil.getCurrentDate()); 59 | staffScoreLog.setActionUserId(UserUtil.getCurrentUser().getUserId()); 60 | 61 | staffScore.setScore(afterScore); 62 | 63 | staffScoreLogMapper.insert(staffScoreLog); 64 | staffScoreMapper.updateById(staffScore); 65 | 66 | return new CommonVO(true,"变更成功"); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/StaffScoreServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.xj.groupbuy.common.vo.CommonVO; 7 | import com.xj.groupbuy.entity.StaffScore; 8 | import com.xj.groupbuy.entity.User; 9 | import com.xj.groupbuy.mapper.StaffScoreMapper; 10 | import com.xj.groupbuy.service.IStaffScoreService; 11 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 12 | import com.xj.groupbuy.service.IUserRoleService; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | import org.springframework.transaction.annotation.Transactional; 16 | 17 | /** 18 | *

19 | * 服务实现类 20 | *

21 | * 22 | * @author zhangxiaojian 23 | * @since 2021-04-12 24 | */ 25 | @Service 26 | public class StaffScoreServiceImpl extends ServiceImpl implements IStaffScoreService { 27 | 28 | @Autowired 29 | private StaffScoreMapper staffScoreMapper; 30 | @Autowired 31 | private IUserRoleService userRoleService; 32 | 33 | // 为了摆脱事务的影响,所以用got 34 | @Override 35 | public CommonVO gotStaffScore(String userId) { 36 | boolean isStaff = userRoleService.checkRole(userId,"ROLE_GROUPER"); 37 | if(isStaff){ 38 | StaffScore staffScore = staffScoreMapper.selectOne(new QueryWrapper().eq("user_id", userId)); 39 | if(staffScore == null){ 40 | staffScore = new StaffScore(userId); 41 | staffScoreMapper.insert(staffScore); 42 | } 43 | return new CommonVO(true,staffScore); 44 | } else { 45 | return new CommonVO(false,"该用户不为员工"); 46 | } 47 | } 48 | 49 | @Override 50 | public IPage getStaffScores(Integer pageNo, Integer pageSize) { 51 | Page page = new Page<>(pageNo, pageSize); 52 | return staffScoreMapper.getStaffScores(page); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/TestService.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.xj.groupbuy.entity.TTest; 5 | import com.xj.groupbuy.mapper.TestMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * Author : zhangxiaojian 11 | * Date : 2021/3/1 12 | */ 13 | @Service 14 | public class TestService extends ServiceImpl { 15 | 16 | @Autowired 17 | TestMapper testMapper; 18 | 19 | public TTest getTestById(String id){ 20 | TTest test = testMapper.getTest(id); 21 | return test; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/TrainFileServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.xj.groupbuy.entity.TrainFile; 4 | import com.xj.groupbuy.mapper.TrainFileMapper; 5 | import com.xj.groupbuy.service.ITrainFileService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.context.annotation.Primary; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | *

12 | * 服务实现类 13 | *

14 | * 15 | * @author zhangxiaojian 16 | * @since 2021-04-07 17 | */ 18 | @Service 19 | @Primary 20 | public class TrainFileServiceImpl extends ServiceImpl implements ITrainFileService { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/xj/groupbuy/service/impl/UserApplyServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy.service.impl; 2 | 3 | import com.xj.groupbuy.common.util.UserUtil; 4 | import com.xj.groupbuy.common.vo.CommonVO; 5 | import com.xj.groupbuy.entity.UserApply; 6 | import com.xj.groupbuy.mapper.UserApplyMapper; 7 | import com.xj.groupbuy.service.IUserApplyService; 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.context.annotation.Primary; 11 | import org.springframework.stereotype.Service; 12 | 13 | /** 14 | *

15 | * 服务实现类 16 | *

17 | * 18 | * @author zhangxiaojian 19 | * @since 2021-04-20 20 | */ 21 | @Service 22 | @Primary 23 | public class UserApplyServiceImpl extends ServiceImpl implements IUserApplyService { 24 | 25 | @Autowired 26 | private UserApplyMapper userApplyMapper; 27 | 28 | @Override 29 | public CommonVO apply(String grouper) { 30 | UserApply userApply = new UserApply(UserUtil.getUserId(), grouper); 31 | int insert = userApplyMapper.insert(userApply); 32 | return new CommonVO(insert==1,insert==1?"申请成功":"申请失败"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | url: jdbc:mysql://localhost:3306/db_groupbuy?serverTimezone=GMT&useSSL=false&useUnicode=true&characterEncoding=UTF-8 4 | username: root 5 | password: 123456 6 | driver-class-name: com.mysql.cj.jdbc.Driver 7 | 8 | druid: 9 | filters: stat,wall 10 | stat-view-servlet: 11 | enabled: true 12 | login-username: admin 13 | login-password: 123456 14 | web-stat-filter: 15 | enabled: true 16 | url-pattern: /* 17 | # exclusions: 18 | aop-patterns: com.xj.groupbuy 19 | 20 | redis: 21 | # url: redis://flower:flower1360+@r-bp17py7fch809jyx5fpd.redis.rds.aliyuncs.com:6379 22 | host: 127.0.0.1 23 | port: 6379 24 | servlet: 25 | multipart: 26 | max-file-size: 100MB 27 | 28 | #mybatis: 29 | # config-location: classpath:mybatis/mybatis-config.xml 30 | # mapper-locations: classpath:mybatis/mapper/*.xml 31 | # 32 | # configuration: 33 | # map-underscore-to-camel-case: true 34 | mybatis-plus: 35 | mapper-locations: classpath:mapper/*.xml 36 | 37 | configuration: 38 | map-underscore-to-camel-case: true 39 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 40 | 41 | #logging: 42 | # level: debug 43 | server: 44 | port: 8888 45 | 46 | upload: 47 | path: F://test//upload// -------------------------------------------------------------------------------- /src/main/resources/mapper/CartItemMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CartMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 43 | 44 | 56 | 57 | 64 | 65 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CategoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 27 | 28 | 36 | 37 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CommunityGoodsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CommunityMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | 57 | 58 | 73 | 74 | -------------------------------------------------------------------------------- /src/main/resources/mapper/GoodsEvaluateMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/mapper/GoodsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 23 | 24 | 37 | 38 | 52 | 53 | 67 | 68 | -------------------------------------------------------------------------------- /src/main/resources/mapper/LoginMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/mapper/MenuRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/resources/mapper/NoticeMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/OrderItemMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/mapper/OrderMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 31 | 32 | 60 | 61 | -------------------------------------------------------------------------------- /src/main/resources/mapper/RegionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 21 | 22 | 30 | 31 | 39 | 40 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/resources/mapper/RoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/StaffRewardMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/StaffScoreLogMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/StaffScoreMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/mapper/StaffTrainMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TestMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TrainFileMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UserApplyMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/test/java/com/xj/groupbuy/GroupbuyApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xj.groupbuy; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.apache.ibatis.session.SqlSession; 5 | import org.apache.ibatis.session.SqlSessionFactory; 6 | import org.junit.jupiter.api.Test; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.data.redis.core.StringRedisTemplate; 10 | import org.springframework.data.redis.core.ValueOperations; 11 | import org.springframework.jdbc.core.JdbcTemplate; 12 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 13 | 14 | import javax.sql.DataSource; 15 | 16 | @Slf4j 17 | @SpringBootTest 18 | class GroupbuyApplicationTests { 19 | 20 | @Autowired 21 | JdbcTemplate jdbcTemplate; 22 | @Autowired 23 | DataSource dataSource; 24 | @Autowired 25 | private StringRedisTemplate redisTemplate; 26 | @Autowired 27 | SqlSessionFactory sqlSessionFactory; 28 | 29 | @Test 30 | void encoderPwd() { 31 | BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); 32 | System.out.println(encoder.encode("123456")); 33 | 34 | // Integer integer = jdbcTemplate.queryForObject("select count(*) from ttest", Integer.class); 35 | // log.info("记录总数: {}",integer); 36 | // 37 | // log.info("shujuyuanleixing: {}",dataSource.getClass()); 38 | 39 | } 40 | // 41 | // @Test 42 | // void testRedis(){ 43 | // ValueOperations operations = redisTemplate.opsForValue(); 44 | // 45 | // operations.set("hello","world"); 46 | // 47 | // String hello = operations.get("hello"); 48 | // System.out.println(hello); 49 | // } 50 | // 51 | // @Test 52 | // void testSqlSession(){ 53 | // System.out.println(sqlSessionFactory.getClass()); 54 | // SqlSession sqlSession = sqlSessionFactory.openSession(); 55 | // 56 | // System.out.println(); 57 | // } 58 | 59 | } 60 | --------------------------------------------------------------------------------