├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── LICENSE ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml ├── sql └── buyers.sql └── src ├── main ├── java │ └── com │ │ └── hzq │ │ └── dragonshopping │ │ ├── DragonshoppingApplication.java │ │ ├── controller │ │ ├── CommonController.java │ │ ├── IndexController.java │ │ ├── ProduceCategoryController.java │ │ ├── ProduceCommentController.java │ │ ├── ProduceController.java │ │ ├── ShoppingCartController.java │ │ └── UserController.java │ │ ├── entity │ │ ├── CommentEntity.java │ │ ├── CommentsUserEntity.java │ │ ├── ProducCommentsUserEntity.java │ │ ├── ProduceCategoryEntity.java │ │ ├── ProduceCategoryExampleEntity.java │ │ ├── ProduceEntity.java │ │ ├── ProduceShoppingCartEntity.java │ │ ├── ShoppingCartEntity.java │ │ └── UserEntity.java │ │ ├── mapper │ │ ├── ProduceCategoryMapper.java │ │ ├── ProduceCommentMapper.java │ │ ├── ProduceMapper.java │ │ ├── ShoppingCartMapper.java │ │ └── UserMapper.java │ │ ├── service │ │ ├── CommentServiceImpl.java │ │ ├── ICommentService.java │ │ ├── IProduceCategoryService.java │ │ ├── IProduceService.java │ │ ├── IShoppingCartService.java │ │ ├── IUserService.java │ │ ├── ProduceCategoryServiceImpl.java │ │ ├── ProduceServiceImpl.java │ │ ├── ShoppingCartServiceImpl.java │ │ └── UserServiceImpl.java │ │ └── untils │ │ └── JedisUtils.java └── resources │ ├── application.yml │ ├── configs │ └── mapper │ │ ├── ProduceCategoryMapper.xml │ │ ├── ProduceCommentMapper.xml │ │ ├── ProduceMapper.xml │ │ ├── ShoppingCartMapper.xml │ │ └── UserMapper.xml │ ├── static │ ├── css │ │ ├── bootstrap.min.css │ │ ├── cart.css │ │ ├── font-awesome.min.css │ │ ├── reset.css │ │ ├── style.css │ │ ├── weui.css │ │ ├── weui.min.css │ │ └── weuix.css │ ├── images │ │ ├── JayZhou.jpeg │ │ ├── cbiancheng.jpg │ │ ├── computer.jpg │ │ ├── gelin.jpg │ │ ├── goyvyang.jpg │ │ ├── halibote.jpg │ │ ├── javarumeng.jpg │ │ ├── leehongwang.jpg │ │ ├── leehonwang.jpg │ │ ├── me.jpg │ │ ├── mingren.jpg │ │ ├── python.jpg │ │ ├── wenxuede.jpg │ │ ├── wenxuedeyiyi.jpg │ │ └── xiyouji.jpg │ ├── img │ │ ├── Basket-2@3x.png │ │ ├── Credit-card-4@3x.png │ │ ├── Lock-square@3x.png │ │ ├── Present-2@3x.png │ │ ├── Settings-3@3x.png │ │ ├── Shopping-bag-3@3x.png │ │ ├── Shopping-cart-1@3x.png │ │ ├── Tag-2@3x.png │ │ ├── User-V@3x.png │ │ ├── User@3x.png │ │ ├── c_checkbox_off.png │ │ ├── c_checkbox_on.png │ │ ├── favicon.ico │ │ ├── icon-back.png │ │ ├── icon-kin.png │ │ ├── icon_radio3.png │ │ ├── icon_radio4.png │ │ └── return.png │ ├── js │ │ ├── cart.js │ │ ├── common.js │ │ ├── jquery-2.1.0.js │ │ ├── jquery-2.1.4.min.js │ │ ├── web.js │ │ ├── zepto.js │ │ ├── zepto.min.js │ │ └── zepto.weui.js │ └── test │ │ └── zepto.min.js │ └── templates │ ├── account │ └── index.html │ ├── include │ ├── menu.html │ └── message.html │ ├── index.html │ ├── login.html │ ├── mycart.html │ ├── product.html │ ├── product_category.html │ ├── regist.html │ └── welcome.html └── test └── java └── com └── hzq └── dragonshopping └── DragonshoppingApplicationTests.java /.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | https://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if(mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if(mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if(!outputFile.getParentFile().exists()) { 87 | if(!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dragonshopping 2 | 基于SpringBoot + Mybatis + Thymeleaf + MySQL开发的购书商城系统 3 | 这个项目是当时在学校学习写后台时的demo 4 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Mingw, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | # TODO classpath? 118 | fi 119 | 120 | if [ -z "$JAVA_HOME" ]; then 121 | javaExecutable="`which javac`" 122 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 123 | # readlink(1) is not available as standard on Solaris 10. 124 | readLink=`which readlink` 125 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 126 | if $darwin ; then 127 | javaHome="`dirname \"$javaExecutable\"`" 128 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 129 | else 130 | javaExecutable="`readlink -f \"$javaExecutable\"`" 131 | fi 132 | javaHome="`dirname \"$javaExecutable\"`" 133 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 134 | JAVA_HOME="$javaHome" 135 | export JAVA_HOME 136 | fi 137 | fi 138 | fi 139 | 140 | if [ -z "$JAVACMD" ] ; then 141 | if [ -n "$JAVA_HOME" ] ; then 142 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 143 | # IBM's JDK on AIX uses strange locations for the executables 144 | JAVACMD="$JAVA_HOME/jre/sh/java" 145 | else 146 | JAVACMD="$JAVA_HOME/bin/java" 147 | fi 148 | else 149 | JAVACMD="`which java`" 150 | fi 151 | fi 152 | 153 | if [ ! -x "$JAVACMD" ] ; then 154 | echo "Error: JAVA_HOME is not defined correctly." >&2 155 | echo " We cannot execute $JAVACMD" >&2 156 | exit 1 157 | fi 158 | 159 | if [ -z "$JAVA_HOME" ] ; then 160 | echo "Warning: JAVA_HOME environment variable is not set." 161 | fi 162 | 163 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 164 | 165 | # traverses directory structure from process work directory to filesystem root 166 | # first directory with .mvn subdirectory is considered project base directory 167 | find_maven_basedir() { 168 | 169 | if [ -z "$1" ] 170 | then 171 | echo "Path not specified to find_maven_basedir" 172 | return 1 173 | fi 174 | 175 | basedir="$1" 176 | wdir="$1" 177 | while [ "$wdir" != '/' ] ; do 178 | if [ -d "$wdir"/.mvn ] ; then 179 | basedir=$wdir 180 | break 181 | fi 182 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 183 | if [ -d "${wdir}" ]; then 184 | wdir=`cd "$wdir/.."; pwd` 185 | fi 186 | # end of workaround 187 | done 188 | echo "${basedir}" 189 | } 190 | 191 | # concatenates all lines of a file 192 | concat_lines() { 193 | if [ -f "$1" ]; then 194 | echo "$(tr -s '\n' ' ' < "$1")" 195 | fi 196 | } 197 | 198 | BASE_DIR=`find_maven_basedir "$(pwd)"` 199 | if [ -z "$BASE_DIR" ]; then 200 | exit 1; 201 | fi 202 | 203 | ########################################################################################## 204 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 205 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 206 | ########################################################################################## 207 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 208 | if [ "$MVNW_VERBOSE" = true ]; then 209 | echo "Found .mvn/wrapper/maven-wrapper.jar" 210 | fi 211 | else 212 | if [ "$MVNW_VERBOSE" = true ]; then 213 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 214 | fi 215 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 216 | while IFS="=" read key value; do 217 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 218 | esac 219 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 220 | if [ "$MVNW_VERBOSE" = true ]; then 221 | echo "Downloading from: $jarUrl" 222 | fi 223 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 224 | 225 | if command -v wget > /dev/null; then 226 | if [ "$MVNW_VERBOSE" = true ]; then 227 | echo "Found wget ... using wget" 228 | fi 229 | wget "$jarUrl" -O "$wrapperJarPath" 230 | elif command -v curl > /dev/null; then 231 | if [ "$MVNW_VERBOSE" = true ]; then 232 | echo "Found curl ... using curl" 233 | fi 234 | curl -o "$wrapperJarPath" "$jarUrl" 235 | else 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Falling back to using Java to download" 238 | fi 239 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 240 | if [ -e "$javaClass" ]; then 241 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 242 | if [ "$MVNW_VERBOSE" = true ]; then 243 | echo " - Compiling MavenWrapperDownloader.java ..." 244 | fi 245 | # Compiling the Java class 246 | ("$JAVA_HOME/bin/javac" "$javaClass") 247 | fi 248 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 249 | # Running the downloader 250 | if [ "$MVNW_VERBOSE" = true ]; then 251 | echo " - Running MavenWrapperDownloader.java ..." 252 | fi 253 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 254 | fi 255 | fi 256 | fi 257 | fi 258 | ########################################################################################## 259 | # End of extension 260 | ########################################################################################## 261 | 262 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 263 | if [ "$MVNW_VERBOSE" = true ]; then 264 | echo $MAVEN_PROJECTBASEDIR 265 | fi 266 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 267 | 268 | # For Cygwin, switch paths to Windows format before running java 269 | if $cygwin; then 270 | [ -n "$M2_HOME" ] && 271 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 272 | [ -n "$JAVA_HOME" ] && 273 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 274 | [ -n "$CLASSPATH" ] && 275 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 276 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 277 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 278 | fi 279 | 280 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 281 | 282 | exec "$JAVACMD" \ 283 | $MAVEN_OPTS \ 284 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 285 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 286 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 287 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.8.RELEASE 9 | 10 | 11 | com.hzq 12 | dragonshopping 13 | 0.0.1-SNAPSHOT 14 | dragonshopping 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-web 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-logging 30 | 31 | 32 | 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-log4j2 37 | 38 | 39 | 40 | org.springframework.boot 41 | spring-boot-starter-test 42 | test 43 | 44 | 45 | 46 | org.springframework 47 | spring-jdbc 48 | 49 | 50 | 51 | mysql 52 | mysql-connector-java 53 | 54 | 55 | 56 | 57 | org.apache.commons 58 | commons-dbcp2 59 | 60 | 61 | 62 | 63 | org.mybatis.spring.boot 64 | mybatis-spring-boot-starter 65 | 2.0.1 66 | 67 | 68 | 69 | 70 | org.springframework.boot 71 | spring-boot-devtools 72 | true 73 | runtime 74 | 75 | 76 | 77 | 78 | org.springframework.boot 79 | spring-boot-starter-thymeleaf 80 | 81 | 82 | 83 | 84 | org.springframework.boot 85 | spring-boot-starter-data-redis 86 | 87 | 88 | 89 | redis.clients 90 | jedis 91 | 92 | 93 | org.apache.commons 94 | commons-pool2 95 | 96 | 97 | 98 | org.springframework.boot 99 | spring-boot-starter-aop 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | org.springframework.boot 108 | spring-boot-maven-plugin 109 | 110 | true 111 | true 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /sql/buyers.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : localhost1 5 | Source Server Type : MySQL 6 | Source Server Version : 50725 7 | Source Host : localhost:3306 8 | Source Schema : buyers 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 50725 12 | File Encoding : 65001 13 | 14 | Date: 02/12/2019 23:37:35 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for comment 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `comment`; 24 | CREATE TABLE `comment` ( 25 | `comments_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '评论id', 26 | `comments_centent` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '评论的内容', 27 | `comments_user_id` int(255) DEFAULT NULL COMMENT '评论的用户id', 28 | `comments_produce_id` int(255) DEFAULT NULL COMMENT '评论的商品id', 29 | `comments_stars` int(11) DEFAULT NULL COMMENT '评论的星级', 30 | `comments_date` datetime(0) DEFAULT CURRENT_TIMESTAMP COMMENT '评论的时间', 31 | PRIMARY KEY (`comments_id`) USING BTREE 32 | ) ENGINE = InnoDB AUTO_INCREMENT = 52 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 33 | 34 | -- ---------------------------- 35 | -- Records of comment 36 | -- ---------------------------- 37 | INSERT INTO `comment` VALUES (1, '真的好看', 1, 1, 2, '2019-09-04 00:00:00'); 38 | INSERT INTO `comment` VALUES (2, '内容精彩', 2, 2, 5, '2019-09-15 00:00:00'); 39 | INSERT INTO `comment` VALUES (3, '内容精彩', 2, 2, 2, '2019-09-04 00:00:00'); 40 | INSERT INTO `comment` VALUES (4, '还可以吧就是有点少', NULL, 2, 1, '2019-09-04 00:00:00'); 41 | INSERT INTO `comment` VALUES (7, '好看', 1, 1, 2, '2019-09-30 12:58:01'); 42 | INSERT INTO `comment` VALUES (8, '士大夫', 1, 6, 0, '2019-09-30 14:21:07'); 43 | INSERT INTO `comment` VALUES (19, 'dsafsdaf', 1, 6, 0, '2019-09-30 14:26:09'); 44 | INSERT INTO `comment` VALUES (20, 'sdafsd', 1, 6, 4, '2019-09-30 14:26:48'); 45 | INSERT INTO `comment` VALUES (21, 'fadsfasd', 1, 6, 5, '2019-09-30 14:27:59'); 46 | INSERT INTO `comment` VALUES (22, '发生法撒旦', 2, 3, 3, '2019-09-30 15:10:18'); 47 | INSERT INTO `comment` VALUES (23, '大事发生的', 2, 6, 3, '2019-09-30 15:52:34'); 48 | INSERT INTO `comment` VALUES (24, 'asdf', 2, 6, 2, '2019-09-30 15:53:39'); 49 | INSERT INTO `comment` VALUES (25, '防守打法', 2, 6, 3, '2019-09-30 15:54:49'); 50 | INSERT INTO `comment` VALUES (40, '很好看!!!!!!!!!!!!!', 2, 1, 4, '2019-10-16 16:26:02'); 51 | INSERT INTO `comment` VALUES (41, '第三方', 2, 3, 4, '2019-10-18 22:11:19'); 52 | INSERT INTO `comment` VALUES (42, '受益匪浅呀', 2, 4, 5, '2019-10-21 22:02:14'); 53 | INSERT INTO `comment` VALUES (43, '1111', 2, 2, 5, '2019-10-29 10:59:34'); 54 | INSERT INTO `comment` VALUES (44, 'admin来过', 2, 7, 5, '2019-10-31 21:35:01'); 55 | INSERT INTO `comment` VALUES (45, '真好看!', 2, 1, 5, '2019-11-02 16:36:35'); 56 | INSERT INTO `comment` VALUES (46, '还行吧?', 2, 2, 5, '2019-11-02 23:45:28'); 57 | INSERT INTO `comment` VALUES (47, '还行!', 2, 1, 5, '2019-11-04 10:27:40'); 58 | INSERT INTO `comment` VALUES (48, 'qqq', 2, 2, 5, '2019-11-04 16:07:51'); 59 | INSERT INTO `comment` VALUES (49, '田茂林真帅', 2, 2, 5, '2019-11-04 23:08:43'); 60 | INSERT INTO `comment` VALUES (50, '23.45', 2, 1, 5, '2019-11-04 23:45:52'); 61 | INSERT INTO `comment` VALUES (51, '现在是0:03', 2, 1, 5, '2019-11-05 00:03:39'); 62 | 63 | -- ---------------------------- 64 | -- Table structure for order_details 65 | -- ---------------------------- 66 | DROP TABLE IF EXISTS `order_details`; 67 | CREATE TABLE `order_details` ( 68 | `id` int(11) NOT NULL AUTO_INCREMENT, 69 | `user_id` int(11) DEFAULT NULL COMMENT '用户id', 70 | `produce_id` int(11) DEFAULT NULL COMMENT '商品id', 71 | `pay_state` int(11) DEFAULT 0 COMMENT '支付状态(1已支付,0未支付)', 72 | `pay_way` int(11) DEFAULT NULL COMMENT '支付方式(1微信,2支付宝)', 73 | `order_num` int(11) DEFAULT NULL COMMENT '订单号', 74 | `pay_time` datetime(0) DEFAULT NULL COMMENT '支付时间', 75 | `order_details_total_price` decimal(10, 2) DEFAULT NULL COMMENT '订单总价', 76 | `create_time` datetime(0) DEFAULT NULL COMMENT '创建时间', 77 | `update_time` datetime(0) DEFAULT NULL COMMENT '更新时间', 78 | PRIMARY KEY (`id`) USING BTREE 79 | ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 80 | 81 | -- ---------------------------- 82 | -- Table structure for order_master 83 | -- ---------------------------- 84 | DROP TABLE IF EXISTS `order_master`; 85 | CREATE TABLE `order_master` ( 86 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单id', 87 | `user_id` int(11) DEFAULT NULL COMMENT '订单用户id', 88 | `produce_id` int(11) DEFAULT NULL COMMENT '订单商品id', 89 | `quantity` int(11) DEFAULT NULL COMMENT '订单数量', 90 | `total_price` decimal(10, 2) DEFAULT NULL COMMENT '总订单总价', 91 | `create_time` datetime(0) DEFAULT NULL COMMENT '订单创建时间', 92 | `update_time` datetime(0) DEFAULT NULL COMMENT '订单更新时间', 93 | PRIMARY KEY (`id`) USING BTREE 94 | ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; 95 | 96 | -- ---------------------------- 97 | -- Table structure for produce_sell 98 | -- ---------------------------- 99 | DROP TABLE IF EXISTS `produce_sell`; 100 | CREATE TABLE `produce_sell` ( 101 | `produce_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '商品详情id', 102 | `produce_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '商品名字', 103 | `produce_explain` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '商品说明', 104 | `produce_produce_sortnum` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '商品种类编号', 105 | `produce_count` int(11) DEFAULT NULL COMMENT '商品库存数量', 106 | `produce_price` decimal(10, 2) DEFAULT NULL COMMENT '商品实际销售价格', 107 | `produce_shop_price` decimal(10, 2) DEFAULT NULL COMMENT '商品原销售价格', 108 | `produce_imgurl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '商品图片地址', 109 | `produce_author` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '商品的作者', 110 | `produce_sale_count` int(11) DEFAULT NULL COMMENT '已销售数量', 111 | `produce_hot` int(11) DEFAULT NULL COMMENT '商品热度', 112 | `produce_creat_user_id` int(11) DEFAULT 2 COMMENT '发布商品的用户id', 113 | `create_time` datetime(0) DEFAULT NULL COMMENT '发布时间', 114 | `update_time` datetime(0) DEFAULT NULL COMMENT '更新时间', 115 | PRIMARY KEY (`produce_id`) USING BTREE 116 | ) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 117 | 118 | -- ---------------------------- 119 | -- Records of produce_sell 120 | -- ---------------------------- 121 | INSERT INTO `produce_sell` VALUES (1, 'c#高级编程', '内容超级全', 'bc001', 499, 100.00, 150.00, '/images/cbiancheng.jpg', '未知', NULL, 10, 2, '2019-09-04 14:58:30', '2019-09-20 14:58:36'); 122 | INSERT INTO `produce_sell` VALUES (2, 'java从入门到精通', '第五版', 'bc001', 12, 50.00, 99.90, '/images/javarumeng.jpg', '未知', NULL, 9, 2, '2019-09-05 15:09:09', '2019-09-18 15:09:22'); 123 | INSERT INTO `produce_sell` VALUES (3, '哈利波特', '故事很精彩', 'et001', 8, 20.00, 31.50, '/images/halibote.jpg', '未知', NULL, 6, 2, '2019-09-02 15:48:48', '2019-09-18 15:48:52'); 124 | INSERT INTO `produce_sell` VALUES (4, '文学的邀约', '关于文学的介绍', 'wx001', 48, 25.00, 42.70, '/images/wenxuede.jpg', '未知', NULL, 5, 2, '2019-09-10 15:48:54', '2019-09-18 15:48:58'); 125 | INSERT INTO `produce_sell` VALUES (5, '文学的意义', '关于文学的意义', 'wx001', 130, 10.00, 15.00, '/images/wenxuedeyiyi.jpg', '未知', NULL, 7, 2, '2019-09-03 15:47:55', '2019-09-18 15:48:02'); 126 | INSERT INTO `produce_sell` VALUES (6, 'python学习手册', '关于python的知识和一些你意想不到的知识', 'bc001', 296, 120.00, 173.00, '/images/python.jpg', '未知', NULL, 8, 2, '2019-09-04 15:58:31', '2019-09-18 15:58:34'); 127 | INSERT INTO `produce_sell` VALUES (7, 'Go语高级编程', '关于go语言的教材', 'bc001', 251, 40.00, 70.30, '/images/goyvyang.jpg', '未知', NULL, 2, 2, '2019-09-09 15:59:55', '2019-09-18 16:00:02'); 128 | INSERT INTO `produce_sell` VALUES (8, '格林童话精选', '有意思的故事会', 'wx001', 560, 5.00, 13.50, '/images/gelin.jpg', '未知', NULL, 1, 2, '2019-09-03 16:02:52', '2019-09-18 16:02:56'); 129 | INSERT INTO `produce_sell` VALUES (9, '西游记', '去西天取经', 'wx001', 2000, 17.00, 19.50, '/images/xiyouji.jpg', '吴承恩', NULL, 3, 2, '2019-09-09 16:04:16', '2019-09-18 16:04:23'); 130 | 131 | -- ---------------------------- 132 | -- Table structure for produce_sell_category 133 | -- ---------------------------- 134 | DROP TABLE IF EXISTS `produce_sell_category`; 135 | CREATE TABLE `produce_sell_category` ( 136 | `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '商品类目id', 137 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '商品类别名称', 138 | ` 139 | describe` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '商品类别描述', 140 | `sortnum` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '商品种类编号', 141 | PRIMARY KEY (`id`) USING BTREE, 142 | UNIQUE INDEX `sortnum`(`sortnum`) USING BTREE 143 | ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; 144 | 145 | -- ---------------------------- 146 | -- Records of produce_sell_category 147 | -- ---------------------------- 148 | INSERT INTO `produce_sell_category` VALUES (1, '编程类', '有关编程的读书', 'bc001'); 149 | INSERT INTO `produce_sell_category` VALUES (2, '儿童读书', 'java的基础知识点', 'et001'); 150 | INSERT INTO `produce_sell_category` VALUES (3, '传记', '叙述名人的生平经历', 'zj001'); 151 | INSERT INTO `produce_sell_category` VALUES (4, '文学', '用形象反映社会生活', 'wx001'); 152 | 153 | -- ---------------------------- 154 | -- Table structure for shopping_cart 155 | -- ---------------------------- 156 | DROP TABLE IF EXISTS `shopping_cart`; 157 | CREATE TABLE `shopping_cart` ( 158 | `id` int(11) NOT NULL AUTO_INCREMENT, 159 | `user_id` int(11) DEFAULT NULL COMMENT '用户id', 160 | `produce_id` int(11) DEFAULT NULL COMMENT '商品id', 161 | `cart_produce_count` int(11) DEFAULT NULL COMMENT '购物车中此商品的数量', 162 | `create_time` datetime(0) DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 163 | `update_time` datetime(0) DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', 164 | PRIMARY KEY (`id`) USING BTREE 165 | ) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 166 | 167 | -- ---------------------------- 168 | -- Records of shopping_cart 169 | -- ---------------------------- 170 | INSERT INTO `shopping_cart` VALUES (1, 2, 1, 13, '2019-10-02 13:54:46', '2019-10-13 13:54:50'); 171 | INSERT INTO `shopping_cart` VALUES (15, 2, 2, 3, '2019-10-22 11:56:41', '2019-10-22 11:56:41'); 172 | INSERT INTO `shopping_cart` VALUES (16, 2, 3, 3, '2019-10-22 11:57:34', '2019-10-22 11:57:34'); 173 | INSERT INTO `shopping_cart` VALUES (17, 3, 3, 1, '2019-10-31 21:33:56', '2019-10-31 21:33:56'); 174 | INSERT INTO `shopping_cart` VALUES (18, 2, 4, 1, '2019-11-01 20:58:49', '2019-11-01 20:58:49'); 175 | 176 | -- ---------------------------- 177 | -- Table structure for user 178 | -- ---------------------------- 179 | DROP TABLE IF EXISTS `user`; 180 | CREATE TABLE `user` ( 181 | `user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id', 182 | `user_name` varchar(225) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户名', 183 | `user_sex` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户性别', 184 | `user_password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户密码', 185 | `user_ 186 | address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户地址', 187 | `user_phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户电话', 188 | `user_headimgurl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户头像图片地址', 189 | `user_status` int(255) DEFAULT NULL COMMENT '状态(1禁用,0未禁用)', 190 | `user_type` int(255) DEFAULT NULL COMMENT '身份标识(1买家,2卖家,3超级管理员)', 191 | `user_money` decimal(10, 1) DEFAULT NULL COMMENT '用户账户余额', 192 | PRIMARY KEY (`user_id`) USING BTREE 193 | ) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 194 | 195 | -- ---------------------------- 196 | -- Records of user 197 | -- ---------------------------- 198 | INSERT INTO `user` VALUES (1, '鸣人', '男', 'password', '台北', '15173468345', '/images/mingren.jpg', 0, 1, 200.0); 199 | INSERT INTO `user` VALUES (2, 'musicman', '男', 'password', '衡阳', '15173468345', '/images/leehongwang.jpg', 0, 3, 0.0); 200 | INSERT INTO `user` VALUES (3, 'admin', '男', 'password', '衡阳', NULL, '/images/mingren.jpg', 0, 3, 0.0); 201 | INSERT INTO `user` VALUES (5, 'JayZhou', '男', 'password', NULL, NULL, '/images/JayZhou.jpeg', 0, 1, 100000000.0); 202 | INSERT INTO `user` VALUES (6, '周杰伦', '男', 'password', '台北', NULL, '/images/JayZhou.jpeg', 0, 1, 100000000.0); 203 | INSERT INTO `user` VALUES (7, '林俊杰', '男', 'password', '新加坡', NULL, '/images/mingren.jpg', NULL, NULL, 0.0); 204 | INSERT INTO `user` VALUES (8, 'object', NULL, 'password', NULL, NULL, NULL, NULL, NULL, NULL); 205 | INSERT INTO `user` VALUES (9, 'obj', NULL, 'password', NULL, NULL, NULL, NULL, NULL, NULL); 206 | INSERT INTO `user` VALUES (10, 'obj', NULL, 'password', NULL, NULL, NULL, NULL, NULL, NULL); 207 | INSERT INTO `user` VALUES (11, 'gootobj', NULL, 'password', NULL, NULL, NULL, NULL, NULL, NULL); 208 | INSERT INTO `user` VALUES (12, 'abc', NULL, 'password', NULL, NULL, NULL, NULL, NULL, NULL); 209 | INSERT INTO `user` VALUES (13, 'a', NULL, 'password', NULL, NULL, NULL, NULL, NULL, NULL); 210 | 211 | SET FOREIGN_KEY_CHECKS = 1; 212 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/DragonshoppingApplication.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping; 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.cache.annotation.EnableCaching; 7 | import org.springframework.transaction.annotation.EnableTransactionManagement; 8 | 9 | @SpringBootApplication 10 | @EnableCaching 11 | @EnableTransactionManagement 12 | @MapperScan("com.hzq.dragonshopping.mapper") 13 | public class DragonshoppingApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(DragonshoppingApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/controller/CommonController.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.servlet.ModelAndView; 6 | 7 | @Controller 8 | public class CommonController { 9 | @RequestMapping("welcome") 10 | public String welcome(){ 11 | return "welcome"; 12 | } 13 | //登录 14 | @RequestMapping("login") 15 | public Object login() { 16 | return "login"; 17 | } 18 | 19 | //首页 20 | @RequestMapping("") 21 | public Object index() { 22 | // ModelAndView mv = new ModelAndView(); 23 | // mv.setViewName(""); 24 | return "forward:index.do"; 25 | } 26 | @RequestMapping("index") 27 | public Object indext() { 28 | // ModelAndView mv = new ModelAndView(); 29 | // mv.setViewName(""); 30 | return "forward:index.do"; 31 | } 32 | //注册 33 | @RequestMapping("regist") 34 | public Object regist() { 35 | return "regist"; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.controller; 2 | 3 | import com.hzq.dragonshopping.service.IProduceCategoryService; 4 | import com.hzq.dragonshopping.service.IProduceService; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.ui.Model; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.ResponseBody; 12 | 13 | @Controller 14 | public class IndexController { 15 | 16 | private final Logger logger = LoggerFactory.getLogger(IndexController.class); 17 | 18 | @Autowired 19 | private IProduceService produceService; 20 | @Autowired 21 | private IProduceCategoryService iProduceCategoryService; 22 | 23 | 24 | /** 25 | * 热门商品 26 | * @param model 27 | * @return 28 | */ 29 | @RequestMapping("index.do") 30 | public String viewHotCommody(Model model){ 31 | //热门商品信息 32 | Model produce = model.addAttribute("produceList", produceService.showHotCommody()); 33 | //所有商品的分类信息 34 | model.addAttribute("produceCategory",iProduceCategoryService.selectProduceCategoryExample()); 35 | logger.info("数据"); 36 | return "index"; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/controller/ProduceCategoryController.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.controller; 2 | 3 | import com.hzq.dragonshopping.service.IProduceCategoryService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.ui.Model; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | import org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor; 11 | 12 | @Controller 13 | @RequestMapping("/producecategory/") 14 | public class ProduceCategoryController { 15 | @Autowired 16 | private IProduceCategoryService produceCategoryService; 17 | 18 | /** 19 | * 显示分类商品信息 20 | * @return 21 | */ 22 | // @RequestMapping("produce.do") 23 | // public Object showProduceCategory(Model model){ 24 | // model.addAttribute("produceCategory",produceCategoryService.selectProduceCategoryExample()); 25 | // return "index"; 26 | // } 27 | 28 | /** 29 | * 根据商品类别id查询所有商品详情 30 | * @param id 31 | * @param model 32 | * @return 33 | */ 34 | @RequestMapping("selectCategoryAll/{id}") 35 | public Object showAllProduceCategoryAll(@PathVariable("id") int id,Model model){ 36 | /*AbstractMessageConverterMethodProcessor*/ 37 | System.out.println("id================"+id); 38 | model.addAttribute("produce",produceCategoryService.selectProduceCategoryExampleByCategoryId(id)); 39 | return "product_category"; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/controller/ProduceCommentController.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.controller; 2 | 3 | import com.hzq.dragonshopping.entity.CommentEntity; 4 | import com.hzq.dragonshopping.service.ICommentService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.ui.Model; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | import org.springframework.web.context.request.RequestAttributes; 11 | import org.springframework.web.context.request.RequestContextHolder; 12 | import org.springframework.web.context.request.ServletRequestAttributes; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import java.util.HashMap; 16 | import java.util.Map; 17 | 18 | @Controller 19 | @RequestMapping("/comment/") 20 | public class ProduceCommentController { 21 | @Autowired 22 | private ICommentService commentService; 23 | 24 | /** 25 | * 添加评论 26 | * @param commentEntity 27 | * @param request 28 | * @return 29 | */ 30 | @ResponseBody 31 | @RequestMapping("addcomment.do") 32 | public Object addComment(CommentEntity commentEntity, HttpServletRequest request){ 33 | Map res_map=new HashMap(); 34 | System.out.println("comment=========="+commentEntity.toString()); 35 | //获取session中的用户信息 36 | if(request.getSession(true).getAttribute("user_id")!=null){ 37 | RequestAttributes ra = RequestContextHolder.getRequestAttributes(); 38 | request = ((ServletRequestAttributes)ra).getRequest(); 39 | int user_id = (Integer) request.getSession(true).getAttribute("user_id"); 40 | //给页面用户名id 41 | res_map.put("produceId",user_id); 42 | commentEntity.setComments_user_id(user_id); 43 | //数据库评论是否成功插入数据 44 | int count= commentService.addComment(commentEntity); 45 | if(count>0){ 46 | res_map.put("code", 1); 47 | res_map.put("msg", "添加评论成功,等待审核!"); 48 | System.out.println("添加评论成功,等待审核!"); 49 | }else{ 50 | res_map.put("code", 0); 51 | res_map.put("msg", "评论失败!"); 52 | System.out.println("评论失败!"); 53 | } 54 | return res_map; 55 | }else { 56 | res_map.put("code", 2); 57 | res_map.put("msg","添加评论失败,请登录!"); 58 | return res_map; 59 | } 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/controller/ProduceController.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.controller; 2 | 3 | import com.hzq.dragonshopping.entity.ProduceEntity; 4 | import com.hzq.dragonshopping.entity.ShoppingCartEntity; 5 | import com.hzq.dragonshopping.service.IProduceCategoryService; 6 | import com.hzq.dragonshopping.service.IProduceService; 7 | import com.hzq.dragonshopping.service.IShoppingCartService; 8 | import com.sun.corba.se.spi.presentation.rmi.StubAdapter; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.web.bind.annotation.PathVariable; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RequestMethod; 15 | import org.springframework.web.bind.annotation.ResponseBody; 16 | import org.springframework.web.context.request.RequestAttributes; 17 | import org.springframework.web.context.request.RequestContextHolder; 18 | import org.springframework.web.context.request.ServletRequestAttributes; 19 | import org.springframework.web.servlet.ModelAndView; 20 | 21 | import javax.servlet.http.HttpServletRequest; 22 | import javax.servlet.http.HttpSession; 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | @Controller 27 | @RequestMapping(value = "/produce/",method = {RequestMethod.POST,RequestMethod.GET}) 28 | public class ProduceController { 29 | 30 | @Autowired 31 | private IProduceService produceService; 32 | @Autowired 33 | private IProduceCategoryService produceCategoryService; 34 | @Autowired 35 | private IShoppingCartService shoppingCartService; 36 | 37 | 38 | /** 39 | * 商品详情和相关评论 40 | * @return 41 | */ 42 | @RequestMapping(value = "producdetailsandcomments/{produce_id}") 43 | public Object showProducDetailsAndComments(@PathVariable("produce_id") int productId, Model model,HttpServletRequest request){ 44 | System.out.println("produceId============="+productId); 45 | //商品详细信息 46 | // request.setAttribute("produceDetails",produceCategoryService.selectProduceCategoryExampleByProduceId(productId)); 47 | Model produceDetails= model.addAttribute("produceDetails",produceCategoryService.selectProduceCategoryExampleByProduceId(productId)); 48 | //商品相关评论 49 | model.addAttribute("comments",produceService.selectProducDetailsAndComments(productId)); 50 | //取出session给前端页面 51 | if(request.getSession(true).getAttribute("user_id")!=null){ 52 | 53 | RequestAttributes ra = RequestContextHolder.getRequestAttributes(); 54 | request = ((ServletRequestAttributes)ra).getRequest(); 55 | int session_user_id = (Integer) request.getSession(true).getAttribute("user_id"); 56 | model.addAttribute("session_user_id",session_user_id); 57 | } 58 | return "product"; 59 | } 60 | 61 | @ResponseBody 62 | @RequestMapping("search") 63 | public Object showSearchProduce(ProduceEntity produceEntity){ 64 | produceEntity.setProduce_name("文学的"); 65 | return produceService.searchProduce(produceEntity); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/controller/ShoppingCartController.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.controller; 2 | 3 | import com.hzq.dragonshopping.entity.ProduceEntity; 4 | import com.hzq.dragonshopping.entity.ShoppingCartEntity; 5 | import com.hzq.dragonshopping.service.IShoppingCartService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.ui.Model; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.ResponseBody; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpSession; 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | @Controller 18 | @RequestMapping("/shoppingcart/") 19 | public class ShoppingCartController { 20 | 21 | @Autowired 22 | private IShoppingCartService shoppingCartService; 23 | 24 | /** 25 | * 展示用户购物车详情页面 26 | * @param request 27 | * @return 28 | */ 29 | @RequestMapping("mycart.do") 30 | public Object showMyCart(HttpServletRequest request, Model model){ 31 | 32 | Map map = new HashMap<>(); 33 | if(request.getSession(true).getAttribute("user_id")!=null){ 34 | Integer uid = (Integer) request.getSession(true).getAttribute("user_id"); 35 | if(shoppingCartService.getAllShopingCart(uid).size()>0){ 36 | map.put("code","1"); 37 | map.put("mycartlist",shoppingCartService.getAllShopingCart(uid)); 38 | }else { 39 | map.put("code","0"); 40 | } 41 | }else { 42 | map.put("code","0"); 43 | map.put("mycartlist","用户未登录!"); 44 | } 45 | System.out.println("显示购物车code====="+map.get("code")); 46 | model.addAttribute("cartlist",map); 47 | return "mycart"; 48 | } 49 | 50 | /** 51 | * 检查库存是否够用 52 | * @param produceEntity 53 | * @return 54 | */ 55 | // @RequestMapping("producecount.do") 56 | // @ResponseBody 57 | // public Object checkProduceCount(ProduceEntity produceEntity,HttpServletRequest request, HttpSession httpSession) { 58 | // Map map = new HashMap<>(); 59 | // if (request.getSession(true).getAttribute("user_id") != null) { 60 | // if (shoppingCartService.checkProduceCount(produceEntity).size() > 0) { 61 | // map.put("code", 1); 62 | // } else { 63 | // map.put("code", 0); 64 | // } 65 | // }else { 66 | // //未登录 67 | // map.put("code",3); 68 | // } 69 | // System.out.println("producecount.do======="+map.get("code")); 70 | // return map; 71 | // } 72 | 73 | /** 74 | * 增加商品到购物车 75 | * @return 76 | */ 77 | @ResponseBody 78 | @RequestMapping("addshoppingcart.do") 79 | public Object addShoppingCart(ShoppingCartEntity shoppingCartEntity,HttpServletRequest request, HttpSession httpSession){ 80 | //获取用户id 81 | Integer uid = (Integer) request.getSession(true).getAttribute("user_id"); 82 | System.out.println("uid=========="+uid); 83 | shoppingCartEntity.setUser_id(uid); 84 | System.out.println(shoppingCartEntity.toString()); 85 | // boolean flag = shoppingCartService.addShoppingCart(shoppingCartEntity); 86 | Map map = new HashMap<>(); 87 | ProduceEntity produceEntity = new ProduceEntity(); 88 | produceEntity.setProduce_id(shoppingCartEntity.getProduce_id()); 89 | produceEntity.setProduce_count(shoppingCartEntity.getCart_produce_count()); 90 | if (request.getSession(true).getAttribute("user_id") != null) { 91 | map = shoppingCartService.addShoppingCart(shoppingCartEntity); 92 | }else { 93 | //未登录 94 | map.put("codemsg","3"); 95 | System.out.println("未登录,code"+3); 96 | } 97 | return map; 98 | } 99 | 100 | } 101 | 102 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.controller; 2 | 3 | import com.hzq.dragonshopping.entity.ProduceEntity; 4 | import com.hzq.dragonshopping.entity.UserEntity; 5 | import com.hzq.dragonshopping.service.IUserService; 6 | import com.sun.org.apache.bcel.internal.generic.NEW; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestMethod; 14 | import org.springframework.web.bind.annotation.ResponseBody; 15 | import org.springframework.web.bind.annotation.RestController; 16 | import org.springframework.web.context.request.RequestAttributes; 17 | import org.springframework.web.context.request.RequestContextHolder; 18 | import org.springframework.web.context.request.ServletRequestAttributes; 19 | import org.springframework.web.servlet.ModelAndView; 20 | 21 | import javax.servlet.http.HttpServletRequest; 22 | import javax.servlet.http.HttpSession; 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | @Controller 27 | @RequestMapping("/user/") 28 | public class UserController { 29 | 30 | private final Logger logger = LoggerFactory.getLogger(IndexController.class); 31 | @Autowired 32 | private IUserService userService; 33 | 34 | 35 | /** 36 | * 登陆 37 | * @param userEntity 38 | * @return 39 | */ 40 | @ResponseBody 41 | @RequestMapping("login.do") 42 | public Object userLogin(UserEntity userEntity, HttpServletRequest request){ 43 | UserEntity t_user=userService.login(userEntity); 44 | Map res_map=new HashMap(); 45 | RequestAttributes ra = RequestContextHolder.getRequestAttributes(); 46 | request = ((ServletRequestAttributes)ra).getRequest(); 47 | if(t_user!=null){ 48 | res_map.put("code", 1); 49 | res_map.put("msg", "登录成功"); 50 | res_map.put("data", t_user); 51 | System.out.println("登陆成功"); 52 | //session存储用户名、密码、用户id 53 | if(request.getSession(true).getAttribute("username")==null){ 54 | request.getSession(true).setAttribute("username",t_user.getUser_name()); 55 | request.getSession(true).setAttribute("password",t_user.getUser_password()); 56 | request.getSession(true).setAttribute("user_id",t_user.getUser_id()); 57 | System.out.println(request.getSession(true).getAttribute("username").toString()); 58 | } 59 | }else{ 60 | res_map.put("code", 0); 61 | res_map.put("msg", "登录失败"); 62 | System.out.println("登陆失败"); 63 | } 64 | // System.out.println(request.getSession(true).getAttribute("username").toString()); 65 | return res_map; 66 | 67 | } 68 | 69 | 70 | /** 71 | * 注册 72 | * @param userEntity 73 | * @return 74 | */ 75 | @ResponseBody 76 | @RequestMapping("regist.do") 77 | public Object regist(UserEntity userEntity){ 78 | int count=userService.regist(userEntity); 79 | Map res_map=new HashMap(); 80 | if(count>0){ 81 | res_map.put("code", 1); 82 | res_map.put("msg", "注册成功!"); 83 | System.out.println("注册成功!"); 84 | }else{ 85 | res_map.put("code", 0); 86 | res_map.put("msg", "注册失败!"); 87 | System.out.println("注册失败!"); 88 | } 89 | return res_map; 90 | } 91 | 92 | /** 93 | * 个人中心 94 | * @return 95 | */ 96 | @RequestMapping("center.do") 97 | public Object userCenter(HttpServletRequest request, HttpSession httpSession,Model model){ 98 | // //获得session 99 | // if(request.getSession(true).getAttribute("user_id")!=null){ 100 | // RequestAttributes ra = RequestContextHolder.getRequestAttributes(); 101 | // request = ((ServletRequestAttributes)ra).getRequest(); 102 | // int session_user_id = (Integer) request.getSession(true).getAttribute("user_id"); 103 | // model.addAttribute("session_user_id",session_user_id); 104 | // //清除session 105 | // httpSession.invalidate(); 106 | // model.addAttribute("msgcode","1"); 107 | // }else if (request.getSession(true).getAttribute("user_id")==null){ 108 | // model.addAttribute("msgcode","0"); 109 | // } 110 | return "account/index"; 111 | } 112 | 113 | 114 | /** 115 | * 登出 116 | * @param request 117 | * @param httpSession 118 | * @return 119 | */ 120 | @ResponseBody 121 | @RequestMapping("loginout.do") 122 | public Object loginOut(HttpServletRequest request, HttpSession httpSession){ 123 | //获得session 124 | Map map = new HashMap<>(); 125 | if(request.getSession(true).getAttribute("user_id")!=null){ 126 | RequestAttributes ra = RequestContextHolder.getRequestAttributes(); 127 | request = ((ServletRequestAttributes)ra).getRequest(); 128 | Integer session_user_id = (Integer) request.getSession(true).getAttribute("user_id"); 129 | map.put("session_user_id",session_user_id.toString()); 130 | //清除session 131 | httpSession.invalidate(); 132 | map.put("msgcode","1"); 133 | }else if (request.getSession(true).getAttribute("user_id")==null){ 134 | System.out.println("000000000"); 135 | map.put("msgcode","0"); 136 | } 137 | System.out.println("退出登录!"); 138 | return map; 139 | } 140 | 141 | /** 142 | * 购买商品 143 | * @param request 144 | * @param userEntity 145 | * @param produceEntity 146 | * @return 147 | */ 148 | @ResponseBody 149 | @RequestMapping("pay.do") 150 | public Object buyProduce(HttpServletRequest request, UserEntity userEntity, ProduceEntity produceEntity){ 151 | 152 | Map map = new HashMap<>(); 153 | if(request.getSession(true).getAttribute("user_id") != null){ 154 | //获取存在session中的id 155 | Integer uid = (Integer) request.getSession(true).getAttribute("user_id"); 156 | userEntity.setUser_id(uid); 157 | logger.info("============================="+userEntity.toString()+"\n"+produceEntity.toString()); 158 | map = userService.payProduce(produceEntity,userEntity); 159 | if (map.get("msgcode") == "1"){ 160 | logger.info("code+msg"+"1支付成功"); 161 | }else { 162 | logger.info("code+msg"+"0支付失败"); 163 | } 164 | }else { 165 | map.put("msgcode","0000"); 166 | logger.info("code+msg"+"0000未登录!"); 167 | } 168 | return map; 169 | } 170 | 171 | 172 | } 173 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/entity/CommentEntity.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.entity; 2 | 3 | /** 4 | * 评论表实体 5 | */ 6 | public class CommentEntity { 7 | 8 | private Integer comments_id; 9 | //评论的内容 10 | private String comments_centent; 11 | //评论的用户id 12 | private Integer comments_user_id; 13 | //评论的商品id 14 | private Integer comments_produce_id; 15 | //评论的星级 16 | private Integer comments_stars; 17 | //评论的时间 18 | private String comments_date; 19 | 20 | public Integer getComments_id() { 21 | return comments_id; 22 | } 23 | 24 | public void setComments_id(Integer comments_id) { 25 | this.comments_id = comments_id; 26 | } 27 | 28 | public String getComments_centent() { 29 | return comments_centent; 30 | } 31 | 32 | public void setComments_centent(String comments_centent) { 33 | this.comments_centent = comments_centent; 34 | } 35 | 36 | public Integer getComments_user_id() { 37 | return comments_user_id; 38 | } 39 | 40 | public void setComments_user_id(Integer comments_user_id) { 41 | this.comments_user_id = comments_user_id; 42 | } 43 | 44 | public Integer getComments_produce_id() { 45 | return comments_produce_id; 46 | } 47 | 48 | public void setComments_produce_id(Integer comments_produce_id) { 49 | this.comments_produce_id = comments_produce_id; 50 | } 51 | 52 | public Integer getComments_stars() { 53 | return comments_stars; 54 | } 55 | 56 | public void setComments_stars(Integer comments_stars) { 57 | this.comments_stars = comments_stars; 58 | } 59 | 60 | public String getComments_date() { 61 | return comments_date; 62 | } 63 | 64 | public void setComments_date(String comments_date) { 65 | this.comments_date = comments_date; 66 | } 67 | 68 | public CommentEntity(Integer comments_id, String comments_centent, Integer comments_user_id, Integer comments_produce_id, Integer comments_stars, String comments_date) { 69 | this.comments_id = comments_id; 70 | this.comments_centent = comments_centent; 71 | this.comments_user_id = comments_user_id; 72 | this.comments_produce_id = comments_produce_id; 73 | this.comments_stars = comments_stars; 74 | this.comments_date = comments_date; 75 | } 76 | 77 | public CommentEntity() { 78 | super(); 79 | } 80 | 81 | @Override 82 | public String toString() { 83 | return "CommentEntity{" + 84 | "comments_id=" + comments_id + 85 | ", comments_centent='" + comments_centent + '\'' + 86 | ", comments_user_id=" + comments_user_id + 87 | ", comments_produce_id=" + comments_produce_id + 88 | ", comments_stars=" + comments_stars + 89 | ", comments_date='" + comments_date + '\'' + 90 | '}'; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/entity/CommentsUserEntity.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.entity; 2 | 3 | /** 4 | * 评论所属用户实体 5 | */ 6 | public class CommentsUserEntity { 7 | private Integer comments_id; 8 | //评论的内容 9 | private String comments_centent; 10 | //评论的用户id 11 | private Integer comments_user_id; 12 | //评论的商品id 13 | private Integer comments_produce_id; 14 | //评论的星级 15 | private Integer comments_stars; 16 | //评论的时间 17 | private String comments_date; 18 | //评论所属的用户 19 | private UserEntity user; 20 | 21 | public Integer getComments_id() { 22 | return comments_id; 23 | } 24 | 25 | public void setComments_id(Integer comments_id) { 26 | this.comments_id = comments_id; 27 | } 28 | 29 | public String getComments_centent() { 30 | return comments_centent; 31 | } 32 | 33 | public void setComments_centent(String comments_centent) { 34 | this.comments_centent = comments_centent; 35 | } 36 | 37 | public Integer getComments_user_id() { 38 | return comments_user_id; 39 | } 40 | 41 | public void setComments_user_id(Integer comments_user_id) { 42 | this.comments_user_id = comments_user_id; 43 | } 44 | 45 | public Integer getComments_produce_id() { 46 | return comments_produce_id; 47 | } 48 | 49 | public void setComments_produce_id(Integer comments_produce_id) { 50 | this.comments_produce_id = comments_produce_id; 51 | } 52 | 53 | public Integer getComments_stars() { 54 | return comments_stars; 55 | } 56 | 57 | public void setComments_stars(Integer comments_stars) { 58 | this.comments_stars = comments_stars; 59 | } 60 | 61 | public String getComments_date() { 62 | return comments_date; 63 | } 64 | 65 | public void setComments_date(String comments_date) { 66 | this.comments_date = comments_date; 67 | } 68 | 69 | public UserEntity getUser() { 70 | return user; 71 | } 72 | 73 | public void setUser(UserEntity user) { 74 | this.user = user; 75 | } 76 | 77 | public CommentsUserEntity(Integer comments_id, String comments_centent, Integer comments_user_id, Integer comments_produce_id, Integer comments_stars, String comments_date, UserEntity user) { 78 | this.comments_id = comments_id; 79 | this.comments_centent = comments_centent; 80 | this.comments_user_id = comments_user_id; 81 | this.comments_produce_id = comments_produce_id; 82 | this.comments_stars = comments_stars; 83 | this.comments_date = comments_date; 84 | this.user = user; 85 | } 86 | public CommentsUserEntity() { 87 | super(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/entity/ProducCommentsUserEntity.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.entity; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 商品详情评论详情 7 | */ 8 | public class ProducCommentsUserEntity { 9 | private Integer comments_id; 10 | //评论的内容 11 | private String comments_centent; 12 | //评论的用户id 13 | private Integer comments_user_id; 14 | //评论的商品id 15 | private Integer comments_produce_id; 16 | //评论的星级 17 | private Integer comments_stars; 18 | private String comments_date; 19 | private UserEntity userEntity; 20 | private ProduceEntity produceEntity; 21 | 22 | public Integer getComments_id() { 23 | return comments_id; 24 | } 25 | 26 | public void setComments_id(Integer comments_id) { 27 | this.comments_id = comments_id; 28 | } 29 | 30 | public String getComments_centent() { 31 | return comments_centent; 32 | } 33 | 34 | public void setComments_centent(String comments_centent) { 35 | this.comments_centent = comments_centent; 36 | } 37 | 38 | public Integer getComments_user_id() { 39 | return comments_user_id; 40 | } 41 | 42 | public void setComments_user_id(Integer comments_user_id) { 43 | this.comments_user_id = comments_user_id; 44 | } 45 | 46 | public Integer getComments_produce_id() { 47 | return comments_produce_id; 48 | } 49 | 50 | public void setComments_produce_id(Integer comments_produce_id) { 51 | this.comments_produce_id = comments_produce_id; 52 | } 53 | 54 | public Integer getComments_stars() { 55 | return comments_stars; 56 | } 57 | 58 | public void setComments_stars(Integer comments_stars) { 59 | this.comments_stars = comments_stars; 60 | } 61 | 62 | public String getComments_date() { 63 | return comments_date; 64 | } 65 | 66 | public void setComments_date(String comments_date) { 67 | this.comments_date = comments_date; 68 | } 69 | 70 | public UserEntity getUserEntity() { 71 | return userEntity; 72 | } 73 | 74 | public void setUserEntity(UserEntity userEntity) { 75 | this.userEntity = userEntity; 76 | } 77 | 78 | public ProduceEntity getProduceEntity() { 79 | return produceEntity; 80 | } 81 | 82 | public void setProduceEntity(ProduceEntity produceEntity) { 83 | this.produceEntity = produceEntity; 84 | } 85 | 86 | public ProducCommentsUserEntity(Integer comments_id, String comments_centent, Integer comments_user_id, Integer comments_produce_id, Integer comments_stars, String comments_date, UserEntity userEntity, ProduceEntity produceEntity) { 87 | this.comments_id = comments_id; 88 | this.comments_centent = comments_centent; 89 | this.comments_user_id = comments_user_id; 90 | this.comments_produce_id = comments_produce_id; 91 | this.comments_stars = comments_stars; 92 | this.comments_date = comments_date; 93 | this.userEntity = userEntity; 94 | this.produceEntity = produceEntity; 95 | } 96 | 97 | public ProducCommentsUserEntity() { 98 | super(); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/entity/ProduceCategoryEntity.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.entity; 2 | 3 | /** 4 | * 商品分类实体 5 | */ 6 | public class ProduceCategoryEntity { 7 | 8 | private Integer id; 9 | //商品类别名称 10 | private String name; 11 | //商品类别描述 12 | private String describe; 13 | //商品种类编号 14 | private String sortnum; 15 | 16 | public Integer getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Integer id) { 21 | this.id = id; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public String getDescribe() { 33 | return describe; 34 | } 35 | 36 | public void setDescribe(String describe) { 37 | this.describe = describe; 38 | } 39 | 40 | public String getSortnum() { 41 | return sortnum; 42 | } 43 | 44 | public void setSortnum(String sortnum) { 45 | this.sortnum = sortnum; 46 | } 47 | 48 | public ProduceCategoryEntity(Integer id, String name, String describe, String sortnum) { 49 | this.id = id; 50 | this.name = name; 51 | this.describe = describe; 52 | this.sortnum = sortnum; 53 | } 54 | 55 | public ProduceCategoryEntity() { 56 | super(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/entity/ProduceCategoryExampleEntity.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.entity; 2 | 3 | import java.util.List; 4 | 5 | public class ProduceCategoryExampleEntity { 6 | 7 | private Integer id; 8 | //商品类别名称 9 | private String name; 10 | //商品类别描述 11 | private String describe; 12 | //商品种类编号 13 | private String sortnum; 14 | //分类下的商品 15 | private List produceEntities; 16 | 17 | public Integer getId() { 18 | return id; 19 | } 20 | 21 | public void setId(Integer id) { 22 | this.id = id; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getDescribe() { 34 | return describe; 35 | } 36 | 37 | public void setDescribe(String describe) { 38 | this.describe = describe; 39 | } 40 | 41 | public String getSortnum() { 42 | return sortnum; 43 | } 44 | 45 | public void setSortnum(String sortnum) { 46 | this.sortnum = sortnum; 47 | } 48 | 49 | public List getProduceEntities() { 50 | return produceEntities; 51 | } 52 | 53 | public void setProduceEntities(List produceEntities) { 54 | this.produceEntities = produceEntities; 55 | } 56 | 57 | public ProduceCategoryExampleEntity(Integer id, String name, String describe, String sortnum, List produceEntities) { 58 | this.id = id; 59 | this.name = name; 60 | this.describe = describe; 61 | this.sortnum = sortnum; 62 | this.produceEntities = produceEntities; 63 | } 64 | 65 | public ProduceCategoryExampleEntity() { 66 | super(); 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | return "ProduceCategoryExampleEntity{" + 72 | "id=" + id + 73 | ", name='" + name + '\'' + 74 | ", describe='" + describe + '\'' + 75 | ", sortnum='" + sortnum + '\'' + 76 | ", produceEntities=" + produceEntities + 77 | '}'; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/entity/ProduceEntity.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.entity; 2 | 3 | /** 4 | * 商品的实体类 5 | */ 6 | public class ProduceEntity { 7 | private Integer produce_id; 8 | private String produce_name; 9 | // 商品说明 10 | private String produce_explain; 11 | //商品种类编号 12 | private String produce_produce_sortnum; 13 | //商品库存数量 14 | private Integer produce_count; 15 | //商品实际销售价格 16 | private Double produce_price; 17 | //商品原销售价格 18 | private Double produce_shop_price; 19 | //商品图片路径 20 | private String produce_imgurl; 21 | //商品作者 22 | private String produce_author; 23 | //已销商品数量 24 | private Integer produce_sale_count; 25 | //商品热度 26 | private Integer produce_hot; 27 | //发布商品的用户id 28 | private Integer produce_creat_user_id; 29 | //发布时间 30 | private String create_time; 31 | //更新时间 32 | private String update_time; 33 | 34 | public Integer getProduce_id() { 35 | return produce_id; 36 | } 37 | 38 | public void setProduce_id(Integer produce_id) { 39 | this.produce_id = produce_id; 40 | } 41 | 42 | public String getProduce_name() { 43 | return produce_name; 44 | } 45 | 46 | public void setProduce_name(String produce_name) { 47 | this.produce_name = produce_name; 48 | } 49 | 50 | public String getProduce_explain() { 51 | return produce_explain; 52 | } 53 | 54 | public void setProduce_explain(String produce_explain) { 55 | this.produce_explain = produce_explain; 56 | } 57 | 58 | public String getProduce_produce_sortnum() { 59 | return produce_produce_sortnum; 60 | } 61 | 62 | public void setProduce_produce_sortnum(String produce_produce_sortnum) { 63 | this.produce_produce_sortnum = produce_produce_sortnum; 64 | } 65 | 66 | public Integer getProduce_count() { 67 | return produce_count; 68 | } 69 | 70 | public void setProduce_count(Integer produce_count) { 71 | this.produce_count = produce_count; 72 | } 73 | 74 | public Double getProduce_price() { 75 | return produce_price; 76 | } 77 | 78 | public void setProduce_price(Double produce_price) { 79 | this.produce_price = produce_price; 80 | } 81 | 82 | public Double getProduce_shop_price() { 83 | return produce_shop_price; 84 | } 85 | 86 | public void setProduce_shop_price(Double produce_shop_price) { 87 | this.produce_shop_price = produce_shop_price; 88 | } 89 | 90 | public String getProduce_imgurl() { 91 | return produce_imgurl; 92 | } 93 | 94 | public void setProduce_imgurl(String produce_imgurl) { 95 | this.produce_imgurl = produce_imgurl; 96 | } 97 | 98 | public String getProduce_author() { 99 | return produce_author; 100 | } 101 | 102 | public void setProduce_author(String produce_author) { 103 | this.produce_author = produce_author; 104 | } 105 | 106 | public Integer getProduce_sale_count() { 107 | return produce_sale_count; 108 | } 109 | 110 | public void setProduce_sale_count(Integer produce_sale_count) { 111 | this.produce_sale_count = produce_sale_count; 112 | } 113 | 114 | public Integer getProduce_hot() { 115 | return produce_hot; 116 | } 117 | 118 | public void setProduce_hot(Integer produce_hot) { 119 | this.produce_hot = produce_hot; 120 | } 121 | 122 | public Integer getProduce_creat_user_id() { 123 | return produce_creat_user_id; 124 | } 125 | 126 | public void setProduce_creat_user_id(Integer produce_creat_user_id) { 127 | this.produce_creat_user_id = produce_creat_user_id; 128 | } 129 | 130 | public String getCreate_time() { 131 | return create_time; 132 | } 133 | 134 | public void setCreate_time(String create_time) { 135 | this.create_time = create_time; 136 | } 137 | 138 | public String getUpdate_time() { 139 | return update_time; 140 | } 141 | 142 | public void setUpdate_time(String update_time) { 143 | this.update_time = update_time; 144 | } 145 | 146 | public ProduceEntity() { 147 | super(); 148 | } 149 | 150 | @Override 151 | public String toString() { 152 | return "ProduceEntity{" + 153 | "produce_id=" + produce_id + 154 | ", produce_name='" + produce_name + '\'' + 155 | ", produce_explain='" + produce_explain + '\'' + 156 | ", produce_produce_sortnum='" + produce_produce_sortnum + '\'' + 157 | ", produce_count=" + produce_count + 158 | ", produce_price=" + produce_price + 159 | ", produce_shop_price=" + produce_shop_price + 160 | ", produce_imgurl='" + produce_imgurl + '\'' + 161 | ", produce_author='" + produce_author + '\'' + 162 | ", produce_sale_count=" + produce_sale_count + 163 | ", produce_hot=" + produce_hot + 164 | ", produce_creat_user_id=" + produce_creat_user_id + 165 | ", create_time='" + create_time + '\'' + 166 | ", update_time='" + update_time + '\'' + 167 | '}'; 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/entity/ProduceShoppingCartEntity.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.entity; 2 | 3 | 4 | public class ProduceShoppingCartEntity { 5 | private Integer id; 6 | //用户id 7 | private Integer user_id; 8 | //商品id 9 | private Integer produce_id; 10 | //购物车中此商品的数量 11 | private Integer cart_produce_count; 12 | //创建时间 13 | private String create_time; 14 | //更新时间 15 | private String update_time; 16 | 17 | //购物车中多个商品实体 18 | private ProduceEntity produceEntity; 19 | 20 | public ProduceShoppingCartEntity(Integer id, Integer user_id, Integer produce_id, Integer cart_produce_count, String create_time, String update_time, ProduceEntity produceEntity) { 21 | this.id = id; 22 | this.user_id = user_id; 23 | this.produce_id = produce_id; 24 | this.cart_produce_count = cart_produce_count; 25 | this.create_time = create_time; 26 | this.update_time = update_time; 27 | this.produceEntity = produceEntity; 28 | } 29 | 30 | public ProduceShoppingCartEntity() { 31 | super(); 32 | } 33 | 34 | public Integer getId() { 35 | return id; 36 | } 37 | 38 | public void setId(Integer id) { 39 | this.id = id; 40 | } 41 | 42 | public Integer getUser_id() { 43 | return user_id; 44 | } 45 | 46 | public void setUser_id(Integer user_id) { 47 | this.user_id = user_id; 48 | } 49 | 50 | public Integer getProduce_id() { 51 | return produce_id; 52 | } 53 | 54 | public void setProduce_id(Integer produce_id) { 55 | this.produce_id = produce_id; 56 | } 57 | 58 | public Integer getCart_produce_count() { 59 | return cart_produce_count; 60 | } 61 | 62 | public void setCart_produce_count(Integer cart_produce_count) { 63 | this.cart_produce_count = cart_produce_count; 64 | } 65 | 66 | public String getCreate_time() { 67 | return create_time; 68 | } 69 | 70 | public void setCreate_time(String create_time) { 71 | this.create_time = create_time; 72 | } 73 | 74 | public String getUpdate_time() { 75 | return update_time; 76 | } 77 | 78 | public void setUpdate_time(String update_time) { 79 | this.update_time = update_time; 80 | } 81 | 82 | public ProduceEntity getProduceEntity() { 83 | return produceEntity; 84 | } 85 | 86 | public void setProduceEntity(ProduceEntity produceEntity) { 87 | this.produceEntity = produceEntity; 88 | } 89 | 90 | @Override 91 | public String toString() { 92 | return "ProduceShoppingCartEntity{" + 93 | "id=" + id + 94 | ", user_id=" + user_id + 95 | ", produce_id=" + produce_id + 96 | ", cart_produce_count=" + cart_produce_count + 97 | ", create_time='" + create_time + '\'' + 98 | ", update_time='" + update_time + '\'' + 99 | ", produceEntity=" + produceEntity + 100 | '}'; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/entity/ShoppingCartEntity.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.entity; 2 | 3 | /** 4 | * 购物车实体 5 | */ 6 | public class ShoppingCartEntity { 7 | private Integer id; 8 | //用户id 9 | private Integer user_id; 10 | //商品id 11 | private Integer produce_id; 12 | //购物车中此商品的数量 13 | private Integer cart_produce_count; 14 | //创建时间 15 | private String create_time; 16 | //更新时间 17 | private String update_time; 18 | 19 | public ShoppingCartEntity() { 20 | super(); 21 | } 22 | 23 | public ShoppingCartEntity(Integer id, Integer user_id, Integer produce_id, Integer cart_produce_count, String create_time, String update_time) { 24 | this.id = id; 25 | this.user_id = user_id; 26 | this.produce_id = produce_id; 27 | this.cart_produce_count = cart_produce_count; 28 | this.create_time = create_time; 29 | this.update_time = update_time; 30 | } 31 | 32 | public Integer getId() { 33 | return id; 34 | } 35 | 36 | public void setId(Integer id) { 37 | this.id = id; 38 | } 39 | 40 | public Integer getUser_id() { 41 | return user_id; 42 | } 43 | 44 | public void setUser_id(Integer user_id) { 45 | this.user_id = user_id; 46 | } 47 | 48 | public Integer getProduce_id() { 49 | return produce_id; 50 | } 51 | 52 | public void setProduce_id(Integer produce_id) { 53 | this.produce_id = produce_id; 54 | } 55 | 56 | public Integer getCart_produce_count() { 57 | return cart_produce_count; 58 | } 59 | 60 | public void setCart_produce_count(Integer cart_produce_count) { 61 | this.cart_produce_count = cart_produce_count; 62 | } 63 | 64 | public String getCreate_time() { 65 | return create_time; 66 | } 67 | 68 | public void setCreate_time(String create_time) { 69 | this.create_time = create_time; 70 | } 71 | 72 | public String getUpdate_time() { 73 | return update_time; 74 | } 75 | 76 | public void setUpdate_time(String update_time) { 77 | this.update_time = update_time; 78 | } 79 | 80 | @Override 81 | public String toString() { 82 | return "ShoppingCartEntity{" + 83 | "id=" + id + 84 | ", user_id=" + user_id + 85 | ", produce_id=" + produce_id + 86 | ", cart_produce_count=" + cart_produce_count + 87 | ", create_time='" + create_time + '\'' + 88 | ", update_time='" + update_time + '\'' + 89 | '}'; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/entity/UserEntity.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.entity; 2 | 3 | import org.springframework.stereotype.Repository; 4 | 5 | /** 6 | * 用户实体类 7 | */ 8 | public class UserEntity { 9 | 10 | private Integer user_id; 11 | private String user_name; 12 | private String user_sex; 13 | private String user_password; 14 | private String user_address; 15 | private String user_phone; 16 | //用户头像图片地址 17 | private String user_headimgurl; 18 | //状态(1禁用,0未禁用) 19 | private Integer user_status; 20 | //身份标识(1买家,2卖家,3超级管理员) 21 | private Integer user_type; 22 | //用户账户余额 23 | private Double user_money; 24 | 25 | public Integer getUser_id() { 26 | return user_id; 27 | } 28 | 29 | public void setUser_id(Integer user_id) { 30 | this.user_id = user_id; 31 | } 32 | 33 | public String getUser_name() { 34 | return user_name; 35 | } 36 | 37 | public void setUser_name(String user_name) { 38 | this.user_name = user_name; 39 | } 40 | 41 | public String getUser_sex() { 42 | return user_sex; 43 | } 44 | 45 | public void setUser_sex(String user_sex) { 46 | this.user_sex = user_sex; 47 | } 48 | 49 | public String getUser_password() { 50 | return user_password; 51 | } 52 | 53 | public void setUser_password(String user_password) { 54 | this.user_password = user_password; 55 | } 56 | 57 | public String getUser_address() { 58 | return user_address; 59 | } 60 | 61 | public void setUser_address(String user_address) { 62 | this.user_address = user_address; 63 | } 64 | 65 | public String getUser_phone() { 66 | return user_phone; 67 | } 68 | 69 | public void setUser_phone(String user_phone) { 70 | this.user_phone = user_phone; 71 | } 72 | 73 | public String getUser_headimgurl() { 74 | return user_headimgurl; 75 | } 76 | 77 | public void setUser_headimgurl(String user_headimgurl) { 78 | this.user_headimgurl = user_headimgurl; 79 | } 80 | 81 | public Integer getUser_status() { 82 | return user_status; 83 | } 84 | 85 | public void setUser_status(Integer user_status) { 86 | this.user_status = user_status; 87 | } 88 | 89 | public Integer getUser_type() { 90 | return user_type; 91 | } 92 | 93 | public void setUser_type(Integer user_type) { 94 | this.user_type = user_type; 95 | } 96 | 97 | public Double getUser_money() { 98 | return user_money; 99 | } 100 | 101 | public void setUser_money(Double user_money) { 102 | this.user_money = user_money; 103 | } 104 | 105 | public UserEntity(Integer user_id, String user_name, String user_sex, String user_password, String user_address, String user_phone, String user_headimgurl, Integer user_status, Integer user_type, Double user_money) { 106 | this.user_id = user_id; 107 | this.user_name = user_name; 108 | this.user_sex = user_sex; 109 | this.user_password = user_password; 110 | this.user_address = user_address; 111 | this.user_phone = user_phone; 112 | this.user_headimgurl = user_headimgurl; 113 | this.user_status = user_status; 114 | this.user_type = user_type; 115 | this.user_money = user_money; 116 | } 117 | 118 | public UserEntity() { 119 | super(); 120 | } 121 | 122 | @Override 123 | public String toString() { 124 | return "UserEntity{" + 125 | "user_id=" + user_id + 126 | ", user_name='" + user_name + '\'' + 127 | ", user_sex='" + user_sex + '\'' + 128 | ", user_password='" + user_password + '\'' + 129 | ", user_address='" + user_address + '\'' + 130 | ", user_phone='" + user_phone + '\'' + 131 | ", user_headimgurl='" + user_headimgurl + '\'' + 132 | ", user_status=" + user_status + 133 | ", user_type=" + user_type + 134 | ", user_money=" + user_money + 135 | '}'; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/mapper/ProduceCategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.mapper; 2 | 3 | import com.hzq.dragonshopping.entity.ProduceCategoryExampleEntity; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | import java.util.List; 7 | 8 | @Mapper 9 | public interface ProduceCategoryMapper { 10 | /** 11 | * 查询分类商品详细信息 12 | * @return 13 | */ 14 | public List selectProduceCategoryExample(); 15 | 16 | /** 17 | * 根据商品id查询商品详细信息 18 | * @param produceId 19 | * @return 20 | */ 21 | public ProduceCategoryExampleEntity selectProduceCategoryExampleById(int produceId); 22 | 23 | /** 24 | * 根据商品种类id查询改类别下的所有商品详情 25 | * @param id 26 | * @return 27 | */ 28 | public List selectAllProduceByCategoryId(int id); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/mapper/ProduceCommentMapper.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.mapper; 2 | 3 | import com.hzq.dragonshopping.entity.CommentEntity; 4 | 5 | public interface ProduceCommentMapper { 6 | /** 7 | * 插入评论 8 | * @param commentEntity 9 | * @return 10 | */ 11 | public int insertComment(CommentEntity commentEntity); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/mapper/ProduceMapper.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.mapper; 2 | 3 | import com.hzq.dragonshopping.entity.ProducCommentsUserEntity; 4 | import com.hzq.dragonshopping.entity.ProduceEntity; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface ProduceMapper { 11 | /** 12 | * 查询热门商品 13 | * @return 14 | */ 15 | public List selectHotCommodyByHot(); 16 | 17 | /** 18 | * 查询商品详情和评论详情 19 | * @return 20 | */ 21 | public List selectProducCommentsUserByProducId(int producId); 22 | 23 | /** 24 | * 查询库存是否够用 25 | * @param produceEntity 26 | * @return 27 | */ 28 | ProduceEntity selectProduceCount (ProduceEntity produceEntity); 29 | 30 | /** 31 | * 根据商品id更新库存数量 32 | * @param produceEntity 33 | * @return 34 | */ 35 | int updateProduceProduce_count(ProduceEntity produceEntity); 36 | 37 | /** 38 | * 根据商品id查询商品库存 39 | * @param produceEntity 40 | * @return 41 | */ 42 | ProduceEntity selectProduceCountByPid(ProduceEntity produceEntity); 43 | 44 | /** 45 | * 根据商品名字模糊查询商品详情 46 | * @param produceEntity 47 | * @return 48 | */ 49 | List selectAllByPN(ProduceEntity produceEntity); 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/mapper/ShoppingCartMapper.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.mapper; 2 | 3 | 4 | import com.hzq.dragonshopping.entity.ProduceShoppingCartEntity; 5 | import com.hzq.dragonshopping.entity.ShoppingCartEntity; 6 | 7 | import java.util.List; 8 | 9 | public interface ShoppingCartMapper { 10 | 11 | /** 12 | * 根据用户id查询购物车中所有商品 13 | * @param uid 14 | * @return 15 | */ 16 | List selectAllShoppingCartByUid(int uid); 17 | 18 | /** 19 | * 增加购物车商品 20 | * @param shoppingCartEntity 21 | * @return 22 | */ 23 | int insertShoppingCart (ShoppingCartEntity shoppingCartEntity); 24 | 25 | /** 26 | * 根据用户id和商品id修改该商品数量 27 | * @param shoppingCartEntity 28 | * @return 29 | */ 30 | int updateShoppingCartProduceCount(ShoppingCartEntity shoppingCartEntity); 31 | 32 | /** 33 | * 查询用户购物车是否有该商品 34 | * @param shoppingCartEntity 35 | * @return 36 | */ 37 | ShoppingCartEntity selectShoppingCartProduceCountByUidAndPid(ShoppingCartEntity shoppingCartEntity); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.mapper; 2 | 3 | import com.hzq.dragonshopping.entity.UserEntity; 4 | import org.apache.catalina.User; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface UserMapper { 9 | 10 | /** 11 | * 登录查询 12 | * @param user 13 | * @return 14 | */ 15 | public UserEntity selectByUnamePwdType(UserEntity user); 16 | 17 | /** 18 | * 注册插入 19 | * @param user 20 | * @return 21 | */ 22 | public int insertUser(UserEntity user); 23 | 24 | /** 25 | * 查询余额是否够用 26 | * @param userEntity 27 | * @return 28 | */ 29 | public UserEntity selectComparedUserBalanceById(UserEntity userEntity); 30 | 31 | /** 32 | * 更新用户余额 33 | * @param userEntity 34 | * @return 35 | */ 36 | public int updateUserMoneyByUid(UserEntity userEntity); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/CommentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.entity.CommentEntity; 4 | import com.hzq.dragonshopping.mapper.ProduceCommentMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | @Service("CommentService") 10 | public class CommentServiceImpl implements ICommentService{ 11 | 12 | @Autowired 13 | private ProduceCommentMapper produceCommentMapper; 14 | 15 | 16 | @Transactional 17 | @Override 18 | public int addComment(CommentEntity commentEntity) { 19 | return produceCommentMapper.insertComment(commentEntity); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/ICommentService.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.entity.CommentEntity; 4 | import org.springframework.stereotype.Service; 5 | 6 | public interface ICommentService { 7 | /** 8 | * 添加评论 9 | * @param commentEntity 10 | * @return 11 | */ 12 | int addComment(CommentEntity commentEntity); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/IProduceCategoryService.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.entity.ProduceCategoryExampleEntity; 4 | 5 | import java.util.List; 6 | 7 | public interface IProduceCategoryService { 8 | 9 | /** 10 | * 查询分类商品详细信息 11 | * @return 12 | */ 13 | List selectProduceCategoryExample(); 14 | 15 | /** 16 | * 根据商品id查询商品分类信息 17 | * @param produceId 18 | * @return 19 | */ 20 | ProduceCategoryExampleEntity selectProduceCategoryExampleByProduceId(int produceId); 21 | 22 | /** 23 | * 根据商品类别id查询所有商品详情 24 | * @param id 25 | * @return 26 | */ 27 | List selectProduceCategoryExampleByCategoryId(int id); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/IProduceService.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.entity.ProducCommentsUserEntity; 4 | import com.hzq.dragonshopping.entity.ProduceEntity; 5 | 6 | import java.util.List; 7 | 8 | public interface IProduceService { 9 | /** 10 | * 查询热门商品 11 | * @return 12 | */ 13 | List showHotCommody(); 14 | /** 15 | * 查询商品详情和评论 16 | * @return 17 | */ 18 | List selectProducDetailsAndComments(int producId); 19 | 20 | /** 21 | * 搜索商品 22 | * @return 23 | */ 24 | List searchProduce(ProduceEntity produceEntity); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/IShoppingCartService.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.entity.ProduceEntity; 4 | import com.hzq.dragonshopping.entity.ProduceShoppingCartEntity; 5 | import com.hzq.dragonshopping.entity.ShoppingCartEntity; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | public interface IShoppingCartService { 11 | 12 | /** 13 | * 获取用户购物车所有商品信息 14 | * @param uid 15 | * @return 16 | */ 17 | List getAllShopingCart(int uid); 18 | 19 | /** 20 | * 检查商品是否还有库存 21 | * @param produceEntity 22 | * @return 23 | */ 24 | ProduceEntity checkProduceCount(ProduceEntity produceEntity); 25 | 26 | /** 27 | * 增加购物车 28 | * @param shoppingCartEntity 29 | */ 30 | Map addShoppingCart(ShoppingCartEntity shoppingCartEntity); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.entity.ProduceEntity; 4 | import com.hzq.dragonshopping.entity.UserEntity; 5 | 6 | import java.util.Map; 7 | 8 | public interface IUserService { 9 | 10 | /** 11 | * 登录 12 | * @param userEntity 13 | * @return 14 | */ 15 | UserEntity login(UserEntity userEntity); 16 | 17 | /** 18 | * 注册 19 | * @param userEntity 20 | * @return 21 | */ 22 | int regist(UserEntity userEntity); 23 | 24 | /** 25 | * 购买商品 26 | * @param produceEntity 27 | * @return 28 | */ 29 | Map payProduce(ProduceEntity produceEntity,UserEntity userEntity); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/ProduceCategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.entity.ProduceCategoryExampleEntity; 4 | import com.hzq.dragonshopping.mapper.ProduceCategoryMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.List; 9 | 10 | @Service("ProduceServiceCategory") 11 | public class ProduceCategoryServiceImpl implements IProduceCategoryService{ 12 | 13 | @Autowired 14 | private ProduceCategoryMapper produceCategoryMapper; 15 | 16 | @Override 17 | public List selectProduceCategoryExample() { 18 | List produceCategoryExampleEntitiesList = produceCategoryMapper.selectProduceCategoryExample(); 19 | //只要ProduceEntities前三条数据 20 | for(int i =0;i < produceCategoryExampleEntitiesList.size(); i++){ 21 | if(produceCategoryExampleEntitiesList.get(i).getProduceEntities().size() >2 ){ 22 | int size = produceCategoryExampleEntitiesList.get(i).getProduceEntities().size(); 23 | 24 | // //被移除的大小 25 | size = produceCategoryExampleEntitiesList.get(i).getProduceEntities().size(); 26 | for(int j = 3;j < size;size--){ 27 | produceCategoryExampleEntitiesList.get(i).getProduceEntities().remove(size-1); 28 | System.out.println("===="+produceCategoryExampleEntitiesList.get(i).getProduceEntities().size()+"======"); 29 | } 30 | System.out.println("一类商品显示的个数"+size); 31 | } 32 | } 33 | return produceCategoryExampleEntitiesList; 34 | } 35 | 36 | @Override 37 | public ProduceCategoryExampleEntity selectProduceCategoryExampleByProduceId(int produceId) { 38 | return produceCategoryMapper.selectProduceCategoryExampleById(produceId); 39 | } 40 | 41 | @Override 42 | public List selectProduceCategoryExampleByCategoryId(int id) { 43 | return produceCategoryMapper.selectAllProduceByCategoryId(id); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/ProduceServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.entity.ProducCommentsUserEntity; 4 | import com.hzq.dragonshopping.entity.ProduceEntity; 5 | import com.hzq.dragonshopping.mapper.ProduceMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | @Service("ProduceService") 12 | public class ProduceServiceImpl implements IProduceService{ 13 | 14 | @Autowired 15 | private ProduceMapper produceMapper; 16 | 17 | @Override 18 | public List showHotCommody() { 19 | return produceMapper.selectHotCommodyByHot(); 20 | } 21 | 22 | @Override 23 | public List selectProducDetailsAndComments(int producId) { 24 | return produceMapper.selectProducCommentsUserByProducId(producId); 25 | } 26 | 27 | @Override 28 | public List searchProduce(ProduceEntity produceEntity) { 29 | return produceMapper.selectAllByPN(produceEntity); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/ShoppingCartServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.entity.ProduceEntity; 4 | import com.hzq.dragonshopping.entity.ProduceShoppingCartEntity; 5 | import com.hzq.dragonshopping.entity.ShoppingCartEntity; 6 | import com.hzq.dragonshopping.mapper.ProduceMapper; 7 | import com.hzq.dragonshopping.mapper.ShoppingCartMapper; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | @Service("ShoppingCart") 17 | public class ShoppingCartServiceImpl implements IShoppingCartService{ 18 | 19 | @Autowired 20 | private ShoppingCartMapper shoppingCartMapper; 21 | @Autowired 22 | private ProduceMapper produceMapper; 23 | 24 | @Override 25 | public List getAllShopingCart(int uid) { 26 | return shoppingCartMapper.selectAllShoppingCartByUid(uid); 27 | } 28 | 29 | @Override 30 | public ProduceEntity checkProduceCount(ProduceEntity produceEntity) { 31 | return produceMapper.selectProduceCount(produceEntity); 32 | } 33 | 34 | @Transactional 35 | @Override 36 | public Map addShoppingCart(ShoppingCartEntity shoppingCartEntity) { 37 | Map map = new HashMap<>(); 38 | ProduceEntity produceEntity = new ProduceEntity(); 39 | produceEntity.setProduce_id(shoppingCartEntity.getProduce_id()); 40 | produceEntity.setProduce_count(shoppingCartEntity.getCart_produce_count()); 41 | if (checkProduceCount(produceEntity)!=null) { 42 | //判断该商品是否在购物车 43 | if (shoppingCartMapper.selectShoppingCartProduceCountByUidAndPid(shoppingCartEntity)!=null) { 44 | ShoppingCartEntity shoppingCartEntity1 = new ShoppingCartEntity(); 45 | //用户id 46 | shoppingCartEntity1.setProduce_id(shoppingCartEntity.getProduce_id()); 47 | //商品id 48 | shoppingCartEntity1.setUser_id(shoppingCartEntity.getUser_id()); 49 | //购物车更新的商品数量 50 | shoppingCartEntity1.setCart_produce_count(shoppingCartEntity.getCart_produce_count() + shoppingCartMapper.selectShoppingCartProduceCountByUidAndPid(shoppingCartEntity).getCart_produce_count()); 51 | //增加购物车商品数量 52 | int result = shoppingCartMapper.updateShoppingCartProduceCount(shoppingCartEntity1); 53 | 54 | //减少商品库存 55 | ProduceEntity produceEntity1 = new ProduceEntity(); 56 | produceEntity1.setProduce_id(shoppingCartEntity.getProduce_id()); 57 | produceEntity1.setProduce_count(produceMapper.selectProduceCountByPid(produceEntity1).getProduce_count()); 58 | //获取商品库存数量和商品id 59 | //更新库存数量 60 | produceEntity1.setProduce_count(produceEntity1.getProduce_count() - shoppingCartEntity.getCart_produce_count()); 61 | int result2 = produceMapper.updateProduceProduce_count(produceEntity1); 62 | if (result + result2 >= 2) { 63 | map.put("codemsg","1"); 64 | System.out.println("添加成功,code="+1); 65 | } else { 66 | map.put("codemsg", "0"); 67 | System.out.println("添加失败,code="+0); 68 | } 69 | } else { 70 | int res = shoppingCartMapper.insertShoppingCart(shoppingCartEntity); 71 | if(res>0){ 72 | map.put("codemsg","1"); 73 | System.out.println("添加成功,code="+1); 74 | }else { 75 | map.put("codemsg", "0"); 76 | System.out.println("添加失败,code="+0); 77 | } 78 | // System.out.println("补充插入语句"); 79 | } 80 | }else { 81 | map.put("codemsg","2"); 82 | System.out.println("库存不足,code"+2); 83 | } 84 | return map; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/hzq/dragonshopping/service/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping.service; 2 | 3 | import com.hzq.dragonshopping.controller.IndexController; 4 | import com.hzq.dragonshopping.entity.ProduceEntity; 5 | import com.hzq.dragonshopping.mapper.ProduceMapper; 6 | import com.hzq.dragonshopping.mapper.UserMapper; 7 | import com.hzq.dragonshopping.entity.UserEntity; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Transactional; 13 | 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | @Service("UserService") 18 | public class UserServiceImpl implements IUserService { 19 | 20 | private final Logger logger = LoggerFactory.getLogger(IndexController.class); 21 | @Autowired 22 | private UserMapper userMapper; 23 | @Autowired 24 | private IShoppingCartService shoppingCartService; 25 | @Autowired 26 | private ProduceMapper produceMapper; 27 | 28 | @Override 29 | public UserEntity login(UserEntity userEntity) { 30 | return userMapper.selectByUnamePwdType(userEntity); 31 | } 32 | 33 | @Transactional 34 | @Override 35 | public int regist(UserEntity userEntity) { 36 | return userMapper.insertUser(userEntity); 37 | } 38 | 39 | @Transactional 40 | @Override 41 | public Map payProduce(ProduceEntity produceEntity,UserEntity userEntity) { 42 | Map map = new HashMap<>(); 43 | //判断库存是否够用shoppingCartService.checkProduceCount(produceEntity)!=null 44 | if(shoppingCartService.checkProduceCount(produceEntity)!= null){ 45 | //总价格 46 | double totlePrice = produceEntity.getProduce_price()*produceEntity.getProduce_count(); 47 | userEntity.setUser_money(totlePrice); 48 | //判断余额是否够用 49 | if(userMapper.selectComparedUserBalanceById(userEntity) != null){ 50 | //进行购买操作 51 | //更新用户余额 52 | double newBalance = userMapper.selectComparedUserBalanceById(userEntity).getUser_money() - totlePrice; 53 | userEntity.setUser_money(newBalance); 54 | int result = userMapper.updateUserMoneyByUid(userEntity); 55 | //更新商品库存 56 | int newProduce_count = produceMapper.selectProduceCount(produceEntity).getProduce_count() - produceEntity.getProduce_count(); 57 | produceEntity.setProduce_count(newProduce_count); 58 | int result2 = produceMapper.updateProduceProduce_count(produceEntity); 59 | if(result + result2 >= 2){ 60 | map.put("msgcode","1"); 61 | logger.info("code+msg"+"1支付成功"); 62 | }else { 63 | map.put("msgcode","0"); 64 | logger.info("code+msg"+"0支付失败"); 65 | } 66 | }else { 67 | map.put("msgcode","00"); 68 | logger.info("code+msg"+"00余额不足"); 69 | } 70 | }else { 71 | map.put("msgcode","000"); 72 | logger.info("code+msg"+"000库存不足"); 73 | } 74 | return map; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | # servlet: 4 | # context-path: /dragonshopping 5 | spring: 6 | datasource: 7 | url: jdbc:mysql://127.0.0.1:3306/buyers?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC 8 | username: root 9 | password: root 10 | # spring mvc 视图解析器 11 | mvc: 12 | view: 13 | prefix: /templates/ 14 | suffix: .html 15 | static-path-pattern: /** 16 | 17 | mybatis: 18 | mapper-locations: classpath:configs/mapper/*.xml #注意:一定要对应mapper映射xml文件的所在路径 19 | type-aliases-package: com.hzq.dragonshopping.entity # 注意:对应实体类的路径 20 | 21 | thymeleaf: 22 | cache: false #关闭缓存 23 | prefix: classpath:/templates/ 24 | suffix: .html 25 | mode: HTML5 #设置模板类型 26 | encoding: utf-8 27 | 28 | #日志 29 | logging: 30 | level: 31 | root: info 32 | com.hzq.dragonshopping: debug 33 | org.springframework: warn 34 | file: ./logs/dragonshopping.log 35 | pattern: 36 | console: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n' 37 | file: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n' 38 | 39 | 40 | 41 | #jedis : 42 | # pool : 43 | # host : 192.168.42.111 44 | # port : 6379 45 | # config : 46 | # maxActive: 20 47 | # maxTotal: 100 48 | # maxIdle: 10 49 | # maxWaitMillis : 100000 50 | 51 | -------------------------------------------------------------------------------- /src/main/resources/configs/mapper/ProduceCategoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 42 | 43 | 48 | 49 | -------------------------------------------------------------------------------- /src/main/resources/configs/mapper/ProduceCommentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | insert into comment 11 | VALUES 12 | ( 13 | NULL , 14 | #{comments_centent}, 15 | #{comments_user_id}, 16 | #{comments_produce_id}, 17 | #{comments_stars}, 18 | DEFAULT 19 | ) 20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/configs/mapper/ProduceMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 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 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 78 | 79 | 80 | 83 | 84 | 87 | 88 | 89 | UPDATE 90 | produce_sell 91 | SET 92 | produce_count = #{produce_count} 93 | WHERE 94 | produce_id= #{produce_id} 95 | 96 | 97 | 98 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/main/resources/configs/mapper/ShoppingCartMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 42 | INSERT INTO shopping_cart 43 | VALUES 44 | ( 45 | null, 46 | #{user_id}, 47 | #{produce_id}, 48 | #{cart_produce_count}, 49 | DEFAULT, 50 | DEFAULT 51 | ) 52 | 53 | 54 | 55 | 56 | UPDATE 57 | shopping_cart 58 | SET 59 | cart_produce_count = #{cart_produce_count} 60 | WHERE 61 | produce_id=#{produce_id} and user_id=#{user_id} 62 | 63 | 64 | 65 | 74 | 75 | -------------------------------------------------------------------------------- /src/main/resources/configs/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | INSERT INTO USER 15 | VALUES 16 | ( 17 | #{user_id}, 18 | #{user_name}, 19 | #{user_sex}, 20 | #{user_password}, 21 | #{user_address}, 22 | #{user_phone}, 23 | #{user_headimgurl}, 24 | #{user_status}, 25 | #{user_type}, 26 | #{user_money} 27 | ) 28 | 29 | 30 | 33 | 34 | 35 | UPDATE 36 | user 37 | SET 38 | user_money = #{user_money} 39 | WHERE 40 | user_id= #{user_id} 41 | 42 | -------------------------------------------------------------------------------- /src/main/resources/static/css/cart.css: -------------------------------------------------------------------------------- 1 | header{width:100%;height:2rem;line-height:2rem;text-align:center;padding:0 .5rem;position:relative;color:#666;border-bottom:1px solid #eee}header span{position:absolute;right:.67rem}.con{margin-bottom:5.22rem}.content{border-bottom:.8rem solid #f2f2f2}input[type=checkbox]{display:none}.list{width:100%;height:2rem;padding:.6rem;border-bottom:1px solid #eee}.list p{margin-left:1.4rem}ul li{width:100%;height:3.2rem;padding:.6rem 0;border-bottom:1px solid #eee}ul li .label{width:2rem;height:2rem;padding:.6rem;overflow:hidden}ul li .img{width:2rem;height:2rem}ul li .text{width:10.9rem;margin-left:.5rem}ul li .text p{width:100%}ul li .text p input,.number{display:inline-block;text-align:center;width:1rem;height:1rem;line-height:1rem;background:rgba(255,255,255,.7);color:#666;border:1px solid #eee;font-size:.53rem}.overflow{margin-bottom:.2rem;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.red{color:#701c17}ul li .img img{width:100%;height:100%}.list label img{width:.8rem;height:.8rem}.total{width:100%;height:2rem;line-height:2rem;background:#fff;text-align:right;color:#666;padding-right:.6rem}.total span{color:#701c17}.bottom{bottom:2.3rem;width:100%;height:2.6rem;color:#701c17;padding:.6rem;border-top:1px solid #eee;background:#fff}.bottom-label{height:2rem;line-height:1.4rem}.bottom img{width:.8rem;height:.8rem;margin-top:.3rem;margin-right:.3rem}.bottom button{width:3rem;height:1.5rem;background:#701c17;color:#fff;font-size:.53rem;margin-left:.4rem}.text1{width:100%;height:100%;top:0;left:0;background:rgba(200,200,200,.7);display:none;-webkit-display:none;justify-content:center;align-items:center}.text1 form{width:70%;height:5rem;background:#fff}.text1 form input[type=number]{width:40%;height:1.8rem;margin:.8rem 30%;border:.04rem solid #000}.text1 form input[type=button]{width:100%;height:1.6rem;background:#701c17;color:#fff}.alert{width:100%;height:2rem;text-align:center;line-height:2rem;color:red;background:#fff;bottom:5rem;display:none}.no{width:100%;height:93%;background:#fff;font-weight:700;color:#666;display:box;box-pack:center;box-align:center;display:-webkit-box;-webkit-box-pack:center;-webkit-box-align:center}footer{width:100%;height:2.62rem;bottom:0;background:#fafafa;padding-top:.5rem}.footer{width:33.33%;height:100*;float:left;text-align:center}.footer p{color:#727272}.footer .p_active{color:#a60810}.footer img{width:1.07rem} -------------------------------------------------------------------------------- /src/main/resources/static/css/reset.css: -------------------------------------------------------------------------------- 1 | html{font-family:helvetica neue,Helvetica,sans-serif;-webkit-text-size-adjust:none;-webkit-tap-hightlight-color:transparent;-webkit-user-select:none;height:100%}*{margin:0;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:microsoft yahei;font-size:.62rem}body{overflow-x:hidden;min-height:100%;-webkit-overflow-scrolling:touch;overflow-x:hidden;-webkit-text-size-adjust:none!important}ul,ol{list-style:none}a{color:#333;text-decoration:none}img{border:0;display:block;width:100%;vertical-align:middle}button,input{appearance:none;-webkit-appearance:none;-moz-appearance:none;outline:none;border:none;text-align:center}.fl{float:left}.fr{float:right}.clearfix:after{content:"";display:block;width:100%;height:0;clear:both}h1,h2,h3,h4,h5,h6{font-weight:400}.relative{position:relative}.absolute{position:absolute}.fixed{position:fixed}.text_over{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.text{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.block{display:block}.none{display:none} -------------------------------------------------------------------------------- /src/main/resources/static/css/style.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | height: 100%; 3 | -webkit-tap-highlight-color: transparent 4 | } 5 | 6 | body { 7 | font-family: -apple-system-font, Helvetica Neue, Helvetica, sans-serif 8 | } 9 | 10 | ul { 11 | list-style: none 12 | } 13 | 14 | .page, body { 15 | background-color: #f8f8f8 16 | } 17 | 18 | .link { 19 | color: #1aad19 20 | } 21 | 22 | .container { 23 | overflow: hidden 24 | } 25 | 26 | .container, .page { 27 | position: absolute; 28 | top: 0; 29 | right: 0; 30 | bottom: 0; 31 | left: 0 32 | } 33 | 34 | .page { 35 | overflow-y: auto; 36 | -webkit-overflow-scrolling: touch; 37 | opacity: 0; 38 | z-index: 1 39 | } 40 | 41 | .page.js_show { 42 | opacity: 1 43 | } 44 | 45 | .page__hd { 46 | padding: 20px 30px; 47 | background-color: #1aad19; 48 | } 49 | 50 | .page__bd_spacing { 51 | padding: 0 15px 52 | } 53 | 54 | .page__ft { 55 | padding-top: 40px; 56 | padding-bottom: 10px; 57 | text-align: center 58 | } 59 | 60 | .page__ft img { 61 | height: 19px 62 | } 63 | 64 | .page__ft.j_bottom { 65 | position: absolute; 66 | bottom: 0; 67 | left: 0; 68 | right: 0 69 | } 70 | 71 | .page__title { 72 | text-align: left; 73 | font-size: 20px; 74 | font-weight: 400; 75 | color: #fff; 76 | } 77 | 78 | .page__desc { 79 | margin-top: 5px; 80 | color: #fff; 81 | text-align: left; 82 | font-size: 14px 83 | } 84 | 85 | .page.home .page__intro-icon { 86 | margin-top: -.2em; 87 | margin-left: 5px; 88 | width: 16px; 89 | height: 16px; 90 | vertical-align: middle 91 | } 92 | 93 | .page.home .page__title { 94 | font-size: 0; 95 | margin-bottom: 15px 96 | } 97 | 98 | .page.home .page__bd img { 99 | width: 30px; 100 | height: 30px 101 | } 102 | 103 | .page.home .page__bd li { 104 | margin: 10px 0; 105 | background-color: #fff; 106 | overflow: hidden; 107 | border-radius: 2px; 108 | cursor: pointer 109 | } 110 | 111 | .page.home .page__bd li.js_show .weui-flex { 112 | opacity: .4 113 | } 114 | 115 | .page.home .page__bd li.js_show .page__category { 116 | height: auto 117 | } 118 | 119 | .page.home .page__bd li.js_show .page__category-content { 120 | opacity: 1; 121 | -webkit-transform: translateY(0); 122 | transform: translateY(0) 123 | } 124 | 125 | .page.home .page__bd li:first-child { 126 | margin-top: 0 127 | } 128 | 129 | .page.home .page__category { 130 | height: 0; 131 | overflow: hidden 132 | } 133 | 134 | .page.home .page__category-content { 135 | opacity: 0; 136 | -webkit-transform: translateY(-50%); 137 | transform: translateY(-50%); 138 | -webkit-transition: .3s; 139 | transition: .3s 140 | } 141 | 142 | .page.home .weui-flex { 143 | padding: 20px; 144 | -webkit-box-align: center; 145 | -webkit-align-items: center; 146 | align-items: center; 147 | -webkit-transition: .3s; 148 | transition: .3s 149 | } 150 | 151 | .page.home .weui-cells { 152 | margin-top: 0 153 | } 154 | 155 | .page.home .weui-cells:after, .page.home .weui-cells:before { 156 | display: none 157 | } 158 | 159 | .page.home .weui-cell { 160 | padding-left: 20px; 161 | padding-right: 20px 162 | } 163 | 164 | .page.home .weui-cell:before { 165 | left: 20px; 166 | right: 20px 167 | } 168 | 169 | .page.button .page__bd { 170 | padding: 0 15px 171 | } 172 | 173 | .page.button .button-sp-area { 174 | margin: 0 auto; 175 | padding: 15px 0; 176 | width: 60% 177 | } 178 | 179 | .page.cell .page__bd, .page.form .page__bd { 180 | padding-bottom: 30px 181 | } 182 | 183 | .page.actionsheet, .page.dialog { 184 | background-color: #fff 185 | } 186 | 187 | .page.dialog .page__bd { 188 | padding: 0 15px 189 | } 190 | 191 | .page.msg, .page.msg_success, .page.msg_warn, .page.toast { 192 | background-color: #fff 193 | } 194 | 195 | .page.panel .page__bd { 196 | padding-bottom: 20px 197 | } 198 | 199 | .page.article { 200 | background-color: #fff 201 | } 202 | 203 | .page.icons { 204 | text-align: center 205 | } 206 | 207 | .page.icons .page__bd { 208 | padding: 0 40px; 209 | text-align: left 210 | } 211 | 212 | .page.icons .icon-box { 213 | margin-bottom: 25px; 214 | display: -webkit-box; 215 | display: -webkit-flex; 216 | display: flex; 217 | -webkit-box-align: center; 218 | -webkit-align-items: center; 219 | align-items: center 220 | } 221 | 222 | .page.icons .icon-box i { 223 | margin-right: 18px 224 | } 225 | 226 | .page.icons .icon-box__ctn { 227 | -webkit-flex-shrink: 100; 228 | flex-shrink: 100 229 | } 230 | 231 | .page.icons .icon-box__title { 232 | font-weight: 400 233 | } 234 | 235 | .page.icons .icon-box__desc { 236 | margin-top: 6px; 237 | font-size: 12px; 238 | color: #888 239 | } 240 | 241 | .page.icons .icon_sp_area { 242 | margin-top: 10px; 243 | text-align: left 244 | } 245 | 246 | .page.icons .icon_sp_area i:before { 247 | margin-bottom: 5px 248 | } 249 | 250 | .page.flex .placeholder { 251 | background-color: #ebebeb; 252 | height: 2.3em; 253 | line-height: 2.3em; 254 | text-align: center; 255 | margin: 5px; 256 | color: #cfcfcf 257 | } 258 | 259 | .page.loadmore { 260 | background-color: #fff 261 | } 262 | 263 | .page.layers { 264 | overflow-x: hidden; 265 | -webkit-perspective: 1000px; 266 | perspective: 1000px 267 | } 268 | 269 | @media only screen and (max-width:320px) { 270 | .page.layers .page__hd { 271 | padding-left: 20px; 272 | padding-right: 20px 273 | } 274 | } 275 | 276 | .page.layers .page__bd { 277 | position: relative 278 | } 279 | 280 | .page.layers .page__desc { 281 | min-height: 4.8em 282 | } 283 | 284 | .page.layers .layers__layer { 285 | position: absolute; 286 | left: 50%; 287 | width: 150px; 288 | height: 266px; 289 | margin-left: -75px; 290 | box-sizing: border-box; 291 | -webkit-transition: .5s; 292 | transition: .5s; 293 | background: url(images/layers/transparent.gif) no-repeat 50%; 294 | background-size: contain; 295 | font-size: 14px; 296 | color: #fff 297 | } 298 | 299 | .page.layers .layers__layer span { 300 | position: absolute; 301 | bottom: 5px; 302 | left: 0; 303 | right: 0; 304 | text-align: center; 305 | -webkit-transition: .5s; 306 | transition: .5s 307 | } 308 | 309 | .page.layers .layers__layer:last-child span { 310 | color: #aaa 311 | } 312 | 313 | .page.layers .layers__layer.j_hide { 314 | opacity: 0 315 | } 316 | 317 | .page.layers .layers__layer.j_pic span { 318 | color: transparent 319 | } 320 | 321 | @media only screen and (min-width:375px) and (min-height:603px) { 322 | .page.layers .layers__layer { 323 | width: 180px; 324 | height: 320px; 325 | margin-left: -90px 326 | } 327 | } 328 | 329 | @media only screen and (min-width:414px) and (min-height:640px) { 330 | .page.layers .layers__layer { 331 | width: 200px; 332 | height: 355px; 333 | margin-left: -100px 334 | } 335 | } 336 | 337 | .page.layers .layers__layer_popout { 338 | border: 1px solid hsla(0, 0%, 80%, .5); 339 | z-index: 4 340 | } 341 | 342 | .page.layers .layers__layer_popout.j_transform { 343 | -webkit-transform: translateX(15px) rotateX(45deg) rotate(10deg) 344 | skew(-15deg) translateZ(120px); 345 | transform: translateX(15px) rotateX(45deg) rotate(10deg) skew(-15deg) 346 | translateZ(120px) 347 | } 348 | 349 | @media only screen and (max-width:320px) { 350 | .page.layers .layers__layer_popout.j_transform { 351 | -webkit-transform: translateX(15px) rotateX(45deg) rotate(10deg) 352 | skew(-15deg) translateZ(140px); 353 | transform: translateX(15px) rotateX(45deg) rotate(10deg) skew(-15deg) 354 | translateZ(140px) 355 | } 356 | } 357 | 358 | .page.layers .layers__layer_popout.j_pic { 359 | border-color: transparent; 360 | background-image: url(images/layers/popout.png) 361 | } 362 | 363 | .page.layers .layers__layer_mask { 364 | background-color: rgba(0, 0, 0, .5); 365 | z-index: 3 366 | } 367 | 368 | .page.layers .layers__layer_mask.j_transform { 369 | -webkit-transform: translateX(15px) rotateX(45deg) rotate(10deg) 370 | skew(-15deg) translateZ(40px); 371 | transform: translateX(15px) rotateX(45deg) rotate(10deg) skew(-15deg) 372 | translateZ(40px) 373 | } 374 | 375 | @media only screen and (max-width:320px) { 376 | .page.layers .layers__layer_mask.j_transform { 377 | -webkit-transform: translateX(15px) rotateX(45deg) rotate(10deg) 378 | skew(-15deg) translateZ(80px); 379 | transform: translateX(15px) rotateX(45deg) rotate(10deg) skew(-15deg) 380 | translateZ(80px) 381 | } 382 | } 383 | 384 | .page.layers .layers__layer_navigation { 385 | background-color: rgba(40, 187, 102, .5); 386 | z-index: 2 387 | } 388 | 389 | .page.layers .layers__layer_navigation.j_transform { 390 | -webkit-transform: translateX(15px) rotateX(45deg) rotate(10deg) 391 | skew(-15deg) translateZ(-40px); 392 | transform: translateX(15px) rotateX(45deg) rotate(10deg) skew(-15deg) 393 | translateZ(-40px) 394 | } 395 | 396 | @media only screen and (max-width:320px) { 397 | .page.layers .layers__layer_navigation.j_transform { 398 | -webkit-transform: translateX(15px) rotateX(45deg) rotate(10deg) 399 | skew(-15deg) translateZ(20px); 400 | transform: translateX(15px) rotateX(45deg) rotate(10deg) skew(-15deg) 401 | translateZ(20px) 402 | } 403 | } 404 | 405 | .page.layers .layers__layer_navigation.j_pic { 406 | background-color: transparent; 407 | background-image: url(images/layers/navigation.png) 408 | } 409 | 410 | .page.layers .layers__layer_content { 411 | background-color: #fff; 412 | z-index: 1 413 | } 414 | 415 | .page.layers .layers__layer_content.j_transform { 416 | -webkit-transform: translateX(15px) rotateX(45deg) rotate(10deg) 417 | skew(-15deg) translateZ(-120px); 418 | transform: translateX(15px) rotateX(45deg) rotate(10deg) skew(-15deg) 419 | translateZ(-120px) 420 | } 421 | 422 | @media only screen and (max-width:320px) { 423 | .page.layers .layers__layer_content.j_transform { 424 | -webkit-transform: translateX(15px) rotateX(45deg) rotate(10deg) 425 | skew(-15deg) translateZ(-40px); 426 | transform: translateX(15px) rotateX(45deg) rotate(10deg) skew(-15deg) 427 | translateZ(-40px) 428 | } 429 | } 430 | 431 | .page.layers .layers__layer_content.j_pic { 432 | background-image: url(images/layers/content.png) 433 | } 434 | 435 | .page.searchbar .searchbar-result { 436 | display: none; 437 | margin-top: 0; 438 | font-size: 14px 439 | } 440 | 441 | .page.searchbar .searchbar-result .weui-cell__bd { 442 | padding: 2px 0 2px 20px; 443 | color: #666 444 | } 445 | 446 | .page.actionsheet, .page.gallery, .page.picker { 447 | overflow: hidden 448 | } 449 | 450 | @ 451 | -webkit-keyframes a { 0%{ 452 | -webkit-transform: translate3d(100%, 0, 0); 453 | transform: translate3d(100%, 0, 0); 454 | opacity: 0 455 | } 456 | 457 | to { 458 | -webkit-transform: translateZ(0); 459 | transform: translateZ(0); 460 | opacity: 1 461 | } 462 | 463 | } 464 | @ 465 | keyframes a { 0%{ 466 | -webkit-transform: translate3d(100%, 0, 0); 467 | transform: translate3d(100%, 0, 0); 468 | opacity: 0 469 | } 470 | 471 | to { 472 | -webkit-transform: translateZ(0); 473 | transform: translateZ(0); 474 | opacity: 1 475 | } 476 | 477 | } 478 | @ 479 | -webkit-keyframes b { 0%{ 480 | -webkit-transform: translateZ(0); 481 | transform: translateZ(0); 482 | opacity: 1 483 | } 484 | 485 | to { 486 | -webkit-transform: translate3d(100%, 0, 0); 487 | transform: translate3d(100%, 0, 0); 488 | opacity: 0 489 | } 490 | 491 | } 492 | @ 493 | keyframes b { 0%{ 494 | -webkit-transform: translateZ(0); 495 | transform: translateZ(0); 496 | opacity: 1 497 | } 498 | 499 | to { 500 | -webkit-transform: translate3d(100%, 0, 0); 501 | transform: translate3d(100%, 0, 0); 502 | opacity: 0 503 | } 504 | 505 | } 506 | .page.slideIn { 507 | -webkit-animation: a .2s forwards; 508 | animation: a .2s forwards 509 | } 510 | 511 | .page.slideOut { 512 | -webkit-animation: b .2s forwards; 513 | animation: b .2s forwards 514 | } -------------------------------------------------------------------------------- /src/main/resources/static/images/JayZhou.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/JayZhou.jpeg -------------------------------------------------------------------------------- /src/main/resources/static/images/cbiancheng.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/cbiancheng.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/computer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/computer.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/gelin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/gelin.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/goyvyang.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/goyvyang.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/halibote.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/halibote.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/javarumeng.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/javarumeng.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/leehongwang.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/leehongwang.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/leehonwang.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/leehonwang.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/me.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/me.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/mingren.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/mingren.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/python.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/python.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/wenxuede.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/wenxuede.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/wenxuedeyiyi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/wenxuedeyiyi.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/xiyouji.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/images/xiyouji.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/Basket-2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/Basket-2@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/Credit-card-4@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/Credit-card-4@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/Lock-square@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/Lock-square@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/Present-2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/Present-2@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/Settings-3@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/Settings-3@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/Shopping-bag-3@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/Shopping-bag-3@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/Shopping-cart-1@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/Shopping-cart-1@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/Tag-2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/Tag-2@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/User-V@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/User-V@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/User@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/User@3x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/c_checkbox_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/c_checkbox_off.png -------------------------------------------------------------------------------- /src/main/resources/static/img/c_checkbox_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/c_checkbox_on.png -------------------------------------------------------------------------------- /src/main/resources/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/favicon.ico -------------------------------------------------------------------------------- /src/main/resources/static/img/icon-back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/icon-back.png -------------------------------------------------------------------------------- /src/main/resources/static/img/icon-kin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/icon-kin.png -------------------------------------------------------------------------------- /src/main/resources/static/img/icon_radio3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/icon_radio3.png -------------------------------------------------------------------------------- /src/main/resources/static/img/icon_radio4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/icon_radio4.png -------------------------------------------------------------------------------- /src/main/resources/static/img/return.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hzq-up/dragonshopping/ceb87033f3fe1e0bdeb8480297e01cc81b1fcaa8/src/main/resources/static/img/return.png -------------------------------------------------------------------------------- /src/main/resources/static/js/cart.js: -------------------------------------------------------------------------------- 1 | function total() { 2 | setTimeout(function () { 3 | var S = 0; 4 | $.each($('.total'), function () { 5 | var $ul_total = $(this).prev('ul').find("input[type='checkbox']"); 6 | var s = 0; 7 | var n1 = 0; 8 | $.each($(this).prev('ul').find(".number"), function (i) { 9 | if ($ul_total.eq(i).attr("checked") == "checked") { 10 | s = s + parseInt($(this).html()) * parseInt($(this).parent().prev().html().replace("¥", "")); 11 | n1 = n1 + parseInt($(this).html()); 12 | } 13 | }); 14 | $(this).children("span").html("¥" + s.toFixed(1)); 15 | $(this).children("number").html(n1); 16 | S = S + s; 17 | }); 18 | $(".bottom span").html(S.toFixed(1)); 19 | }, 100) 20 | } 21 | 22 | function hide() { 23 | if ($(".content").length == 0) { 24 | $(".bottom").hide(); 25 | $(".no").css("display", "-webkit-box"); 26 | return; 27 | } else { 28 | $(".bottom").eq(0).show(); 29 | $(".no").css("display", "none"); 30 | } 31 | } 32 | 33 | function sum() { 34 | if ($("ul input[checked='checked']").length == $("li").length) { 35 | $(".bottom input[type=checkbox]").attr("checked", "checked"); 36 | $(".bottom input[type=checkbox]").next("img").attr("src", "/img/c_checkbox_on.png"); 37 | } else { 38 | $(".bottom input[type=checkbox]").removeAttr("checked"); 39 | $(".bottom input[type=checkbox]").next("img").attr("src", "/img/c_checkbox_off.png"); 40 | } 41 | } 42 | 43 | function checkbox($this) { 44 | if ($this.attr('type') == "checkbox") { 45 | if ($this.attr('checked') == "checked") { 46 | $this.removeAttr("checked"); 47 | $this.next('img').attr("src", "/img/c_checkbox_off.png"); 48 | } else { 49 | $this.attr("checked", "checked"); 50 | $this.next('img').attr("src", "/img/c_checkbox_on.png"); 51 | } 52 | } 53 | total(); 54 | } 55 | $(function () { 56 | hide(); 57 | total(); 58 | $("#bianji").click(function () { 59 | if ($(this).html() == "编辑") { 60 | $(this).html("完成"); 61 | $(".bottom").eq(1).show(); 62 | } else { 63 | $(this).html("编辑"); 64 | $(".bottom").eq(1).hide(); 65 | } 66 | hide(); 67 | }); 68 | $('.bottom-label input').change(function () { 69 | if ($(this).attr("checked") == "checked") { 70 | $(".con input[type='checkbox']").removeAttr("checked"); 71 | $(".con input[type='checkbox']").next('img').attr("src", "/img/c_checkbox_off.png"); 72 | } else { 73 | $(".con input[type='checkbox']").attr("checked", "checked"); 74 | $(".con input[type='checkbox']").next('img').attr("src", "/img/c_checkbox_on.png"); 75 | } 76 | checkbox($(this)); 77 | }) 78 | $('.list input').change(function () { 79 | var $list_input = $(this).parents('.list').next('ul').find('input[type=checkbox]'); 80 | if ($(this).attr("checked") == undefined) { 81 | $list_input.attr("checked", "checked"); 82 | $list_input.next('img').attr("src", "/img/c_checkbox_on.png"); 83 | } else { 84 | $list_input.removeAttr("checked"); 85 | $list_input.next('img').attr("src", "/img/c_checkbox_off.png"); 86 | } 87 | checkbox($(this)); 88 | sum(); 89 | }) 90 | $("ul input[type='checkbox']").change(function () { 91 | checkbox($(this)); 92 | var $ul_input = $(this).parents('ul').prev('.list').find('input'); 93 | if ($(this).parents('ul').find("input[checked='checked']").length == $(this).parents("ul").children('li').length) { 94 | $ul_input.attr("checked", "checked"); 95 | $ul_input.next('img').attr("src", "/img/c_checkbox_on.png"); 96 | } else { 97 | $ul_input.removeAttr("checked"); 98 | $ul_input.next('img').attr("src", "/img/c_checkbox_off.png"); 99 | } 100 | sum(); 101 | }) 102 | $('.btn2').click(function () { 103 | if ($(this).next('.number').html() > 100) { 104 | $(this).next('.number').html(100); 105 | $('.alert').show().html('超出库存了!'); 106 | setTimeout(function () { 107 | $('.alert').hide(); 108 | }, 2000); 109 | return false; 110 | } else 111 | $(this).prev('.number').html(parseInt($(this).prev('.number').html()) + 1); 112 | total(); 113 | }) 114 | $('.btn1').click(function () { 115 | if ($(this).next('.number').html() == 0) 116 | $(this).next('.number').html(0); 117 | else 118 | $(this).next('.number').html(parseInt($(this).next('.number').html()) - 1); 119 | total(); 120 | }) 121 | $(".number").click(function () { 122 | $('.text1').css({ 123 | "display": "flex", 124 | "-webkit-display": "flex" 125 | }).attr({ 126 | 'ind': $(this).parents('li').index(), 127 | "ind_1": $(this).parents("ul").attr("ind") 128 | }); 129 | $('.text1 input[type=number]').val($(this).html()); 130 | }) 131 | $('.text1 input[type="button"]').click(function () { 132 | if ($('.text1 input[type=number]').val() == "") { 133 | $('.alert').show().html('请输入数量!'); 134 | setTimeout(function () { 135 | $('.alert').hide(); 136 | }, 2000); 137 | return false; 138 | } 139 | if ($('.text1 input[type=number]').val() > 100) { 140 | $('.alert').show().html('超出库存了!'); 141 | setTimeout(function () { 142 | $('.alert').hide(); 143 | }, 2000); 144 | return false; 145 | } 146 | $("ul").eq($('.text1').attr('ind_1')).find(".number").eq($('.text1').attr('ind')).html($('.text1 input[type=number]').val()); 147 | $('.text1').css({ 148 | "display": "none", 149 | "-webkit-display": "none" 150 | }); 151 | total(); 152 | }) 153 | $('.sett').click(function () { 154 | alert("你应付" + $(this).prev("span").html() + "元钱"); 155 | }); 156 | $('.delete').click(function () { 157 | $.each($('li'), function () { 158 | if ($(this).find("input[type=checkbox]").attr("checked") == "checked") { 159 | $(this).remove(); 160 | } 161 | }); 162 | $('input[type=checkbox]').attr("checked", "checked"); 163 | $('input[type=checkbox]').next("img").attr("src", "/img/c_checkbox_on.png"); 164 | $.each($(".content"), function () { 165 | if ($(this).find("li").length == 0) { 166 | $(this).remove(); 167 | } 168 | }); 169 | hide(); 170 | total(); 171 | }); 172 | }) -------------------------------------------------------------------------------- /src/main/resources/static/js/common.js: -------------------------------------------------------------------------------- 1 | function showMsg(message, callback) { 2 | $('#msgBox').find('.weui-dialog__bd').html(message); 3 | $('#msgBox').fadeIn(200); 4 | $('.weui-dialog__btn_primary').unbind('click').click(function() { 5 | $('#msgBox').fadeOut(200); 6 | if (typeof (callback) == 'function') { 7 | callback(); 8 | } 9 | }); 10 | } -------------------------------------------------------------------------------- /src/main/resources/static/js/web.js: -------------------------------------------------------------------------------- 1 | (function(doc,win){var docEl=doc.documentElement,resizeEvt='orientationchange'in window?'orientationchange':'resize',recalc=function(){var clientWidth=docEl.clientWidth;if(!clientWidth)return;docEl.style.fontSize=20*(clientWidth/320)+'px';};if(!doc.addEventListener)return;win.addEventListener(resizeEvt,recalc,false);doc.addEventListener('DOMContentLoaded',recalc,false);})(document,window); -------------------------------------------------------------------------------- /src/main/resources/templates/account/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 39 | 40 | 41 | 42 | 117 | 149 | 150 | -------------------------------------------------------------------------------- /src/main/resources/templates/include/menu.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 23 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
60 | 61 | -------------------------------------------------------------------------------- /src/main/resources/templates/include/message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 首页 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 40 | 41 | 42 |
43 | 44 |
45 |
46 |
47 |

