├── image ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png └── 8.png ├── limage └── 1.png ├── src ├── main │ ├── resources │ │ ├── mapper │ │ │ ├── ConfigDao.xml │ │ │ ├── UserDao.xml │ │ │ ├── TokenDao.xml │ │ │ ├── NewsDao.xml │ │ │ ├── YonghuDao.xml │ │ │ ├── DiscussjingdianxinxiDao.xml │ │ │ ├── YonghupingjiaDao.xml │ │ │ ├── CommonDao.xml │ │ │ ├── DingpiaoxinxiDao.xml │ │ │ └── JingdianxinxiDao.xml │ │ └── application.yml │ └── java │ │ └── com │ │ ├── dao │ │ ├── ConfigDao.java │ │ ├── UserDao.java │ │ ├── TokenDao.java │ │ ├── CommonDao.java │ │ ├── NewsDao.java │ │ ├── YonghuDao.java │ │ ├── DingpiaoxinxiDao.java │ │ ├── JingdianxinxiDao.java │ │ ├── YonghupingjiaDao.java │ │ └── DiscussjingdianxinxiDao.java │ │ ├── annotation │ │ ├── IgnoreAuth.java │ │ ├── LoginUser.java │ │ └── APPLoginUser.java │ │ ├── service │ │ ├── ConfigService.java │ │ ├── CommonService.java │ │ ├── UserService.java │ │ ├── TokenService.java │ │ ├── impl │ │ │ ├── ConfigServiceImpl.java │ │ │ ├── CommonServiceImpl.java │ │ │ ├── UserServiceImpl.java │ │ │ ├── NewsServiceImpl.java │ │ │ ├── YonghuServiceImpl.java │ │ │ ├── DingpiaoxinxiServiceImpl.java │ │ │ ├── JingdianxinxiServiceImpl.java │ │ │ ├── YonghupingjiaServiceImpl.java │ │ │ ├── DiscussjingdianxinxiServiceImpl.java │ │ │ └── TokenServiceImpl.java │ │ ├── NewsService.java │ │ ├── YonghuService.java │ │ ├── DingpiaoxinxiService.java │ │ ├── JingdianxinxiService.java │ │ ├── YonghupingjiaService.java │ │ └── DiscussjingdianxinxiService.java │ │ ├── utils │ │ ├── MD5Util.java │ │ ├── CommonUtil.java │ │ ├── FileUtil.java │ │ ├── JQPageInfo.java │ │ ├── R.java │ │ ├── SQLFilter.java │ │ ├── HttpClientUtils.java │ │ ├── ValidatorUtils.java │ │ ├── SpringContextUtils.java │ │ ├── PageUtils.java │ │ ├── Query.java │ │ ├── BaiduUtil.java │ │ └── MPUtil.java │ │ ├── config │ │ ├── MybatisPlusConfig.java │ │ └── InterceptorConfig.java │ │ ├── SpringbootSchemaApplication.java │ │ ├── entity │ │ ├── view │ │ │ ├── NewsView.java │ │ │ ├── YonghuView.java │ │ │ ├── DingpiaoxinxiView.java │ │ │ ├── JingdianxinxiView.java │ │ │ ├── YonghupingjiaView.java │ │ │ └── DiscussjingdianxinxiView.java │ │ ├── EIException.java │ │ ├── ConfigEntity.java │ │ ├── UserEntity.java │ │ ├── vo │ │ │ ├── NewsVO.java │ │ │ ├── DiscussjingdianxinxiVO.java │ │ │ ├── YonghuVO.java │ │ │ ├── YonghupingjiaVO.java │ │ │ ├── DingpiaoxinxiVO.java │ │ │ └── JingdianxinxiVO.java │ │ ├── model │ │ │ ├── NewsModel.java │ │ │ ├── DiscussjingdianxinxiModel.java │ │ │ ├── YonghuModel.java │ │ │ ├── YonghupingjiaModel.java │ │ │ ├── DingpiaoxinxiModel.java │ │ │ └── JingdianxinxiModel.java │ │ ├── TokenEntity.java │ │ ├── NewsEntity.java │ │ ├── DiscussjingdianxinxiEntity.java │ │ ├── YonghuEntity.java │ │ ├── YonghupingjiaEntity.java │ │ ├── DingpiaoxinxiEntity.java │ │ └── JingdianxinxiEntity.java │ │ ├── controller │ │ ├── ConfigController.java │ │ ├── FileController.java │ │ ├── UserController.java │ │ ├── NewsController.java │ │ ├── YonghupingjiaController.java │ │ └── DingpiaoxinxiController.java │ │ └── interceptor │ │ └── AuthorizationInterceptor.java └── test │ └── java │ └── com │ └── SpringbootSchemaApplicationTests.java ├── .gitignore ├── README.md ├── pom.xml ├── pom-war.xml └── mvnw.cmd /image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No285tourism-management-system/HEAD/image/1.png -------------------------------------------------------------------------------- /image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No285tourism-management-system/HEAD/image/2.png -------------------------------------------------------------------------------- /image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No285tourism-management-system/HEAD/image/3.png -------------------------------------------------------------------------------- /image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No285tourism-management-system/HEAD/image/4.png -------------------------------------------------------------------------------- /image/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No285tourism-management-system/HEAD/image/5.png -------------------------------------------------------------------------------- /image/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No285tourism-management-system/HEAD/image/6.png -------------------------------------------------------------------------------- /image/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No285tourism-management-system/HEAD/image/7.png -------------------------------------------------------------------------------- /image/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No285tourism-management-system/HEAD/image/8.png -------------------------------------------------------------------------------- /limage/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No285tourism-management-system/HEAD/limage/1.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/service/ConfigService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.Map; 5 | 6 | import com.baomidou.mybatisplus.service.IService; 7 | import com.entity.ConfigEntity; 8 | import com.utils.PageUtils; 9 | 10 | 11 | /** 12 | * 系统用户 13 | */ 14 | public interface ConfigService extends IService { 15 | PageUtils queryPage(Map params); 16 | } 17 | -------------------------------------------------------------------------------- /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/UserDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TokenDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | -------------------------------------------------------------------------------- /.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/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 | -------------------------------------------------------------------------------- /src/main/java/com/dao/UserDao.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.UserEntity; 12 | 13 | /** 14 | * 用户 15 | */ 16 | public interface UserDao 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/utils/CommonUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.Random; 4 | 5 | public class CommonUtil { 6 | /** 7 | * 获取随机字符串 8 | * 9 | * @param num 10 | * @return 11 | */ 12 | public static String getRandomString(Integer num) { 13 | String base = "abcdefghijklmnopqrstuvwxyz0123456789"; 14 | Random random = new Random(); 15 | StringBuffer sb = new StringBuffer(); 16 | for (int i = 0; i < num; i++) { 17 | int number = random.nextInt(base.length()); 18 | sb.append(base.charAt(number)); 19 | } 20 | return sb.toString(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /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/UserService.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.UserEntity; 12 | import com.utils.PageUtils; 13 | 14 | 15 | /** 16 | * 系统用户 17 | */ 18 | public interface UserService 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/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 | -------------------------------------------------------------------------------- /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/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 2021-04-17 10:00:42 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 2021-04-17 10:00:42 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/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 com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.NewsVO; 11 | import com.entity.view.NewsView; 12 | 13 | 14 | /** 15 | * 景点资讯 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface NewsDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | NewsVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | NewsView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /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/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 com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.YonghuVO; 11 | import com.entity.view.YonghuView; 12 | 13 | 14 | /** 15 | * 用户 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface YonghuDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | YonghuVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | YonghuView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /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.plugins.Page; 11 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 12 | import com.dao.ConfigDao; 13 | import com.entity.ConfigEntity; 14 | import com.entity.UserEntity; 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) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/DingpiaoxinxiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.DingpiaoxinxiEntity; 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 2021-04-17 10:00:42 19 | */ 20 | @TableName("dingpiaoxinxi") 21 | public class DingpiaoxinxiView extends DingpiaoxinxiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public DingpiaoxinxiView(){ 25 | } 26 | 27 | public DingpiaoxinxiView(DingpiaoxinxiEntity dingpiaoxinxiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, dingpiaoxinxiEntity); 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/JingdianxinxiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.JingdianxinxiEntity; 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 2021-04-17 10:00:42 19 | */ 20 | @TableName("jingdianxinxi") 21 | public class JingdianxinxiView extends JingdianxinxiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public JingdianxinxiView(){ 25 | } 26 | 27 | public JingdianxinxiView(JingdianxinxiEntity jingdianxinxiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, jingdianxinxiEntity); 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/YonghupingjiaView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.YonghupingjiaEntity; 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 2021-04-17 10:00:42 19 | */ 20 | @TableName("yonghupingjia") 21 | public class YonghupingjiaView extends YonghupingjiaEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public YonghupingjiaView(){ 25 | } 26 | 27 | public YonghupingjiaView(YonghupingjiaEntity yonghupingjiaEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, yonghupingjiaEntity); 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/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/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/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 2021-04-17 10:00:42 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 | -------------------------------------------------------------------------------- /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 2021-04-17 10:00:42 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 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/DiscussjingdianxinxiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.DiscussjingdianxinxiEntity; 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 2021-04-17 10:00:42 19 | */ 20 | @TableName("discussjingdianxinxi") 21 | public class DiscussjingdianxinxiView extends DiscussjingdianxinxiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public DiscussjingdianxinxiView(){ 25 | } 26 | 27 | public DiscussjingdianxinxiView(DiscussjingdianxinxiEntity discussjingdianxinxiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, discussjingdianxinxiEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/dao/DingpiaoxinxiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.DingpiaoxinxiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.DingpiaoxinxiVO; 11 | import com.entity.view.DingpiaoxinxiView; 12 | 13 | 14 | /** 15 | * 订票信息 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface DingpiaoxinxiDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | DingpiaoxinxiVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | DingpiaoxinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/dao/JingdianxinxiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.JingdianxinxiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.JingdianxinxiVO; 11 | import com.entity.view.JingdianxinxiView; 12 | 13 | 14 | /** 15 | * 景点信息 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface JingdianxinxiDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | JingdianxinxiVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | JingdianxinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/dao/YonghupingjiaDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.YonghupingjiaEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.YonghupingjiaVO; 11 | import com.entity.view.YonghupingjiaView; 12 | 13 | 14 | /** 15 | * 用户评价 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface YonghupingjiaDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | YonghupingjiaVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | YonghupingjiaView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /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/DingpiaoxinxiService.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.DingpiaoxinxiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.DingpiaoxinxiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.DingpiaoxinxiView; 12 | 13 | 14 | /** 15 | * 订票信息 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface DingpiaoxinxiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | DingpiaoxinxiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | DingpiaoxinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/service/JingdianxinxiService.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.JingdianxinxiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.JingdianxinxiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.JingdianxinxiView; 12 | 13 | 14 | /** 15 | * 景点信息 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface JingdianxinxiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | JingdianxinxiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | JingdianxinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/service/YonghupingjiaService.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.YonghupingjiaEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.YonghupingjiaVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.YonghupingjiaView; 12 | 13 | 14 | /** 15 | * 用户评价 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface YonghupingjiaService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | YonghupingjiaVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | YonghupingjiaView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /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/dao/DiscussjingdianxinxiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.DiscussjingdianxinxiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.DiscussjingdianxinxiVO; 11 | import com.entity.view.DiscussjingdianxinxiView; 12 | 13 | 14 | /** 15 | * 景点信息评论表 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface DiscussjingdianxinxiDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | DiscussjingdianxinxiVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | DiscussjingdianxinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/service/DiscussjingdianxinxiService.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.DiscussjingdianxinxiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.DiscussjingdianxinxiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.DiscussjingdianxinxiView; 12 | 13 | 14 | /** 15 | * 景点信息评论表 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-04-17 10:00:42 20 | */ 21 | public interface DiscussjingdianxinxiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | DiscussjingdianxinxiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | DiscussjingdianxinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /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 | 系统包含两种角色:用户、管理员,系统分为前台和后台两大模块,主要功能如下: 12 | 13 | 14 | ### 1管理员模块的实现 15 | - 学生信息管理: 管理学生信息,包括添加、修改、删除和查询学生数据。 16 | - 科目类型管理: 管理科目类型,包括添加、修改、删除和查询操作。 17 | 18 | ### 2老师模块的实现 19 | - 老师回答管理: 查看和查询老师的回答。 20 | - 我的收藏管理: 管理收藏的内容,包括添加、修改、删除和查询操作。 21 | 22 | ### 3学生模块的实现 23 | - 学生问题: 查看和发布学生问题信息。 24 | - 留言反馈: 查看老师的回答信息。 25 | - 交流区: 在交流区发布信息。 26 | 27 | 28 | 29 | 30 | 31 | 二、项目技术 32 | --- 33 | - 编程语言:Java 34 | - 数据库:MySQL 35 | - 项目管理工具:Maven 36 | - 前端技术:VUE、HTML、Jquery、Bootstrap 37 | - 后端技术:Spring、SpringMVC、MyBatis 38 | 39 | 三、运行环境 40 | --- 41 | - 操作系统:Windows、macOS都可以 42 | - JDK版本:JDK1.8以上都可以 43 | - 开发工具:IDEA、Ecplise、Myecplise都可以 44 | - 数据库: MySQL5.7以上都可以 45 | - Tomcat:任意版本都可以 46 | - Maven:任意版本都可以 47 | 48 | 四、运行截图 49 | --- 50 | ### 论文截图: 51 | ![image/1.png](limage/1.png) 52 | 53 | ### 程序截图: 54 | ![image/1.png](image/1.png) 55 | ![image/1.png](image/2.png) 56 | ![image/1.png](image/3.png) 57 | ![image/1.png](image/4.png) 58 | ![image/1.png](image/5.png) 59 | ![image/1.png](image/6.png) 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/entity/UserEntity.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 UserEntity 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/YonghuDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 28 | 29 | 35 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/UserServiceImpl.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.UserDao; 15 | import com.entity.UserEntity; 16 | import com.service.UserService; 17 | import com.utils.PageUtils; 18 | import com.utils.Query; 19 | 20 | 21 | /** 22 | * 系统用户 23 | */ 24 | @Service("userService") 25 | public class UserServiceImpl extends ServiceImpl implements UserService { 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/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 2021-04-17 10:00:42 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/DiscussjingdianxinxiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 20 | 21 | 26 | 27 | 33 | 34 | 38 | 39 | -------------------------------------------------------------------------------- /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 2021-04-17 10:00:42 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/resources/mapper/YonghupingjiaDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 28 | 29 | 35 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | tomcat: 4 | uri-encoding: UTF-8 5 | port: 8080 6 | servlet: 7 | context-path: /springbootul0e4 8 | 9 | spring: 10 | datasource: 11 | driverClassName: com.mysql.jdbc.Driver 12 | url: jdbc:mysql://127.0.0.1:3306/springbootul0e4?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8 13 | username: root 14 | password: 123456 15 | 16 | # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver 17 | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=springbootul0e4 18 | # username: sa 19 | # password: 123456 20 | 21 | servlet: 22 | multipart: 23 | max-file-size: 10MB 24 | max-request-size: 10MB 25 | resources: 26 | static-locations: classpath:static/,file:static/ 27 | 28 | #mybatis 29 | mybatis-plus: 30 | mapper-locations: classpath*:mapper/*.xml 31 | #实体扫描,多个package用逗号或者分号分隔 32 | typeAliasesPackage: com.entity 33 | global-config: 34 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 35 | id-type: 1 36 | #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" 37 | field-strategy: 2 38 | #驼峰下划线转换 39 | db-column-underline: true 40 | #刷新mapper 调试神器 41 | refresh-mapper: true 42 | #逻辑删除配置 43 | logic-delete-value: -1 44 | logic-not-delete-value: 0 45 | #自定义SQL注入器 46 | sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector 47 | configuration: 48 | map-underscore-to-camel-case: true 49 | cache-enabled: false 50 | call-setters-on-nulls: true 51 | #springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other) 52 | jdbc-type-for-null: 'null' 53 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CommonDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 19 | 20 | 21 | UPDATE ${table} set sfsh=#{sfsh} where id=#{id} 22 | 23 | 24 | 44 | 45 | 48 | 49 | 52 | 53 | 56 | 57 | -------------------------------------------------------------------------------- /src/main/resources/mapper/DingpiaoxinxiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 32 | 33 | 39 | 40 | 44 | 45 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/main/resources/mapper/JingdianxinxiDao.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 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/DiscussjingdianxinxiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.DiscussjingdianxinxiEntity; 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 2021-04-17 10:00:42 20 | */ 21 | public class DiscussjingdianxinxiVO 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 nickname; 36 | 37 | /** 38 | * 评论内容 39 | */ 40 | 41 | private String content; 42 | 43 | /** 44 | * 回复内容 45 | */ 46 | 47 | private String reply; 48 | 49 | 50 | /** 51 | * 设置:用户id 52 | */ 53 | 54 | public void setUserid(Long userid) { 55 | this.userid = userid; 56 | } 57 | 58 | /** 59 | * 获取:用户id 60 | */ 61 | public Long getUserid() { 62 | return userid; 63 | } 64 | 65 | 66 | /** 67 | * 设置:用户名 68 | */ 69 | 70 | public void setNickname(String nickname) { 71 | this.nickname = nickname; 72 | } 73 | 74 | /** 75 | * 获取:用户名 76 | */ 77 | public String getNickname() { 78 | return nickname; 79 | } 80 | 81 | 82 | /** 83 | * 设置:评论内容 84 | */ 85 | 86 | public void setContent(String content) { 87 | this.content = content; 88 | } 89 | 90 | /** 91 | * 获取:评论内容 92 | */ 93 | public String getContent() { 94 | return content; 95 | } 96 | 97 | 98 | /** 99 | * 设置:回复内容 100 | */ 101 | 102 | public void setReply(String reply) { 103 | this.reply = reply; 104 | } 105 | 106 | /** 107 | * 获取:回复内容 108 | */ 109 | public String getReply() { 110 | return reply; 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/DiscussjingdianxinxiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.DiscussjingdianxinxiEntity; 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 2021-04-17 10:00:42 21 | */ 22 | public class DiscussjingdianxinxiModel 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 nickname; 37 | 38 | /** 39 | * 评论内容 40 | */ 41 | 42 | private String content; 43 | 44 | /** 45 | * 回复内容 46 | */ 47 | 48 | private String reply; 49 | 50 | 51 | /** 52 | * 设置:用户id 53 | */ 54 | 55 | public void setUserid(Long userid) { 56 | this.userid = userid; 57 | } 58 | 59 | /** 60 | * 获取:用户id 61 | */ 62 | public Long getUserid() { 63 | return userid; 64 | } 65 | 66 | 67 | /** 68 | * 设置:用户名 69 | */ 70 | 71 | public void setNickname(String nickname) { 72 | this.nickname = nickname; 73 | } 74 | 75 | /** 76 | * 获取:用户名 77 | */ 78 | public String getNickname() { 79 | return nickname; 80 | } 81 | 82 | 83 | /** 84 | * 设置:评论内容 85 | */ 86 | 87 | public void setContent(String content) { 88 | this.content = content; 89 | } 90 | 91 | /** 92 | * 获取:评论内容 93 | */ 94 | public String getContent() { 95 | return content; 96 | } 97 | 98 | 99 | /** 100 | * 设置:回复内容 101 | */ 102 | 103 | public void setReply(String reply) { 104 | this.reply = reply; 105 | } 106 | 107 | /** 108 | * 获取:回复内容 109 | */ 110 | public String getReply() { 111 | return reply; 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/DingpiaoxinxiServiceImpl.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.DingpiaoxinxiDao; 16 | import com.entity.DingpiaoxinxiEntity; 17 | import com.service.DingpiaoxinxiService; 18 | import com.entity.vo.DingpiaoxinxiVO; 19 | import com.entity.view.DingpiaoxinxiView; 20 | 21 | @Service("dingpiaoxinxiService") 22 | public class DingpiaoxinxiServiceImpl extends ServiceImpl implements DingpiaoxinxiService { 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 DingpiaoxinxiVO 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 DingpiaoxinxiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/JingdianxinxiServiceImpl.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.JingdianxinxiDao; 16 | import com.entity.JingdianxinxiEntity; 17 | import com.service.JingdianxinxiService; 18 | import com.entity.vo.JingdianxinxiVO; 19 | import com.entity.view.JingdianxinxiView; 20 | 21 | @Service("jingdianxinxiService") 22 | public class JingdianxinxiServiceImpl extends ServiceImpl implements JingdianxinxiService { 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 JingdianxinxiVO 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 JingdianxinxiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/YonghupingjiaServiceImpl.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.YonghupingjiaDao; 16 | import com.entity.YonghupingjiaEntity; 17 | import com.service.YonghupingjiaService; 18 | import com.entity.vo.YonghupingjiaVO; 19 | import com.entity.view.YonghupingjiaView; 20 | 21 | @Service("yonghupingjiaService") 22 | public class YonghupingjiaServiceImpl extends ServiceImpl implements YonghupingjiaService { 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 YonghupingjiaVO 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 YonghupingjiaView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /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/service/impl/DiscussjingdianxinxiServiceImpl.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.DiscussjingdianxinxiDao; 16 | import com.entity.DiscussjingdianxinxiEntity; 17 | import com.service.DiscussjingdianxinxiService; 18 | import com.entity.vo.DiscussjingdianxinxiVO; 19 | import com.entity.view.DiscussjingdianxinxiView; 20 | 21 | @Service("discussjingdianxinxiService") 22 | public class DiscussjingdianxinxiServiceImpl extends ServiceImpl implements DiscussjingdianxinxiService { 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 DiscussjingdianxinxiVO 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 DiscussjingdianxinxiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /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 2021-04-17 10:00:42 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 xingming; 36 | 37 | /** 38 | * 性别 39 | */ 40 | 41 | private String xingbie; 42 | 43 | /** 44 | * 手机 45 | */ 46 | 47 | private String shouji; 48 | 49 | /** 50 | * 邮箱 51 | */ 52 | 53 | private String youxiang; 54 | 55 | /** 56 | * 头像 57 | */ 58 | 59 | private String touxiang; 60 | 61 | 62 | /** 63 | * 设置:密码 64 | */ 65 | 66 | public void setMima(String mima) { 67 | this.mima = mima; 68 | } 69 | 70 | /** 71 | * 获取:密码 72 | */ 73 | public String getMima() { 74 | return mima; 75 | } 76 | 77 | 78 | /** 79 | * 设置:姓名 80 | */ 81 | 82 | public void setXingming(String xingming) { 83 | this.xingming = xingming; 84 | } 85 | 86 | /** 87 | * 获取:姓名 88 | */ 89 | public String getXingming() { 90 | return xingming; 91 | } 92 | 93 | 94 | /** 95 | * 设置:性别 96 | */ 97 | 98 | public void setXingbie(String xingbie) { 99 | this.xingbie = xingbie; 100 | } 101 | 102 | /** 103 | * 获取:性别 104 | */ 105 | public String getXingbie() { 106 | return xingbie; 107 | } 108 | 109 | 110 | /** 111 | * 设置:手机 112 | */ 113 | 114 | public void setShouji(String shouji) { 115 | this.shouji = shouji; 116 | } 117 | 118 | /** 119 | * 获取:手机 120 | */ 121 | public String getShouji() { 122 | return shouji; 123 | } 124 | 125 | 126 | /** 127 | * 设置:邮箱 128 | */ 129 | 130 | public void setYouxiang(String youxiang) { 131 | this.youxiang = youxiang; 132 | } 133 | 134 | /** 135 | * 获取:邮箱 136 | */ 137 | public String getYouxiang() { 138 | return youxiang; 139 | } 140 | 141 | 142 | /** 143 | * 设置:头像 144 | */ 145 | 146 | public void setTouxiang(String touxiang) { 147 | this.touxiang = touxiang; 148 | } 149 | 150 | /** 151 | * 获取:头像 152 | */ 153 | public String getTouxiang() { 154 | return touxiang; 155 | } 156 | 157 | } 158 | -------------------------------------------------------------------------------- /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/java/com/entity/vo/YonghupingjiaVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.YonghupingjiaEntity; 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 2021-04-17 10:00:42 20 | */ 21 | public class YonghupingjiaVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 景点名称 27 | */ 28 | 29 | private String jingdianmingcheng; 30 | 31 | /** 32 | * 观光日期 33 | */ 34 | 35 | private String guanguangriqi; 36 | 37 | /** 38 | * 用户名 39 | */ 40 | 41 | private String yonghuming; 42 | 43 | /** 44 | * 评价内容 45 | */ 46 | 47 | private String pingjianeirong; 48 | 49 | /** 50 | * 是否审核 51 | */ 52 | 53 | private String sfsh; 54 | 55 | /** 56 | * 审核回复 57 | */ 58 | 59 | private String shhf; 60 | 61 | 62 | /** 63 | * 设置:景点名称 64 | */ 65 | 66 | public void setJingdianmingcheng(String jingdianmingcheng) { 67 | this.jingdianmingcheng = jingdianmingcheng; 68 | } 69 | 70 | /** 71 | * 获取:景点名称 72 | */ 73 | public String getJingdianmingcheng() { 74 | return jingdianmingcheng; 75 | } 76 | 77 | 78 | /** 79 | * 设置:观光日期 80 | */ 81 | 82 | public void setGuanguangriqi(String guanguangriqi) { 83 | this.guanguangriqi = guanguangriqi; 84 | } 85 | 86 | /** 87 | * 获取:观光日期 88 | */ 89 | public String getGuanguangriqi() { 90 | return guanguangriqi; 91 | } 92 | 93 | 94 | /** 95 | * 设置:用户名 96 | */ 97 | 98 | public void setYonghuming(String yonghuming) { 99 | this.yonghuming = yonghuming; 100 | } 101 | 102 | /** 103 | * 获取:用户名 104 | */ 105 | public String getYonghuming() { 106 | return yonghuming; 107 | } 108 | 109 | 110 | /** 111 | * 设置:评价内容 112 | */ 113 | 114 | public void setPingjianeirong(String pingjianeirong) { 115 | this.pingjianeirong = pingjianeirong; 116 | } 117 | 118 | /** 119 | * 获取:评价内容 120 | */ 121 | public String getPingjianeirong() { 122 | return pingjianeirong; 123 | } 124 | 125 | 126 | /** 127 | * 设置:是否审核 128 | */ 129 | 130 | public void setSfsh(String sfsh) { 131 | this.sfsh = sfsh; 132 | } 133 | 134 | /** 135 | * 获取:是否审核 136 | */ 137 | public String getSfsh() { 138 | return sfsh; 139 | } 140 | 141 | 142 | /** 143 | * 设置:审核回复 144 | */ 145 | 146 | public void setShhf(String shhf) { 147 | this.shhf = shhf; 148 | } 149 | 150 | /** 151 | * 获取:审核回复 152 | */ 153 | public String getShhf() { 154 | return shhf; 155 | } 156 | 157 | } 158 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/YonghupingjiaModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.YonghupingjiaEntity; 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 2021-04-17 10:00:42 21 | */ 22 | public class YonghupingjiaModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 景点名称 28 | */ 29 | 30 | private String jingdianmingcheng; 31 | 32 | /** 33 | * 观光日期 34 | */ 35 | 36 | private String guanguangriqi; 37 | 38 | /** 39 | * 用户名 40 | */ 41 | 42 | private String yonghuming; 43 | 44 | /** 45 | * 评价内容 46 | */ 47 | 48 | private String pingjianeirong; 49 | 50 | /** 51 | * 是否审核 52 | */ 53 | 54 | private String sfsh; 55 | 56 | /** 57 | * 审核回复 58 | */ 59 | 60 | private String shhf; 61 | 62 | 63 | /** 64 | * 设置:景点名称 65 | */ 66 | 67 | public void setJingdianmingcheng(String jingdianmingcheng) { 68 | this.jingdianmingcheng = jingdianmingcheng; 69 | } 70 | 71 | /** 72 | * 获取:景点名称 73 | */ 74 | public String getJingdianmingcheng() { 75 | return jingdianmingcheng; 76 | } 77 | 78 | 79 | /** 80 | * 设置:观光日期 81 | */ 82 | 83 | public void setGuanguangriqi(String guanguangriqi) { 84 | this.guanguangriqi = guanguangriqi; 85 | } 86 | 87 | /** 88 | * 获取:观光日期 89 | */ 90 | public String getGuanguangriqi() { 91 | return guanguangriqi; 92 | } 93 | 94 | 95 | /** 96 | * 设置:用户名 97 | */ 98 | 99 | public void setYonghuming(String yonghuming) { 100 | this.yonghuming = yonghuming; 101 | } 102 | 103 | /** 104 | * 获取:用户名 105 | */ 106 | public String getYonghuming() { 107 | return yonghuming; 108 | } 109 | 110 | 111 | /** 112 | * 设置:评价内容 113 | */ 114 | 115 | public void setPingjianeirong(String pingjianeirong) { 116 | this.pingjianeirong = pingjianeirong; 117 | } 118 | 119 | /** 120 | * 获取:评价内容 121 | */ 122 | public String getPingjianeirong() { 123 | return pingjianeirong; 124 | } 125 | 126 | 127 | /** 128 | * 设置:是否审核 129 | */ 130 | 131 | public void setSfsh(String sfsh) { 132 | this.sfsh = sfsh; 133 | } 134 | 135 | /** 136 | * 获取:是否审核 137 | */ 138 | public String getSfsh() { 139 | return sfsh; 140 | } 141 | 142 | 143 | /** 144 | * 设置:审核回复 145 | */ 146 | 147 | public void setShhf(String shhf) { 148 | this.shhf = shhf; 149 | } 150 | 151 | /** 152 | * 获取:审核回复 153 | */ 154 | public String getShhf() { 155 | return shhf; 156 | } 157 | 158 | } 159 | -------------------------------------------------------------------------------- /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 2021-04-17 10:00:42 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/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.PageUtils; 21 | import com.utils.R; 22 | import com.utils.ValidatorUtils; 23 | 24 | /** 25 | * 登录相关 26 | */ 27 | @RequestMapping("config") 28 | @RestController 29 | public class ConfigController{ 30 | 31 | @Autowired 32 | private ConfigService configService; 33 | 34 | /** 35 | * 列表 36 | */ 37 | @RequestMapping("/page") 38 | public R page(@RequestParam Map params,ConfigEntity config){ 39 | EntityWrapper ew = new EntityWrapper(); 40 | PageUtils page = configService.queryPage(params); 41 | return R.ok().put("data", page); 42 | } 43 | 44 | /** 45 | * 列表 46 | */ 47 | @IgnoreAuth 48 | @RequestMapping("/list") 49 | public R list(@RequestParam Map params,ConfigEntity config){ 50 | EntityWrapper ew = new EntityWrapper(); 51 | PageUtils page = configService.queryPage(params); 52 | return R.ok().put("data", page); 53 | } 54 | 55 | /** 56 | * 信息 57 | */ 58 | @RequestMapping("/info/{id}") 59 | public R info(@PathVariable("id") String id){ 60 | ConfigEntity config = configService.selectById(id); 61 | return R.ok().put("data", config); 62 | } 63 | 64 | /** 65 | * 详情 66 | */ 67 | @IgnoreAuth 68 | @RequestMapping("/detail/{id}") 69 | public R detail(@PathVariable("id") String id){ 70 | ConfigEntity config = configService.selectById(id); 71 | return R.ok().put("data", config); 72 | } 73 | 74 | /** 75 | * 根据name获取信息 76 | */ 77 | @RequestMapping("/info") 78 | public R infoByName(@RequestParam String name){ 79 | ConfigEntity config = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 80 | return R.ok().put("data", config); 81 | } 82 | 83 | /** 84 | * 保存 85 | */ 86 | @PostMapping("/save") 87 | public R save(@RequestBody ConfigEntity config){ 88 | // ValidatorUtils.validateEntity(config); 89 | configService.insert(config); 90 | return R.ok(); 91 | } 92 | 93 | /** 94 | * 修改 95 | */ 96 | @RequestMapping("/update") 97 | public R update(@RequestBody ConfigEntity config){ 98 | // ValidatorUtils.validateEntity(config); 99 | configService.updateById(config);//全部更新 100 | return R.ok(); 101 | } 102 | 103 | /** 104 | * 删除 105 | */ 106 | @RequestMapping("/delete") 107 | public R delete(@RequestBody Long[] ids){ 108 | configService.deleteBatchIds(Arrays.asList(ids)); 109 | return R.ok(); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/entity/DiscussjingdianxinxiEntity.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 2021-04-17 10:00:42 30 | */ 31 | @TableName("discussjingdianxinxi") 32 | public class DiscussjingdianxinxiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public DiscussjingdianxinxiEntity() { 37 | 38 | } 39 | 40 | public DiscussjingdianxinxiEntity(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 nickname; 71 | 72 | /** 73 | * 评论内容 74 | */ 75 | 76 | private String content; 77 | 78 | /** 79 | * 回复内容 80 | */ 81 | 82 | private String reply; 83 | 84 | 85 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 86 | @DateTimeFormat 87 | private Date addtime; 88 | 89 | public Date getAddtime() { 90 | return addtime; 91 | } 92 | public void setAddtime(Date addtime) { 93 | this.addtime = addtime; 94 | } 95 | 96 | public Long getId() { 97 | return id; 98 | } 99 | 100 | public void setId(Long id) { 101 | this.id = id; 102 | } 103 | /** 104 | * 设置:关联表id 105 | */ 106 | public void setRefid(Long refid) { 107 | this.refid = refid; 108 | } 109 | /** 110 | * 获取:关联表id 111 | */ 112 | public Long getRefid() { 113 | return refid; 114 | } 115 | /** 116 | * 设置:用户id 117 | */ 118 | public void setUserid(Long userid) { 119 | this.userid = userid; 120 | } 121 | /** 122 | * 获取:用户id 123 | */ 124 | public Long getUserid() { 125 | return userid; 126 | } 127 | /** 128 | * 设置:用户名 129 | */ 130 | public void setNickname(String nickname) { 131 | this.nickname = nickname; 132 | } 133 | /** 134 | * 获取:用户名 135 | */ 136 | public String getNickname() { 137 | return nickname; 138 | } 139 | /** 140 | * 设置:评论内容 141 | */ 142 | public void setContent(String content) { 143 | this.content = content; 144 | } 145 | /** 146 | * 获取:评论内容 147 | */ 148 | public String getContent() { 149 | return content; 150 | } 151 | /** 152 | * 设置:回复内容 153 | */ 154 | public void setReply(String reply) { 155 | this.reply = reply; 156 | } 157 | /** 158 | * 获取:回复内容 159 | */ 160 | public String getReply() { 161 | return reply; 162 | } 163 | 164 | } 165 | -------------------------------------------------------------------------------- /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/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/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 | public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception { 50 | if (file.isEmpty()) { 51 | throw new EIException("上传文件不能为空"); 52 | } 53 | String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); 54 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 55 | if(!path.exists()) { 56 | path = new File(""); 57 | } 58 | File upload = new File(path.getAbsolutePath(),"/upload/"); 59 | if(!upload.exists()) { 60 | upload.mkdirs(); 61 | } 62 | String fileName = new Date().getTime()+"."+fileExt; 63 | File dest = new File(upload.getAbsolutePath()+"/"+fileName); 64 | file.transferTo(dest); 65 | if(StringUtils.isNotBlank(type) && type.equals("1")) { 66 | ConfigEntity configEntity = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 67 | if(configEntity==null) { 68 | configEntity = new ConfigEntity(); 69 | configEntity.setName("faceFile"); 70 | configEntity.setValue(fileName); 71 | } else { 72 | configEntity.setValue(fileName); 73 | } 74 | configService.insertOrUpdate(configEntity); 75 | } 76 | return R.ok().put("file", fileName); 77 | } 78 | 79 | /** 80 | * 下载文件 81 | */ 82 | @IgnoreAuth 83 | @RequestMapping("/download") 84 | public ResponseEntity download(@RequestParam String fileName) { 85 | try { 86 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 87 | if(!path.exists()) { 88 | path = new File(""); 89 | } 90 | File upload = new File(path.getAbsolutePath(),"/upload/"); 91 | if(!upload.exists()) { 92 | upload.mkdirs(); 93 | } 94 | File file = new File(upload.getAbsolutePath()+"/"+fileName); 95 | if(file.exists()){ 96 | /*if(!fileService.canRead(file, SessionManager.getSessionUser())){ 97 | getResponse().sendError(403); 98 | }*/ 99 | HttpHeaders headers = new HttpHeaders(); 100 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 101 | headers.setContentDispositionFormData("attachment", fileName); 102 | return new ResponseEntity(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); 103 | } 104 | } catch (IOException e) { 105 | e.printStackTrace(); 106 | } 107 | return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /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 2021-04-17 10:00:42 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 yonghuming; 59 | 60 | /** 61 | * 密码 62 | */ 63 | 64 | private String mima; 65 | 66 | /** 67 | * 姓名 68 | */ 69 | 70 | private String xingming; 71 | 72 | /** 73 | * 性别 74 | */ 75 | 76 | private String xingbie; 77 | 78 | /** 79 | * 手机 80 | */ 81 | 82 | private String shouji; 83 | 84 | /** 85 | * 邮箱 86 | */ 87 | 88 | private String youxiang; 89 | 90 | /** 91 | * 头像 92 | */ 93 | 94 | private String touxiang; 95 | 96 | 97 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 98 | @DateTimeFormat 99 | private Date addtime; 100 | 101 | public Date getAddtime() { 102 | return addtime; 103 | } 104 | public void setAddtime(Date addtime) { 105 | this.addtime = addtime; 106 | } 107 | 108 | public Long getId() { 109 | return id; 110 | } 111 | 112 | public void setId(Long id) { 113 | this.id = id; 114 | } 115 | /** 116 | * 设置:用户名 117 | */ 118 | public void setYonghuming(String yonghuming) { 119 | this.yonghuming = yonghuming; 120 | } 121 | /** 122 | * 获取:用户名 123 | */ 124 | public String getYonghuming() { 125 | return yonghuming; 126 | } 127 | /** 128 | * 设置:密码 129 | */ 130 | public void setMima(String mima) { 131 | this.mima = mima; 132 | } 133 | /** 134 | * 获取:密码 135 | */ 136 | public String getMima() { 137 | return mima; 138 | } 139 | /** 140 | * 设置:姓名 141 | */ 142 | public void setXingming(String xingming) { 143 | this.xingming = xingming; 144 | } 145 | /** 146 | * 获取:姓名 147 | */ 148 | public String getXingming() { 149 | return xingming; 150 | } 151 | /** 152 | * 设置:性别 153 | */ 154 | public void setXingbie(String xingbie) { 155 | this.xingbie = xingbie; 156 | } 157 | /** 158 | * 获取:性别 159 | */ 160 | public String getXingbie() { 161 | return xingbie; 162 | } 163 | /** 164 | * 设置:手机 165 | */ 166 | public void setShouji(String shouji) { 167 | this.shouji = shouji; 168 | } 169 | /** 170 | * 获取:手机 171 | */ 172 | public String getShouji() { 173 | return shouji; 174 | } 175 | /** 176 | * 设置:邮箱 177 | */ 178 | public void setYouxiang(String youxiang) { 179 | this.youxiang = youxiang; 180 | } 181 | /** 182 | * 获取:邮箱 183 | */ 184 | public String getYouxiang() { 185 | return youxiang; 186 | } 187 | /** 188 | * 设置:头像 189 | */ 190 | public void setTouxiang(String touxiang) { 191 | this.touxiang = touxiang; 192 | } 193 | /** 194 | * 获取:头像 195 | */ 196 | public String getTouxiang() { 197 | return touxiang; 198 | } 199 | 200 | } 201 | -------------------------------------------------------------------------------- /src/main/java/com/entity/YonghupingjiaEntity.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 2021-04-17 10:00:42 30 | */ 31 | @TableName("yonghupingjia") 32 | public class YonghupingjiaEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public YonghupingjiaEntity() { 37 | 38 | } 39 | 40 | public YonghupingjiaEntity(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 dingdanbianhao; 59 | 60 | /** 61 | * 景点名称 62 | */ 63 | 64 | private String jingdianmingcheng; 65 | 66 | /** 67 | * 观光日期 68 | */ 69 | 70 | private String guanguangriqi; 71 | 72 | /** 73 | * 用户名 74 | */ 75 | 76 | private String yonghuming; 77 | 78 | /** 79 | * 评价内容 80 | */ 81 | 82 | private String pingjianeirong; 83 | 84 | /** 85 | * 是否审核 86 | */ 87 | 88 | private String sfsh; 89 | 90 | /** 91 | * 审核回复 92 | */ 93 | 94 | private String shhf; 95 | 96 | 97 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 98 | @DateTimeFormat 99 | private Date addtime; 100 | 101 | public Date getAddtime() { 102 | return addtime; 103 | } 104 | public void setAddtime(Date addtime) { 105 | this.addtime = addtime; 106 | } 107 | 108 | public Long getId() { 109 | return id; 110 | } 111 | 112 | public void setId(Long id) { 113 | this.id = id; 114 | } 115 | /** 116 | * 设置:订单编号 117 | */ 118 | public void setDingdanbianhao(String dingdanbianhao) { 119 | this.dingdanbianhao = dingdanbianhao; 120 | } 121 | /** 122 | * 获取:订单编号 123 | */ 124 | public String getDingdanbianhao() { 125 | return dingdanbianhao; 126 | } 127 | /** 128 | * 设置:景点名称 129 | */ 130 | public void setJingdianmingcheng(String jingdianmingcheng) { 131 | this.jingdianmingcheng = jingdianmingcheng; 132 | } 133 | /** 134 | * 获取:景点名称 135 | */ 136 | public String getJingdianmingcheng() { 137 | return jingdianmingcheng; 138 | } 139 | /** 140 | * 设置:观光日期 141 | */ 142 | public void setGuanguangriqi(String guanguangriqi) { 143 | this.guanguangriqi = guanguangriqi; 144 | } 145 | /** 146 | * 获取:观光日期 147 | */ 148 | public String getGuanguangriqi() { 149 | return guanguangriqi; 150 | } 151 | /** 152 | * 设置:用户名 153 | */ 154 | public void setYonghuming(String yonghuming) { 155 | this.yonghuming = yonghuming; 156 | } 157 | /** 158 | * 获取:用户名 159 | */ 160 | public String getYonghuming() { 161 | return yonghuming; 162 | } 163 | /** 164 | * 设置:评价内容 165 | */ 166 | public void setPingjianeirong(String pingjianeirong) { 167 | this.pingjianeirong = pingjianeirong; 168 | } 169 | /** 170 | * 获取:评价内容 171 | */ 172 | public String getPingjianeirong() { 173 | return pingjianeirong; 174 | } 175 | /** 176 | * 设置:是否审核 177 | */ 178 | public void setSfsh(String sfsh) { 179 | this.sfsh = sfsh; 180 | } 181 | /** 182 | * 获取:是否审核 183 | */ 184 | public String getSfsh() { 185 | return sfsh; 186 | } 187 | /** 188 | * 设置:审核回复 189 | */ 190 | public void setShhf(String shhf) { 191 | this.shhf = shhf; 192 | } 193 | /** 194 | * 获取:审核回复 195 | */ 196 | public String getShhf() { 197 | return shhf; 198 | } 199 | 200 | } 201 | -------------------------------------------------------------------------------- /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 | springbootul0e4 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.springframework.boot 118 | spring-boot-starter-test 119 | test 120 | 121 | 122 | org.junit.vintage 123 | junit-vintage-engine 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | org.springframework.boot 133 | spring-boot-maven-plugin 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/DingpiaoxinxiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.DingpiaoxinxiEntity; 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 2021-04-17 10:00:42 20 | */ 21 | public class DingpiaoxinxiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 景点名称 27 | */ 28 | 29 | private String jingdianmingcheng; 30 | 31 | /** 32 | * 观光日期 33 | */ 34 | 35 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 36 | @DateTimeFormat 37 | private Date guanguangriqi; 38 | 39 | /** 40 | * 个人票价 41 | */ 42 | 43 | private String gerenpiaojia; 44 | 45 | /** 46 | * 购买票数 47 | */ 48 | 49 | private String goumaipiaoshu; 50 | 51 | /** 52 | * 总费用 53 | */ 54 | 55 | private String zongfeiyong; 56 | 57 | /** 58 | * 用户名 59 | */ 60 | 61 | private String yonghuming; 62 | 63 | /** 64 | * 生成订单时间 65 | */ 66 | 67 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 68 | @DateTimeFormat 69 | private Date shengchengdingdanshijian; 70 | 71 | /** 72 | * 是否审核 73 | */ 74 | 75 | private String sfsh; 76 | 77 | /** 78 | * 审核回复 79 | */ 80 | 81 | private String shhf; 82 | 83 | /** 84 | * 是否支付 85 | */ 86 | 87 | private String ispay; 88 | 89 | 90 | /** 91 | * 设置:景点名称 92 | */ 93 | 94 | public void setJingdianmingcheng(String jingdianmingcheng) { 95 | this.jingdianmingcheng = jingdianmingcheng; 96 | } 97 | 98 | /** 99 | * 获取:景点名称 100 | */ 101 | public String getJingdianmingcheng() { 102 | return jingdianmingcheng; 103 | } 104 | 105 | 106 | /** 107 | * 设置:观光日期 108 | */ 109 | 110 | public void setGuanguangriqi(Date guanguangriqi) { 111 | this.guanguangriqi = guanguangriqi; 112 | } 113 | 114 | /** 115 | * 获取:观光日期 116 | */ 117 | public Date getGuanguangriqi() { 118 | return guanguangriqi; 119 | } 120 | 121 | 122 | /** 123 | * 设置:个人票价 124 | */ 125 | 126 | public void setGerenpiaojia(String gerenpiaojia) { 127 | this.gerenpiaojia = gerenpiaojia; 128 | } 129 | 130 | /** 131 | * 获取:个人票价 132 | */ 133 | public String getGerenpiaojia() { 134 | return gerenpiaojia; 135 | } 136 | 137 | 138 | /** 139 | * 设置:购买票数 140 | */ 141 | 142 | public void setGoumaipiaoshu(String goumaipiaoshu) { 143 | this.goumaipiaoshu = goumaipiaoshu; 144 | } 145 | 146 | /** 147 | * 获取:购买票数 148 | */ 149 | public String getGoumaipiaoshu() { 150 | return goumaipiaoshu; 151 | } 152 | 153 | 154 | /** 155 | * 设置:总费用 156 | */ 157 | 158 | public void setZongfeiyong(String zongfeiyong) { 159 | this.zongfeiyong = zongfeiyong; 160 | } 161 | 162 | /** 163 | * 获取:总费用 164 | */ 165 | public String getZongfeiyong() { 166 | return zongfeiyong; 167 | } 168 | 169 | 170 | /** 171 | * 设置:用户名 172 | */ 173 | 174 | public void setYonghuming(String yonghuming) { 175 | this.yonghuming = yonghuming; 176 | } 177 | 178 | /** 179 | * 获取:用户名 180 | */ 181 | public String getYonghuming() { 182 | return yonghuming; 183 | } 184 | 185 | 186 | /** 187 | * 设置:生成订单时间 188 | */ 189 | 190 | public void setShengchengdingdanshijian(Date shengchengdingdanshijian) { 191 | this.shengchengdingdanshijian = shengchengdingdanshijian; 192 | } 193 | 194 | /** 195 | * 获取:生成订单时间 196 | */ 197 | public Date getShengchengdingdanshijian() { 198 | return shengchengdingdanshijian; 199 | } 200 | 201 | 202 | /** 203 | * 设置:是否审核 204 | */ 205 | 206 | public void setSfsh(String sfsh) { 207 | this.sfsh = sfsh; 208 | } 209 | 210 | /** 211 | * 获取:是否审核 212 | */ 213 | public String getSfsh() { 214 | return sfsh; 215 | } 216 | 217 | 218 | /** 219 | * 设置:审核回复 220 | */ 221 | 222 | public void setShhf(String shhf) { 223 | this.shhf = shhf; 224 | } 225 | 226 | /** 227 | * 获取:审核回复 228 | */ 229 | public String getShhf() { 230 | return shhf; 231 | } 232 | 233 | 234 | /** 235 | * 设置:是否支付 236 | */ 237 | 238 | public void setIspay(String ispay) { 239 | this.ispay = ispay; 240 | } 241 | 242 | /** 243 | * 获取:是否支付 244 | */ 245 | public String getIspay() { 246 | return ispay; 247 | } 248 | 249 | } 250 | -------------------------------------------------------------------------------- /pom-war.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 | springbootul0e4 14 | 0.0.1-SNAPSHOT 15 | springboot-schema 16 | springboot学习框架(war包对应的pom,打war包,执行【mvn clean package -f pom-war.xml】) 17 | war 18 | 19 | 20 | 1.8 21 | 1.2.8 22 | 3.1.1 23 | 24 | 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-web 29 | 30 | 31 | org.mybatis.spring.boot 32 | mybatis-spring-boot-starter 33 | 2.1.1 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-starter-jdbc 38 | 39 | 40 | 41 | org.springframework.boot 42 | spring-boot-starter-tomcat 43 | provided 44 | 45 | 46 | 47 | mysql 48 | mysql-connector-java 49 | 50 | 51 | org.apache.shiro 52 | shiro-spring 53 | 1.3.2 54 | 55 | 56 | 57 | com.baomidou 58 | mybatis-plus 59 | 2.3 60 | 61 | 62 | com.baomidou 63 | mybatisplus-spring-boot-starter 64 | 1.0.5 65 | 66 | 67 | com.google.protobuf 68 | protobuf-java 69 | 3.10.0 70 | 71 | 72 | 73 | org.apache.commons 74 | commons-lang3 75 | 3.0 76 | 77 | 78 | 79 | javax.validation 80 | validation-api 81 | 2.0.1.Final 82 | 83 | 84 | 85 | commons-io 86 | commons-io 87 | 2.5 88 | 89 | 90 | 91 | 92 | cn.hutool 93 | hutool-all 94 | 4.0.12 95 | 96 | 97 | 98 | 99 | com.alibaba 100 | fastjson 101 | ${fastjson.version} 102 | 103 | 104 | 105 | com.baidu.aip 106 | java-sdk 107 | 4.4.1 108 | 109 | 110 | 111 | org.springframework.boot 112 | spring-boot-starter-test 113 | test 114 | 115 | 116 | org.junit.vintage 117 | junit-vintage-engine 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | springbootul0e4 126 | 127 | 128 | org.springframework.boot 129 | spring-boot-maven-plugin 130 | 131 | 132 | 133 | org.apache.maven.plugins 134 | maven-surefire-plugin 135 | 136 | true 137 | 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/DingpiaoxinxiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.DingpiaoxinxiEntity; 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 2021-04-17 10:00:42 21 | */ 22 | public class DingpiaoxinxiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 景点名称 28 | */ 29 | 30 | private String jingdianmingcheng; 31 | 32 | /** 33 | * 观光日期 34 | */ 35 | 36 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 37 | @DateTimeFormat 38 | private Date guanguangriqi; 39 | 40 | /** 41 | * 个人票价 42 | */ 43 | 44 | private String gerenpiaojia; 45 | 46 | /** 47 | * 购买票数 48 | */ 49 | 50 | private String goumaipiaoshu; 51 | 52 | /** 53 | * 总费用 54 | */ 55 | 56 | private String zongfeiyong; 57 | 58 | /** 59 | * 用户名 60 | */ 61 | 62 | private String yonghuming; 63 | 64 | /** 65 | * 生成订单时间 66 | */ 67 | 68 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 69 | @DateTimeFormat 70 | private Date shengchengdingdanshijian; 71 | 72 | /** 73 | * 是否审核 74 | */ 75 | 76 | private String sfsh; 77 | 78 | /** 79 | * 审核回复 80 | */ 81 | 82 | private String shhf; 83 | 84 | /** 85 | * 是否支付 86 | */ 87 | 88 | private String ispay; 89 | 90 | 91 | /** 92 | * 设置:景点名称 93 | */ 94 | 95 | public void setJingdianmingcheng(String jingdianmingcheng) { 96 | this.jingdianmingcheng = jingdianmingcheng; 97 | } 98 | 99 | /** 100 | * 获取:景点名称 101 | */ 102 | public String getJingdianmingcheng() { 103 | return jingdianmingcheng; 104 | } 105 | 106 | 107 | /** 108 | * 设置:观光日期 109 | */ 110 | 111 | public void setGuanguangriqi(Date guanguangriqi) { 112 | this.guanguangriqi = guanguangriqi; 113 | } 114 | 115 | /** 116 | * 获取:观光日期 117 | */ 118 | public Date getGuanguangriqi() { 119 | return guanguangriqi; 120 | } 121 | 122 | 123 | /** 124 | * 设置:个人票价 125 | */ 126 | 127 | public void setGerenpiaojia(String gerenpiaojia) { 128 | this.gerenpiaojia = gerenpiaojia; 129 | } 130 | 131 | /** 132 | * 获取:个人票价 133 | */ 134 | public String getGerenpiaojia() { 135 | return gerenpiaojia; 136 | } 137 | 138 | 139 | /** 140 | * 设置:购买票数 141 | */ 142 | 143 | public void setGoumaipiaoshu(String goumaipiaoshu) { 144 | this.goumaipiaoshu = goumaipiaoshu; 145 | } 146 | 147 | /** 148 | * 获取:购买票数 149 | */ 150 | public String getGoumaipiaoshu() { 151 | return goumaipiaoshu; 152 | } 153 | 154 | 155 | /** 156 | * 设置:总费用 157 | */ 158 | 159 | public void setZongfeiyong(String zongfeiyong) { 160 | this.zongfeiyong = zongfeiyong; 161 | } 162 | 163 | /** 164 | * 获取:总费用 165 | */ 166 | public String getZongfeiyong() { 167 | return zongfeiyong; 168 | } 169 | 170 | 171 | /** 172 | * 设置:用户名 173 | */ 174 | 175 | public void setYonghuming(String yonghuming) { 176 | this.yonghuming = yonghuming; 177 | } 178 | 179 | /** 180 | * 获取:用户名 181 | */ 182 | public String getYonghuming() { 183 | return yonghuming; 184 | } 185 | 186 | 187 | /** 188 | * 设置:生成订单时间 189 | */ 190 | 191 | public void setShengchengdingdanshijian(Date shengchengdingdanshijian) { 192 | this.shengchengdingdanshijian = shengchengdingdanshijian; 193 | } 194 | 195 | /** 196 | * 获取:生成订单时间 197 | */ 198 | public Date getShengchengdingdanshijian() { 199 | return shengchengdingdanshijian; 200 | } 201 | 202 | 203 | /** 204 | * 设置:是否审核 205 | */ 206 | 207 | public void setSfsh(String sfsh) { 208 | this.sfsh = sfsh; 209 | } 210 | 211 | /** 212 | * 获取:是否审核 213 | */ 214 | public String getSfsh() { 215 | return sfsh; 216 | } 217 | 218 | 219 | /** 220 | * 设置:审核回复 221 | */ 222 | 223 | public void setShhf(String shhf) { 224 | this.shhf = shhf; 225 | } 226 | 227 | /** 228 | * 获取:审核回复 229 | */ 230 | public String getShhf() { 231 | return shhf; 232 | } 233 | 234 | 235 | /** 236 | * 设置:是否支付 237 | */ 238 | 239 | public void setIspay(String ispay) { 240 | this.ispay = ispay; 241 | } 242 | 243 | /** 244 | * 获取:是否支付 245 | */ 246 | public String getIspay() { 247 | return ispay; 248 | } 249 | 250 | } 251 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/JingdianxinxiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.JingdianxinxiEntity; 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 2021-04-17 10:00:42 20 | */ 21 | public class JingdianxinxiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 景点特色 27 | */ 28 | 29 | private String jingdiantese; 30 | 31 | /** 32 | * 服务保障 33 | */ 34 | 35 | private String fuwubaozhang; 36 | 37 | /** 38 | * 供应商 39 | */ 40 | 41 | private String gongyingshang; 42 | 43 | /** 44 | * 个人票价 45 | */ 46 | 47 | private Integer gerenpiaojia; 48 | 49 | /** 50 | * 景点介绍 51 | */ 52 | 53 | private String jingdianjieshao; 54 | 55 | /** 56 | * 旅游路线 57 | */ 58 | 59 | private String lvyouluxian; 60 | 61 | /** 62 | * 预订须知 63 | */ 64 | 65 | private String yudingxuzhi; 66 | 67 | /** 68 | * 如何预订 69 | */ 70 | 71 | private String ruheyuding; 72 | 73 | /** 74 | * 景点图片 75 | */ 76 | 77 | private String jingdiantupian; 78 | 79 | /** 80 | * 赞 81 | */ 82 | 83 | private Integer thumbsupnum; 84 | 85 | /** 86 | * 踩 87 | */ 88 | 89 | private Integer crazilynum; 90 | 91 | 92 | /** 93 | * 设置:景点特色 94 | */ 95 | 96 | public void setJingdiantese(String jingdiantese) { 97 | this.jingdiantese = jingdiantese; 98 | } 99 | 100 | /** 101 | * 获取:景点特色 102 | */ 103 | public String getJingdiantese() { 104 | return jingdiantese; 105 | } 106 | 107 | 108 | /** 109 | * 设置:服务保障 110 | */ 111 | 112 | public void setFuwubaozhang(String fuwubaozhang) { 113 | this.fuwubaozhang = fuwubaozhang; 114 | } 115 | 116 | /** 117 | * 获取:服务保障 118 | */ 119 | public String getFuwubaozhang() { 120 | return fuwubaozhang; 121 | } 122 | 123 | 124 | /** 125 | * 设置:供应商 126 | */ 127 | 128 | public void setGongyingshang(String gongyingshang) { 129 | this.gongyingshang = gongyingshang; 130 | } 131 | 132 | /** 133 | * 获取:供应商 134 | */ 135 | public String getGongyingshang() { 136 | return gongyingshang; 137 | } 138 | 139 | 140 | /** 141 | * 设置:个人票价 142 | */ 143 | 144 | public void setGerenpiaojia(Integer gerenpiaojia) { 145 | this.gerenpiaojia = gerenpiaojia; 146 | } 147 | 148 | /** 149 | * 获取:个人票价 150 | */ 151 | public Integer getGerenpiaojia() { 152 | return gerenpiaojia; 153 | } 154 | 155 | 156 | /** 157 | * 设置:景点介绍 158 | */ 159 | 160 | public void setJingdianjieshao(String jingdianjieshao) { 161 | this.jingdianjieshao = jingdianjieshao; 162 | } 163 | 164 | /** 165 | * 获取:景点介绍 166 | */ 167 | public String getJingdianjieshao() { 168 | return jingdianjieshao; 169 | } 170 | 171 | 172 | /** 173 | * 设置:旅游路线 174 | */ 175 | 176 | public void setLvyouluxian(String lvyouluxian) { 177 | this.lvyouluxian = lvyouluxian; 178 | } 179 | 180 | /** 181 | * 获取:旅游路线 182 | */ 183 | public String getLvyouluxian() { 184 | return lvyouluxian; 185 | } 186 | 187 | 188 | /** 189 | * 设置:预订须知 190 | */ 191 | 192 | public void setYudingxuzhi(String yudingxuzhi) { 193 | this.yudingxuzhi = yudingxuzhi; 194 | } 195 | 196 | /** 197 | * 获取:预订须知 198 | */ 199 | public String getYudingxuzhi() { 200 | return yudingxuzhi; 201 | } 202 | 203 | 204 | /** 205 | * 设置:如何预订 206 | */ 207 | 208 | public void setRuheyuding(String ruheyuding) { 209 | this.ruheyuding = ruheyuding; 210 | } 211 | 212 | /** 213 | * 获取:如何预订 214 | */ 215 | public String getRuheyuding() { 216 | return ruheyuding; 217 | } 218 | 219 | 220 | /** 221 | * 设置:景点图片 222 | */ 223 | 224 | public void setJingdiantupian(String jingdiantupian) { 225 | this.jingdiantupian = jingdiantupian; 226 | } 227 | 228 | /** 229 | * 获取:景点图片 230 | */ 231 | public String getJingdiantupian() { 232 | return jingdiantupian; 233 | } 234 | 235 | 236 | /** 237 | * 设置:赞 238 | */ 239 | 240 | public void setThumbsupnum(Integer thumbsupnum) { 241 | this.thumbsupnum = thumbsupnum; 242 | } 243 | 244 | /** 245 | * 获取:赞 246 | */ 247 | public Integer getThumbsupnum() { 248 | return thumbsupnum; 249 | } 250 | 251 | 252 | /** 253 | * 设置:踩 254 | */ 255 | 256 | public void setCrazilynum(Integer crazilynum) { 257 | this.crazilynum = crazilynum; 258 | } 259 | 260 | /** 261 | * 获取:踩 262 | */ 263 | public Integer getCrazilynum() { 264 | return crazilynum; 265 | } 266 | 267 | } 268 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/JingdianxinxiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.JingdianxinxiEntity; 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 2021-04-17 10:00:42 21 | */ 22 | public class JingdianxinxiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 景点特色 28 | */ 29 | 30 | private String jingdiantese; 31 | 32 | /** 33 | * 服务保障 34 | */ 35 | 36 | private String fuwubaozhang; 37 | 38 | /** 39 | * 供应商 40 | */ 41 | 42 | private String gongyingshang; 43 | 44 | /** 45 | * 个人票价 46 | */ 47 | 48 | private Integer gerenpiaojia; 49 | 50 | /** 51 | * 景点介绍 52 | */ 53 | 54 | private String jingdianjieshao; 55 | 56 | /** 57 | * 旅游路线 58 | */ 59 | 60 | private String lvyouluxian; 61 | 62 | /** 63 | * 预订须知 64 | */ 65 | 66 | private String yudingxuzhi; 67 | 68 | /** 69 | * 如何预订 70 | */ 71 | 72 | private String ruheyuding; 73 | 74 | /** 75 | * 景点图片 76 | */ 77 | 78 | private String jingdiantupian; 79 | 80 | /** 81 | * 赞 82 | */ 83 | 84 | private Integer thumbsupnum; 85 | 86 | /** 87 | * 踩 88 | */ 89 | 90 | private Integer crazilynum; 91 | 92 | 93 | /** 94 | * 设置:景点特色 95 | */ 96 | 97 | public void setJingdiantese(String jingdiantese) { 98 | this.jingdiantese = jingdiantese; 99 | } 100 | 101 | /** 102 | * 获取:景点特色 103 | */ 104 | public String getJingdiantese() { 105 | return jingdiantese; 106 | } 107 | 108 | 109 | /** 110 | * 设置:服务保障 111 | */ 112 | 113 | public void setFuwubaozhang(String fuwubaozhang) { 114 | this.fuwubaozhang = fuwubaozhang; 115 | } 116 | 117 | /** 118 | * 获取:服务保障 119 | */ 120 | public String getFuwubaozhang() { 121 | return fuwubaozhang; 122 | } 123 | 124 | 125 | /** 126 | * 设置:供应商 127 | */ 128 | 129 | public void setGongyingshang(String gongyingshang) { 130 | this.gongyingshang = gongyingshang; 131 | } 132 | 133 | /** 134 | * 获取:供应商 135 | */ 136 | public String getGongyingshang() { 137 | return gongyingshang; 138 | } 139 | 140 | 141 | /** 142 | * 设置:个人票价 143 | */ 144 | 145 | public void setGerenpiaojia(Integer gerenpiaojia) { 146 | this.gerenpiaojia = gerenpiaojia; 147 | } 148 | 149 | /** 150 | * 获取:个人票价 151 | */ 152 | public Integer getGerenpiaojia() { 153 | return gerenpiaojia; 154 | } 155 | 156 | 157 | /** 158 | * 设置:景点介绍 159 | */ 160 | 161 | public void setJingdianjieshao(String jingdianjieshao) { 162 | this.jingdianjieshao = jingdianjieshao; 163 | } 164 | 165 | /** 166 | * 获取:景点介绍 167 | */ 168 | public String getJingdianjieshao() { 169 | return jingdianjieshao; 170 | } 171 | 172 | 173 | /** 174 | * 设置:旅游路线 175 | */ 176 | 177 | public void setLvyouluxian(String lvyouluxian) { 178 | this.lvyouluxian = lvyouluxian; 179 | } 180 | 181 | /** 182 | * 获取:旅游路线 183 | */ 184 | public String getLvyouluxian() { 185 | return lvyouluxian; 186 | } 187 | 188 | 189 | /** 190 | * 设置:预订须知 191 | */ 192 | 193 | public void setYudingxuzhi(String yudingxuzhi) { 194 | this.yudingxuzhi = yudingxuzhi; 195 | } 196 | 197 | /** 198 | * 获取:预订须知 199 | */ 200 | public String getYudingxuzhi() { 201 | return yudingxuzhi; 202 | } 203 | 204 | 205 | /** 206 | * 设置:如何预订 207 | */ 208 | 209 | public void setRuheyuding(String ruheyuding) { 210 | this.ruheyuding = ruheyuding; 211 | } 212 | 213 | /** 214 | * 获取:如何预订 215 | */ 216 | public String getRuheyuding() { 217 | return ruheyuding; 218 | } 219 | 220 | 221 | /** 222 | * 设置:景点图片 223 | */ 224 | 225 | public void setJingdiantupian(String jingdiantupian) { 226 | this.jingdiantupian = jingdiantupian; 227 | } 228 | 229 | /** 230 | * 获取:景点图片 231 | */ 232 | public String getJingdiantupian() { 233 | return jingdiantupian; 234 | } 235 | 236 | 237 | /** 238 | * 设置:赞 239 | */ 240 | 241 | public void setThumbsupnum(Integer thumbsupnum) { 242 | this.thumbsupnum = thumbsupnum; 243 | } 244 | 245 | /** 246 | * 获取:赞 247 | */ 248 | public Integer getThumbsupnum() { 249 | return thumbsupnum; 250 | } 251 | 252 | 253 | /** 254 | * 设置:踩 255 | */ 256 | 257 | public void setCrazilynum(Integer crazilynum) { 258 | this.crazilynum = crazilynum; 259 | } 260 | 261 | /** 262 | * 获取:踩 263 | */ 264 | public Integer getCrazilynum() { 265 | return crazilynum; 266 | } 267 | 268 | } 269 | -------------------------------------------------------------------------------- /src/main/java/com/controller/UserController.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.UserEntity; 27 | import com.service.TokenService; 28 | import com.service.UserService; 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 UserController{ 41 | 42 | @Autowired 43 | private UserService 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 | UserEntity 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 UserEntity 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 | UserEntity 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,UserEntity 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( UserEntity 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 | UserEntity 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 | UserEntity user = userService.selectById(id); 136 | return R.ok().put("data", user); 137 | } 138 | 139 | /** 140 | * 保存 141 | */ 142 | @PostMapping("/save") 143 | public R save(@RequestBody UserEntity 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 UserEntity user){ 157 | // ValidatorUtils.validateEntity(user); 158 | UserEntity 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 | -------------------------------------------------------------------------------- /src/main/java/com/utils/MPUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.Arrays; 4 | import java.util.HashMap; 5 | import java.util.Iterator; 6 | import java.util.Map; 7 | 8 | import org.apache.commons.lang3.StringUtils; 9 | 10 | import cn.hutool.core.bean.BeanUtil; 11 | 12 | import com.baomidou.mybatisplus.mapper.Wrapper; 13 | 14 | /** 15 | * Mybatis-Plus工具类 16 | */ 17 | public class MPUtil { 18 | public static final char UNDERLINE = '_'; 19 | 20 | 21 | //mybatis plus allEQ 表达式转换 22 | public static Map allEQMapPre(Object bean,String pre) { 23 | Map map =BeanUtil.beanToMap(bean); 24 | return camelToUnderlineMap(map,pre); 25 | } 26 | 27 | //mybatis plus allEQ 表达式转换 28 | public static Map allEQMap(Object bean) { 29 | Map map =BeanUtil.beanToMap(bean); 30 | return camelToUnderlineMap(map,""); 31 | } 32 | 33 | public static Wrapper allLikePre(Wrapper wrapper,Object bean,String pre) { 34 | Map map =BeanUtil.beanToMap(bean); 35 | Map result = camelToUnderlineMap(map,pre); 36 | 37 | return genLike(wrapper,result); 38 | } 39 | 40 | public static Wrapper allLike(Wrapper wrapper,Object bean) { 41 | Map result = BeanUtil.beanToMap(bean, true, true); 42 | return genLike(wrapper,result); 43 | } 44 | 45 | 46 | public static Wrapper genLike( Wrapper wrapper,Map param) { 47 | Iterator> it = param.entrySet().iterator(); 48 | int i=0; 49 | while (it.hasNext()) { 50 | if(i>0) wrapper.and(); 51 | Map.Entry entry = it.next(); 52 | String key = entry.getKey(); 53 | String value = (String) entry.getValue(); 54 | wrapper.like(key, value); 55 | i++; 56 | } 57 | return wrapper; 58 | } 59 | 60 | public static Wrapper likeOrEq(Wrapper wrapper,Object bean) { 61 | Map result = BeanUtil.beanToMap(bean, true, true); 62 | return genLikeOrEq(wrapper,result); 63 | } 64 | 65 | public static Wrapper genLikeOrEq( Wrapper wrapper,Map param) { 66 | Iterator> it = param.entrySet().iterator(); 67 | int i=0; 68 | while (it.hasNext()) { 69 | if(i>0) wrapper.and(); 70 | Map.Entry entry = it.next(); 71 | String key = entry.getKey(); 72 | if(entry.getValue().toString().contains("%")) { 73 | wrapper.like(key, entry.getValue().toString().replace("%", "")); 74 | } else { 75 | wrapper.eq(key, entry.getValue()); 76 | } 77 | i++; 78 | } 79 | return wrapper; 80 | } 81 | 82 | public static Wrapper allEq(Wrapper wrapper,Object bean) { 83 | Map result = BeanUtil.beanToMap(bean, true, true); 84 | return genEq(wrapper,result); 85 | } 86 | 87 | 88 | public static Wrapper genEq( Wrapper wrapper,Map param) { 89 | Iterator> it = param.entrySet().iterator(); 90 | int i=0; 91 | while (it.hasNext()) { 92 | if(i>0) wrapper.and(); 93 | Map.Entry entry = it.next(); 94 | String key = entry.getKey(); 95 | wrapper.eq(key, entry.getValue()); 96 | i++; 97 | } 98 | return wrapper; 99 | } 100 | 101 | 102 | public static Wrapper between(Wrapper wrapper,Map params) { 103 | for(String key : params.keySet()) { 104 | String columnName = ""; 105 | if(key.endsWith("_start")) { 106 | columnName = key.substring(0, key.indexOf("_start")); 107 | if(StringUtils.isNotBlank(params.get(key).toString())) { 108 | wrapper.ge(columnName, params.get(key)); 109 | } 110 | } 111 | if(key.endsWith("_end")) { 112 | columnName = key.substring(0, key.indexOf("_end")); 113 | if(StringUtils.isNotBlank(params.get(key).toString())) { 114 | wrapper.le(columnName, params.get(key)); 115 | } 116 | } 117 | } 118 | return wrapper; 119 | } 120 | 121 | public static Wrapper sort(Wrapper wrapper,Map params) { 122 | String order = ""; 123 | if(params.get("order") != null && StringUtils.isNotBlank(params.get("order").toString())) { 124 | order = params.get("order").toString(); 125 | } 126 | if(params.get("sort") != null && StringUtils.isNotBlank(params.get("sort").toString())) { 127 | if(order.equalsIgnoreCase("desc")) { 128 | wrapper.orderDesc(Arrays.asList(params.get("sort"))); 129 | } else { 130 | wrapper.orderAsc(Arrays.asList(params.get("sort"))); 131 | } 132 | } 133 | return wrapper; 134 | } 135 | 136 | 137 | /** 138 | * 驼峰格式字符串转换为下划线格式字符串 139 | * 140 | * @param param 141 | * @return 142 | */ 143 | public static String camelToUnderline(String param) { 144 | if (param == null || "".equals(param.trim())) { 145 | return ""; 146 | } 147 | int len = param.length(); 148 | StringBuilder sb = new StringBuilder(len); 149 | for (int i = 0; i < len; i++) { 150 | char c = param.charAt(i); 151 | if (Character.isUpperCase(c)) { 152 | sb.append(UNDERLINE); 153 | sb.append(Character.toLowerCase(c)); 154 | } else { 155 | sb.append(c); 156 | } 157 | } 158 | return sb.toString(); 159 | } 160 | 161 | public static void main(String[] ages) { 162 | System.out.println(camelToUnderline("ABCddfANM")); 163 | } 164 | 165 | public static Map camelToUnderlineMap(Map param, String pre) { 166 | 167 | Map newMap = new HashMap(); 168 | Iterator> it = param.entrySet().iterator(); 169 | while (it.hasNext()) { 170 | Map.Entry entry = it.next(); 171 | String key = entry.getKey(); 172 | String newKey = camelToUnderline(key); 173 | if (pre.endsWith(".")) { 174 | newMap.put(pre + newKey, entry.getValue()); 175 | } else if (StringUtils.isEmpty(pre)) { 176 | newMap.put(newKey, entry.getValue()); 177 | } else { 178 | 179 | newMap.put(pre + "." + newKey, entry.getValue()); 180 | } 181 | } 182 | return newMap; 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /src/main/java/com/entity/DingpiaoxinxiEntity.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 2021-04-17 10:00:42 30 | */ 31 | @TableName("dingpiaoxinxi") 32 | public class DingpiaoxinxiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public DingpiaoxinxiEntity() { 37 | 38 | } 39 | 40 | public DingpiaoxinxiEntity(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 dingdanbianhao; 59 | 60 | /** 61 | * 景点名称 62 | */ 63 | 64 | private String jingdianmingcheng; 65 | 66 | /** 67 | * 观光日期 68 | */ 69 | 70 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") 71 | @DateTimeFormat 72 | private Date guanguangriqi; 73 | 74 | /** 75 | * 个人票价 76 | */ 77 | 78 | private String gerenpiaojia; 79 | 80 | /** 81 | * 购买票数 82 | */ 83 | 84 | private String goumaipiaoshu; 85 | 86 | /** 87 | * 总费用 88 | */ 89 | 90 | private String zongfeiyong; 91 | 92 | /** 93 | * 用户名 94 | */ 95 | 96 | private String yonghuming; 97 | 98 | /** 99 | * 生成订单时间 100 | */ 101 | 102 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 103 | @DateTimeFormat 104 | private Date shengchengdingdanshijian; 105 | 106 | /** 107 | * 是否审核 108 | */ 109 | 110 | private String sfsh; 111 | 112 | /** 113 | * 审核回复 114 | */ 115 | 116 | private String shhf; 117 | 118 | /** 119 | * 是否支付 120 | */ 121 | 122 | private String ispay; 123 | 124 | 125 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 126 | @DateTimeFormat 127 | private Date addtime; 128 | 129 | public Date getAddtime() { 130 | return addtime; 131 | } 132 | public void setAddtime(Date addtime) { 133 | this.addtime = addtime; 134 | } 135 | 136 | public Long getId() { 137 | return id; 138 | } 139 | 140 | public void setId(Long id) { 141 | this.id = id; 142 | } 143 | /** 144 | * 设置:订单编号 145 | */ 146 | public void setDingdanbianhao(String dingdanbianhao) { 147 | this.dingdanbianhao = dingdanbianhao; 148 | } 149 | /** 150 | * 获取:订单编号 151 | */ 152 | public String getDingdanbianhao() { 153 | return dingdanbianhao; 154 | } 155 | /** 156 | * 设置:景点名称 157 | */ 158 | public void setJingdianmingcheng(String jingdianmingcheng) { 159 | this.jingdianmingcheng = jingdianmingcheng; 160 | } 161 | /** 162 | * 获取:景点名称 163 | */ 164 | public String getJingdianmingcheng() { 165 | return jingdianmingcheng; 166 | } 167 | /** 168 | * 设置:观光日期 169 | */ 170 | public void setGuanguangriqi(Date guanguangriqi) { 171 | this.guanguangriqi = guanguangriqi; 172 | } 173 | /** 174 | * 获取:观光日期 175 | */ 176 | public Date getGuanguangriqi() { 177 | return guanguangriqi; 178 | } 179 | /** 180 | * 设置:个人票价 181 | */ 182 | public void setGerenpiaojia(String gerenpiaojia) { 183 | this.gerenpiaojia = gerenpiaojia; 184 | } 185 | /** 186 | * 获取:个人票价 187 | */ 188 | public String getGerenpiaojia() { 189 | return gerenpiaojia; 190 | } 191 | /** 192 | * 设置:购买票数 193 | */ 194 | public void setGoumaipiaoshu(String goumaipiaoshu) { 195 | this.goumaipiaoshu = goumaipiaoshu; 196 | } 197 | /** 198 | * 获取:购买票数 199 | */ 200 | public String getGoumaipiaoshu() { 201 | return goumaipiaoshu; 202 | } 203 | /** 204 | * 设置:总费用 205 | */ 206 | public void setZongfeiyong(String zongfeiyong) { 207 | this.zongfeiyong = zongfeiyong; 208 | } 209 | /** 210 | * 获取:总费用 211 | */ 212 | public String getZongfeiyong() { 213 | return zongfeiyong; 214 | } 215 | /** 216 | * 设置:用户名 217 | */ 218 | public void setYonghuming(String yonghuming) { 219 | this.yonghuming = yonghuming; 220 | } 221 | /** 222 | * 获取:用户名 223 | */ 224 | public String getYonghuming() { 225 | return yonghuming; 226 | } 227 | /** 228 | * 设置:生成订单时间 229 | */ 230 | public void setShengchengdingdanshijian(Date shengchengdingdanshijian) { 231 | this.shengchengdingdanshijian = shengchengdingdanshijian; 232 | } 233 | /** 234 | * 获取:生成订单时间 235 | */ 236 | public Date getShengchengdingdanshijian() { 237 | return shengchengdingdanshijian; 238 | } 239 | /** 240 | * 设置:是否审核 241 | */ 242 | public void setSfsh(String sfsh) { 243 | this.sfsh = sfsh; 244 | } 245 | /** 246 | * 获取:是否审核 247 | */ 248 | public String getSfsh() { 249 | return sfsh; 250 | } 251 | /** 252 | * 设置:审核回复 253 | */ 254 | public void setShhf(String shhf) { 255 | this.shhf = shhf; 256 | } 257 | /** 258 | * 获取:审核回复 259 | */ 260 | public String getShhf() { 261 | return shhf; 262 | } 263 | /** 264 | * 设置:是否支付 265 | */ 266 | public void setIspay(String ispay) { 267 | this.ispay = ispay; 268 | } 269 | /** 270 | * 获取:是否支付 271 | */ 272 | public String getIspay() { 273 | return ispay; 274 | } 275 | 276 | } 277 | -------------------------------------------------------------------------------- /src/main/java/com/entity/JingdianxinxiEntity.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 2021-04-17 10:00:42 30 | */ 31 | @TableName("jingdianxinxi") 32 | public class JingdianxinxiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public JingdianxinxiEntity() { 37 | 38 | } 39 | 40 | public JingdianxinxiEntity(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 jingdianmingcheng; 59 | 60 | /** 61 | * 景点特色 62 | */ 63 | 64 | private String jingdiantese; 65 | 66 | /** 67 | * 服务保障 68 | */ 69 | 70 | private String fuwubaozhang; 71 | 72 | /** 73 | * 供应商 74 | */ 75 | 76 | private String gongyingshang; 77 | 78 | /** 79 | * 个人票价 80 | */ 81 | 82 | private Integer gerenpiaojia; 83 | 84 | /** 85 | * 景点介绍 86 | */ 87 | 88 | private String jingdianjieshao; 89 | 90 | /** 91 | * 旅游路线 92 | */ 93 | 94 | private String lvyouluxian; 95 | 96 | /** 97 | * 预订须知 98 | */ 99 | 100 | private String yudingxuzhi; 101 | 102 | /** 103 | * 如何预订 104 | */ 105 | 106 | private String ruheyuding; 107 | 108 | /** 109 | * 景点图片 110 | */ 111 | 112 | private String jingdiantupian; 113 | 114 | /** 115 | * 赞 116 | */ 117 | 118 | private Integer thumbsupnum; 119 | 120 | /** 121 | * 踩 122 | */ 123 | 124 | private Integer crazilynum; 125 | 126 | 127 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 128 | @DateTimeFormat 129 | private Date addtime; 130 | 131 | public Date getAddtime() { 132 | return addtime; 133 | } 134 | public void setAddtime(Date addtime) { 135 | this.addtime = addtime; 136 | } 137 | 138 | public Long getId() { 139 | return id; 140 | } 141 | 142 | public void setId(Long id) { 143 | this.id = id; 144 | } 145 | /** 146 | * 设置:景点名称 147 | */ 148 | public void setJingdianmingcheng(String jingdianmingcheng) { 149 | this.jingdianmingcheng = jingdianmingcheng; 150 | } 151 | /** 152 | * 获取:景点名称 153 | */ 154 | public String getJingdianmingcheng() { 155 | return jingdianmingcheng; 156 | } 157 | /** 158 | * 设置:景点特色 159 | */ 160 | public void setJingdiantese(String jingdiantese) { 161 | this.jingdiantese = jingdiantese; 162 | } 163 | /** 164 | * 获取:景点特色 165 | */ 166 | public String getJingdiantese() { 167 | return jingdiantese; 168 | } 169 | /** 170 | * 设置:服务保障 171 | */ 172 | public void setFuwubaozhang(String fuwubaozhang) { 173 | this.fuwubaozhang = fuwubaozhang; 174 | } 175 | /** 176 | * 获取:服务保障 177 | */ 178 | public String getFuwubaozhang() { 179 | return fuwubaozhang; 180 | } 181 | /** 182 | * 设置:供应商 183 | */ 184 | public void setGongyingshang(String gongyingshang) { 185 | this.gongyingshang = gongyingshang; 186 | } 187 | /** 188 | * 获取:供应商 189 | */ 190 | public String getGongyingshang() { 191 | return gongyingshang; 192 | } 193 | /** 194 | * 设置:个人票价 195 | */ 196 | public void setGerenpiaojia(Integer gerenpiaojia) { 197 | this.gerenpiaojia = gerenpiaojia; 198 | } 199 | /** 200 | * 获取:个人票价 201 | */ 202 | public Integer getGerenpiaojia() { 203 | return gerenpiaojia; 204 | } 205 | /** 206 | * 设置:景点介绍 207 | */ 208 | public void setJingdianjieshao(String jingdianjieshao) { 209 | this.jingdianjieshao = jingdianjieshao; 210 | } 211 | /** 212 | * 获取:景点介绍 213 | */ 214 | public String getJingdianjieshao() { 215 | return jingdianjieshao; 216 | } 217 | /** 218 | * 设置:旅游路线 219 | */ 220 | public void setLvyouluxian(String lvyouluxian) { 221 | this.lvyouluxian = lvyouluxian; 222 | } 223 | /** 224 | * 获取:旅游路线 225 | */ 226 | public String getLvyouluxian() { 227 | return lvyouluxian; 228 | } 229 | /** 230 | * 设置:预订须知 231 | */ 232 | public void setYudingxuzhi(String yudingxuzhi) { 233 | this.yudingxuzhi = yudingxuzhi; 234 | } 235 | /** 236 | * 获取:预订须知 237 | */ 238 | public String getYudingxuzhi() { 239 | return yudingxuzhi; 240 | } 241 | /** 242 | * 设置:如何预订 243 | */ 244 | public void setRuheyuding(String ruheyuding) { 245 | this.ruheyuding = ruheyuding; 246 | } 247 | /** 248 | * 获取:如何预订 249 | */ 250 | public String getRuheyuding() { 251 | return ruheyuding; 252 | } 253 | /** 254 | * 设置:景点图片 255 | */ 256 | public void setJingdiantupian(String jingdiantupian) { 257 | this.jingdiantupian = jingdiantupian; 258 | } 259 | /** 260 | * 获取:景点图片 261 | */ 262 | public String getJingdiantupian() { 263 | return jingdiantupian; 264 | } 265 | /** 266 | * 设置:赞 267 | */ 268 | public void setThumbsupnum(Integer thumbsupnum) { 269 | this.thumbsupnum = thumbsupnum; 270 | } 271 | /** 272 | * 获取:赞 273 | */ 274 | public Integer getThumbsupnum() { 275 | return thumbsupnum; 276 | } 277 | /** 278 | * 设置:踩 279 | */ 280 | public void setCrazilynum(Integer crazilynum) { 281 | this.crazilynum = crazilynum; 282 | } 283 | /** 284 | * 获取:踩 285 | */ 286 | public Integer getCrazilynum() { 287 | return crazilynum; 288 | } 289 | 290 | } 291 | -------------------------------------------------------------------------------- /src/main/java/com/controller/NewsController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Map; 8 | import java.util.HashMap; 9 | import java.util.Iterator; 10 | import java.util.Date; 11 | import java.util.List; 12 | import javax.servlet.http.HttpServletRequest; 13 | 14 | import com.utils.ValidatorUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.format.annotation.DateTimeFormat; 18 | import org.springframework.web.bind.annotation.PathVariable; 19 | import org.springframework.web.bind.annotation.RequestBody; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.RequestParam; 22 | import org.springframework.web.bind.annotation.RestController; 23 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 24 | import com.baomidou.mybatisplus.mapper.Wrapper; 25 | import com.annotation.IgnoreAuth; 26 | 27 | import com.entity.NewsEntity; 28 | import com.entity.view.NewsView; 29 | 30 | import com.service.NewsService; 31 | import com.service.TokenService; 32 | import com.utils.PageUtils; 33 | import com.utils.R; 34 | import com.utils.MD5Util; 35 | import com.utils.MPUtil; 36 | import com.utils.CommonUtil; 37 | 38 | 39 | /** 40 | * 景点资讯 41 | * 后端接口 42 | * @author 43 | * @email 44 | * @date 2021-04-17 10:00:42 45 | */ 46 | @RestController 47 | @RequestMapping("/news") 48 | public class NewsController { 49 | @Autowired 50 | private NewsService newsService; 51 | 52 | 53 | 54 | /** 55 | * 后端列表 56 | */ 57 | @RequestMapping("/page") 58 | public R page(@RequestParam Map params,NewsEntity news, 59 | HttpServletRequest request){ 60 | EntityWrapper ew = new EntityWrapper(); 61 | PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params)); 62 | 63 | return R.ok().put("data", page); 64 | } 65 | 66 | /** 67 | * 前端列表 68 | */ 69 | @IgnoreAuth 70 | @RequestMapping("/list") 71 | public R list(@RequestParam Map params,NewsEntity news, HttpServletRequest request){ 72 | EntityWrapper ew = new EntityWrapper(); 73 | PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params)); 74 | return R.ok().put("data", page); 75 | } 76 | 77 | /** 78 | * 列表 79 | */ 80 | @RequestMapping("/lists") 81 | public R list( NewsEntity news){ 82 | EntityWrapper ew = new EntityWrapper(); 83 | ew.allEq(MPUtil.allEQMapPre( news, "news")); 84 | return R.ok().put("data", newsService.selectListView(ew)); 85 | } 86 | 87 | /** 88 | * 查询 89 | */ 90 | @RequestMapping("/query") 91 | public R query(NewsEntity news){ 92 | EntityWrapper< NewsEntity> ew = new EntityWrapper< NewsEntity>(); 93 | ew.allEq(MPUtil.allEQMapPre( news, "news")); 94 | NewsView newsView = newsService.selectView(ew); 95 | return R.ok("查询景点资讯成功").put("data", newsView); 96 | } 97 | 98 | /** 99 | * 后端详情 100 | */ 101 | @RequestMapping("/info/{id}") 102 | public R info(@PathVariable("id") Long id){ 103 | NewsEntity news = newsService.selectById(id); 104 | return R.ok().put("data", news); 105 | } 106 | 107 | /** 108 | * 前端详情 109 | */ 110 | @IgnoreAuth 111 | @RequestMapping("/detail/{id}") 112 | public R detail(@PathVariable("id") Long id){ 113 | NewsEntity news = newsService.selectById(id); 114 | return R.ok().put("data", news); 115 | } 116 | 117 | 118 | 119 | 120 | /** 121 | * 后端保存 122 | */ 123 | @RequestMapping("/save") 124 | public R save(@RequestBody NewsEntity news, HttpServletRequest request){ 125 | news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 126 | //ValidatorUtils.validateEntity(news); 127 | newsService.insert(news); 128 | return R.ok(); 129 | } 130 | 131 | /** 132 | * 前端保存 133 | */ 134 | @RequestMapping("/add") 135 | public R add(@RequestBody NewsEntity news, HttpServletRequest request){ 136 | news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 137 | //ValidatorUtils.validateEntity(news); 138 | newsService.insert(news); 139 | return R.ok(); 140 | } 141 | 142 | /** 143 | * 修改 144 | */ 145 | @RequestMapping("/update") 146 | public R update(@RequestBody NewsEntity news, HttpServletRequest request){ 147 | //ValidatorUtils.validateEntity(news); 148 | newsService.updateById(news);//全部更新 149 | return R.ok(); 150 | } 151 | 152 | 153 | /** 154 | * 删除 155 | */ 156 | @RequestMapping("/delete") 157 | public R delete(@RequestBody Long[] ids){ 158 | newsService.deleteBatchIds(Arrays.asList(ids)); 159 | return R.ok(); 160 | } 161 | 162 | /** 163 | * 提醒接口 164 | */ 165 | @RequestMapping("/remind/{columnName}/{type}") 166 | public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 167 | @PathVariable("type") String type,@RequestParam Map map) { 168 | map.put("column", columnName); 169 | map.put("type", type); 170 | 171 | if(type.equals("2")) { 172 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 173 | Calendar c = Calendar.getInstance(); 174 | Date remindStartDate = null; 175 | Date remindEndDate = null; 176 | if(map.get("remindstart")!=null) { 177 | Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); 178 | c.setTime(new Date()); 179 | c.add(Calendar.DAY_OF_MONTH,remindStart); 180 | remindStartDate = c.getTime(); 181 | map.put("remindstart", sdf.format(remindStartDate)); 182 | } 183 | if(map.get("remindend")!=null) { 184 | Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); 185 | c.setTime(new Date()); 186 | c.add(Calendar.DAY_OF_MONTH,remindEnd); 187 | remindEndDate = c.getTime(); 188 | map.put("remindend", sdf.format(remindEndDate)); 189 | } 190 | } 191 | 192 | Wrapper wrapper = new EntityWrapper(); 193 | if(map.get("remindstart")!=null) { 194 | wrapper.ge(columnName, map.get("remindstart")); 195 | } 196 | if(map.get("remindend")!=null) { 197 | wrapper.le(columnName, map.get("remindend")); 198 | } 199 | 200 | 201 | int count = newsService.selectCount(wrapper); 202 | return R.ok().put("count", count); 203 | } 204 | 205 | 206 | 207 | } 208 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /src/main/java/com/controller/YonghupingjiaController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Map; 8 | import java.util.HashMap; 9 | import java.util.Iterator; 10 | import java.util.Date; 11 | import java.util.List; 12 | import javax.servlet.http.HttpServletRequest; 13 | 14 | import com.utils.ValidatorUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.format.annotation.DateTimeFormat; 18 | import org.springframework.web.bind.annotation.PathVariable; 19 | import org.springframework.web.bind.annotation.RequestBody; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.RequestParam; 22 | import org.springframework.web.bind.annotation.RestController; 23 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 24 | import com.baomidou.mybatisplus.mapper.Wrapper; 25 | import com.annotation.IgnoreAuth; 26 | 27 | import com.entity.YonghupingjiaEntity; 28 | import com.entity.view.YonghupingjiaView; 29 | 30 | import com.service.YonghupingjiaService; 31 | import com.service.TokenService; 32 | import com.utils.PageUtils; 33 | import com.utils.R; 34 | import com.utils.MD5Util; 35 | import com.utils.MPUtil; 36 | import com.utils.CommonUtil; 37 | 38 | 39 | /** 40 | * 用户评价 41 | * 后端接口 42 | * @author 43 | * @email 44 | * @date 2021-04-17 10:00:42 45 | */ 46 | @RestController 47 | @RequestMapping("/yonghupingjia") 48 | public class YonghupingjiaController { 49 | @Autowired 50 | private YonghupingjiaService yonghupingjiaService; 51 | 52 | 53 | 54 | /** 55 | * 后端列表 56 | */ 57 | @RequestMapping("/page") 58 | public R page(@RequestParam Map params,YonghupingjiaEntity yonghupingjia, 59 | HttpServletRequest request){ 60 | String tableName = request.getSession().getAttribute("tableName").toString(); 61 | if(tableName.equals("yonghu")) { 62 | yonghupingjia.setYonghuming((String)request.getSession().getAttribute("username")); 63 | } 64 | EntityWrapper ew = new EntityWrapper(); 65 | PageUtils page = yonghupingjiaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghupingjia), params), params)); 66 | 67 | return R.ok().put("data", page); 68 | } 69 | 70 | /** 71 | * 前端列表 72 | */ 73 | @RequestMapping("/list") 74 | public R list(@RequestParam Map params,YonghupingjiaEntity yonghupingjia, HttpServletRequest request){ 75 | EntityWrapper ew = new EntityWrapper(); 76 | PageUtils page = yonghupingjiaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghupingjia), params), params)); 77 | return R.ok().put("data", page); 78 | } 79 | 80 | /** 81 | * 列表 82 | */ 83 | @RequestMapping("/lists") 84 | public R list( YonghupingjiaEntity yonghupingjia){ 85 | EntityWrapper ew = new EntityWrapper(); 86 | ew.allEq(MPUtil.allEQMapPre( yonghupingjia, "yonghupingjia")); 87 | return R.ok().put("data", yonghupingjiaService.selectListView(ew)); 88 | } 89 | 90 | /** 91 | * 查询 92 | */ 93 | @RequestMapping("/query") 94 | public R query(YonghupingjiaEntity yonghupingjia){ 95 | EntityWrapper< YonghupingjiaEntity> ew = new EntityWrapper< YonghupingjiaEntity>(); 96 | ew.allEq(MPUtil.allEQMapPre( yonghupingjia, "yonghupingjia")); 97 | YonghupingjiaView yonghupingjiaView = yonghupingjiaService.selectView(ew); 98 | return R.ok("查询用户评价成功").put("data", yonghupingjiaView); 99 | } 100 | 101 | /** 102 | * 后端详情 103 | */ 104 | @RequestMapping("/info/{id}") 105 | public R info(@PathVariable("id") Long id){ 106 | YonghupingjiaEntity yonghupingjia = yonghupingjiaService.selectById(id); 107 | return R.ok().put("data", yonghupingjia); 108 | } 109 | 110 | /** 111 | * 前端详情 112 | */ 113 | @RequestMapping("/detail/{id}") 114 | public R detail(@PathVariable("id") Long id){ 115 | YonghupingjiaEntity yonghupingjia = yonghupingjiaService.selectById(id); 116 | return R.ok().put("data", yonghupingjia); 117 | } 118 | 119 | 120 | 121 | 122 | /** 123 | * 后端保存 124 | */ 125 | @RequestMapping("/save") 126 | public R save(@RequestBody YonghupingjiaEntity yonghupingjia, HttpServletRequest request){ 127 | yonghupingjia.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 128 | //ValidatorUtils.validateEntity(yonghupingjia); 129 | yonghupingjiaService.insert(yonghupingjia); 130 | return R.ok(); 131 | } 132 | 133 | /** 134 | * 前端保存 135 | */ 136 | @RequestMapping("/add") 137 | public R add(@RequestBody YonghupingjiaEntity yonghupingjia, HttpServletRequest request){ 138 | yonghupingjia.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 139 | //ValidatorUtils.validateEntity(yonghupingjia); 140 | yonghupingjiaService.insert(yonghupingjia); 141 | return R.ok(); 142 | } 143 | 144 | /** 145 | * 修改 146 | */ 147 | @RequestMapping("/update") 148 | public R update(@RequestBody YonghupingjiaEntity yonghupingjia, HttpServletRequest request){ 149 | //ValidatorUtils.validateEntity(yonghupingjia); 150 | yonghupingjiaService.updateById(yonghupingjia);//全部更新 151 | return R.ok(); 152 | } 153 | 154 | 155 | /** 156 | * 删除 157 | */ 158 | @RequestMapping("/delete") 159 | public R delete(@RequestBody Long[] ids){ 160 | yonghupingjiaService.deleteBatchIds(Arrays.asList(ids)); 161 | return R.ok(); 162 | } 163 | 164 | /** 165 | * 提醒接口 166 | */ 167 | @RequestMapping("/remind/{columnName}/{type}") 168 | public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 169 | @PathVariable("type") String type,@RequestParam Map map) { 170 | map.put("column", columnName); 171 | map.put("type", type); 172 | 173 | if(type.equals("2")) { 174 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 175 | Calendar c = Calendar.getInstance(); 176 | Date remindStartDate = null; 177 | Date remindEndDate = null; 178 | if(map.get("remindstart")!=null) { 179 | Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); 180 | c.setTime(new Date()); 181 | c.add(Calendar.DAY_OF_MONTH,remindStart); 182 | remindStartDate = c.getTime(); 183 | map.put("remindstart", sdf.format(remindStartDate)); 184 | } 185 | if(map.get("remindend")!=null) { 186 | Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); 187 | c.setTime(new Date()); 188 | c.add(Calendar.DAY_OF_MONTH,remindEnd); 189 | remindEndDate = c.getTime(); 190 | map.put("remindend", sdf.format(remindEndDate)); 191 | } 192 | } 193 | 194 | Wrapper wrapper = new EntityWrapper(); 195 | if(map.get("remindstart")!=null) { 196 | wrapper.ge(columnName, map.get("remindstart")); 197 | } 198 | if(map.get("remindend")!=null) { 199 | wrapper.le(columnName, map.get("remindend")); 200 | } 201 | 202 | String tableName = request.getSession().getAttribute("tableName").toString(); 203 | if(tableName.equals("yonghu")) { 204 | wrapper.eq("yonghuming", (String)request.getSession().getAttribute("username")); 205 | } 206 | 207 | int count = yonghupingjiaService.selectCount(wrapper); 208 | return R.ok().put("count", count); 209 | } 210 | 211 | 212 | 213 | } 214 | -------------------------------------------------------------------------------- /src/main/java/com/controller/DingpiaoxinxiController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Map; 8 | import java.util.HashMap; 9 | import java.util.Iterator; 10 | import java.util.Date; 11 | import java.util.List; 12 | import javax.servlet.http.HttpServletRequest; 13 | 14 | import com.utils.ValidatorUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.format.annotation.DateTimeFormat; 18 | import org.springframework.web.bind.annotation.PathVariable; 19 | import org.springframework.web.bind.annotation.RequestBody; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.RequestParam; 22 | import org.springframework.web.bind.annotation.RestController; 23 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 24 | import com.baomidou.mybatisplus.mapper.Wrapper; 25 | import com.annotation.IgnoreAuth; 26 | 27 | import com.entity.DingpiaoxinxiEntity; 28 | import com.entity.view.DingpiaoxinxiView; 29 | 30 | import com.service.DingpiaoxinxiService; 31 | import com.service.TokenService; 32 | import com.utils.PageUtils; 33 | import com.utils.R; 34 | import com.utils.MD5Util; 35 | import com.utils.MPUtil; 36 | import com.utils.CommonUtil; 37 | 38 | 39 | /** 40 | * 订票信息 41 | * 后端接口 42 | * @author 43 | * @email 44 | * @date 2021-04-17 10:00:42 45 | */ 46 | @RestController 47 | @RequestMapping("/dingpiaoxinxi") 48 | public class DingpiaoxinxiController { 49 | @Autowired 50 | private DingpiaoxinxiService dingpiaoxinxiService; 51 | 52 | 53 | 54 | /** 55 | * 后端列表 56 | */ 57 | @RequestMapping("/page") 58 | public R page(@RequestParam Map params,DingpiaoxinxiEntity dingpiaoxinxi, 59 | HttpServletRequest request){ 60 | String tableName = request.getSession().getAttribute("tableName").toString(); 61 | if(tableName.equals("yonghu")) { 62 | dingpiaoxinxi.setYonghuming((String)request.getSession().getAttribute("username")); 63 | } 64 | EntityWrapper ew = new EntityWrapper(); 65 | PageUtils page = dingpiaoxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, dingpiaoxinxi), params), params)); 66 | 67 | return R.ok().put("data", page); 68 | } 69 | 70 | /** 71 | * 前端列表 72 | */ 73 | @RequestMapping("/list") 74 | public R list(@RequestParam Map params,DingpiaoxinxiEntity dingpiaoxinxi, HttpServletRequest request){ 75 | EntityWrapper ew = new EntityWrapper(); 76 | PageUtils page = dingpiaoxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, dingpiaoxinxi), params), params)); 77 | return R.ok().put("data", page); 78 | } 79 | 80 | /** 81 | * 列表 82 | */ 83 | @RequestMapping("/lists") 84 | public R list( DingpiaoxinxiEntity dingpiaoxinxi){ 85 | EntityWrapper ew = new EntityWrapper(); 86 | ew.allEq(MPUtil.allEQMapPre( dingpiaoxinxi, "dingpiaoxinxi")); 87 | return R.ok().put("data", dingpiaoxinxiService.selectListView(ew)); 88 | } 89 | 90 | /** 91 | * 查询 92 | */ 93 | @RequestMapping("/query") 94 | public R query(DingpiaoxinxiEntity dingpiaoxinxi){ 95 | EntityWrapper< DingpiaoxinxiEntity> ew = new EntityWrapper< DingpiaoxinxiEntity>(); 96 | ew.allEq(MPUtil.allEQMapPre( dingpiaoxinxi, "dingpiaoxinxi")); 97 | DingpiaoxinxiView dingpiaoxinxiView = dingpiaoxinxiService.selectView(ew); 98 | return R.ok("查询订票信息成功").put("data", dingpiaoxinxiView); 99 | } 100 | 101 | /** 102 | * 后端详情 103 | */ 104 | @RequestMapping("/info/{id}") 105 | public R info(@PathVariable("id") Long id){ 106 | DingpiaoxinxiEntity dingpiaoxinxi = dingpiaoxinxiService.selectById(id); 107 | return R.ok().put("data", dingpiaoxinxi); 108 | } 109 | 110 | /** 111 | * 前端详情 112 | */ 113 | @RequestMapping("/detail/{id}") 114 | public R detail(@PathVariable("id") Long id){ 115 | DingpiaoxinxiEntity dingpiaoxinxi = dingpiaoxinxiService.selectById(id); 116 | return R.ok().put("data", dingpiaoxinxi); 117 | } 118 | 119 | 120 | 121 | 122 | /** 123 | * 后端保存 124 | */ 125 | @RequestMapping("/save") 126 | public R save(@RequestBody DingpiaoxinxiEntity dingpiaoxinxi, HttpServletRequest request){ 127 | dingpiaoxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 128 | //ValidatorUtils.validateEntity(dingpiaoxinxi); 129 | dingpiaoxinxiService.insert(dingpiaoxinxi); 130 | return R.ok(); 131 | } 132 | 133 | /** 134 | * 前端保存 135 | */ 136 | @IgnoreAuth 137 | @RequestMapping("/add") 138 | public R add(@RequestBody DingpiaoxinxiEntity dingpiaoxinxi, HttpServletRequest request){ 139 | dingpiaoxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 140 | //ValidatorUtils.validateEntity(dingpiaoxinxi); 141 | dingpiaoxinxiService.insert(dingpiaoxinxi); 142 | return R.ok(); 143 | } 144 | 145 | /** 146 | * 修改 147 | */ 148 | @RequestMapping("/update") 149 | public R update(@RequestBody DingpiaoxinxiEntity dingpiaoxinxi, HttpServletRequest request){ 150 | //ValidatorUtils.validateEntity(dingpiaoxinxi); 151 | dingpiaoxinxiService.updateById(dingpiaoxinxi);//全部更新 152 | return R.ok(); 153 | } 154 | 155 | 156 | /** 157 | * 删除 158 | */ 159 | @RequestMapping("/delete") 160 | public R delete(@RequestBody Long[] ids){ 161 | dingpiaoxinxiService.deleteBatchIds(Arrays.asList(ids)); 162 | return R.ok(); 163 | } 164 | 165 | /** 166 | * 提醒接口 167 | */ 168 | @RequestMapping("/remind/{columnName}/{type}") 169 | public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 170 | @PathVariable("type") String type,@RequestParam Map map) { 171 | map.put("column", columnName); 172 | map.put("type", type); 173 | 174 | if(type.equals("2")) { 175 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 176 | Calendar c = Calendar.getInstance(); 177 | Date remindStartDate = null; 178 | Date remindEndDate = null; 179 | if(map.get("remindstart")!=null) { 180 | Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); 181 | c.setTime(new Date()); 182 | c.add(Calendar.DAY_OF_MONTH,remindStart); 183 | remindStartDate = c.getTime(); 184 | map.put("remindstart", sdf.format(remindStartDate)); 185 | } 186 | if(map.get("remindend")!=null) { 187 | Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); 188 | c.setTime(new Date()); 189 | c.add(Calendar.DAY_OF_MONTH,remindEnd); 190 | remindEndDate = c.getTime(); 191 | map.put("remindend", sdf.format(remindEndDate)); 192 | } 193 | } 194 | 195 | Wrapper wrapper = new EntityWrapper(); 196 | if(map.get("remindstart")!=null) { 197 | wrapper.ge(columnName, map.get("remindstart")); 198 | } 199 | if(map.get("remindend")!=null) { 200 | wrapper.le(columnName, map.get("remindend")); 201 | } 202 | 203 | String tableName = request.getSession().getAttribute("tableName").toString(); 204 | if(tableName.equals("yonghu")) { 205 | wrapper.eq("yonghuming", (String)request.getSession().getAttribute("username")); 206 | } 207 | 208 | int count = dingpiaoxinxiService.selectCount(wrapper); 209 | return R.ok().put("count", count); 210 | } 211 | 212 | 213 | 214 | } 215 | --------------------------------------------------------------------------------