├── image ├── 1.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png ├── limage ├── 1.png ├── 2.png └── 3.png ├── .idea ├── encodings.xml ├── modules.xml ├── misc.xml ├── libraries │ ├── Maven__dom4j_dom4j_1_6_1.xml │ ├── Maven__log4j_log4j_1_2_17.xml │ ├── Maven__org_apache_poi_poi_3_9.xml │ ├── Maven__org_ow2_asm_asm_5_0_4.xml │ ├── Maven__stax_stax_api_1_0_1.xml │ ├── Maven__org_apache_ant_ant_1_8_2.xml │ ├── Maven__org_json_json_20160810.xml │ ├── Maven__org_yaml_snakeyaml_1_25.xml │ ├── Maven__org_hamcrest_hamcrest_2_1.xml │ ├── Maven__com_zaxxer_HikariCP_3_4_1.xml │ ├── Maven__commons_io_commons_io_2_2.xml │ ├── Maven__org_mybatis_mybatis_3_5_3.xml │ ├── Maven__xml_apis_xml_apis_1_0_b2.xml │ ├── Maven__com_alibaba_fastjson_1_2_8.xml │ ├── Maven__net_minidev_json_smart_2_3.xml │ ├── Maven__org_objenesis_objenesis_2_6.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_29.xml │ ├── Maven__com_baidu_aip_java_sdk_4_4_1.xml │ ├── Maven__org_apache_poi_poi_ooxml_3_9.xml │ ├── Maven__cn_hutool_hutool_all_4_0_12.xml │ ├── Maven__com_baomidou_mybatis_plus_2_3.xml │ ├── Maven__com_fasterxml_classmate_1_5_1.xml │ ├── Maven__org_apache_poi_poi_examples_3_9.xml │ ├── Maven__org_apache_poi_poi_excelant_3_9.xml │ ├── Maven__org_opentest4j_opentest4j_1_2_0.xml │ ├── Maven__org_slf4j_jul_to_slf4j_1_7_29.xml │ ├── Maven__net_bytebuddy_byte_buddy_1_10_4.xml │ ├── Maven__org_apache_shiro_shiro_web_1_3_2.xml │ ├── Maven__org_mockito_mockito_core_3_1_0.xml │ ├── Maven__org_skyscreamer_jsonassert_1_5_0.xml │ ├── Maven__org_xmlunit_xmlunit_core_2_6_3.xml │ ├── Maven__net_minidev_accessors_smart_1_2.xml │ ├── Maven__org_apache_shiro_shiro_core_1_3_2.xml │ ├── Maven__org_apache_xmlbeans_xmlbeans_2_3_0.xml │ ├── Maven__org_assertj_assertj_core_3_13_2.xml │ ├── Maven__commons_codec_commons_codec_1_13.xml │ ├── Maven__ch_qos_logback_logback_core_1_2_3.xml │ ├── Maven__com_github_jsqlparser_jsqlparser_1_1.xml │ ├── Maven__com_jayway_jsonpath_json_path_2_4_0.xml │ ├── Maven__org_apache_ant_ant_launcher_1_8_2.xml │ ├── Maven__org_apache_poi_poi_scratchpad_3_9.xml │ ├── Maven__org_mybatis_mybatis_spring_2_0_3.xml │ ├── Maven__com_baomidou_mybatis_plus_core_2_3.xml │ ├── Maven__org_apache_commons_commons_lang3_3_0.xml │ ├── Maven__org_apache_shiro_shiro_spring_1_3_2.xml │ ├── Maven__ch_qos_logback_logback_classic_1_2_3.xml │ ├── Maven__org_apache_poi_poi_ooxml_schemas_3_9.xml │ ├── Maven__org_junit_jupiter_junit_jupiter_5_5_2.xml │ ├── Maven__mysql_mysql_connector_java_8_0_18.xml │ ├── Maven__org_apiguardian_apiguardian_api_1_1_0.xml │ ├── Maven__org_apache_logging_log4j_log4j_api_2_12_1.xml │ ├── Maven__com_baomidou_mybatis_plus_support_2_3.xml │ ├── Maven__net_bytebuddy_byte_buddy_agent_1_10_4.xml │ ├── Maven__org_unbescape_unbescape_1_1_6_RELEASE.xml │ ├── Maven__com_google_protobuf_protobuf_java_3_10_0.xml │ ├── Maven__org_thymeleaf_thymeleaf_3_0_11_RELEASE.xml │ ├── Maven__com_baomidou_mybatis_plus_generate_2_3.xml │ ├── Maven__org_attoparser_attoparser_2_0_5_RELEASE.xml │ ├── Maven__commons_beanutils_commons_beanutils_1_8_3.xml │ ├── Maven__org_junit_jupiter_junit_jupiter_api_5_5_2.xml │ ├── Maven__org_mockito_mockito_junit_jupiter_3_1_0.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_10_1.xml │ ├── Maven__org_springframework_spring_tx_5_2_2_RELEASE.xml │ ├── Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_2.xml │ ├── Maven__javax_validation_validation_api_2_0_1_Final.xml │ ├── Maven__org_apache_logging_log4j_log4j_to_slf4j_2_12_1.xml │ ├── Maven__org_jboss_logging_jboss_logging_3_4_1_Final.xml │ ├── Maven__org_springframework_spring_aop_5_2_2_RELEASE.xml │ ├── Maven__org_springframework_spring_jcl_5_2_2_RELEASE.xml │ ├── Maven__org_springframework_spring_web_5_2_2_RELEASE.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_29.xml │ ├── Maven__org_junit_jupiter_junit_jupiter_engine_5_5_2.xml │ ├── Maven__org_junit_jupiter_junit_jupiter_params_5_5_2.xml │ ├── Maven__org_springframework_spring_core_5_2_2_RELEASE.xml │ ├── Maven__org_springframework_spring_jdbc_5_2_2_RELEASE.xml │ ├── Maven__org_springframework_spring_test_5_2_2_RELEASE.xml │ ├── Maven__org_springframework_spring_beans_5_2_2_RELEASE.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_29.xml │ ├── Maven__org_junit_platform_junit_platform_engine_1_5_2.xml │ ├── Maven__org_springframework_spring_webmvc_5_2_2_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_10_1.xml │ ├── Maven__jakarta_activation_jakarta_activation_api_1_2_1.xml │ ├── Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml │ ├── Maven__jakarta_validation_jakarta_validation_api_2_0_1.xml │ ├── Maven__org_junit_platform_junit_platform_commons_1_5_2.xml │ ├── Maven__org_springframework_boot_spring_boot_2_2_2_RELEASE.xml │ ├── Maven__org_springframework_spring_context_5_2_2_RELEASE.xml │ ├── Maven__org_thymeleaf_thymeleaf_spring5_3_0_11_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_10_1.xml │ ├── Maven__org_springframework_spring_expression_5_2_2_RELEASE.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_29.xml │ ├── Maven__com_baomidou_mybatisplus_spring_boot_starter_1_0_5.xml │ ├── Maven__org_springframework_boot_spring_boot_test_2_2_2_RELEASE.xml │ ├── Maven__org_hibernate_validator_hibernate_validator_6_0_18_Final.xml │ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_10_1.xml │ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_1_1.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_2_2_2_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_10_1.xml │ ├── Maven__org_springframework_boot_spring_boot_devtools_2_2_2_RELEASE.xml │ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_web_2_2_2_RELEASE.xml │ ├── Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_4_RELEASE.xml │ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_1_1.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_jdbc_2_2_2_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_json_2_2_2_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_test_2_2_2_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_2_2_2_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_10_1.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_tomcat_2_2_2_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_logging_2_2_2_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_2_2_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_validation_2_2_2_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_2_2_RELEASE.xml │ └── Maven__org_springframework_boot_spring_boot_configuration_processor_2_2_2_RELEASE.xml └── compiler.xml ├── src └── main │ ├── java │ └── com │ │ ├── dao │ │ ├── ConfigDao.java │ │ ├── CartDao.java │ │ ├── TushuDao.java │ │ ├── YonghuDao.java │ │ ├── AddressDao.java │ │ ├── DictionaryDao.java │ │ ├── TushuOrderDao.java │ │ ├── UsersDao.java │ │ ├── TokenDao.java │ │ ├── TushuCollectionDao.java │ │ ├── TushuCommentbackDao.java │ │ └── CommonDao.java │ │ ├── annotation │ │ ├── IgnoreAuth.java │ │ ├── LoginUser.java │ │ └── APPLoginUser.java │ │ ├── utils │ │ ├── StringUtil.java │ │ ├── CommonUtil.java │ │ ├── FileUtil.java │ │ ├── JQPageInfo.java │ │ ├── R.java │ │ ├── SQLFilter.java │ │ ├── HttpClientUtils.java │ │ ├── ValidatorUtils.java │ │ ├── SpringContextUtils.java │ │ ├── PageUtils.java │ │ ├── Query.java │ │ ├── BaiduUtil.java │ │ └── PoiUtil.java │ │ ├── service │ │ ├── ConfigService.java │ │ ├── CartService.java │ │ ├── TushuService.java │ │ ├── YonghuService.java │ │ ├── AddressService.java │ │ ├── TushuOrderService.java │ │ ├── TushuCollectionService.java │ │ ├── TushuCommentbackService.java │ │ ├── DictionaryService.java │ │ ├── UsersService.java │ │ ├── TokenService.java │ │ ├── impl │ │ │ ├── ConfigServiceImpl.java │ │ │ ├── CartServiceImpl.java │ │ │ ├── TushuServiceImpl.java │ │ │ ├── YonghuServiceImpl.java │ │ │ ├── AddressServiceImpl.java │ │ │ ├── TushuOrderServiceImpl.java │ │ │ ├── TushuCollectionServiceImpl.java │ │ │ ├── TushuCommentbackServiceImpl.java │ │ │ ├── UsersServiceImpl.java │ │ │ └── TokenServiceImpl.java │ │ └── CommonService.java │ │ ├── config │ │ ├── MybatisPlusConfig.java │ │ ├── MyMetaObjectHandler.java │ │ └── InterceptorConfig.java │ │ ├── thread │ │ └── MyThreadMethod.java │ │ ├── model │ │ └── enums │ │ │ └── TypeEnum.java │ │ ├── tushushangchengApplication.java │ │ ├── entity │ │ ├── EIException.java │ │ ├── ConfigEntity.java │ │ ├── view │ │ │ ├── DictionaryView.java │ │ │ ├── TushuView.java │ │ │ └── YonghuView.java │ │ ├── UsersEntity.java │ │ ├── TokenEntity.java │ │ ├── model │ │ │ ├── TushuCollectionModel.java │ │ │ ├── CartModel.java │ │ │ ├── DictionaryModel.java │ │ │ ├── TushuCommentbackModel.java │ │ │ └── AddressModel.java │ │ └── vo │ │ │ ├── TushuCollectionVO.java │ │ │ ├── CartVO.java │ │ │ └── DictionaryVO.java │ │ ├── ServletContextListener │ │ └── DictionaryServletContextListener.java │ │ ├── controller │ │ ├── ConfigController.java │ │ └── FileController.java │ │ └── interceptor │ │ └── AuthorizationInterceptor.java │ └── resources │ └── application.yml └── README.md /image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/1.png -------------------------------------------------------------------------------- /image/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/10.png -------------------------------------------------------------------------------- /image/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/11.png -------------------------------------------------------------------------------- /image/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/12.png -------------------------------------------------------------------------------- /image/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/13.png -------------------------------------------------------------------------------- /image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/2.png -------------------------------------------------------------------------------- /image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/3.png -------------------------------------------------------------------------------- /image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/4.png -------------------------------------------------------------------------------- /image/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/5.png -------------------------------------------------------------------------------- /image/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/6.png -------------------------------------------------------------------------------- /image/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/7.png -------------------------------------------------------------------------------- /image/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/8.png -------------------------------------------------------------------------------- /image/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/image/9.png -------------------------------------------------------------------------------- /limage/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/limage/1.png -------------------------------------------------------------------------------- /limage/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/limage/2.png -------------------------------------------------------------------------------- /limage/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No60Book-Mall-Management-System/HEAD/limage/3.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/utils/StringUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | public class StringUtil { 4 | 5 | public static boolean isEmpty(String s){ 6 | if(s==null || s.equals("") || s.equals("null")){ 7 | return true; 8 | } 9 | return false; 10 | } 11 | 12 | public static boolean isNotEmpty(String s){ 13 | return !StringUtil.isEmpty(s); 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 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/com/service/ConfigService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.Map; 5 | 6 | import com.baomidou.mybatisplus.service.IService; 7 | import com.entity.ConfigEntity; 8 | import com.utils.PageUtils; 9 | 10 | 11 | /** 12 | * 系统用户 13 | * @author yangliyuan 14 | * @date 2019年10月10日 上午9:18:20 15 | */ 16 | public interface ConfigService extends IService { 17 | PageUtils queryPage(Map params); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/service/CartService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.utils.PageUtils; 5 | import com.entity.CartEntity; 6 | import java.util.Map; 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * 购物车 服务类 11 | */ 12 | public interface CartService extends IService { 13 | 14 | /** 15 | * @param params 查询参数 16 | * @return 带分页的查询出来的数据 17 | */ 18 | PageUtils queryPage(Map params); 19 | } -------------------------------------------------------------------------------- /src/main/java/com/service/TushuService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.utils.PageUtils; 5 | import com.entity.TushuEntity; 6 | import java.util.Map; 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * 图书 服务类 11 | */ 12 | public interface TushuService extends IService { 13 | 14 | /** 15 | * @param params 查询参数 16 | * @return 带分页的查询出来的数据 17 | */ 18 | PageUtils queryPage(Map params); 19 | } -------------------------------------------------------------------------------- /src/main/java/com/service/YonghuService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.utils.PageUtils; 5 | import com.entity.YonghuEntity; 6 | import java.util.Map; 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * 用户 服务类 11 | */ 12 | public interface YonghuService extends IService { 13 | 14 | /** 15 | * @param params 查询参数 16 | * @return 带分页的查询出来的数据 17 | */ 18 | PageUtils queryPage(Map params); 19 | } -------------------------------------------------------------------------------- /src/main/java/com/service/AddressService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.utils.PageUtils; 5 | import com.entity.AddressEntity; 6 | import java.util.Map; 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * 收货地址 服务类 11 | */ 12 | public interface AddressService extends IService { 13 | 14 | /** 15 | * @param params 查询参数 16 | * @return 带分页的查询出来的数据 17 | */ 18 | PageUtils queryPage(Map params); 19 | } -------------------------------------------------------------------------------- /.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/service/TushuOrderService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.utils.PageUtils; 5 | import com.entity.TushuOrderEntity; 6 | import java.util.Map; 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * 图书订单 服务类 11 | */ 12 | public interface TushuOrderService extends IService { 13 | 14 | /** 15 | * @param params 查询参数 16 | * @return 带分页的查询出来的数据 17 | */ 18 | PageUtils queryPage(Map params); 19 | } -------------------------------------------------------------------------------- /.idea/libraries/Maven__log4j_log4j_1_2_17.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_poi_poi_3_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_ow2_asm_asm_5_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__stax_stax_api_1_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/service/TushuCollectionService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.utils.PageUtils; 5 | import com.entity.TushuCollectionEntity; 6 | import java.util.Map; 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * 图书收藏 服务类 11 | */ 12 | public interface TushuCollectionService extends IService { 13 | 14 | /** 15 | * @param params 查询参数 16 | * @return 带分页的查询出来的数据 17 | */ 18 | PageUtils queryPage(Map params); 19 | } -------------------------------------------------------------------------------- /src/main/java/com/service/TushuCommentbackService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.utils.PageUtils; 5 | import com.entity.TushuCommentbackEntity; 6 | import java.util.Map; 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * 图书评价 服务类 11 | */ 12 | public interface TushuCommentbackService extends IService { 13 | 14 | /** 15 | * @param params 查询参数 16 | * @return 带分页的查询出来的数据 17 | */ 18 | PageUtils queryPage(Map params); 19 | } -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_ant_ant_1_8_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_json_json_20160810.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_yaml_snakeyaml_1_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_zaxxer_HikariCP_3_4_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_io_commons_io_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_3_5_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__xml_apis_xml_apis_1_0_b2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_fastjson_1_2_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_json_smart_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_objenesis_objenesis_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_29.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dao/CartDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.CartEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.view.CartView; 11 | 12 | /** 13 | * 购物车 Dao 接口 14 | * 15 | * @author 16 | */ 17 | public interface CartDao extends BaseMapper { 18 | 19 | List selectListView(Pagination page,@Param("params")Map params); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baidu_aip_java_sdk_4_4_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_poi_poi_ooxml_3_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dao/TushuDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.TushuEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.view.TushuView; 11 | 12 | /** 13 | * 图书 Dao 接口 14 | * 15 | * @author 16 | */ 17 | public interface TushuDao extends BaseMapper { 18 | 19 | List selectListView(Pagination page,@Param("params")Map params); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__cn_hutool_hutool_all_4_0_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_classmate_1_5_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.view.YonghuView; 11 | 12 | /** 13 | * 用户 Dao 接口 14 | * 15 | * @author 16 | */ 17 | public interface YonghuDao extends BaseMapper { 18 | 19 | List selectListView(Pagination page,@Param("params")Map params); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/dao/AddressDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.AddressEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.view.AddressView; 11 | 12 | /** 13 | * 收货地址 Dao 接口 14 | * 15 | * @author 16 | */ 17 | public interface AddressDao extends BaseMapper { 18 | 19 | List selectListView(Pagination page,@Param("params")Map params); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_poi_poi_examples_3_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_poi_poi_excelant_3_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_29.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_10_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_web_1_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mockito_mockito_core_3_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_6_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_accessors_smart_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_core_1_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_xmlbeans_xmlbeans_2_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_assertj_assertj_core_3_13_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dao/DictionaryDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.DictionaryEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.view.DictionaryView; 11 | 12 | /** 13 | * 字典 Dao 接口 14 | * 15 | * @author 16 | */ 17 | public interface DictionaryDao extends BaseMapper { 18 | 19 | List selectListView(Pagination page,@Param("params")Map params); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_codec_commons_codec_1_13.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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/TushuOrderDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.TushuOrderEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.view.TushuOrderView; 11 | 12 | /** 13 | * 图书订单 Dao 接口 14 | * 15 | * @author 16 | */ 17 | public interface TushuOrderDao extends BaseMapper { 18 | 19 | List selectListView(Pagination page,@Param("params")Map params); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_jsqlparser_jsqlparser_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_ant_ant_launcher_1_8_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_poi_poi_scratchpad_3_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_spring_2_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_core_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_lang3_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_spring_1_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_poi_poi_ooxml_schemas_3_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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/thread/MyThreadMethod.java: -------------------------------------------------------------------------------- 1 | package com.thread; 2 | 3 | /** 4 | * 线程执行方法(做一些项目启动后 一直要执行的操作,比如根据时间自动更改订单状态,比如订单签收30天自动收货功能,比如根据时间来更改状态) 5 | */ 6 | public class MyThreadMethod extends Thread { 7 | public void run() { 8 | while (!this.isInterrupted()) {// 线程未中断执行循环 9 | try { 10 | Thread.sleep(5000); //每隔2000ms执行一次 11 | } catch (InterruptedException e) { 12 | e.printStackTrace(); 13 | } 14 | 15 | // ------------------ 开始执行 --------------------------- 16 | // System.out.println("线程执行中:" + System.currentTimeMillis()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__mysql_mysql_connector_java_8_0_18.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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/dao/TushuCollectionDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.TushuCollectionEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.view.TushuCollectionView; 11 | 12 | /** 13 | * 图书收藏 Dao 接口 14 | * 15 | * @author 16 | */ 17 | public interface TushuCollectionDao extends BaseMapper { 18 | 19 | List selectListView(Pagination page,@Param("params")Map params); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/utils/CommonUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.Random; 4 | 5 | public class CommonUtil { 6 | /** 7 | * 获取随机字符串 8 | * 9 | * @param num 10 | * @return 11 | */ 12 | public static String getRandomString(Integer num) { 13 | String base = "abcdefghijklmnopqrstuvwxyz0123456789"; 14 | Random random = new Random(); 15 | StringBuffer sb = new StringBuffer(); 16 | for (int i = 0; i < num; i++) { 17 | int number = random.nextInt(base.length()); 18 | sb.append(base.charAt(number)); 19 | } 20 | return sb.toString(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_12_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dao/TushuCommentbackDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.TushuCommentbackEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import java.util.Map; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.view.TushuCommentbackView; 11 | 12 | /** 13 | * 图书评价 Dao 接口 14 | * 15 | * @author 16 | */ 17 | public interface TushuCommentbackDao extends BaseMapper { 18 | 19 | List selectListView(Pagination page,@Param("params")Map params); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_support_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_10_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_unbescape_unbescape_1_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_10_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_thymeleaf_thymeleaf_3_0_11_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/service/DictionaryService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.service.IService; 4 | import com.utils.PageUtils; 5 | import com.entity.DictionaryEntity; 6 | import java.util.Map; 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * 字典 服务类 11 | */ 12 | public interface DictionaryService extends IService { 13 | 14 | /** 15 | * @param params 查询参数 16 | * @return 带分页的查询出来的数据 17 | */ 18 | PageUtils queryPage(Map params); 19 | /** 20 | * 字典表转换 21 | * @param obj 22 | */ 23 | void dictionaryConvert(Object obj, HttpServletRequest request); 24 | } -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_generate_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_attoparser_attoparser_2_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_8_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mockito_mockito_junit_jupiter_3_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_10_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_tx_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_validation_validation_api_2_0_1_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_to_slf4j_2_12_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_4_1_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aop_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jcl_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_web_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_29.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_core_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jdbc_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_test_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/config/MyMetaObjectHandler.java: -------------------------------------------------------------------------------- 1 | package com.config; 2 | 3 | import java.util.Date; 4 | 5 | import org.apache.ibatis.reflection.MetaObject; 6 | 7 | import com.baomidou.mybatisplus.mapper.MetaObjectHandler; 8 | 9 | /** 10 | * 自定义填充处理器 11 | */ 12 | public class MyMetaObjectHandler extends MetaObjectHandler { 13 | 14 | @Override 15 | public void insertFill(MetaObject metaObject) { 16 | this.setFieldValByName("ctime", new Date(), metaObject); 17 | } 18 | 19 | @Override 20 | public boolean openUpdateFill() { 21 | return false; 22 | } 23 | 24 | @Override 25 | public void updateFill(MetaObject metaObject) { 26 | // 关闭更新填充、这里不执行 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_beans_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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 com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.service.IService; 9 | import com.entity.UsersEntity; 10 | import com.utils.PageUtils; 11 | 12 | 13 | /** 14 | * 系统用户 15 | * @author yangliyuan 16 | * @date 2019年10月10日 上午9:18:20 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 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_29.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_webmvc_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_10_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_activation_jakarta_activation_api_1_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_validation_jakarta_validation_api_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_thymeleaf_thymeleaf_spring5_3_0_11_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_10_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_expression_5_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_29.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatisplus_spring_boot_starter_1_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hibernate_validator_hibernate_validator_6_0_18_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_10_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/model/enums/TypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.model.enums; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.baomidou.mybatisplus.enums.IEnum; 6 | 7 | /** 8 | * 必须现在 IEnum 配置 该包扫描自动注入,查看文件 spring-mybatis.xml 参数 typeEnumsPackage 9 | */ 10 | public enum TypeEnum implements IEnum { 11 | DISABLED(0, "禁用"), 12 | NORMAL(1, "正常"); 13 | 14 | private final int value; 15 | private final String desc; 16 | 17 | TypeEnum(final int value, final String desc) { 18 | this.value = value; 19 | this.desc = desc; 20 | } 21 | 22 | @Override 23 | public Serializable getValue() { 24 | return this.value; 25 | } 26 | 27 | // Jackson 注解为 JsonValue 返回中文 json 描述 28 | public String getDesc() { 29 | return this.desc; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_10_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_devtools_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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 | * @author yangliyuan 11 | * @version 创建时间:2020年2月7日 下午8:01:14 12 | * 类说明 : 13 | */ 14 | 15 | public class FileUtil { 16 | public static byte[] FileToByte(File file) throws IOException { 17 | // 将数据转为流 18 | @SuppressWarnings("resource") 19 | InputStream content = new FileInputStream(file); 20 | ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); 21 | byte[] buff = new byte[100]; 22 | int rc = 0; 23 | while ((rc = content.read(buff, 0, 100)) > 0) { 24 | swapStream.write(buff, 0, rc); 25 | } 26 | // 获得二进制数组 27 | return swapStream.toByteArray(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_json_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_10_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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 | * @author yangliyuan 16 | * @date 2019年10月10日 上午9:18:20 17 | */ 18 | public interface TokenService extends IService { 19 | PageUtils queryPage(Map params); 20 | 21 | List selectListView(Wrapper wrapper); 22 | 23 | PageUtils queryPage(Map params,Wrapper wrapper); 24 | 25 | String generateToken(Integer userid,String username,String tableName, String role); 26 | 27 | TokenEntity getTokenEntity(String token); 28 | } 29 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_validation_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_configuration_processor_2_2_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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/tushushangchengApplication.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.ServletComponentScan; 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 9 | 10 | @SpringBootApplication 11 | @ServletComponentScan(value = "com.ServletContextListener") 12 | @MapperScan(basePackages = {"com.dao"}) 13 | public class tushushangchengApplication extends SpringBootServletInitializer{ 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(tushushangchengApplication.class, args); 17 | } 18 | 19 | @Override 20 | protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) { 21 | return applicationBuilder.sources(tushushangchengApplication.class); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/entity/EIException.java: -------------------------------------------------------------------------------- 1 | 2 | package com.entity; 3 | 4 | /** 5 | * 自定义异常 6 | */ 7 | public class EIException extends RuntimeException { 8 | private static final long serialVersionUID = 1L; 9 | 10 | private String msg; 11 | private int code = 500; 12 | 13 | public EIException(String msg) { 14 | super(msg); 15 | this.msg = msg; 16 | } 17 | 18 | public EIException(String msg, Throwable e) { 19 | super(msg, e); 20 | this.msg = msg; 21 | } 22 | 23 | public EIException(String msg, int code) { 24 | super(msg); 25 | this.msg = msg; 26 | this.code = code; 27 | } 28 | 29 | public EIException(String msg, int code, Throwable e) { 30 | super(msg, e); 31 | this.msg = msg; 32 | this.code = code; 33 | } 34 | 35 | public String getMsg() { 36 | return msg; 37 | } 38 | 39 | public void setMsg(String msg) { 40 | this.msg = msg; 41 | } 42 | 43 | public int getCode() { 44 | return code; 45 | } 46 | 47 | public void setCode(int code) { 48 | this.code = code; 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/utils/R.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * 返回数据 8 | */ 9 | public class R extends HashMap { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public R() { 13 | put("code", 0); 14 | } 15 | 16 | public static R error() { 17 | return error(500, "未知异常,请联系管理员"); 18 | } 19 | 20 | public static R error(String msg) { 21 | return error(500, msg); 22 | } 23 | 24 | public static R error(int code, String msg) { 25 | R r = new R(); 26 | r.put("code", code); 27 | r.put("msg", msg); 28 | return r; 29 | } 30 | 31 | public static R ok(String msg) { 32 | R r = new R(); 33 | r.put("msg", msg); 34 | return r; 35 | } 36 | 37 | public static R ok(Map map) { 38 | R r = new R(); 39 | r.putAll(map); 40 | return r; 41 | } 42 | 43 | public static R ok() { 44 | return new R(); 45 | } 46 | 47 | public R put(String key, Object value) { 48 | super.put(key, value); 49 | return this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ConfigServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.Map; 6 | 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 10 | import com.baomidou.mybatisplus.plugins.Page; 11 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 12 | import com.dao.ConfigDao; 13 | import com.entity.ConfigEntity; 14 | import com.service.ConfigService; 15 | import com.utils.PageUtils; 16 | import com.utils.Query; 17 | 18 | 19 | /** 20 | * 系统用户 21 | * @author yangliyuan 22 | * @date 2019年10月10日 上午9:17:59 23 | */ 24 | @Service("configService") 25 | public class ConfigServiceImpl extends ServiceImpl implements ConfigService { 26 | @Override 27 | public PageUtils queryPage(Map params) { 28 | Page page = this.selectPage( 29 | new Query(params).getPage(), 30 | new EntityWrapper() 31 | ); 32 | return new PageUtils(page); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /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 | * @author yangliyuan 11 | * @version 创建时间:2020年2月7日 下午8:36:05 12 | * 类说明 : 13 | */ 14 | @TableName("config") 15 | public class ConfigEntity implements Serializable{ 16 | private static final long serialVersionUID = 1L; 17 | 18 | @TableId(type = IdType.AUTO) 19 | private Long id; 20 | 21 | /** 22 | * key 23 | */ 24 | private String name; 25 | 26 | /** 27 | * value 28 | */ 29 | private String value; 30 | 31 | public Long getId() { 32 | return id; 33 | } 34 | 35 | public void setId(Long id) { 36 | this.id = id; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | 47 | public String getValue() { 48 | return value; 49 | } 50 | 51 | public void setValue(String value) { 52 | this.value = value; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/utils/SQLFilter.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | import com.entity.EIException; 7 | 8 | /** 9 | * SQL过滤 10 | */ 11 | public class SQLFilter { 12 | 13 | /** 14 | * SQL注入过滤 15 | * @param str 待验证的字符串 16 | */ 17 | public static String sqlInject(String str){ 18 | if(StringUtils.isBlank(str)){ 19 | return null; 20 | } 21 | //去掉'|"|;|\字符 22 | str = StringUtils.replace(str, "'", ""); 23 | str = StringUtils.replace(str, "\"", ""); 24 | str = StringUtils.replace(str, ";", ""); 25 | str = StringUtils.replace(str, "\\", ""); 26 | 27 | //转换成小写 28 | str = str.toLowerCase(); 29 | 30 | //非法字符 31 | String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"}; 32 | 33 | //判断是否包含非法字符 34 | for(String keyword : keywords){ 35 | if(str.indexOf(keyword) != -1){ 36 | throw new EIException("包含非法字符"); 37 | } 38 | } 39 | 40 | return str; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/utils/HttpClientUtils.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.net.HttpURLConnection; 6 | import java.net.URL; 7 | 8 | 9 | /** 10 | * HttpClient工具类 11 | */ 12 | public class HttpClientUtils { 13 | 14 | /** 15 | * @param uri 16 | * @return String 17 | * @description get请求方式 18 | * @author: long.he01 19 | */ 20 | public static String doGet(String uri) { 21 | 22 | StringBuilder result = new StringBuilder(); 23 | try { 24 | String res = ""; 25 | URL url = new URL(uri); 26 | HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 27 | BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); 28 | String line; 29 | while ((line = in.readLine()) != null) { 30 | res += line+"\n"; 31 | } 32 | in.close(); 33 | return res; 34 | }catch (Exception e) { 35 | e.printStackTrace(); 36 | return null; 37 | } 38 | 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/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/entity/view/DictionaryView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.DictionaryEntity; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import org.apache.commons.beanutils.BeanUtils; 6 | import java.lang.reflect.InvocationTargetException; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | import com.fasterxml.jackson.annotation.JsonFormat; 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 字典 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | */ 17 | @TableName("dictionary") 18 | public class DictionaryView extends DictionaryEntity implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | 23 | 24 | public DictionaryView() { 25 | 26 | } 27 | 28 | public DictionaryView(DictionaryEntity dictionaryEntity) { 29 | try { 30 | BeanUtils.copyProperties(this, dictionaryEntity); 31 | } catch (IllegalAccessException | InvocationTargetException e) { 32 | // TODO Auto-generated catch block 33 | e.printStackTrace(); 34 | } 35 | } 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/utils/SpringContextUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.ApplicationContextAware; 7 | import org.springframework.stereotype.Component; 8 | 9 | 10 | /** 11 | * Spring Context 工具类 12 | */ 13 | @Component 14 | public class SpringContextUtils implements ApplicationContextAware { 15 | public static ApplicationContext applicationContext; 16 | 17 | @Override 18 | public void setApplicationContext(ApplicationContext applicationContext) 19 | throws BeansException { 20 | SpringContextUtils.applicationContext = applicationContext; 21 | } 22 | 23 | public static Object getBean(String name) { 24 | return applicationContext.getBean(name); 25 | } 26 | 27 | public static T getBean(String name, Class requiredType) { 28 | return applicationContext.getBean(name, requiredType); 29 | } 30 | 31 | public static boolean containsBean(String name) { 32 | return applicationContext.containsBean(name); 33 | } 34 | 35 | public static boolean isSingleton(String name) { 36 | return applicationContext.isSingleton(name); 37 | } 38 | 39 | public static Class getType(String name) { 40 | return applicationContext.getType(name); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /src/main/java/com/service/impl/CartServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import com.utils.StringUtil; 4 | import org.springframework.stereotype.Service; 5 | import java.lang.reflect.Field; 6 | import java.util.*; 7 | import com.baomidou.mybatisplus.plugins.Page; 8 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 9 | import org.springframework.transaction.annotation.Transactional; 10 | import com.utils.PageUtils; 11 | import com.utils.Query; 12 | import org.springframework.web.context.ContextLoader; 13 | import javax.servlet.ServletContext; 14 | import javax.servlet.http.HttpServletRequest; 15 | import com.dao.CartDao; 16 | import com.entity.CartEntity; 17 | import com.service.CartService; 18 | import com.entity.view.CartView; 19 | 20 | /** 21 | * 购物车 服务实现类 22 | */ 23 | @Service("cartService") 24 | @Transactional 25 | public class CartServiceImpl extends ServiceImpl implements CartService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | if(params != null && (params.get("limit") == null || params.get("page") == null)){ 30 | params.put("page","1"); 31 | params.put("limit","10"); 32 | } 33 | Page page =new Query(params).getPage(); 34 | page.setRecords(baseMapper.selectListView(page,params)); 35 | return new PageUtils(page); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/TushuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import com.utils.StringUtil; 4 | import org.springframework.stereotype.Service; 5 | import java.lang.reflect.Field; 6 | import java.util.*; 7 | import com.baomidou.mybatisplus.plugins.Page; 8 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 9 | import org.springframework.transaction.annotation.Transactional; 10 | import com.utils.PageUtils; 11 | import com.utils.Query; 12 | import org.springframework.web.context.ContextLoader; 13 | import javax.servlet.ServletContext; 14 | import javax.servlet.http.HttpServletRequest; 15 | import com.dao.TushuDao; 16 | import com.entity.TushuEntity; 17 | import com.service.TushuService; 18 | import com.entity.view.TushuView; 19 | 20 | /** 21 | * 图书 服务实现类 22 | */ 23 | @Service("tushuService") 24 | @Transactional 25 | public class TushuServiceImpl extends ServiceImpl implements TushuService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | if(params != null && (params.get("limit") == null || params.get("page") == null)){ 30 | params.put("page","1"); 31 | params.put("limit","10"); 32 | } 33 | Page page =new Query(params).getPage(); 34 | page.setRecords(baseMapper.selectListView(page,params)); 35 | return new PageUtils(page); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/YonghuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import com.utils.StringUtil; 4 | import org.springframework.stereotype.Service; 5 | import java.lang.reflect.Field; 6 | import java.util.*; 7 | import com.baomidou.mybatisplus.plugins.Page; 8 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 9 | import org.springframework.transaction.annotation.Transactional; 10 | import com.utils.PageUtils; 11 | import com.utils.Query; 12 | import org.springframework.web.context.ContextLoader; 13 | import javax.servlet.ServletContext; 14 | import javax.servlet.http.HttpServletRequest; 15 | import com.dao.YonghuDao; 16 | import com.entity.YonghuEntity; 17 | import com.service.YonghuService; 18 | import com.entity.view.YonghuView; 19 | 20 | /** 21 | * 用户 服务实现类 22 | */ 23 | @Service("yonghuService") 24 | @Transactional 25 | public class YonghuServiceImpl extends ServiceImpl implements YonghuService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | if(params != null && (params.get("limit") == null || params.get("page") == null)){ 30 | params.put("page","1"); 31 | params.put("limit","10"); 32 | } 33 | Page page =new Query(params).getPage(); 34 | page.setRecords(baseMapper.selectListView(page,params)); 35 | return new PageUtils(page); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/AddressServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import com.utils.StringUtil; 4 | import org.springframework.stereotype.Service; 5 | import java.lang.reflect.Field; 6 | import java.util.*; 7 | import com.baomidou.mybatisplus.plugins.Page; 8 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 9 | import org.springframework.transaction.annotation.Transactional; 10 | import com.utils.PageUtils; 11 | import com.utils.Query; 12 | import org.springframework.web.context.ContextLoader; 13 | import javax.servlet.ServletContext; 14 | import javax.servlet.http.HttpServletRequest; 15 | import com.dao.AddressDao; 16 | import com.entity.AddressEntity; 17 | import com.service.AddressService; 18 | import com.entity.view.AddressView; 19 | 20 | /** 21 | * 收货地址 服务实现类 22 | */ 23 | @Service("addressService") 24 | @Transactional 25 | public class AddressServiceImpl extends ServiceImpl implements AddressService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | if(params != null && (params.get("limit") == null || params.get("page") == null)){ 30 | params.put("page","1"); 31 | params.put("limit","10"); 32 | } 33 | Page page =new Query(params).getPage(); 34 | page.setRecords(baseMapper.selectListView(page,params)); 35 | return new PageUtils(page); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/TushuOrderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import com.utils.StringUtil; 4 | import org.springframework.stereotype.Service; 5 | import java.lang.reflect.Field; 6 | import java.util.*; 7 | import com.baomidou.mybatisplus.plugins.Page; 8 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 9 | import org.springframework.transaction.annotation.Transactional; 10 | import com.utils.PageUtils; 11 | import com.utils.Query; 12 | import org.springframework.web.context.ContextLoader; 13 | import javax.servlet.ServletContext; 14 | import javax.servlet.http.HttpServletRequest; 15 | import com.dao.TushuOrderDao; 16 | import com.entity.TushuOrderEntity; 17 | import com.service.TushuOrderService; 18 | import com.entity.view.TushuOrderView; 19 | 20 | /** 21 | * 图书订单 服务实现类 22 | */ 23 | @Service("tushuOrderService") 24 | @Transactional 25 | public class TushuOrderServiceImpl extends ServiceImpl implements TushuOrderService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | if(params != null && (params.get("limit") == null || params.get("page") == null)){ 30 | params.put("page","1"); 31 | params.put("limit","10"); 32 | } 33 | Page page =new Query(params).getPage(); 34 | page.setRecords(baseMapper.selectListView(page,params)); 35 | return new PageUtils(page); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /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 Integer 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 Integer getId() { 70 | return id; 71 | } 72 | 73 | public void setId(Integer id) { 74 | this.id = id; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/TushuCollectionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import com.utils.StringUtil; 4 | import org.springframework.stereotype.Service; 5 | import java.lang.reflect.Field; 6 | import java.util.*; 7 | import com.baomidou.mybatisplus.plugins.Page; 8 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 9 | import org.springframework.transaction.annotation.Transactional; 10 | import com.utils.PageUtils; 11 | import com.utils.Query; 12 | import org.springframework.web.context.ContextLoader; 13 | import javax.servlet.ServletContext; 14 | import javax.servlet.http.HttpServletRequest; 15 | import com.dao.TushuCollectionDao; 16 | import com.entity.TushuCollectionEntity; 17 | import com.service.TushuCollectionService; 18 | import com.entity.view.TushuCollectionView; 19 | 20 | /** 21 | * 图书收藏 服务实现类 22 | */ 23 | @Service("tushuCollectionService") 24 | @Transactional 25 | public class TushuCollectionServiceImpl extends ServiceImpl implements TushuCollectionService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | if(params != null && (params.get("limit") == null || params.get("page") == null)){ 30 | params.put("page","1"); 31 | params.put("limit","10"); 32 | } 33 | Page page =new Query(params).getPage(); 34 | page.setRecords(baseMapper.selectListView(page,params)); 35 | return new PageUtils(page); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/TushuCommentbackServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import com.utils.StringUtil; 4 | import org.springframework.stereotype.Service; 5 | import java.lang.reflect.Field; 6 | import java.util.*; 7 | import com.baomidou.mybatisplus.plugins.Page; 8 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 9 | import org.springframework.transaction.annotation.Transactional; 10 | import com.utils.PageUtils; 11 | import com.utils.Query; 12 | import org.springframework.web.context.ContextLoader; 13 | import javax.servlet.ServletContext; 14 | import javax.servlet.http.HttpServletRequest; 15 | import com.dao.TushuCommentbackDao; 16 | import com.entity.TushuCommentbackEntity; 17 | import com.service.TushuCommentbackService; 18 | import com.entity.view.TushuCommentbackView; 19 | 20 | /** 21 | * 图书评价 服务实现类 22 | */ 23 | @Service("tushuCommentbackService") 24 | @Transactional 25 | public class TushuCommentbackServiceImpl extends ServiceImpl implements TushuCommentbackService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | if(params != null && (params.get("limit") == null || params.get("page") == null)){ 30 | params.put("page","1"); 31 | params.put("limit","10"); 32 | } 33 | Page page =new Query(params).getPage(); 34 | page.setRecords(baseMapper.selectListView(page,params)); 35 | return new PageUtils(page); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /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 com.service.UsersService; 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 12 | import com.baomidou.mybatisplus.mapper.Wrapper; 13 | import com.baomidou.mybatisplus.plugins.Page; 14 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 15 | import com.dao.UsersDao; 16 | import com.entity.UsersEntity; 17 | import com.utils.PageUtils; 18 | import com.utils.Query; 19 | 20 | 21 | /** 22 | * 系统用户 23 | * @author 24 | */ 25 | @Service("userService") 26 | public class UsersServiceImpl extends ServiceImpl implements UsersService { 27 | 28 | @Override 29 | public PageUtils queryPage(Map params) { 30 | Page page = this.selectPage( 31 | new Query(params).getPage(), 32 | new EntityWrapper() 33 | ); 34 | return new PageUtils(page); 35 | } 36 | 37 | @Override 38 | public List selectListView(Wrapper wrapper) { 39 | return baseMapper.selectListView(wrapper); 40 | } 41 | 42 | @Override 43 | public PageUtils queryPage(Map params, 44 | Wrapper wrapper) { 45 | Page page =new Query(params).getPage(); 46 | page.setRecords(baseMapper.selectListView(page,wrapper)); 47 | PageUtils pageUtil = new PageUtils(page); 48 | return pageUtil; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | tomcat: 4 | uri-encoding: UTF-8 5 | port: 8080 6 | servlet: 7 | context-path: /tushushangcheng 8 | 9 | spring: 10 | datasource: 11 | driverClassName: com.mysql.cj.jdbc.Driver 12 | url: jdbc:mysql://127.0.0.1:3306/tushushangcheng?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8 13 | username: root 14 | password: 123456 15 | 16 | 17 | servlet: 18 | multipart: 19 | max-file-size: 1000MB 20 | max-request-size: 1000MB 21 | resources: 22 | static-locations: classpath:static/,file:static/ 23 | 24 | #mybatis 25 | mybatis-plus: 26 | mapper-locations: classpath*:mapper/*.xml 27 | #实体扫描,多个package用逗号或者分号分隔 28 | typeAliasesPackage: com.entity 29 | global-config: 30 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 31 | id-type: 1 32 | #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" 33 | field-strategy: 2 34 | #驼峰下划线转换 35 | db-column-underline: true 36 | #刷新mapper 调试神器 37 | refresh-mapper: true 38 | #逻辑删除配置 39 | logic-delete-value: -1 40 | logic-not-delete-value: 0 41 | #自定义SQL注入器 42 | sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector 43 | configuration: 44 | map-underscore-to-camel-case: true 45 | cache-enabled: false 46 | call-setters-on-nulls: true 47 | #springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other) 48 | jdbc-type-for-null: 'null' 49 | 50 | #打印sql语句 51 | logging: 52 | level: 53 | com.dao: debug -------------------------------------------------------------------------------- /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:/img/") 35 | .addResourceLocations("classpath:/front/") 36 | .addResourceLocations("classpath:/public/"); 37 | super.addResourceHandlers(registry); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/TushuView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.TushuEntity; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import org.apache.commons.beanutils.BeanUtils; 6 | import java.lang.reflect.InvocationTargetException; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | import com.fasterxml.jackson.annotation.JsonFormat; 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 图书 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | */ 17 | @TableName("tushu") 18 | public class TushuView extends TushuEntity implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * 图书类型的值 23 | */ 24 | private String tushuValue; 25 | /** 26 | * 是否上架的值 27 | */ 28 | private String shangxiaValue; 29 | 30 | 31 | 32 | public TushuView() { 33 | 34 | } 35 | 36 | public TushuView(TushuEntity tushuEntity) { 37 | try { 38 | BeanUtils.copyProperties(this, tushuEntity); 39 | } catch (IllegalAccessException | InvocationTargetException e) { 40 | // TODO Auto-generated catch block 41 | e.printStackTrace(); 42 | } 43 | } 44 | 45 | 46 | 47 | /** 48 | * 获取: 图书类型的值 49 | */ 50 | public String getTushuValue() { 51 | return tushuValue; 52 | } 53 | /** 54 | * 设置: 图书类型的值 55 | */ 56 | public void setTushuValue(String tushuValue) { 57 | this.tushuValue = tushuValue; 58 | } 59 | /** 60 | * 获取: 是否上架的值 61 | */ 62 | public String getShangxiaValue() { 63 | return shangxiaValue; 64 | } 65 | /** 66 | * 设置: 是否上架的值 67 | */ 68 | public void setShangxiaValue(String shangxiaValue) { 69 | this.shangxiaValue = shangxiaValue; 70 | } 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | } 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 基于SpringBoot的图书商城管理系统(程序+论文) 2 | = 3 | - 完整代码获取地址:从戎源码网 ([https://armycodes.com/](https://armycodes.com/)) 4 | - 作者微信:19941326836 QQ:952045282 5 | - 承接计算机毕业设计、Java毕业设计、Python毕业设计、深度学习、机器学习 6 | - 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务 7 | - 所有选题地址https://github.com/nature924/allProject 8 | 9 | 一、项目介绍 10 | --- 11 | 基于Spring Boot框架实现的图书商城管理系统,系统包含两种角色:管理员、用户,系统分为前台和后台两大模块,主要功能如下。 12 | ### 前台: 13 | 14 | 首页:展示图书商城的相关内容。 15 | 图书:浏览和搜索图书信息。 16 | 图书总热度排行榜:展示图书按照热度进行排名的榜单。 17 | 个人中心:管理个人信息,包括订单记录、个人设置等。 18 | 购物车:管理用户选购的图书,包括添加、删除、结算等操作。 19 | 20 | ### 后台(管理员): 21 | 22 | 个人中心:管理个人信息。 23 | 基础数据管理:管理系统中的基础数据,例如图书分类、出版社信息等。 24 | 图书管理:管理图书信息,包括添加、编辑、删除图书等操作。 25 | 用户管理:管理用户账号信息,包括添加、编辑、删除用户等操作。 26 | 图书评价管理:管理用户对图书的评价和评论,包括审核和删除等操作。 27 | 图书收藏管理:管理用户对图书的收藏,包括查看收藏列表、取消收藏等操作。 28 | 图书订单管理:管理用户的图书订单,包括查看订单详情、确认发货等操作。 29 | 轮播图信息:管理系统的轮播图信息,包括添加、编辑、删除等操作。 30 | 31 | ### 用户: 32 | 33 | 个人中心:管理个人信息,包括订单记录、个人设置等。 34 | 图书管理:浏览和搜索图书信息,包括图书封面、作者、价格等。 35 | 图书评价管理:对已购买的图书进行评价和评论。 36 | 图书收藏管理:查看和管理已收藏的图书。 37 | 图书订单管理:查看和管理已购买的图书订单。 38 | 39 | 40 | 41 | 42 | 43 | 二、项目技术 44 | --- 45 | - 编程语言:Java 46 | - 数据库:MySQL 47 | - 项目管理工具:Maven 48 | - 前端技术:VUE、HTML、Jquery、Bootstrap 49 | - 后端技术:Spring、SpringMVC、MyBatis 50 | 51 | 三、运行环境 52 | --- 53 | - 操作系统:Windows、macOS都可以 54 | - JDK版本:JDK1.8以上都可以 55 | - 开发工具:IDEA、Ecplise、Myecplise都可以 56 | - 数据库: MySQL5.7以上都可以 57 | - Tomcat:任意版本都可以 58 | - Maven:任意版本都可以 59 | 60 | 四、运行截图 61 | --- 62 | ### 论文截图: 63 | ![image/1.png](limage/1.png) 64 | ![image/1.png](limage/2.png) 65 | 66 | ### 程序截图: 67 | ![image/1.png](image/1.png) 68 | ![image/1.png](image/2.png) 69 | ![image/1.png](image/3.png) 70 | ![image/1.png](image/4.png) 71 | ![image/1.png](image/5.png) 72 | ![image/1.png](image/6.png) 73 | ![image/1.png](image/7.png) 74 | ![image/1.png](image/8.png) 75 | ![image/1.png](image/9.png) 76 | ![image/1.png](image/10.png) 77 | 78 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/YonghuView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.YonghuEntity; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import org.apache.commons.beanutils.BeanUtils; 6 | import java.lang.reflect.InvocationTargetException; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | import com.fasterxml.jackson.annotation.JsonFormat; 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 用户 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | */ 17 | @TableName("yonghu") 18 | public class YonghuView extends YonghuEntity implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * 性别的值 23 | */ 24 | private String sexValue; 25 | /** 26 | * 会员等级的值 27 | */ 28 | private String huiyuandengjiValue; 29 | 30 | 31 | 32 | public YonghuView() { 33 | 34 | } 35 | 36 | public YonghuView(YonghuEntity yonghuEntity) { 37 | try { 38 | BeanUtils.copyProperties(this, yonghuEntity); 39 | } catch (IllegalAccessException | InvocationTargetException e) { 40 | // TODO Auto-generated catch block 41 | e.printStackTrace(); 42 | } 43 | } 44 | 45 | 46 | 47 | /** 48 | * 获取: 性别的值 49 | */ 50 | public String getSexValue() { 51 | return sexValue; 52 | } 53 | /** 54 | * 设置: 性别的值 55 | */ 56 | public void setSexValue(String sexValue) { 57 | this.sexValue = sexValue; 58 | } 59 | /** 60 | * 获取: 会员等级的值 61 | */ 62 | public String getHuiyuandengjiValue() { 63 | return huiyuandengjiValue; 64 | } 65 | /** 66 | * 设置: 会员等级的值 67 | */ 68 | public void setHuiyuandengjiValue(String huiyuandengjiValue) { 69 | this.huiyuandengjiValue = huiyuandengjiValue; 70 | } 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | } 83 | -------------------------------------------------------------------------------- /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/ServletContextListener/DictionaryServletContextListener.java: -------------------------------------------------------------------------------- 1 | package com.ServletContextListener; 2 | 3 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 4 | import com.entity.DictionaryEntity; 5 | import com.service.DictionaryService; 6 | import com.thread.MyThreadMethod; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.context.ApplicationContext; 10 | import org.springframework.web.context.support.WebApplicationContextUtils; 11 | 12 | import javax.servlet.ServletContextListener; 13 | import javax.servlet.ServletContextEvent; 14 | import javax.servlet.annotation.WebListener; 15 | import java.util.HashMap; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | * 字典初始化监视器 用的是服务器监听,每次项目启动,都会调用这个类 21 | */ 22 | @WebListener 23 | public class DictionaryServletContextListener implements ServletContextListener { 24 | 25 | private static final Logger logger = LoggerFactory.getLogger(DictionaryServletContextListener.class); 26 | private MyThreadMethod myThreadMethod; 27 | @Override 28 | public void contextDestroyed(ServletContextEvent sce) { 29 | logger.info("----------服务器停止----------"); 30 | } 31 | 32 | @Override 33 | public void contextInitialized(ServletContextEvent sce) { 34 | ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext()); 35 | 36 | logger.info("----------字典表初始化开始----------"); 37 | DictionaryService dictionaryService = (DictionaryService)appContext.getBean("dictionaryService"); 38 | List dictionaryEntities = dictionaryService.selectList(new EntityWrapper()); 39 | Map> map = new HashMap<>(); 40 | for(DictionaryEntity d :dictionaryEntities){ 41 | Map m = map.get(d.getDicCode()); 42 | if(m ==null || m.isEmpty()){ 43 | m = new HashMap<>(); 44 | } 45 | m.put(d.getCodeIndex(),d.getIndexName()); 46 | map.put(d.getDicCode(),m); 47 | } 48 | sce.getServletContext().setAttribute("dictionaryMap", map); 49 | logger.info("----------字典表初始化完成----------"); 50 | 51 | 52 | 53 | logger.info("----------线程执行开始----------"); 54 | if (myThreadMethod == null) { 55 | myThreadMethod = new MyThreadMethod(); 56 | myThreadMethod.start(); // servlet 上下文初始化时启动线程myThreadMethod 57 | } 58 | logger.info("----------线程执行结束----------"); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /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 | * @author 28 | */ 29 | @Service("tokenService") 30 | public class TokenServiceImpl extends ServiceImpl implements TokenService { 31 | 32 | @Override 33 | public PageUtils queryPage(Map params) { 34 | Page page = this.selectPage( 35 | new Query(params).getPage(), 36 | new EntityWrapper() 37 | ); 38 | return new PageUtils(page); 39 | } 40 | 41 | @Override 42 | public List selectListView(Wrapper wrapper) { 43 | return baseMapper.selectListView(wrapper); 44 | } 45 | 46 | @Override 47 | public PageUtils queryPage(Map params, 48 | Wrapper wrapper) { 49 | Page page =new Query(params).getPage(); 50 | page.setRecords(baseMapper.selectListView(page,wrapper)); 51 | PageUtils pageUtil = new PageUtils(page); 52 | return pageUtil; 53 | } 54 | 55 | @Override 56 | public String generateToken(Integer userid,String username, String tableName, String role) { 57 | TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("userid", userid).eq("role", role)); 58 | String token = CommonUtil.getRandomString(32); 59 | Calendar cal = Calendar.getInstance(); 60 | cal.setTime(new Date()); 61 | cal.add(Calendar.HOUR_OF_DAY, 1); 62 | if(tokenEntity!=null) { 63 | tokenEntity.setToken(token); 64 | tokenEntity.setExpiratedtime(cal.getTime()); 65 | this.updateById(tokenEntity); 66 | } else { 67 | this.insert(new TokenEntity(userid,username, tableName, role, token, cal.getTime())); 68 | } 69 | return token; 70 | } 71 | 72 | @Override 73 | public TokenEntity getTokenEntity(String token) { 74 | TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("token", token)); 75 | if(tokenEntity == null || tokenEntity.getExpiratedtime().getTime() extends LinkedHashMap { 15 | private static final long serialVersionUID = 1L; 16 | /** 17 | * mybatis-plus分页参数 18 | */ 19 | private Page page; 20 | /** 21 | * 当前页码 22 | */ 23 | private int currPage = 1; 24 | /** 25 | * 每页条数 26 | */ 27 | private int limit = 10; 28 | 29 | public Query(JQPageInfo pageInfo) { 30 | //分页参数 31 | if(pageInfo.getPage()!= null){ 32 | currPage = pageInfo.getPage(); 33 | } 34 | if(pageInfo.getLimit()!= null){ 35 | limit = pageInfo.getLimit(); 36 | } 37 | 38 | 39 | //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) 40 | String sidx = SQLFilter.sqlInject(pageInfo.getSidx()); 41 | String order = SQLFilter.sqlInject(pageInfo.getOrder()); 42 | 43 | 44 | //mybatis-plus分页 45 | this.page = new Page<>(currPage, limit); 46 | 47 | //排序 48 | if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ 49 | this.page.setOrderByField(sidx); 50 | this.page.setAsc("ASC".equalsIgnoreCase(order)); 51 | } 52 | } 53 | 54 | 55 | public Query(Map params){ 56 | this.putAll(params); 57 | 58 | //分页参数 59 | if(params.get("page") != null){ 60 | currPage = Integer.parseInt((String)params.get("page")); 61 | } 62 | if(params.get("limit") != null){ 63 | limit = Integer.parseInt((String)params.get("limit")); 64 | } 65 | 66 | this.put("offset", (currPage - 1) * limit); 67 | this.put("page", currPage); 68 | this.put("limit", limit); 69 | 70 | //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) 71 | String sidx = SQLFilter.sqlInject((String)params.get("sidx")); 72 | String order = SQLFilter.sqlInject((String)params.get("order")); 73 | this.put("sidx", sidx); 74 | this.put("order", order); 75 | 76 | //mybatis-plus分页 77 | this.page = new Page<>(currPage, limit); 78 | 79 | //排序 80 | if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ 81 | this.page.setOrderByField(sidx); 82 | this.page.setAsc("ASC".equalsIgnoreCase(order)); 83 | } 84 | 85 | } 86 | 87 | public Page getPage() { 88 | return page; 89 | } 90 | 91 | public int getCurrPage() { 92 | return currPage; 93 | } 94 | 95 | public int getLimit() { 96 | return limit; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/TushuCollectionModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.TushuCollectionEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import java.util.Date; 8 | import org.springframework.format.annotation.DateTimeFormat; 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 图书收藏 14 | * 接收传参的实体类 15 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 16 | * 取自ModelAndView 的model名称 17 | */ 18 | public class TushuCollectionModel implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | 23 | 24 | /** 25 | * 主键 26 | */ 27 | private Integer id; 28 | 29 | 30 | /** 31 | * 图书 32 | */ 33 | private Integer tushuId; 34 | 35 | 36 | /** 37 | * 用户 38 | */ 39 | private Integer yonghuId; 40 | 41 | 42 | /** 43 | * 类型 44 | */ 45 | private Integer tushuCollectionTypes; 46 | 47 | 48 | /** 49 | * 收藏时间 50 | */ 51 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 52 | @DateTimeFormat 53 | private Date insertTime; 54 | 55 | 56 | /** 57 | * 创建时间 show3 photoShow 58 | */ 59 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 60 | @DateTimeFormat 61 | private Date createTime; 62 | 63 | 64 | /** 65 | * 获取:主键 66 | */ 67 | public Integer getId() { 68 | return id; 69 | } 70 | 71 | 72 | /** 73 | * 设置:主键 74 | */ 75 | public void setId(Integer id) { 76 | this.id = id; 77 | } 78 | /** 79 | * 获取:图书 80 | */ 81 | public Integer getTushuId() { 82 | return tushuId; 83 | } 84 | 85 | 86 | /** 87 | * 设置:图书 88 | */ 89 | public void setTushuId(Integer tushuId) { 90 | this.tushuId = tushuId; 91 | } 92 | /** 93 | * 获取:用户 94 | */ 95 | public Integer getYonghuId() { 96 | return yonghuId; 97 | } 98 | 99 | 100 | /** 101 | * 设置:用户 102 | */ 103 | public void setYonghuId(Integer yonghuId) { 104 | this.yonghuId = yonghuId; 105 | } 106 | /** 107 | * 获取:类型 108 | */ 109 | public Integer getTushuCollectionTypes() { 110 | return tushuCollectionTypes; 111 | } 112 | 113 | 114 | /** 115 | * 设置:类型 116 | */ 117 | public void setTushuCollectionTypes(Integer tushuCollectionTypes) { 118 | this.tushuCollectionTypes = tushuCollectionTypes; 119 | } 120 | /** 121 | * 获取:收藏时间 122 | */ 123 | public Date getInsertTime() { 124 | return insertTime; 125 | } 126 | 127 | 128 | /** 129 | * 设置:收藏时间 130 | */ 131 | public void setInsertTime(Date insertTime) { 132 | this.insertTime = insertTime; 133 | } 134 | /** 135 | * 获取:创建时间 show3 photoShow 136 | */ 137 | public Date getCreateTime() { 138 | return createTime; 139 | } 140 | 141 | 142 | /** 143 | * 设置:创建时间 show3 photoShow 144 | */ 145 | public void setCreateTime(Date createTime) { 146 | this.createTime = createTime; 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /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> chartBoth(Map params); 18 | 19 | List> chartOne(Map params); 20 | 21 | List> selectGroup(Map params); 22 | 23 | List> selectValue(Map params); 24 | 25 | /** 26 | tableName 查询表 27 | condition1 条件1 28 | condition1Value 条件1值 29 | average 计算平均评分 30 | * */ 31 | Map queryScore(Map params); 32 | 33 | /** 34 | * 下面为新加的 35 | */ 36 | 37 | 38 | /** 39 | * 新的级联字典表的 分组求和统计 40 | * @param params 41 | * @return 42 | */ 43 | List> newSelectGroupSum(Map params); 44 | 45 | /** 46 | * 新的级联字典表的 分组求和统计 47 | * @param params 48 | * @return 49 | */ 50 | List> newSelectGroupCount(Map params); 51 | /** 52 | * 当前表的日期分组求和 53 | * @param params 54 | * @return 55 | */ 56 | List> newSelectDateGroupSum(Map params); 57 | 58 | /** 59 | * 查询字典表的分组统计总条数 60 | * @param params 61 | * @return 62 | */ 63 | List> newSelectDateGroupCount(Map params); 64 | /** 65 | * 增加字段数字 66 | * @param params 67 | * @return 68 | */ 69 | int plusCloumNumber(Map params); 70 | /** 71 | * 减少字段数字 72 | * @param params 73 | * @return 74 | */ 75 | int reduceCloumNumber(Map params); 76 | /** 77 | * 修改字段数字 78 | * @param params 79 | * @return 80 | */ 81 | int updateCloumValue(Map params); 82 | 83 | 84 | /** 85 | * 饼状图 86 | * -- 饼状图 查询当前表 87 | -- 查询字典表【月】 88 | -- 统计 -- 查询某个月的每个类型的订单销售数量 89 | -- 求和 -- 查询某个月的每个类型的订单销售额 90 | -- 查询某个字符串【月】 91 | -- 统计 -- 查询某个月的每个员工的订单销售数量 92 | -- 求和 -- 查询某个月的每个员工的订单销售额 93 | -- 查询时间【年】 94 | -- 统计 -- 查询每个月的订单销售数量 95 | -- 求和 -- 查询每个月的订单销售额 96 | -- 饼状图 查询级联表 97 | -- 查询字典表 98 | -- 统计 -- 查询某个月的每个类型的订单销售数量 99 | -- 求和 -- 查询某个月的每个类型的订单销售额 100 | -- 查询某个字符串 101 | -- 统计 -- 查询某个月的每个员工的订单销售数量 102 | -- 求和 -- 查询某个月的每个员工的订单销售额 103 | -- 查询时间 104 | -- 统计 -- 统计每个月的订单销售数量 105 | -- 求和 -- 查询每个月的订单销售额 106 | */ 107 | 108 | 109 | /** 110 | * 柱状图 111 | -- 柱状图 查询当前表 112 | -- 某个【年,月】 113 | -- 当前表 2 级联表 1 114 | -- 统计 115 | -- 【日期,字符串,下拉框】 116 | -- 求和 117 | -- 【日期,字符串,下拉框】 118 | -- 柱状图 查询级联表 119 | -- 某个【年,月】 120 | -- 统计 121 | -- 【日期,字符串,下拉框】 122 | -- 求和 123 | -- 【日期,字符串,下拉框】 124 | */ 125 | 126 | /** 127 | * 柱状图求和 128 | * @param params 129 | * @return 130 | */ 131 | List> barSum(Map params); 132 | /** 133 | * 柱状图统计 134 | * @param params 135 | * @return 136 | */ 137 | List> barCount(Map params); 138 | 139 | } 140 | -------------------------------------------------------------------------------- /src/main/java/com/controller/ConfigController.java: -------------------------------------------------------------------------------- 1 | 2 | package com.controller; 3 | 4 | 5 | import java.util.Arrays; 6 | import java.util.Map; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import com.annotation.IgnoreAuth; 17 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 18 | import com.entity.ConfigEntity; 19 | import com.service.ConfigService; 20 | import com.utils.PageUtils; 21 | import com.utils.R; 22 | import com.utils.ValidatorUtils; 23 | 24 | /** 25 | * 登录相关 26 | */ 27 | @RequestMapping("config") 28 | @RestController 29 | public class ConfigController{ 30 | 31 | @Autowired 32 | private ConfigService configService; 33 | 34 | /** 35 | * 列表 36 | */ 37 | @RequestMapping("/page") 38 | public R page(@RequestParam Map params,ConfigEntity config){ 39 | EntityWrapper ew = new EntityWrapper(); 40 | PageUtils page = configService.queryPage(params); 41 | return R.ok().put("data", page); 42 | } 43 | 44 | /** 45 | * 列表 46 | */ 47 | @IgnoreAuth 48 | @RequestMapping("/list") 49 | public R list(@RequestParam Map params,ConfigEntity config){ 50 | EntityWrapper ew = new EntityWrapper(); 51 | PageUtils page = configService.queryPage(params); 52 | return R.ok().put("data", page); 53 | } 54 | 55 | /** 56 | * 信息 57 | */ 58 | @RequestMapping("/info/{id}") 59 | public R info(@PathVariable("id") String id){ 60 | ConfigEntity config = configService.selectById(id); 61 | return R.ok().put("data", config); 62 | } 63 | 64 | /** 65 | * 详情 66 | */ 67 | @IgnoreAuth 68 | @RequestMapping("/detail/{id}") 69 | public R detail(@PathVariable("id") String id){ 70 | ConfigEntity config = configService.selectById(id); 71 | return R.ok().put("data", config); 72 | } 73 | 74 | /** 75 | * 根据name获取信息 76 | */ 77 | @RequestMapping("/info") 78 | public R infoByName(@RequestParam String name){ 79 | ConfigEntity config = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 80 | return R.ok().put("data", config); 81 | } 82 | 83 | /** 84 | * 保存 85 | */ 86 | @PostMapping("/save") 87 | public R save(@RequestBody ConfigEntity config){ 88 | // ValidatorUtils.validateEntity(config); 89 | configService.insert(config); 90 | return R.ok(); 91 | } 92 | 93 | /** 94 | * 修改 95 | */ 96 | @RequestMapping("/update") 97 | public R update(@RequestBody ConfigEntity config){ 98 | // ValidatorUtils.validateEntity(config); 99 | configService.updateById(config);//全部更新 100 | return R.ok(); 101 | } 102 | 103 | /** 104 | * 删除 105 | */ 106 | @RequestMapping("/delete") 107 | public R delete(@RequestBody Long[] ids){ 108 | configService.deleteBatchIds(Arrays.asList(ids)); 109 | return R.ok(); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/CartModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.CartEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import java.util.Date; 8 | import org.springframework.format.annotation.DateTimeFormat; 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 购物车 14 | * 接收传参的实体类 15 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 16 | * 取自ModelAndView 的model名称 17 | */ 18 | public class CartModel implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | 23 | 24 | /** 25 | * 主键 26 | */ 27 | private Integer id; 28 | 29 | 30 | /** 31 | * 所属用户 32 | */ 33 | private Integer yonghuId; 34 | 35 | 36 | /** 37 | * 图书 38 | */ 39 | private Integer tushuId; 40 | 41 | 42 | /** 43 | * 购买数量 44 | */ 45 | private Integer buyNumber; 46 | 47 | 48 | /** 49 | * 添加时间 50 | */ 51 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 52 | @DateTimeFormat 53 | private Date createTime; 54 | 55 | 56 | /** 57 | * 更新时间 58 | */ 59 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 60 | @DateTimeFormat 61 | private Date updateTime; 62 | 63 | 64 | /** 65 | * 创建时间 66 | */ 67 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 68 | @DateTimeFormat 69 | private Date insertTime; 70 | 71 | 72 | /** 73 | * 获取:主键 74 | */ 75 | public Integer getId() { 76 | return id; 77 | } 78 | 79 | 80 | /** 81 | * 设置:主键 82 | */ 83 | public void setId(Integer id) { 84 | this.id = id; 85 | } 86 | /** 87 | * 获取:所属用户 88 | */ 89 | public Integer getYonghuId() { 90 | return yonghuId; 91 | } 92 | 93 | 94 | /** 95 | * 设置:所属用户 96 | */ 97 | public void setYonghuId(Integer yonghuId) { 98 | this.yonghuId = yonghuId; 99 | } 100 | /** 101 | * 获取:图书 102 | */ 103 | public Integer getTushuId() { 104 | return tushuId; 105 | } 106 | 107 | 108 | /** 109 | * 设置:图书 110 | */ 111 | public void setTushuId(Integer tushuId) { 112 | this.tushuId = tushuId; 113 | } 114 | /** 115 | * 获取:购买数量 116 | */ 117 | public Integer getBuyNumber() { 118 | return buyNumber; 119 | } 120 | 121 | 122 | /** 123 | * 设置:购买数量 124 | */ 125 | public void setBuyNumber(Integer buyNumber) { 126 | this.buyNumber = buyNumber; 127 | } 128 | /** 129 | * 获取:添加时间 130 | */ 131 | public Date getCreateTime() { 132 | return createTime; 133 | } 134 | 135 | 136 | /** 137 | * 设置:添加时间 138 | */ 139 | public void setCreateTime(Date createTime) { 140 | this.createTime = createTime; 141 | } 142 | /** 143 | * 获取:更新时间 144 | */ 145 | public Date getUpdateTime() { 146 | return updateTime; 147 | } 148 | 149 | 150 | /** 151 | * 设置:更新时间 152 | */ 153 | public void setUpdateTime(Date updateTime) { 154 | this.updateTime = updateTime; 155 | } 156 | /** 157 | * 获取:创建时间 158 | */ 159 | public Date getInsertTime() { 160 | return insertTime; 161 | } 162 | 163 | 164 | /** 165 | * 设置:创建时间 166 | */ 167 | public void setInsertTime(Date insertTime) { 168 | this.insertTime = insertTime; 169 | } 170 | 171 | } 172 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/TushuCollectionVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.TushuCollectionEntity; 4 | import com.baomidou.mybatisplus.annotations.TableField; 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import java.util.Date; 8 | import org.springframework.format.annotation.DateTimeFormat; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 图书收藏 14 | * 手机端接口返回实体辅助类 15 | * (主要作用去除一些不必要的字段) 16 | */ 17 | @TableName("tushu_collection") 18 | public class TushuCollectionVO implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | /** 23 | * 主键 24 | */ 25 | 26 | @TableField(value = "id") 27 | private Integer id; 28 | 29 | 30 | /** 31 | * 图书 32 | */ 33 | 34 | @TableField(value = "tushu_id") 35 | private Integer tushuId; 36 | 37 | 38 | /** 39 | * 用户 40 | */ 41 | 42 | @TableField(value = "yonghu_id") 43 | private Integer yonghuId; 44 | 45 | 46 | /** 47 | * 类型 48 | */ 49 | 50 | @TableField(value = "tushu_collection_types") 51 | private Integer tushuCollectionTypes; 52 | 53 | 54 | /** 55 | * 收藏时间 56 | */ 57 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 58 | @DateTimeFormat 59 | 60 | @TableField(value = "insert_time") 61 | private Date insertTime; 62 | 63 | 64 | /** 65 | * 创建时间 show3 photoShow 66 | */ 67 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 68 | @DateTimeFormat 69 | 70 | @TableField(value = "create_time") 71 | private Date createTime; 72 | 73 | 74 | /** 75 | * 设置:主键 76 | */ 77 | public Integer getId() { 78 | return id; 79 | } 80 | 81 | 82 | /** 83 | * 获取:主键 84 | */ 85 | 86 | public void setId(Integer id) { 87 | this.id = id; 88 | } 89 | /** 90 | * 设置:图书 91 | */ 92 | public Integer getTushuId() { 93 | return tushuId; 94 | } 95 | 96 | 97 | /** 98 | * 获取:图书 99 | */ 100 | 101 | public void setTushuId(Integer tushuId) { 102 | this.tushuId = tushuId; 103 | } 104 | /** 105 | * 设置:用户 106 | */ 107 | public Integer getYonghuId() { 108 | return yonghuId; 109 | } 110 | 111 | 112 | /** 113 | * 获取:用户 114 | */ 115 | 116 | public void setYonghuId(Integer yonghuId) { 117 | this.yonghuId = yonghuId; 118 | } 119 | /** 120 | * 设置:类型 121 | */ 122 | public Integer getTushuCollectionTypes() { 123 | return tushuCollectionTypes; 124 | } 125 | 126 | 127 | /** 128 | * 获取:类型 129 | */ 130 | 131 | public void setTushuCollectionTypes(Integer tushuCollectionTypes) { 132 | this.tushuCollectionTypes = tushuCollectionTypes; 133 | } 134 | /** 135 | * 设置:收藏时间 136 | */ 137 | public Date getInsertTime() { 138 | return insertTime; 139 | } 140 | 141 | 142 | /** 143 | * 获取:收藏时间 144 | */ 145 | 146 | public void setInsertTime(Date insertTime) { 147 | this.insertTime = insertTime; 148 | } 149 | /** 150 | * 设置:创建时间 show3 photoShow 151 | */ 152 | public Date getCreateTime() { 153 | return createTime; 154 | } 155 | 156 | 157 | /** 158 | * 获取:创建时间 show3 photoShow 159 | */ 160 | 161 | public void setCreateTime(Date createTime) { 162 | this.createTime = createTime; 163 | } 164 | 165 | } 166 | -------------------------------------------------------------------------------- /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 | tableName 查询表 24 | condition1 条件1 25 | condition1Value 条件1值 26 | average 计算平均评分 27 | * */ 28 | Map queryScore(Map params); 29 | 30 | List> selectGroup(Map params); 31 | 32 | List> selectValue(Map params); 33 | 34 | 35 | List> chartBoth(Map params); 36 | 37 | List> chartOne(Map params); 38 | 39 | /** 40 | * 下面为新加的 41 | */ 42 | 43 | /** 44 | * 新的级联字典表的 分组求和方法 45 | * @param params 46 | * @return 47 | */ 48 | List> newSelectGroupSum(Map params); 49 | 50 | /** 51 | * 新的级联字典表的 分组条数统计统计方法方法 52 | * @param params 53 | * @return 54 | */ 55 | List> newSelectGroupCount(Map params); 56 | 57 | 58 | /** 59 | * 当前表的日期分组求和 60 | * @param params 61 | * @return 62 | */ 63 | List> newSelectDateGroupSum(Map params); 64 | 65 | /** 66 | * 查询字典表的分组统计总条数 67 | * @param params 68 | * @return 69 | */ 70 | List> newSelectDateGroupCount(Map params); 71 | 72 | /** 73 | * 增加字段值 74 | * @param params 75 | * @return 76 | */ 77 | int plusCloumNumber(Map params); 78 | 79 | /** 80 | * 减少字段值 81 | * @param params 82 | * @return 83 | */ 84 | int reduceCloumNumber(Map params); 85 | 86 | /** 87 | * 修改字段值 88 | * @param params 89 | * @return 90 | */ 91 | int updateCloumValue(Map params); 92 | 93 | 94 | /** 95 | * 饼状图 96 | * -- 饼状图 查询当前表 97 | -- 查询字典表【月】 98 | -- 统计 -- 查询某个月的每个类型的订单销售数量 99 | -- 求和 -- 查询某个月的每个类型的订单销售额 100 | -- 查询某个字符串【月】 101 | -- 统计 -- 查询某个月的每个员工的订单销售数量 102 | -- 求和 -- 查询某个月的每个员工的订单销售额 103 | -- 查询时间【年】 104 | -- 统计 -- 查询每个月的订单销售数量 105 | -- 求和 -- 查询每个月的订单销售额 106 | -- 饼状图 查询级联表 107 | -- 查询字典表 108 | -- 统计 -- 查询某个月的每个类型的订单销售数量 109 | -- 求和 -- 查询某个月的每个类型的订单销售额 110 | -- 查询某个字符串 111 | -- 统计 -- 查询某个月的每个员工的订单销售数量 112 | -- 求和 -- 查询某个月的每个员工的订单销售额 113 | -- 查询时间 114 | -- 统计 -- 统计每个月的订单销售数量 115 | -- 求和 -- 查询每个月的订单销售额 116 | */ 117 | 118 | 119 | /** 120 | * 柱状图 121 | -- 柱状图 查询当前表 122 | -- 某个【年,月】 123 | -- 当前表 2 级联表 1 124 | -- 统计 125 | -- 【日期,字符串,下拉框】 126 | -- 求和 127 | -- 【日期,字符串,下拉框】 128 | -- 柱状图 查询级联表 129 | -- 某个【年,月】 130 | -- 统计 131 | -- 【日期,字符串,下拉框】 132 | -- 求和 133 | -- 【日期,字符串,下拉框】 134 | */ 135 | 136 | /** 137 | * 柱状图求和 138 | * @param params 139 | * @return 140 | */ 141 | List> barSum(Map params); 142 | 143 | /** 144 | * 柱状图统计 145 | * @param params 146 | * @return 147 | */ 148 | List> barCount(Map params); 149 | 150 | 151 | 152 | } 153 | -------------------------------------------------------------------------------- /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 | 17 | import com.annotation.IgnoreAuth; 18 | import com.entity.EIException; 19 | import com.entity.TokenEntity; 20 | import com.service.TokenService; 21 | import com.utils.R; 22 | 23 | /** 24 | * 权限(Token)验证 25 | */ 26 | @Component 27 | public class AuthorizationInterceptor implements HandlerInterceptor { 28 | 29 | public static final String LOGIN_TOKEN_KEY = "Token"; 30 | 31 | @Autowired 32 | private TokenService tokenService; 33 | 34 | @Override 35 | 36 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 37 | 38 | 39 | String servletPath = request.getServletPath(); 40 | if("/dictionary/page".equals(request.getServletPath()) || "/file/upload".equals(request.getServletPath()) || "/yonghu/register".equals(request.getServletPath()) ){//请求路径是字典表或者文件上传 直接放行 41 | return true; 42 | } 43 | //支持跨域请求 44 | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); 45 | response.setHeader("Access-Control-Max-Age", "3600"); 46 | response.setHeader("Access-Control-Allow-Credentials", "true"); 47 | response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization"); 48 | response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); 49 | 50 | IgnoreAuth annotation; 51 | if (handler instanceof HandlerMethod) { 52 | annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class); 53 | } else { 54 | return true; 55 | } 56 | 57 | //从header中获取token 58 | String token = request.getHeader(LOGIN_TOKEN_KEY); 59 | 60 | /** 61 | * 不需要验证权限的方法直接放过 62 | */ 63 | if(annotation!=null) { 64 | return true; 65 | } 66 | 67 | TokenEntity tokenEntity = null; 68 | if(StringUtils.isNotBlank(token)) { 69 | tokenEntity = tokenService.getTokenEntity(token); 70 | } 71 | 72 | if(tokenEntity != null) { 73 | request.getSession().setAttribute("userId", tokenEntity.getUserid()); 74 | request.getSession().setAttribute("role", tokenEntity.getRole()); 75 | request.getSession().setAttribute("tableName", tokenEntity.getTablename()); 76 | request.getSession().setAttribute("username", tokenEntity.getUsername()); 77 | return true; 78 | } 79 | 80 | PrintWriter writer = null; 81 | response.setCharacterEncoding("UTF-8"); 82 | response.setContentType("application/json; charset=utf-8"); 83 | try { 84 | writer = response.getWriter(); 85 | writer.print(JSONObject.toJSONString(R.error(401, "请先登录"))); 86 | } finally { 87 | if(writer != null){ 88 | writer.close(); 89 | } 90 | } 91 | // throw new EIException("请先登录", 401); 92 | return false; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/DictionaryModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.DictionaryEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import java.util.Date; 8 | import org.springframework.format.annotation.DateTimeFormat; 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 字典 14 | * 接收传参的实体类 15 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 16 | * 取自ModelAndView 的model名称 17 | */ 18 | public class DictionaryModel implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | 23 | 24 | /** 25 | * 主键 26 | */ 27 | private Long id; 28 | 29 | 30 | /** 31 | * 字段 32 | */ 33 | private String dicCode; 34 | 35 | 36 | /** 37 | * 字段名 38 | */ 39 | private String dicName; 40 | 41 | 42 | /** 43 | * 编码 44 | */ 45 | private Integer codeIndex; 46 | 47 | 48 | /** 49 | * 编码名字 50 | */ 51 | private String indexName; 52 | 53 | 54 | /** 55 | * 父字段id 56 | */ 57 | private Integer superId; 58 | 59 | 60 | /** 61 | * 备注 62 | */ 63 | private String beizhu; 64 | 65 | 66 | /** 67 | * 创建时间 68 | */ 69 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 70 | @DateTimeFormat 71 | private Date createTime; 72 | 73 | 74 | /** 75 | * 获取:主键 76 | */ 77 | public Long getId() { 78 | return id; 79 | } 80 | 81 | 82 | /** 83 | * 设置:主键 84 | */ 85 | public void setId(Long id) { 86 | this.id = id; 87 | } 88 | /** 89 | * 获取:字段 90 | */ 91 | public String getDicCode() { 92 | return dicCode; 93 | } 94 | 95 | 96 | /** 97 | * 设置:字段 98 | */ 99 | public void setDicCode(String dicCode) { 100 | this.dicCode = dicCode; 101 | } 102 | /** 103 | * 获取:字段名 104 | */ 105 | public String getDicName() { 106 | return dicName; 107 | } 108 | 109 | 110 | /** 111 | * 设置:字段名 112 | */ 113 | public void setDicName(String dicName) { 114 | this.dicName = dicName; 115 | } 116 | /** 117 | * 获取:编码 118 | */ 119 | public Integer getCodeIndex() { 120 | return codeIndex; 121 | } 122 | 123 | 124 | /** 125 | * 设置:编码 126 | */ 127 | public void setCodeIndex(Integer codeIndex) { 128 | this.codeIndex = codeIndex; 129 | } 130 | /** 131 | * 获取:编码名字 132 | */ 133 | public String getIndexName() { 134 | return indexName; 135 | } 136 | 137 | 138 | /** 139 | * 设置:编码名字 140 | */ 141 | public void setIndexName(String indexName) { 142 | this.indexName = indexName; 143 | } 144 | /** 145 | * 获取:父字段id 146 | */ 147 | public Integer getSuperId() { 148 | return superId; 149 | } 150 | 151 | 152 | /** 153 | * 设置:父字段id 154 | */ 155 | public void setSuperId(Integer superId) { 156 | this.superId = superId; 157 | } 158 | /** 159 | * 获取:备注 160 | */ 161 | public String getBeizhu() { 162 | return beizhu; 163 | } 164 | 165 | 166 | /** 167 | * 设置:备注 168 | */ 169 | public void setBeizhu(String beizhu) { 170 | this.beizhu = beizhu; 171 | } 172 | /** 173 | * 获取:创建时间 174 | */ 175 | public Date getCreateTime() { 176 | return createTime; 177 | } 178 | 179 | 180 | /** 181 | * 设置:创建时间 182 | */ 183 | public void setCreateTime(Date createTime) { 184 | this.createTime = createTime; 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /src/main/java/com/utils/BaiduUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.net.HttpURLConnection; 6 | import java.net.URL; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import org.json.JSONObject; 12 | 13 | 14 | /** 15 | * @author yangliyuan 16 | * @version 创建时间:2020年2月7日 下午9:37:05 17 | * 类说明 : 18 | */ 19 | 20 | public class BaiduUtil { 21 | 22 | /** 23 | * 根据经纬度获得省市区信息 24 | * @param lon 纬度 25 | * @param lat 经度 26 | * @param coordtype 经纬度坐标系 27 | * @return 28 | */ 29 | public static Map getCityByLonLat(String key, String lng, String lat) { 30 | String location = lat + "," + lng; 31 | try { 32 | //拼装url 33 | String url = "http://api.map.baidu.com/reverse_geocoding/v3/?ak="+key+"&output=json&coordtype=wgs84ll&location="+location; 34 | String result = HttpClientUtils.doGet(url); 35 | JSONObject o = new JSONObject(result); 36 | Map area = new HashMap<>(); 37 | area.put("province", o.getJSONObject("result").getJSONObject("addressComponent").getString("province")); 38 | area.put("city", o.getJSONObject("result").getJSONObject("addressComponent").getString("city")); 39 | area.put("district", o.getJSONObject("result").getJSONObject("addressComponent").getString("district")); 40 | area.put("street", o.getJSONObject("result").getJSONObject("addressComponent").getString("street")); 41 | return area; 42 | }catch (Exception e) { 43 | e.printStackTrace(); 44 | } 45 | return null; 46 | } 47 | 48 | /** 49 | * 获取API访问token 50 | * 该token有一定的有效期,需要自行管理,当失效时需重新获取. 51 | * @param ak - 百度云官网获取的 API Key 52 | * @param sk - 百度云官网获取的 Securet Key 53 | * @return assess_token 54 | */ 55 | public static String getAuth(String ak, String sk) { 56 | // 获取token地址 57 | String authHost = "https://aip.baidubce.com/oauth/2.0/token?"; 58 | String getAccessTokenUrl = authHost 59 | // 1. grant_type为固定参数 60 | + "grant_type=client_credentials" 61 | // 2. 官网获取的 API Key 62 | + "&client_id=" + ak 63 | // 3. 官网获取的 Secret Key 64 | + "&client_secret=" + sk; 65 | try { 66 | URL realUrl = new URL(getAccessTokenUrl); 67 | // 打开和URL之间的连接 68 | HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection(); 69 | connection.setRequestMethod("GET"); 70 | connection.connect(); 71 | // 获取所有响应头字段 72 | Map> map = connection.getHeaderFields(); 73 | // 遍历所有的响应头字段 74 | for (String key : map.keySet()) { 75 | System.err.println(key + "--->" + map.get(key)); 76 | } 77 | // 定义 BufferedReader输入流来读取URL的响应 78 | BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); 79 | String result = ""; 80 | String line; 81 | while ((line = in.readLine()) != null) { 82 | result += line; 83 | } 84 | /** 85 | * 返回结果示例 86 | */ 87 | System.err.println("result:" + result); 88 | org.json.JSONObject jsonObject = new org.json.JSONObject(result); 89 | String access_token = jsonObject.getString("access_token"); 90 | return access_token; 91 | } catch (Exception e) { 92 | System.err.printf("获取token失败!"); 93 | e.printStackTrace(System.err); 94 | } 95 | return null; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/CartVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.CartEntity; 4 | import com.baomidou.mybatisplus.annotations.TableField; 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import java.util.Date; 8 | import org.springframework.format.annotation.DateTimeFormat; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 购物车 14 | * 手机端接口返回实体辅助类 15 | * (主要作用去除一些不必要的字段) 16 | */ 17 | @TableName("cart") 18 | public class CartVO implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | /** 23 | * 主键 24 | */ 25 | 26 | @TableField(value = "id") 27 | private Integer id; 28 | 29 | 30 | /** 31 | * 所属用户 32 | */ 33 | 34 | @TableField(value = "yonghu_id") 35 | private Integer yonghuId; 36 | 37 | 38 | /** 39 | * 图书 40 | */ 41 | 42 | @TableField(value = "tushu_id") 43 | private Integer tushuId; 44 | 45 | 46 | /** 47 | * 购买数量 48 | */ 49 | 50 | @TableField(value = "buy_number") 51 | private Integer buyNumber; 52 | 53 | 54 | /** 55 | * 添加时间 56 | */ 57 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 58 | @DateTimeFormat 59 | 60 | @TableField(value = "create_time") 61 | private Date createTime; 62 | 63 | 64 | /** 65 | * 更新时间 66 | */ 67 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 68 | @DateTimeFormat 69 | 70 | @TableField(value = "update_time") 71 | private Date updateTime; 72 | 73 | 74 | /** 75 | * 创建时间 76 | */ 77 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 78 | @DateTimeFormat 79 | 80 | @TableField(value = "insert_time") 81 | private Date insertTime; 82 | 83 | 84 | /** 85 | * 设置:主键 86 | */ 87 | public Integer getId() { 88 | return id; 89 | } 90 | 91 | 92 | /** 93 | * 获取:主键 94 | */ 95 | 96 | public void setId(Integer id) { 97 | this.id = id; 98 | } 99 | /** 100 | * 设置:所属用户 101 | */ 102 | public Integer getYonghuId() { 103 | return yonghuId; 104 | } 105 | 106 | 107 | /** 108 | * 获取:所属用户 109 | */ 110 | 111 | public void setYonghuId(Integer yonghuId) { 112 | this.yonghuId = yonghuId; 113 | } 114 | /** 115 | * 设置:图书 116 | */ 117 | public Integer getTushuId() { 118 | return tushuId; 119 | } 120 | 121 | 122 | /** 123 | * 获取:图书 124 | */ 125 | 126 | public void setTushuId(Integer tushuId) { 127 | this.tushuId = tushuId; 128 | } 129 | /** 130 | * 设置:购买数量 131 | */ 132 | public Integer getBuyNumber() { 133 | return buyNumber; 134 | } 135 | 136 | 137 | /** 138 | * 获取:购买数量 139 | */ 140 | 141 | public void setBuyNumber(Integer buyNumber) { 142 | this.buyNumber = buyNumber; 143 | } 144 | /** 145 | * 设置:添加时间 146 | */ 147 | public Date getCreateTime() { 148 | return createTime; 149 | } 150 | 151 | 152 | /** 153 | * 获取:添加时间 154 | */ 155 | 156 | public void setCreateTime(Date createTime) { 157 | this.createTime = createTime; 158 | } 159 | /** 160 | * 设置:更新时间 161 | */ 162 | public Date getUpdateTime() { 163 | return updateTime; 164 | } 165 | 166 | 167 | /** 168 | * 获取:更新时间 169 | */ 170 | 171 | public void setUpdateTime(Date updateTime) { 172 | this.updateTime = updateTime; 173 | } 174 | /** 175 | * 设置:创建时间 176 | */ 177 | public Date getInsertTime() { 178 | return insertTime; 179 | } 180 | 181 | 182 | /** 183 | * 获取:创建时间 184 | */ 185 | 186 | public void setInsertTime(Date insertTime) { 187 | this.insertTime = insertTime; 188 | } 189 | 190 | } 191 | -------------------------------------------------------------------------------- /src/main/java/com/utils/PoiUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import org.apache.commons.io.FileUtils; 4 | import org.apache.poi.hssf.usermodel.HSSFCell; 5 | import org.apache.poi.hssf.usermodel.HSSFRow; 6 | import org.apache.poi.hssf.usermodel.HSSFSheet; 7 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; 8 | import org.apache.poi.ss.usermodel.Cell; 9 | 10 | import java.io.File; 11 | import java.io.FileOutputStream; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * 文件导入到处 17 | */ 18 | public class PoiUtil { 19 | /** 20 | * 导入 21 | * 22 | * @param url 23 | * @return 24 | * @throws Exception 25 | */ 26 | public static List> poiImport(String url) throws Exception { 27 | List> list = new ArrayList<>(); 28 | // 创建Excel 读取文件内容 29 | HSSFWorkbook workbook = new HSSFWorkbook(FileUtils.openInputStream(new File(url))); 30 | /** 31 | * 第一种方式读取Sheet页 32 | */ 33 | // HSSFSheet sheet = workbook.getSheet("Sheet0"); 34 | /** 35 | * 第二种方式读取Sheet页 36 | */ 37 | HSSFSheet sheet = workbook.getSheetAt(0);//获取工作表 38 | for (int i = 0; i < sheet.getLastRowNum()+1; i++) { 39 | HSSFRow row = sheet.getRow(i);//获取行 40 | List rowlist = new ArrayList<>();//行数据 41 | for (int j = 0; j < row.getLastCellNum(); j++) { 42 | HSSFCell cell = row.getCell(j); 43 | cell.setCellType(Cell.CELL_TYPE_STRING); 44 | String value = cell.getStringCellValue(); 45 | rowlist.add(value);//行中数据添加到行中 46 | } 47 | list.add(rowlist);//将行数据添加到list中 48 | } 49 | return list; 50 | } 51 | 52 | 53 | 54 | 55 | 56 | 57 | // 导出 58 | public static void poiExport(List> list, String url) throws Exception { 59 | //创建Excel工作薄 60 | HSSFWorkbook workbook = new HSSFWorkbook(); 61 | //创建一个工作表shheet 62 | HSSFSheet sheet = workbook.createSheet(); 63 | for (int i = 0; i < list.size(); i++) { 64 | HSSFRow row = sheet.createRow(i); 65 | List dataList = list.get(i); 66 | for (int j = 0; j < dataList.size(); j++) { 67 | HSSFCell cell = row.createCell(j); 68 | cell.setCellValue(dataList.get(j)); 69 | } 70 | 71 | } 72 | FileOutputStream stream = FileUtils.openOutputStream(new File(url)); 73 | workbook.write(stream); 74 | stream.close(); 75 | } 76 | 77 | 78 | public static void main(String[] args) { 79 | try { 80 | //导入 81 | List> lists = PoiUtil.poiImport("C:/Users/Administrator/Desktop/工作1.xls"); 82 | System.out.println(); 83 | 84 | 85 | //导出 86 | 87 | PoiUtil.poiExport(lists, "C:/Users/Administrator/Desktop/工作1.xls"); 88 | 89 | // 90 | // List> list = new ArrayList<>(); 91 | // ArrayList dataList = new ArrayList<>(); 92 | // dataList.add("标题1"); 93 | // dataList.add("标题2"); 94 | // dataList.add("标题3"); 95 | // list.add(dataList); 96 | // // 追加数据 97 | // for (int i = 1; i < 10; i++) {// 这里的int 起始是1 也就是第二行开始 98 | // ArrayList dataList111 = new ArrayList<>(); 99 | // dataList111.add("内容" + i); 100 | // dataList111.add("内容1111111121222222222333333333377777777411111111477777777" + i); 101 | // dataList111.add("内容" + i); 102 | // list.add(dataList111); 103 | // } 104 | // PoiUtil.poiExport(list, "C:/Users/Administrator/Desktop/工作1.xls"); 105 | } catch (Exception e) { 106 | e.printStackTrace(); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/TushuCommentbackModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.TushuCommentbackEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import java.util.Date; 8 | import org.springframework.format.annotation.DateTimeFormat; 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 图书评价 14 | * 接收传参的实体类 15 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 16 | * 取自ModelAndView 的model名称 17 | */ 18 | public class TushuCommentbackModel implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | 23 | 24 | /** 25 | * 主键 26 | */ 27 | private Integer id; 28 | 29 | 30 | /** 31 | * 图书 32 | */ 33 | private Integer tushuId; 34 | 35 | 36 | /** 37 | * 用户 38 | */ 39 | private Integer yonghuId; 40 | 41 | 42 | /** 43 | * 评价内容 44 | */ 45 | private String tushuCommentbackText; 46 | 47 | 48 | /** 49 | * 评价时间 50 | */ 51 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 52 | @DateTimeFormat 53 | private Date insertTime; 54 | 55 | 56 | /** 57 | * 回复内容 58 | */ 59 | private String replyText; 60 | 61 | 62 | /** 63 | * 回复时间 64 | */ 65 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 66 | @DateTimeFormat 67 | private Date updateTime; 68 | 69 | 70 | /** 71 | * 创建时间 72 | */ 73 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 74 | @DateTimeFormat 75 | private Date createTime; 76 | 77 | 78 | /** 79 | * 获取:主键 80 | */ 81 | public Integer getId() { 82 | return id; 83 | } 84 | 85 | 86 | /** 87 | * 设置:主键 88 | */ 89 | public void setId(Integer id) { 90 | this.id = id; 91 | } 92 | /** 93 | * 获取:图书 94 | */ 95 | public Integer getTushuId() { 96 | return tushuId; 97 | } 98 | 99 | 100 | /** 101 | * 设置:图书 102 | */ 103 | public void setTushuId(Integer tushuId) { 104 | this.tushuId = tushuId; 105 | } 106 | /** 107 | * 获取:用户 108 | */ 109 | public Integer getYonghuId() { 110 | return yonghuId; 111 | } 112 | 113 | 114 | /** 115 | * 设置:用户 116 | */ 117 | public void setYonghuId(Integer yonghuId) { 118 | this.yonghuId = yonghuId; 119 | } 120 | /** 121 | * 获取:评价内容 122 | */ 123 | public String getTushuCommentbackText() { 124 | return tushuCommentbackText; 125 | } 126 | 127 | 128 | /** 129 | * 设置:评价内容 130 | */ 131 | public void setTushuCommentbackText(String tushuCommentbackText) { 132 | this.tushuCommentbackText = tushuCommentbackText; 133 | } 134 | /** 135 | * 获取:评价时间 136 | */ 137 | public Date getInsertTime() { 138 | return insertTime; 139 | } 140 | 141 | 142 | /** 143 | * 设置:评价时间 144 | */ 145 | public void setInsertTime(Date insertTime) { 146 | this.insertTime = insertTime; 147 | } 148 | /** 149 | * 获取:回复内容 150 | */ 151 | public String getReplyText() { 152 | return replyText; 153 | } 154 | 155 | 156 | /** 157 | * 设置:回复内容 158 | */ 159 | public void setReplyText(String replyText) { 160 | this.replyText = replyText; 161 | } 162 | /** 163 | * 获取:回复时间 164 | */ 165 | public Date getUpdateTime() { 166 | return updateTime; 167 | } 168 | 169 | 170 | /** 171 | * 设置:回复时间 172 | */ 173 | public void setUpdateTime(Date updateTime) { 174 | this.updateTime = updateTime; 175 | } 176 | /** 177 | * 获取:创建时间 178 | */ 179 | public Date getCreateTime() { 180 | return createTime; 181 | } 182 | 183 | 184 | /** 185 | * 设置:创建时间 186 | */ 187 | public void setCreateTime(Date createTime) { 188 | this.createTime = createTime; 189 | } 190 | 191 | } 192 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/DictionaryVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.DictionaryEntity; 4 | import com.baomidou.mybatisplus.annotations.TableField; 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import java.util.Date; 8 | import org.springframework.format.annotation.DateTimeFormat; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 字典 14 | * 手机端接口返回实体辅助类 15 | * (主要作用去除一些不必要的字段) 16 | */ 17 | @TableName("dictionary") 18 | public class DictionaryVO implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | /** 23 | * 主键 24 | */ 25 | 26 | @TableField(value = "id") 27 | private Long id; 28 | 29 | 30 | /** 31 | * 字段 32 | */ 33 | 34 | @TableField(value = "dic_code") 35 | private String dicCode; 36 | 37 | 38 | /** 39 | * 字段名 40 | */ 41 | 42 | @TableField(value = "dic_name") 43 | private String dicName; 44 | 45 | 46 | /** 47 | * 编码 48 | */ 49 | 50 | @TableField(value = "code_index") 51 | private Integer codeIndex; 52 | 53 | 54 | /** 55 | * 编码名字 56 | */ 57 | 58 | @TableField(value = "index_name") 59 | private String indexName; 60 | 61 | 62 | /** 63 | * 父字段id 64 | */ 65 | 66 | @TableField(value = "super_id") 67 | private Integer superId; 68 | 69 | 70 | /** 71 | * 备注 72 | */ 73 | 74 | @TableField(value = "beizhu") 75 | private String beizhu; 76 | 77 | 78 | /** 79 | * 创建时间 80 | */ 81 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 82 | @DateTimeFormat 83 | 84 | @TableField(value = "create_time") 85 | private Date createTime; 86 | 87 | 88 | /** 89 | * 设置:主键 90 | */ 91 | public Long getId() { 92 | return id; 93 | } 94 | 95 | 96 | /** 97 | * 获取:主键 98 | */ 99 | 100 | public void setId(Long id) { 101 | this.id = id; 102 | } 103 | /** 104 | * 设置:字段 105 | */ 106 | public String getDicCode() { 107 | return dicCode; 108 | } 109 | 110 | 111 | /** 112 | * 获取:字段 113 | */ 114 | 115 | public void setDicCode(String dicCode) { 116 | this.dicCode = dicCode; 117 | } 118 | /** 119 | * 设置:字段名 120 | */ 121 | public String getDicName() { 122 | return dicName; 123 | } 124 | 125 | 126 | /** 127 | * 获取:字段名 128 | */ 129 | 130 | public void setDicName(String dicName) { 131 | this.dicName = dicName; 132 | } 133 | /** 134 | * 设置:编码 135 | */ 136 | public Integer getCodeIndex() { 137 | return codeIndex; 138 | } 139 | 140 | 141 | /** 142 | * 获取:编码 143 | */ 144 | 145 | public void setCodeIndex(Integer codeIndex) { 146 | this.codeIndex = codeIndex; 147 | } 148 | /** 149 | * 设置:编码名字 150 | */ 151 | public String getIndexName() { 152 | return indexName; 153 | } 154 | 155 | 156 | /** 157 | * 获取:编码名字 158 | */ 159 | 160 | public void setIndexName(String indexName) { 161 | this.indexName = indexName; 162 | } 163 | /** 164 | * 设置:父字段id 165 | */ 166 | public Integer getSuperId() { 167 | return superId; 168 | } 169 | 170 | 171 | /** 172 | * 获取:父字段id 173 | */ 174 | 175 | public void setSuperId(Integer superId) { 176 | this.superId = superId; 177 | } 178 | /** 179 | * 设置:备注 180 | */ 181 | public String getBeizhu() { 182 | return beizhu; 183 | } 184 | 185 | 186 | /** 187 | * 获取:备注 188 | */ 189 | 190 | public void setBeizhu(String beizhu) { 191 | this.beizhu = beizhu; 192 | } 193 | /** 194 | * 设置:创建时间 195 | */ 196 | public Date getCreateTime() { 197 | return createTime; 198 | } 199 | 200 | 201 | /** 202 | * 获取:创建时间 203 | */ 204 | 205 | public void setCreateTime(Date createTime) { 206 | this.createTime = createTime; 207 | } 208 | 209 | } 210 | -------------------------------------------------------------------------------- /src/main/java/com/controller/FileController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | import java.util.Arrays; 7 | import java.util.Date; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | import java.util.Random; 12 | import java.util.UUID; 13 | 14 | import org.apache.commons.io.FileUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.http.HttpHeaders; 18 | import org.springframework.http.HttpStatus; 19 | import org.springframework.http.MediaType; 20 | import org.springframework.http.ResponseEntity; 21 | import org.springframework.util.ResourceUtils; 22 | import org.springframework.web.bind.annotation.PathVariable; 23 | import org.springframework.web.bind.annotation.RequestBody; 24 | import org.springframework.web.bind.annotation.RequestMapping; 25 | import org.springframework.web.bind.annotation.RequestParam; 26 | import org.springframework.web.bind.annotation.RestController; 27 | import org.springframework.web.multipart.MultipartFile; 28 | 29 | import com.annotation.IgnoreAuth; 30 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 31 | import com.entity.ConfigEntity; 32 | import com.entity.EIException; 33 | import com.service.ConfigService; 34 | import com.utils.R; 35 | 36 | /** 37 | * 上传文件映射表 38 | */ 39 | @RestController 40 | @RequestMapping("file") 41 | @SuppressWarnings({"unchecked","rawtypes"}) 42 | public class FileController{ 43 | @Autowired 44 | private ConfigService configService; 45 | /** 46 | * 上传文件 47 | */ 48 | @RequestMapping("/upload") 49 | public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception { 50 | if (file.isEmpty()) { 51 | throw new EIException("上传文件不能为空"); 52 | } 53 | String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); 54 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 55 | if(!path.exists()) { 56 | path = new File(""); 57 | } 58 | File upload = new File(path.getAbsolutePath(),"/upload/"); 59 | if(!upload.exists()) { 60 | upload.mkdirs(); 61 | } 62 | String fileName = new Date().getTime()+"."+fileExt; 63 | File dest = new File(upload.getAbsolutePath()+"/"+fileName); 64 | file.transferTo(dest); 65 | if(StringUtils.isNotBlank(type) && type.equals("1")) { 66 | ConfigEntity configEntity = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 67 | if(configEntity==null) { 68 | configEntity = new ConfigEntity(); 69 | configEntity.setName("faceFile"); 70 | configEntity.setValue(fileName); 71 | } else { 72 | configEntity.setValue(fileName); 73 | } 74 | configService.insertOrUpdate(configEntity); 75 | } 76 | return R.ok().put("file", fileName); 77 | } 78 | 79 | /** 80 | * 下载文件 81 | */ 82 | @IgnoreAuth 83 | @RequestMapping("/download") 84 | public ResponseEntity download(@RequestParam String fileName) { 85 | try { 86 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 87 | if(!path.exists()) { 88 | path = new File(""); 89 | } 90 | File upload = new File(path.getAbsolutePath(),"/upload/"); 91 | if(!upload.exists()) { 92 | upload.mkdirs(); 93 | } 94 | File file = new File(upload.getAbsolutePath()+"/"+fileName); 95 | if(file.exists()){ 96 | /*if(!fileService.canRead(file, SessionManager.getSessionUser())){ 97 | getResponse().sendError(403); 98 | }*/ 99 | HttpHeaders headers = new HttpHeaders(); 100 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 101 | headers.setContentDispositionFormData("attachment", fileName); 102 | return new ResponseEntity(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); 103 | } 104 | } catch (IOException e) { 105 | e.printStackTrace(); 106 | } 107 | return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/AddressModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.AddressEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import java.util.Date; 8 | import org.springframework.format.annotation.DateTimeFormat; 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 收货地址 14 | * 接收传参的实体类 15 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 16 | * 取自ModelAndView 的model名称 17 | */ 18 | public class AddressModel implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | 23 | 24 | /** 25 | * 主键 26 | */ 27 | private Integer id; 28 | 29 | 30 | /** 31 | * 创建用户 32 | */ 33 | private Integer yonghuId; 34 | 35 | 36 | /** 37 | * 收货人 38 | */ 39 | private String addressName; 40 | 41 | 42 | /** 43 | * 电话 44 | */ 45 | private String addressPhone; 46 | 47 | 48 | /** 49 | * 地址 50 | */ 51 | private String addressDizhi; 52 | 53 | 54 | /** 55 | * 是否默认地址 56 | */ 57 | private Integer isdefaultTypes; 58 | 59 | 60 | /** 61 | * 添加时间 62 | */ 63 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 64 | @DateTimeFormat 65 | private Date insertTime; 66 | 67 | 68 | /** 69 | * 修改时间 70 | */ 71 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 72 | @DateTimeFormat 73 | private Date updateTime; 74 | 75 | 76 | /** 77 | * 创建时间 show3 78 | */ 79 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 80 | @DateTimeFormat 81 | private Date createTime; 82 | 83 | 84 | /** 85 | * 获取:主键 86 | */ 87 | public Integer getId() { 88 | return id; 89 | } 90 | 91 | 92 | /** 93 | * 设置:主键 94 | */ 95 | public void setId(Integer id) { 96 | this.id = id; 97 | } 98 | /** 99 | * 获取:创建用户 100 | */ 101 | public Integer getYonghuId() { 102 | return yonghuId; 103 | } 104 | 105 | 106 | /** 107 | * 设置:创建用户 108 | */ 109 | public void setYonghuId(Integer yonghuId) { 110 | this.yonghuId = yonghuId; 111 | } 112 | /** 113 | * 获取:收货人 114 | */ 115 | public String getAddressName() { 116 | return addressName; 117 | } 118 | 119 | 120 | /** 121 | * 设置:收货人 122 | */ 123 | public void setAddressName(String addressName) { 124 | this.addressName = addressName; 125 | } 126 | /** 127 | * 获取:电话 128 | */ 129 | public String getAddressPhone() { 130 | return addressPhone; 131 | } 132 | 133 | 134 | /** 135 | * 设置:电话 136 | */ 137 | public void setAddressPhone(String addressPhone) { 138 | this.addressPhone = addressPhone; 139 | } 140 | /** 141 | * 获取:地址 142 | */ 143 | public String getAddressDizhi() { 144 | return addressDizhi; 145 | } 146 | 147 | 148 | /** 149 | * 设置:地址 150 | */ 151 | public void setAddressDizhi(String addressDizhi) { 152 | this.addressDizhi = addressDizhi; 153 | } 154 | /** 155 | * 获取:是否默认地址 156 | */ 157 | public Integer getIsdefaultTypes() { 158 | return isdefaultTypes; 159 | } 160 | 161 | 162 | /** 163 | * 设置:是否默认地址 164 | */ 165 | public void setIsdefaultTypes(Integer isdefaultTypes) { 166 | this.isdefaultTypes = isdefaultTypes; 167 | } 168 | /** 169 | * 获取:添加时间 170 | */ 171 | public Date getInsertTime() { 172 | return insertTime; 173 | } 174 | 175 | 176 | /** 177 | * 设置:添加时间 178 | */ 179 | public void setInsertTime(Date insertTime) { 180 | this.insertTime = insertTime; 181 | } 182 | /** 183 | * 获取:修改时间 184 | */ 185 | public Date getUpdateTime() { 186 | return updateTime; 187 | } 188 | 189 | 190 | /** 191 | * 设置:修改时间 192 | */ 193 | public void setUpdateTime(Date updateTime) { 194 | this.updateTime = updateTime; 195 | } 196 | /** 197 | * 获取:创建时间 show3 198 | */ 199 | public Date getCreateTime() { 200 | return createTime; 201 | } 202 | 203 | 204 | /** 205 | * 设置:创建时间 show3 206 | */ 207 | public void setCreateTime(Date createTime) { 208 | this.createTime = createTime; 209 | } 210 | 211 | } 212 | --------------------------------------------------------------------------------