神龙购书网

48 |
49 | 50 |
51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 | 热门读书 72 |
73 | 74 | 88 | 89 | 90 | 91 | 92 | 93 |
94 | 95 | 123 | 124 |
125 | 126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | 186 | 187 | -------------------------------------------------------------------------------- /src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 登录 7 | 8 | 9 | 10 | 11 | 12 | 20 | 21 | 22 | 23 |
24 | 25 |

神龙购书网

26 | 27 |
28 |
29 |
30 |
31 |
32 | 35 |
36 |
37 | 38 |
39 |
40 |
41 |
42 | 45 |
46 |
47 | 48 |
49 |
50 |
51 |
52 | 登 录 53 |
54 |
55 | 56 | 57 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/main/resources/templates/mycart.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 购物车 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 | 26 | 27 | 28 | 29 |
30 |

购物车

31 |
32 | 编辑 33 |
34 |
35 | 36 |
37 | 38 |
39 |
40 |

暂无数据,快去逛逛吧!

41 |
42 |
43 |
44 | 45 |
    46 |
  • 47 |
    48 | 52 |
    53 |
    54 | 55 | 56 | 57 |
    58 |
    59 | 60 |

    61 |
    62 |

    63 | 64 | 65 | 66 | 1 67 | 68 | 69 |

    70 |
    71 |
  • 72 |
