├── image ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png ├── 9.png ├── 10.png └── 11.png ├── limage ├── 1.png ├── 2.png └── 3.png ├── src ├── main │ ├── resources │ │ ├── mapper │ │ │ ├── ConfigDao.xml │ │ │ ├── TokenDao.xml │ │ │ ├── UsersDao.xml │ │ │ ├── HuocheleixingDao.xml │ │ │ ├── NewsDao.xml │ │ │ ├── AboutusDao.xml │ │ │ ├── YonghuDao.xml │ │ │ ├── SystemintroDao.xml │ │ │ ├── StoreupDao.xml │ │ │ ├── DiscusshuochexinxiDao.xml │ │ │ ├── HuochexinxiDao.xml │ │ │ ├── ChepiaotuipiaoDao.xml │ │ │ ├── ChepiaoyudingDao.xml │ │ │ └── CommonDao.xml │ │ └── application.yml │ └── java │ │ └── com │ │ ├── dao │ │ ├── ConfigDao.java │ │ ├── UsersDao.java │ │ ├── TokenDao.java │ │ ├── CommonDao.java │ │ ├── NewsDao.java │ │ ├── YonghuDao.java │ │ ├── StoreupDao.java │ │ ├── AboutusDao.java │ │ ├── HuochexinxiDao.java │ │ ├── SystemintroDao.java │ │ ├── ChepiaoyudingDao.java │ │ ├── HuocheleixingDao.java │ │ ├── ChepiaotuipiaoDao.java │ │ └── DiscusshuochexinxiDao.java │ │ ├── annotation │ │ ├── IgnoreAuth.java │ │ ├── LoginUser.java │ │ └── APPLoginUser.java │ │ ├── config │ │ ├── AlipayConfig.java │ │ ├── MybatisPlusConfig.java │ │ └── InterceptorConfig.java │ │ ├── utils │ │ ├── MD5Util.java │ │ ├── FileUtil.java │ │ ├── JQPageInfo.java │ │ ├── R.java │ │ ├── SQLFilter.java │ │ ├── HttpClientUtils.java │ │ ├── ValidatorUtils.java │ │ ├── SpringContextUtils.java │ │ ├── PageUtils.java │ │ ├── CommonUtil.java │ │ ├── Query.java │ │ └── BaiduUtil.java │ │ ├── service │ │ ├── ConfigService.java │ │ ├── UsersService.java │ │ ├── CommonService.java │ │ ├── TokenService.java │ │ ├── impl │ │ │ ├── ConfigServiceImpl.java │ │ │ ├── UsersServiceImpl.java │ │ │ ├── CommonServiceImpl.java │ │ │ ├── NewsServiceImpl.java │ │ │ ├── YonghuServiceImpl.java │ │ │ ├── AboutusServiceImpl.java │ │ │ ├── StoreupServiceImpl.java │ │ │ ├── HuochexinxiServiceImpl.java │ │ │ ├── SystemintroServiceImpl.java │ │ │ ├── ChepiaoyudingServiceImpl.java │ │ │ ├── HuocheleixingServiceImpl.java │ │ │ ├── ChepiaotuipiaoServiceImpl.java │ │ │ ├── DiscusshuochexinxiServiceImpl.java │ │ │ └── TokenServiceImpl.java │ │ ├── NewsService.java │ │ ├── YonghuService.java │ │ ├── AboutusService.java │ │ ├── StoreupService.java │ │ ├── HuochexinxiService.java │ │ ├── SystemintroService.java │ │ ├── ChepiaoyudingService.java │ │ ├── HuocheleixingService.java │ │ ├── ChepiaotuipiaoService.java │ │ └── DiscusshuochexinxiService.java │ │ ├── entity │ │ ├── vo │ │ │ ├── HuocheleixingVO.java │ │ │ ├── NewsVO.java │ │ │ ├── AboutusVO.java │ │ │ ├── DiscusshuochexinxiVO.java │ │ │ ├── SystemintroVO.java │ │ │ ├── YonghuVO.java │ │ │ ├── StoreupVO.java │ │ │ └── HuochexinxiVO.java │ │ ├── model │ │ │ ├── HuocheleixingModel.java │ │ │ ├── NewsModel.java │ │ │ ├── AboutusModel.java │ │ │ ├── DiscusshuochexinxiModel.java │ │ │ ├── SystemintroModel.java │ │ │ ├── YonghuModel.java │ │ │ ├── StoreupModel.java │ │ │ └── HuochexinxiModel.java │ │ ├── view │ │ │ ├── NewsView.java │ │ │ ├── YonghuView.java │ │ │ ├── StoreupView.java │ │ │ ├── AboutusView.java │ │ │ ├── HuochexinxiView.java │ │ │ ├── SystemintroView.java │ │ │ ├── ChepiaoyudingView.java │ │ │ ├── HuocheleixingView.java │ │ │ ├── ChepiaotuipiaoView.java │ │ │ └── DiscusshuochexinxiView.java │ │ ├── EIException.java │ │ ├── ConfigEntity.java │ │ ├── UsersEntity.java │ │ ├── HuocheleixingEntity.java │ │ ├── TokenEntity.java │ │ ├── NewsEntity.java │ │ ├── AboutusEntity.java │ │ ├── SystemintroEntity.java │ │ ├── DiscusshuochexinxiEntity.java │ │ ├── YonghuEntity.java │ │ └── StoreupEntity.java │ │ ├── SpringbootSchemaApplication.java │ │ ├── interceptor │ │ └── AuthorizationInterceptor.java │ │ └── controller │ │ ├── ConfigController.java │ │ ├── FileController.java │ │ └── UsersController.java └── test │ └── java │ └── com │ └── SpringbootSchemaApplicationTests.java ├── .gitignore ├── README.md └── pom.xml /image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/1.png -------------------------------------------------------------------------------- /image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/2.png -------------------------------------------------------------------------------- /image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/3.png -------------------------------------------------------------------------------- /image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/4.png -------------------------------------------------------------------------------- /image/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/5.png -------------------------------------------------------------------------------- /image/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/6.png -------------------------------------------------------------------------------- /image/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/7.png -------------------------------------------------------------------------------- /image/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/8.png -------------------------------------------------------------------------------- /image/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/9.png -------------------------------------------------------------------------------- /image/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/10.png -------------------------------------------------------------------------------- /image/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/image/11.png -------------------------------------------------------------------------------- /limage/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/limage/1.png -------------------------------------------------------------------------------- /limage/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/limage/2.png -------------------------------------------------------------------------------- /limage/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No257Railway-ticket-booking-management-system/HEAD/limage/3.png -------------------------------------------------------------------------------- /src/main/resources/mapper/ConfigDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ConfigDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import com.entity.ConfigEntity; 6 | 7 | /** 8 | * 配置 9 | */ 10 | public interface ConfigDao extends BaseMapper { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/annotation/IgnoreAuth.java: -------------------------------------------------------------------------------- 1 | package com.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 忽略Token验证 7 | */ 8 | @Target(ElementType.METHOD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface IgnoreAuth { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/java/com/SpringbootSchemaApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootSchemaApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/config/AlipayConfig.java: -------------------------------------------------------------------------------- 1 | package com.config; 2 | 3 | import java.io.FileWriter; 4 | import java.io.IOException; 5 | 6 | /* * 7 | *类名:AlipayConfig 8 | *功能:基础配置类 9 | *详细:设置帐户有关信息及返回路径 10 | *修改日期:2017-04-05 11 | *说明: 12 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 13 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 14 | */ 15 | 16 | public class AlipayConfig { 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/com/utils/MD5Util.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import cn.hutool.crypto.digest.DigestUtil; 4 | 5 | public class MD5Util { 6 | 7 | /** 8 | * @param text明文 9 | * @param key密钥 10 | * @return 密文 11 | */ 12 | // 带秘钥加密 13 | public static String md5(String text) { 14 | // 加密后的字符串 15 | String md5str = DigestUtil.md5Hex(text); 16 | return md5str; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/annotation/LoginUser.java: -------------------------------------------------------------------------------- 1 | package com.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 登录用户信息 10 | */ 11 | @Target(ElementType.PARAMETER) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface LoginUser { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/annotation/APPLoginUser.java: -------------------------------------------------------------------------------- 1 | package com.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 登录用户信息 10 | */ 11 | @Target(ElementType.PARAMETER) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface APPLoginUser { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TokenDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UsersDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/java/com/service/ConfigService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.Map; 5 | 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.service.IService; 8 | import com.entity.ConfigEntity; 9 | import com.utils.PageUtils; 10 | 11 | 12 | /** 13 | * 系统用户 14 | */ 15 | public interface ConfigService extends IService { 16 | PageUtils queryPage(Map params,Wrapper wrapper); 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /src/main/java/com/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | 2 | package com.config; 3 | 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import com.baomidou.mybatisplus.mapper.MetaObjectHandler; 8 | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; 9 | 10 | /** 11 | * mybatis-plus配置 12 | */ 13 | @Configuration 14 | public class MybatisPlusConfig { 15 | 16 | /** 17 | * 分页插件 18 | */ 19 | @Bean 20 | public PaginationInterceptor paginationInterceptor() { 21 | return new PaginationInterceptor(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/dao/UsersDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import java.util.List; 5 | 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import com.baomidou.mybatisplus.mapper.BaseMapper; 9 | import com.baomidou.mybatisplus.mapper.Wrapper; 10 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 11 | import com.entity.UsersEntity; 12 | 13 | /** 14 | * 用户 15 | */ 16 | public interface UsersDao extends BaseMapper { 17 | 18 | List selectListView(@Param("ew") Wrapper wrapper); 19 | 20 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/HuocheleixingVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.HuocheleixingEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 火车类型 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public class HuocheleixingVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/dao/TokenDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import java.util.List; 5 | 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import com.baomidou.mybatisplus.mapper.BaseMapper; 9 | import com.baomidou.mybatisplus.mapper.Wrapper; 10 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 11 | import com.entity.TokenEntity; 12 | 13 | /** 14 | * token 15 | */ 16 | public interface TokenDao extends BaseMapper { 17 | 18 | List selectListView(@Param("ew") Wrapper wrapper); 19 | 20 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/service/UsersService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import com.baomidou.mybatisplus.mapper.Wrapper; 10 | import com.baomidou.mybatisplus.service.IService; 11 | import com.entity.UsersEntity; 12 | import com.utils.PageUtils; 13 | 14 | 15 | /** 16 | * 系统用户 17 | */ 18 | public interface UsersService extends IService { 19 | PageUtils queryPage(Map params); 20 | 21 | List selectListView(Wrapper wrapper); 22 | 23 | PageUtils queryPage(Map params,Wrapper wrapper); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/service/CommonService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public interface CommonService { 7 | List getOption(Map params); 8 | 9 | Map getFollowByOption(Map params); 10 | 11 | void sh(Map params); 12 | 13 | int remindCount(Map params); 14 | 15 | Map selectCal(Map params); 16 | 17 | List> selectGroup(Map params); 18 | 19 | List> selectValue(Map params); 20 | 21 | List> selectTimeStatValue(Map params); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/HuocheleixingModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.HuocheleixingEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 火车类型 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public class HuocheleixingModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/utils/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.File; 5 | import java.io.FileInputStream; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | /** 10 | * 类说明 : 11 | */ 12 | 13 | public class FileUtil { 14 | public static byte[] FileToByte(File file) throws IOException { 15 | // 将数据转为流 16 | @SuppressWarnings("resource") 17 | InputStream content = new FileInputStream(file); 18 | ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); 19 | byte[] buff = new byte[100]; 20 | int rc = 0; 21 | while ((rc = content.read(buff, 0, 100)) > 0) { 22 | swapStream.write(buff, 0, rc); 23 | } 24 | // 获得二进制数组 25 | return swapStream.toByteArray(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/service/TokenService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.service.IService; 9 | import com.entity.TokenEntity; 10 | import com.utils.PageUtils; 11 | 12 | 13 | /** 14 | * token 15 | */ 16 | public interface TokenService extends IService { 17 | PageUtils queryPage(Map params); 18 | 19 | List selectListView(Wrapper wrapper); 20 | 21 | PageUtils queryPage(Map params,Wrapper wrapper); 22 | 23 | String generateToken(Long userid,String username,String tableName, String role); 24 | 25 | TokenEntity getTokenEntity(String token); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/dao/CommonDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | /** 8 | * 通用接口 9 | */ 10 | public interface CommonDao{ 11 | List getOption(Map params); 12 | 13 | Map getFollowByOption(Map params); 14 | 15 | List getFollowByOption2(Map params); 16 | 17 | void sh(Map params); 18 | 19 | int remindCount(Map params); 20 | 21 | Map selectCal(Map params); 22 | 23 | List> selectGroup(Map params); 24 | 25 | List> selectValue(Map params); 26 | 27 | List> selectTimeStatValue(Map params); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/SpringbootSchemaApplication.java: -------------------------------------------------------------------------------- 1 | package com; 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.builder.SpringApplicationBuilder; 7 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 8 | 9 | @SpringBootApplication 10 | @MapperScan(basePackages = {"com.dao"}) 11 | public class SpringbootSchemaApplication extends SpringBootServletInitializer{ 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(SpringbootSchemaApplication.class, args); 15 | } 16 | 17 | @Override 18 | protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) { 19 | return applicationBuilder.sources(SpringbootSchemaApplication.class); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/NewsView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.NewsEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 公告资讯 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("news") 21 | public class NewsView extends NewsEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public NewsView(){ 25 | } 26 | 27 | public NewsView(NewsEntity newsEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, newsEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/YonghuView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.YonghuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 用户 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("yonghu") 21 | public class YonghuView extends YonghuEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public YonghuView(){ 25 | } 26 | 27 | public YonghuView(YonghuEntity yonghuEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, yonghuEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/StoreupView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.StoreupEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 收藏表 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("storeup") 21 | public class StoreupView extends StoreupEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public StoreupView(){ 25 | } 26 | 27 | public StoreupView(StoreupEntity storeupEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, storeupEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/AboutusView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.AboutusEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 关于我们 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("aboutus") 21 | public class AboutusView extends AboutusEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public AboutusView(){ 25 | } 26 | 27 | public AboutusView(AboutusEntity aboutusEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, aboutusEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/utils/JQPageInfo.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | public class JQPageInfo{ 4 | private Integer page; 5 | 6 | private Integer limit; 7 | 8 | private String sidx; 9 | 10 | private String order; 11 | 12 | private Integer offset; 13 | 14 | public Integer getPage() { 15 | return page; 16 | } 17 | 18 | public void setPage(Integer page) { 19 | this.page = page; 20 | } 21 | 22 | public Integer getLimit() { 23 | return limit; 24 | } 25 | 26 | public void setLimit(Integer limit) { 27 | this.limit = limit; 28 | } 29 | 30 | public String getSidx() { 31 | return sidx; 32 | } 33 | 34 | public void setSidx(String sidx) { 35 | this.sidx = sidx; 36 | } 37 | 38 | public String getOrder() { 39 | return order; 40 | } 41 | 42 | public void setOrder(String order) { 43 | this.order = order; 44 | } 45 | 46 | public Integer getOffset() { 47 | return offset; 48 | } 49 | 50 | public void setOffset(Integer offset) { 51 | this.offset = offset; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/HuochexinxiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.HuochexinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 火车信息 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("huochexinxi") 21 | public class HuochexinxiView extends HuochexinxiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public HuochexinxiView(){ 25 | } 26 | 27 | public HuochexinxiView(HuochexinxiEntity huochexinxiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, huochexinxiEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/SystemintroView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.SystemintroEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 关于我们 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("systemintro") 21 | public class SystemintroView extends SystemintroEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public SystemintroView(){ 25 | } 26 | 27 | public SystemintroView(SystemintroEntity systemintroEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, systemintroEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/dao/NewsDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.NewsEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.NewsVO; 12 | import com.entity.view.NewsView; 13 | 14 | 15 | /** 16 | * 公告资讯 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface NewsDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | NewsVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | NewsView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/ChepiaoyudingView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.ChepiaoyudingEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 车票预订 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("chepiaoyuding") 21 | public class ChepiaoyudingView extends ChepiaoyudingEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public ChepiaoyudingView(){ 25 | } 26 | 27 | public ChepiaoyudingView(ChepiaoyudingEntity chepiaoyudingEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, chepiaoyudingEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/HuocheleixingView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.HuocheleixingEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 火车类型 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("huocheleixing") 21 | public class HuocheleixingView extends HuocheleixingEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public HuocheleixingView(){ 25 | } 26 | 27 | public HuocheleixingView(HuocheleixingEntity huocheleixingEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, huocheleixingEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/EIException.java: -------------------------------------------------------------------------------- 1 | 2 | package com.entity; 3 | 4 | /** 5 | * 自定义异常 6 | */ 7 | public class EIException extends RuntimeException { 8 | private static final long serialVersionUID = 1L; 9 | 10 | private String msg; 11 | private int code = 500; 12 | 13 | public EIException(String msg) { 14 | super(msg); 15 | this.msg = msg; 16 | } 17 | 18 | public EIException(String msg, Throwable e) { 19 | super(msg, e); 20 | this.msg = msg; 21 | } 22 | 23 | public EIException(String msg, int code) { 24 | super(msg); 25 | this.msg = msg; 26 | this.code = code; 27 | } 28 | 29 | public EIException(String msg, int code, Throwable e) { 30 | super(msg, e); 31 | this.msg = msg; 32 | this.code = code; 33 | } 34 | 35 | public String getMsg() { 36 | return msg; 37 | } 38 | 39 | public void setMsg(String msg) { 40 | this.msg = msg; 41 | } 42 | 43 | public int getCode() { 44 | return code; 45 | } 46 | 47 | public void setCode(int code) { 48 | this.code = code; 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/ChepiaotuipiaoView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.ChepiaotuipiaoEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 车票退票 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("chepiaotuipiao") 21 | public class ChepiaotuipiaoView extends ChepiaotuipiaoEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public ChepiaotuipiaoView(){ 25 | } 26 | 27 | public ChepiaotuipiaoView(ChepiaotuipiaoEntity chepiaotuipiaoEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, chepiaotuipiaoEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/utils/R.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * 返回数据 8 | */ 9 | public class R extends HashMap { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public R() { 13 | put("code", 0); 14 | } 15 | 16 | public static R error() { 17 | return error(500, "未知异常,请联系管理员"); 18 | } 19 | 20 | public static R error(String msg) { 21 | return error(500, msg); 22 | } 23 | 24 | public static R error(int code, String msg) { 25 | R r = new R(); 26 | r.put("code", code); 27 | r.put("msg", msg); 28 | return r; 29 | } 30 | 31 | public static R ok(String msg) { 32 | R r = new R(); 33 | r.put("msg", msg); 34 | return r; 35 | } 36 | 37 | public static R ok(Map map) { 38 | R r = new R(); 39 | r.putAll(map); 40 | return r; 41 | } 42 | 43 | public static R ok() { 44 | return new R(); 45 | } 46 | 47 | public R put(String key, Object value) { 48 | super.put(key, value); 49 | return this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ConfigServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.Map; 6 | 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 10 | import com.baomidou.mybatisplus.mapper.Wrapper; 11 | import com.baomidou.mybatisplus.plugins.Page; 12 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 13 | import com.dao.ConfigDao; 14 | import com.entity.ConfigEntity; 15 | import com.service.ConfigService; 16 | import com.utils.PageUtils; 17 | import com.utils.Query; 18 | 19 | 20 | /** 21 | * 系统用户 22 | */ 23 | @Service("configService") 24 | public class ConfigServiceImpl extends ServiceImpl implements ConfigService { 25 | @Override 26 | public PageUtils queryPage(Map params, Wrapper wrapper) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | wrapper 30 | ); 31 | return new PageUtils(page); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/entity/ConfigEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableId; 6 | import com.baomidou.mybatisplus.annotations.TableName; 7 | import com.baomidou.mybatisplus.enums.IdType; 8 | 9 | /** 10 | * 类说明 : 11 | */ 12 | @TableName("config") 13 | public class ConfigEntity implements Serializable{ 14 | private static final long serialVersionUID = 1L; 15 | 16 | @TableId(type = IdType.AUTO) 17 | private Long id; 18 | 19 | /** 20 | * key 21 | */ 22 | private String name; 23 | 24 | /** 25 | * value 26 | */ 27 | private String value; 28 | 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | public void setId(Long id) { 34 | this.id = id; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | public String getValue() { 46 | return value; 47 | } 48 | 49 | public void setValue(String value) { 50 | this.value = value; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/dao/YonghuDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.YonghuEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.YonghuVO; 12 | import com.entity.view.YonghuView; 13 | 14 | 15 | /** 16 | * 用户 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface YonghuDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | YonghuVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | YonghuView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/service/NewsService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.NewsEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.NewsVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.NewsView; 12 | 13 | 14 | /** 15 | * 公告资讯 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface NewsService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | NewsVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | NewsView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/dao/StoreupDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.StoreupEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.StoreupVO; 12 | import com.entity.view.StoreupView; 13 | 14 | 15 | /** 16 | * 收藏表 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface StoreupDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | StoreupVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | StoreupView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dao/AboutusDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.AboutusEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.AboutusVO; 12 | import com.entity.view.AboutusView; 13 | 14 | 15 | /** 16 | * 关于我们 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface AboutusDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | AboutusVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | AboutusView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/DiscusshuochexinxiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.DiscusshuochexinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 火车信息评论表 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-01-05 15:26:04 19 | */ 20 | @TableName("discusshuochexinxi") 21 | public class DiscusshuochexinxiView extends DiscusshuochexinxiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public DiscusshuochexinxiView(){ 25 | } 26 | 27 | public DiscusshuochexinxiView(DiscusshuochexinxiEntity discusshuochexinxiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, discusshuochexinxiEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/service/YonghuService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.YonghuEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.YonghuVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.YonghuView; 12 | 13 | 14 | /** 15 | * 用户 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface YonghuService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | YonghuVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | YonghuView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/service/AboutusService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.AboutusEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.AboutusVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.AboutusView; 12 | 13 | 14 | /** 15 | * 关于我们 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface AboutusService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | AboutusVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | AboutusView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/service/StoreupService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.StoreupEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.StoreupVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.StoreupView; 12 | 13 | 14 | /** 15 | * 收藏表 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface StoreupService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | StoreupVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | StoreupView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/dao/HuochexinxiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.HuochexinxiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.HuochexinxiVO; 12 | import com.entity.view.HuochexinxiView; 13 | 14 | 15 | /** 16 | * 火车信息 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface HuochexinxiDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | HuochexinxiVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | HuochexinxiView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dao/SystemintroDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.SystemintroEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.SystemintroVO; 12 | import com.entity.view.SystemintroView; 13 | 14 | 15 | /** 16 | * 关于我们 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface SystemintroDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | SystemintroVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | SystemintroView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/utils/SQLFilter.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | import com.entity.EIException; 7 | 8 | /** 9 | * SQL过滤 10 | */ 11 | public class SQLFilter { 12 | 13 | /** 14 | * SQL注入过滤 15 | * @param str 待验证的字符串 16 | */ 17 | public static String sqlInject(String str){ 18 | if(StringUtils.isBlank(str)){ 19 | return null; 20 | } 21 | //去掉'|"|;|\字符 22 | str = StringUtils.replace(str, "'", ""); 23 | str = StringUtils.replace(str, "\"", ""); 24 | str = StringUtils.replace(str, ";", ""); 25 | str = StringUtils.replace(str, "\\", ""); 26 | 27 | //转换成小写 28 | str = str.toLowerCase(); 29 | 30 | //非法字符 31 | String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"}; 32 | 33 | //判断是否包含非法字符 34 | for(String keyword : keywords){ 35 | if(str.indexOf(keyword) != -1){ 36 | throw new EIException("包含非法字符"); 37 | } 38 | } 39 | 40 | return str; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/utils/HttpClientUtils.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.net.HttpURLConnection; 6 | import java.net.URL; 7 | 8 | 9 | /** 10 | * HttpClient工具类 11 | */ 12 | public class HttpClientUtils { 13 | 14 | /** 15 | * @param uri 16 | * @return String 17 | * @description get请求方式 18 | * @author: long.he01 19 | */ 20 | public static String doGet(String uri) { 21 | 22 | StringBuilder result = new StringBuilder(); 23 | try { 24 | String res = ""; 25 | URL url = new URL(uri); 26 | HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 27 | BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); 28 | String line; 29 | while ((line = in.readLine()) != null) { 30 | res += line+"\n"; 31 | } 32 | in.close(); 33 | return res; 34 | }catch (Exception e) { 35 | e.printStackTrace(); 36 | return null; 37 | } 38 | 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/service/HuochexinxiService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.HuochexinxiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.HuochexinxiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.HuochexinxiView; 12 | 13 | 14 | /** 15 | * 火车信息 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface HuochexinxiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | HuochexinxiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | HuochexinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/service/SystemintroService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.SystemintroEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.SystemintroVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.SystemintroView; 12 | 13 | 14 | /** 15 | * 关于我们 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface SystemintroService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | SystemintroVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | SystemintroView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ChepiaoyudingDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.ChepiaoyudingEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.ChepiaoyudingVO; 12 | import com.entity.view.ChepiaoyudingView; 13 | 14 | 15 | /** 16 | * 车票预订 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface ChepiaoyudingDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | ChepiaoyudingVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | ChepiaoyudingView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dao/HuocheleixingDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.HuocheleixingEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.HuocheleixingVO; 12 | import com.entity.view.HuocheleixingView; 13 | 14 | 15 | /** 16 | * 火车类型 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface HuocheleixingDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | HuocheleixingVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | HuocheleixingView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ChepiaotuipiaoDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.ChepiaotuipiaoEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.ChepiaotuipiaoVO; 12 | import com.entity.view.ChepiaotuipiaoView; 13 | 14 | 15 | /** 16 | * 车票退票 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface ChepiaotuipiaoDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | ChepiaotuipiaoVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | ChepiaotuipiaoView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/service/ChepiaoyudingService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.ChepiaoyudingEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.ChepiaoyudingVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.ChepiaoyudingView; 12 | 13 | 14 | /** 15 | * 车票预订 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface ChepiaoyudingService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | ChepiaoyudingVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | ChepiaoyudingView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/service/HuocheleixingService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.HuocheleixingEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.HuocheleixingVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.HuocheleixingView; 12 | 13 | 14 | /** 15 | * 火车类型 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface HuocheleixingService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | HuocheleixingVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | HuocheleixingView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/utils/ValidatorUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | 5 | import java.util.Set; 6 | 7 | import javax.validation.ConstraintViolation; 8 | import javax.validation.Validation; 9 | import javax.validation.Validator; 10 | 11 | import com.entity.EIException; 12 | 13 | /** 14 | * hibernate-validator校验工具类 15 | */ 16 | public class ValidatorUtils { 17 | private static Validator validator; 18 | 19 | static { 20 | validator = Validation.buildDefaultValidatorFactory().getValidator(); 21 | } 22 | 23 | /** 24 | * 校验对象 25 | * @param object 待校验对象 26 | * @param groups 待校验的组 27 | * @throws EIException 校验不通过,则报EIException异常 28 | */ 29 | public static void validateEntity(Object object, Class... groups) 30 | throws EIException { 31 | Set> constraintViolations = validator.validate(object, groups); 32 | if (!constraintViolations.isEmpty()) { 33 | ConstraintViolation constraint = (ConstraintViolation)constraintViolations.iterator().next(); 34 | throw new EIException(constraint.getMessage()); 35 | } 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/service/ChepiaotuipiaoService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.ChepiaotuipiaoEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.ChepiaotuipiaoVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.ChepiaotuipiaoView; 12 | 13 | 14 | /** 15 | * 车票退票 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface ChepiaotuipiaoService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | ChepiaotuipiaoVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | ChepiaotuipiaoView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/dao/DiscusshuochexinxiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.DiscusshuochexinxiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.DiscusshuochexinxiVO; 12 | import com.entity.view.DiscusshuochexinxiView; 13 | 14 | 15 | /** 16 | * 火车信息评论表 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public interface DiscusshuochexinxiDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | DiscusshuochexinxiVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | DiscusshuochexinxiView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/service/DiscusshuochexinxiService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.DiscusshuochexinxiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.DiscusshuochexinxiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.DiscusshuochexinxiView; 12 | 13 | 14 | /** 15 | * 火车信息评论表 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public interface DiscusshuochexinxiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | DiscusshuochexinxiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | DiscusshuochexinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/resources/mapper/HuocheleixingDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 22 | 23 | 29 | 30 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/utils/SpringContextUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.ApplicationContextAware; 7 | import org.springframework.stereotype.Component; 8 | 9 | 10 | /** 11 | * Spring Context 工具类 12 | */ 13 | @Component 14 | public class SpringContextUtils implements ApplicationContextAware { 15 | public static ApplicationContext applicationContext; 16 | 17 | @Override 18 | public void setApplicationContext(ApplicationContext applicationContext) 19 | throws BeansException { 20 | SpringContextUtils.applicationContext = applicationContext; 21 | } 22 | 23 | public static Object getBean(String name) { 24 | return applicationContext.getBean(name); 25 | } 26 | 27 | public static T getBean(String name, Class requiredType) { 28 | return applicationContext.getBean(name, requiredType); 29 | } 30 | 31 | public static boolean containsBean(String name) { 32 | return applicationContext.containsBean(name); 33 | } 34 | 35 | public static boolean isSingleton(String name) { 36 | return applicationContext.isSingleton(name); 37 | } 38 | 39 | public static Class getType(String name) { 40 | return applicationContext.getType(name); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /src/main/resources/mapper/NewsDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 19 | 20 | 25 | 26 | 32 | 33 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/mapper/AboutusDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 27 | 28 | 34 | 35 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 基于Springboot的铁路订票管理系统(程序+论文) 2 | = 3 | ### 完整代码获取地址:从戎源码网 ([https://armycodes.com/](https://armycodes.com/)) 4 | ### 作者微信:19941326836 QQ:952045282 5 | ### 承接计算机毕业设计、Java毕业设计、Python毕业设计、深度学习、机器学习 6 | ### 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务 7 | ### 所有选题地址https://github.com/nature924/allProject 8 | 9 | 一、项目介绍 10 | --- 11 | 基于Spring Boot框架实现的铁路订票管理系统,系统包含两种角色:管理员、用户主要功能如下。 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 | 37 | 二、项目技术 38 | --- 39 | - 编程语言:Java 40 | - 数据库:MySQL 41 | - 项目管理工具:Maven 42 | - 前端技术:VUE、HTML、Jquery、Bootstrap 43 | - 后端技术:Spring、SpringMVC、MyBatis 44 | 45 | 三、运行环境 46 | --- 47 | - 操作系统:Windows、macOS都可以 48 | - JDK版本:JDK1.8以上都可以 49 | - 开发工具:IDEA、Ecplise、Myecplise都可以 50 | - 数据库: MySQL5.7以上都可以 51 | - Tomcat:任意版本都可以 52 | - Maven:任意版本都可以 53 | 54 | 四、运行截图 55 | --- 56 | ### 论文截图: 57 | ![image/1.png](limage/1.png) 58 | ![image/1.png](limage/2.png) 59 | 60 | ### 程序截图: 61 | ![image/1.png](image/1.png) 62 | ![image/1.png](image/2.png) 63 | ![image/1.png](image/3.png) 64 | ![image/1.png](image/4.png) 65 | ![image/1.png](image/5.png) 66 | ![image/1.png](image/6.png) 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/main/resources/mapper/YonghuDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 27 | 28 | 34 | 35 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/entity/UsersEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | import com.baomidou.mybatisplus.annotations.TableId; 7 | import com.baomidou.mybatisplus.annotations.TableName; 8 | import com.baomidou.mybatisplus.enums.IdType; 9 | 10 | /** 11 | * 用户 12 | */ 13 | @TableName("users") 14 | public class UsersEntity implements Serializable { 15 | private static final long serialVersionUID = 1L; 16 | 17 | @TableId(type = IdType.AUTO) 18 | private Long id; 19 | 20 | /** 21 | * 用户账号 22 | */ 23 | private String username; 24 | 25 | /** 26 | * 密码 27 | */ 28 | private String password; 29 | 30 | /** 31 | * 用户类型 32 | */ 33 | private String role; 34 | 35 | private Date addtime; 36 | 37 | public String getUsername() { 38 | return username; 39 | } 40 | 41 | public void setUsername(String username) { 42 | this.username = username; 43 | } 44 | 45 | public String getPassword() { 46 | return password; 47 | } 48 | 49 | public void setPassword(String password) { 50 | this.password = password; 51 | } 52 | 53 | public String getRole() { 54 | return role; 55 | } 56 | 57 | public void setRole(String role) { 58 | this.role = role; 59 | } 60 | 61 | public Date getAddtime() { 62 | return addtime; 63 | } 64 | 65 | public void setAddtime(Date addtime) { 66 | this.addtime = addtime; 67 | } 68 | 69 | public Long getId() { 70 | return id; 71 | } 72 | 73 | public void setId(Long id) { 74 | this.id = id; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/resources/mapper/SystemintroDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 27 | 28 | 34 | 35 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/UsersServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 11 | import com.baomidou.mybatisplus.mapper.Wrapper; 12 | import com.baomidou.mybatisplus.plugins.Page; 13 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 14 | import com.dao.UsersDao; 15 | import com.entity.UsersEntity; 16 | import com.service.UsersService; 17 | import com.utils.PageUtils; 18 | import com.utils.Query; 19 | 20 | 21 | /** 22 | * 系统用户 23 | */ 24 | @Service("usersService") 25 | public class UsersServiceImpl extends ServiceImpl implements UsersService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | Page page = this.selectPage( 30 | new Query(params).getPage(), 31 | new EntityWrapper() 32 | ); 33 | return new PageUtils(page); 34 | } 35 | 36 | @Override 37 | public List selectListView(Wrapper wrapper) { 38 | return baseMapper.selectListView(wrapper); 39 | } 40 | 41 | @Override 42 | public PageUtils queryPage(Map params, 43 | Wrapper wrapper) { 44 | Page page =new Query(params).getPage(); 45 | page.setRecords(baseMapper.selectListView(page,wrapper)); 46 | PageUtils pageUtil = new PageUtils(page); 47 | return pageUtil; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/resources/mapper/StoreupDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | 29 | 30 | 36 | 37 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/com/config/InterceptorConfig.java: -------------------------------------------------------------------------------- 1 | package com.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 6 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; 8 | 9 | import com.interceptor.AuthorizationInterceptor; 10 | 11 | @Configuration 12 | public class InterceptorConfig extends WebMvcConfigurationSupport{ 13 | 14 | @Bean 15 | public AuthorizationInterceptor getAuthorizationInterceptor() { 16 | return new AuthorizationInterceptor(); 17 | } 18 | 19 | @Override 20 | public void addInterceptors(InterceptorRegistry registry) { 21 | registry.addInterceptor(getAuthorizationInterceptor()).addPathPatterns("/**").excludePathPatterns("/static/**"); 22 | super.addInterceptors(registry); 23 | } 24 | 25 | /** 26 | * springboot 2.0配置WebMvcConfigurationSupport之后,会导致默认配置被覆盖,要访问静态资源需要重写addResourceHandlers方法 27 | */ 28 | @Override 29 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 30 | registry.addResourceHandler("/**") 31 | .addResourceLocations("classpath:/resources/") 32 | .addResourceLocations("classpath:/static/") 33 | .addResourceLocations("classpath:/admin/") 34 | .addResourceLocations("classpath:/front/") 35 | .addResourceLocations("classpath:/public/"); 36 | super.addResourceHandlers(registry); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/NewsVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.NewsEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 公告资讯 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public class NewsVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 简介 27 | */ 28 | 29 | private String introduction; 30 | 31 | /** 32 | * 图片 33 | */ 34 | 35 | private String picture; 36 | 37 | /** 38 | * 内容 39 | */ 40 | 41 | private String content; 42 | 43 | 44 | /** 45 | * 设置:简介 46 | */ 47 | 48 | public void setIntroduction(String introduction) { 49 | this.introduction = introduction; 50 | } 51 | 52 | /** 53 | * 获取:简介 54 | */ 55 | public String getIntroduction() { 56 | return introduction; 57 | } 58 | 59 | 60 | /** 61 | * 设置:图片 62 | */ 63 | 64 | public void setPicture(String picture) { 65 | this.picture = picture; 66 | } 67 | 68 | /** 69 | * 获取:图片 70 | */ 71 | public String getPicture() { 72 | return picture; 73 | } 74 | 75 | 76 | /** 77 | * 设置:内容 78 | */ 79 | 80 | public void setContent(String content) { 81 | this.content = content; 82 | } 83 | 84 | /** 85 | * 获取:内容 86 | */ 87 | public String getContent() { 88 | return content; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/resources/mapper/DiscusshuochexinxiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 27 | 28 | 34 | 35 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/NewsModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.NewsEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 公告资讯 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public class NewsModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 简介 28 | */ 29 | 30 | private String introduction; 31 | 32 | /** 33 | * 图片 34 | */ 35 | 36 | private String picture; 37 | 38 | /** 39 | * 内容 40 | */ 41 | 42 | private String content; 43 | 44 | 45 | /** 46 | * 设置:简介 47 | */ 48 | 49 | public void setIntroduction(String introduction) { 50 | this.introduction = introduction; 51 | } 52 | 53 | /** 54 | * 获取:简介 55 | */ 56 | public String getIntroduction() { 57 | return introduction; 58 | } 59 | 60 | 61 | /** 62 | * 设置:图片 63 | */ 64 | 65 | public void setPicture(String picture) { 66 | this.picture = picture; 67 | } 68 | 69 | /** 70 | * 获取:图片 71 | */ 72 | public String getPicture() { 73 | return picture; 74 | } 75 | 76 | 77 | /** 78 | * 设置:内容 79 | */ 80 | 81 | public void setContent(String content) { 82 | this.content = content; 83 | } 84 | 85 | /** 86 | * 获取:内容 87 | */ 88 | public String getContent() { 89 | return content; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/CommonServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.dao.CommonDao; 12 | import com.service.CommonService; 13 | 14 | 15 | /** 16 | * 系统用户 17 | */ 18 | @Service("commonService") 19 | public class CommonServiceImpl implements CommonService { 20 | 21 | @Autowired 22 | private CommonDao commonDao; 23 | 24 | @Override 25 | public List getOption(Map params) { 26 | return commonDao.getOption(params); 27 | } 28 | 29 | @Override 30 | public Map getFollowByOption(Map params) { 31 | return commonDao.getFollowByOption(params); 32 | } 33 | 34 | @Override 35 | public void sh(Map params) { 36 | commonDao.sh(params); 37 | } 38 | 39 | @Override 40 | public int remindCount(Map params) { 41 | return commonDao.remindCount(params); 42 | } 43 | 44 | @Override 45 | public Map selectCal(Map params) { 46 | return commonDao.selectCal(params); 47 | } 48 | 49 | @Override 50 | public List> selectGroup(Map params) { 51 | return commonDao.selectGroup(params); 52 | } 53 | 54 | @Override 55 | public List> selectValue(Map params) { 56 | return commonDao.selectValue(params); 57 | } 58 | 59 | @Override 60 | public List> selectTimeStatValue(Map params) { 61 | return commonDao.selectTimeStatValue(params); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | tomcat: 4 | uri-encoding: UTF-8 5 | port: 8080 6 | servlet: 7 | context-path: /springbootw8iq4 8 | 9 | 10 | spring: 11 | datasource: 12 | driverClassName: com.mysql.cj.jdbc.Driver 13 | url: jdbc:mysql://127.0.0.1:3306/springbootw8iq4?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8 14 | username: root 15 | password: 123456 16 | 17 | # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver 18 | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=springbootw8iq4 19 | # username: sa 20 | # password: 123456 21 | 22 | servlet: 23 | multipart: 24 | max-file-size: 300MB 25 | max-request-size: 300MB 26 | resources: 27 | static-locations: classpath:static/,file:static/ 28 | 29 | #mybatis 30 | mybatis-plus: 31 | mapper-locations: classpath*:mapper/*.xml 32 | #实体扫描,多个package用逗号或者分号分隔 33 | typeAliasesPackage: com.entity 34 | global-config: 35 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 36 | id-type: 1 37 | #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" 38 | field-strategy: 1 39 | #驼峰下划线转换 40 | db-column-underline: true 41 | #刷新mapper 调试神器 42 | refresh-mapper: true 43 | #逻辑删除配置 44 | logic-delete-value: -1 45 | logic-not-delete-value: 0 46 | #自定义SQL注入器 47 | sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector 48 | configuration: 49 | map-underscore-to-camel-case: true 50 | cache-enabled: false 51 | call-setters-on-nulls: true 52 | #springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other) 53 | jdbc-type-for-null: 'null' 54 | -------------------------------------------------------------------------------- /src/main/resources/mapper/HuochexinxiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 33 | 34 | 40 | 41 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/NewsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.NewsDao; 16 | import com.entity.NewsEntity; 17 | import com.service.NewsService; 18 | import com.entity.vo.NewsVO; 19 | import com.entity.view.NewsView; 20 | 21 | @Service("newsService") 22 | public class NewsServiceImpl extends ServiceImpl implements NewsService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public NewsVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public NewsView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/YonghuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.YonghuDao; 16 | import com.entity.YonghuEntity; 17 | import com.service.YonghuService; 18 | import com.entity.vo.YonghuVO; 19 | import com.entity.view.YonghuView; 20 | 21 | @Service("yonghuService") 22 | public class YonghuServiceImpl extends ServiceImpl implements YonghuService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public YonghuVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public YonghuView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/AboutusServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.AboutusDao; 16 | import com.entity.AboutusEntity; 17 | import com.service.AboutusService; 18 | import com.entity.vo.AboutusVO; 19 | import com.entity.view.AboutusView; 20 | 21 | @Service("aboutusService") 22 | public class AboutusServiceImpl extends ServiceImpl implements AboutusService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public AboutusVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public AboutusView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/StoreupServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.StoreupDao; 16 | import com.entity.StoreupEntity; 17 | import com.service.StoreupService; 18 | import com.entity.vo.StoreupVO; 19 | import com.entity.view.StoreupView; 20 | 21 | @Service("storeupService") 22 | public class StoreupServiceImpl extends ServiceImpl implements StoreupService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public StoreupVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public StoreupView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/HuochexinxiServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.HuochexinxiDao; 16 | import com.entity.HuochexinxiEntity; 17 | import com.service.HuochexinxiService; 18 | import com.entity.vo.HuochexinxiVO; 19 | import com.entity.view.HuochexinxiView; 20 | 21 | @Service("huochexinxiService") 22 | public class HuochexinxiServiceImpl extends ServiceImpl implements HuochexinxiService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public HuochexinxiVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public HuochexinxiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/SystemintroServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.SystemintroDao; 16 | import com.entity.SystemintroEntity; 17 | import com.service.SystemintroService; 18 | import com.entity.vo.SystemintroVO; 19 | import com.entity.view.SystemintroView; 20 | 21 | @Service("systemintroService") 22 | public class SystemintroServiceImpl extends ServiceImpl implements SystemintroService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public SystemintroVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public SystemintroView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ChepiaoyudingServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.ChepiaoyudingDao; 16 | import com.entity.ChepiaoyudingEntity; 17 | import com.service.ChepiaoyudingService; 18 | import com.entity.vo.ChepiaoyudingVO; 19 | import com.entity.view.ChepiaoyudingView; 20 | 21 | @Service("chepiaoyudingService") 22 | public class ChepiaoyudingServiceImpl extends ServiceImpl implements ChepiaoyudingService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public ChepiaoyudingVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public ChepiaoyudingView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/HuocheleixingServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.HuocheleixingDao; 16 | import com.entity.HuocheleixingEntity; 17 | import com.service.HuocheleixingService; 18 | import com.entity.vo.HuocheleixingVO; 19 | import com.entity.view.HuocheleixingView; 20 | 21 | @Service("huocheleixingService") 22 | public class HuocheleixingServiceImpl extends ServiceImpl implements HuocheleixingService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public HuocheleixingVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public HuocheleixingView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ChepiaotuipiaoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.ChepiaotuipiaoDao; 16 | import com.entity.ChepiaotuipiaoEntity; 17 | import com.service.ChepiaotuipiaoService; 18 | import com.entity.vo.ChepiaotuipiaoVO; 19 | import com.entity.view.ChepiaotuipiaoView; 20 | 21 | @Service("chepiaotuipiaoService") 22 | public class ChepiaotuipiaoServiceImpl extends ServiceImpl implements ChepiaotuipiaoService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public ChepiaotuipiaoVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public ChepiaotuipiaoView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/entity/HuocheleixingEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 火车类型 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-01-05 15:26:04 30 | */ 31 | @TableName("huocheleixing") 32 | public class HuocheleixingEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public HuocheleixingEntity() { 37 | 38 | } 39 | 40 | public HuocheleixingEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 火车类型 56 | */ 57 | 58 | private String huocheleixing; 59 | 60 | 61 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 62 | @DateTimeFormat 63 | private Date addtime; 64 | 65 | public Date getAddtime() { 66 | return addtime; 67 | } 68 | public void setAddtime(Date addtime) { 69 | this.addtime = addtime; 70 | } 71 | 72 | public Long getId() { 73 | return id; 74 | } 75 | 76 | public void setId(Long id) { 77 | this.id = id; 78 | } 79 | /** 80 | * 设置:火车类型 81 | */ 82 | public void setHuocheleixing(String huocheleixing) { 83 | this.huocheleixing = huocheleixing; 84 | } 85 | /** 86 | * 获取:火车类型 87 | */ 88 | public String getHuocheleixing() { 89 | return huocheleixing; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/utils/PageUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | import java.io.Serializable; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import com.baomidou.mybatisplus.plugins.Page; 9 | 10 | /** 11 | * 分页工具类 12 | */ 13 | public class PageUtils implements Serializable { 14 | private static final long serialVersionUID = 1L; 15 | //总记录数 16 | private long total; 17 | //每页记录数 18 | private int pageSize; 19 | //总页数 20 | private long totalPage; 21 | //当前页数 22 | private int currPage; 23 | //列表数据 24 | private List list; 25 | 26 | /** 27 | * 分页 28 | * @param list 列表数据 29 | * @param totalCount 总记录数 30 | * @param pageSize 每页记录数 31 | * @param currPage 当前页数 32 | */ 33 | public PageUtils(List list, int totalCount, int pageSize, int currPage) { 34 | this.list = list; 35 | this.total = totalCount; 36 | this.pageSize = pageSize; 37 | this.currPage = currPage; 38 | this.totalPage = (int)Math.ceil((double)totalCount/pageSize); 39 | } 40 | 41 | /** 42 | * 分页 43 | */ 44 | public PageUtils(Page page) { 45 | this.list = page.getRecords(); 46 | this.total = page.getTotal(); 47 | this.pageSize = page.getSize(); 48 | this.currPage = page.getCurrent(); 49 | this.totalPage = page.getPages(); 50 | } 51 | 52 | /* 53 | * 空数据的分页 54 | */ 55 | public PageUtils(Map params) { 56 | Page page =new Query(params).getPage(); 57 | new PageUtils(page); 58 | } 59 | 60 | 61 | public int getPageSize() { 62 | return pageSize; 63 | } 64 | 65 | public void setPageSize(int pageSize) { 66 | this.pageSize = pageSize; 67 | } 68 | 69 | public int getCurrPage() { 70 | return currPage; 71 | } 72 | 73 | public void setCurrPage(int currPage) { 74 | this.currPage = currPage; 75 | } 76 | 77 | public List getList() { 78 | return list; 79 | } 80 | 81 | public void setList(List list) { 82 | this.list = list; 83 | } 84 | 85 | public long getTotalPage() { 86 | return totalPage; 87 | } 88 | 89 | public void setTotalPage(long totalPage) { 90 | this.totalPage = totalPage; 91 | } 92 | 93 | public long getTotal() { 94 | return total; 95 | } 96 | 97 | public void setTotal(long total) { 98 | this.total = total; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/utils/CommonUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.Random; 4 | import org.springframework.stereotype.Component; 5 | import org.apache.commons.lang3.StringUtils; 6 | import org.apache.poi.ss.usermodel.Cell; 7 | import java.text.DecimalFormat; 8 | import java.util.Objects; 9 | 10 | @Component 11 | public class CommonUtil { 12 | /** 13 | * 获取随机字符串 14 | * 15 | * @param num 16 | * @return 17 | */ 18 | public static String getRandomString(Integer num) { 19 | String base = "abcdefghijklmnopqrstuvwxyz0123456789"; 20 | Random random = new Random(); 21 | StringBuffer sb = new StringBuffer(); 22 | for (int i = 0; i < num; i++) { 23 | int number = random.nextInt(base.length()); 24 | sb.append(base.charAt(number)); 25 | } 26 | return sb.toString(); 27 | } 28 | 29 | /** 30 | * 获取随机验证码 31 | * 32 | * @param num 33 | * @return 34 | */ 35 | public static String getRandomNumber(Integer num) { 36 | String base = "0123456789"; 37 | Random random = new Random(); 38 | StringBuffer sb = new StringBuffer(); 39 | for (int i = 0; i < num; i++) { 40 | int number = random.nextInt(base.length()); 41 | sb.append(base.charAt(number)); 42 | } 43 | return sb.toString(); 44 | } 45 | 46 | public static String getCellValue(Cell cell) { 47 | String resultValue = ""; 48 | // 判空 49 | if (Objects.isNull(cell)) { 50 | return resultValue; 51 | } 52 | 53 | // 拿到单元格类型 54 | int cellType = cell.getCellType(); 55 | switch (cellType) { 56 | // 字符串类型 57 | case Cell.CELL_TYPE_STRING: 58 | resultValue = StringUtils.isEmpty(cell.getStringCellValue()) ? "" : cell.getStringCellValue().trim(); 59 | break; 60 | // 布尔类型 61 | case Cell.CELL_TYPE_BOOLEAN: 62 | resultValue = String.valueOf(cell.getBooleanCellValue()); 63 | break; 64 | // 数值类型 65 | case Cell.CELL_TYPE_NUMERIC: 66 | resultValue = new DecimalFormat("#.######").format(cell.getNumericCellValue()); 67 | break; 68 | // 取空串 69 | default: 70 | break; 71 | } 72 | return resultValue; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/DiscusshuochexinxiServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.DiscusshuochexinxiDao; 16 | import com.entity.DiscusshuochexinxiEntity; 17 | import com.service.DiscusshuochexinxiService; 18 | import com.entity.vo.DiscusshuochexinxiVO; 19 | import com.entity.view.DiscusshuochexinxiView; 20 | 21 | @Service("discusshuochexinxiService") 22 | public class DiscusshuochexinxiServiceImpl extends ServiceImpl implements DiscusshuochexinxiService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public DiscusshuochexinxiVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public DiscusshuochexinxiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ChepiaotuipiaoDao.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 | 32 | 33 | 38 | 39 | 45 | 46 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/AboutusVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.AboutusEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 关于我们 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public class AboutusVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 副标题 27 | */ 28 | 29 | private String subtitle; 30 | 31 | /** 32 | * 内容 33 | */ 34 | 35 | private String content; 36 | 37 | /** 38 | * 图片1 39 | */ 40 | 41 | private String picture1; 42 | 43 | /** 44 | * 图片2 45 | */ 46 | 47 | private String picture2; 48 | 49 | /** 50 | * 图片3 51 | */ 52 | 53 | private String picture3; 54 | 55 | 56 | /** 57 | * 设置:副标题 58 | */ 59 | 60 | public void setSubtitle(String subtitle) { 61 | this.subtitle = subtitle; 62 | } 63 | 64 | /** 65 | * 获取:副标题 66 | */ 67 | public String getSubtitle() { 68 | return subtitle; 69 | } 70 | 71 | 72 | /** 73 | * 设置:内容 74 | */ 75 | 76 | public void setContent(String content) { 77 | this.content = content; 78 | } 79 | 80 | /** 81 | * 获取:内容 82 | */ 83 | public String getContent() { 84 | return content; 85 | } 86 | 87 | 88 | /** 89 | * 设置:图片1 90 | */ 91 | 92 | public void setPicture1(String picture1) { 93 | this.picture1 = picture1; 94 | } 95 | 96 | /** 97 | * 获取:图片1 98 | */ 99 | public String getPicture1() { 100 | return picture1; 101 | } 102 | 103 | 104 | /** 105 | * 设置:图片2 106 | */ 107 | 108 | public void setPicture2(String picture2) { 109 | this.picture2 = picture2; 110 | } 111 | 112 | /** 113 | * 获取:图片2 114 | */ 115 | public String getPicture2() { 116 | return picture2; 117 | } 118 | 119 | 120 | /** 121 | * 设置:图片3 122 | */ 123 | 124 | public void setPicture3(String picture3) { 125 | this.picture3 = picture3; 126 | } 127 | 128 | /** 129 | * 获取:图片3 130 | */ 131 | public String getPicture3() { 132 | return picture3; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ChepiaoyudingDao.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 | 33 | 34 | 39 | 40 | 46 | 47 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/DiscusshuochexinxiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.DiscusshuochexinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 火车信息评论表 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public class DiscusshuochexinxiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 用户id 27 | */ 28 | 29 | private Long userid; 30 | 31 | /** 32 | * 头像 33 | */ 34 | 35 | private String avatarurl; 36 | 37 | /** 38 | * 用户名 39 | */ 40 | 41 | private String nickname; 42 | 43 | /** 44 | * 评论内容 45 | */ 46 | 47 | private String content; 48 | 49 | /** 50 | * 回复内容 51 | */ 52 | 53 | private String reply; 54 | 55 | 56 | /** 57 | * 设置:用户id 58 | */ 59 | 60 | public void setUserid(Long userid) { 61 | this.userid = userid; 62 | } 63 | 64 | /** 65 | * 获取:用户id 66 | */ 67 | public Long getUserid() { 68 | return userid; 69 | } 70 | 71 | 72 | /** 73 | * 设置:头像 74 | */ 75 | 76 | public void setAvatarurl(String avatarurl) { 77 | this.avatarurl = avatarurl; 78 | } 79 | 80 | /** 81 | * 获取:头像 82 | */ 83 | public String getAvatarurl() { 84 | return avatarurl; 85 | } 86 | 87 | 88 | /** 89 | * 设置:用户名 90 | */ 91 | 92 | public void setNickname(String nickname) { 93 | this.nickname = nickname; 94 | } 95 | 96 | /** 97 | * 获取:用户名 98 | */ 99 | public String getNickname() { 100 | return nickname; 101 | } 102 | 103 | 104 | /** 105 | * 设置:评论内容 106 | */ 107 | 108 | public void setContent(String content) { 109 | this.content = content; 110 | } 111 | 112 | /** 113 | * 获取:评论内容 114 | */ 115 | public String getContent() { 116 | return content; 117 | } 118 | 119 | 120 | /** 121 | * 设置:回复内容 122 | */ 123 | 124 | public void setReply(String reply) { 125 | this.reply = reply; 126 | } 127 | 128 | /** 129 | * 获取:回复内容 130 | */ 131 | public String getReply() { 132 | return reply; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/SystemintroVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.SystemintroEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 关于我们 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public class SystemintroVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 副标题 27 | */ 28 | 29 | private String subtitle; 30 | 31 | /** 32 | * 内容 33 | */ 34 | 35 | private String content; 36 | 37 | /** 38 | * 图片1 39 | */ 40 | 41 | private String picture1; 42 | 43 | /** 44 | * 图片2 45 | */ 46 | 47 | private String picture2; 48 | 49 | /** 50 | * 图片3 51 | */ 52 | 53 | private String picture3; 54 | 55 | 56 | /** 57 | * 设置:副标题 58 | */ 59 | 60 | public void setSubtitle(String subtitle) { 61 | this.subtitle = subtitle; 62 | } 63 | 64 | /** 65 | * 获取:副标题 66 | */ 67 | public String getSubtitle() { 68 | return subtitle; 69 | } 70 | 71 | 72 | /** 73 | * 设置:内容 74 | */ 75 | 76 | public void setContent(String content) { 77 | this.content = content; 78 | } 79 | 80 | /** 81 | * 获取:内容 82 | */ 83 | public String getContent() { 84 | return content; 85 | } 86 | 87 | 88 | /** 89 | * 设置:图片1 90 | */ 91 | 92 | public void setPicture1(String picture1) { 93 | this.picture1 = picture1; 94 | } 95 | 96 | /** 97 | * 获取:图片1 98 | */ 99 | public String getPicture1() { 100 | return picture1; 101 | } 102 | 103 | 104 | /** 105 | * 设置:图片2 106 | */ 107 | 108 | public void setPicture2(String picture2) { 109 | this.picture2 = picture2; 110 | } 111 | 112 | /** 113 | * 获取:图片2 114 | */ 115 | public String getPicture2() { 116 | return picture2; 117 | } 118 | 119 | 120 | /** 121 | * 设置:图片3 122 | */ 123 | 124 | public void setPicture3(String picture3) { 125 | this.picture3 = picture3; 126 | } 127 | 128 | /** 129 | * 获取:图片3 130 | */ 131 | public String getPicture3() { 132 | return picture3; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/YonghuVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.YonghuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 用户 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public class YonghuVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 密码 27 | */ 28 | 29 | private String mima; 30 | 31 | /** 32 | * 用户姓名 33 | */ 34 | 35 | private String yonghuxingming; 36 | 37 | /** 38 | * 性别 39 | */ 40 | 41 | private String xingbie; 42 | 43 | /** 44 | * 用户电话 45 | */ 46 | 47 | private String yonghudianhua; 48 | 49 | /** 50 | * 头像 51 | */ 52 | 53 | private String touxiang; 54 | 55 | 56 | /** 57 | * 设置:密码 58 | */ 59 | 60 | public void setMima(String mima) { 61 | this.mima = mima; 62 | } 63 | 64 | /** 65 | * 获取:密码 66 | */ 67 | public String getMima() { 68 | return mima; 69 | } 70 | 71 | 72 | /** 73 | * 设置:用户姓名 74 | */ 75 | 76 | public void setYonghuxingming(String yonghuxingming) { 77 | this.yonghuxingming = yonghuxingming; 78 | } 79 | 80 | /** 81 | * 获取:用户姓名 82 | */ 83 | public String getYonghuxingming() { 84 | return yonghuxingming; 85 | } 86 | 87 | 88 | /** 89 | * 设置:性别 90 | */ 91 | 92 | public void setXingbie(String xingbie) { 93 | this.xingbie = xingbie; 94 | } 95 | 96 | /** 97 | * 获取:性别 98 | */ 99 | public String getXingbie() { 100 | return xingbie; 101 | } 102 | 103 | 104 | /** 105 | * 设置:用户电话 106 | */ 107 | 108 | public void setYonghudianhua(String yonghudianhua) { 109 | this.yonghudianhua = yonghudianhua; 110 | } 111 | 112 | /** 113 | * 获取:用户电话 114 | */ 115 | public String getYonghudianhua() { 116 | return yonghudianhua; 117 | } 118 | 119 | 120 | /** 121 | * 设置:头像 122 | */ 123 | 124 | public void setTouxiang(String touxiang) { 125 | this.touxiang = touxiang; 126 | } 127 | 128 | /** 129 | * 获取:头像 130 | */ 131 | public String getTouxiang() { 132 | return touxiang; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/AboutusModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.AboutusEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 关于我们 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public class AboutusModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 副标题 28 | */ 29 | 30 | private String subtitle; 31 | 32 | /** 33 | * 内容 34 | */ 35 | 36 | private String content; 37 | 38 | /** 39 | * 图片1 40 | */ 41 | 42 | private String picture1; 43 | 44 | /** 45 | * 图片2 46 | */ 47 | 48 | private String picture2; 49 | 50 | /** 51 | * 图片3 52 | */ 53 | 54 | private String picture3; 55 | 56 | 57 | /** 58 | * 设置:副标题 59 | */ 60 | 61 | public void setSubtitle(String subtitle) { 62 | this.subtitle = subtitle; 63 | } 64 | 65 | /** 66 | * 获取:副标题 67 | */ 68 | public String getSubtitle() { 69 | return subtitle; 70 | } 71 | 72 | 73 | /** 74 | * 设置:内容 75 | */ 76 | 77 | public void setContent(String content) { 78 | this.content = content; 79 | } 80 | 81 | /** 82 | * 获取:内容 83 | */ 84 | public String getContent() { 85 | return content; 86 | } 87 | 88 | 89 | /** 90 | * 设置:图片1 91 | */ 92 | 93 | public void setPicture1(String picture1) { 94 | this.picture1 = picture1; 95 | } 96 | 97 | /** 98 | * 获取:图片1 99 | */ 100 | public String getPicture1() { 101 | return picture1; 102 | } 103 | 104 | 105 | /** 106 | * 设置:图片2 107 | */ 108 | 109 | public void setPicture2(String picture2) { 110 | this.picture2 = picture2; 111 | } 112 | 113 | /** 114 | * 获取:图片2 115 | */ 116 | public String getPicture2() { 117 | return picture2; 118 | } 119 | 120 | 121 | /** 122 | * 设置:图片3 123 | */ 124 | 125 | public void setPicture3(String picture3) { 126 | this.picture3 = picture3; 127 | } 128 | 129 | /** 130 | * 获取:图片3 131 | */ 132 | public String getPicture3() { 133 | return picture3; 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/DiscusshuochexinxiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.DiscusshuochexinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 火车信息评论表 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public class DiscusshuochexinxiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 用户id 28 | */ 29 | 30 | private Long userid; 31 | 32 | /** 33 | * 头像 34 | */ 35 | 36 | private String avatarurl; 37 | 38 | /** 39 | * 用户名 40 | */ 41 | 42 | private String nickname; 43 | 44 | /** 45 | * 评论内容 46 | */ 47 | 48 | private String content; 49 | 50 | /** 51 | * 回复内容 52 | */ 53 | 54 | private String reply; 55 | 56 | 57 | /** 58 | * 设置:用户id 59 | */ 60 | 61 | public void setUserid(Long userid) { 62 | this.userid = userid; 63 | } 64 | 65 | /** 66 | * 获取:用户id 67 | */ 68 | public Long getUserid() { 69 | return userid; 70 | } 71 | 72 | 73 | /** 74 | * 设置:头像 75 | */ 76 | 77 | public void setAvatarurl(String avatarurl) { 78 | this.avatarurl = avatarurl; 79 | } 80 | 81 | /** 82 | * 获取:头像 83 | */ 84 | public String getAvatarurl() { 85 | return avatarurl; 86 | } 87 | 88 | 89 | /** 90 | * 设置:用户名 91 | */ 92 | 93 | public void setNickname(String nickname) { 94 | this.nickname = nickname; 95 | } 96 | 97 | /** 98 | * 获取:用户名 99 | */ 100 | public String getNickname() { 101 | return nickname; 102 | } 103 | 104 | 105 | /** 106 | * 设置:评论内容 107 | */ 108 | 109 | public void setContent(String content) { 110 | this.content = content; 111 | } 112 | 113 | /** 114 | * 获取:评论内容 115 | */ 116 | public String getContent() { 117 | return content; 118 | } 119 | 120 | 121 | /** 122 | * 设置:回复内容 123 | */ 124 | 125 | public void setReply(String reply) { 126 | this.reply = reply; 127 | } 128 | 129 | /** 130 | * 获取:回复内容 131 | */ 132 | public String getReply() { 133 | return reply; 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/SystemintroModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.SystemintroEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 关于我们 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public class SystemintroModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 副标题 28 | */ 29 | 30 | private String subtitle; 31 | 32 | /** 33 | * 内容 34 | */ 35 | 36 | private String content; 37 | 38 | /** 39 | * 图片1 40 | */ 41 | 42 | private String picture1; 43 | 44 | /** 45 | * 图片2 46 | */ 47 | 48 | private String picture2; 49 | 50 | /** 51 | * 图片3 52 | */ 53 | 54 | private String picture3; 55 | 56 | 57 | /** 58 | * 设置:副标题 59 | */ 60 | 61 | public void setSubtitle(String subtitle) { 62 | this.subtitle = subtitle; 63 | } 64 | 65 | /** 66 | * 获取:副标题 67 | */ 68 | public String getSubtitle() { 69 | return subtitle; 70 | } 71 | 72 | 73 | /** 74 | * 设置:内容 75 | */ 76 | 77 | public void setContent(String content) { 78 | this.content = content; 79 | } 80 | 81 | /** 82 | * 获取:内容 83 | */ 84 | public String getContent() { 85 | return content; 86 | } 87 | 88 | 89 | /** 90 | * 设置:图片1 91 | */ 92 | 93 | public void setPicture1(String picture1) { 94 | this.picture1 = picture1; 95 | } 96 | 97 | /** 98 | * 获取:图片1 99 | */ 100 | public String getPicture1() { 101 | return picture1; 102 | } 103 | 104 | 105 | /** 106 | * 设置:图片2 107 | */ 108 | 109 | public void setPicture2(String picture2) { 110 | this.picture2 = picture2; 111 | } 112 | 113 | /** 114 | * 获取:图片2 115 | */ 116 | public String getPicture2() { 117 | return picture2; 118 | } 119 | 120 | 121 | /** 122 | * 设置:图片3 123 | */ 124 | 125 | public void setPicture3(String picture3) { 126 | this.picture3 = picture3; 127 | } 128 | 129 | /** 130 | * 获取:图片3 131 | */ 132 | public String getPicture3() { 133 | return picture3; 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/YonghuModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.YonghuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 用户 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public class YonghuModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 密码 28 | */ 29 | 30 | private String mima; 31 | 32 | /** 33 | * 用户姓名 34 | */ 35 | 36 | private String yonghuxingming; 37 | 38 | /** 39 | * 性别 40 | */ 41 | 42 | private String xingbie; 43 | 44 | /** 45 | * 用户电话 46 | */ 47 | 48 | private String yonghudianhua; 49 | 50 | /** 51 | * 头像 52 | */ 53 | 54 | private String touxiang; 55 | 56 | 57 | /** 58 | * 设置:密码 59 | */ 60 | 61 | public void setMima(String mima) { 62 | this.mima = mima; 63 | } 64 | 65 | /** 66 | * 获取:密码 67 | */ 68 | public String getMima() { 69 | return mima; 70 | } 71 | 72 | 73 | /** 74 | * 设置:用户姓名 75 | */ 76 | 77 | public void setYonghuxingming(String yonghuxingming) { 78 | this.yonghuxingming = yonghuxingming; 79 | } 80 | 81 | /** 82 | * 获取:用户姓名 83 | */ 84 | public String getYonghuxingming() { 85 | return yonghuxingming; 86 | } 87 | 88 | 89 | /** 90 | * 设置:性别 91 | */ 92 | 93 | public void setXingbie(String xingbie) { 94 | this.xingbie = xingbie; 95 | } 96 | 97 | /** 98 | * 获取:性别 99 | */ 100 | public String getXingbie() { 101 | return xingbie; 102 | } 103 | 104 | 105 | /** 106 | * 设置:用户电话 107 | */ 108 | 109 | public void setYonghudianhua(String yonghudianhua) { 110 | this.yonghudianhua = yonghudianhua; 111 | } 112 | 113 | /** 114 | * 获取:用户电话 115 | */ 116 | public String getYonghudianhua() { 117 | return yonghudianhua; 118 | } 119 | 120 | 121 | /** 122 | * 设置:头像 123 | */ 124 | 125 | public void setTouxiang(String touxiang) { 126 | this.touxiang = touxiang; 127 | } 128 | 129 | /** 130 | * 获取:头像 131 | */ 132 | public String getTouxiang() { 133 | return touxiang; 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/TokenServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.Calendar; 6 | import java.util.Date; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | import org.springframework.stereotype.Service; 11 | 12 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 13 | import com.baomidou.mybatisplus.mapper.Wrapper; 14 | import com.baomidou.mybatisplus.plugins.Page; 15 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 16 | import com.dao.TokenDao; 17 | import com.entity.TokenEntity; 18 | import com.entity.TokenEntity; 19 | import com.service.TokenService; 20 | import com.utils.CommonUtil; 21 | import com.utils.PageUtils; 22 | import com.utils.Query; 23 | 24 | 25 | /** 26 | * token 27 | */ 28 | @Service("tokenService") 29 | public class TokenServiceImpl extends ServiceImpl implements TokenService { 30 | 31 | @Override 32 | public PageUtils queryPage(Map params) { 33 | Page page = this.selectPage( 34 | new Query(params).getPage(), 35 | new EntityWrapper() 36 | ); 37 | return new PageUtils(page); 38 | } 39 | 40 | @Override 41 | public List selectListView(Wrapper wrapper) { 42 | return baseMapper.selectListView(wrapper); 43 | } 44 | 45 | @Override 46 | public PageUtils queryPage(Map params, 47 | Wrapper wrapper) { 48 | Page page =new Query(params).getPage(); 49 | page.setRecords(baseMapper.selectListView(page,wrapper)); 50 | PageUtils pageUtil = new PageUtils(page); 51 | return pageUtil; 52 | } 53 | 54 | @Override 55 | public String generateToken(Long userid,String username, String tableName, String role) { 56 | TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("userid", userid).eq("role", role)); 57 | String token = CommonUtil.getRandomString(32); 58 | Calendar cal = Calendar.getInstance(); 59 | cal.setTime(new Date()); 60 | cal.add(Calendar.HOUR_OF_DAY, 1); 61 | if(tokenEntity!=null) { 62 | tokenEntity.setToken(token); 63 | tokenEntity.setExpiratedtime(cal.getTime()); 64 | this.updateById(tokenEntity); 65 | } else { 66 | this.insert(new TokenEntity(userid,username, tableName, role, token, cal.getTime())); 67 | } 68 | return token; 69 | } 70 | 71 | @Override 72 | public TokenEntity getTokenEntity(String token) { 73 | TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("token", token)); 74 | if(tokenEntity == null || tokenEntity.getExpiratedtime().getTime() extends LinkedHashMap { 15 | private static final long serialVersionUID = 1L; 16 | /** 17 | * mybatis-plus分页参数 18 | */ 19 | private Page page; 20 | /** 21 | * 当前页码 22 | */ 23 | private int currPage = 1; 24 | /** 25 | * 每页条数 26 | */ 27 | private int limit = 10; 28 | 29 | public Query(JQPageInfo pageInfo) { 30 | //分页参数 31 | if(pageInfo.getPage()!= null){ 32 | currPage = pageInfo.getPage(); 33 | } 34 | if(pageInfo.getLimit()!= null){ 35 | limit = pageInfo.getLimit(); 36 | } 37 | 38 | 39 | //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) 40 | String sidx = SQLFilter.sqlInject(pageInfo.getSidx()); 41 | String order = SQLFilter.sqlInject(pageInfo.getOrder()); 42 | 43 | 44 | //mybatis-plus分页 45 | this.page = new Page<>(currPage, limit); 46 | 47 | //排序 48 | if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ 49 | this.page.setOrderByField(sidx); 50 | this.page.setAsc("ASC".equalsIgnoreCase(order)); 51 | } 52 | } 53 | 54 | 55 | public Query(Map params){ 56 | this.putAll(params); 57 | 58 | //分页参数 59 | if(params.get("page") != null){ 60 | currPage = Integer.parseInt((String)params.get("page")); 61 | } 62 | if(params.get("limit") != null){ 63 | limit = Integer.parseInt((String)params.get("limit")); 64 | } 65 | 66 | this.put("offset", (currPage - 1) * limit); 67 | this.put("page", currPage); 68 | this.put("limit", limit); 69 | 70 | //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) 71 | String sidx = SQLFilter.sqlInject((String)params.get("sidx")); 72 | String order = SQLFilter.sqlInject((String)params.get("order")); 73 | this.put("sidx", sidx); 74 | this.put("order", order); 75 | 76 | //mybatis-plus分页 77 | this.page = new Page<>(currPage, limit); 78 | 79 | //排序 80 | if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ 81 | this.page.setOrderByField(sidx); 82 | this.page.setAsc("ASC".equalsIgnoreCase(order)); 83 | } 84 | 85 | } 86 | 87 | public Page getPage() { 88 | return page; 89 | } 90 | 91 | public int getCurrPage() { 92 | return currPage; 93 | } 94 | 95 | public int getLimit() { 96 | return limit; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CommonDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 22 | 23 | 24 | UPDATE ${table} set sfsh=#{sfsh} where id=#{id} 25 | 26 | 27 | 47 | 48 | 51 | 52 | 55 | 56 | 59 | 60 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/StoreupVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.StoreupEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 收藏表 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public class StoreupVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 商品id 27 | */ 28 | 29 | private Long refid; 30 | 31 | /** 32 | * 表名 33 | */ 34 | 35 | private String tablename; 36 | 37 | /** 38 | * 名称 39 | */ 40 | 41 | private String name; 42 | 43 | /** 44 | * 图片 45 | */ 46 | 47 | private String picture; 48 | 49 | /** 50 | * 类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) 51 | */ 52 | 53 | private String type; 54 | 55 | /** 56 | * 推荐类型 57 | */ 58 | 59 | private String inteltype; 60 | 61 | /** 62 | * 备注 63 | */ 64 | 65 | private String remark; 66 | 67 | 68 | /** 69 | * 设置:商品id 70 | */ 71 | 72 | public void setRefid(Long refid) { 73 | this.refid = refid; 74 | } 75 | 76 | /** 77 | * 获取:商品id 78 | */ 79 | public Long getRefid() { 80 | return refid; 81 | } 82 | 83 | 84 | /** 85 | * 设置:表名 86 | */ 87 | 88 | public void setTablename(String tablename) { 89 | this.tablename = tablename; 90 | } 91 | 92 | /** 93 | * 获取:表名 94 | */ 95 | public String getTablename() { 96 | return tablename; 97 | } 98 | 99 | 100 | /** 101 | * 设置:名称 102 | */ 103 | 104 | public void setName(String name) { 105 | this.name = name; 106 | } 107 | 108 | /** 109 | * 获取:名称 110 | */ 111 | public String getName() { 112 | return name; 113 | } 114 | 115 | 116 | /** 117 | * 设置:图片 118 | */ 119 | 120 | public void setPicture(String picture) { 121 | this.picture = picture; 122 | } 123 | 124 | /** 125 | * 获取:图片 126 | */ 127 | public String getPicture() { 128 | return picture; 129 | } 130 | 131 | 132 | /** 133 | * 设置:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) 134 | */ 135 | 136 | public void setType(String type) { 137 | this.type = type; 138 | } 139 | 140 | /** 141 | * 获取:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) 142 | */ 143 | public String getType() { 144 | return type; 145 | } 146 | 147 | 148 | /** 149 | * 设置:推荐类型 150 | */ 151 | 152 | public void setInteltype(String inteltype) { 153 | this.inteltype = inteltype; 154 | } 155 | 156 | /** 157 | * 获取:推荐类型 158 | */ 159 | public String getInteltype() { 160 | return inteltype; 161 | } 162 | 163 | 164 | /** 165 | * 设置:备注 166 | */ 167 | 168 | public void setRemark(String remark) { 169 | this.remark = remark; 170 | } 171 | 172 | /** 173 | * 获取:备注 174 | */ 175 | public String getRemark() { 176 | return remark; 177 | } 178 | 179 | } 180 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/StoreupModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.StoreupEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 收藏表 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public class StoreupModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 商品id 28 | */ 29 | 30 | private Long refid; 31 | 32 | /** 33 | * 表名 34 | */ 35 | 36 | private String tablename; 37 | 38 | /** 39 | * 名称 40 | */ 41 | 42 | private String name; 43 | 44 | /** 45 | * 图片 46 | */ 47 | 48 | private String picture; 49 | 50 | /** 51 | * 类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) 52 | */ 53 | 54 | private String type; 55 | 56 | /** 57 | * 推荐类型 58 | */ 59 | 60 | private String inteltype; 61 | 62 | /** 63 | * 备注 64 | */ 65 | 66 | private String remark; 67 | 68 | 69 | /** 70 | * 设置:商品id 71 | */ 72 | 73 | public void setRefid(Long refid) { 74 | this.refid = refid; 75 | } 76 | 77 | /** 78 | * 获取:商品id 79 | */ 80 | public Long getRefid() { 81 | return refid; 82 | } 83 | 84 | 85 | /** 86 | * 设置:表名 87 | */ 88 | 89 | public void setTablename(String tablename) { 90 | this.tablename = tablename; 91 | } 92 | 93 | /** 94 | * 获取:表名 95 | */ 96 | public String getTablename() { 97 | return tablename; 98 | } 99 | 100 | 101 | /** 102 | * 设置:名称 103 | */ 104 | 105 | public void setName(String name) { 106 | this.name = name; 107 | } 108 | 109 | /** 110 | * 获取:名称 111 | */ 112 | public String getName() { 113 | return name; 114 | } 115 | 116 | 117 | /** 118 | * 设置:图片 119 | */ 120 | 121 | public void setPicture(String picture) { 122 | this.picture = picture; 123 | } 124 | 125 | /** 126 | * 获取:图片 127 | */ 128 | public String getPicture() { 129 | return picture; 130 | } 131 | 132 | 133 | /** 134 | * 设置:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) 135 | */ 136 | 137 | public void setType(String type) { 138 | this.type = type; 139 | } 140 | 141 | /** 142 | * 获取:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) 143 | */ 144 | public String getType() { 145 | return type; 146 | } 147 | 148 | 149 | /** 150 | * 设置:推荐类型 151 | */ 152 | 153 | public void setInteltype(String inteltype) { 154 | this.inteltype = inteltype; 155 | } 156 | 157 | /** 158 | * 获取:推荐类型 159 | */ 160 | public String getInteltype() { 161 | return inteltype; 162 | } 163 | 164 | 165 | /** 166 | * 设置:备注 167 | */ 168 | 169 | public void setRemark(String remark) { 170 | this.remark = remark; 171 | } 172 | 173 | /** 174 | * 获取:备注 175 | */ 176 | public String getRemark() { 177 | return remark; 178 | } 179 | 180 | } 181 | -------------------------------------------------------------------------------- /src/main/java/com/entity/NewsEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 公告资讯 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-01-05 15:26:04 30 | */ 31 | @TableName("news") 32 | public class NewsEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public NewsEntity() { 37 | 38 | } 39 | 40 | public NewsEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 标题 56 | */ 57 | 58 | private String title; 59 | 60 | /** 61 | * 简介 62 | */ 63 | 64 | private String introduction; 65 | 66 | /** 67 | * 图片 68 | */ 69 | 70 | private String picture; 71 | 72 | /** 73 | * 内容 74 | */ 75 | 76 | private String content; 77 | 78 | 79 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 80 | @DateTimeFormat 81 | private Date addtime; 82 | 83 | public Date getAddtime() { 84 | return addtime; 85 | } 86 | public void setAddtime(Date addtime) { 87 | this.addtime = addtime; 88 | } 89 | 90 | public Long getId() { 91 | return id; 92 | } 93 | 94 | public void setId(Long id) { 95 | this.id = id; 96 | } 97 | /** 98 | * 设置:标题 99 | */ 100 | public void setTitle(String title) { 101 | this.title = title; 102 | } 103 | /** 104 | * 获取:标题 105 | */ 106 | public String getTitle() { 107 | return title; 108 | } 109 | /** 110 | * 设置:简介 111 | */ 112 | public void setIntroduction(String introduction) { 113 | this.introduction = introduction; 114 | } 115 | /** 116 | * 获取:简介 117 | */ 118 | public String getIntroduction() { 119 | return introduction; 120 | } 121 | /** 122 | * 设置:图片 123 | */ 124 | public void setPicture(String picture) { 125 | this.picture = picture; 126 | } 127 | /** 128 | * 获取:图片 129 | */ 130 | public String getPicture() { 131 | return picture; 132 | } 133 | /** 134 | * 设置:内容 135 | */ 136 | public void setContent(String content) { 137 | this.content = content; 138 | } 139 | /** 140 | * 获取:内容 141 | */ 142 | public String getContent() { 143 | return content; 144 | } 145 | 146 | } 147 | -------------------------------------------------------------------------------- /src/main/java/com/interceptor/AuthorizationInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.interceptor; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import com.alibaba.fastjson.JSONObject; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | import org.apache.commons.lang3.StringUtils; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Component; 14 | import org.springframework.web.method.HandlerMethod; 15 | import org.springframework.web.servlet.HandlerInterceptor; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.http.HttpStatus; 18 | 19 | import com.annotation.IgnoreAuth; 20 | import com.entity.EIException; 21 | import com.entity.TokenEntity; 22 | import com.service.TokenService; 23 | import com.utils.R; 24 | 25 | /** 26 | * 权限(Token)验证 27 | */ 28 | @Component 29 | public class AuthorizationInterceptor implements HandlerInterceptor { 30 | 31 | public static final String LOGIN_TOKEN_KEY = "Token"; 32 | 33 | @Autowired 34 | private TokenService tokenService; 35 | 36 | @Override 37 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 38 | 39 | //支持跨域请求 40 | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); 41 | response.setHeader("Access-Control-Max-Age", "3600"); 42 | response.setHeader("Access-Control-Allow-Credentials", "true"); 43 | response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization"); 44 | response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); 45 | // 跨域时会首先发送一个OPTIONS请求,这里我们给OPTIONS请求直接返回正常状态 46 | if (request.getMethod().equals(RequestMethod.OPTIONS.name())) { 47 | response.setStatus(HttpStatus.OK.value()); 48 | return false; 49 | } 50 | 51 | IgnoreAuth annotation; 52 | if (handler instanceof HandlerMethod) { 53 | annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class); 54 | } else { 55 | return true; 56 | } 57 | 58 | //从header中获取token 59 | String token = request.getHeader(LOGIN_TOKEN_KEY); 60 | 61 | /** 62 | * 不需要验证权限的方法直接放过 63 | */ 64 | if(annotation!=null) { 65 | return true; 66 | } 67 | 68 | TokenEntity tokenEntity = null; 69 | if(StringUtils.isNotBlank(token)) { 70 | tokenEntity = tokenService.getTokenEntity(token); 71 | } 72 | 73 | if(tokenEntity != null) { 74 | request.getSession().setAttribute("userId", tokenEntity.getUserid()); 75 | request.getSession().setAttribute("role", tokenEntity.getRole()); 76 | request.getSession().setAttribute("tableName", tokenEntity.getTablename()); 77 | request.getSession().setAttribute("username", tokenEntity.getUsername()); 78 | return true; 79 | } 80 | 81 | PrintWriter writer = null; 82 | response.setCharacterEncoding("UTF-8"); 83 | response.setContentType("application/json; charset=utf-8"); 84 | try { 85 | writer = response.getWriter(); 86 | writer.print(JSONObject.toJSONString(R.error(401, "请先登录"))); 87 | } finally { 88 | if(writer != null){ 89 | writer.close(); 90 | } 91 | } 92 | // throw new EIException("请先登录", 401); 93 | return false; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/controller/ConfigController.java: -------------------------------------------------------------------------------- 1 | 2 | package com.controller; 3 | 4 | 5 | import java.util.Arrays; 6 | import java.util.Map; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import com.annotation.IgnoreAuth; 17 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 18 | import com.entity.ConfigEntity; 19 | import com.service.ConfigService; 20 | import com.utils.MPUtil; 21 | import com.utils.PageUtils; 22 | import com.utils.R; 23 | import com.utils.ValidatorUtils; 24 | 25 | /** 26 | * 登录相关 27 | */ 28 | @RequestMapping("config") 29 | @RestController 30 | public class ConfigController{ 31 | 32 | @Autowired 33 | private ConfigService configService; 34 | 35 | /** 36 | * 列表 37 | */ 38 | @RequestMapping("/page") 39 | public R page(@RequestParam Map params,ConfigEntity config){ 40 | EntityWrapper ew = new EntityWrapper(); 41 | PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params)); 42 | return R.ok().put("data", page); 43 | } 44 | 45 | /** 46 | * 列表 47 | */ 48 | @IgnoreAuth 49 | @RequestMapping("/list") 50 | public R list(@RequestParam Map params,ConfigEntity config){ 51 | EntityWrapper ew = new EntityWrapper(); 52 | PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params)); 53 | return R.ok().put("data", page); 54 | } 55 | 56 | /** 57 | * 信息 58 | */ 59 | @RequestMapping("/info/{id}") 60 | public R info(@PathVariable("id") String id){ 61 | ConfigEntity config = configService.selectById(id); 62 | return R.ok().put("data", config); 63 | } 64 | 65 | /** 66 | * 详情 67 | */ 68 | @IgnoreAuth 69 | @RequestMapping("/detail/{id}") 70 | public R detail(@PathVariable("id") String id){ 71 | ConfigEntity config = configService.selectById(id); 72 | return R.ok().put("data", config); 73 | } 74 | 75 | /** 76 | * 根据name获取信息 77 | */ 78 | @RequestMapping("/info") 79 | public R infoByName(@RequestParam String name){ 80 | ConfigEntity config = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 81 | return R.ok().put("data", config); 82 | } 83 | 84 | /** 85 | * 保存 86 | */ 87 | @PostMapping("/save") 88 | public R save(@RequestBody ConfigEntity config){ 89 | // ValidatorUtils.validateEntity(config); 90 | configService.insert(config); 91 | return R.ok(); 92 | } 93 | 94 | /** 95 | * 修改 96 | */ 97 | @RequestMapping("/update") 98 | public R update(@RequestBody ConfigEntity config){ 99 | // ValidatorUtils.validateEntity(config); 100 | configService.updateById(config);//全部更新 101 | return R.ok(); 102 | } 103 | 104 | /** 105 | * 删除 106 | */ 107 | @RequestMapping("/delete") 108 | public R delete(@RequestBody Long[] ids){ 109 | configService.deleteBatchIds(Arrays.asList(ids)); 110 | return R.ok(); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/com/utils/BaiduUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.net.HttpURLConnection; 6 | import java.net.URL; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import org.json.JSONObject; 12 | 13 | 14 | /** 15 | * 类说明 : 16 | */ 17 | 18 | public class BaiduUtil { 19 | 20 | /** 21 | * 根据经纬度获得省市区信息 22 | * @param lon 纬度 23 | * @param lat 经度 24 | * @param coordtype 经纬度坐标系 25 | * @return 26 | */ 27 | public static Map getCityByLonLat(String key, String lng, String lat) { 28 | String location = lat + "," + lng; 29 | try { 30 | //拼装url 31 | String url = "http://api.map.baidu.com/reverse_geocoding/v3/?ak="+key+"&output=json&coordtype=wgs84ll&location="+location; 32 | String result = HttpClientUtils.doGet(url); 33 | JSONObject o = new JSONObject(result); 34 | Map area = new HashMap<>(); 35 | area.put("province", o.getJSONObject("result").getJSONObject("addressComponent").getString("province")); 36 | area.put("city", o.getJSONObject("result").getJSONObject("addressComponent").getString("city")); 37 | area.put("district", o.getJSONObject("result").getJSONObject("addressComponent").getString("district")); 38 | area.put("street", o.getJSONObject("result").getJSONObject("addressComponent").getString("street")); 39 | return area; 40 | }catch (Exception e) { 41 | e.printStackTrace(); 42 | } 43 | return null; 44 | } 45 | 46 | /** 47 | * 获取API访问token 48 | * 该token有一定的有效期,需要自行管理,当失效时需重新获取. 49 | * @param ak - 百度云官网获取的 API Key 50 | * @param sk - 百度云官网获取的 Securet Key 51 | * @return assess_token 52 | */ 53 | public static String getAuth(String ak, String sk) { 54 | // 获取token地址 55 | String authHost = "https://aip.baidubce.com/oauth/2.0/token?"; 56 | String getAccessTokenUrl = authHost 57 | // 1. grant_type为固定参数 58 | + "grant_type=client_credentials" 59 | // 2. 官网获取的 API Key 60 | + "&client_id=" + ak 61 | // 3. 官网获取的 Secret Key 62 | + "&client_secret=" + sk; 63 | try { 64 | URL realUrl = new URL(getAccessTokenUrl); 65 | // 打开和URL之间的连接 66 | HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection(); 67 | connection.setRequestMethod("GET"); 68 | connection.connect(); 69 | // 获取所有响应头字段 70 | Map> map = connection.getHeaderFields(); 71 | // 遍历所有的响应头字段 72 | for (String key : map.keySet()) { 73 | System.err.println(key + "--->" + map.get(key)); 74 | } 75 | // 定义 BufferedReader输入流来读取URL的响应 76 | BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); 77 | String result = ""; 78 | String line; 79 | while ((line = in.readLine()) != null) { 80 | result += line; 81 | } 82 | /** 83 | * 返回结果示例 84 | */ 85 | System.err.println("result:" + result); 86 | org.json.JSONObject jsonObject = new org.json.JSONObject(result); 87 | String access_token = jsonObject.getString("access_token"); 88 | return access_token; 89 | } catch (Exception e) { 90 | System.err.printf("获取token失败!"); 91 | e.printStackTrace(System.err); 92 | } 93 | return null; 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/entity/AboutusEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 关于我们 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-01-05 15:26:04 30 | */ 31 | @TableName("aboutus") 32 | public class AboutusEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public AboutusEntity() { 37 | 38 | } 39 | 40 | public AboutusEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 标题 56 | */ 57 | 58 | private String title; 59 | 60 | /** 61 | * 副标题 62 | */ 63 | 64 | private String subtitle; 65 | 66 | /** 67 | * 内容 68 | */ 69 | 70 | private String content; 71 | 72 | /** 73 | * 图片1 74 | */ 75 | 76 | private String picture1; 77 | 78 | /** 79 | * 图片2 80 | */ 81 | 82 | private String picture2; 83 | 84 | /** 85 | * 图片3 86 | */ 87 | 88 | private String picture3; 89 | 90 | 91 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 92 | @DateTimeFormat 93 | private Date addtime; 94 | 95 | public Date getAddtime() { 96 | return addtime; 97 | } 98 | public void setAddtime(Date addtime) { 99 | this.addtime = addtime; 100 | } 101 | 102 | public Long getId() { 103 | return id; 104 | } 105 | 106 | public void setId(Long id) { 107 | this.id = id; 108 | } 109 | /** 110 | * 设置:标题 111 | */ 112 | public void setTitle(String title) { 113 | this.title = title; 114 | } 115 | /** 116 | * 获取:标题 117 | */ 118 | public String getTitle() { 119 | return title; 120 | } 121 | /** 122 | * 设置:副标题 123 | */ 124 | public void setSubtitle(String subtitle) { 125 | this.subtitle = subtitle; 126 | } 127 | /** 128 | * 获取:副标题 129 | */ 130 | public String getSubtitle() { 131 | return subtitle; 132 | } 133 | /** 134 | * 设置:内容 135 | */ 136 | public void setContent(String content) { 137 | this.content = content; 138 | } 139 | /** 140 | * 获取:内容 141 | */ 142 | public String getContent() { 143 | return content; 144 | } 145 | /** 146 | * 设置:图片1 147 | */ 148 | public void setPicture1(String picture1) { 149 | this.picture1 = picture1; 150 | } 151 | /** 152 | * 获取:图片1 153 | */ 154 | public String getPicture1() { 155 | return picture1; 156 | } 157 | /** 158 | * 设置:图片2 159 | */ 160 | public void setPicture2(String picture2) { 161 | this.picture2 = picture2; 162 | } 163 | /** 164 | * 获取:图片2 165 | */ 166 | public String getPicture2() { 167 | return picture2; 168 | } 169 | /** 170 | * 设置:图片3 171 | */ 172 | public void setPicture3(String picture3) { 173 | this.picture3 = picture3; 174 | } 175 | /** 176 | * 获取:图片3 177 | */ 178 | public String getPicture3() { 179 | return picture3; 180 | } 181 | 182 | } 183 | -------------------------------------------------------------------------------- /src/main/java/com/entity/SystemintroEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 关于我们 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-01-05 15:26:04 30 | */ 31 | @TableName("systemintro") 32 | public class SystemintroEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public SystemintroEntity() { 37 | 38 | } 39 | 40 | public SystemintroEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 标题 56 | */ 57 | 58 | private String title; 59 | 60 | /** 61 | * 副标题 62 | */ 63 | 64 | private String subtitle; 65 | 66 | /** 67 | * 内容 68 | */ 69 | 70 | private String content; 71 | 72 | /** 73 | * 图片1 74 | */ 75 | 76 | private String picture1; 77 | 78 | /** 79 | * 图片2 80 | */ 81 | 82 | private String picture2; 83 | 84 | /** 85 | * 图片3 86 | */ 87 | 88 | private String picture3; 89 | 90 | 91 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 92 | @DateTimeFormat 93 | private Date addtime; 94 | 95 | public Date getAddtime() { 96 | return addtime; 97 | } 98 | public void setAddtime(Date addtime) { 99 | this.addtime = addtime; 100 | } 101 | 102 | public Long getId() { 103 | return id; 104 | } 105 | 106 | public void setId(Long id) { 107 | this.id = id; 108 | } 109 | /** 110 | * 设置:标题 111 | */ 112 | public void setTitle(String title) { 113 | this.title = title; 114 | } 115 | /** 116 | * 获取:标题 117 | */ 118 | public String getTitle() { 119 | return title; 120 | } 121 | /** 122 | * 设置:副标题 123 | */ 124 | public void setSubtitle(String subtitle) { 125 | this.subtitle = subtitle; 126 | } 127 | /** 128 | * 获取:副标题 129 | */ 130 | public String getSubtitle() { 131 | return subtitle; 132 | } 133 | /** 134 | * 设置:内容 135 | */ 136 | public void setContent(String content) { 137 | this.content = content; 138 | } 139 | /** 140 | * 获取:内容 141 | */ 142 | public String getContent() { 143 | return content; 144 | } 145 | /** 146 | * 设置:图片1 147 | */ 148 | public void setPicture1(String picture1) { 149 | this.picture1 = picture1; 150 | } 151 | /** 152 | * 获取:图片1 153 | */ 154 | public String getPicture1() { 155 | return picture1; 156 | } 157 | /** 158 | * 设置:图片2 159 | */ 160 | public void setPicture2(String picture2) { 161 | this.picture2 = picture2; 162 | } 163 | /** 164 | * 获取:图片2 165 | */ 166 | public String getPicture2() { 167 | return picture2; 168 | } 169 | /** 170 | * 设置:图片3 171 | */ 172 | public void setPicture3(String picture3) { 173 | this.picture3 = picture3; 174 | } 175 | /** 176 | * 获取:图片3 177 | */ 178 | public String getPicture3() { 179 | return picture3; 180 | } 181 | 182 | } 183 | -------------------------------------------------------------------------------- /src/main/java/com/entity/DiscusshuochexinxiEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 火车信息评论表 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-01-05 15:26:04 30 | */ 31 | @TableName("discusshuochexinxi") 32 | public class DiscusshuochexinxiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public DiscusshuochexinxiEntity() { 37 | 38 | } 39 | 40 | public DiscusshuochexinxiEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 关联表id 56 | */ 57 | 58 | private Long refid; 59 | 60 | /** 61 | * 用户id 62 | */ 63 | 64 | private Long userid; 65 | 66 | /** 67 | * 头像 68 | */ 69 | 70 | private String avatarurl; 71 | 72 | /** 73 | * 用户名 74 | */ 75 | 76 | private String nickname; 77 | 78 | /** 79 | * 评论内容 80 | */ 81 | 82 | private String content; 83 | 84 | /** 85 | * 回复内容 86 | */ 87 | 88 | private String reply; 89 | 90 | 91 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 92 | @DateTimeFormat 93 | private Date addtime; 94 | 95 | public Date getAddtime() { 96 | return addtime; 97 | } 98 | public void setAddtime(Date addtime) { 99 | this.addtime = addtime; 100 | } 101 | 102 | public Long getId() { 103 | return id; 104 | } 105 | 106 | public void setId(Long id) { 107 | this.id = id; 108 | } 109 | /** 110 | * 设置:关联表id 111 | */ 112 | public void setRefid(Long refid) { 113 | this.refid = refid; 114 | } 115 | /** 116 | * 获取:关联表id 117 | */ 118 | public Long getRefid() { 119 | return refid; 120 | } 121 | /** 122 | * 设置:用户id 123 | */ 124 | public void setUserid(Long userid) { 125 | this.userid = userid; 126 | } 127 | /** 128 | * 获取:用户id 129 | */ 130 | public Long getUserid() { 131 | return userid; 132 | } 133 | /** 134 | * 设置:头像 135 | */ 136 | public void setAvatarurl(String avatarurl) { 137 | this.avatarurl = avatarurl; 138 | } 139 | /** 140 | * 获取:头像 141 | */ 142 | public String getAvatarurl() { 143 | return avatarurl; 144 | } 145 | /** 146 | * 设置:用户名 147 | */ 148 | public void setNickname(String nickname) { 149 | this.nickname = nickname; 150 | } 151 | /** 152 | * 获取:用户名 153 | */ 154 | public String getNickname() { 155 | return nickname; 156 | } 157 | /** 158 | * 设置:评论内容 159 | */ 160 | public void setContent(String content) { 161 | this.content = content; 162 | } 163 | /** 164 | * 获取:评论内容 165 | */ 166 | public String getContent() { 167 | return content; 168 | } 169 | /** 170 | * 设置:回复内容 171 | */ 172 | public void setReply(String reply) { 173 | this.reply = reply; 174 | } 175 | /** 176 | * 获取:回复内容 177 | */ 178 | public String getReply() { 179 | return reply; 180 | } 181 | 182 | } 183 | -------------------------------------------------------------------------------- /src/main/java/com/entity/YonghuEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 用户 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-01-05 15:26:04 30 | */ 31 | @TableName("yonghu") 32 | public class YonghuEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public YonghuEntity() { 37 | 38 | } 39 | 40 | public YonghuEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 用户账号 56 | */ 57 | 58 | private String yonghuzhanghao; 59 | 60 | /** 61 | * 密码 62 | */ 63 | 64 | private String mima; 65 | 66 | /** 67 | * 用户姓名 68 | */ 69 | 70 | private String yonghuxingming; 71 | 72 | /** 73 | * 性别 74 | */ 75 | 76 | private String xingbie; 77 | 78 | /** 79 | * 用户电话 80 | */ 81 | 82 | private String yonghudianhua; 83 | 84 | /** 85 | * 头像 86 | */ 87 | 88 | private String touxiang; 89 | 90 | 91 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 92 | @DateTimeFormat 93 | private Date addtime; 94 | 95 | public Date getAddtime() { 96 | return addtime; 97 | } 98 | public void setAddtime(Date addtime) { 99 | this.addtime = addtime; 100 | } 101 | 102 | public Long getId() { 103 | return id; 104 | } 105 | 106 | public void setId(Long id) { 107 | this.id = id; 108 | } 109 | /** 110 | * 设置:用户账号 111 | */ 112 | public void setYonghuzhanghao(String yonghuzhanghao) { 113 | this.yonghuzhanghao = yonghuzhanghao; 114 | } 115 | /** 116 | * 获取:用户账号 117 | */ 118 | public String getYonghuzhanghao() { 119 | return yonghuzhanghao; 120 | } 121 | /** 122 | * 设置:密码 123 | */ 124 | public void setMima(String mima) { 125 | this.mima = mima; 126 | } 127 | /** 128 | * 获取:密码 129 | */ 130 | public String getMima() { 131 | return mima; 132 | } 133 | /** 134 | * 设置:用户姓名 135 | */ 136 | public void setYonghuxingming(String yonghuxingming) { 137 | this.yonghuxingming = yonghuxingming; 138 | } 139 | /** 140 | * 获取:用户姓名 141 | */ 142 | public String getYonghuxingming() { 143 | return yonghuxingming; 144 | } 145 | /** 146 | * 设置:性别 147 | */ 148 | public void setXingbie(String xingbie) { 149 | this.xingbie = xingbie; 150 | } 151 | /** 152 | * 获取:性别 153 | */ 154 | public String getXingbie() { 155 | return xingbie; 156 | } 157 | /** 158 | * 设置:用户电话 159 | */ 160 | public void setYonghudianhua(String yonghudianhua) { 161 | this.yonghudianhua = yonghudianhua; 162 | } 163 | /** 164 | * 获取:用户电话 165 | */ 166 | public String getYonghudianhua() { 167 | return yonghudianhua; 168 | } 169 | /** 170 | * 设置:头像 171 | */ 172 | public void setTouxiang(String touxiang) { 173 | this.touxiang = touxiang; 174 | } 175 | /** 176 | * 获取:头像 177 | */ 178 | public String getTouxiang() { 179 | return touxiang; 180 | } 181 | 182 | } 183 | -------------------------------------------------------------------------------- /src/main/java/com/controller/FileController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | import java.util.Arrays; 7 | import java.util.Date; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | import java.util.Random; 12 | import java.util.UUID; 13 | 14 | import org.apache.commons.io.FileUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.http.HttpHeaders; 18 | import org.springframework.http.HttpStatus; 19 | import org.springframework.http.MediaType; 20 | import org.springframework.http.ResponseEntity; 21 | import org.springframework.util.ResourceUtils; 22 | import org.springframework.web.bind.annotation.PathVariable; 23 | import org.springframework.web.bind.annotation.RequestBody; 24 | import org.springframework.web.bind.annotation.RequestMapping; 25 | import org.springframework.web.bind.annotation.RequestParam; 26 | import org.springframework.web.bind.annotation.RestController; 27 | import org.springframework.web.multipart.MultipartFile; 28 | 29 | import com.annotation.IgnoreAuth; 30 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 31 | import com.entity.ConfigEntity; 32 | import com.entity.EIException; 33 | import com.service.ConfigService; 34 | import com.utils.R; 35 | 36 | /** 37 | * 上传文件映射表 38 | */ 39 | @RestController 40 | @RequestMapping("file") 41 | @SuppressWarnings({"unchecked","rawtypes"}) 42 | public class FileController{ 43 | @Autowired 44 | private ConfigService configService; 45 | /** 46 | * 上传文件 47 | */ 48 | @RequestMapping("/upload") 49 | @IgnoreAuth 50 | public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception { 51 | if (file.isEmpty()) { 52 | throw new EIException("上传文件不能为空"); 53 | } 54 | String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); 55 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 56 | if(!path.exists()) { 57 | path = new File(""); 58 | } 59 | File upload = new File(path.getAbsolutePath(),"/upload/"); 60 | if(!upload.exists()) { 61 | upload.mkdirs(); 62 | } 63 | String fileName = new Date().getTime()+"."+fileExt; 64 | File dest = new File(upload.getAbsolutePath()+"/"+fileName); 65 | file.transferTo(dest); 66 | /** 67 | * 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开 68 | * 请将以下的"D:\\springbootq33sd\\src\\main\\resources\\static\\upload"替换成你本地项目的upload路径, 69 | * 并且项目路径不能存在中文、空格等特殊字符 70 | */ 71 | // FileUtils.copyFile(dest, new File("D:\\springbootq33sd\\src\\main\\resources\\static\\upload"+"/"+fileName)); /**修改了路径以后请将该行最前面的//注释去掉**/ 72 | if(StringUtils.isNotBlank(type) && type.equals("1")) { 73 | ConfigEntity configEntity = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 74 | if(configEntity==null) { 75 | configEntity = new ConfigEntity(); 76 | configEntity.setName("faceFile"); 77 | configEntity.setValue(fileName); 78 | } else { 79 | configEntity.setValue(fileName); 80 | } 81 | configService.insertOrUpdate(configEntity); 82 | } 83 | return R.ok().put("file", fileName); 84 | } 85 | 86 | /** 87 | * 下载文件 88 | */ 89 | @IgnoreAuth 90 | @RequestMapping("/download") 91 | public ResponseEntity download(@RequestParam String fileName) { 92 | try { 93 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 94 | if(!path.exists()) { 95 | path = new File(""); 96 | } 97 | File upload = new File(path.getAbsolutePath(),"/upload/"); 98 | if(!upload.exists()) { 99 | upload.mkdirs(); 100 | } 101 | File file = new File(upload.getAbsolutePath()+"/"+fileName); 102 | if(file.exists()){ 103 | /*if(!fileService.canRead(file, SessionManager.getSessionUser())){ 104 | getResponse().sendError(403); 105 | }*/ 106 | HttpHeaders headers = new HttpHeaders(); 107 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 108 | headers.setContentDispositionFormData("attachment", fileName); 109 | return new ResponseEntity(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); 110 | } 111 | } catch (IOException e) { 112 | e.printStackTrace(); 113 | } 114 | return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/com/entity/StoreupEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 收藏表 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-01-05 15:26:04 30 | */ 31 | @TableName("storeup") 32 | public class StoreupEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public StoreupEntity() { 37 | 38 | } 39 | 40 | public StoreupEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 用户id 56 | */ 57 | 58 | private Long userid; 59 | 60 | /** 61 | * 商品id 62 | */ 63 | 64 | private Long refid; 65 | 66 | /** 67 | * 表名 68 | */ 69 | 70 | private String tablename; 71 | 72 | /** 73 | * 名称 74 | */ 75 | 76 | private String name; 77 | 78 | /** 79 | * 图片 80 | */ 81 | 82 | private String picture; 83 | 84 | /** 85 | * 类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) 86 | */ 87 | 88 | private String type; 89 | 90 | /** 91 | * 推荐类型 92 | */ 93 | 94 | private String inteltype; 95 | 96 | /** 97 | * 备注 98 | */ 99 | 100 | private String remark; 101 | 102 | 103 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 104 | @DateTimeFormat 105 | private Date addtime; 106 | 107 | public Date getAddtime() { 108 | return addtime; 109 | } 110 | public void setAddtime(Date addtime) { 111 | this.addtime = addtime; 112 | } 113 | 114 | public Long getId() { 115 | return id; 116 | } 117 | 118 | public void setId(Long id) { 119 | this.id = id; 120 | } 121 | /** 122 | * 设置:用户id 123 | */ 124 | public void setUserid(Long userid) { 125 | this.userid = userid; 126 | } 127 | /** 128 | * 获取:用户id 129 | */ 130 | public Long getUserid() { 131 | return userid; 132 | } 133 | /** 134 | * 设置:商品id 135 | */ 136 | public void setRefid(Long refid) { 137 | this.refid = refid; 138 | } 139 | /** 140 | * 获取:商品id 141 | */ 142 | public Long getRefid() { 143 | return refid; 144 | } 145 | /** 146 | * 设置:表名 147 | */ 148 | public void setTablename(String tablename) { 149 | this.tablename = tablename; 150 | } 151 | /** 152 | * 获取:表名 153 | */ 154 | public String getTablename() { 155 | return tablename; 156 | } 157 | /** 158 | * 设置:名称 159 | */ 160 | public void setName(String name) { 161 | this.name = name; 162 | } 163 | /** 164 | * 获取:名称 165 | */ 166 | public String getName() { 167 | return name; 168 | } 169 | /** 170 | * 设置:图片 171 | */ 172 | public void setPicture(String picture) { 173 | this.picture = picture; 174 | } 175 | /** 176 | * 获取:图片 177 | */ 178 | public String getPicture() { 179 | return picture; 180 | } 181 | /** 182 | * 设置:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) 183 | */ 184 | public void setType(String type) { 185 | this.type = type; 186 | } 187 | /** 188 | * 获取:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) 189 | */ 190 | public String getType() { 191 | return type; 192 | } 193 | /** 194 | * 设置:推荐类型 195 | */ 196 | public void setInteltype(String inteltype) { 197 | this.inteltype = inteltype; 198 | } 199 | /** 200 | * 获取:推荐类型 201 | */ 202 | public String getInteltype() { 203 | return inteltype; 204 | } 205 | /** 206 | * 设置:备注 207 | */ 208 | public void setRemark(String remark) { 209 | this.remark = remark; 210 | } 211 | /** 212 | * 获取:备注 213 | */ 214 | public String getRemark() { 215 | return remark; 216 | } 217 | 218 | } 219 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/HuochexinxiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.HuochexinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 火车信息 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-01-05 15:26:04 20 | */ 21 | public class HuochexinxiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 火车类型 27 | */ 28 | 29 | private String huocheleixing; 30 | 31 | /** 32 | * 车次 33 | */ 34 | 35 | private String checi; 36 | 37 | /** 38 | * 起点站 39 | */ 40 | 41 | private String qidianzhan; 42 | 43 | /** 44 | * 终点站 45 | */ 46 | 47 | private String zhongdianzhan; 48 | 49 | /** 50 | * 开车时间 51 | */ 52 | 53 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 54 | @DateTimeFormat 55 | private Date kaicheshijian; 56 | 57 | /** 58 | * 到站时间 59 | */ 60 | 61 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 62 | @DateTimeFormat 63 | private Date daozhanshijian; 64 | 65 | /** 66 | * 车票类型 67 | */ 68 | 69 | private String chepiaoleixing; 70 | 71 | /** 72 | * 座位类型 73 | */ 74 | 75 | private String zuoweileixing; 76 | 77 | /** 78 | * 列车图片 79 | */ 80 | 81 | private String liechetupian; 82 | 83 | /** 84 | * 车票价格 85 | */ 86 | 87 | private Integer chepiaojiage; 88 | 89 | /** 90 | * 列车路线 91 | */ 92 | 93 | private String liecheluxian; 94 | 95 | 96 | /** 97 | * 设置:火车类型 98 | */ 99 | 100 | public void setHuocheleixing(String huocheleixing) { 101 | this.huocheleixing = huocheleixing; 102 | } 103 | 104 | /** 105 | * 获取:火车类型 106 | */ 107 | public String getHuocheleixing() { 108 | return huocheleixing; 109 | } 110 | 111 | 112 | /** 113 | * 设置:车次 114 | */ 115 | 116 | public void setCheci(String checi) { 117 | this.checi = checi; 118 | } 119 | 120 | /** 121 | * 获取:车次 122 | */ 123 | public String getCheci() { 124 | return checi; 125 | } 126 | 127 | 128 | /** 129 | * 设置:起点站 130 | */ 131 | 132 | public void setQidianzhan(String qidianzhan) { 133 | this.qidianzhan = qidianzhan; 134 | } 135 | 136 | /** 137 | * 获取:起点站 138 | */ 139 | public String getQidianzhan() { 140 | return qidianzhan; 141 | } 142 | 143 | 144 | /** 145 | * 设置:终点站 146 | */ 147 | 148 | public void setZhongdianzhan(String zhongdianzhan) { 149 | this.zhongdianzhan = zhongdianzhan; 150 | } 151 | 152 | /** 153 | * 获取:终点站 154 | */ 155 | public String getZhongdianzhan() { 156 | return zhongdianzhan; 157 | } 158 | 159 | 160 | /** 161 | * 设置:开车时间 162 | */ 163 | 164 | public void setKaicheshijian(Date kaicheshijian) { 165 | this.kaicheshijian = kaicheshijian; 166 | } 167 | 168 | /** 169 | * 获取:开车时间 170 | */ 171 | public Date getKaicheshijian() { 172 | return kaicheshijian; 173 | } 174 | 175 | 176 | /** 177 | * 设置:到站时间 178 | */ 179 | 180 | public void setDaozhanshijian(Date daozhanshijian) { 181 | this.daozhanshijian = daozhanshijian; 182 | } 183 | 184 | /** 185 | * 获取:到站时间 186 | */ 187 | public Date getDaozhanshijian() { 188 | return daozhanshijian; 189 | } 190 | 191 | 192 | /** 193 | * 设置:车票类型 194 | */ 195 | 196 | public void setChepiaoleixing(String chepiaoleixing) { 197 | this.chepiaoleixing = chepiaoleixing; 198 | } 199 | 200 | /** 201 | * 获取:车票类型 202 | */ 203 | public String getChepiaoleixing() { 204 | return chepiaoleixing; 205 | } 206 | 207 | 208 | /** 209 | * 设置:座位类型 210 | */ 211 | 212 | public void setZuoweileixing(String zuoweileixing) { 213 | this.zuoweileixing = zuoweileixing; 214 | } 215 | 216 | /** 217 | * 获取:座位类型 218 | */ 219 | public String getZuoweileixing() { 220 | return zuoweileixing; 221 | } 222 | 223 | 224 | /** 225 | * 设置:列车图片 226 | */ 227 | 228 | public void setLiechetupian(String liechetupian) { 229 | this.liechetupian = liechetupian; 230 | } 231 | 232 | /** 233 | * 获取:列车图片 234 | */ 235 | public String getLiechetupian() { 236 | return liechetupian; 237 | } 238 | 239 | 240 | /** 241 | * 设置:车票价格 242 | */ 243 | 244 | public void setChepiaojiage(Integer chepiaojiage) { 245 | this.chepiaojiage = chepiaojiage; 246 | } 247 | 248 | /** 249 | * 获取:车票价格 250 | */ 251 | public Integer getChepiaojiage() { 252 | return chepiaojiage; 253 | } 254 | 255 | 256 | /** 257 | * 设置:列车路线 258 | */ 259 | 260 | public void setLiecheluxian(String liecheluxian) { 261 | this.liecheluxian = liecheluxian; 262 | } 263 | 264 | /** 265 | * 获取:列车路线 266 | */ 267 | public String getLiecheluxian() { 268 | return liecheluxian; 269 | } 270 | 271 | } 272 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/HuochexinxiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.HuochexinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 火车信息 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-01-05 15:26:04 21 | */ 22 | public class HuochexinxiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 火车类型 28 | */ 29 | 30 | private String huocheleixing; 31 | 32 | /** 33 | * 车次 34 | */ 35 | 36 | private String checi; 37 | 38 | /** 39 | * 起点站 40 | */ 41 | 42 | private String qidianzhan; 43 | 44 | /** 45 | * 终点站 46 | */ 47 | 48 | private String zhongdianzhan; 49 | 50 | /** 51 | * 开车时间 52 | */ 53 | 54 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 55 | @DateTimeFormat 56 | private Date kaicheshijian; 57 | 58 | /** 59 | * 到站时间 60 | */ 61 | 62 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 63 | @DateTimeFormat 64 | private Date daozhanshijian; 65 | 66 | /** 67 | * 车票类型 68 | */ 69 | 70 | private String chepiaoleixing; 71 | 72 | /** 73 | * 座位类型 74 | */ 75 | 76 | private String zuoweileixing; 77 | 78 | /** 79 | * 列车图片 80 | */ 81 | 82 | private String liechetupian; 83 | 84 | /** 85 | * 车票价格 86 | */ 87 | 88 | private Integer chepiaojiage; 89 | 90 | /** 91 | * 列车路线 92 | */ 93 | 94 | private String liecheluxian; 95 | 96 | 97 | /** 98 | * 设置:火车类型 99 | */ 100 | 101 | public void setHuocheleixing(String huocheleixing) { 102 | this.huocheleixing = huocheleixing; 103 | } 104 | 105 | /** 106 | * 获取:火车类型 107 | */ 108 | public String getHuocheleixing() { 109 | return huocheleixing; 110 | } 111 | 112 | 113 | /** 114 | * 设置:车次 115 | */ 116 | 117 | public void setCheci(String checi) { 118 | this.checi = checi; 119 | } 120 | 121 | /** 122 | * 获取:车次 123 | */ 124 | public String getCheci() { 125 | return checi; 126 | } 127 | 128 | 129 | /** 130 | * 设置:起点站 131 | */ 132 | 133 | public void setQidianzhan(String qidianzhan) { 134 | this.qidianzhan = qidianzhan; 135 | } 136 | 137 | /** 138 | * 获取:起点站 139 | */ 140 | public String getQidianzhan() { 141 | return qidianzhan; 142 | } 143 | 144 | 145 | /** 146 | * 设置:终点站 147 | */ 148 | 149 | public void setZhongdianzhan(String zhongdianzhan) { 150 | this.zhongdianzhan = zhongdianzhan; 151 | } 152 | 153 | /** 154 | * 获取:终点站 155 | */ 156 | public String getZhongdianzhan() { 157 | return zhongdianzhan; 158 | } 159 | 160 | 161 | /** 162 | * 设置:开车时间 163 | */ 164 | 165 | public void setKaicheshijian(Date kaicheshijian) { 166 | this.kaicheshijian = kaicheshijian; 167 | } 168 | 169 | /** 170 | * 获取:开车时间 171 | */ 172 | public Date getKaicheshijian() { 173 | return kaicheshijian; 174 | } 175 | 176 | 177 | /** 178 | * 设置:到站时间 179 | */ 180 | 181 | public void setDaozhanshijian(Date daozhanshijian) { 182 | this.daozhanshijian = daozhanshijian; 183 | } 184 | 185 | /** 186 | * 获取:到站时间 187 | */ 188 | public Date getDaozhanshijian() { 189 | return daozhanshijian; 190 | } 191 | 192 | 193 | /** 194 | * 设置:车票类型 195 | */ 196 | 197 | public void setChepiaoleixing(String chepiaoleixing) { 198 | this.chepiaoleixing = chepiaoleixing; 199 | } 200 | 201 | /** 202 | * 获取:车票类型 203 | */ 204 | public String getChepiaoleixing() { 205 | return chepiaoleixing; 206 | } 207 | 208 | 209 | /** 210 | * 设置:座位类型 211 | */ 212 | 213 | public void setZuoweileixing(String zuoweileixing) { 214 | this.zuoweileixing = zuoweileixing; 215 | } 216 | 217 | /** 218 | * 获取:座位类型 219 | */ 220 | public String getZuoweileixing() { 221 | return zuoweileixing; 222 | } 223 | 224 | 225 | /** 226 | * 设置:列车图片 227 | */ 228 | 229 | public void setLiechetupian(String liechetupian) { 230 | this.liechetupian = liechetupian; 231 | } 232 | 233 | /** 234 | * 获取:列车图片 235 | */ 236 | public String getLiechetupian() { 237 | return liechetupian; 238 | } 239 | 240 | 241 | /** 242 | * 设置:车票价格 243 | */ 244 | 245 | public void setChepiaojiage(Integer chepiaojiage) { 246 | this.chepiaojiage = chepiaojiage; 247 | } 248 | 249 | /** 250 | * 获取:车票价格 251 | */ 252 | public Integer getChepiaojiage() { 253 | return chepiaojiage; 254 | } 255 | 256 | 257 | /** 258 | * 设置:列车路线 259 | */ 260 | 261 | public void setLiecheluxian(String liecheluxian) { 262 | this.liecheluxian = liecheluxian; 263 | } 264 | 265 | /** 266 | * 获取:列车路线 267 | */ 268 | public String getLiecheluxian() { 269 | return liecheluxian; 270 | } 271 | 272 | } 273 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.2.RELEASE 9 | 10 | 11 | com.jlwl 12 | 13 | springbootw8iq4 14 | 0.0.1-SNAPSHOT 15 | springboot-schema 16 | springboot学习框架 17 | 18 | 19 | 1.8 20 | 1.2.8 21 | 3.1.1 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-web 28 | 29 | 30 | org.mybatis.spring.boot 31 | mybatis-spring-boot-starter 32 | 2.1.1 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-jdbc 37 | 38 | 39 | 40 | mysql 41 | mysql-connector-java 42 | 43 | 44 | org.apache.shiro 45 | shiro-spring 46 | 1.3.2 47 | 48 | 49 | 50 | com.baomidou 51 | mybatis-plus 52 | 2.3 53 | 54 | 55 | com.baomidou 56 | mybatisplus-spring-boot-starter 57 | 1.0.5 58 | 59 | 60 | com.google.protobuf 61 | protobuf-java 62 | 3.10.0 63 | 64 | 65 | 66 | org.apache.commons 67 | commons-lang3 68 | 3.0 69 | 70 | 71 | 72 | javax.validation 73 | validation-api 74 | 2.0.1.Final 75 | 76 | 77 | 78 | commons-io 79 | commons-io 80 | 2.5 81 | 82 | 83 | 84 | 85 | cn.hutool 86 | hutool-all 87 | 4.0.12 88 | 89 | 90 | 91 | 92 | com.alibaba 93 | fastjson 94 | ${fastjson.version} 95 | 96 | 97 | com.microsoft.sqlserver 98 | sqljdbc4 99 | 4.0 100 | 4.0 101 | 102 | 103 | 104 | com.microsoft.sqlserver 105 | mssql-jdbc 106 | 6.2.0.jre8 107 | runtime 108 | 109 | 110 | 111 | com.baidu.aip 112 | java-sdk 113 | 4.4.1 114 | 115 | 116 | 117 | org.apache.poi 118 | poi 119 | 3.11 120 | 121 | 122 | 123 | org.apache.poi 124 | poi-ooxml 125 | 3.9 126 | 127 | 128 | 129 | 130 | org.springframework.boot 131 | spring-boot-starter-test 132 | test 133 | 134 | 135 | org.junit.vintage 136 | junit-vintage-engine 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | org.springframework.boot 146 | spring-boot-maven-plugin 147 | 148 | 149 | org.apache.maven.plugins 150 | maven-compiler-plugin 151 | 152 | 1.8 153 | 1.8 154 | 155 | 156 | 157 | org.apache.maven.plugins 158 | maven-surefire-plugin 159 | 160 | true 161 | 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /src/main/java/com/controller/UsersController.java: -------------------------------------------------------------------------------- 1 | 2 | package com.controller; 3 | 4 | 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Date; 8 | import java.util.Map; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Controller; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.PathVariable; 16 | import org.springframework.web.bind.annotation.PostMapping; 17 | import org.springframework.web.bind.annotation.RequestBody; 18 | import org.springframework.web.bind.annotation.RequestMapping; 19 | import org.springframework.web.bind.annotation.RequestParam; 20 | import org.springframework.web.bind.annotation.ResponseBody; 21 | import org.springframework.web.bind.annotation.RestController; 22 | 23 | import com.annotation.IgnoreAuth; 24 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 25 | import com.entity.TokenEntity; 26 | import com.entity.UsersEntity; 27 | import com.service.TokenService; 28 | import com.service.UsersService; 29 | import com.utils.CommonUtil; 30 | import com.utils.MPUtil; 31 | import com.utils.PageUtils; 32 | import com.utils.R; 33 | import com.utils.ValidatorUtils; 34 | 35 | /** 36 | * 登录相关 37 | */ 38 | @RequestMapping("users") 39 | @RestController 40 | public class UsersController{ 41 | 42 | @Autowired 43 | private UsersService userService; 44 | 45 | @Autowired 46 | private TokenService tokenService; 47 | 48 | /** 49 | * 登录 50 | */ 51 | @IgnoreAuth 52 | @PostMapping(value = "/login") 53 | public R login(String username, String password, String captcha, HttpServletRequest request) { 54 | UsersEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); 55 | if(user==null || !user.getPassword().equals(password)) { 56 | return R.error("账号或密码不正确"); 57 | } 58 | String token = tokenService.generateToken(user.getId(),username, "users", user.getRole()); 59 | return R.ok().put("token", token); 60 | } 61 | 62 | /** 63 | * 注册 64 | */ 65 | @IgnoreAuth 66 | @PostMapping(value = "/register") 67 | public R register(@RequestBody UsersEntity user){ 68 | // ValidatorUtils.validateEntity(user); 69 | if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { 70 | return R.error("用户已存在"); 71 | } 72 | userService.insert(user); 73 | return R.ok(); 74 | } 75 | 76 | /** 77 | * 退出 78 | */ 79 | @GetMapping(value = "logout") 80 | public R logout(HttpServletRequest request) { 81 | request.getSession().invalidate(); 82 | return R.ok("退出成功"); 83 | } 84 | 85 | /** 86 | * 密码重置 87 | */ 88 | @IgnoreAuth 89 | @RequestMapping(value = "/resetPass") 90 | public R resetPass(String username, HttpServletRequest request){ 91 | UsersEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); 92 | if(user==null) { 93 | return R.error("账号不存在"); 94 | } 95 | user.setPassword("123456"); 96 | userService.update(user,null); 97 | return R.ok("密码已重置为:123456"); 98 | } 99 | 100 | /** 101 | * 列表 102 | */ 103 | @RequestMapping("/page") 104 | public R page(@RequestParam Map params,UsersEntity user){ 105 | EntityWrapper ew = new EntityWrapper(); 106 | PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); 107 | return R.ok().put("data", page); 108 | } 109 | 110 | /** 111 | * 列表 112 | */ 113 | @RequestMapping("/list") 114 | public R list( UsersEntity user){ 115 | EntityWrapper ew = new EntityWrapper(); 116 | ew.allEq(MPUtil.allEQMapPre( user, "user")); 117 | return R.ok().put("data", userService.selectListView(ew)); 118 | } 119 | 120 | /** 121 | * 信息 122 | */ 123 | @RequestMapping("/info/{id}") 124 | public R info(@PathVariable("id") String id){ 125 | UsersEntity user = userService.selectById(id); 126 | return R.ok().put("data", user); 127 | } 128 | 129 | /** 130 | * 获取用户的session用户信息 131 | */ 132 | @RequestMapping("/session") 133 | public R getCurrUser(HttpServletRequest request){ 134 | Long id = (Long)request.getSession().getAttribute("userId"); 135 | UsersEntity user = userService.selectById(id); 136 | return R.ok().put("data", user); 137 | } 138 | 139 | /** 140 | * 保存 141 | */ 142 | @PostMapping("/save") 143 | public R save(@RequestBody UsersEntity user){ 144 | // ValidatorUtils.validateEntity(user); 145 | if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { 146 | return R.error("用户已存在"); 147 | } 148 | userService.insert(user); 149 | return R.ok(); 150 | } 151 | 152 | /** 153 | * 修改 154 | */ 155 | @RequestMapping("/update") 156 | public R update(@RequestBody UsersEntity user){ 157 | // ValidatorUtils.validateEntity(user); 158 | UsersEntity u = userService.selectOne(new EntityWrapper().eq("username", user.getUsername())); 159 | if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) { 160 | return R.error("用户名已存在。"); 161 | } 162 | userService.updateById(user);//全部更新 163 | return R.ok(); 164 | } 165 | 166 | /** 167 | * 删除 168 | */ 169 | @RequestMapping("/delete") 170 | public R delete(@RequestBody Long[] ids){ 171 | userService.deleteBatchIds(Arrays.asList(ids)); 172 | return R.ok(); 173 | } 174 | } 175 | --------------------------------------------------------------------------------