├── image ├── 1.png ├── 10.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png ├── src ├── main │ ├── resources │ │ ├── mapper │ │ │ ├── ConfigDao.xml │ │ │ ├── TokenDao.xml │ │ │ ├── UsersDao.xml │ │ │ ├── JingdianfenleiDao.xml │ │ │ ├── AboutusDao.xml │ │ │ ├── YonghuDao.xml │ │ │ ├── TesemeishiDao.xml │ │ │ ├── JiudianxinxiDao.xml │ │ │ ├── LvyoujingdianDao.xml │ │ │ └── CommonDao.xml │ │ └── application.yml │ └── java │ │ └── com │ │ ├── dao │ │ ├── ConfigDao.java │ │ ├── UsersDao.java │ │ ├── TokenDao.java │ │ ├── CommonDao.java │ │ ├── YonghuDao.java │ │ ├── AboutusDao.java │ │ ├── TesemeishiDao.java │ │ ├── JiudianxinxiDao.java │ │ ├── LvyoujingdianDao.java │ │ └── JingdianfenleiDao.java │ │ ├── annotation │ │ ├── IgnoreAuth.java │ │ ├── LoginUser.java │ │ └── APPLoginUser.java │ │ ├── config │ │ ├── AlipayConfig.java │ │ ├── MybatisPlusConfig.java │ │ └── InterceptorConfig.java │ │ ├── utils │ │ ├── MD5Util.java │ │ ├── FileUtil.java │ │ ├── JQPageInfo.java │ │ ├── R.java │ │ ├── SQLFilter.java │ │ ├── HttpClientUtils.java │ │ ├── ValidatorUtils.java │ │ ├── SpringContextUtils.java │ │ ├── PageUtils.java │ │ ├── Query.java │ │ ├── CommonUtil.java │ │ └── MPUtil.java │ │ ├── service │ │ ├── ConfigService.java │ │ ├── UsersService.java │ │ ├── CommonService.java │ │ ├── TokenService.java │ │ ├── impl │ │ │ ├── ConfigServiceImpl.java │ │ │ ├── UsersServiceImpl.java │ │ │ ├── CommonServiceImpl.java │ │ │ ├── YonghuServiceImpl.java │ │ │ ├── AboutusServiceImpl.java │ │ │ ├── TesemeishiServiceImpl.java │ │ │ ├── JiudianxinxiServiceImpl.java │ │ │ ├── LvyoujingdianServiceImpl.java │ │ │ ├── JingdianfenleiServiceImpl.java │ │ │ └── TokenServiceImpl.java │ │ ├── YonghuService.java │ │ ├── AboutusService.java │ │ ├── TesemeishiService.java │ │ ├── JiudianxinxiService.java │ │ ├── LvyoujingdianService.java │ │ └── JingdianfenleiService.java │ │ ├── entity │ │ ├── vo │ │ │ ├── JingdianfenleiVO.java │ │ │ ├── AboutusVO.java │ │ │ ├── YonghuVO.java │ │ │ ├── JiudianxinxiVO.java │ │ │ ├── TesemeishiVO.java │ │ │ └── LvyoujingdianVO.java │ │ ├── model │ │ │ ├── JingdianfenleiModel.java │ │ │ ├── AboutusModel.java │ │ │ ├── YonghuModel.java │ │ │ ├── JiudianxinxiModel.java │ │ │ ├── TesemeishiModel.java │ │ │ └── LvyoujingdianModel.java │ │ ├── view │ │ │ ├── YonghuView.java │ │ │ ├── AboutusView.java │ │ │ ├── TesemeishiView.java │ │ │ ├── JiudianxinxiView.java │ │ │ ├── LvyoujingdianView.java │ │ │ └── JingdianfenleiView.java │ │ ├── EIException.java │ │ ├── ConfigEntity.java │ │ ├── UsersEntity.java │ │ ├── JingdianfenleiEntity.java │ │ ├── TokenEntity.java │ │ ├── AboutusEntity.java │ │ ├── YonghuEntity.java │ │ ├── JiudianxinxiEntity.java │ │ ├── TesemeishiEntity.java │ │ └── LvyoujingdianEntity.java │ │ ├── SpringbootSchemaApplication.java │ │ ├── interceptor │ │ └── AuthorizationInterceptor.java │ │ └── controller │ │ ├── ConfigController.java │ │ ├── FileController.java │ │ ├── UsersController.java │ │ ├── AboutusController.java │ │ ├── TesemeishiController.java │ │ └── JiudianxinxiController.java └── test │ └── java │ └── com │ └── SpringbootSchemaApplicationTests.java ├── .gitignore ├── README.md ├── pom-war.xml ├── pom.xml └── mvnw.cmd /image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/1.png -------------------------------------------------------------------------------- /image/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/10.png -------------------------------------------------------------------------------- /image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/2.png -------------------------------------------------------------------------------- /image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/3.png -------------------------------------------------------------------------------- /image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/4.png -------------------------------------------------------------------------------- /image/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/5.png -------------------------------------------------------------------------------- /image/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/6.png -------------------------------------------------------------------------------- /image/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/7.png -------------------------------------------------------------------------------- /image/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/8.png -------------------------------------------------------------------------------- /image/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No253Kashgar-Tourism-Website/HEAD/image/9.png -------------------------------------------------------------------------------- /src/main/resources/mapper/ConfigDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ConfigDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import com.entity.ConfigEntity; 6 | 7 | /** 8 | * 配置 9 | */ 10 | public interface ConfigDao extends BaseMapper { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/annotation/IgnoreAuth.java: -------------------------------------------------------------------------------- 1 | package com.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 忽略Token验证 7 | */ 8 | @Target(ElementType.METHOD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface IgnoreAuth { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/java/com/SpringbootSchemaApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootSchemaApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/config/AlipayConfig.java: -------------------------------------------------------------------------------- 1 | package com.config; 2 | 3 | import java.io.FileWriter; 4 | import java.io.IOException; 5 | 6 | /* * 7 | *类名:AlipayConfig 8 | *功能:基础配置类 9 | *详细:设置帐户有关信息及返回路径 10 | *修改日期:2017-04-05 11 | *说明: 12 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 13 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 14 | */ 15 | 16 | public class AlipayConfig { 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/com/utils/MD5Util.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import cn.hutool.crypto.digest.DigestUtil; 4 | 5 | public class MD5Util { 6 | 7 | /** 8 | * @param text明文 9 | * @param key密钥 10 | * @return 密文 11 | */ 12 | // 带秘钥加密 13 | public static String md5(String text) { 14 | // 加密后的字符串 15 | String md5str = DigestUtil.md5Hex(text); 16 | return md5str; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/annotation/LoginUser.java: -------------------------------------------------------------------------------- 1 | package com.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 登录用户信息 10 | */ 11 | @Target(ElementType.PARAMETER) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface LoginUser { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/annotation/APPLoginUser.java: -------------------------------------------------------------------------------- 1 | package com.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 登录用户信息 10 | */ 11 | @Target(ElementType.PARAMETER) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface APPLoginUser { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TokenDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UsersDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/java/com/service/ConfigService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.Map; 5 | 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.service.IService; 8 | import com.entity.ConfigEntity; 9 | import com.utils.PageUtils; 10 | 11 | 12 | /** 13 | * 系统用户 14 | */ 15 | public interface ConfigService extends IService { 16 | PageUtils queryPage(Map params,Wrapper wrapper); 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /src/main/java/com/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | 2 | package com.config; 3 | 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import com.baomidou.mybatisplus.mapper.MetaObjectHandler; 8 | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; 9 | 10 | /** 11 | * mybatis-plus配置 12 | */ 13 | @Configuration 14 | public class MybatisPlusConfig { 15 | 16 | /** 17 | * 分页插件 18 | */ 19 | @Bean 20 | public PaginationInterceptor paginationInterceptor() { 21 | return new PaginationInterceptor(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/dao/UsersDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import java.util.List; 5 | 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import com.baomidou.mybatisplus.mapper.BaseMapper; 9 | import com.baomidou.mybatisplus.mapper.Wrapper; 10 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 11 | import com.entity.UsersEntity; 12 | 13 | /** 14 | * 用户 15 | */ 16 | public interface UsersDao extends BaseMapper { 17 | 18 | List selectListView(@Param("ew") Wrapper wrapper); 19 | 20 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/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/entity/vo/JingdianfenleiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.JingdianfenleiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 景点分类 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public class JingdianfenleiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/service/UsersService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import com.baomidou.mybatisplus.mapper.Wrapper; 10 | import com.baomidou.mybatisplus.service.IService; 11 | import com.entity.UsersEntity; 12 | import com.utils.PageUtils; 13 | 14 | 15 | /** 16 | * 系统用户 17 | */ 18 | public interface UsersService extends IService { 19 | PageUtils queryPage(Map params); 20 | 21 | List selectListView(Wrapper wrapper); 22 | 23 | PageUtils queryPage(Map params,Wrapper wrapper); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/service/CommonService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public interface CommonService { 7 | List getOption(Map params); 8 | 9 | Map getFollowByOption(Map params); 10 | 11 | void sh(Map params); 12 | 13 | int remindCount(Map params); 14 | 15 | Map selectCal(Map params); 16 | 17 | List> selectGroup(Map params); 18 | 19 | List> selectValue(Map params); 20 | 21 | List> selectTimeStatValue(Map params); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/JingdianfenleiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.JingdianfenleiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 景点分类 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public class JingdianfenleiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/utils/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.File; 5 | import java.io.FileInputStream; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | /** 10 | * 类说明 : 11 | */ 12 | 13 | public class FileUtil { 14 | public static byte[] FileToByte(File file) throws IOException { 15 | // 将数据转为流 16 | @SuppressWarnings("resource") 17 | InputStream content = new FileInputStream(file); 18 | ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); 19 | byte[] buff = new byte[100]; 20 | int rc = 0; 21 | while ((rc = content.read(buff, 0, 100)) > 0) { 22 | swapStream.write(buff, 0, rc); 23 | } 24 | // 获得二进制数组 25 | return swapStream.toByteArray(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/service/TokenService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.service.IService; 9 | import com.entity.TokenEntity; 10 | import com.utils.PageUtils; 11 | 12 | 13 | /** 14 | * token 15 | */ 16 | public interface TokenService extends IService { 17 | PageUtils queryPage(Map params); 18 | 19 | List selectListView(Wrapper wrapper); 20 | 21 | PageUtils queryPage(Map params,Wrapper wrapper); 22 | 23 | String generateToken(Long userid,String username,String tableName, String role); 24 | 25 | TokenEntity getTokenEntity(String token); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/dao/CommonDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | /** 8 | * 通用接口 9 | */ 10 | public interface CommonDao{ 11 | List getOption(Map params); 12 | 13 | Map getFollowByOption(Map params); 14 | 15 | List getFollowByOption2(Map params); 16 | 17 | void sh(Map params); 18 | 19 | int remindCount(Map params); 20 | 21 | Map selectCal(Map params); 22 | 23 | List> selectGroup(Map params); 24 | 25 | List> selectValue(Map params); 26 | 27 | List> selectTimeStatValue(Map params); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/SpringbootSchemaApplication.java: -------------------------------------------------------------------------------- 1 | package com; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.builder.SpringApplicationBuilder; 7 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 8 | 9 | @SpringBootApplication 10 | @MapperScan(basePackages = {"com.dao"}) 11 | public class SpringbootSchemaApplication extends SpringBootServletInitializer{ 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(SpringbootSchemaApplication.class, args); 15 | } 16 | 17 | @Override 18 | protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) { 19 | return applicationBuilder.sources(SpringbootSchemaApplication.class); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/YonghuView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.YonghuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 用户 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-03-15 11:57:16 19 | */ 20 | @TableName("yonghu") 21 | public class YonghuView extends YonghuEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public YonghuView(){ 25 | } 26 | 27 | public YonghuView(YonghuEntity yonghuEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, yonghuEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/AboutusView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.AboutusEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 关于我们 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-03-15 11:57:16 19 | */ 20 | @TableName("aboutus") 21 | public class AboutusView extends AboutusEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public AboutusView(){ 25 | } 26 | 27 | public AboutusView(AboutusEntity aboutusEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, aboutusEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/TesemeishiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.TesemeishiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 特色美食 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-03-15 11:57:16 19 | */ 20 | @TableName("tesemeishi") 21 | public class TesemeishiView extends TesemeishiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public TesemeishiView(){ 25 | } 26 | 27 | public TesemeishiView(TesemeishiEntity tesemeishiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, tesemeishiEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/utils/JQPageInfo.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | public class JQPageInfo{ 4 | private Integer page; 5 | 6 | private Integer limit; 7 | 8 | private String sidx; 9 | 10 | private String order; 11 | 12 | private Integer offset; 13 | 14 | public Integer getPage() { 15 | return page; 16 | } 17 | 18 | public void setPage(Integer page) { 19 | this.page = page; 20 | } 21 | 22 | public Integer getLimit() { 23 | return limit; 24 | } 25 | 26 | public void setLimit(Integer limit) { 27 | this.limit = limit; 28 | } 29 | 30 | public String getSidx() { 31 | return sidx; 32 | } 33 | 34 | public void setSidx(String sidx) { 35 | this.sidx = sidx; 36 | } 37 | 38 | public String getOrder() { 39 | return order; 40 | } 41 | 42 | public void setOrder(String order) { 43 | this.order = order; 44 | } 45 | 46 | public Integer getOffset() { 47 | return offset; 48 | } 49 | 50 | public void setOffset(Integer offset) { 51 | this.offset = offset; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/JiudianxinxiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.JiudianxinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 酒店信息 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-03-15 11:57:16 19 | */ 20 | @TableName("jiudianxinxi") 21 | public class JiudianxinxiView extends JiudianxinxiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public JiudianxinxiView(){ 25 | } 26 | 27 | public JiudianxinxiView(JiudianxinxiEntity jiudianxinxiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, jiudianxinxiEntity); 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/LvyoujingdianView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.LvyoujingdianEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 旅游景点 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-03-15 11:57:16 19 | */ 20 | @TableName("lvyoujingdian") 21 | public class LvyoujingdianView extends LvyoujingdianEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public LvyoujingdianView(){ 25 | } 26 | 27 | public LvyoujingdianView(LvyoujingdianEntity lvyoujingdianEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, lvyoujingdianEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/EIException.java: -------------------------------------------------------------------------------- 1 | 2 | package com.entity; 3 | 4 | /** 5 | * 自定义异常 6 | */ 7 | public class EIException extends RuntimeException { 8 | private static final long serialVersionUID = 1L; 9 | 10 | private String msg; 11 | private int code = 500; 12 | 13 | public EIException(String msg) { 14 | super(msg); 15 | this.msg = msg; 16 | } 17 | 18 | public EIException(String msg, Throwable e) { 19 | super(msg, e); 20 | this.msg = msg; 21 | } 22 | 23 | public EIException(String msg, int code) { 24 | super(msg); 25 | this.msg = msg; 26 | this.code = code; 27 | } 28 | 29 | public EIException(String msg, int code, Throwable e) { 30 | super(msg, e); 31 | this.msg = msg; 32 | this.code = code; 33 | } 34 | 35 | public String getMsg() { 36 | return msg; 37 | } 38 | 39 | public void setMsg(String msg) { 40 | this.msg = msg; 41 | } 42 | 43 | public int getCode() { 44 | return code; 45 | } 46 | 47 | public void setCode(int code) { 48 | this.code = code; 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/JingdianfenleiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.JingdianfenleiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 景点分类 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2023-03-15 11:57:16 19 | */ 20 | @TableName("jingdianfenlei") 21 | public class JingdianfenleiView extends JingdianfenleiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public JingdianfenleiView(){ 25 | } 26 | 27 | public JingdianfenleiView(JingdianfenleiEntity jingdianfenleiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, jingdianfenleiEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/utils/R.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * 返回数据 8 | */ 9 | public class R extends HashMap { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public R() { 13 | put("code", 0); 14 | } 15 | 16 | public static R error() { 17 | return error(500, "未知异常,请联系管理员"); 18 | } 19 | 20 | public static R error(String msg) { 21 | return error(500, msg); 22 | } 23 | 24 | public static R error(int code, String msg) { 25 | R r = new R(); 26 | r.put("code", code); 27 | r.put("msg", msg); 28 | return r; 29 | } 30 | 31 | public static R ok(String msg) { 32 | R r = new R(); 33 | r.put("msg", msg); 34 | return r; 35 | } 36 | 37 | public static R ok(Map map) { 38 | R r = new R(); 39 | r.putAll(map); 40 | return r; 41 | } 42 | 43 | public static R ok() { 44 | return new R(); 45 | } 46 | 47 | public R put(String key, Object value) { 48 | super.put(key, value); 49 | return this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ConfigServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.Map; 6 | 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 10 | import com.baomidou.mybatisplus.mapper.Wrapper; 11 | import com.baomidou.mybatisplus.plugins.Page; 12 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 13 | import com.dao.ConfigDao; 14 | import com.entity.ConfigEntity; 15 | import com.service.ConfigService; 16 | import com.utils.PageUtils; 17 | import com.utils.Query; 18 | 19 | 20 | /** 21 | * 系统用户 22 | */ 23 | @Service("configService") 24 | public class ConfigServiceImpl extends ServiceImpl implements ConfigService { 25 | @Override 26 | public PageUtils queryPage(Map params, Wrapper wrapper) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | wrapper 30 | ); 31 | return new PageUtils(page); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/entity/ConfigEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableId; 6 | import com.baomidou.mybatisplus.annotations.TableName; 7 | import com.baomidou.mybatisplus.enums.IdType; 8 | 9 | /** 10 | * 类说明 : 11 | */ 12 | @TableName("config") 13 | public class ConfigEntity implements Serializable{ 14 | private static final long serialVersionUID = 1L; 15 | 16 | @TableId(type = IdType.AUTO) 17 | private Long id; 18 | 19 | /** 20 | * key 21 | */ 22 | private String name; 23 | 24 | /** 25 | * value 26 | */ 27 | private String value; 28 | 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | public void setId(Long id) { 34 | this.id = id; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | public String getValue() { 46 | return value; 47 | } 48 | 49 | public void setValue(String value) { 50 | this.value = value; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/dao/YonghuDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.YonghuEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.YonghuVO; 12 | import com.entity.view.YonghuView; 13 | 14 | 15 | /** 16 | * 用户 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public interface YonghuDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | YonghuVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | YonghuView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dao/AboutusDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.AboutusEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.AboutusVO; 12 | import com.entity.view.AboutusView; 13 | 14 | 15 | /** 16 | * 关于我们 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public interface AboutusDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | AboutusVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | AboutusView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/service/YonghuService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.YonghuEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.YonghuVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.YonghuView; 12 | 13 | 14 | /** 15 | * 用户 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public interface YonghuService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | YonghuVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | YonghuView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/service/AboutusService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.AboutusEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.AboutusVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.AboutusView; 12 | 13 | 14 | /** 15 | * 关于我们 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public interface AboutusService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | AboutusVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | AboutusView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/dao/TesemeishiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.TesemeishiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.TesemeishiVO; 12 | import com.entity.view.TesemeishiView; 13 | 14 | 15 | /** 16 | * 特色美食 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public interface TesemeishiDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | TesemeishiVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | TesemeishiView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/utils/SQLFilter.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | import com.entity.EIException; 7 | 8 | /** 9 | * SQL过滤 10 | */ 11 | public class SQLFilter { 12 | 13 | /** 14 | * SQL注入过滤 15 | * @param str 待验证的字符串 16 | */ 17 | public static String sqlInject(String str){ 18 | if(StringUtils.isBlank(str)){ 19 | return null; 20 | } 21 | //去掉'|"|;|\字符 22 | str = StringUtils.replace(str, "'", ""); 23 | str = StringUtils.replace(str, "\"", ""); 24 | str = StringUtils.replace(str, ";", ""); 25 | str = StringUtils.replace(str, "\\", ""); 26 | 27 | //转换成小写 28 | str = str.toLowerCase(); 29 | 30 | //非法字符 31 | String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"}; 32 | 33 | //判断是否包含非法字符 34 | for(String keyword : keywords){ 35 | if(str.indexOf(keyword) != -1){ 36 | throw new EIException("包含非法字符"); 37 | } 38 | } 39 | 40 | return str; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/service/TesemeishiService.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.TesemeishiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.TesemeishiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.TesemeishiView; 12 | 13 | 14 | /** 15 | * 特色美食 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public interface TesemeishiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | TesemeishiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | TesemeishiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/dao/JiudianxinxiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.JiudianxinxiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.JiudianxinxiVO; 12 | import com.entity.view.JiudianxinxiView; 13 | 14 | 15 | /** 16 | * 酒店信息 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public interface JiudianxinxiDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | JiudianxinxiVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | JiudianxinxiView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /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/dao/LvyoujingdianDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.LvyoujingdianEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.LvyoujingdianVO; 12 | import com.entity.view.LvyoujingdianView; 13 | 14 | 15 | /** 16 | * 旅游景点 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public interface LvyoujingdianDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | LvyoujingdianVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | LvyoujingdianView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/service/JiudianxinxiService.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.JiudianxinxiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.JiudianxinxiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.JiudianxinxiView; 12 | 13 | 14 | /** 15 | * 酒店信息 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public interface JiudianxinxiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | JiudianxinxiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | JiudianxinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/dao/JingdianfenleiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.JingdianfenleiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 9 | 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.vo.JingdianfenleiVO; 12 | import com.entity.view.JingdianfenleiView; 13 | 14 | 15 | /** 16 | * 景点分类 17 | * 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public interface JingdianfenleiDao extends BaseMapper { 23 | 24 | List selectListVO(@Param("ew") Wrapper wrapper); 25 | 26 | JingdianfenleiVO selectVO(@Param("ew") Wrapper wrapper); 27 | 28 | List selectListView(@Param("ew") Wrapper wrapper); 29 | 30 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 31 | 32 | JingdianfenleiView selectView(@Param("ew") Wrapper wrapper); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/service/LvyoujingdianService.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.LvyoujingdianEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.LvyoujingdianVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.LvyoujingdianView; 12 | 13 | 14 | /** 15 | * 旅游景点 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public interface LvyoujingdianService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | LvyoujingdianVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | LvyoujingdianView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/utils/ValidatorUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | 5 | import java.util.Set; 6 | 7 | import javax.validation.ConstraintViolation; 8 | import javax.validation.Validation; 9 | import javax.validation.Validator; 10 | 11 | import com.entity.EIException; 12 | 13 | /** 14 | * hibernate-validator校验工具类 15 | */ 16 | public class ValidatorUtils { 17 | private static Validator validator; 18 | 19 | static { 20 | validator = Validation.buildDefaultValidatorFactory().getValidator(); 21 | } 22 | 23 | /** 24 | * 校验对象 25 | * @param object 待校验对象 26 | * @param groups 待校验的组 27 | * @throws EIException 校验不通过,则报EIException异常 28 | */ 29 | public static void validateEntity(Object object, Class... groups) 30 | throws EIException { 31 | Set> constraintViolations = validator.validate(object, groups); 32 | if (!constraintViolations.isEmpty()) { 33 | ConstraintViolation constraint = (ConstraintViolation)constraintViolations.iterator().next(); 34 | throw new EIException(constraint.getMessage()); 35 | } 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/service/JingdianfenleiService.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.JingdianfenleiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.JingdianfenleiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.JingdianfenleiView; 12 | 13 | 14 | /** 15 | * 景点分类 16 | * 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public interface JingdianfenleiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | JingdianfenleiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | JingdianfenleiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | 36 | } 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/resources/mapper/JingdianfenleiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 22 | 23 | 29 | 30 | 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 | 基于Spring Boot框架实现的喀什旅游网站,系统包含两种角色:管理员、用户主要功能如下。 12 | ### 【用户功能】 13 | 14 | 系统首页:浏览喀什旅游网站信息。 15 | 个人中心:管理个人信息、查看订单记录等。 16 | 旅游景点管理:浏览、搜索和了解各个旅游景点的详细信息。 17 | 酒店信息管理:查看喀什地区的酒店信息,价格、设施等。 18 | 特色美食管理:了解和搜索当地的特色美食信息。 19 | 20 | ### 【管理员功能】 21 | 22 | 系统首页:查看喀什旅游网站整体概况。 23 | 个人中心:管理个人信息。 24 | 用户管理:审核和管理注册用户的信息。 25 | 景点分类管理:管理旅游景点的分类信息。 26 | 旅游景点管理:监管和管理旅游景点的详细信息。 27 | 酒店信息管理:管理酒店的基本信息,价格、房型等。 28 | 特色美食管理:管理特色美食的信息,推荐、介绍等。 29 | 30 | 31 | 32 | 33 | 34 | 35 | 二、项目技术 36 | --- 37 | - 编程语言:Java 38 | - 数据库:MySQL 39 | - 项目管理工具:Maven 40 | - 前端技术:VUE、HTML、Jquery、Bootstrap 41 | - 后端技术:Spring、SpringMVC、MyBatis 42 | 43 | 三、运行环境 44 | --- 45 | - 操作系统:Windows、macOS都可以 46 | - JDK版本:JDK1.8以上都可以 47 | - 开发工具:IDEA、Ecplise、Myecplise都可以 48 | - 数据库: MySQL5.7以上都可以 49 | - Tomcat:任意版本都可以 50 | - Maven:任意版本都可以 51 | 52 | 四、运行截图 53 | --- 54 | 55 | ### 程序截图: 56 | ![image/1.png](image/1.png) 57 | ![image/1.png](image/2.png) 58 | ![image/1.png](image/3.png) 59 | ![image/1.png](image/4.png) 60 | ![image/1.png](image/5.png) 61 | ![image/1.png](image/6.png) 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/main/resources/mapper/AboutusDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 27 | 28 | 34 | 35 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/main/resources/mapper/YonghuDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 27 | 28 | 34 | 35 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/entity/UsersEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | import com.baomidou.mybatisplus.annotations.TableId; 7 | import com.baomidou.mybatisplus.annotations.TableName; 8 | import com.baomidou.mybatisplus.enums.IdType; 9 | 10 | /** 11 | * 用户 12 | */ 13 | @TableName("users") 14 | public class UsersEntity implements Serializable { 15 | private static final long serialVersionUID = 1L; 16 | 17 | @TableId(type = IdType.AUTO) 18 | private Long id; 19 | 20 | /** 21 | * 用户账号 22 | */ 23 | private String username; 24 | 25 | /** 26 | * 密码 27 | */ 28 | private String password; 29 | 30 | /** 31 | * 用户类型 32 | */ 33 | private String role; 34 | 35 | private Date addtime; 36 | 37 | public String getUsername() { 38 | return username; 39 | } 40 | 41 | public void setUsername(String username) { 42 | this.username = username; 43 | } 44 | 45 | public String getPassword() { 46 | return password; 47 | } 48 | 49 | public void setPassword(String password) { 50 | this.password = password; 51 | } 52 | 53 | public String getRole() { 54 | return role; 55 | } 56 | 57 | public void setRole(String role) { 58 | this.role = role; 59 | } 60 | 61 | public Date getAddtime() { 62 | return addtime; 63 | } 64 | 65 | public void setAddtime(Date addtime) { 66 | this.addtime = addtime; 67 | } 68 | 69 | public Long getId() { 70 | return id; 71 | } 72 | 73 | public void setId(Long id) { 74 | this.id = id; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/UsersServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 11 | import com.baomidou.mybatisplus.mapper.Wrapper; 12 | import com.baomidou.mybatisplus.plugins.Page; 13 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 14 | import com.dao.UsersDao; 15 | import com.entity.UsersEntity; 16 | import com.service.UsersService; 17 | import com.utils.PageUtils; 18 | import com.utils.Query; 19 | 20 | 21 | /** 22 | * 系统用户 23 | */ 24 | @Service("usersService") 25 | public class UsersServiceImpl extends ServiceImpl implements UsersService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | Page page = this.selectPage( 30 | new Query(params).getPage(), 31 | new EntityWrapper() 32 | ); 33 | return new PageUtils(page); 34 | } 35 | 36 | @Override 37 | public List selectListView(Wrapper wrapper) { 38 | return baseMapper.selectListView(wrapper); 39 | } 40 | 41 | @Override 42 | public PageUtils queryPage(Map params, 43 | Wrapper wrapper) { 44 | Page page =new Query(params).getPage(); 45 | page.setRecords(baseMapper.selectListView(page,wrapper)); 46 | PageUtils pageUtil = new PageUtils(page); 47 | return pageUtil; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/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/service/impl/CommonServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.dao.CommonDao; 12 | import com.service.CommonService; 13 | 14 | 15 | /** 16 | * 系统用户 17 | */ 18 | @Service("commonService") 19 | public class CommonServiceImpl implements CommonService { 20 | 21 | @Autowired 22 | private CommonDao commonDao; 23 | 24 | @Override 25 | public List getOption(Map params) { 26 | return commonDao.getOption(params); 27 | } 28 | 29 | @Override 30 | public Map getFollowByOption(Map params) { 31 | return commonDao.getFollowByOption(params); 32 | } 33 | 34 | @Override 35 | public void sh(Map params) { 36 | commonDao.sh(params); 37 | } 38 | 39 | @Override 40 | public int remindCount(Map params) { 41 | return commonDao.remindCount(params); 42 | } 43 | 44 | @Override 45 | public Map selectCal(Map params) { 46 | return commonDao.selectCal(params); 47 | } 48 | 49 | @Override 50 | public List> selectGroup(Map params) { 51 | return commonDao.selectGroup(params); 52 | } 53 | 54 | @Override 55 | public List> selectValue(Map params) { 56 | return commonDao.selectValue(params); 57 | } 58 | 59 | @Override 60 | public List> selectTimeStatValue(Map params) { 61 | return commonDao.selectTimeStatValue(params); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TesemeishiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 25 | 30 | 31 | 37 | 38 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/resources/mapper/JiudianxinxiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | 29 | 30 | 36 | 37 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | tomcat: 4 | uri-encoding: UTF-8 5 | port: 8080 6 | servlet: 7 | context-path: /springboothw31x 8 | 9 | 10 | spring: 11 | datasource: 12 | driverClassName: com.mysql.cj.jdbc.Driver 13 | url: jdbc:mysql://127.0.0.1:3306/springboothw31x?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8 14 | username: root 15 | password: 123456 16 | 17 | # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver 18 | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=springboothw31x 19 | # username: sa 20 | # password: 123456 21 | 22 | servlet: 23 | multipart: 24 | max-file-size: 300MB 25 | max-request-size: 300MB 26 | resources: 27 | static-locations: classpath:static/,file:static/ 28 | 29 | #mybatis 30 | mybatis-plus: 31 | mapper-locations: classpath*:mapper/*.xml 32 | #实体扫描,多个package用逗号或者分号分隔 33 | typeAliasesPackage: com.entity 34 | global-config: 35 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 36 | id-type: 1 37 | #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" 38 | field-strategy: 1 39 | #驼峰下划线转换 40 | db-column-underline: true 41 | #刷新mapper 调试神器 42 | refresh-mapper: true 43 | #逻辑删除配置 44 | logic-delete-value: -1 45 | logic-not-delete-value: 0 46 | #自定义SQL注入器 47 | sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector 48 | configuration: 49 | map-underscore-to-camel-case: true 50 | cache-enabled: false 51 | call-setters-on-nulls: true 52 | #springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other) 53 | jdbc-type-for-null: 'null' 54 | -------------------------------------------------------------------------------- /src/main/resources/mapper/LvyoujingdianDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 25 | 30 | 31 | 37 | 38 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/YonghuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.YonghuDao; 16 | import com.entity.YonghuEntity; 17 | import com.service.YonghuService; 18 | import com.entity.vo.YonghuVO; 19 | import com.entity.view.YonghuView; 20 | 21 | @Service("yonghuService") 22 | public class YonghuServiceImpl extends ServiceImpl implements YonghuService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public YonghuVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public YonghuView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/AboutusServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.AboutusDao; 16 | import com.entity.AboutusEntity; 17 | import com.service.AboutusService; 18 | import com.entity.vo.AboutusVO; 19 | import com.entity.view.AboutusView; 20 | 21 | @Service("aboutusService") 22 | public class AboutusServiceImpl extends ServiceImpl implements AboutusService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public AboutusVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public AboutusView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/TesemeishiServiceImpl.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.TesemeishiDao; 16 | import com.entity.TesemeishiEntity; 17 | import com.service.TesemeishiService; 18 | import com.entity.vo.TesemeishiVO; 19 | import com.entity.view.TesemeishiView; 20 | 21 | @Service("tesemeishiService") 22 | public class TesemeishiServiceImpl extends ServiceImpl implements TesemeishiService { 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 TesemeishiVO 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 TesemeishiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/JiudianxinxiServiceImpl.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.JiudianxinxiDao; 16 | import com.entity.JiudianxinxiEntity; 17 | import com.service.JiudianxinxiService; 18 | import com.entity.vo.JiudianxinxiVO; 19 | import com.entity.view.JiudianxinxiView; 20 | 21 | @Service("jiudianxinxiService") 22 | public class JiudianxinxiServiceImpl extends ServiceImpl implements JiudianxinxiService { 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 JiudianxinxiVO 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 JiudianxinxiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/LvyoujingdianServiceImpl.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.LvyoujingdianDao; 16 | import com.entity.LvyoujingdianEntity; 17 | import com.service.LvyoujingdianService; 18 | import com.entity.vo.LvyoujingdianVO; 19 | import com.entity.view.LvyoujingdianView; 20 | 21 | @Service("lvyoujingdianService") 22 | public class LvyoujingdianServiceImpl extends ServiceImpl implements LvyoujingdianService { 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 LvyoujingdianVO 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 LvyoujingdianView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/JingdianfenleiServiceImpl.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.JingdianfenleiDao; 16 | import com.entity.JingdianfenleiEntity; 17 | import com.service.JingdianfenleiService; 18 | import com.entity.vo.JingdianfenleiVO; 19 | import com.entity.view.JingdianfenleiView; 20 | 21 | @Service("jingdianfenleiService") 22 | public class JingdianfenleiServiceImpl extends ServiceImpl implements JingdianfenleiService { 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 JingdianfenleiVO 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 JingdianfenleiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /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/entity/JingdianfenleiEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 景点分类 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-03-15 11:57:16 30 | */ 31 | @TableName("jingdianfenlei") 32 | public class JingdianfenleiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public JingdianfenleiEntity() { 37 | 38 | } 39 | 40 | public JingdianfenleiEntity(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 jingdianfenlei; 59 | 60 | 61 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 62 | @DateTimeFormat 63 | private Date addtime; 64 | 65 | public Date getAddtime() { 66 | return addtime; 67 | } 68 | public void setAddtime(Date addtime) { 69 | this.addtime = addtime; 70 | } 71 | 72 | public Long getId() { 73 | return id; 74 | } 75 | 76 | public void setId(Long id) { 77 | this.id = id; 78 | } 79 | /** 80 | * 设置:景点分类 81 | */ 82 | public void setJingdianfenlei(String jingdianfenlei) { 83 | this.jingdianfenlei = jingdianfenlei; 84 | } 85 | /** 86 | * 获取:景点分类 87 | */ 88 | public String getJingdianfenlei() { 89 | return jingdianfenlei; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/AboutusVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.AboutusEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 关于我们 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public class AboutusVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 副标题 27 | */ 28 | 29 | private String subtitle; 30 | 31 | /** 32 | * 内容 33 | */ 34 | 35 | private String content; 36 | 37 | /** 38 | * 图片1 39 | */ 40 | 41 | private String picture1; 42 | 43 | /** 44 | * 图片2 45 | */ 46 | 47 | private String picture2; 48 | 49 | /** 50 | * 图片3 51 | */ 52 | 53 | private String picture3; 54 | 55 | 56 | /** 57 | * 设置:副标题 58 | */ 59 | 60 | public void setSubtitle(String subtitle) { 61 | this.subtitle = subtitle; 62 | } 63 | 64 | /** 65 | * 获取:副标题 66 | */ 67 | public String getSubtitle() { 68 | return subtitle; 69 | } 70 | 71 | 72 | /** 73 | * 设置:内容 74 | */ 75 | 76 | public void setContent(String content) { 77 | this.content = content; 78 | } 79 | 80 | /** 81 | * 获取:内容 82 | */ 83 | public String getContent() { 84 | return content; 85 | } 86 | 87 | 88 | /** 89 | * 设置:图片1 90 | */ 91 | 92 | public void setPicture1(String picture1) { 93 | this.picture1 = picture1; 94 | } 95 | 96 | /** 97 | * 获取:图片1 98 | */ 99 | public String getPicture1() { 100 | return picture1; 101 | } 102 | 103 | 104 | /** 105 | * 设置:图片2 106 | */ 107 | 108 | public void setPicture2(String picture2) { 109 | this.picture2 = picture2; 110 | } 111 | 112 | /** 113 | * 获取:图片2 114 | */ 115 | public String getPicture2() { 116 | return picture2; 117 | } 118 | 119 | 120 | /** 121 | * 设置:图片3 122 | */ 123 | 124 | public void setPicture3(String picture3) { 125 | this.picture3 = picture3; 126 | } 127 | 128 | /** 129 | * 获取:图片3 130 | */ 131 | public String getPicture3() { 132 | return picture3; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/YonghuVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.YonghuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 用户 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public class YonghuVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 用户姓名 27 | */ 28 | 29 | private String yonghuxingming; 30 | 31 | /** 32 | * 密码 33 | */ 34 | 35 | private String mima; 36 | 37 | /** 38 | * 性别 39 | */ 40 | 41 | private String xingbie; 42 | 43 | /** 44 | * 头像 45 | */ 46 | 47 | private String touxiang; 48 | 49 | /** 50 | * 联系电话 51 | */ 52 | 53 | private String lianxidianhua; 54 | 55 | 56 | /** 57 | * 设置:用户姓名 58 | */ 59 | 60 | public void setYonghuxingming(String yonghuxingming) { 61 | this.yonghuxingming = yonghuxingming; 62 | } 63 | 64 | /** 65 | * 获取:用户姓名 66 | */ 67 | public String getYonghuxingming() { 68 | return yonghuxingming; 69 | } 70 | 71 | 72 | /** 73 | * 设置:密码 74 | */ 75 | 76 | public void setMima(String mima) { 77 | this.mima = mima; 78 | } 79 | 80 | /** 81 | * 获取:密码 82 | */ 83 | public String getMima() { 84 | return mima; 85 | } 86 | 87 | 88 | /** 89 | * 设置:性别 90 | */ 91 | 92 | public void setXingbie(String xingbie) { 93 | this.xingbie = xingbie; 94 | } 95 | 96 | /** 97 | * 获取:性别 98 | */ 99 | public String getXingbie() { 100 | return xingbie; 101 | } 102 | 103 | 104 | /** 105 | * 设置:头像 106 | */ 107 | 108 | public void setTouxiang(String touxiang) { 109 | this.touxiang = touxiang; 110 | } 111 | 112 | /** 113 | * 获取:头像 114 | */ 115 | public String getTouxiang() { 116 | return touxiang; 117 | } 118 | 119 | 120 | /** 121 | * 设置:联系电话 122 | */ 123 | 124 | public void setLianxidianhua(String lianxidianhua) { 125 | this.lianxidianhua = lianxidianhua; 126 | } 127 | 128 | /** 129 | * 获取:联系电话 130 | */ 131 | public String getLianxidianhua() { 132 | return lianxidianhua; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/AboutusModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.AboutusEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 关于我们 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public class AboutusModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 副标题 28 | */ 29 | 30 | private String subtitle; 31 | 32 | /** 33 | * 内容 34 | */ 35 | 36 | private String content; 37 | 38 | /** 39 | * 图片1 40 | */ 41 | 42 | private String picture1; 43 | 44 | /** 45 | * 图片2 46 | */ 47 | 48 | private String picture2; 49 | 50 | /** 51 | * 图片3 52 | */ 53 | 54 | private String picture3; 55 | 56 | 57 | /** 58 | * 设置:副标题 59 | */ 60 | 61 | public void setSubtitle(String subtitle) { 62 | this.subtitle = subtitle; 63 | } 64 | 65 | /** 66 | * 获取:副标题 67 | */ 68 | public String getSubtitle() { 69 | return subtitle; 70 | } 71 | 72 | 73 | /** 74 | * 设置:内容 75 | */ 76 | 77 | public void setContent(String content) { 78 | this.content = content; 79 | } 80 | 81 | /** 82 | * 获取:内容 83 | */ 84 | public String getContent() { 85 | return content; 86 | } 87 | 88 | 89 | /** 90 | * 设置:图片1 91 | */ 92 | 93 | public void setPicture1(String picture1) { 94 | this.picture1 = picture1; 95 | } 96 | 97 | /** 98 | * 获取:图片1 99 | */ 100 | public String getPicture1() { 101 | return picture1; 102 | } 103 | 104 | 105 | /** 106 | * 设置:图片2 107 | */ 108 | 109 | public void setPicture2(String picture2) { 110 | this.picture2 = picture2; 111 | } 112 | 113 | /** 114 | * 获取:图片2 115 | */ 116 | public String getPicture2() { 117 | return picture2; 118 | } 119 | 120 | 121 | /** 122 | * 设置:图片3 123 | */ 124 | 125 | public void setPicture3(String picture3) { 126 | this.picture3 = picture3; 127 | } 128 | 129 | /** 130 | * 获取:图片3 131 | */ 132 | public String getPicture3() { 133 | return picture3; 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/YonghuModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.YonghuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 用户 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public class YonghuModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 用户姓名 28 | */ 29 | 30 | private String yonghuxingming; 31 | 32 | /** 33 | * 密码 34 | */ 35 | 36 | private String mima; 37 | 38 | /** 39 | * 性别 40 | */ 41 | 42 | private String xingbie; 43 | 44 | /** 45 | * 头像 46 | */ 47 | 48 | private String touxiang; 49 | 50 | /** 51 | * 联系电话 52 | */ 53 | 54 | private String lianxidianhua; 55 | 56 | 57 | /** 58 | * 设置:用户姓名 59 | */ 60 | 61 | public void setYonghuxingming(String yonghuxingming) { 62 | this.yonghuxingming = yonghuxingming; 63 | } 64 | 65 | /** 66 | * 获取:用户姓名 67 | */ 68 | public String getYonghuxingming() { 69 | return yonghuxingming; 70 | } 71 | 72 | 73 | /** 74 | * 设置:密码 75 | */ 76 | 77 | public void setMima(String mima) { 78 | this.mima = mima; 79 | } 80 | 81 | /** 82 | * 获取:密码 83 | */ 84 | public String getMima() { 85 | return mima; 86 | } 87 | 88 | 89 | /** 90 | * 设置:性别 91 | */ 92 | 93 | public void setXingbie(String xingbie) { 94 | this.xingbie = xingbie; 95 | } 96 | 97 | /** 98 | * 获取:性别 99 | */ 100 | public String getXingbie() { 101 | return xingbie; 102 | } 103 | 104 | 105 | /** 106 | * 设置:头像 107 | */ 108 | 109 | public void setTouxiang(String touxiang) { 110 | this.touxiang = touxiang; 111 | } 112 | 113 | /** 114 | * 获取:头像 115 | */ 116 | public String getTouxiang() { 117 | return touxiang; 118 | } 119 | 120 | 121 | /** 122 | * 设置:联系电话 123 | */ 124 | 125 | public void setLianxidianhua(String lianxidianhua) { 126 | this.lianxidianhua = lianxidianhua; 127 | } 128 | 129 | /** 130 | * 获取:联系电话 131 | */ 132 | public String getLianxidianhua() { 133 | return lianxidianhua; 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/TokenServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.Calendar; 6 | import java.util.Date; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | import org.springframework.stereotype.Service; 11 | 12 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 13 | import com.baomidou.mybatisplus.mapper.Wrapper; 14 | import com.baomidou.mybatisplus.plugins.Page; 15 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 16 | import com.dao.TokenDao; 17 | import com.entity.TokenEntity; 18 | import com.entity.TokenEntity; 19 | import com.service.TokenService; 20 | import com.utils.CommonUtil; 21 | import com.utils.PageUtils; 22 | import com.utils.Query; 23 | 24 | 25 | /** 26 | * token 27 | */ 28 | @Service("tokenService") 29 | public class TokenServiceImpl extends ServiceImpl implements TokenService { 30 | 31 | @Override 32 | public PageUtils queryPage(Map params) { 33 | Page page = this.selectPage( 34 | new Query(params).getPage(), 35 | new EntityWrapper() 36 | ); 37 | return new PageUtils(page); 38 | } 39 | 40 | @Override 41 | public List selectListView(Wrapper wrapper) { 42 | return baseMapper.selectListView(wrapper); 43 | } 44 | 45 | @Override 46 | public PageUtils queryPage(Map params, 47 | Wrapper wrapper) { 48 | Page page =new Query(params).getPage(); 49 | page.setRecords(baseMapper.selectListView(page,wrapper)); 50 | PageUtils pageUtil = new PageUtils(page); 51 | return pageUtil; 52 | } 53 | 54 | @Override 55 | public String generateToken(Long userid,String username, String tableName, String role) { 56 | TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("userid", userid).eq("role", role)); 57 | String token = CommonUtil.getRandomString(32); 58 | Calendar cal = Calendar.getInstance(); 59 | cal.setTime(new Date()); 60 | cal.add(Calendar.HOUR_OF_DAY, 1); 61 | if(tokenEntity!=null) { 62 | tokenEntity.setToken(token); 63 | tokenEntity.setExpiratedtime(cal.getTime()); 64 | this.updateById(tokenEntity); 65 | } else { 66 | this.insert(new TokenEntity(userid,username, tableName, role, token, cal.getTime())); 67 | } 68 | return token; 69 | } 70 | 71 | @Override 72 | public TokenEntity getTokenEntity(String token) { 73 | TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("token", token)); 74 | if(tokenEntity == null || tokenEntity.getExpiratedtime().getTime() extends LinkedHashMap { 15 | private static final long serialVersionUID = 1L; 16 | /** 17 | * mybatis-plus分页参数 18 | */ 19 | private Page page; 20 | /** 21 | * 当前页码 22 | */ 23 | private int currPage = 1; 24 | /** 25 | * 每页条数 26 | */ 27 | private int limit = 10; 28 | 29 | public Query(JQPageInfo pageInfo) { 30 | //分页参数 31 | if(pageInfo.getPage()!= null){ 32 | currPage = pageInfo.getPage(); 33 | } 34 | if(pageInfo.getLimit()!= null){ 35 | limit = pageInfo.getLimit(); 36 | } 37 | 38 | 39 | //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) 40 | String sidx = SQLFilter.sqlInject(pageInfo.getSidx()); 41 | String order = SQLFilter.sqlInject(pageInfo.getOrder()); 42 | 43 | 44 | //mybatis-plus分页 45 | this.page = new Page<>(currPage, limit); 46 | 47 | //排序 48 | if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ 49 | this.page.setOrderByField(sidx); 50 | this.page.setAsc("ASC".equalsIgnoreCase(order)); 51 | } 52 | } 53 | 54 | 55 | public Query(Map params){ 56 | this.putAll(params); 57 | 58 | //分页参数 59 | if(params.get("page") != null){ 60 | currPage = Integer.parseInt((String)params.get("page")); 61 | } 62 | if(params.get("limit") != null){ 63 | limit = Integer.parseInt((String)params.get("limit")); 64 | } 65 | 66 | this.put("offset", (currPage - 1) * limit); 67 | this.put("page", currPage); 68 | this.put("limit", limit); 69 | 70 | //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) 71 | String sidx = SQLFilter.sqlInject((String)params.get("sidx")); 72 | String order = SQLFilter.sqlInject((String)params.get("order")); 73 | this.put("sidx", sidx); 74 | this.put("order", order); 75 | 76 | //mybatis-plus分页 77 | this.page = new Page<>(currPage, limit); 78 | 79 | //排序 80 | if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ 81 | this.page.setOrderByField(sidx); 82 | this.page.setAsc("ASC".equalsIgnoreCase(order)); 83 | } 84 | 85 | } 86 | 87 | public Page getPage() { 88 | return page; 89 | } 90 | 91 | public int getCurrPage() { 92 | return currPage; 93 | } 94 | 95 | public int getLimit() { 96 | return limit; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CommonDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 22 | 23 | 24 | UPDATE ${table} set sfsh=#{sfsh} where id=#{id} 25 | 26 | 27 | 47 | 48 | 51 | 52 | 55 | 56 | 59 | 60 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/JiudianxinxiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.JiudianxinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 酒店信息 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public class JiudianxinxiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 类别 27 | */ 28 | 29 | private String leibie; 30 | 31 | /** 32 | * 星级 33 | */ 34 | 35 | private String xingji; 36 | 37 | /** 38 | * 酒店图片 39 | */ 40 | 41 | private String jiudiantupian; 42 | 43 | /** 44 | * 酒店地址 45 | */ 46 | 47 | private String jiudiandizhi; 48 | 49 | /** 50 | * 房间类型 51 | */ 52 | 53 | private String fangjianleixing; 54 | 55 | /** 56 | * 联系电话 57 | */ 58 | 59 | private String lianxidianhua; 60 | 61 | /** 62 | * 酒店介绍 63 | */ 64 | 65 | private String jiudianjieshao; 66 | 67 | 68 | /** 69 | * 设置:类别 70 | */ 71 | 72 | public void setLeibie(String leibie) { 73 | this.leibie = leibie; 74 | } 75 | 76 | /** 77 | * 获取:类别 78 | */ 79 | public String getLeibie() { 80 | return leibie; 81 | } 82 | 83 | 84 | /** 85 | * 设置:星级 86 | */ 87 | 88 | public void setXingji(String xingji) { 89 | this.xingji = xingji; 90 | } 91 | 92 | /** 93 | * 获取:星级 94 | */ 95 | public String getXingji() { 96 | return xingji; 97 | } 98 | 99 | 100 | /** 101 | * 设置:酒店图片 102 | */ 103 | 104 | public void setJiudiantupian(String jiudiantupian) { 105 | this.jiudiantupian = jiudiantupian; 106 | } 107 | 108 | /** 109 | * 获取:酒店图片 110 | */ 111 | public String getJiudiantupian() { 112 | return jiudiantupian; 113 | } 114 | 115 | 116 | /** 117 | * 设置:酒店地址 118 | */ 119 | 120 | public void setJiudiandizhi(String jiudiandizhi) { 121 | this.jiudiandizhi = jiudiandizhi; 122 | } 123 | 124 | /** 125 | * 获取:酒店地址 126 | */ 127 | public String getJiudiandizhi() { 128 | return jiudiandizhi; 129 | } 130 | 131 | 132 | /** 133 | * 设置:房间类型 134 | */ 135 | 136 | public void setFangjianleixing(String fangjianleixing) { 137 | this.fangjianleixing = fangjianleixing; 138 | } 139 | 140 | /** 141 | * 获取:房间类型 142 | */ 143 | public String getFangjianleixing() { 144 | return fangjianleixing; 145 | } 146 | 147 | 148 | /** 149 | * 设置:联系电话 150 | */ 151 | 152 | public void setLianxidianhua(String lianxidianhua) { 153 | this.lianxidianhua = lianxidianhua; 154 | } 155 | 156 | /** 157 | * 获取:联系电话 158 | */ 159 | public String getLianxidianhua() { 160 | return lianxidianhua; 161 | } 162 | 163 | 164 | /** 165 | * 设置:酒店介绍 166 | */ 167 | 168 | public void setJiudianjieshao(String jiudianjieshao) { 169 | this.jiudianjieshao = jiudianjieshao; 170 | } 171 | 172 | /** 173 | * 获取:酒店介绍 174 | */ 175 | public String getJiudianjieshao() { 176 | return jiudianjieshao; 177 | } 178 | 179 | } 180 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/JiudianxinxiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.JiudianxinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 酒店信息 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public class JiudianxinxiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 类别 28 | */ 29 | 30 | private String leibie; 31 | 32 | /** 33 | * 星级 34 | */ 35 | 36 | private String xingji; 37 | 38 | /** 39 | * 酒店图片 40 | */ 41 | 42 | private String jiudiantupian; 43 | 44 | /** 45 | * 酒店地址 46 | */ 47 | 48 | private String jiudiandizhi; 49 | 50 | /** 51 | * 房间类型 52 | */ 53 | 54 | private String fangjianleixing; 55 | 56 | /** 57 | * 联系电话 58 | */ 59 | 60 | private String lianxidianhua; 61 | 62 | /** 63 | * 酒店介绍 64 | */ 65 | 66 | private String jiudianjieshao; 67 | 68 | 69 | /** 70 | * 设置:类别 71 | */ 72 | 73 | public void setLeibie(String leibie) { 74 | this.leibie = leibie; 75 | } 76 | 77 | /** 78 | * 获取:类别 79 | */ 80 | public String getLeibie() { 81 | return leibie; 82 | } 83 | 84 | 85 | /** 86 | * 设置:星级 87 | */ 88 | 89 | public void setXingji(String xingji) { 90 | this.xingji = xingji; 91 | } 92 | 93 | /** 94 | * 获取:星级 95 | */ 96 | public String getXingji() { 97 | return xingji; 98 | } 99 | 100 | 101 | /** 102 | * 设置:酒店图片 103 | */ 104 | 105 | public void setJiudiantupian(String jiudiantupian) { 106 | this.jiudiantupian = jiudiantupian; 107 | } 108 | 109 | /** 110 | * 获取:酒店图片 111 | */ 112 | public String getJiudiantupian() { 113 | return jiudiantupian; 114 | } 115 | 116 | 117 | /** 118 | * 设置:酒店地址 119 | */ 120 | 121 | public void setJiudiandizhi(String jiudiandizhi) { 122 | this.jiudiandizhi = jiudiandizhi; 123 | } 124 | 125 | /** 126 | * 获取:酒店地址 127 | */ 128 | public String getJiudiandizhi() { 129 | return jiudiandizhi; 130 | } 131 | 132 | 133 | /** 134 | * 设置:房间类型 135 | */ 136 | 137 | public void setFangjianleixing(String fangjianleixing) { 138 | this.fangjianleixing = fangjianleixing; 139 | } 140 | 141 | /** 142 | * 获取:房间类型 143 | */ 144 | public String getFangjianleixing() { 145 | return fangjianleixing; 146 | } 147 | 148 | 149 | /** 150 | * 设置:联系电话 151 | */ 152 | 153 | public void setLianxidianhua(String lianxidianhua) { 154 | this.lianxidianhua = lianxidianhua; 155 | } 156 | 157 | /** 158 | * 获取:联系电话 159 | */ 160 | public String getLianxidianhua() { 161 | return lianxidianhua; 162 | } 163 | 164 | 165 | /** 166 | * 设置:酒店介绍 167 | */ 168 | 169 | public void setJiudianjieshao(String jiudianjieshao) { 170 | this.jiudianjieshao = jiudianjieshao; 171 | } 172 | 173 | /** 174 | * 获取:酒店介绍 175 | */ 176 | public String getJiudianjieshao() { 177 | return jiudianjieshao; 178 | } 179 | 180 | } 181 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/TesemeishiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.TesemeishiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 特色美食 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public class TesemeishiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 美食类型 27 | */ 28 | 29 | private String meishileixing; 30 | 31 | /** 32 | * 图片 33 | */ 34 | 35 | private String tupian; 36 | 37 | /** 38 | * 口味 39 | */ 40 | 41 | private String kouwei; 42 | 43 | /** 44 | * 特色 45 | */ 46 | 47 | private String tese; 48 | 49 | /** 50 | * 城市 51 | */ 52 | 53 | private String chengshi; 54 | 55 | /** 56 | * 打卡地点 57 | */ 58 | 59 | private String dakadidian; 60 | 61 | /** 62 | * 人均消费 63 | */ 64 | 65 | private Float renjunxiaofei; 66 | 67 | /** 68 | * 详情 69 | */ 70 | 71 | private String xiangqing; 72 | 73 | 74 | /** 75 | * 设置:美食类型 76 | */ 77 | 78 | public void setMeishileixing(String meishileixing) { 79 | this.meishileixing = meishileixing; 80 | } 81 | 82 | /** 83 | * 获取:美食类型 84 | */ 85 | public String getMeishileixing() { 86 | return meishileixing; 87 | } 88 | 89 | 90 | /** 91 | * 设置:图片 92 | */ 93 | 94 | public void setTupian(String tupian) { 95 | this.tupian = tupian; 96 | } 97 | 98 | /** 99 | * 获取:图片 100 | */ 101 | public String getTupian() { 102 | return tupian; 103 | } 104 | 105 | 106 | /** 107 | * 设置:口味 108 | */ 109 | 110 | public void setKouwei(String kouwei) { 111 | this.kouwei = kouwei; 112 | } 113 | 114 | /** 115 | * 获取:口味 116 | */ 117 | public String getKouwei() { 118 | return kouwei; 119 | } 120 | 121 | 122 | /** 123 | * 设置:特色 124 | */ 125 | 126 | public void setTese(String tese) { 127 | this.tese = tese; 128 | } 129 | 130 | /** 131 | * 获取:特色 132 | */ 133 | public String getTese() { 134 | return tese; 135 | } 136 | 137 | 138 | /** 139 | * 设置:城市 140 | */ 141 | 142 | public void setChengshi(String chengshi) { 143 | this.chengshi = chengshi; 144 | } 145 | 146 | /** 147 | * 获取:城市 148 | */ 149 | public String getChengshi() { 150 | return chengshi; 151 | } 152 | 153 | 154 | /** 155 | * 设置:打卡地点 156 | */ 157 | 158 | public void setDakadidian(String dakadidian) { 159 | this.dakadidian = dakadidian; 160 | } 161 | 162 | /** 163 | * 获取:打卡地点 164 | */ 165 | public String getDakadidian() { 166 | return dakadidian; 167 | } 168 | 169 | 170 | /** 171 | * 设置:人均消费 172 | */ 173 | 174 | public void setRenjunxiaofei(Float renjunxiaofei) { 175 | this.renjunxiaofei = renjunxiaofei; 176 | } 177 | 178 | /** 179 | * 获取:人均消费 180 | */ 181 | public Float getRenjunxiaofei() { 182 | return renjunxiaofei; 183 | } 184 | 185 | 186 | /** 187 | * 设置:详情 188 | */ 189 | 190 | public void setXiangqing(String xiangqing) { 191 | this.xiangqing = xiangqing; 192 | } 193 | 194 | /** 195 | * 获取:详情 196 | */ 197 | public String getXiangqing() { 198 | return xiangqing; 199 | } 200 | 201 | } 202 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/TesemeishiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.TesemeishiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 特色美食 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public class TesemeishiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 美食类型 28 | */ 29 | 30 | private String meishileixing; 31 | 32 | /** 33 | * 图片 34 | */ 35 | 36 | private String tupian; 37 | 38 | /** 39 | * 口味 40 | */ 41 | 42 | private String kouwei; 43 | 44 | /** 45 | * 特色 46 | */ 47 | 48 | private String tese; 49 | 50 | /** 51 | * 城市 52 | */ 53 | 54 | private String chengshi; 55 | 56 | /** 57 | * 打卡地点 58 | */ 59 | 60 | private String dakadidian; 61 | 62 | /** 63 | * 人均消费 64 | */ 65 | 66 | private Float renjunxiaofei; 67 | 68 | /** 69 | * 详情 70 | */ 71 | 72 | private String xiangqing; 73 | 74 | 75 | /** 76 | * 设置:美食类型 77 | */ 78 | 79 | public void setMeishileixing(String meishileixing) { 80 | this.meishileixing = meishileixing; 81 | } 82 | 83 | /** 84 | * 获取:美食类型 85 | */ 86 | public String getMeishileixing() { 87 | return meishileixing; 88 | } 89 | 90 | 91 | /** 92 | * 设置:图片 93 | */ 94 | 95 | public void setTupian(String tupian) { 96 | this.tupian = tupian; 97 | } 98 | 99 | /** 100 | * 获取:图片 101 | */ 102 | public String getTupian() { 103 | return tupian; 104 | } 105 | 106 | 107 | /** 108 | * 设置:口味 109 | */ 110 | 111 | public void setKouwei(String kouwei) { 112 | this.kouwei = kouwei; 113 | } 114 | 115 | /** 116 | * 获取:口味 117 | */ 118 | public String getKouwei() { 119 | return kouwei; 120 | } 121 | 122 | 123 | /** 124 | * 设置:特色 125 | */ 126 | 127 | public void setTese(String tese) { 128 | this.tese = tese; 129 | } 130 | 131 | /** 132 | * 获取:特色 133 | */ 134 | public String getTese() { 135 | return tese; 136 | } 137 | 138 | 139 | /** 140 | * 设置:城市 141 | */ 142 | 143 | public void setChengshi(String chengshi) { 144 | this.chengshi = chengshi; 145 | } 146 | 147 | /** 148 | * 获取:城市 149 | */ 150 | public String getChengshi() { 151 | return chengshi; 152 | } 153 | 154 | 155 | /** 156 | * 设置:打卡地点 157 | */ 158 | 159 | public void setDakadidian(String dakadidian) { 160 | this.dakadidian = dakadidian; 161 | } 162 | 163 | /** 164 | * 获取:打卡地点 165 | */ 166 | public String getDakadidian() { 167 | return dakadidian; 168 | } 169 | 170 | 171 | /** 172 | * 设置:人均消费 173 | */ 174 | 175 | public void setRenjunxiaofei(Float renjunxiaofei) { 176 | this.renjunxiaofei = renjunxiaofei; 177 | } 178 | 179 | /** 180 | * 获取:人均消费 181 | */ 182 | public Float getRenjunxiaofei() { 183 | return renjunxiaofei; 184 | } 185 | 186 | 187 | /** 188 | * 设置:详情 189 | */ 190 | 191 | public void setXiangqing(String xiangqing) { 192 | this.xiangqing = xiangqing; 193 | } 194 | 195 | /** 196 | * 获取:详情 197 | */ 198 | public String getXiangqing() { 199 | return xiangqing; 200 | } 201 | 202 | } 203 | -------------------------------------------------------------------------------- /src/main/java/com/interceptor/AuthorizationInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.interceptor; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import com.alibaba.fastjson.JSONObject; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | import org.apache.commons.lang3.StringUtils; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Component; 14 | import org.springframework.web.method.HandlerMethod; 15 | import org.springframework.web.servlet.HandlerInterceptor; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.http.HttpStatus; 18 | 19 | import com.annotation.IgnoreAuth; 20 | import com.entity.EIException; 21 | import com.entity.TokenEntity; 22 | import com.service.TokenService; 23 | import com.utils.R; 24 | 25 | /** 26 | * 权限(Token)验证 27 | */ 28 | @Component 29 | public class AuthorizationInterceptor implements HandlerInterceptor { 30 | 31 | public static final String LOGIN_TOKEN_KEY = "Token"; 32 | 33 | @Autowired 34 | private TokenService tokenService; 35 | 36 | @Override 37 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 38 | 39 | //支持跨域请求 40 | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); 41 | response.setHeader("Access-Control-Max-Age", "3600"); 42 | response.setHeader("Access-Control-Allow-Credentials", "true"); 43 | response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization"); 44 | response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); 45 | // 跨域时会首先发送一个OPTIONS请求,这里我们给OPTIONS请求直接返回正常状态 46 | if (request.getMethod().equals(RequestMethod.OPTIONS.name())) { 47 | response.setStatus(HttpStatus.OK.value()); 48 | return false; 49 | } 50 | 51 | IgnoreAuth annotation; 52 | if (handler instanceof HandlerMethod) { 53 | annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class); 54 | } else { 55 | return true; 56 | } 57 | 58 | //从header中获取token 59 | String token = request.getHeader(LOGIN_TOKEN_KEY); 60 | 61 | /** 62 | * 不需要验证权限的方法直接放过 63 | */ 64 | if(annotation!=null) { 65 | return true; 66 | } 67 | 68 | TokenEntity tokenEntity = null; 69 | if(StringUtils.isNotBlank(token)) { 70 | tokenEntity = tokenService.getTokenEntity(token); 71 | } 72 | 73 | if(tokenEntity != null) { 74 | request.getSession().setAttribute("userId", tokenEntity.getUserid()); 75 | request.getSession().setAttribute("role", tokenEntity.getRole()); 76 | request.getSession().setAttribute("tableName", tokenEntity.getTablename()); 77 | request.getSession().setAttribute("username", tokenEntity.getUsername()); 78 | return true; 79 | } 80 | 81 | PrintWriter writer = null; 82 | response.setCharacterEncoding("UTF-8"); 83 | response.setContentType("application/json; charset=utf-8"); 84 | try { 85 | writer = response.getWriter(); 86 | writer.print(JSONObject.toJSONString(R.error(401, "请先登录"))); 87 | } finally { 88 | if(writer != null){ 89 | writer.close(); 90 | } 91 | } 92 | // throw new EIException("请先登录", 401); 93 | return false; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/controller/ConfigController.java: -------------------------------------------------------------------------------- 1 | 2 | package com.controller; 3 | 4 | 5 | import java.util.Arrays; 6 | import java.util.Map; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import com.annotation.IgnoreAuth; 17 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 18 | import com.entity.ConfigEntity; 19 | import com.service.ConfigService; 20 | import com.utils.MPUtil; 21 | import com.utils.PageUtils; 22 | import com.utils.R; 23 | import com.utils.ValidatorUtils; 24 | 25 | /** 26 | * 登录相关 27 | */ 28 | @RequestMapping("config") 29 | @RestController 30 | public class ConfigController{ 31 | 32 | @Autowired 33 | private ConfigService configService; 34 | 35 | /** 36 | * 列表 37 | */ 38 | @RequestMapping("/page") 39 | public R page(@RequestParam Map params,ConfigEntity config){ 40 | EntityWrapper ew = new EntityWrapper(); 41 | PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params)); 42 | return R.ok().put("data", page); 43 | } 44 | 45 | /** 46 | * 列表 47 | */ 48 | @IgnoreAuth 49 | @RequestMapping("/list") 50 | public R list(@RequestParam Map params,ConfigEntity config){ 51 | EntityWrapper ew = new EntityWrapper(); 52 | PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params)); 53 | return R.ok().put("data", page); 54 | } 55 | 56 | /** 57 | * 信息 58 | */ 59 | @RequestMapping("/info/{id}") 60 | public R info(@PathVariable("id") String id){ 61 | ConfigEntity config = configService.selectById(id); 62 | return R.ok().put("data", config); 63 | } 64 | 65 | /** 66 | * 详情 67 | */ 68 | @IgnoreAuth 69 | @RequestMapping("/detail/{id}") 70 | public R detail(@PathVariable("id") String id){ 71 | ConfigEntity config = configService.selectById(id); 72 | return R.ok().put("data", config); 73 | } 74 | 75 | /** 76 | * 根据name获取信息 77 | */ 78 | @RequestMapping("/info") 79 | public R infoByName(@RequestParam String name){ 80 | ConfigEntity config = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 81 | return R.ok().put("data", config); 82 | } 83 | 84 | /** 85 | * 保存 86 | */ 87 | @PostMapping("/save") 88 | public R save(@RequestBody ConfigEntity config){ 89 | // ValidatorUtils.validateEntity(config); 90 | configService.insert(config); 91 | return R.ok(); 92 | } 93 | 94 | /** 95 | * 修改 96 | */ 97 | @RequestMapping("/update") 98 | public R update(@RequestBody ConfigEntity config){ 99 | // ValidatorUtils.validateEntity(config); 100 | configService.updateById(config);//全部更新 101 | return R.ok(); 102 | } 103 | 104 | /** 105 | * 删除 106 | */ 107 | @RequestMapping("/delete") 108 | public R delete(@RequestBody Long[] ids){ 109 | configService.deleteBatchIds(Arrays.asList(ids)); 110 | return R.ok(); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/LvyoujingdianVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.LvyoujingdianEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 旅游景点 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2023-03-15 11:57:16 20 | */ 21 | public class LvyoujingdianVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 景点图片 27 | */ 28 | 29 | private String jingdiantupian; 30 | 31 | /** 32 | * 景点分类 33 | */ 34 | 35 | private String jingdianfenlei; 36 | 37 | /** 38 | * 景点等级 39 | */ 40 | 41 | private String jingdiandengji; 42 | 43 | /** 44 | * 景点地址 45 | */ 46 | 47 | private String jingdiandizhi; 48 | 49 | /** 50 | * 开放时间 51 | */ 52 | 53 | private String kaifangshijian; 54 | 55 | /** 56 | * 旅游特点 57 | */ 58 | 59 | private String lvyoutedian; 60 | 61 | /** 62 | * 景点介绍 63 | */ 64 | 65 | private String jingdianjieshao; 66 | 67 | /** 68 | * 旅游文化 69 | */ 70 | 71 | private String lvyouwenhua; 72 | 73 | 74 | /** 75 | * 设置:景点图片 76 | */ 77 | 78 | public void setJingdiantupian(String jingdiantupian) { 79 | this.jingdiantupian = jingdiantupian; 80 | } 81 | 82 | /** 83 | * 获取:景点图片 84 | */ 85 | public String getJingdiantupian() { 86 | return jingdiantupian; 87 | } 88 | 89 | 90 | /** 91 | * 设置:景点分类 92 | */ 93 | 94 | public void setJingdianfenlei(String jingdianfenlei) { 95 | this.jingdianfenlei = jingdianfenlei; 96 | } 97 | 98 | /** 99 | * 获取:景点分类 100 | */ 101 | public String getJingdianfenlei() { 102 | return jingdianfenlei; 103 | } 104 | 105 | 106 | /** 107 | * 设置:景点等级 108 | */ 109 | 110 | public void setJingdiandengji(String jingdiandengji) { 111 | this.jingdiandengji = jingdiandengji; 112 | } 113 | 114 | /** 115 | * 获取:景点等级 116 | */ 117 | public String getJingdiandengji() { 118 | return jingdiandengji; 119 | } 120 | 121 | 122 | /** 123 | * 设置:景点地址 124 | */ 125 | 126 | public void setJingdiandizhi(String jingdiandizhi) { 127 | this.jingdiandizhi = jingdiandizhi; 128 | } 129 | 130 | /** 131 | * 获取:景点地址 132 | */ 133 | public String getJingdiandizhi() { 134 | return jingdiandizhi; 135 | } 136 | 137 | 138 | /** 139 | * 设置:开放时间 140 | */ 141 | 142 | public void setKaifangshijian(String kaifangshijian) { 143 | this.kaifangshijian = kaifangshijian; 144 | } 145 | 146 | /** 147 | * 获取:开放时间 148 | */ 149 | public String getKaifangshijian() { 150 | return kaifangshijian; 151 | } 152 | 153 | 154 | /** 155 | * 设置:旅游特点 156 | */ 157 | 158 | public void setLvyoutedian(String lvyoutedian) { 159 | this.lvyoutedian = lvyoutedian; 160 | } 161 | 162 | /** 163 | * 获取:旅游特点 164 | */ 165 | public String getLvyoutedian() { 166 | return lvyoutedian; 167 | } 168 | 169 | 170 | /** 171 | * 设置:景点介绍 172 | */ 173 | 174 | public void setJingdianjieshao(String jingdianjieshao) { 175 | this.jingdianjieshao = jingdianjieshao; 176 | } 177 | 178 | /** 179 | * 获取:景点介绍 180 | */ 181 | public String getJingdianjieshao() { 182 | return jingdianjieshao; 183 | } 184 | 185 | 186 | /** 187 | * 设置:旅游文化 188 | */ 189 | 190 | public void setLvyouwenhua(String lvyouwenhua) { 191 | this.lvyouwenhua = lvyouwenhua; 192 | } 193 | 194 | /** 195 | * 获取:旅游文化 196 | */ 197 | public String getLvyouwenhua() { 198 | return lvyouwenhua; 199 | } 200 | 201 | } 202 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/LvyoujingdianModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.LvyoujingdianEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 旅游景点 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2023-03-15 11:57:16 21 | */ 22 | public class LvyoujingdianModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 景点图片 28 | */ 29 | 30 | private String jingdiantupian; 31 | 32 | /** 33 | * 景点分类 34 | */ 35 | 36 | private String jingdianfenlei; 37 | 38 | /** 39 | * 景点等级 40 | */ 41 | 42 | private String jingdiandengji; 43 | 44 | /** 45 | * 景点地址 46 | */ 47 | 48 | private String jingdiandizhi; 49 | 50 | /** 51 | * 开放时间 52 | */ 53 | 54 | private String kaifangshijian; 55 | 56 | /** 57 | * 旅游特点 58 | */ 59 | 60 | private String lvyoutedian; 61 | 62 | /** 63 | * 景点介绍 64 | */ 65 | 66 | private String jingdianjieshao; 67 | 68 | /** 69 | * 旅游文化 70 | */ 71 | 72 | private String lvyouwenhua; 73 | 74 | 75 | /** 76 | * 设置:景点图片 77 | */ 78 | 79 | public void setJingdiantupian(String jingdiantupian) { 80 | this.jingdiantupian = jingdiantupian; 81 | } 82 | 83 | /** 84 | * 获取:景点图片 85 | */ 86 | public String getJingdiantupian() { 87 | return jingdiantupian; 88 | } 89 | 90 | 91 | /** 92 | * 设置:景点分类 93 | */ 94 | 95 | public void setJingdianfenlei(String jingdianfenlei) { 96 | this.jingdianfenlei = jingdianfenlei; 97 | } 98 | 99 | /** 100 | * 获取:景点分类 101 | */ 102 | public String getJingdianfenlei() { 103 | return jingdianfenlei; 104 | } 105 | 106 | 107 | /** 108 | * 设置:景点等级 109 | */ 110 | 111 | public void setJingdiandengji(String jingdiandengji) { 112 | this.jingdiandengji = jingdiandengji; 113 | } 114 | 115 | /** 116 | * 获取:景点等级 117 | */ 118 | public String getJingdiandengji() { 119 | return jingdiandengji; 120 | } 121 | 122 | 123 | /** 124 | * 设置:景点地址 125 | */ 126 | 127 | public void setJingdiandizhi(String jingdiandizhi) { 128 | this.jingdiandizhi = jingdiandizhi; 129 | } 130 | 131 | /** 132 | * 获取:景点地址 133 | */ 134 | public String getJingdiandizhi() { 135 | return jingdiandizhi; 136 | } 137 | 138 | 139 | /** 140 | * 设置:开放时间 141 | */ 142 | 143 | public void setKaifangshijian(String kaifangshijian) { 144 | this.kaifangshijian = kaifangshijian; 145 | } 146 | 147 | /** 148 | * 获取:开放时间 149 | */ 150 | public String getKaifangshijian() { 151 | return kaifangshijian; 152 | } 153 | 154 | 155 | /** 156 | * 设置:旅游特点 157 | */ 158 | 159 | public void setLvyoutedian(String lvyoutedian) { 160 | this.lvyoutedian = lvyoutedian; 161 | } 162 | 163 | /** 164 | * 获取:旅游特点 165 | */ 166 | public String getLvyoutedian() { 167 | return lvyoutedian; 168 | } 169 | 170 | 171 | /** 172 | * 设置:景点介绍 173 | */ 174 | 175 | public void setJingdianjieshao(String jingdianjieshao) { 176 | this.jingdianjieshao = jingdianjieshao; 177 | } 178 | 179 | /** 180 | * 获取:景点介绍 181 | */ 182 | public String getJingdianjieshao() { 183 | return jingdianjieshao; 184 | } 185 | 186 | 187 | /** 188 | * 设置:旅游文化 189 | */ 190 | 191 | public void setLvyouwenhua(String lvyouwenhua) { 192 | this.lvyouwenhua = lvyouwenhua; 193 | } 194 | 195 | /** 196 | * 获取:旅游文化 197 | */ 198 | public String getLvyouwenhua() { 199 | return lvyouwenhua; 200 | } 201 | 202 | } 203 | -------------------------------------------------------------------------------- /src/main/java/com/entity/AboutusEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 关于我们 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-03-15 11:57:16 30 | */ 31 | @TableName("aboutus") 32 | public class AboutusEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public AboutusEntity() { 37 | 38 | } 39 | 40 | public AboutusEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 标题 56 | */ 57 | 58 | private String title; 59 | 60 | /** 61 | * 副标题 62 | */ 63 | 64 | private String subtitle; 65 | 66 | /** 67 | * 内容 68 | */ 69 | 70 | private String content; 71 | 72 | /** 73 | * 图片1 74 | */ 75 | 76 | private String picture1; 77 | 78 | /** 79 | * 图片2 80 | */ 81 | 82 | private String picture2; 83 | 84 | /** 85 | * 图片3 86 | */ 87 | 88 | private String picture3; 89 | 90 | 91 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 92 | @DateTimeFormat 93 | private Date addtime; 94 | 95 | public Date getAddtime() { 96 | return addtime; 97 | } 98 | public void setAddtime(Date addtime) { 99 | this.addtime = addtime; 100 | } 101 | 102 | public Long getId() { 103 | return id; 104 | } 105 | 106 | public void setId(Long id) { 107 | this.id = id; 108 | } 109 | /** 110 | * 设置:标题 111 | */ 112 | public void setTitle(String title) { 113 | this.title = title; 114 | } 115 | /** 116 | * 获取:标题 117 | */ 118 | public String getTitle() { 119 | return title; 120 | } 121 | /** 122 | * 设置:副标题 123 | */ 124 | public void setSubtitle(String subtitle) { 125 | this.subtitle = subtitle; 126 | } 127 | /** 128 | * 获取:副标题 129 | */ 130 | public String getSubtitle() { 131 | return subtitle; 132 | } 133 | /** 134 | * 设置:内容 135 | */ 136 | public void setContent(String content) { 137 | this.content = content; 138 | } 139 | /** 140 | * 获取:内容 141 | */ 142 | public String getContent() { 143 | return content; 144 | } 145 | /** 146 | * 设置:图片1 147 | */ 148 | public void setPicture1(String picture1) { 149 | this.picture1 = picture1; 150 | } 151 | /** 152 | * 获取:图片1 153 | */ 154 | public String getPicture1() { 155 | return picture1; 156 | } 157 | /** 158 | * 设置:图片2 159 | */ 160 | public void setPicture2(String picture2) { 161 | this.picture2 = picture2; 162 | } 163 | /** 164 | * 获取:图片2 165 | */ 166 | public String getPicture2() { 167 | return picture2; 168 | } 169 | /** 170 | * 设置:图片3 171 | */ 172 | public void setPicture3(String picture3) { 173 | this.picture3 = picture3; 174 | } 175 | /** 176 | * 获取:图片3 177 | */ 178 | public String getPicture3() { 179 | return picture3; 180 | } 181 | 182 | } 183 | -------------------------------------------------------------------------------- /src/main/java/com/entity/YonghuEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 用户 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-03-15 11:57:16 30 | */ 31 | @TableName("yonghu") 32 | public class YonghuEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public YonghuEntity() { 37 | 38 | } 39 | 40 | public YonghuEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 用户账号 56 | */ 57 | 58 | private String yonghuzhanghao; 59 | 60 | /** 61 | * 用户姓名 62 | */ 63 | 64 | private String yonghuxingming; 65 | 66 | /** 67 | * 密码 68 | */ 69 | 70 | private String mima; 71 | 72 | /** 73 | * 性别 74 | */ 75 | 76 | private String xingbie; 77 | 78 | /** 79 | * 头像 80 | */ 81 | 82 | private String touxiang; 83 | 84 | /** 85 | * 联系电话 86 | */ 87 | 88 | private String lianxidianhua; 89 | 90 | 91 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 92 | @DateTimeFormat 93 | private Date addtime; 94 | 95 | public Date getAddtime() { 96 | return addtime; 97 | } 98 | public void setAddtime(Date addtime) { 99 | this.addtime = addtime; 100 | } 101 | 102 | public Long getId() { 103 | return id; 104 | } 105 | 106 | public void setId(Long id) { 107 | this.id = id; 108 | } 109 | /** 110 | * 设置:用户账号 111 | */ 112 | public void setYonghuzhanghao(String yonghuzhanghao) { 113 | this.yonghuzhanghao = yonghuzhanghao; 114 | } 115 | /** 116 | * 获取:用户账号 117 | */ 118 | public String getYonghuzhanghao() { 119 | return yonghuzhanghao; 120 | } 121 | /** 122 | * 设置:用户姓名 123 | */ 124 | public void setYonghuxingming(String yonghuxingming) { 125 | this.yonghuxingming = yonghuxingming; 126 | } 127 | /** 128 | * 获取:用户姓名 129 | */ 130 | public String getYonghuxingming() { 131 | return yonghuxingming; 132 | } 133 | /** 134 | * 设置:密码 135 | */ 136 | public void setMima(String mima) { 137 | this.mima = mima; 138 | } 139 | /** 140 | * 获取:密码 141 | */ 142 | public String getMima() { 143 | return mima; 144 | } 145 | /** 146 | * 设置:性别 147 | */ 148 | public void setXingbie(String xingbie) { 149 | this.xingbie = xingbie; 150 | } 151 | /** 152 | * 获取:性别 153 | */ 154 | public String getXingbie() { 155 | return xingbie; 156 | } 157 | /** 158 | * 设置:头像 159 | */ 160 | public void setTouxiang(String touxiang) { 161 | this.touxiang = touxiang; 162 | } 163 | /** 164 | * 获取:头像 165 | */ 166 | public String getTouxiang() { 167 | return touxiang; 168 | } 169 | /** 170 | * 设置:联系电话 171 | */ 172 | public void setLianxidianhua(String lianxidianhua) { 173 | this.lianxidianhua = lianxidianhua; 174 | } 175 | /** 176 | * 获取:联系电话 177 | */ 178 | public String getLianxidianhua() { 179 | return lianxidianhua; 180 | } 181 | 182 | } 183 | -------------------------------------------------------------------------------- /src/main/java/com/controller/FileController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | import java.util.Arrays; 7 | import java.util.Date; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | import java.util.Random; 12 | import java.util.UUID; 13 | 14 | import org.apache.commons.io.FileUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.http.HttpHeaders; 18 | import org.springframework.http.HttpStatus; 19 | import org.springframework.http.MediaType; 20 | import org.springframework.http.ResponseEntity; 21 | import org.springframework.util.ResourceUtils; 22 | import org.springframework.web.bind.annotation.PathVariable; 23 | import org.springframework.web.bind.annotation.RequestBody; 24 | import org.springframework.web.bind.annotation.RequestMapping; 25 | import org.springframework.web.bind.annotation.RequestParam; 26 | import org.springframework.web.bind.annotation.RestController; 27 | import org.springframework.web.multipart.MultipartFile; 28 | 29 | import com.annotation.IgnoreAuth; 30 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 31 | import com.entity.ConfigEntity; 32 | import com.entity.EIException; 33 | import com.service.ConfigService; 34 | import com.utils.R; 35 | 36 | /** 37 | * 上传文件映射表 38 | */ 39 | @RestController 40 | @RequestMapping("file") 41 | @SuppressWarnings({"unchecked","rawtypes"}) 42 | public class FileController{ 43 | @Autowired 44 | private ConfigService configService; 45 | /** 46 | * 上传文件 47 | */ 48 | @RequestMapping("/upload") 49 | @IgnoreAuth 50 | public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception { 51 | if (file.isEmpty()) { 52 | throw new EIException("上传文件不能为空"); 53 | } 54 | String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); 55 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 56 | if(!path.exists()) { 57 | path = new File(""); 58 | } 59 | File upload = new File(path.getAbsolutePath(),"/upload/"); 60 | if(!upload.exists()) { 61 | upload.mkdirs(); 62 | } 63 | String fileName = new Date().getTime()+"."+fileExt; 64 | File dest = new File(upload.getAbsolutePath()+"/"+fileName); 65 | file.transferTo(dest); 66 | /** 67 | * 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开 68 | * 请将以下的"D:\\springbootq33sd\\src\\main\\resources\\static\\upload"替换成你本地项目的upload路径, 69 | * 并且项目路径不能存在中文、空格等特殊字符 70 | */ 71 | // FileUtils.copyFile(dest, new File("D:\\springbootq33sd\\src\\main\\resources\\static\\upload"+"/"+fileName)); /**修改了路径以后请将该行最前面的//注释去掉**/ 72 | if(StringUtils.isNotBlank(type) && type.equals("1")) { 73 | ConfigEntity configEntity = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 74 | if(configEntity==null) { 75 | configEntity = new ConfigEntity(); 76 | configEntity.setName("faceFile"); 77 | configEntity.setValue(fileName); 78 | } else { 79 | configEntity.setValue(fileName); 80 | } 81 | configService.insertOrUpdate(configEntity); 82 | } 83 | return R.ok().put("file", fileName); 84 | } 85 | 86 | /** 87 | * 下载文件 88 | */ 89 | @IgnoreAuth 90 | @RequestMapping("/download") 91 | public ResponseEntity download(@RequestParam String fileName) { 92 | try { 93 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 94 | if(!path.exists()) { 95 | path = new File(""); 96 | } 97 | File upload = new File(path.getAbsolutePath(),"/upload/"); 98 | if(!upload.exists()) { 99 | upload.mkdirs(); 100 | } 101 | File file = new File(upload.getAbsolutePath()+"/"+fileName); 102 | if(file.exists()){ 103 | /*if(!fileService.canRead(file, SessionManager.getSessionUser())){ 104 | getResponse().sendError(403); 105 | }*/ 106 | HttpHeaders headers = new HttpHeaders(); 107 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 108 | headers.setContentDispositionFormData("attachment", fileName); 109 | return new ResponseEntity(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); 110 | } 111 | } catch (IOException e) { 112 | e.printStackTrace(); 113 | } 114 | return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/com/utils/CommonUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.Random; 4 | import java.util.ArrayList; 5 | import org.springframework.stereotype.Component; 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.apache.poi.ss.usermodel.Cell; 8 | import java.text.DecimalFormat; 9 | import java.text.SimpleDateFormat; 10 | import org.apache.poi.ss.usermodel.DateUtil; 11 | import java.util.Objects; 12 | import com.alibaba.fastjson.JSONObject; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | 15 | @Component 16 | public class CommonUtil { 17 | /** 18 | * 获取随机字符串 19 | * 20 | * @param num 21 | * @return 22 | */ 23 | public static String getRandomString(Integer num) { 24 | String base = "abcdefghijklmnopqrstuvwxyz0123456789"; 25 | Random random = new Random(); 26 | StringBuffer sb = new StringBuffer(); 27 | for (int i = 0; i < num; i++) { 28 | int number = random.nextInt(base.length()); 29 | sb.append(base.charAt(number)); 30 | } 31 | return sb.toString(); 32 | } 33 | 34 | /** 35 | * 获取随机验证码 36 | * 37 | * @param num 38 | * @return 39 | */ 40 | public static String getRandomNumber(Integer num) { 41 | String base = "0123456789"; 42 | Random random = new Random(); 43 | StringBuffer sb = new StringBuffer(); 44 | for (int i = 0; i < num; i++) { 45 | int number = random.nextInt(base.length()); 46 | sb.append(base.charAt(number)); 47 | } 48 | return sb.toString(); 49 | } 50 | 51 | public static String getCellValue(Cell cell) { 52 | String resultValue = ""; 53 | // 判空 54 | if (Objects.isNull(cell)) { 55 | return resultValue; 56 | } 57 | 58 | // 拿到单元格类型 59 | int cellType = cell.getCellType(); 60 | switch (cellType) { 61 | // 字符串类型 62 | case Cell.CELL_TYPE_STRING: 63 | resultValue = StringUtils.isEmpty(cell.getStringCellValue()) ? "" : cell.getStringCellValue().trim(); 64 | break; 65 | // 布尔类型 66 | case Cell.CELL_TYPE_BOOLEAN: 67 | resultValue = String.valueOf(cell.getBooleanCellValue()); 68 | break; 69 | // 数值类型 70 | case Cell.CELL_TYPE_NUMERIC: 71 | /** 72 | * format 的值可能为以下这些 yyyyMMddHHmmss 73 | * yyyy-MM-dd----- 14 74 | * yyyy年m月d日----- 31 75 | * yyyy年m月--------57 76 | * m月d日 -----------58 77 | * HH:mm-----------20 78 | * h时mm分 --------- 32 79 | */ 80 | Object val = cell.getNumericCellValue(); 81 | // POI Excel 日期格式转换 82 | String formatDate = ""; 83 | switch (cell.getCellStyle().getDataFormat()){ 84 | case 14: 85 | formatDate = "yyyy-MM-dd"; 86 | break; 87 | case 20: 88 | formatDate = "HH:mm"; 89 | break; 90 | case 21: 91 | formatDate = "HH:mm:ss"; 92 | break; 93 | case 31: 94 | formatDate = "yyyy年MM月dd日"; 95 | break; 96 | case 32: 97 | formatDate = "HH时mm分"; 98 | break; 99 | case 33: 100 | formatDate = "HH时mm分mm秒"; 101 | break; 102 | case 57: 103 | formatDate = "yyyy年MM月"; 104 | break; 105 | case 58: 106 | formatDate = "MM月dd日"; 107 | break; 108 | case 176: 109 | formatDate = "yyyy-MM-dd HH:mm:ss"; 110 | break; 111 | } 112 | if(!"".equals(formatDate)){ 113 | resultValue = new SimpleDateFormat(formatDate).format(DateUtil.getJavaDate((Double) val)); 114 | }else{ 115 | resultValue = new DecimalFormat("#.######").format(cell.getNumericCellValue()); 116 | } 117 | break; 118 | // 取空串 119 | default: 120 | break; 121 | } 122 | return resultValue; 123 | } 124 | 125 | 126 | 127 | 128 | 129 | } 130 | -------------------------------------------------------------------------------- /src/main/java/com/entity/JiudianxinxiEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 酒店信息 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-03-15 11:57:16 30 | */ 31 | @TableName("jiudianxinxi") 32 | public class JiudianxinxiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public JiudianxinxiEntity() { 37 | 38 | } 39 | 40 | public JiudianxinxiEntity(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 jiudianmingcheng; 59 | 60 | /** 61 | * 类别 62 | */ 63 | 64 | private String leibie; 65 | 66 | /** 67 | * 星级 68 | */ 69 | 70 | private String xingji; 71 | 72 | /** 73 | * 酒店图片 74 | */ 75 | 76 | private String jiudiantupian; 77 | 78 | /** 79 | * 酒店地址 80 | */ 81 | 82 | private String jiudiandizhi; 83 | 84 | /** 85 | * 房间类型 86 | */ 87 | 88 | private String fangjianleixing; 89 | 90 | /** 91 | * 联系电话 92 | */ 93 | 94 | private String lianxidianhua; 95 | 96 | /** 97 | * 酒店介绍 98 | */ 99 | 100 | private String jiudianjieshao; 101 | 102 | 103 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 104 | @DateTimeFormat 105 | private Date addtime; 106 | 107 | public Date getAddtime() { 108 | return addtime; 109 | } 110 | public void setAddtime(Date addtime) { 111 | this.addtime = addtime; 112 | } 113 | 114 | public Long getId() { 115 | return id; 116 | } 117 | 118 | public void setId(Long id) { 119 | this.id = id; 120 | } 121 | /** 122 | * 设置:酒店名称 123 | */ 124 | public void setJiudianmingcheng(String jiudianmingcheng) { 125 | this.jiudianmingcheng = jiudianmingcheng; 126 | } 127 | /** 128 | * 获取:酒店名称 129 | */ 130 | public String getJiudianmingcheng() { 131 | return jiudianmingcheng; 132 | } 133 | /** 134 | * 设置:类别 135 | */ 136 | public void setLeibie(String leibie) { 137 | this.leibie = leibie; 138 | } 139 | /** 140 | * 获取:类别 141 | */ 142 | public String getLeibie() { 143 | return leibie; 144 | } 145 | /** 146 | * 设置:星级 147 | */ 148 | public void setXingji(String xingji) { 149 | this.xingji = xingji; 150 | } 151 | /** 152 | * 获取:星级 153 | */ 154 | public String getXingji() { 155 | return xingji; 156 | } 157 | /** 158 | * 设置:酒店图片 159 | */ 160 | public void setJiudiantupian(String jiudiantupian) { 161 | this.jiudiantupian = jiudiantupian; 162 | } 163 | /** 164 | * 获取:酒店图片 165 | */ 166 | public String getJiudiantupian() { 167 | return jiudiantupian; 168 | } 169 | /** 170 | * 设置:酒店地址 171 | */ 172 | public void setJiudiandizhi(String jiudiandizhi) { 173 | this.jiudiandizhi = jiudiandizhi; 174 | } 175 | /** 176 | * 获取:酒店地址 177 | */ 178 | public String getJiudiandizhi() { 179 | return jiudiandizhi; 180 | } 181 | /** 182 | * 设置:房间类型 183 | */ 184 | public void setFangjianleixing(String fangjianleixing) { 185 | this.fangjianleixing = fangjianleixing; 186 | } 187 | /** 188 | * 获取:房间类型 189 | */ 190 | public String getFangjianleixing() { 191 | return fangjianleixing; 192 | } 193 | /** 194 | * 设置:联系电话 195 | */ 196 | public void setLianxidianhua(String lianxidianhua) { 197 | this.lianxidianhua = lianxidianhua; 198 | } 199 | /** 200 | * 获取:联系电话 201 | */ 202 | public String getLianxidianhua() { 203 | return lianxidianhua; 204 | } 205 | /** 206 | * 设置:酒店介绍 207 | */ 208 | public void setJiudianjieshao(String jiudianjieshao) { 209 | this.jiudianjieshao = jiudianjieshao; 210 | } 211 | /** 212 | * 获取:酒店介绍 213 | */ 214 | public String getJiudianjieshao() { 215 | return jiudianjieshao; 216 | } 217 | 218 | } 219 | -------------------------------------------------------------------------------- /src/main/java/com/entity/TesemeishiEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 特色美食 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-03-15 11:57:16 30 | */ 31 | @TableName("tesemeishi") 32 | public class TesemeishiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public TesemeishiEntity() { 37 | 38 | } 39 | 40 | public TesemeishiEntity(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 meishimingcheng; 59 | 60 | /** 61 | * 美食类型 62 | */ 63 | 64 | private String meishileixing; 65 | 66 | /** 67 | * 图片 68 | */ 69 | 70 | private String tupian; 71 | 72 | /** 73 | * 口味 74 | */ 75 | 76 | private String kouwei; 77 | 78 | /** 79 | * 特色 80 | */ 81 | 82 | private String tese; 83 | 84 | /** 85 | * 城市 86 | */ 87 | 88 | private String chengshi; 89 | 90 | /** 91 | * 打卡地点 92 | */ 93 | 94 | private String dakadidian; 95 | 96 | /** 97 | * 人均消费 98 | */ 99 | 100 | private Float renjunxiaofei; 101 | 102 | /** 103 | * 详情 104 | */ 105 | 106 | private String xiangqing; 107 | 108 | 109 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 110 | @DateTimeFormat 111 | private Date addtime; 112 | 113 | public Date getAddtime() { 114 | return addtime; 115 | } 116 | public void setAddtime(Date addtime) { 117 | this.addtime = addtime; 118 | } 119 | 120 | public Long getId() { 121 | return id; 122 | } 123 | 124 | public void setId(Long id) { 125 | this.id = id; 126 | } 127 | /** 128 | * 设置:美食名称 129 | */ 130 | public void setMeishimingcheng(String meishimingcheng) { 131 | this.meishimingcheng = meishimingcheng; 132 | } 133 | /** 134 | * 获取:美食名称 135 | */ 136 | public String getMeishimingcheng() { 137 | return meishimingcheng; 138 | } 139 | /** 140 | * 设置:美食类型 141 | */ 142 | public void setMeishileixing(String meishileixing) { 143 | this.meishileixing = meishileixing; 144 | } 145 | /** 146 | * 获取:美食类型 147 | */ 148 | public String getMeishileixing() { 149 | return meishileixing; 150 | } 151 | /** 152 | * 设置:图片 153 | */ 154 | public void setTupian(String tupian) { 155 | this.tupian = tupian; 156 | } 157 | /** 158 | * 获取:图片 159 | */ 160 | public String getTupian() { 161 | return tupian; 162 | } 163 | /** 164 | * 设置:口味 165 | */ 166 | public void setKouwei(String kouwei) { 167 | this.kouwei = kouwei; 168 | } 169 | /** 170 | * 获取:口味 171 | */ 172 | public String getKouwei() { 173 | return kouwei; 174 | } 175 | /** 176 | * 设置:特色 177 | */ 178 | public void setTese(String tese) { 179 | this.tese = tese; 180 | } 181 | /** 182 | * 获取:特色 183 | */ 184 | public String getTese() { 185 | return tese; 186 | } 187 | /** 188 | * 设置:城市 189 | */ 190 | public void setChengshi(String chengshi) { 191 | this.chengshi = chengshi; 192 | } 193 | /** 194 | * 获取:城市 195 | */ 196 | public String getChengshi() { 197 | return chengshi; 198 | } 199 | /** 200 | * 设置:打卡地点 201 | */ 202 | public void setDakadidian(String dakadidian) { 203 | this.dakadidian = dakadidian; 204 | } 205 | /** 206 | * 获取:打卡地点 207 | */ 208 | public String getDakadidian() { 209 | return dakadidian; 210 | } 211 | /** 212 | * 设置:人均消费 213 | */ 214 | public void setRenjunxiaofei(Float renjunxiaofei) { 215 | this.renjunxiaofei = renjunxiaofei; 216 | } 217 | /** 218 | * 获取:人均消费 219 | */ 220 | public Float getRenjunxiaofei() { 221 | return renjunxiaofei; 222 | } 223 | /** 224 | * 设置:详情 225 | */ 226 | public void setXiangqing(String xiangqing) { 227 | this.xiangqing = xiangqing; 228 | } 229 | /** 230 | * 获取:详情 231 | */ 232 | public String getXiangqing() { 233 | return xiangqing; 234 | } 235 | 236 | } 237 | -------------------------------------------------------------------------------- /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 | springboothw31x 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.apache.poi 112 | poi 113 | 3.11 114 | 115 | 116 | 117 | org.apache.poi 118 | poi-ooxml 119 | 3.9 120 | 121 | 122 | 123 | 124 | org.springframework.boot 125 | spring-boot-starter-test 126 | test 127 | 128 | 129 | org.junit.vintage 130 | junit-vintage-engine 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | springboothw31x 139 | 140 | 141 | org.springframework.boot 142 | spring-boot-maven-plugin 143 | 144 | 145 | 146 | org.apache.maven.plugins 147 | maven-surefire-plugin 148 | 149 | true 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /src/main/java/com/entity/LvyoujingdianEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 旅游景点 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2023-03-15 11:57:16 30 | */ 31 | @TableName("lvyoujingdian") 32 | public class LvyoujingdianEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public LvyoujingdianEntity() { 37 | 38 | } 39 | 40 | public LvyoujingdianEntity(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 jingdiantupian; 65 | 66 | /** 67 | * 景点分类 68 | */ 69 | 70 | private String jingdianfenlei; 71 | 72 | /** 73 | * 景点等级 74 | */ 75 | 76 | private String jingdiandengji; 77 | 78 | /** 79 | * 景点地址 80 | */ 81 | 82 | private String jingdiandizhi; 83 | 84 | /** 85 | * 开放时间 86 | */ 87 | 88 | private String kaifangshijian; 89 | 90 | /** 91 | * 旅游特点 92 | */ 93 | 94 | private String lvyoutedian; 95 | 96 | /** 97 | * 景点介绍 98 | */ 99 | 100 | private String jingdianjieshao; 101 | 102 | /** 103 | * 旅游文化 104 | */ 105 | 106 | private String lvyouwenhua; 107 | 108 | 109 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 110 | @DateTimeFormat 111 | private Date addtime; 112 | 113 | public Date getAddtime() { 114 | return addtime; 115 | } 116 | public void setAddtime(Date addtime) { 117 | this.addtime = addtime; 118 | } 119 | 120 | public Long getId() { 121 | return id; 122 | } 123 | 124 | public void setId(Long id) { 125 | this.id = id; 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 setJingdiantupian(String jingdiantupian) { 143 | this.jingdiantupian = jingdiantupian; 144 | } 145 | /** 146 | * 获取:景点图片 147 | */ 148 | public String getJingdiantupian() { 149 | return jingdiantupian; 150 | } 151 | /** 152 | * 设置:景点分类 153 | */ 154 | public void setJingdianfenlei(String jingdianfenlei) { 155 | this.jingdianfenlei = jingdianfenlei; 156 | } 157 | /** 158 | * 获取:景点分类 159 | */ 160 | public String getJingdianfenlei() { 161 | return jingdianfenlei; 162 | } 163 | /** 164 | * 设置:景点等级 165 | */ 166 | public void setJingdiandengji(String jingdiandengji) { 167 | this.jingdiandengji = jingdiandengji; 168 | } 169 | /** 170 | * 获取:景点等级 171 | */ 172 | public String getJingdiandengji() { 173 | return jingdiandengji; 174 | } 175 | /** 176 | * 设置:景点地址 177 | */ 178 | public void setJingdiandizhi(String jingdiandizhi) { 179 | this.jingdiandizhi = jingdiandizhi; 180 | } 181 | /** 182 | * 获取:景点地址 183 | */ 184 | public String getJingdiandizhi() { 185 | return jingdiandizhi; 186 | } 187 | /** 188 | * 设置:开放时间 189 | */ 190 | public void setKaifangshijian(String kaifangshijian) { 191 | this.kaifangshijian = kaifangshijian; 192 | } 193 | /** 194 | * 获取:开放时间 195 | */ 196 | public String getKaifangshijian() { 197 | return kaifangshijian; 198 | } 199 | /** 200 | * 设置:旅游特点 201 | */ 202 | public void setLvyoutedian(String lvyoutedian) { 203 | this.lvyoutedian = lvyoutedian; 204 | } 205 | /** 206 | * 获取:旅游特点 207 | */ 208 | public String getLvyoutedian() { 209 | return lvyoutedian; 210 | } 211 | /** 212 | * 设置:景点介绍 213 | */ 214 | public void setJingdianjieshao(String jingdianjieshao) { 215 | this.jingdianjieshao = jingdianjieshao; 216 | } 217 | /** 218 | * 获取:景点介绍 219 | */ 220 | public String getJingdianjieshao() { 221 | return jingdianjieshao; 222 | } 223 | /** 224 | * 设置:旅游文化 225 | */ 226 | public void setLvyouwenhua(String lvyouwenhua) { 227 | this.lvyouwenhua = lvyouwenhua; 228 | } 229 | /** 230 | * 获取:旅游文化 231 | */ 232 | public String getLvyouwenhua() { 233 | return lvyouwenhua; 234 | } 235 | 236 | } 237 | -------------------------------------------------------------------------------- /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 | springboothw31x 14 | 0.0.1-SNAPSHOT 15 | springboot-schema 16 | springboot学习框架 17 | 18 | 19 | 1.8 20 | 1.2.8 21 | 3.1.1 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-web 28 | 29 | 30 | org.mybatis.spring.boot 31 | mybatis-spring-boot-starter 32 | 2.1.1 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-jdbc 37 | 38 | 39 | 40 | mysql 41 | mysql-connector-java 42 | 43 | 44 | org.apache.shiro 45 | shiro-spring 46 | 1.3.2 47 | 48 | 49 | 50 | com.baomidou 51 | mybatis-plus 52 | 2.3 53 | 54 | 55 | com.baomidou 56 | mybatisplus-spring-boot-starter 57 | 1.0.5 58 | 59 | 60 | com.google.protobuf 61 | protobuf-java 62 | 3.10.0 63 | 64 | 65 | 66 | org.apache.commons 67 | commons-lang3 68 | 3.0 69 | 70 | 71 | 72 | javax.validation 73 | validation-api 74 | 2.0.1.Final 75 | 76 | 77 | 78 | commons-io 79 | commons-io 80 | 2.5 81 | 82 | 83 | 84 | 85 | cn.hutool 86 | hutool-all 87 | 4.0.12 88 | 89 | 90 | 91 | 92 | com.alibaba 93 | fastjson 94 | ${fastjson.version} 95 | 96 | 97 | com.microsoft.sqlserver 98 | sqljdbc4 99 | 4.0 100 | 4.0 101 | 102 | 103 | 104 | com.microsoft.sqlserver 105 | mssql-jdbc 106 | 6.2.0.jre8 107 | runtime 108 | 109 | 110 | 111 | com.baidu.aip 112 | java-sdk 113 | 4.4.1 114 | 115 | 116 | 117 | org.apache.poi 118 | poi 119 | 3.11 120 | 121 | 122 | 123 | org.apache.poi 124 | poi-ooxml 125 | 3.9 126 | 127 | 128 | 129 | 130 | org.springframework.boot 131 | spring-boot-starter-test 132 | test 133 | 134 | 135 | org.junit.vintage 136 | junit-vintage-engine 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | org.springframework.boot 146 | spring-boot-maven-plugin 147 | 148 | 149 | org.apache.maven.plugins 150 | maven-compiler-plugin 151 | 152 | 1.8 153 | 1.8 154 | 155 | 156 | 157 | org.apache.maven.plugins 158 | maven-surefire-plugin 159 | 160 | true 161 | 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /src/main/java/com/controller/UsersController.java: -------------------------------------------------------------------------------- 1 | 2 | package com.controller; 3 | 4 | 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Date; 8 | import java.util.Map; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Controller; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.PathVariable; 16 | import org.springframework.web.bind.annotation.PostMapping; 17 | import org.springframework.web.bind.annotation.RequestBody; 18 | import org.springframework.web.bind.annotation.RequestMapping; 19 | import org.springframework.web.bind.annotation.RequestParam; 20 | import org.springframework.web.bind.annotation.ResponseBody; 21 | import org.springframework.web.bind.annotation.RestController; 22 | 23 | import com.annotation.IgnoreAuth; 24 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 25 | import com.entity.TokenEntity; 26 | import com.entity.UsersEntity; 27 | import com.service.TokenService; 28 | import com.service.UsersService; 29 | import com.utils.CommonUtil; 30 | import com.utils.MPUtil; 31 | import com.utils.PageUtils; 32 | import com.utils.R; 33 | import com.utils.ValidatorUtils; 34 | 35 | /** 36 | * 登录相关 37 | */ 38 | @RequestMapping("users") 39 | @RestController 40 | public class UsersController{ 41 | 42 | @Autowired 43 | private UsersService userService; 44 | 45 | @Autowired 46 | private TokenService tokenService; 47 | 48 | /** 49 | * 登录 50 | */ 51 | @IgnoreAuth 52 | @PostMapping(value = "/login") 53 | public R login(String username, String password, String captcha, HttpServletRequest request) { 54 | UsersEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); 55 | if(user==null || !user.getPassword().equals(password)) { 56 | return R.error("账号或密码不正确"); 57 | } 58 | String token = tokenService.generateToken(user.getId(),username, "users", user.getRole()); 59 | return R.ok().put("token", token); 60 | } 61 | 62 | /** 63 | * 注册 64 | */ 65 | @IgnoreAuth 66 | @PostMapping(value = "/register") 67 | public R register(@RequestBody UsersEntity user){ 68 | // ValidatorUtils.validateEntity(user); 69 | if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { 70 | return R.error("用户已存在"); 71 | } 72 | userService.insert(user); 73 | return R.ok(); 74 | } 75 | 76 | /** 77 | * 退出 78 | */ 79 | @GetMapping(value = "logout") 80 | public R logout(HttpServletRequest request) { 81 | request.getSession().invalidate(); 82 | return R.ok("退出成功"); 83 | } 84 | 85 | /** 86 | * 密码重置 87 | */ 88 | @IgnoreAuth 89 | @RequestMapping(value = "/resetPass") 90 | public R resetPass(String username, HttpServletRequest request){ 91 | UsersEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); 92 | if(user==null) { 93 | return R.error("账号不存在"); 94 | } 95 | user.setPassword("123456"); 96 | userService.update(user,null); 97 | return R.ok("密码已重置为:123456"); 98 | } 99 | 100 | /** 101 | * 列表 102 | */ 103 | @RequestMapping("/page") 104 | public R page(@RequestParam Map params,UsersEntity user){ 105 | EntityWrapper ew = new EntityWrapper(); 106 | PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); 107 | return R.ok().put("data", page); 108 | } 109 | 110 | /** 111 | * 列表 112 | */ 113 | @RequestMapping("/list") 114 | public R list( UsersEntity user){ 115 | EntityWrapper ew = new EntityWrapper(); 116 | ew.allEq(MPUtil.allEQMapPre( user, "user")); 117 | return R.ok().put("data", userService.selectListView(ew)); 118 | } 119 | 120 | /** 121 | * 信息 122 | */ 123 | @RequestMapping("/info/{id}") 124 | public R info(@PathVariable("id") String id){ 125 | UsersEntity user = userService.selectById(id); 126 | return R.ok().put("data", user); 127 | } 128 | 129 | /** 130 | * 获取用户的session用户信息 131 | */ 132 | @RequestMapping("/session") 133 | public R getCurrUser(HttpServletRequest request){ 134 | Long id = (Long)request.getSession().getAttribute("userId"); 135 | UsersEntity user = userService.selectById(id); 136 | return R.ok().put("data", user); 137 | } 138 | 139 | /** 140 | * 保存 141 | */ 142 | @PostMapping("/save") 143 | public R save(@RequestBody UsersEntity user){ 144 | // ValidatorUtils.validateEntity(user); 145 | if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { 146 | return R.error("用户已存在"); 147 | } 148 | userService.insert(user); 149 | return R.ok(); 150 | } 151 | 152 | /** 153 | * 修改 154 | */ 155 | @RequestMapping("/update") 156 | public R update(@RequestBody UsersEntity user){ 157 | // ValidatorUtils.validateEntity(user); 158 | UsersEntity u = userService.selectOne(new EntityWrapper().eq("username", user.getUsername())); 159 | if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) { 160 | return R.error("用户名已存在。"); 161 | } 162 | userService.updateById(user);//全部更新 163 | return R.ok(); 164 | } 165 | 166 | /** 167 | * 删除 168 | */ 169 | @RequestMapping("/delete") 170 | public R delete(@RequestBody Long[] ids){ 171 | userService.deleteBatchIds(Arrays.asList(ids)); 172 | return R.ok(); 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /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/controller/AboutusController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.math.BigDecimal; 4 | import java.text.SimpleDateFormat; 5 | import java.text.ParseException; 6 | import java.util.ArrayList; 7 | import java.util.Arrays; 8 | import java.util.Calendar; 9 | import java.util.Map; 10 | import java.util.HashMap; 11 | import java.util.Iterator; 12 | import java.util.Date; 13 | import java.util.List; 14 | import javax.servlet.http.HttpServletRequest; 15 | 16 | import com.utils.ValidatorUtils; 17 | import org.apache.commons.lang3.StringUtils; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.transaction.annotation.Transactional; 20 | import org.springframework.format.annotation.DateTimeFormat; 21 | import org.springframework.web.bind.annotation.PathVariable; 22 | import org.springframework.web.bind.annotation.RequestBody; 23 | import org.springframework.web.bind.annotation.RequestMapping; 24 | import org.springframework.web.bind.annotation.RequestParam; 25 | import org.springframework.web.bind.annotation.RestController; 26 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 27 | import com.baomidou.mybatisplus.mapper.Wrapper; 28 | import com.annotation.IgnoreAuth; 29 | 30 | import com.entity.AboutusEntity; 31 | import com.entity.view.AboutusView; 32 | 33 | import com.service.AboutusService; 34 | import com.service.TokenService; 35 | import com.utils.PageUtils; 36 | import com.utils.R; 37 | import com.utils.MD5Util; 38 | import com.utils.MPUtil; 39 | import com.utils.CommonUtil; 40 | import java.io.IOException; 41 | 42 | /** 43 | * 关于我们 44 | * 后端接口 45 | * @author 46 | * @email 47 | * @date 2023-03-15 11:57:16 48 | */ 49 | @RestController 50 | @RequestMapping("/aboutus") 51 | public class AboutusController { 52 | @Autowired 53 | private AboutusService aboutusService; 54 | 55 | 56 | 57 | 58 | 59 | /** 60 | * 后端列表 61 | */ 62 | @RequestMapping("/page") 63 | public R page(@RequestParam Map params,AboutusEntity aboutus, 64 | HttpServletRequest request){ 65 | EntityWrapper ew = new EntityWrapper(); 66 | 67 | PageUtils page = aboutusService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, aboutus), params), params)); 68 | 69 | return R.ok().put("data", page); 70 | } 71 | 72 | /** 73 | * 前端列表 74 | */ 75 | @IgnoreAuth 76 | @RequestMapping("/list") 77 | public R list(@RequestParam Map params,AboutusEntity aboutus, 78 | HttpServletRequest request){ 79 | EntityWrapper ew = new EntityWrapper(); 80 | 81 | PageUtils page = aboutusService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, aboutus), params), params)); 82 | return R.ok().put("data", page); 83 | } 84 | 85 | /** 86 | * 列表 87 | */ 88 | @RequestMapping("/lists") 89 | public R list( AboutusEntity aboutus){ 90 | EntityWrapper ew = new EntityWrapper(); 91 | ew.allEq(MPUtil.allEQMapPre( aboutus, "aboutus")); 92 | return R.ok().put("data", aboutusService.selectListView(ew)); 93 | } 94 | 95 | /** 96 | * 查询 97 | */ 98 | @RequestMapping("/query") 99 | public R query(AboutusEntity aboutus){ 100 | EntityWrapper< AboutusEntity> ew = new EntityWrapper< AboutusEntity>(); 101 | ew.allEq(MPUtil.allEQMapPre( aboutus, "aboutus")); 102 | AboutusView aboutusView = aboutusService.selectView(ew); 103 | return R.ok("查询关于我们成功").put("data", aboutusView); 104 | } 105 | 106 | /** 107 | * 后端详情 108 | */ 109 | @RequestMapping("/info/{id}") 110 | public R info(@PathVariable("id") Long id){ 111 | AboutusEntity aboutus = aboutusService.selectById(id); 112 | return R.ok().put("data", aboutus); 113 | } 114 | 115 | /** 116 | * 前端详情 117 | */ 118 | @IgnoreAuth 119 | @RequestMapping("/detail/{id}") 120 | public R detail(@PathVariable("id") Long id){ 121 | AboutusEntity aboutus = aboutusService.selectById(id); 122 | return R.ok().put("data", aboutus); 123 | } 124 | 125 | 126 | 127 | 128 | /** 129 | * 后端保存 130 | */ 131 | @RequestMapping("/save") 132 | public R save(@RequestBody AboutusEntity aboutus, HttpServletRequest request){ 133 | aboutus.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 134 | //ValidatorUtils.validateEntity(aboutus); 135 | aboutusService.insert(aboutus); 136 | return R.ok(); 137 | } 138 | 139 | /** 140 | * 前端保存 141 | */ 142 | @RequestMapping("/add") 143 | public R add(@RequestBody AboutusEntity aboutus, HttpServletRequest request){ 144 | aboutus.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 145 | //ValidatorUtils.validateEntity(aboutus); 146 | aboutusService.insert(aboutus); 147 | return R.ok(); 148 | } 149 | 150 | 151 | 152 | /** 153 | * 修改 154 | */ 155 | @RequestMapping("/update") 156 | @Transactional 157 | public R update(@RequestBody AboutusEntity aboutus, HttpServletRequest request){ 158 | //ValidatorUtils.validateEntity(aboutus); 159 | aboutusService.updateById(aboutus);//全部更新 160 | return R.ok(); 161 | } 162 | 163 | 164 | 165 | 166 | /** 167 | * 删除 168 | */ 169 | @RequestMapping("/delete") 170 | public R delete(@RequestBody Long[] ids){ 171 | aboutusService.deleteBatchIds(Arrays.asList(ids)); 172 | return R.ok(); 173 | } 174 | 175 | /** 176 | * 提醒接口 177 | */ 178 | @RequestMapping("/remind/{columnName}/{type}") 179 | public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 180 | @PathVariable("type") String type,@RequestParam Map map) { 181 | map.put("column", columnName); 182 | map.put("type", type); 183 | 184 | if(type.equals("2")) { 185 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 186 | Calendar c = Calendar.getInstance(); 187 | Date remindStartDate = null; 188 | Date remindEndDate = null; 189 | if(map.get("remindstart")!=null) { 190 | Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); 191 | c.setTime(new Date()); 192 | c.add(Calendar.DAY_OF_MONTH,remindStart); 193 | remindStartDate = c.getTime(); 194 | map.put("remindstart", sdf.format(remindStartDate)); 195 | } 196 | if(map.get("remindend")!=null) { 197 | Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); 198 | c.setTime(new Date()); 199 | c.add(Calendar.DAY_OF_MONTH,remindEnd); 200 | remindEndDate = c.getTime(); 201 | map.put("remindend", sdf.format(remindEndDate)); 202 | } 203 | } 204 | 205 | Wrapper wrapper = new EntityWrapper(); 206 | if(map.get("remindstart")!=null) { 207 | wrapper.ge(columnName, map.get("remindstart")); 208 | } 209 | if(map.get("remindend")!=null) { 210 | wrapper.le(columnName, map.get("remindend")); 211 | } 212 | 213 | 214 | int count = aboutusService.selectCount(wrapper); 215 | return R.ok().put("count", count); 216 | } 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | } 228 | -------------------------------------------------------------------------------- /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/TesemeishiController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.math.BigDecimal; 4 | import java.text.SimpleDateFormat; 5 | import java.text.ParseException; 6 | import java.util.ArrayList; 7 | import java.util.Arrays; 8 | import java.util.Calendar; 9 | import java.util.Map; 10 | import java.util.HashMap; 11 | import java.util.Iterator; 12 | import java.util.Date; 13 | import java.util.List; 14 | import javax.servlet.http.HttpServletRequest; 15 | 16 | import com.utils.ValidatorUtils; 17 | import org.apache.commons.lang3.StringUtils; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.transaction.annotation.Transactional; 20 | import org.springframework.format.annotation.DateTimeFormat; 21 | import org.springframework.web.bind.annotation.PathVariable; 22 | import org.springframework.web.bind.annotation.RequestBody; 23 | import org.springframework.web.bind.annotation.RequestMapping; 24 | import org.springframework.web.bind.annotation.RequestParam; 25 | import org.springframework.web.bind.annotation.RestController; 26 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 27 | import com.baomidou.mybatisplus.mapper.Wrapper; 28 | import com.annotation.IgnoreAuth; 29 | 30 | import com.entity.TesemeishiEntity; 31 | import com.entity.view.TesemeishiView; 32 | 33 | import com.service.TesemeishiService; 34 | import com.service.TokenService; 35 | import com.utils.PageUtils; 36 | import com.utils.R; 37 | import com.utils.MD5Util; 38 | import com.utils.MPUtil; 39 | import com.utils.CommonUtil; 40 | import java.io.IOException; 41 | 42 | /** 43 | * 特色美食 44 | * 后端接口 45 | * @author 46 | * @email 47 | * @date 2023-03-15 11:57:16 48 | */ 49 | @RestController 50 | @RequestMapping("/tesemeishi") 51 | public class TesemeishiController { 52 | @Autowired 53 | private TesemeishiService tesemeishiService; 54 | 55 | 56 | 57 | 58 | 59 | /** 60 | * 后端列表 61 | */ 62 | @RequestMapping("/page") 63 | public R page(@RequestParam Map params,TesemeishiEntity tesemeishi, 64 | HttpServletRequest request){ 65 | EntityWrapper ew = new EntityWrapper(); 66 | 67 | PageUtils page = tesemeishiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, tesemeishi), params), params)); 68 | 69 | return R.ok().put("data", page); 70 | } 71 | 72 | /** 73 | * 前端列表 74 | */ 75 | @IgnoreAuth 76 | @RequestMapping("/list") 77 | public R list(@RequestParam Map params,TesemeishiEntity tesemeishi, 78 | HttpServletRequest request){ 79 | EntityWrapper ew = new EntityWrapper(); 80 | 81 | PageUtils page = tesemeishiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, tesemeishi), params), params)); 82 | return R.ok().put("data", page); 83 | } 84 | 85 | /** 86 | * 列表 87 | */ 88 | @RequestMapping("/lists") 89 | public R list( TesemeishiEntity tesemeishi){ 90 | EntityWrapper ew = new EntityWrapper(); 91 | ew.allEq(MPUtil.allEQMapPre( tesemeishi, "tesemeishi")); 92 | return R.ok().put("data", tesemeishiService.selectListView(ew)); 93 | } 94 | 95 | /** 96 | * 查询 97 | */ 98 | @RequestMapping("/query") 99 | public R query(TesemeishiEntity tesemeishi){ 100 | EntityWrapper< TesemeishiEntity> ew = new EntityWrapper< TesemeishiEntity>(); 101 | ew.allEq(MPUtil.allEQMapPre( tesemeishi, "tesemeishi")); 102 | TesemeishiView tesemeishiView = tesemeishiService.selectView(ew); 103 | return R.ok("查询特色美食成功").put("data", tesemeishiView); 104 | } 105 | 106 | /** 107 | * 后端详情 108 | */ 109 | @RequestMapping("/info/{id}") 110 | public R info(@PathVariable("id") Long id){ 111 | TesemeishiEntity tesemeishi = tesemeishiService.selectById(id); 112 | return R.ok().put("data", tesemeishi); 113 | } 114 | 115 | /** 116 | * 前端详情 117 | */ 118 | @IgnoreAuth 119 | @RequestMapping("/detail/{id}") 120 | public R detail(@PathVariable("id") Long id){ 121 | TesemeishiEntity tesemeishi = tesemeishiService.selectById(id); 122 | return R.ok().put("data", tesemeishi); 123 | } 124 | 125 | 126 | 127 | 128 | /** 129 | * 后端保存 130 | */ 131 | @RequestMapping("/save") 132 | public R save(@RequestBody TesemeishiEntity tesemeishi, HttpServletRequest request){ 133 | tesemeishi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 134 | //ValidatorUtils.validateEntity(tesemeishi); 135 | tesemeishiService.insert(tesemeishi); 136 | return R.ok(); 137 | } 138 | 139 | /** 140 | * 前端保存 141 | */ 142 | @RequestMapping("/add") 143 | public R add(@RequestBody TesemeishiEntity tesemeishi, HttpServletRequest request){ 144 | tesemeishi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 145 | //ValidatorUtils.validateEntity(tesemeishi); 146 | tesemeishiService.insert(tesemeishi); 147 | return R.ok(); 148 | } 149 | 150 | 151 | 152 | /** 153 | * 修改 154 | */ 155 | @RequestMapping("/update") 156 | @Transactional 157 | public R update(@RequestBody TesemeishiEntity tesemeishi, HttpServletRequest request){ 158 | //ValidatorUtils.validateEntity(tesemeishi); 159 | tesemeishiService.updateById(tesemeishi);//全部更新 160 | return R.ok(); 161 | } 162 | 163 | 164 | 165 | 166 | /** 167 | * 删除 168 | */ 169 | @RequestMapping("/delete") 170 | public R delete(@RequestBody Long[] ids){ 171 | tesemeishiService.deleteBatchIds(Arrays.asList(ids)); 172 | return R.ok(); 173 | } 174 | 175 | /** 176 | * 提醒接口 177 | */ 178 | @RequestMapping("/remind/{columnName}/{type}") 179 | public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 180 | @PathVariable("type") String type,@RequestParam Map map) { 181 | map.put("column", columnName); 182 | map.put("type", type); 183 | 184 | if(type.equals("2")) { 185 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 186 | Calendar c = Calendar.getInstance(); 187 | Date remindStartDate = null; 188 | Date remindEndDate = null; 189 | if(map.get("remindstart")!=null) { 190 | Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); 191 | c.setTime(new Date()); 192 | c.add(Calendar.DAY_OF_MONTH,remindStart); 193 | remindStartDate = c.getTime(); 194 | map.put("remindstart", sdf.format(remindStartDate)); 195 | } 196 | if(map.get("remindend")!=null) { 197 | Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); 198 | c.setTime(new Date()); 199 | c.add(Calendar.DAY_OF_MONTH,remindEnd); 200 | remindEndDate = c.getTime(); 201 | map.put("remindend", sdf.format(remindEndDate)); 202 | } 203 | } 204 | 205 | Wrapper wrapper = new EntityWrapper(); 206 | if(map.get("remindstart")!=null) { 207 | wrapper.ge(columnName, map.get("remindstart")); 208 | } 209 | if(map.get("remindend")!=null) { 210 | wrapper.le(columnName, map.get("remindend")); 211 | } 212 | 213 | 214 | int count = tesemeishiService.selectCount(wrapper); 215 | return R.ok().put("count", count); 216 | } 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | } 228 | -------------------------------------------------------------------------------- /src/main/java/com/controller/JiudianxinxiController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.math.BigDecimal; 4 | import java.text.SimpleDateFormat; 5 | import java.text.ParseException; 6 | import java.util.ArrayList; 7 | import java.util.Arrays; 8 | import java.util.Calendar; 9 | import java.util.Map; 10 | import java.util.HashMap; 11 | import java.util.Iterator; 12 | import java.util.Date; 13 | import java.util.List; 14 | import javax.servlet.http.HttpServletRequest; 15 | 16 | import com.utils.ValidatorUtils; 17 | import org.apache.commons.lang3.StringUtils; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.transaction.annotation.Transactional; 20 | import org.springframework.format.annotation.DateTimeFormat; 21 | import org.springframework.web.bind.annotation.PathVariable; 22 | import org.springframework.web.bind.annotation.RequestBody; 23 | import org.springframework.web.bind.annotation.RequestMapping; 24 | import org.springframework.web.bind.annotation.RequestParam; 25 | import org.springframework.web.bind.annotation.RestController; 26 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 27 | import com.baomidou.mybatisplus.mapper.Wrapper; 28 | import com.annotation.IgnoreAuth; 29 | 30 | import com.entity.JiudianxinxiEntity; 31 | import com.entity.view.JiudianxinxiView; 32 | 33 | import com.service.JiudianxinxiService; 34 | import com.service.TokenService; 35 | import com.utils.PageUtils; 36 | import com.utils.R; 37 | import com.utils.MD5Util; 38 | import com.utils.MPUtil; 39 | import com.utils.CommonUtil; 40 | import java.io.IOException; 41 | 42 | /** 43 | * 酒店信息 44 | * 后端接口 45 | * @author 46 | * @email 47 | * @date 2023-03-15 11:57:16 48 | */ 49 | @RestController 50 | @RequestMapping("/jiudianxinxi") 51 | public class JiudianxinxiController { 52 | @Autowired 53 | private JiudianxinxiService jiudianxinxiService; 54 | 55 | 56 | 57 | 58 | 59 | /** 60 | * 后端列表 61 | */ 62 | @RequestMapping("/page") 63 | public R page(@RequestParam Map params,JiudianxinxiEntity jiudianxinxi, 64 | HttpServletRequest request){ 65 | EntityWrapper ew = new EntityWrapper(); 66 | 67 | PageUtils page = jiudianxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiudianxinxi), params), params)); 68 | 69 | return R.ok().put("data", page); 70 | } 71 | 72 | /** 73 | * 前端列表 74 | */ 75 | @IgnoreAuth 76 | @RequestMapping("/list") 77 | public R list(@RequestParam Map params,JiudianxinxiEntity jiudianxinxi, 78 | HttpServletRequest request){ 79 | EntityWrapper ew = new EntityWrapper(); 80 | 81 | PageUtils page = jiudianxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiudianxinxi), params), params)); 82 | return R.ok().put("data", page); 83 | } 84 | 85 | /** 86 | * 列表 87 | */ 88 | @RequestMapping("/lists") 89 | public R list( JiudianxinxiEntity jiudianxinxi){ 90 | EntityWrapper ew = new EntityWrapper(); 91 | ew.allEq(MPUtil.allEQMapPre( jiudianxinxi, "jiudianxinxi")); 92 | return R.ok().put("data", jiudianxinxiService.selectListView(ew)); 93 | } 94 | 95 | /** 96 | * 查询 97 | */ 98 | @RequestMapping("/query") 99 | public R query(JiudianxinxiEntity jiudianxinxi){ 100 | EntityWrapper< JiudianxinxiEntity> ew = new EntityWrapper< JiudianxinxiEntity>(); 101 | ew.allEq(MPUtil.allEQMapPre( jiudianxinxi, "jiudianxinxi")); 102 | JiudianxinxiView jiudianxinxiView = jiudianxinxiService.selectView(ew); 103 | return R.ok("查询酒店信息成功").put("data", jiudianxinxiView); 104 | } 105 | 106 | /** 107 | * 后端详情 108 | */ 109 | @RequestMapping("/info/{id}") 110 | public R info(@PathVariable("id") Long id){ 111 | JiudianxinxiEntity jiudianxinxi = jiudianxinxiService.selectById(id); 112 | return R.ok().put("data", jiudianxinxi); 113 | } 114 | 115 | /** 116 | * 前端详情 117 | */ 118 | @IgnoreAuth 119 | @RequestMapping("/detail/{id}") 120 | public R detail(@PathVariable("id") Long id){ 121 | JiudianxinxiEntity jiudianxinxi = jiudianxinxiService.selectById(id); 122 | return R.ok().put("data", jiudianxinxi); 123 | } 124 | 125 | 126 | 127 | 128 | /** 129 | * 后端保存 130 | */ 131 | @RequestMapping("/save") 132 | public R save(@RequestBody JiudianxinxiEntity jiudianxinxi, HttpServletRequest request){ 133 | jiudianxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 134 | //ValidatorUtils.validateEntity(jiudianxinxi); 135 | jiudianxinxiService.insert(jiudianxinxi); 136 | return R.ok(); 137 | } 138 | 139 | /** 140 | * 前端保存 141 | */ 142 | @RequestMapping("/add") 143 | public R add(@RequestBody JiudianxinxiEntity jiudianxinxi, HttpServletRequest request){ 144 | jiudianxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 145 | //ValidatorUtils.validateEntity(jiudianxinxi); 146 | jiudianxinxiService.insert(jiudianxinxi); 147 | return R.ok(); 148 | } 149 | 150 | 151 | 152 | /** 153 | * 修改 154 | */ 155 | @RequestMapping("/update") 156 | @Transactional 157 | public R update(@RequestBody JiudianxinxiEntity jiudianxinxi, HttpServletRequest request){ 158 | //ValidatorUtils.validateEntity(jiudianxinxi); 159 | jiudianxinxiService.updateById(jiudianxinxi);//全部更新 160 | return R.ok(); 161 | } 162 | 163 | 164 | 165 | 166 | /** 167 | * 删除 168 | */ 169 | @RequestMapping("/delete") 170 | public R delete(@RequestBody Long[] ids){ 171 | jiudianxinxiService.deleteBatchIds(Arrays.asList(ids)); 172 | return R.ok(); 173 | } 174 | 175 | /** 176 | * 提醒接口 177 | */ 178 | @RequestMapping("/remind/{columnName}/{type}") 179 | public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 180 | @PathVariable("type") String type,@RequestParam Map map) { 181 | map.put("column", columnName); 182 | map.put("type", type); 183 | 184 | if(type.equals("2")) { 185 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 186 | Calendar c = Calendar.getInstance(); 187 | Date remindStartDate = null; 188 | Date remindEndDate = null; 189 | if(map.get("remindstart")!=null) { 190 | Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); 191 | c.setTime(new Date()); 192 | c.add(Calendar.DAY_OF_MONTH,remindStart); 193 | remindStartDate = c.getTime(); 194 | map.put("remindstart", sdf.format(remindStartDate)); 195 | } 196 | if(map.get("remindend")!=null) { 197 | Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); 198 | c.setTime(new Date()); 199 | c.add(Calendar.DAY_OF_MONTH,remindEnd); 200 | remindEndDate = c.getTime(); 201 | map.put("remindend", sdf.format(remindEndDate)); 202 | } 203 | } 204 | 205 | Wrapper wrapper = new EntityWrapper(); 206 | if(map.get("remindstart")!=null) { 207 | wrapper.ge(columnName, map.get("remindstart")); 208 | } 209 | if(map.get("remindend")!=null) { 210 | wrapper.le(columnName, map.get("remindend")); 211 | } 212 | 213 | 214 | int count = jiudianxinxiService.selectCount(wrapper); 215 | return R.ok().put("count", count); 216 | } 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | } 228 | --------------------------------------------------------------------------------