73 |

一共 74 | 75 | 件商品:

76 |
77 | 78 |
79 |
80 |
81 | 86 |
87 |
88 | 需要支付: 89 | 90 |
91 |
92 | 97 |
98 |
99 | 100 | 101 |
102 | 107 |
108 |
109 |
110 |
111 | 112 |
113 | 114 |
115 |
116 |
117 |
118 | 119 |
120 | 121 | 122 | 123 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /src/main/resources/templates/product_category.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 商品 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 31 | 32 | 33 | 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 |
61 | 79 | 80 | 81 | 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 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /src/main/resources/templates/regist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 注册 7 | 8 | 9 | 10 | 11 | 12 | 20 | 21 | 22 | 23 |
24 | 25 |

神龙购书网

26 | 27 |
28 | 29 |
30 |
31 |
32 |
33 | 36 |
37 |
38 | 39 |
40 |
41 |
42 |
43 | 46 |
47 |
48 | 49 |
50 |
51 | 52 |
53 |
54 | 注 册 55 |
56 |
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/main/resources/templates/welcome.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 欢迎界面 7 | 8 | 9 | 10 |

登陆成功!!!

11 | 12 | 13 | -------------------------------------------------------------------------------- /src/test/java/com/hzq/dragonshopping/DragonshoppingApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.hzq.dragonshopping; 2 | 3 | import com.hzq.dragonshopping.controller.IndexController; 4 | import com.hzq.dragonshopping.entity.ProduceEntity; 5 | import com.hzq.dragonshopping.entity.UserEntity; 6 | import com.hzq.dragonshopping.mapper.UserMapper; 7 | import com.hzq.dragonshopping.service.IUserService; 8 | import com.hzq.dragonshopping.service.UserServiceImpl; 9 | import com.hzq.dragonshopping.untils.JedisUtils; 10 | import org.junit.Test; 11 | import org.junit.runner.RunWith; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.boot.test.context.SpringBootTest; 16 | import org.springframework.test.context.junit4.SpringRunner; 17 | import redis.clients.jedis.Jedis; 18 | 19 | import javax.annotation.Resource; 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | @RunWith(SpringRunner.class) 24 | @SpringBootTest(classes = DragonshoppingApplication.class) 25 | public class DragonshoppingApplicationTests { 26 | private final Logger logger = LoggerFactory.getLogger(IndexController.class); 27 | @Resource 28 | private UserMapper userMapper; 29 | @Autowired 30 | private IUserService userService; 31 | @Resource 32 | private JedisUtils jedisUtils; 33 | 34 | /** 35 | * 检查支付方法 36 | */ 37 | @Test 38 | public void userM() { 39 | UserEntity userEntity = new UserEntity(); 40 | userEntity.setUser_id(1); 41 | ProduceEntity produceEntity = new ProduceEntity(); 42 | produceEntity.setProduce_id(1); 43 | produceEntity.setProduce_count(1); 44 | produceEntity.setProduce_price(100.0); 45 | logger.info("code========"+userService.payProduce(produceEntity,userEntity).get("code").toString()); 46 | // UserEntity userEntity1 = userMapper.selectComparedUserBalanceById(userEntity); 47 | // logger.info(userEntity1.toString()); 48 | } 49 | @Test 50 | public void testRedis(){ 51 | Map userH = new HashMap<>(); 52 | userH.put("name","hzq"); 53 | userH.put("age","10"); 54 | System.out.println(jedisUtils.hmset("user:001",userH)); 55 | System.out.println(jedisUtils.hmget("user:001","name","age")); 56 | } 57 | 58 | } 59 | --------------------------------------------------------------------------------