├── .gitignore ├── README.md ├── ssm-vue ├── .editorconfig ├── .env.development ├── .env.production ├── .env.staging ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .travis.yml ├── LICENSE ├── README-zh.md ├── README.md ├── babel.config.js ├── build │ └── index.js ├── jest.config.js ├── jsconfig.json ├── mock │ ├── index.js │ ├── mock-server.js │ ├── table.js │ └── user.js ├── package.json ├── postcss.config.js ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── App.vue │ ├── api │ │ ├── log.js │ │ ├── order.js │ │ ├── permission.js │ │ ├── product.js │ │ ├── role.js │ │ ├── table.js │ │ └── user.js │ ├── assets │ │ └── 404_images │ │ │ ├── 404.png │ │ │ └── 404_cloud.png │ ├── components │ │ ├── Breadcrumb │ │ │ └── index.vue │ │ ├── Hamburger │ │ │ └── index.vue │ │ ├── Pagination │ │ │ └── index.vue │ │ └── SvgIcon │ │ │ └── index.vue │ ├── icons │ │ ├── index.js │ │ ├── svg │ │ │ ├── component.svg │ │ │ ├── dashboard.svg │ │ │ ├── documentation.svg │ │ │ ├── example.svg │ │ │ ├── eye-open.svg │ │ │ ├── eye.svg │ │ │ ├── form.svg │ │ │ ├── link.svg │ │ │ ├── list.svg │ │ │ ├── lock.svg │ │ │ ├── nested.svg │ │ │ ├── password.svg │ │ │ ├── peoples.svg │ │ │ ├── table.svg │ │ │ ├── tree.svg │ │ │ └── user.svg │ │ └── svgo.yml │ ├── layout │ │ ├── components │ │ │ ├── AppMain.vue │ │ │ ├── Navbar.vue │ │ │ ├── Sidebar │ │ │ │ ├── FixiOSBug.js │ │ │ │ ├── Item.vue │ │ │ │ ├── Link.vue │ │ │ │ ├── Logo.vue │ │ │ │ ├── SidebarItem.vue │ │ │ │ └── index.vue │ │ │ └── index.js │ │ ├── index.vue │ │ └── mixin │ │ │ └── ResizeHandler.js │ ├── main.js │ ├── permission.js │ ├── router │ │ └── index.js │ ├── settings.js │ ├── store │ │ ├── getters.js │ │ ├── index.js │ │ └── modules │ │ │ ├── app.js │ │ │ ├── settings.js │ │ │ └── user.js │ ├── styles │ │ ├── element-ui.scss │ │ ├── index.scss │ │ ├── mixin.scss │ │ ├── sidebar.scss │ │ ├── transition.scss │ │ └── variables.scss │ ├── utils │ │ ├── auth.js │ │ ├── get-page-title.js │ │ ├── index.js │ │ ├── request.js │ │ ├── scroll-to.js │ │ └── validate.js │ └── views │ │ ├── 404.vue │ │ ├── dashboard │ │ └── index.vue │ │ ├── log │ │ └── index.vue │ │ ├── login │ │ └── index.vue │ │ ├── order │ │ ├── detail.vue │ │ ├── edit.vue │ │ └── index.vue │ │ ├── permission │ │ ├── detail.vue │ │ └── index.vue │ │ ├── product │ │ ├── detail.vue │ │ ├── edit.vue │ │ └── index.vue │ │ ├── role │ │ ├── detail.vue │ │ └── index.vue │ │ └── user │ │ ├── detail.vue │ │ └── index.vue ├── tests │ └── unit │ │ ├── .eslintrc.js │ │ ├── components │ │ ├── Breadcrumb.spec.js │ │ ├── Hamburger.spec.js │ │ └── SvgIcon.spec.js │ │ └── utils │ │ ├── formatTime.spec.js │ │ ├── parseTime.spec.js │ │ └── validate.spec.js └── vue.config.js ├── ssm_project.sql └── ssm_project ├── pom.xml ├── ssm_project.iml ├── ssm_project_common ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── com │ │ └── zephon │ │ └── utils │ │ ├── DateUtil.java │ │ ├── JwtUtil.java │ │ └── RedisUtil.java └── target │ ├── classes │ └── META-INF │ │ └── ssm_project_common.kotlin_module │ ├── maven-archiver │ └── pom.properties │ ├── maven-status │ └── maven-compiler-plugin │ │ ├── compile │ │ └── default-compile │ │ │ ├── createdFiles.lst │ │ │ └── inputFiles.lst │ │ └── testCompile │ │ └── default-testCompile │ │ └── inputFiles.lst │ ├── ssm_project_common-1.0-SNAPSHOT.jar │ └── test-classes │ └── META-INF │ └── ssm_project_common.kotlin_module ├── ssm_project_dao ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── com │ │ └── zephon │ │ └── dao │ │ ├── ILogDao.java │ │ ├── IMemberDao.java │ │ ├── IOrderDao.java │ │ ├── IPermissionDao.java │ │ ├── IProductDao.java │ │ ├── IRoleDao.java │ │ ├── ITravellerDao.java │ │ └── IUserDao.java └── target │ ├── maven-archiver │ └── pom.properties │ ├── maven-status │ └── maven-compiler-plugin │ │ ├── compile │ │ └── default-compile │ │ │ ├── createdFiles.lst │ │ │ └── inputFiles.lst │ │ └── testCompile │ │ └── default-testCompile │ │ └── inputFiles.lst │ └── ssm_project_dao-1.0-SNAPSHOT.jar ├── ssm_project_domain ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── com │ │ └── zephon │ │ ├── domain │ │ ├── Member.java │ │ ├── Order.java │ │ ├── Permission.java │ │ ├── Product.java │ │ ├── Role.java │ │ ├── SysLog.java │ │ ├── Traveller.java │ │ └── UserInfo.java │ │ └── entity │ │ ├── JWTToken.java │ │ ├── Result.java │ │ └── ResultCode.java └── target │ ├── maven-archiver │ └── pom.properties │ ├── maven-status │ └── maven-compiler-plugin │ │ ├── compile │ │ └── default-compile │ │ │ ├── createdFiles.lst │ │ │ └── inputFiles.lst │ │ └── testCompile │ │ └── default-testCompile │ │ └── inputFiles.lst │ └── ssm_project_domain-1.0-SNAPSHOT.jar ├── ssm_project_service ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── com │ │ └── zephon │ │ └── service │ │ ├── ILogService.java │ │ ├── IOrderService.java │ │ ├── IPermissionService.java │ │ ├── IProductService.java │ │ ├── IRoleService.java │ │ ├── IUserService.java │ │ └── impl │ │ ├── LogServiceImpl.java │ │ ├── OrderServiceImpl.java │ │ ├── PermissionServiceImpl.java │ │ ├── ProductServiceImpl.java │ │ ├── RoleServiceImpl.java │ │ └── UserServiceImpl.java └── target │ ├── maven-archiver │ └── pom.properties │ ├── maven-status │ └── maven-compiler-plugin │ │ ├── compile │ │ └── default-compile │ │ │ ├── createdFiles.lst │ │ │ └── inputFiles.lst │ │ └── testCompile │ │ └── default-testCompile │ │ └── inputFiles.lst │ └── ssm_project_service-1.0-SNAPSHOT.jar └── ssm_project_web ├── pom.xml ├── src ├── com │ └── zephon │ │ └── log │ │ ├── error.log │ │ └── error.log_2020-03-22.log ├── main │ ├── java │ │ └── com │ │ │ └── zephon │ │ │ ├── aop │ │ │ └── LogAop.java │ │ │ ├── controller │ │ │ ├── LogController.java │ │ │ ├── OrderController.java │ │ │ ├── PermissionController.java │ │ │ ├── ProductController.java │ │ │ ├── RoleController.java │ │ │ └── UserController.java │ │ │ └── shrio │ │ │ └── UserRealm.java │ ├── resources │ │ ├── applicationContext.xml │ │ ├── db.properties │ │ ├── log4j.properties │ │ ├── mybatis-config.xml │ │ ├── redis.properties │ │ ├── spring-mvc.xml │ │ ├── spring-redis.xml │ │ └── spring-shiro.xml │ └── webapp │ │ └── WEB-INF │ │ └── web.xml └── test │ └── java │ └── com │ └── zephon │ └── controller │ └── test │ └── JwtTest.java └── target ├── classes ├── applicationContext.xml ├── db.properties ├── log4j.properties ├── mybatis-config.xml ├── redis.properties ├── spring-mvc.xml ├── spring-redis.xml └── spring-shiro.xml ├── maven-archiver └── pom.properties ├── maven-status └── maven-compiler-plugin │ ├── compile │ └── default-compile │ │ ├── createdFiles.lst │ │ └── inputFiles.lst │ └── testCompile │ └── default-testCompile │ ├── createdFiles.lst │ └── inputFiles.lst └── ssm_project_web-1.0-SNAPSHOT.jar /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | ssm-vue/node_modules/ 3 | ssm-vue/dist/ 4 | ssm-vue/npm-debug.log* 5 | ssm-vue/yarn-debug.log* 6 | ssm-vue/yarn-error.log* 7 | ssm-vue/package-lock.json 8 | ssm-vue/tests/**/coverage/ 9 | ssm_project/out/** 10 | 11 | # Editor directories and files 12 | .idea 13 | .vscode 14 | *.suo 15 | *.ntvs* 16 | *.njsproj 17 | *.sln 18 | *.class 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # README 2 | ## 关于 3 | 这是一个基于vue+ssm的旅游网站后台管理系统,采用前后端分离的模式。 4 | 前端采用vue-element-admin设计,后端使用SSM设计。 5 | ## 技术栈 6 | ### 前端 7 | 基础:HTML5/CSS/JS 8 | 框架:vue+vue-element-admin 9 | ### 后端 10 | 基础:Spring、Spring MVC 11 | ORM:Mybatis 12 | 数据库连接池:Druid 13 | ### 工具 14 | IDEA:IntelliJ IDEA 15 | 项目构建:Maven 16 | ### 环境 17 | - jdk1.8 18 | - tomcat8 19 | ## 主要功能 20 | 1. 登录认证,使用jwt token的形式 21 | 2. 产品管理 22 | 3. 订单管理 23 | 4. 用户管理 24 | 5. 角色管理 25 | 6. 资源权限管理,使用shiro鉴权 26 | 7. 访问日志记录,使用AOP进行日志记录 27 | 8. 使用redis缓存用户登录信息 28 | ## 项目过程中遇到的问题 29 | [https://www.zephon.ml/](https://www.zephon.ml/2020/03/28/%E9%A1%B9%E7%9B%AE%E4%B8%AD%E7%9A%84%E9%97%AE%E9%A2%98/) 30 | -------------------------------------------------------------------------------- /ssm-vue/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | end_of_line = lf 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | insert_final_newline = false 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /ssm-vue/.env.development: -------------------------------------------------------------------------------- 1 | # just a flag 2 | ENV = 'development' 3 | 4 | # base api 5 | # VUE_APP_BASE_API = '/dev-api' 6 | VUE_APP_BASE_API = '' 7 | 8 | 9 | # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, 10 | # to control whether the babel-plugin-dynamic-import-node plugin is enabled. 11 | # It only does one thing by converting all import() to require(). 12 | # This configuration can significantly increase the speed of hot updates, 13 | # when you have a large number of pages. 14 | # Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js 15 | 16 | VUE_CLI_BABEL_TRANSPILE_MODULES = true 17 | -------------------------------------------------------------------------------- /ssm-vue/.env.production: -------------------------------------------------------------------------------- 1 | # just a flag 2 | ENV = 'production' 3 | 4 | # base api 5 | VUE_APP_BASE_API = '/prod-api' 6 | 7 | -------------------------------------------------------------------------------- /ssm-vue/.env.staging: -------------------------------------------------------------------------------- 1 | NODE_ENV = production 2 | 3 | # just a flag 4 | ENV = 'staging' 5 | 6 | # base api 7 | VUE_APP_BASE_API = '/stage-api' 8 | 9 | -------------------------------------------------------------------------------- /ssm-vue/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | src/assets 3 | public 4 | dist 5 | -------------------------------------------------------------------------------- /ssm-vue/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | package-lock.json 8 | tests/**/coverage/ 9 | 10 | # Editor directories and files 11 | .idea 12 | .vscode 13 | *.suo 14 | *.ntvs* 15 | *.njsproj 16 | *.sln 17 | -------------------------------------------------------------------------------- /ssm-vue/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 10 3 | script: npm run test 4 | notifications: 5 | email: false 6 | -------------------------------------------------------------------------------- /ssm-vue/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-present PanJiaChen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ssm-vue/README-zh.md: -------------------------------------------------------------------------------- 1 | # vue-admin-template 2 | 3 | > 这是一个极简的 vue admin 管理后台。它只包含了 Element UI & axios & iconfont & permission control & lint,这些搭建后台必要的东西。 4 | 5 | [线上地址](http://panjiachen.github.io/vue-admin-template) 6 | 7 | [国内访问](https://panjiachen.gitee.io/vue-admin-template) 8 | 9 | 目前版本为 `v4.0+` 基于 `vue-cli` 进行构建,若你想使用旧版本,可以切换分支到[tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0),它不依赖 `vue-cli`。 10 | 11 | ## Extra 12 | 13 | 如果你想要根据用户角色来动态生成侧边栏和 router,你可以使用该分支[permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control) 14 | 15 | ## 相关项目 16 | 17 | - [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) 18 | 19 | - [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin) 20 | 21 | - [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) 22 | 23 | - [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312) 24 | 25 | 写了一个系列的教程配套文章,如何从零构建后一个完整的后台项目: 26 | 27 | - [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2) 28 | - [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac) 29 | - [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35) 30 | - [手摸手,带你用 vue 撸后台 系列四(vueAdmin 一个极简的后台基础模板,专门针对本项目的文章,算作是一篇文档)](https://juejin.im/post/595b4d776fb9a06bbe7dba56) 31 | - [手摸手,带你封装一个 vue component](https://segmentfault.com/a/1190000009090836) 32 | 33 | ## Build Setup 34 | 35 | ```bash 36 | # 克隆项目 37 | git clone https://github.com/PanJiaChen/vue-admin-template.git 38 | 39 | # 进入项目目录 40 | cd vue-admin-template 41 | 42 | # 安装依赖 43 | npm install 44 | 45 | # 建议不要直接使用 cnpm 安装以来,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 46 | npm install --registry=https://registry.npm.taobao.org 47 | 48 | # 启动服务 49 | npm run dev 50 | ``` 51 | 52 | 浏览器访问 [http://localhost:9528](http://localhost:9528) 53 | 54 | ## 发布 55 | 56 | ```bash 57 | # 构建测试环境 58 | npm run build:stage 59 | 60 | # 构建生产环境 61 | npm run build:prod 62 | ``` 63 | 64 | ## 其它 65 | 66 | ```bash 67 | # 预览发布环境效果 68 | npm run preview 69 | 70 | # 预览发布环境效果 + 静态资源分析 71 | npm run preview -- --report 72 | 73 | # 代码格式检查 74 | npm run lint 75 | 76 | # 代码格式检查并自动修复 77 | npm run lint -- --fix 78 | ``` 79 | 80 | 更多信息请参考 [使用文档](https://panjiachen.github.io/vue-element-admin-site/zh/) 81 | 82 | ## Demo 83 | 84 | ![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif) 85 | 86 | ## Browsers support 87 | 88 | Modern browsers and Internet Explorer 10+. 89 | 90 | | [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | 91 | | --------- | --------- | --------- | --------- | 92 | | IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions 93 | 94 | ## License 95 | 96 | [MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license. 97 | 98 | Copyright (c) 2017-present PanJiaChen 99 | -------------------------------------------------------------------------------- /ssm-vue/README.md: -------------------------------------------------------------------------------- 1 | # vue-admin-template 2 | 3 | English | [简体中文](./README-zh.md) 4 | 5 | > A minimal vue admin template with Element UI & axios & iconfont & permission control & lint 6 | 7 | **Live demo:** http://panjiachen.github.io/vue-admin-template 8 | 9 | 10 | **The current version is `v4.0+` build on `vue-cli`. If you want to use the old version , you can switch branch to [tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0), it does not rely on `vue-cli`** 11 | 12 | ## Build Setup 13 | 14 | 15 | ```bash 16 | # clone the project 17 | git clone https://github.com/PanJiaChen/vue-admin-template.git 18 | 19 | # enter the project directory 20 | cd vue-admin-template 21 | 22 | # install dependency 23 | npm install 24 | 25 | # develop 26 | npm run dev 27 | ``` 28 | 29 | This will automatically open http://localhost:9528 30 | 31 | ## Build 32 | 33 | ```bash 34 | # build for test environment 35 | npm run build:stage 36 | 37 | # build for production environment 38 | npm run build:prod 39 | ``` 40 | 41 | ## Advanced 42 | 43 | ```bash 44 | # preview the release environment effect 45 | npm run preview 46 | 47 | # preview the release environment effect + static resource analysis 48 | npm run preview -- --report 49 | 50 | # code format check 51 | npm run lint 52 | 53 | # code format check and auto fix 54 | npm run lint -- --fix 55 | ``` 56 | 57 | Refer to [Documentation](https://panjiachen.github.io/vue-element-admin-site/guide/essentials/deploy.html) for more information 58 | 59 | ## Demo 60 | 61 | ![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif) 62 | 63 | ## Extra 64 | 65 | If you want router permission && generate menu by user roles , you can use this branch [permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control) 66 | 67 | For `typescript` version, you can use [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Credits: [@Armour](https://github.com/Armour)) 68 | 69 | ## Related Project 70 | 71 | - [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) 72 | 73 | - [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin) 74 | 75 | - [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) 76 | 77 | - [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312) 78 | 79 | ## Browsers support 80 | 81 | Modern browsers and Internet Explorer 10+. 82 | 83 | | [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | 84 | | --------- | --------- | --------- | --------- | 85 | | IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions 86 | 87 | ## License 88 | 89 | [MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license. 90 | 91 | Copyright (c) 2017-present PanJiaChen 92 | -------------------------------------------------------------------------------- /ssm-vue/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /ssm-vue/build/index.js: -------------------------------------------------------------------------------- 1 | const { run } = require('runjs') 2 | const chalk = require('chalk') 3 | const config = require('../vue.config.js') 4 | const rawArgv = process.argv.slice(2) 5 | const args = rawArgv.join(' ') 6 | 7 | if (process.env.npm_config_preview || rawArgv.includes('--preview')) { 8 | const report = rawArgv.includes('--report') 9 | 10 | run(`vue-cli-service build ${args}`) 11 | 12 | const port = 9526 13 | const publicPath = config.publicPath 14 | 15 | var connect = require('connect') 16 | var serveStatic = require('serve-static') 17 | const app = connect() 18 | 19 | app.use( 20 | publicPath, 21 | serveStatic('./dist', { 22 | index: ['index.html', '/'] 23 | }) 24 | ) 25 | 26 | app.listen(port, function () { 27 | console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`)) 28 | if (report) { 29 | console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`)) 30 | } 31 | 32 | }) 33 | } else { 34 | run(`vue-cli-service build ${args}`) 35 | } 36 | -------------------------------------------------------------------------------- /ssm-vue/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], 3 | transform: { 4 | '^.+\\.vue$': 'vue-jest', 5 | '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 6 | 'jest-transform-stub', 7 | '^.+\\.jsx?$': 'babel-jest' 8 | }, 9 | moduleNameMapper: { 10 | '^@/(.*)$': '/src/$1' 11 | }, 12 | snapshotSerializers: ['jest-serializer-vue'], 13 | testMatch: [ 14 | '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' 15 | ], 16 | collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'], 17 | coverageDirectory: '/tests/unit/coverage', 18 | // 'collectCoverage': true, 19 | 'coverageReporters': [ 20 | 'lcov', 21 | 'text-summary' 22 | ], 23 | testURL: 'http://localhost/' 24 | } 25 | -------------------------------------------------------------------------------- /ssm-vue/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "paths": { 5 | "@/*": ["src/*"] 6 | } 7 | }, 8 | "exclude": ["node_modules", "dist"] 9 | } 10 | -------------------------------------------------------------------------------- /ssm-vue/mock/index.js: -------------------------------------------------------------------------------- 1 | import Mock from 'mockjs' 2 | import { param2Obj } from '../src/utils' 3 | 4 | import user from './user' 5 | import table from './table' 6 | 7 | const mocks = [ 8 | ...user, 9 | ...table 10 | ] 11 | 12 | // for front mock 13 | // please use it cautiously, it will redefine XMLHttpRequest, 14 | // which will cause many of your third-party libraries to be invalidated(like progress event). 15 | export function mockXHR() { 16 | // mock patch 17 | // https://github.com/nuysoft/Mock/issues/300 18 | Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send 19 | Mock.XHR.prototype.send = function() { 20 | if (this.custom.xhr) { 21 | this.custom.xhr.withCredentials = this.withCredentials || false 22 | 23 | if (this.responseType) { 24 | this.custom.xhr.responseType = this.responseType 25 | } 26 | } 27 | this.proxy_send(...arguments) 28 | } 29 | 30 | function XHR2ExpressReqWrap(respond) { 31 | return function(options) { 32 | let result = null 33 | if (respond instanceof Function) { 34 | const { body, type, url } = options 35 | // https://expressjs.com/en/4x/api.html#req 36 | result = respond({ 37 | method: type, 38 | body: JSON.parse(body), 39 | query: param2Obj(url) 40 | }) 41 | } else { 42 | result = respond 43 | } 44 | return Mock.mock(result) 45 | } 46 | } 47 | 48 | for (const i of mocks) { 49 | Mock.mock(new RegExp(i.url), i.type || 'get', XHR2ExpressReqWrap(i.response)) 50 | } 51 | } 52 | 53 | // for mock server 54 | const responseFake = (url, type, respond) => { 55 | return { 56 | url: new RegExp(`/mock${url}`), 57 | type: type || 'get', 58 | response(req, res) { 59 | res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond)) 60 | } 61 | } 62 | } 63 | 64 | export default mocks.map(route => { 65 | return responseFake(route.url, route.type, route.response) 66 | }) 67 | -------------------------------------------------------------------------------- /ssm-vue/mock/mock-server.js: -------------------------------------------------------------------------------- 1 | const chokidar = require('chokidar') 2 | const bodyParser = require('body-parser') 3 | const chalk = require('chalk') 4 | const path = require('path') 5 | 6 | const mockDir = path.join(process.cwd(), 'mock') 7 | 8 | function registerRoutes(app) { 9 | let mockLastIndex 10 | const { default: mocks } = require('./index.js') 11 | for (const mock of mocks) { 12 | app[mock.type](mock.url, mock.response) 13 | mockLastIndex = app._router.stack.length 14 | } 15 | const mockRoutesLength = Object.keys(mocks).length 16 | return { 17 | mockRoutesLength: mockRoutesLength, 18 | mockStartIndex: mockLastIndex - mockRoutesLength 19 | } 20 | } 21 | 22 | function unregisterRoutes() { 23 | Object.keys(require.cache).forEach(i => { 24 | if (i.includes(mockDir)) { 25 | delete require.cache[require.resolve(i)] 26 | } 27 | }) 28 | } 29 | 30 | module.exports = app => { 31 | // es6 polyfill 32 | require('@babel/register') 33 | 34 | // parse app.body 35 | // https://expressjs.com/en/4x/api.html#req.body 36 | app.use(bodyParser.json()) 37 | app.use(bodyParser.urlencoded({ 38 | extended: true 39 | })) 40 | 41 | const mockRoutes = registerRoutes(app) 42 | var mockRoutesLength = mockRoutes.mockRoutesLength 43 | var mockStartIndex = mockRoutes.mockStartIndex 44 | 45 | // watch files, hot reload mock server 46 | chokidar.watch(mockDir, { 47 | ignored: /mock-server/, 48 | ignoreInitial: true 49 | }).on('all', (event, path) => { 50 | if (event === 'change' || event === 'add') { 51 | try { 52 | // remove mock routes stack 53 | app._router.stack.splice(mockStartIndex, mockRoutesLength) 54 | 55 | // clear routes cache 56 | unregisterRoutes() 57 | 58 | const mockRoutes = registerRoutes(app) 59 | mockRoutesLength = mockRoutes.mockRoutesLength 60 | mockStartIndex = mockRoutes.mockStartIndex 61 | 62 | console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`)) 63 | } catch (error) { 64 | console.log(chalk.redBright(error)) 65 | } 66 | } 67 | }) 68 | } 69 | -------------------------------------------------------------------------------- /ssm-vue/mock/table.js: -------------------------------------------------------------------------------- 1 | import Mock from 'mockjs' 2 | 3 | const data = Mock.mock({ 4 | 'items|30': [{ 5 | id: '@id', 6 | title: '@sentence(10, 20)', 7 | 'status|1': ['published', 'draft', 'deleted'], 8 | author: 'name', 9 | display_time: '@datetime', 10 | pageviews: '@integer(300, 5000)' 11 | }] 12 | }) 13 | 14 | export default [ 15 | { 16 | url: '/user/list', 17 | type: 'get', 18 | response: config => { 19 | const items = data.items 20 | return { 21 | code: 20000, 22 | data: { 23 | total: items.length, 24 | items: items 25 | } 26 | } 27 | } 28 | } 29 | ] 30 | -------------------------------------------------------------------------------- /ssm-vue/mock/user.js: -------------------------------------------------------------------------------- 1 | 2 | const tokens = { 3 | admin: { 4 | token: 'admin-token' 5 | }, 6 | editor: { 7 | token: 'editor-token' 8 | } 9 | } 10 | 11 | const users = { 12 | 'admin-token': { 13 | roles: ['admin'], 14 | introduction: 'I am a super administrator', 15 | avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', 16 | name: 'Super Admin' 17 | }, 18 | 'editor-token': { 19 | roles: ['editor'], 20 | introduction: 'I am an editor', 21 | avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', 22 | name: 'Normal Editor' 23 | } 24 | } 25 | 26 | export default [ 27 | // user login 28 | { 29 | url: '/user/login', 30 | type: 'post', 31 | response: config => { 32 | const { username } = config.body 33 | const token = tokens[username] 34 | 35 | // mock error 36 | if (!token) { 37 | return { 38 | code: 60204, 39 | message: 'Account and password are incorrect.' 40 | } 41 | } 42 | 43 | return { 44 | code: 10000, 45 | data: token 46 | } 47 | } 48 | }, 49 | 50 | // get user info 51 | { 52 | url: '/user/info\.*', 53 | type: 'get', 54 | response: config => { 55 | const { token } = config.query 56 | const info = users[token] 57 | 58 | // mock error 59 | if (!info) { 60 | return { 61 | code: 50008, 62 | message: 'Login failed, unable to get user details.' 63 | } 64 | } 65 | 66 | return { 67 | code: 10000, 68 | data: info 69 | } 70 | } 71 | }, 72 | 73 | // user logout 74 | { 75 | url: '/user/logout', 76 | type: 'post', 77 | response: _ => { 78 | return { 79 | code: 20000, 80 | data: 'success' 81 | } 82 | } 83 | } 84 | ] 85 | -------------------------------------------------------------------------------- /ssm-vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-admin-template", 3 | "version": "4.2.1", 4 | "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint", 5 | "author": "Pan ", 6 | "license": "MIT", 7 | "scripts": { 8 | "dev": "vue-cli-service serve", 9 | "build:prod": "vue-cli-service build", 10 | "build:stage": "vue-cli-service build --mode staging", 11 | "preview": "node build/index.js --preview", 12 | "lint": "eslint --ext .js,.vue src", 13 | "test:unit": "jest --clearCache && vue-cli-service test:unit", 14 | "test:ci": "npm run lint && npm run test:unit", 15 | "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" 16 | }, 17 | "dependencies": { 18 | "axios": "0.18.1", 19 | "element-ui": "2.7.2", 20 | "js-cookie": "2.2.0", 21 | "normalize.css": "7.0.0", 22 | "nprogress": "0.2.0", 23 | "path-to-regexp": "2.4.0", 24 | "vue": "2.6.10", 25 | "vue-router": "3.0.6", 26 | "vuex": "3.1.0" 27 | }, 28 | "devDependencies": { 29 | "@babel/core": "7.0.0", 30 | "@babel/register": "7.0.0", 31 | "@vue/cli-plugin-babel": "3.6.0", 32 | "@vue/cli-plugin-eslint": "^3.9.1", 33 | "@vue/cli-plugin-unit-jest": "3.6.3", 34 | "@vue/cli-service": "3.6.0", 35 | "@vue/test-utils": "1.0.0-beta.29", 36 | "autoprefixer": "^9.5.1", 37 | "babel-core": "7.0.0-bridge.0", 38 | "babel-eslint": "10.0.1", 39 | "babel-jest": "23.6.0", 40 | "chalk": "2.4.2", 41 | "connect": "3.6.6", 42 | "eslint": "5.15.3", 43 | "eslint-plugin-vue": "5.2.2", 44 | "html-webpack-plugin": "3.2.0", 45 | "mockjs": "1.0.1-beta3", 46 | "node-sass": "^4.9.0", 47 | "runjs": "^4.3.2", 48 | "sass-loader": "^7.1.0", 49 | "script-ext-html-webpack-plugin": "2.1.3", 50 | "script-loader": "0.7.2", 51 | "serve-static": "^1.13.2", 52 | "svg-sprite-loader": "4.1.3", 53 | "svgo": "1.2.2", 54 | "vue-template-compiler": "2.6.10" 55 | }, 56 | "engines": { 57 | "node": ">=8.9", 58 | "npm": ">= 3.0.0" 59 | }, 60 | "browserslist": [ 61 | "> 1%", 62 | "last 2 versions" 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /ssm-vue/postcss.config.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | 'plugins': { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | 'autoprefixer': {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ssm-vue/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm-vue/public/favicon.ico -------------------------------------------------------------------------------- /ssm-vue/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= webpackConfig.name %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ssm-vue/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /ssm-vue/src/api/log.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function getPageList(params) { 4 | return request({ 5 | url: '/ssm/logs', 6 | method: 'get', 7 | params 8 | }) 9 | } 10 | -------------------------------------------------------------------------------- /ssm-vue/src/api/order.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function getPageList(params) { 4 | return request({ 5 | url: '/ssm/orders', 6 | method: 'get', 7 | params 8 | }) 9 | } 10 | 11 | export function addOrder(data) { 12 | return request({ 13 | url: '/ssm/order', 14 | method: 'post', 15 | data 16 | }) 17 | } 18 | export function getOrderDetail(param) { 19 | return request({ 20 | url: '/ssm/order/' + param, 21 | method: 'get' 22 | }) 23 | } 24 | 25 | export function updateOrder(data) { 26 | return request({ 27 | url: '/ssm/order', 28 | method: 'put', 29 | data 30 | }) 31 | } 32 | -------------------------------------------------------------------------------- /ssm-vue/src/api/permission.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function getPageList(params) { 4 | return request({ 5 | url: '/ssm/permissions', 6 | method: 'get', 7 | params 8 | }) 9 | } 10 | 11 | export function addPermission(data) { 12 | return request({ 13 | url: '/ssm/permission', 14 | method: 'post', 15 | data 16 | }) 17 | } 18 | export function getPermissionDetail(param) { 19 | return request({ 20 | url: '/ssm/permission/' + param, 21 | method: 'get' 22 | }) 23 | } 24 | 25 | export function deletePermission(param) { 26 | return request({ 27 | url: '/ssm/permission/' + param, 28 | method: 'delete' 29 | }) 30 | } 31 | -------------------------------------------------------------------------------- /ssm-vue/src/api/product.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function getPageList(params) { 4 | return request({ 5 | url: '/ssm/products', 6 | method: 'get', 7 | params 8 | }) 9 | } 10 | 11 | export function addProduct(data) { 12 | return request({ 13 | url: '/ssm/product', 14 | method: 'post', 15 | data 16 | }) 17 | } 18 | 19 | export function getProductDetail(param) { 20 | return request({ 21 | url: '/ssm/product/' + param, 22 | method: 'get' 23 | }) 24 | } 25 | 26 | export function updateProduct(data) { 27 | return request({ 28 | url: '/ssm/product', 29 | method: 'put', 30 | data 31 | }) 32 | } 33 | -------------------------------------------------------------------------------- /ssm-vue/src/api/role.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function getPageList(params) { 4 | return request({ 5 | url: '/ssm/roles', 6 | method: 'get', 7 | params 8 | }) 9 | } 10 | 11 | export function addRole(data) { 12 | return request({ 13 | url: '/ssm/role', 14 | method: 'post', 15 | data 16 | }) 17 | } 18 | export function getRoleDetail(param) { 19 | return request({ 20 | url: '/ssm/role/' + param, 21 | method: 'get' 22 | }) 23 | } 24 | export function getOtherPermission(param) { 25 | return request({ 26 | url: '/ssm/role/permission/' + param, 27 | method: 'get' 28 | }) 29 | } 30 | 31 | export function addOtherPermission(params) { 32 | return request({ 33 | url: '/ssm/role/permission', 34 | method: 'get', 35 | params 36 | }) 37 | } 38 | export function deleteRole(param) { 39 | return request({ 40 | url: '/ssm/role/' + param, 41 | method: 'delete' 42 | }) 43 | } 44 | -------------------------------------------------------------------------------- /ssm-vue/src/api/table.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function getList(params) { 4 | return request({ 5 | url: '/user/list', 6 | method: 'get', 7 | params 8 | }) 9 | } 10 | -------------------------------------------------------------------------------- /ssm-vue/src/api/user.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function login(data) { 4 | return request({ 5 | url: '/ssm/user/login', 6 | method: 'post', 7 | data 8 | }) 9 | } 10 | 11 | export function getInfo(token) { 12 | return request({ 13 | url: '/ssm/user/info', 14 | method: 'get', 15 | params: { token } 16 | }) 17 | } 18 | 19 | export function logout() { 20 | return request({ 21 | url: '/ssm/user/logout', 22 | method: 'post' 23 | }) 24 | } 25 | 26 | export function getList(params) { 27 | return request({ 28 | url: '/ssm/users', 29 | method: 'get', 30 | params 31 | }) 32 | } 33 | 34 | export function getPageList(params) { 35 | return request({ 36 | url: '/ssm/users', 37 | method: 'get', 38 | params 39 | }) 40 | } 41 | 42 | export function addUser(data) { 43 | return request({ 44 | url: '/ssm/user', 45 | method: 'post', 46 | data 47 | }) 48 | } 49 | 50 | export function getUserDetail(param) { 51 | return request({ 52 | url: '/ssm/user/' + param, 53 | method: 'get' 54 | }) 55 | } 56 | 57 | export function getOtherRoles(param) { 58 | return request({ 59 | url: '/ssm/user/role/' + param, 60 | method: 'get' 61 | }) 62 | } 63 | 64 | export function addOtherRole(params) { 65 | return request({ 66 | url: '/ssm/user/role', 67 | method: 'get', 68 | params 69 | }) 70 | } 71 | -------------------------------------------------------------------------------- /ssm-vue/src/assets/404_images/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm-vue/src/assets/404_images/404.png -------------------------------------------------------------------------------- /ssm-vue/src/assets/404_images/404_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm-vue/src/assets/404_images/404_cloud.png -------------------------------------------------------------------------------- /ssm-vue/src/components/Breadcrumb/index.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 65 | 66 | 79 | -------------------------------------------------------------------------------- /ssm-vue/src/components/Hamburger/index.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 32 | 33 | 45 | -------------------------------------------------------------------------------- /ssm-vue/src/components/Pagination/index.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 91 | 92 | 101 | -------------------------------------------------------------------------------- /ssm-vue/src/components/SvgIcon/index.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 47 | 48 | 63 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import SvgIcon from '@/components/SvgIcon'// svg component 3 | 4 | // register globally 5 | Vue.component('svg-icon', SvgIcon) 6 | 7 | const req = require.context('./svg', false, /\.svg$/) 8 | const requireAll = requireContext => requireContext.keys().map(requireContext) 9 | requireAll(req) 10 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/component.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/dashboard.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/documentation.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/example.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/eye-open.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/eye.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/form.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/link.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/list.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/lock.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/nested.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/password.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/peoples.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/table.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/tree.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svg/user.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ssm-vue/src/icons/svgo.yml: -------------------------------------------------------------------------------- 1 | # replace default config 2 | 3 | # multipass: true 4 | # full: true 5 | 6 | plugins: 7 | 8 | # - name 9 | # 10 | # or: 11 | # - name: false 12 | # - name: true 13 | # 14 | # or: 15 | # - name: 16 | # param1: 1 17 | # param2: 2 18 | 19 | - removeAttrs: 20 | attrs: 21 | - 'fill' 22 | - 'fill-rule' 23 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/components/AppMain.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 19 | 20 | 32 | 33 | 41 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/components/Sidebar/FixiOSBug.js: -------------------------------------------------------------------------------- 1 | export default { 2 | computed: { 3 | device() { 4 | return this.$store.state.app.device 5 | } 6 | }, 7 | mounted() { 8 | // In order to fix the click on menu on the ios device will trigger the mouseleave bug 9 | // https://github.com/PanJiaChen/vue-element-admin/issues/1135 10 | this.fixBugIniOS() 11 | }, 12 | methods: { 13 | fixBugIniOS() { 14 | const $subMenu = this.$refs.subMenu 15 | if ($subMenu) { 16 | const handleMouseleave = $subMenu.handleMouseleave 17 | $subMenu.handleMouseleave = (e) => { 18 | if (this.device === 'mobile') { 19 | return 20 | } 21 | handleMouseleave(e) 22 | } 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/components/Sidebar/Item.vue: -------------------------------------------------------------------------------- 1 | 30 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/components/Sidebar/Link.vue: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 37 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/components/Sidebar/Logo.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 33 | 34 | 83 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/components/Sidebar/SidebarItem.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 96 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/components/Sidebar/index.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 57 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/components/index.js: -------------------------------------------------------------------------------- 1 | export { default as Navbar } from './Navbar' 2 | export { default as Sidebar } from './Sidebar' 3 | export { default as AppMain } from './AppMain' 4 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 52 | 53 | 94 | -------------------------------------------------------------------------------- /ssm-vue/src/layout/mixin/ResizeHandler.js: -------------------------------------------------------------------------------- 1 | import store from '@/store' 2 | 3 | const { body } = document 4 | const WIDTH = 992 // refer to Bootstrap's responsive design 5 | 6 | export default { 7 | watch: { 8 | $route(route) { 9 | if (this.device === 'mobile' && this.sidebar.opened) { 10 | store.dispatch('app/closeSideBar', { withoutAnimation: false }) 11 | } 12 | } 13 | }, 14 | beforeMount() { 15 | window.addEventListener('resize', this.$_resizeHandler) 16 | }, 17 | beforeDestroy() { 18 | window.removeEventListener('resize', this.$_resizeHandler) 19 | }, 20 | mounted() { 21 | const isMobile = this.$_isMobile() 22 | if (isMobile) { 23 | store.dispatch('app/toggleDevice', 'mobile') 24 | store.dispatch('app/closeSideBar', { withoutAnimation: true }) 25 | } 26 | }, 27 | methods: { 28 | // use $_ for mixins properties 29 | // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential 30 | $_isMobile() { 31 | const rect = body.getBoundingClientRect() 32 | return rect.width - 1 < WIDTH 33 | }, 34 | $_resizeHandler() { 35 | if (!document.hidden) { 36 | const isMobile = this.$_isMobile() 37 | store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop') 38 | 39 | if (isMobile) { 40 | store.dispatch('app/closeSideBar', { withoutAnimation: true }) 41 | } 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ssm-vue/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | import 'normalize.css/normalize.css' // A modern alternative to CSS resets 4 | 5 | import ElementUI from 'element-ui' 6 | import 'element-ui/lib/theme-chalk/index.css' 7 | import locale from 'element-ui/lib/locale/lang/en' // lang i18n 8 | 9 | import '@/styles/index.scss' // global css 10 | 11 | import App from './App' 12 | import store from './store' 13 | import router from './router' 14 | 15 | import '@/icons' // icon 16 | import '@/permission' // permission control 17 | 18 | /** 19 | * If you don't want to use mock-server 20 | * you want to use MockJs for mock api 21 | * you can execute: mockXHR() 22 | * 23 | * Currently MockJs will be used in the production environment, 24 | * please remove it before going online! ! ! 25 | */ 26 | import { mockXHR } from '../mock' 27 | if (process.env.NODE_ENV === 'production') { 28 | mockXHR() 29 | } 30 | 31 | // set ElementUI lang to EN 32 | Vue.use(ElementUI, { locale }) 33 | // 如果想要中文版 element-ui,按如下方式声明 34 | // Vue.use(ElementUI) 35 | 36 | Vue.config.productionTip = false 37 | 38 | new Vue({ 39 | el: '#app', 40 | router, 41 | store, 42 | render: h => h(App) 43 | }) 44 | -------------------------------------------------------------------------------- /ssm-vue/src/permission.js: -------------------------------------------------------------------------------- 1 | import router from './router' 2 | import store from './store' 3 | import { Message } from 'element-ui' 4 | import NProgress from 'nprogress' // progress bar 5 | import 'nprogress/nprogress.css' // progress bar style 6 | import { getToken } from '@/utils/auth' // get token from cookie 7 | import getPageTitle from '@/utils/get-page-title' 8 | 9 | NProgress.configure({ showSpinner: false }) // NProgress Configuration 10 | 11 | const whiteList = ['/login'] // no redirect whitelist 12 | 13 | router.beforeEach(async(to, from, next) => { 14 | // start progress bar 15 | NProgress.start() 16 | 17 | // set page title 18 | document.title = getPageTitle(to.meta.title) 19 | 20 | // determine whether the user has logged in 21 | const hasToken = getToken() 22 | 23 | if (hasToken) { 24 | if (to.path === '/login') { 25 | // if is logged in, redirect to the home page 26 | next({ path: '/' }) 27 | NProgress.done() 28 | } else { 29 | const hasGetUserInfo = store.getters.name 30 | if (hasGetUserInfo) { 31 | next() 32 | } else { 33 | try { 34 | // get user info 35 | await store.dispatch('user/getInfo') 36 | 37 | next() 38 | } catch (error) { 39 | // remove token and go to login page to re-login 40 | await store.dispatch('user/resetToken') 41 | Message.error(error || 'Has Error') 42 | next(`/login?redirect=${to.path}`) 43 | NProgress.done() 44 | } 45 | } 46 | } 47 | } else { 48 | /* has no token*/ 49 | 50 | if (whiteList.indexOf(to.path) !== -1) { 51 | // in the free login whitelist, go directly 52 | next() 53 | } else { 54 | // other pages that do not have permission to access are redirected to the login page. 55 | next(`/login?redirect=${to.path}`) 56 | NProgress.done() 57 | } 58 | } 59 | }) 60 | 61 | router.afterEach(() => { 62 | // finish progress bar 63 | NProgress.done() 64 | }) 65 | -------------------------------------------------------------------------------- /ssm-vue/src/settings.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | title: 'Vue Admin Template', 4 | 5 | /** 6 | * @type {boolean} true | false 7 | * @description Whether fix the header 8 | */ 9 | fixedHeader: false, 10 | 11 | /** 12 | * @type {boolean} true | false 13 | * @description Whether show the logo in sidebar 14 | */ 15 | sidebarLogo: false 16 | } 17 | -------------------------------------------------------------------------------- /ssm-vue/src/store/getters.js: -------------------------------------------------------------------------------- 1 | const getters = { 2 | sidebar: state => state.app.sidebar, 3 | device: state => state.app.device, 4 | token: state => state.user.token, 5 | avatar: state => state.user.avatar, 6 | name: state => state.user.name 7 | } 8 | export default getters 9 | -------------------------------------------------------------------------------- /ssm-vue/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import getters from './getters' 4 | import app from './modules/app' 5 | import settings from './modules/settings' 6 | import user from './modules/user' 7 | 8 | Vue.use(Vuex) 9 | 10 | const store = new Vuex.Store({ 11 | modules: { 12 | app, 13 | settings, 14 | user 15 | }, 16 | getters 17 | }) 18 | 19 | export default store 20 | -------------------------------------------------------------------------------- /ssm-vue/src/store/modules/app.js: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie' 2 | 3 | const state = { 4 | sidebar: { 5 | opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, 6 | withoutAnimation: false 7 | }, 8 | device: 'desktop' 9 | } 10 | 11 | const mutations = { 12 | TOGGLE_SIDEBAR: state => { 13 | state.sidebar.opened = !state.sidebar.opened 14 | state.sidebar.withoutAnimation = false 15 | if (state.sidebar.opened) { 16 | Cookies.set('sidebarStatus', 1) 17 | } else { 18 | Cookies.set('sidebarStatus', 0) 19 | } 20 | }, 21 | CLOSE_SIDEBAR: (state, withoutAnimation) => { 22 | Cookies.set('sidebarStatus', 0) 23 | state.sidebar.opened = false 24 | state.sidebar.withoutAnimation = withoutAnimation 25 | }, 26 | TOGGLE_DEVICE: (state, device) => { 27 | state.device = device 28 | } 29 | } 30 | 31 | const actions = { 32 | toggleSideBar({ commit }) { 33 | commit('TOGGLE_SIDEBAR') 34 | }, 35 | closeSideBar({ commit }, { withoutAnimation }) { 36 | commit('CLOSE_SIDEBAR', withoutAnimation) 37 | }, 38 | toggleDevice({ commit }, device) { 39 | commit('TOGGLE_DEVICE', device) 40 | } 41 | } 42 | 43 | export default { 44 | namespaced: true, 45 | state, 46 | mutations, 47 | actions 48 | } 49 | -------------------------------------------------------------------------------- /ssm-vue/src/store/modules/settings.js: -------------------------------------------------------------------------------- 1 | import defaultSettings from '@/settings' 2 | 3 | const { showSettings, fixedHeader, sidebarLogo } = defaultSettings 4 | 5 | const state = { 6 | showSettings: showSettings, 7 | fixedHeader: fixedHeader, 8 | sidebarLogo: sidebarLogo 9 | } 10 | 11 | const mutations = { 12 | CHANGE_SETTING: (state, { key, value }) => { 13 | if (state.hasOwnProperty(key)) { 14 | state[key] = value 15 | } 16 | } 17 | } 18 | 19 | const actions = { 20 | changeSetting({ commit }, data) { 21 | commit('CHANGE_SETTING', data) 22 | } 23 | } 24 | 25 | export default { 26 | namespaced: true, 27 | state, 28 | mutations, 29 | actions 30 | } 31 | 32 | -------------------------------------------------------------------------------- /ssm-vue/src/store/modules/user.js: -------------------------------------------------------------------------------- 1 | import { login, logout, getInfo } from '@/api/user' 2 | import { getToken, setToken, removeToken } from '@/utils/auth' 3 | import { resetRouter } from '@/router' 4 | 5 | const state = { 6 | token: getToken(), 7 | name: '', 8 | avatar: '' 9 | } 10 | 11 | const mutations = { 12 | SET_TOKEN: (state, token) => { 13 | state.token = token 14 | }, 15 | SET_NAME: (state, name) => { 16 | state.name = name 17 | }, 18 | SET_AVATAR: (state, avatar) => { 19 | state.avatar = avatar 20 | } 21 | } 22 | 23 | const actions = { 24 | // user login 25 | login({ commit }, userInfo) { 26 | const { username, password } = userInfo 27 | return new Promise((resolve, reject) => { 28 | login({ username: username.trim(), password: password }).then(response => { 29 | const { data } = response 30 | commit('SET_TOKEN', data.token) 31 | setToken(data.token) 32 | resolve() 33 | }).catch(error => { 34 | reject(error) 35 | }) 36 | }) 37 | }, 38 | 39 | // get user info 40 | getInfo({ commit, state }) { 41 | return new Promise((resolve, reject) => { 42 | getInfo(state.token).then(response => { 43 | const { data } = response 44 | 45 | if (!data) { 46 | reject('Verification failed, please Login again.') 47 | } 48 | 49 | const { username, avatar } = data 50 | 51 | commit('SET_NAME', username) 52 | commit('SET_AVATAR', avatar) 53 | resolve(data) 54 | }).catch(error => { 55 | reject(error) 56 | }) 57 | }) 58 | }, 59 | 60 | // user logout 61 | logout({ commit, state }) { 62 | return new Promise((resolve, reject) => { 63 | logout(state.token).then(() => { 64 | commit('SET_TOKEN', '') 65 | removeToken() 66 | resetRouter() 67 | resolve() 68 | }).catch(error => { 69 | reject(error) 70 | }) 71 | }) 72 | }, 73 | 74 | // remove token 75 | resetToken({ commit }) { 76 | return new Promise(resolve => { 77 | commit('SET_TOKEN', '') 78 | removeToken() 79 | resolve() 80 | }) 81 | } 82 | } 83 | 84 | export default { 85 | namespaced: true, 86 | state, 87 | mutations, 88 | actions 89 | } 90 | 91 | -------------------------------------------------------------------------------- /ssm-vue/src/styles/element-ui.scss: -------------------------------------------------------------------------------- 1 | // cover some element-ui styles 2 | 3 | .el-breadcrumb__inner, 4 | .el-breadcrumb__inner a { 5 | font-weight: 400 !important; 6 | } 7 | 8 | .el-upload { 9 | input[type="file"] { 10 | display: none !important; 11 | } 12 | } 13 | 14 | .el-upload__input { 15 | display: none; 16 | } 17 | 18 | 19 | // to fixed https://github.com/ElemeFE/element/issues/2461 20 | .el-dialog { 21 | transform: none; 22 | left: 0; 23 | position: relative; 24 | margin: 0 auto; 25 | } 26 | 27 | // refine element ui upload 28 | .upload-container { 29 | .el-upload { 30 | width: 100%; 31 | 32 | .el-upload-dragger { 33 | width: 100%; 34 | height: 200px; 35 | } 36 | } 37 | } 38 | 39 | // dropdown 40 | .el-dropdown-menu { 41 | a { 42 | display: block 43 | } 44 | } 45 | 46 | // to fix el-date-picker css style 47 | .el-range-separator { 48 | box-sizing: content-box; 49 | } 50 | -------------------------------------------------------------------------------- /ssm-vue/src/styles/index.scss: -------------------------------------------------------------------------------- 1 | @import './variables.scss'; 2 | @import './mixin.scss'; 3 | @import './transition.scss'; 4 | @import './element-ui.scss'; 5 | @import './sidebar.scss'; 6 | 7 | body { 8 | height: 100%; 9 | -moz-osx-font-smoothing: grayscale; 10 | -webkit-font-smoothing: antialiased; 11 | text-rendering: optimizeLegibility; 12 | font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; 13 | } 14 | 15 | label { 16 | font-weight: 700; 17 | } 18 | 19 | html { 20 | height: 100%; 21 | box-sizing: border-box; 22 | } 23 | 24 | #app { 25 | height: 100%; 26 | } 27 | 28 | *, 29 | *:before, 30 | *:after { 31 | box-sizing: inherit; 32 | } 33 | 34 | a:focus, 35 | a:active { 36 | outline: none; 37 | } 38 | 39 | a, 40 | a:focus, 41 | a:hover { 42 | cursor: pointer; 43 | color: inherit; 44 | text-decoration: none; 45 | } 46 | 47 | div:focus { 48 | outline: none; 49 | } 50 | 51 | .clearfix { 52 | &:after { 53 | visibility: hidden; 54 | display: block; 55 | font-size: 0; 56 | content: " "; 57 | clear: both; 58 | height: 0; 59 | } 60 | } 61 | 62 | // main-container global css 63 | .app-container { 64 | padding: 20px; 65 | } 66 | -------------------------------------------------------------------------------- /ssm-vue/src/styles/mixin.scss: -------------------------------------------------------------------------------- 1 | @mixin clearfix { 2 | &:after { 3 | content: ""; 4 | display: table; 5 | clear: both; 6 | } 7 | } 8 | 9 | @mixin scrollBar { 10 | &::-webkit-scrollbar-track-piece { 11 | background: #d3dce6; 12 | } 13 | 14 | &::-webkit-scrollbar { 15 | width: 6px; 16 | } 17 | 18 | &::-webkit-scrollbar-thumb { 19 | background: #99a9bf; 20 | border-radius: 20px; 21 | } 22 | } 23 | 24 | @mixin relative { 25 | position: relative; 26 | width: 100%; 27 | height: 100%; 28 | } 29 | -------------------------------------------------------------------------------- /ssm-vue/src/styles/transition.scss: -------------------------------------------------------------------------------- 1 | // global transition css 2 | 3 | /* fade */ 4 | .fade-enter-active, 5 | .fade-leave-active { 6 | transition: opacity 0.28s; 7 | } 8 | 9 | .fade-enter, 10 | .fade-leave-active { 11 | opacity: 0; 12 | } 13 | 14 | /* fade-transform */ 15 | .fade-transform-leave-active, 16 | .fade-transform-enter-active { 17 | transition: all .5s; 18 | } 19 | 20 | .fade-transform-enter { 21 | opacity: 0; 22 | transform: translateX(-30px); 23 | } 24 | 25 | .fade-transform-leave-to { 26 | opacity: 0; 27 | transform: translateX(30px); 28 | } 29 | 30 | /* breadcrumb transition */ 31 | .breadcrumb-enter-active, 32 | .breadcrumb-leave-active { 33 | transition: all .5s; 34 | } 35 | 36 | .breadcrumb-enter, 37 | .breadcrumb-leave-active { 38 | opacity: 0; 39 | transform: translateX(20px); 40 | } 41 | 42 | .breadcrumb-move { 43 | transition: all .5s; 44 | } 45 | 46 | .breadcrumb-leave-active { 47 | position: absolute; 48 | } 49 | -------------------------------------------------------------------------------- /ssm-vue/src/styles/variables.scss: -------------------------------------------------------------------------------- 1 | // sidebar 2 | $menuText:#bfcbd9; 3 | $menuActiveText:#409EFF; 4 | $subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951 5 | 6 | $menuBg:#304156; 7 | $menuHover:#263445; 8 | 9 | $subMenuBg:#1f2d3d; 10 | $subMenuHover:#001528; 11 | 12 | $sideBarWidth: 210px; 13 | 14 | // the :export directive is the magic sauce for webpack 15 | // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass 16 | :export { 17 | menuText: $menuText; 18 | menuActiveText: $menuActiveText; 19 | subMenuActiveText: $subMenuActiveText; 20 | menuBg: $menuBg; 21 | menuHover: $menuHover; 22 | subMenuBg: $subMenuBg; 23 | subMenuHover: $subMenuHover; 24 | sideBarWidth: $sideBarWidth; 25 | } 26 | -------------------------------------------------------------------------------- /ssm-vue/src/utils/auth.js: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie' 2 | 3 | const TokenKey = 'vue_admin_template_token' 4 | 5 | export function getToken() { 6 | return Cookies.get(TokenKey) 7 | } 8 | 9 | export function setToken(token) { 10 | return Cookies.set(TokenKey, token) 11 | } 12 | 13 | export function removeToken() { 14 | return Cookies.remove(TokenKey) 15 | } 16 | -------------------------------------------------------------------------------- /ssm-vue/src/utils/get-page-title.js: -------------------------------------------------------------------------------- 1 | import defaultSettings from '@/settings' 2 | 3 | const title = defaultSettings.title || 'Vue Admin Template' 4 | 5 | export default function getPageTitle(pageTitle) { 6 | if (pageTitle) { 7 | return `${pageTitle} - ${title}` 8 | } 9 | return `${title}` 10 | } 11 | -------------------------------------------------------------------------------- /ssm-vue/src/utils/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by PanJiaChen on 16/11/18. 3 | */ 4 | 5 | /** 6 | * Parse the time to string 7 | * @param {(Object|string|number)} time 8 | * @param {string} cFormat 9 | * @returns {string | null} 10 | */ 11 | export function parseTime(time, cFormat) { 12 | if (arguments.length === 0) { 13 | return null 14 | } 15 | const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' 16 | let date 17 | if (typeof time === 'object') { 18 | date = time 19 | } else { 20 | if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { 21 | time = parseInt(time) 22 | } 23 | if ((typeof time === 'number') && (time.toString().length === 10)) { 24 | time = time * 1000 25 | } 26 | date = new Date(time) 27 | } 28 | const formatObj = { 29 | y: date.getFullYear(), 30 | m: date.getMonth() + 1, 31 | d: date.getDate(), 32 | h: date.getHours(), 33 | i: date.getMinutes(), 34 | s: date.getSeconds(), 35 | a: date.getDay() 36 | } 37 | const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { 38 | const value = formatObj[key] 39 | // Note: getDay() returns 0 on Sunday 40 | if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] } 41 | return value.toString().padStart(2, '0') 42 | }) 43 | return time_str 44 | } 45 | 46 | /** 47 | * @param {number} time 48 | * @param {string} option 49 | * @returns {string} 50 | */ 51 | export function formatTime(time, option) { 52 | if (('' + time).length === 10) { 53 | time = parseInt(time) * 1000 54 | } else { 55 | time = +time 56 | } 57 | const d = new Date(time) 58 | const now = Date.now() 59 | 60 | const diff = (now - d) / 1000 61 | 62 | if (diff < 30) { 63 | return '刚刚' 64 | } else if (diff < 3600) { 65 | // less 1 hour 66 | return Math.ceil(diff / 60) + '分钟前' 67 | } else if (diff < 3600 * 24) { 68 | return Math.ceil(diff / 3600) + '小时前' 69 | } else if (diff < 3600 * 24 * 2) { 70 | return '1天前' 71 | } 72 | if (option) { 73 | return parseTime(time, option) 74 | } else { 75 | return ( 76 | d.getMonth() + 77 | 1 + 78 | '月' + 79 | d.getDate() + 80 | '日' + 81 | d.getHours() + 82 | '时' + 83 | d.getMinutes() + 84 | '分' 85 | ) 86 | } 87 | } 88 | 89 | /** 90 | * @param {string} url 91 | * @returns {Object} 92 | */ 93 | export function param2Obj(url) { 94 | const search = url.split('?')[1] 95 | if (!search) { 96 | return {} 97 | } 98 | return JSON.parse( 99 | '{"' + 100 | decodeURIComponent(search) 101 | .replace(/"/g, '\\"') 102 | .replace(/&/g, '","') 103 | .replace(/=/g, '":"') 104 | .replace(/\+/g, ' ') + 105 | '"}' 106 | ) 107 | } 108 | -------------------------------------------------------------------------------- /ssm-vue/src/utils/request.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import { MessageBox, Message } from 'element-ui' 3 | import store from '@/store' 4 | import { getToken } from '@/utils/auth' 5 | 6 | // create an axios instance 7 | const service = axios.create({ 8 | baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url 9 | // withCredentials: true, // send cookies when cross-domain requests 10 | timeout: 5000 // request timeout 11 | }) 12 | 13 | // request interceptor 14 | service.interceptors.request.use( 15 | config => { 16 | // do something before request is sent 17 | 18 | if (store.getters.token) { 19 | // let each request carry token 20 | // ['X-Token'] is a custom headers key 21 | // please modify it according to the actual situation 22 | config.headers['X-Token'] = getToken() 23 | } 24 | return config 25 | }, 26 | error => { 27 | // do something with request error 28 | console.log(error) // for debug 29 | return Promise.reject(error) 30 | } 31 | ) 32 | 33 | // response interceptor 34 | service.interceptors.response.use( 35 | /** 36 | * If you want to get http information such as headers or status 37 | * Please return response => response 38 | */ 39 | 40 | /** 41 | * Determine the request status by custom code 42 | * Here is just an example 43 | * You can also judge the status by HTTP Status Code 44 | */ 45 | response => { 46 | const res = response.data 47 | 48 | // if the custom code is not 20000, it is judged as an error. 49 | if (res.code !== 10000) { 50 | Message({ 51 | message: res.message || 'Error', 52 | type: 'error', 53 | duration: 5 * 1000 54 | }) 55 | 56 | // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; 57 | if (res.code === 50008 || res.code === 50012 || res.code === 50014) { 58 | // to re-login 59 | MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', { 60 | confirmButtonText: 'Re-Login', 61 | cancelButtonText: 'Cancel', 62 | type: 'warning' 63 | }).then(() => { 64 | store.dispatch('user/resetToken').then(() => { 65 | location.reload() 66 | }) 67 | }) 68 | } 69 | return Promise.reject(new Error(res.message || 'Error')) 70 | } else { 71 | return res 72 | } 73 | }, 74 | error => { 75 | console.log('err' + error) // for debug 76 | Message({ 77 | message: error.message, 78 | type: 'error', 79 | duration: 5 * 1000 80 | }) 81 | return Promise.reject(error) 82 | } 83 | ) 84 | 85 | export default service 86 | -------------------------------------------------------------------------------- /ssm-vue/src/utils/scroll-to.js: -------------------------------------------------------------------------------- 1 | Math.easeInOutQuad = function(t, b, c, d) { 2 | t /= d / 2 3 | if (t < 1) { 4 | return c / 2 * t * t + b 5 | } 6 | t-- 7 | return -c / 2 * (t * (t - 2) - 1) + b 8 | } 9 | 10 | // requestAnimationFrame for Smart Animating http://goo.gl/sx5sts 11 | var requestAnimFrame = (function() { 12 | return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) } 13 | })() 14 | 15 | /** 16 | * Because it's so fucking difficult to detect the scrolling element, just move them all 17 | * @param {number} amount 18 | */ 19 | function move(amount) { 20 | document.documentElement.scrollTop = amount 21 | document.body.parentNode.scrollTop = amount 22 | document.body.scrollTop = amount 23 | } 24 | 25 | function position() { 26 | return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop 27 | } 28 | 29 | /** 30 | * @param {number} to 31 | * @param {number} duration 32 | * @param {Function} callback 33 | */ 34 | export function scrollTo(to, duration, callback) { 35 | const start = position() 36 | const change = to - start 37 | const increment = 20 38 | let currentTime = 0 39 | duration = (typeof (duration) === 'undefined') ? 500 : duration 40 | var animateScroll = function() { 41 | // increment the time 42 | currentTime += increment 43 | // find the value with the quadratic in-out easing function 44 | var val = Math.easeInOutQuad(currentTime, start, change, duration) 45 | // move the document.body 46 | move(val) 47 | // do the animation unless its over 48 | if (currentTime < duration) { 49 | requestAnimFrame(animateScroll) 50 | } else { 51 | if (callback && typeof (callback) === 'function') { 52 | // the animation is done so lets callback 53 | callback() 54 | } 55 | } 56 | } 57 | animateScroll() 58 | } 59 | -------------------------------------------------------------------------------- /ssm-vue/src/utils/validate.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by PanJiaChen on 16/11/18. 3 | */ 4 | 5 | /** 6 | * @param {string} path 7 | * @returns {Boolean} 8 | */ 9 | export function isExternal(path) { 10 | return /^(https?:|mailto:|tel:)/.test(path) 11 | } 12 | 13 | /** 14 | * @param {string} str 15 | * @returns {Boolean} 16 | */ 17 | export function validUsername(str) { 18 | // const valid_map = ['admin', 'editor'] 19 | // return valid_map.indexOf(str.trim()) >= 0 20 | return true 21 | } 22 | -------------------------------------------------------------------------------- /ssm-vue/src/views/dashboard/index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 19 | 20 | 31 | -------------------------------------------------------------------------------- /ssm-vue/src/views/log/index.vue: -------------------------------------------------------------------------------- 1 | 62 | 63 | 103 | -------------------------------------------------------------------------------- /ssm-vue/src/views/permission/detail.vue: -------------------------------------------------------------------------------- 1 | 21 | 54 | 63 | -------------------------------------------------------------------------------- /ssm-vue/src/views/role/detail.vue: -------------------------------------------------------------------------------- 1 | 38 | 68 | 77 | -------------------------------------------------------------------------------- /ssm-vue/src/views/user/detail.vue: -------------------------------------------------------------------------------- 1 | 49 | 83 | 92 | -------------------------------------------------------------------------------- /ssm-vue/tests/unit/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | jest: true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /ssm-vue/tests/unit/components/Breadcrumb.spec.js: -------------------------------------------------------------------------------- 1 | import { mount, createLocalVue } from '@vue/test-utils' 2 | import VueRouter from 'vue-router' 3 | import ElementUI from 'element-ui' 4 | import Breadcrumb from '@/components/Breadcrumb/index.vue' 5 | 6 | const localVue = createLocalVue() 7 | localVue.use(VueRouter) 8 | localVue.use(ElementUI) 9 | 10 | const routes = [ 11 | { 12 | path: '/', 13 | name: 'home', 14 | children: [{ 15 | path: 'dashboard', 16 | name: 'dashboard' 17 | }] 18 | }, 19 | { 20 | path: '/menu', 21 | name: 'menu', 22 | children: [{ 23 | path: 'menu1', 24 | name: 'menu1', 25 | meta: { title: 'menu1' }, 26 | children: [{ 27 | path: 'menu1-1', 28 | name: 'menu1-1', 29 | meta: { title: 'menu1-1' } 30 | }, 31 | { 32 | path: 'menu1-2', 33 | name: 'menu1-2', 34 | redirect: 'noredirect', 35 | meta: { title: 'menu1-2' }, 36 | children: [{ 37 | path: 'menu1-2-1', 38 | name: 'menu1-2-1', 39 | meta: { title: 'menu1-2-1' } 40 | }, 41 | { 42 | path: 'menu1-2-2', 43 | name: 'menu1-2-2' 44 | }] 45 | }] 46 | }] 47 | }] 48 | 49 | const router = new VueRouter({ 50 | routes 51 | }) 52 | 53 | describe('Breadcrumb.vue', () => { 54 | const wrapper = mount(Breadcrumb, { 55 | localVue, 56 | router 57 | }) 58 | it('dashboard', () => { 59 | router.push('/dashboard') 60 | const len = wrapper.findAll('.el-breadcrumb__inner').length 61 | expect(len).toBe(1) 62 | }) 63 | it('normal route', () => { 64 | router.push('/menu/menu1') 65 | const len = wrapper.findAll('.el-breadcrumb__inner').length 66 | expect(len).toBe(2) 67 | }) 68 | it('nested route', () => { 69 | router.push('/menu/menu1/menu1-2/menu1-2-1') 70 | const len = wrapper.findAll('.el-breadcrumb__inner').length 71 | expect(len).toBe(4) 72 | }) 73 | it('no meta.title', () => { 74 | router.push('/menu/menu1/menu1-2/menu1-2-2') 75 | const len = wrapper.findAll('.el-breadcrumb__inner').length 76 | expect(len).toBe(3) 77 | }) 78 | // it('click link', () => { 79 | // router.push('/menu/menu1/menu1-2/menu1-2-2') 80 | // const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') 81 | // const second = breadcrumbArray.at(1) 82 | // console.log(breadcrumbArray) 83 | // const href = second.find('a').attributes().href 84 | // expect(href).toBe('#/menu/menu1') 85 | // }) 86 | // it('noRedirect', () => { 87 | // router.push('/menu/menu1/menu1-2/menu1-2-1') 88 | // const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') 89 | // const redirectBreadcrumb = breadcrumbArray.at(2) 90 | // expect(redirectBreadcrumb.contains('a')).toBe(false) 91 | // }) 92 | it('last breadcrumb', () => { 93 | router.push('/menu/menu1/menu1-2/menu1-2-1') 94 | const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') 95 | const redirectBreadcrumb = breadcrumbArray.at(3) 96 | expect(redirectBreadcrumb.contains('a')).toBe(false) 97 | }) 98 | }) 99 | -------------------------------------------------------------------------------- /ssm-vue/tests/unit/components/Hamburger.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Hamburger from '@/components/Hamburger/index.vue' 3 | describe('Hamburger.vue', () => { 4 | it('toggle click', () => { 5 | const wrapper = shallowMount(Hamburger) 6 | const mockFn = jest.fn() 7 | wrapper.vm.$on('toggleClick', mockFn) 8 | wrapper.find('.hamburger').trigger('click') 9 | expect(mockFn).toBeCalled() 10 | }) 11 | it('prop isActive', () => { 12 | const wrapper = shallowMount(Hamburger) 13 | wrapper.setProps({ isActive: true }) 14 | expect(wrapper.contains('.is-active')).toBe(true) 15 | wrapper.setProps({ isActive: false }) 16 | expect(wrapper.contains('.is-active')).toBe(false) 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /ssm-vue/tests/unit/components/SvgIcon.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import SvgIcon from '@/components/SvgIcon/index.vue' 3 | describe('SvgIcon.vue', () => { 4 | it('iconClass', () => { 5 | const wrapper = shallowMount(SvgIcon, { 6 | propsData: { 7 | iconClass: 'test' 8 | } 9 | }) 10 | expect(wrapper.find('use').attributes().href).toBe('#icon-test') 11 | }) 12 | it('className', () => { 13 | const wrapper = shallowMount(SvgIcon, { 14 | propsData: { 15 | iconClass: 'test' 16 | } 17 | }) 18 | expect(wrapper.classes().length).toBe(1) 19 | wrapper.setProps({ className: 'test' }) 20 | expect(wrapper.classes().includes('test')).toBe(true) 21 | }) 22 | }) 23 | -------------------------------------------------------------------------------- /ssm-vue/tests/unit/utils/formatTime.spec.js: -------------------------------------------------------------------------------- 1 | import { formatTime } from '@/utils/index.js' 2 | 3 | describe('Utils:formatTime', () => { 4 | const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01" 5 | const retrofit = 5 * 1000 6 | 7 | it('ten digits timestamp', () => { 8 | expect(formatTime((d / 1000).toFixed(0))).toBe('7月13日17时54分') 9 | }) 10 | it('test now', () => { 11 | expect(formatTime(+new Date() - 1)).toBe('刚刚') 12 | }) 13 | it('less two minute', () => { 14 | expect(formatTime(+new Date() - 60 * 2 * 1000 + retrofit)).toBe('2分钟前') 15 | }) 16 | it('less two hour', () => { 17 | expect(formatTime(+new Date() - 60 * 60 * 2 * 1000 + retrofit)).toBe('2小时前') 18 | }) 19 | it('less one day', () => { 20 | expect(formatTime(+new Date() - 60 * 60 * 24 * 1 * 1000)).toBe('1天前') 21 | }) 22 | it('more than one day', () => { 23 | expect(formatTime(d)).toBe('7月13日17时54分') 24 | }) 25 | it('format', () => { 26 | expect(formatTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54') 27 | expect(formatTime(d, '{y}-{m}-{d}')).toBe('2018-07-13') 28 | expect(formatTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54') 29 | }) 30 | }) 31 | -------------------------------------------------------------------------------- /ssm-vue/tests/unit/utils/parseTime.spec.js: -------------------------------------------------------------------------------- 1 | import { parseTime } from '@/utils/index.js' 2 | 3 | describe('Utils:parseTime', () => { 4 | const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01" 5 | it('timestamp', () => { 6 | expect(parseTime(d)).toBe('2018-07-13 17:54:01') 7 | }) 8 | it('ten digits timestamp', () => { 9 | expect(parseTime((d / 1000).toFixed(0))).toBe('2018-07-13 17:54:01') 10 | }) 11 | it('new Date', () => { 12 | expect(parseTime(new Date(d))).toBe('2018-07-13 17:54:01') 13 | }) 14 | it('format', () => { 15 | expect(parseTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54') 16 | expect(parseTime(d, '{y}-{m}-{d}')).toBe('2018-07-13') 17 | expect(parseTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54') 18 | }) 19 | it('get the day of the week', () => { 20 | expect(parseTime(d, '{a}')).toBe('五') // 星期五 21 | }) 22 | it('get the day of the week', () => { 23 | expect(parseTime(+d + 1000 * 60 * 60 * 24 * 2, '{a}')).toBe('日') // 星期日 24 | }) 25 | it('empty argument', () => { 26 | expect(parseTime()).toBeNull() 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /ssm-vue/tests/unit/utils/validate.spec.js: -------------------------------------------------------------------------------- 1 | import { validUsername, isExternal } from '@/utils/validate.js' 2 | 3 | describe('Utils:validate', () => { 4 | it('validUsername', () => { 5 | expect(validUsername('admin')).toBe(true) 6 | expect(validUsername('editor')).toBe(true) 7 | expect(validUsername('xxxx')).toBe(false) 8 | }) 9 | it('isExternal', () => { 10 | expect(isExternal('https://github.com/PanJiaChen/vue-element-admin')).toBe(true) 11 | expect(isExternal('http://github.com/PanJiaChen/vue-element-admin')).toBe(true) 12 | expect(isExternal('github.com/PanJiaChen/vue-element-admin')).toBe(false) 13 | expect(isExternal('/dashboard')).toBe(false) 14 | expect(isExternal('./dashboard')).toBe(false) 15 | expect(isExternal('dashboard')).toBe(false) 16 | }) 17 | }) 18 | -------------------------------------------------------------------------------- /ssm_project/ssm_project.iml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ssm_project 7 | com.zephon 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | ssm_project_common 13 | 14 | 15 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/src/main/java/com/zephon/utils/DateUtil.java: -------------------------------------------------------------------------------- 1 | package com.zephon.utils; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | 7 | /** 8 | * @author Zephon 9 | * @version V1.0 10 | * @Package com.zephon.utils 11 | * 日期工具类 12 | */ 13 | public class DateUtil { 14 | /** 15 | * 日期转字符串 16 | */ 17 | public static String date2String(Date date, String pattern){ 18 | SimpleDateFormat smf = new SimpleDateFormat(pattern); 19 | String format = smf.format(date); 20 | return format; 21 | } 22 | /** 23 | * 字符串转日期 24 | */ 25 | public static Date string2Date(String str,String pattern) throws ParseException { 26 | SimpleDateFormat smf = new SimpleDateFormat(pattern); 27 | Date date = smf.parse(str); 28 | return date; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/src/main/java/com/zephon/utils/JwtUtil.java: -------------------------------------------------------------------------------- 1 | package com.zephon.utils; 2 | 3 | import io.jsonwebtoken.Claims; 4 | import io.jsonwebtoken.JwtBuilder; 5 | import io.jsonwebtoken.Jwts; 6 | import io.jsonwebtoken.SignatureAlgorithm; 7 | import lombok.Getter; 8 | import lombok.Setter; 9 | import org.springframework.stereotype.Component; 10 | 11 | import java.util.Date; 12 | import java.util.Map; 13 | 14 | /** 15 | * @author Zephon 16 | * @version V1.0 17 | * @Package com.zephon.utils 18 | * @date 2020/3/21 下午6:34 19 | * @Copyright © 20 | */ 21 | @Getter 22 | @Setter 23 | @Component 24 | public class JwtUtil { 25 | /** 26 | * 签名私钥 27 | */ 28 | public String key="ssm_project"; 29 | /** 30 | * 签名失效时间 31 | */ 32 | public Long ttl=3600000L; 33 | /** 34 | * 设置认证token 35 | * id:登录用户id 36 | * subject:登录用户名 37 | */ 38 | public String createJwt(String id, String name, Map map){ 39 | // 1.设置失效时间 40 | long now = System.currentTimeMillis(); 41 | long exp = now + ttl; 42 | // 2.创建jwtBuilder 43 | JwtBuilder builder = Jwts.builder().setId(id).setSubject(name) 44 | .setClaims(map) 45 | .setIssuedAt(new Date()) 46 | .signWith(SignatureAlgorithm.HS256, key); 47 | // 3.根据map设置claims 48 | // for(Map.Entry entry:map.entrySet()){ 49 | // builder.claim(entry.getKey(),entry.getValue()); 50 | // } 51 | // 设置失效时间 52 | builder.setExpiration(new Date(exp)); 53 | // 4.创建token 54 | String token = builder.compact(); 55 | return token; 56 | 57 | } 58 | /** 59 | * 解析token字符串获取clamis 60 | */ 61 | public Claims parseJwt(String token){ 62 | Claims claims = Jwts.parser().setSigningKey(key).parseClaimsJws(token).getBody(); 63 | return claims; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/src/main/java/com/zephon/utils/RedisUtil.java: -------------------------------------------------------------------------------- 1 | package com.zephon.utils; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.data.redis.core.RedisTemplate; 5 | import org.springframework.data.redis.core.ValueOperations; 6 | import org.springframework.stereotype.Component; 7 | 8 | import java.io.Serializable; 9 | import java.util.Set; 10 | import java.util.concurrent.TimeUnit; 11 | 12 | /** 13 | * @author Zephon 14 | * @version V1.0 15 | * @Package com.zephon.utils 16 | * @date 2020/4/6 下午12:19 17 | * @Copyright © 18 | */ 19 | 20 | public class RedisUtil { 21 | private RedisTemplate redisTemplate; 22 | 23 | /** 24 | * 批量删除对应的value 25 | * 26 | * @param keys 27 | */ 28 | public void remove(final String... keys) { 29 | for (String key : keys) { 30 | remove(key); 31 | } 32 | } 33 | 34 | /** 35 | * 批量删除key 36 | * 37 | * @param pattern 38 | */ 39 | public void removePattern(final String pattern) { 40 | Set keys = redisTemplate.keys(pattern); 41 | if (keys.size() > 0) 42 | redisTemplate.delete(keys); 43 | } 44 | 45 | /** 46 | * 删除对应的value 47 | * 48 | * @param key 49 | */ 50 | public void remove(final String key) { 51 | if (exists(key)) { 52 | redisTemplate.delete(key); 53 | } 54 | } 55 | 56 | /** 57 | * 判断缓存中是否有对应的value 58 | * 59 | * @param key 60 | * @return 61 | */ 62 | public boolean exists(final String key) { 63 | return redisTemplate.hasKey(key); 64 | } 65 | 66 | /** 67 | * 读取缓存 68 | * 69 | * @param key 70 | * @return 71 | */ 72 | public Object get(final String key) { 73 | Object result = null; 74 | ValueOperations operations = redisTemplate.opsForValue(); 75 | result = operations.get(key); 76 | return result; 77 | } 78 | 79 | /** 80 | * 写入缓存 81 | * 82 | * @param key 83 | * @param value 84 | * @return 85 | */ 86 | public boolean set(final String key, Object value) { 87 | boolean result = false; 88 | try { 89 | ValueOperations operations = redisTemplate.opsForValue(); 90 | operations.set(key, value); 91 | result = true; 92 | } catch (Exception e) { 93 | e.printStackTrace(); 94 | } 95 | return result; 96 | } 97 | 98 | /** 99 | * 写入缓存 100 | * 101 | * @param key 102 | * @param value 103 | * @return 104 | */ 105 | public boolean set(final String key, Object value, Long expireTime) { 106 | boolean result = false; 107 | try { 108 | ValueOperations operations = redisTemplate.opsForValue(); 109 | operations.set(key, value); 110 | redisTemplate.expire(key, expireTime, TimeUnit.SECONDS); 111 | result = true; 112 | } catch (Exception e) { 113 | e.printStackTrace(); 114 | } 115 | return result; 116 | } 117 | 118 | public void setRedisTemplate(RedisTemplate redisTemplate) { 119 | this.redisTemplate = redisTemplate; 120 | } 121 | } -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/target/classes/META-INF/ssm_project_common.kotlin_module: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Mon Apr 06 13:22:04 CST 2020 3 | version=1.0-SNAPSHOT 4 | groupId=com.zephon 5 | artifactId=ssm_project_common 6 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/zephon/utils/JwtUtil.class 2 | com/zephon/utils/RedisUtil.class 3 | com/zephon/utils/DateUtil.class 4 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_common/src/main/java/com/zephon/utils/JwtUtil.java 2 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_common/src/main/java/com/zephon/utils/DateUtil.java 3 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_common/src/main/java/com/zephon/utils/RedisUtil.java 4 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm_project/ssm_project_common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/target/ssm_project_common-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm_project/ssm_project_common/target/ssm_project_common-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /ssm_project/ssm_project_common/target/test-classes/META-INF/ssm_project_common.kotlin_module: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ssm_project 7 | com.zephon 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | ssm_project_dao 13 | 14 | 15 | com.zephon 16 | ssm_project_domain 17 | 1.0-SNAPSHOT 18 | compile 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/ILogDao.java: -------------------------------------------------------------------------------- 1 | package com.zephon.dao; 2 | 3 | import com.zephon.domain.SysLog; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Select; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @author Zephon 12 | * @version V1.0 13 | * @Package com.zephon.dao 14 | * @date 2020/3/28 下午1:18 15 | * @Copyright © 16 | */ 17 | @Repository("logDao") 18 | public interface ILogDao { 19 | 20 | @Select("select * from tb_log") 21 | List findAll(); 22 | 23 | @Insert("insert into tb_log (id,visit_time,username,ip,url,execution_time,method) values(#{id},#{visitTime},#{username},#{ip},#{url},#{executionTime},#{method})") 24 | void save(SysLog log); 25 | } 26 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IMemberDao.java: -------------------------------------------------------------------------------- 1 | package com.zephon.dao; 2 | 3 | import com.zephon.domain.Member; 4 | import org.apache.ibatis.annotations.Select; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author Zephon 11 | * @version V1.0 12 | * @Package com.zephon.dao 13 | * @date 2020/3/24 下午6:31 14 | * @Copyright © 15 | */ 16 | @Repository("memberDao") 17 | public interface IMemberDao { 18 | @Select("select * from tb_member where id = #{memberId}") 19 | Member findById(String memberId); 20 | } 21 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IOrderDao.java: -------------------------------------------------------------------------------- 1 | package com.zephon.dao; 2 | 3 | import com.zephon.domain.Member; 4 | import com.zephon.domain.Order; 5 | import com.zephon.domain.Product; 6 | import com.zephon.domain.Traveller; 7 | import org.apache.ibatis.annotations.Many; 8 | import org.apache.ibatis.annotations.One; 9 | import org.apache.ibatis.annotations.Result; 10 | import org.apache.ibatis.annotations.Results; 11 | import org.apache.ibatis.annotations.Select; 12 | import org.apache.ibatis.annotations.Update; 13 | import org.springframework.stereotype.Repository; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * @author Zephon 19 | * @version V1.0 20 | * @Package com.zephon.dao 21 | * @date 2020/3/24 下午2:21 22 | * @Copyright © 23 | */ 24 | @Repository("orderDao") 25 | public interface IOrderDao { 26 | 27 | @Select("select * from tb_order") 28 | @Results({ 29 | @Result(id =true,property = "id",column = "id"), 30 | @Result(property = "product",column = "id",javaType = Product.class, 31 | one = @One(select = "com.zephon.dao.IProductDao.findByOrderId")) 32 | }) 33 | List findAll(); 34 | 35 | @Select("select * from tb_order where id=#{id}") 36 | @Results({ 37 | @Result(id=true,property = "id",column = "id"), 38 | @Result(property = "product",column = "id",javaType = Product.class, 39 | one = @One(select = "com.zephon.dao.IProductDao.findByOrderId")), 40 | @Result(property = "member",column = "member_id",javaType = Member.class, 41 | one = @One(select = "com.zephon.dao.IMemberDao.findById")), 42 | @Result(property = "travellers",column = "id",javaType = java.util.List.class, 43 | many = @Many(select = "com.zephon.dao.ITravellerDao.findByOrderId")) 44 | }) 45 | Order findById(String id); 46 | 47 | @Update("update tb_order set order_num=#{orderNum},order_time=#{orderTime},people_count=#{peopleCount},order_desc=#{orderDesc},pay_type=#{payType} where id=#{id}") 48 | void saveOrder(Order o); 49 | 50 | @Update("update tb_traveller set name=#{name},gender=#{gender},phone_num=#{phoneNum},credentials_type=#{credentialsType},credentials_num=#{credentialsNum},traveller_type=#{travellerType} where id=#{id}") 51 | void saveTraveller(Traveller traveller); 52 | 53 | @Update("update tb_member set name=#{name},nickname=#{nickname},phone_num=#{phoneNum},email=#{email} where id=#{id}") 54 | void saveMember(Member member); 55 | } 56 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IPermissionDao.java: -------------------------------------------------------------------------------- 1 | package com.zephon.dao; 2 | 3 | import com.zephon.domain.Permission; 4 | import org.apache.ibatis.annotations.Delete; 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.springframework.stereotype.Repository; 8 | import org.springframework.web.bind.annotation.DeleteMapping; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Zephon 14 | * @version V1.0 15 | * @Package com.zephon.dao 16 | * @date 2020/3/27 下午1:22 17 | * @Copyright © 18 | */ 19 | @Repository("permissionDao") 20 | public interface IPermissionDao { 21 | @Select("select * from tb_permission where id in " + 22 | "(select permission_id from tb_role_permission where role_id = #{roleId})") 23 | List findPermissionByRoleId(String roleId); 24 | 25 | @Select("select * from tb_permission") 26 | List findAll(); 27 | 28 | @Insert("insert into tb_permission (id,permission_name,url) values(#{id},#{permissionName},#{url})") 29 | void save(Permission permission); 30 | 31 | @Select("select * from tb_permission where id=#{id}") 32 | Permission findById(String id); 33 | 34 | @Delete("delete from tb_permission where id=#{id}") 35 | void delete(String id); 36 | 37 | @Delete("delete from tb_role_permission where role_id=#{id}") 38 | void deleteFromRolePermission(String id); 39 | } 40 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IProductDao.java: -------------------------------------------------------------------------------- 1 | package com.zephon.dao; 2 | 3 | import com.zephon.domain.Product; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Select; 6 | import org.apache.ibatis.annotations.Update; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @author Zephon 13 | * @version V1.0 14 | * @Package com.zephon.dao 15 | * @date 2020/3/23 下午10:00 16 | * @Copyright © 17 | */ 18 | @Repository("productDao") 19 | public interface IProductDao { 20 | // @Select("select * from tb_product limit #{arg0},#{arg1}") 21 | // List findAll(Integer pageLimit,Integer pageSize); 22 | @Select("select * from tb_product") 23 | List findAll(); 24 | 25 | @Insert("insert into tb_product (id,product_num,product_name,city_name,departure_time,product_price,product_desc,product_status) values (#{id},#{productNum},#{productName},#{cityName},#{departureTime},#{productPrice},#{productDesc},#{productStatus})") 26 | void save(Product product); 27 | 28 | @Select("select * from tb_product where id in (select product_id from tb_order_product where order_id=#{orderId})") 29 | Product findByOrderId(String orderId); 30 | 31 | @Select("select * from tb_product where id=#{id}") 32 | Product findById(String id); 33 | 34 | @Update("update tb_product set product_num=#{productNum},product_name=#{productName},city_name=#{cityName},departure_time=#{departureTime},product_price=#{productPrice},product_desc=#{productDesc},product_status=#{productStatus} where id = #{id}") 35 | void update(Product product); 36 | } 37 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IRoleDao.java: -------------------------------------------------------------------------------- 1 | package com.zephon.dao; 2 | 3 | import com.zephon.domain.Permission; 4 | import com.zephon.domain.Role; 5 | import org.apache.ibatis.annotations.Delete; 6 | import org.apache.ibatis.annotations.Insert; 7 | import org.apache.ibatis.annotations.Many; 8 | import org.apache.ibatis.annotations.One; 9 | import org.apache.ibatis.annotations.Result; 10 | import org.apache.ibatis.annotations.Results; 11 | import org.apache.ibatis.annotations.Select; 12 | import org.springframework.stereotype.Repository; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @author Zephon 18 | * @version V1.0 19 | * @Package com.zephon.dao 20 | * @date 2020/3/21 下午10:04 21 | * @Copyright © 22 | */ 23 | @Repository("roleDao") 24 | public interface IRoleDao { 25 | @Select("select * from tb_role where id in " + 26 | "(select role_id from tb_user_role where user_id=#{userId})") 27 | @Results({ 28 | @Result(id = true, property = "id", column = "id"), 29 | @Result(property = "roleName", column = "role_name"), 30 | @Result(property = "roleDesc", column = "role_desc"), 31 | @Result(property = "permissions", column = "id", javaType = java.util.List.class, 32 | many = @Many(select = "com.zephon.dao.IPermissionDao.findPermissionByRoleId")) 33 | }) 34 | Role findByUserId(String userId); 35 | 36 | @Select("select * from tb_role") 37 | List findAll(); 38 | 39 | @Insert("insert into tb_role (id,role_name,role_desc) values(#{id},#{roleName},#{roleDesc})") 40 | void save(Role role); 41 | 42 | @Select("select * from tb_permission where id not in " + 43 | "(select permission_id from tb_role_permission where role_id=#{roleId})") 44 | List findOtherPermissionByRoleId(String roleId); 45 | 46 | @Insert("insert into tb_role_permission (role_id,permission_id) values(#{arg0},#{arg1})") 47 | void addPermissionToRole(String roleId, String permissionId); 48 | 49 | @Select("select * from tb_role where id = #{id}") 50 | @Results({ 51 | @Result(id=true,property = "id",column = "id"), 52 | @Result(property = "permissions",column = "id", 53 | javaType = java.util.List.class, 54 | many = @Many(select = "com.zephon.dao.IPermissionDao.findPermissionByRoleId")) 55 | }) 56 | Role findById(String id); 57 | 58 | @Delete("delete from tb_role where id=#{id}") 59 | void delete(String id); 60 | 61 | @Delete("delete from tb_user_role where role_id=#{id}") 62 | void deleteFromUserRole(String id); 63 | 64 | @Delete("delete from tb_role_permission where role_id=#{id}") 65 | void deleteFromRolePermission(String id); 66 | } 67 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/ITravellerDao.java: -------------------------------------------------------------------------------- 1 | package com.zephon.dao; 2 | 3 | import com.zephon.domain.Traveller; 4 | import org.apache.ibatis.annotations.Select; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author Zephon 11 | * @version V1.0 12 | * @Package com.zephon.dao 13 | * @date 2020/3/24 下午6:34 14 | * @Copyright © 15 | */ 16 | @Repository("travellerDao") 17 | public interface ITravellerDao { 18 | @Select("select * from tb_traveller where id in (select traveller_id from tb_order_traveller where order_id=#{orderId} )") 19 | List findByOrderId(String orderId); 20 | } 21 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IUserDao.java: -------------------------------------------------------------------------------- 1 | package com.zephon.dao; 2 | 3 | import com.zephon.domain.Role; 4 | import com.zephon.domain.UserInfo; 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Many; 7 | import org.apache.ibatis.annotations.Result; 8 | import org.apache.ibatis.annotations.Results; 9 | import org.apache.ibatis.annotations.Select; 10 | import org.apache.ibatis.annotations.Update; 11 | import org.springframework.stereotype.Repository; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * @author Zephon 17 | * @version V1.0 18 | * @Package PACKAGE_NAME 19 | * @date 2020/3/21 下午6:49 20 | * @Copyright © 21 | */ 22 | @Repository("userDao") 23 | public interface IUserDao { 24 | @Select("select * from tb_user where username=#{username}") 25 | @Results({ 26 | @Result(id = true, property = "id", column = "id"), 27 | @Result(property = "roles", column = "id", javaType = java.util.Set.class, 28 | many = @Many(select = "com.zephon.dao.IRoleDao.findByUserId")) 29 | } 30 | ) 31 | UserInfo findByUsername(String username); 32 | 33 | // @Select("select id,email,username,phone_num,status from tb_user limit #{arg0},#{arg1}") 34 | // List findAll(Integer pageLimit,Integer pageSize); 35 | @Select("select * from tb_user") 36 | List findAll(); 37 | 38 | @Insert("insert into tb_user(id,email,username,password,phone_num,status,avatar) values(#{id},#{email},#{username},#{password},#{phoneNum},#{status},#{avatar})") 39 | void save(UserInfo userInfo) throws Exception; 40 | 41 | @Select("select * from tb_user where id=#{id}") 42 | @Results({ 43 | @Result(id = true,property = "id",column = "id"), 44 | @Result(property = "roles", column = "id", javaType = java.util.Set.class, 45 | many = @Many(select = "com.zephon.dao.IRoleDao.findByUserId")) 46 | }) 47 | UserInfo findById(String id); 48 | 49 | @Select("select * from tb_role where id not in " + 50 | "(select role_id from tb_user_role where user_id=#{id})") 51 | List findOtherRolesById(String id); 52 | 53 | @Insert("insert into tb_user_role (user_id,role_id) values(#{arg0},#{arg1})") 54 | void addRole(String userId, String roleId); 55 | 56 | void update(UserInfo user); 57 | } 58 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Mon Apr 06 13:22:05 CST 2020 3 | version=1.0-SNAPSHOT 4 | groupId=com.zephon 5 | artifactId=ssm_project_dao 6 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/zephon/dao/IUserDao.class 2 | com/zephon/dao/ILogDao.class 3 | com/zephon/dao/IRoleDao.class 4 | com/zephon/dao/IProductDao.class 5 | com/zephon/dao/IPermissionDao.class 6 | com/zephon/dao/IMemberDao.class 7 | com/zephon/dao/IOrderDao.class 8 | com/zephon/dao/ITravellerDao.class 9 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IProductDao.java 2 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IOrderDao.java 3 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IPermissionDao.java 4 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IMemberDao.java 5 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/ILogDao.java 6 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/ITravellerDao.java 7 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IRoleDao.java 8 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_dao/src/main/java/com/zephon/dao/IUserDao.java 9 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm_project/ssm_project_dao/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -------------------------------------------------------------------------------- /ssm_project/ssm_project_dao/target/ssm_project_dao-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm_project/ssm_project_dao/target/ssm_project_dao-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ssm_project 7 | com.zephon 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | ssm_project_domain 13 | 14 | 15 | com.zephon 16 | ssm_project_common 17 | 1.0-SNAPSHOT 18 | compile 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Member.java: -------------------------------------------------------------------------------- 1 | package com.zephon.domain; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | /** 8 | * @author Zephon 9 | * @version V1.0 10 | * @Package com.zephon.domain 11 | * 会员信息 12 | */ 13 | @Getter 14 | @Setter 15 | @ToString 16 | public class Member { 17 | private String id; 18 | /** 19 | * 姓名 20 | */ 21 | private String name; 22 | /** 23 | * 昵称 24 | */ 25 | private String nickname; 26 | /** 27 | * 电话号码 28 | */ 29 | private String phoneNum; 30 | /** 31 | * 邮箱 32 | */ 33 | private String email; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Order.java: -------------------------------------------------------------------------------- 1 | package com.zephon.domain; 2 | 3 | import com.zephon.utils.DateUtil; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import java.util.Date; 10 | import java.util.List; 11 | 12 | /** 13 | * @author Zephon 14 | * @version V1.0 15 | * @Package com.zephon.domain 16 | * 订单 17 | */ 18 | @Getter 19 | @Setter 20 | @ToString 21 | public class Order { 22 | private String id; 23 | /** 24 | * 订单编号 25 | */ 26 | private String orderNum; 27 | /** 28 | * 下单日期 29 | */ 30 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") 31 | private Date orderTime; 32 | /** 33 | * 下单日期字符串 34 | */ 35 | private String orderTimeStr; 36 | /** 37 | * 订单状态 38 | * 0:未支付 39 | * 1:已支付 40 | */ 41 | private Integer orderStatus; 42 | /** 43 | * 订单状态字符串 44 | */ 45 | private String orderStatusStr; 46 | /** 47 | * 出行人数 48 | */ 49 | private Integer peopleCount; 50 | /** 51 | * 订单对应的产品 52 | */ 53 | private Product product; 54 | /** 55 | * 订单对应的游客 56 | */ 57 | private List travellers; 58 | /** 59 | * 订单对应的会员 60 | */ 61 | private Member member; 62 | /** 63 | * 支付类型: 64 | * 0:支付宝 65 | * 1:微信 66 | * 2:其它 67 | */ 68 | private Integer payType; 69 | /** 70 | * 支付类型字符串 71 | */ 72 | private String payTypeStr; 73 | /** 74 | * 订单详情 75 | */ 76 | private String orderDesc; 77 | 78 | 79 | public String getOrderTimeStr() { 80 | if(orderTime!=null){ 81 | orderTimeStr= DateUtil.date2String(orderTime, "yyyy-MM-dd HH:mm"); 82 | } 83 | return orderTimeStr; 84 | } 85 | 86 | public String getOrderStatusStr() { 87 | return orderStatus==0?"未支付":"已支付"; 88 | } 89 | 90 | public String getPayTypeStr() { 91 | if(payType==0){ 92 | return "支付宝"; 93 | }else if(payType==1){ 94 | return "微信"; 95 | }else{ 96 | return "其它"; 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Permission.java: -------------------------------------------------------------------------------- 1 | package com.zephon.domain; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author Zephon 11 | * @version V1.0 12 | * @Package com.zephon.domain 13 | * 权限 14 | */ 15 | @Getter 16 | @Setter 17 | @ToString 18 | public class Permission { 19 | private String id; 20 | /** 21 | * 权限名 22 | */ 23 | private String permissionName; 24 | /** 25 | * 权限对应的url 26 | */ 27 | private String url; 28 | /** 29 | * 权限对应的角色 30 | */ 31 | private List roles; 32 | } 33 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Product.java: -------------------------------------------------------------------------------- 1 | package com.zephon.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.zephon.utils.DateUtil; 5 | import jdk.nashorn.internal.objects.annotations.Constructor; 6 | import lombok.Getter; 7 | import lombok.NoArgsConstructor; 8 | import lombok.Setter; 9 | import lombok.ToString; 10 | import org.springframework.format.annotation.DateTimeFormat; 11 | 12 | import java.util.Date; 13 | 14 | /** 15 | * @author Zephon 16 | * @version V1.0 17 | * @Package com.zephon.domain 18 | * 产品 19 | */ 20 | @Getter 21 | @Setter 22 | @ToString 23 | public class Product { 24 | private String id; 25 | /** 26 | * 产品编号 27 | */ 28 | private String productNum; 29 | /** 30 | * 产品名 31 | */ 32 | private String productName; 33 | /** 34 | * 出发城市 35 | */ 36 | private String cityName; 37 | /** 38 | * 出发时间 39 | */ 40 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") 41 | private Date departureTime; 42 | /** 43 | * 出发时间字符串 44 | */ 45 | private String departureTimeStr; 46 | /** 47 | * 产品价格 48 | */ 49 | private Double productPrice; 50 | /** 51 | * 产品描述 52 | */ 53 | private String productDesc; 54 | /** 55 | * 产品状态 56 | * 0:关闭 57 | * 1:开启 58 | */ 59 | private Integer productStatus; 60 | 61 | public String getDepartureTimeStr() { 62 | if(departureTime!=null){ 63 | departureTimeStr = DateUtil.date2String(departureTime,"yyyy-MM-dd HH:mm"); 64 | } 65 | return departureTimeStr; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Role.java: -------------------------------------------------------------------------------- 1 | package com.zephon.domain; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author Zephon 11 | * @version V1.0 12 | * @Package com.zephon.domain 13 | * 角色 14 | */ 15 | @Getter 16 | @Setter 17 | @ToString 18 | public class Role { 19 | private String id; 20 | /** 21 | * 角色名 22 | */ 23 | private String roleName; 24 | /** 25 | * 角色详情 26 | */ 27 | private String roleDesc; 28 | /** 29 | * 角色对应的权限 30 | */ 31 | private List permissions; 32 | /** 33 | * 角色对应的用户 34 | */ 35 | private List userInfos; 36 | } 37 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/SysLog.java: -------------------------------------------------------------------------------- 1 | package com.zephon.domain; 2 | 3 | import com.zephon.utils.DateUtil; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * @author Zephon 12 | * @version V1.0 13 | * @Package com.zephon.domain 14 | * 日志 15 | */ 16 | @Getter 17 | @Setter 18 | @ToString 19 | public class SysLog { 20 | private String id; 21 | /** 22 | * 访问时间 23 | */ 24 | private Date visitTime; 25 | /** 26 | * 访问时间字符串 27 | */ 28 | private String visitTimeStr; 29 | /** 30 | * 访问用户名 31 | */ 32 | private String username; 33 | /** 34 | * 访问者ip 35 | */ 36 | private String ip; 37 | /** 38 | * 访问资源url 39 | */ 40 | private String url; 41 | /** 42 | * 执行时间 43 | */ 44 | private Long executionTime; 45 | /** 46 | * 执行方法 47 | */ 48 | private String method; 49 | 50 | public String getVisitTimeStr() { 51 | if(visitTime!=null){ 52 | visitTimeStr = DateUtil.date2String(visitTime,"yyyy-MM-dd HH:mm"); 53 | } 54 | return visitTimeStr; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Traveller.java: -------------------------------------------------------------------------------- 1 | package com.zephon.domain; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | /** 8 | * @author Zephon 9 | * @version V1.0 10 | * @Package com.zephon.domain 11 | * 旅客 12 | */ 13 | @Getter 14 | @Setter 15 | @ToString 16 | public class Traveller { 17 | 18 | private String id; 19 | /** 20 | * 旅客姓名 21 | */ 22 | private String name; 23 | /** 24 | * 旅客性别 25 | */ 26 | private String gender; 27 | /** 28 | * 手机号 29 | */ 30 | private String phoneNum; 31 | /** 32 | * 证件类型 33 | * 0:身份证 34 | * 1:护照 35 | * 2:军官证 36 | */ 37 | private Integer credentialsType; 38 | /** 39 | * 证件类型字符串 40 | */ 41 | private String credentialsTypeStr; 42 | /** 43 | * 证件号 44 | */ 45 | private String credentialsNum; 46 | /** 47 | * 旅客类型 48 | * 0:成人 49 | * 1:儿童 50 | */ 51 | private Integer travellerType; 52 | /** 53 | * 旅客类型字符串 54 | */ 55 | private String travellerTypeStr; 56 | 57 | public String getCredentialsTypeStr() { 58 | if (credentialsType == 0) { 59 | return "身份证"; 60 | } else if (credentialsType == 1) { 61 | return "护照"; 62 | } else { 63 | return "军官证"; 64 | } 65 | } 66 | 67 | 68 | public String getTravellerTypeStr() { 69 | return travellerType == 0 ? "成人" : "儿童"; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.zephon.domain; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | import java.io.Serializable; 7 | import java.util.Set; 8 | 9 | /** 10 | * @author Zephon 11 | * @version V1.0 12 | * @Package com.zephon.domain 13 | * 用户 14 | */ 15 | @Getter 16 | @Setter 17 | @ToString 18 | public class UserInfo implements Serializable { 19 | private String id; 20 | /** 21 | * 邮箱 22 | */ 23 | private String email; 24 | /** 25 | * 用户名 26 | */ 27 | private String username; 28 | /** 29 | * 密码 30 | */ 31 | private String password; 32 | /** 33 | * 手机号 34 | */ 35 | private String phoneNum; 36 | /** 37 | * 用户状态 38 | * 0:未启用 39 | * 1:已启用 40 | */ 41 | private Integer status; 42 | /** 43 | * 用户头像 44 | */ 45 | private String avatar; 46 | 47 | /** 48 | * 用户对应的角色 49 | */ 50 | private Set roles; 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/entity/JWTToken.java: -------------------------------------------------------------------------------- 1 | package com.zephon.entity; 2 | 3 | import org.apache.shiro.authc.AuthenticationToken; 4 | 5 | /** 6 | * @author Zephon 7 | * @version V1.0 8 | * @Package com.zephon.entity 9 | */ 10 | 11 | public class JWTToken implements AuthenticationToken { 12 | 13 | /** 14 | * 密钥 15 | */ 16 | private String token; 17 | 18 | public JWTToken(String token) { 19 | this.token = token; 20 | } 21 | 22 | @Override 23 | public Object getPrincipal() { 24 | return token; 25 | } 26 | 27 | @Override 28 | public Object getCredentials() { 29 | return token; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/entity/Result.java: -------------------------------------------------------------------------------- 1 | package com.zephon.entity; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | /** 7 | * @author Zephon 8 | * @version V1.0 9 | * @Package com.zephon.entity 10 | * 返回结果 11 | */ 12 | @Getter 13 | @Setter 14 | public class Result { 15 | /** 16 | * 是否成功 17 | */ 18 | private boolean success; 19 | /** 20 | * 返回码 21 | */ 22 | private Integer code; 23 | /** 24 | * 返回信息 25 | */ 26 | private String message; 27 | /** 28 | * 返回数据 29 | */ 30 | private Object data; 31 | 32 | public Result(ResultCode resultCode) { 33 | this.success = resultCode.success; 34 | this.code = resultCode.code; 35 | this.message = resultCode.message; 36 | } 37 | 38 | public Result(ResultCode resultCode, Object data) { 39 | this.success = resultCode.success; 40 | this.code = resultCode.code; 41 | this.message = resultCode.message; 42 | this.data = data; 43 | } 44 | } -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/src/main/java/com/zephon/entity/ResultCode.java: -------------------------------------------------------------------------------- 1 | package com.zephon.entity; 2 | 3 | /** 4 | * @author Zephon 5 | * @version V1.0 6 | * @Package com.zephon.entity 7 | * 返回状态码 8 | */ 9 | public enum ResultCode { 10 | /** 11 | * 成功 12 | */ 13 | SUCCESS(true,10000,"操作成功!"), 14 | /** 15 | * 失败 16 | */ 17 | FAIL(false,10001,"操作失败"), 18 | /** 19 | * 未认证 20 | */ 21 | UNAUTHENTICATED(false, 10002, "您还未登录"), 22 | /** 23 | * 权限不足 24 | */ 25 | UNAUTHORISE(false, 10003, "权限不足"), 26 | /** 27 | * 系统繁忙 28 | */ 29 | SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"), 30 | 31 | /** 32 | * 用户操作返回码:20001 33 | */ 34 | USERNAME_PASSWORD_ERROR(false,20001,"用户名或密码错误"), 35 | 36 | INFORMATION_NOT_STANDARD(false,20002,"注册信息不规范"), 37 | 38 | /** 39 | * 产品操作返回码:30001 40 | */ 41 | DATE_FORMAT_ERROR(false,30001,"日期格式错误"), 42 | 43 | /** 44 | * 角色操作返回码:40001 45 | */ 46 | ROLE_INFORMATION_ERROR(false,40001,"角色信息错误"), 47 | 48 | /** 49 | * 权限操作返回码:50001 50 | */ 51 | PERMISSION_INFORMATION_ERROR(false,50001,"权限信息错误"); 52 | 53 | boolean success; 54 | Integer code; 55 | String message; 56 | ResultCode(boolean success,Integer code,String message){ 57 | this.success = success; 58 | this.code = code; 59 | this.message = message; 60 | } 61 | public boolean success(){ 62 | return success; 63 | } 64 | public int code(){ 65 | return code; 66 | } 67 | public String message(){ 68 | return message; 69 | } 70 | } -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Mon Apr 06 13:22:04 CST 2020 3 | version=1.0-SNAPSHOT 4 | groupId=com.zephon 5 | artifactId=ssm_project_domain 6 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/zephon/domain/Role.class 2 | com/zephon/domain/Member.class 3 | com/zephon/entity/ResultCode.class 4 | com/zephon/domain/Permission.class 5 | com/zephon/domain/Order.class 6 | com/zephon/domain/Product.class 7 | com/zephon/entity/Result.class 8 | com/zephon/entity/JWTToken.class 9 | com/zephon/domain/SysLog.class 10 | com/zephon/domain/UserInfo.class 11 | com/zephon/domain/Traveller.class 12 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/UserInfo.java 2 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/entity/Result.java 3 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Order.java 4 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Product.java 5 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/SysLog.java 6 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Traveller.java 7 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Role.java 8 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/entity/ResultCode.java 9 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/entity/JWTToken.java 10 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Permission.java 11 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_domain/src/main/java/com/zephon/domain/Member.java 12 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm_project/ssm_project_domain/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -------------------------------------------------------------------------------- /ssm_project/ssm_project_domain/target/ssm_project_domain-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm_project/ssm_project_domain/target/ssm_project_domain-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ssm_project 7 | com.zephon 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | ssm_project_service 13 | 14 | 15 | com.zephon 16 | ssm_project_domain 17 | 1.0-SNAPSHOT 18 | compile 19 | 20 | 21 | com.zephon 22 | ssm_project_dao 23 | 1.0-SNAPSHOT 24 | compile 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/ILogService.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service; 2 | 3 | import com.zephon.domain.SysLog; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author Zephon 9 | * @version V1.0 10 | * @Package com.zephon.service 11 | * @date 2020/3/28 下午1:17 12 | * @Copyright © 13 | */ 14 | public interface ILogService { 15 | List findAll(Integer page,Integer pageSize); 16 | 17 | void save(SysLog log); 18 | } 19 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/IOrderService.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service; 2 | 3 | import com.zephon.domain.Order; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author Zephon 9 | * @version V1.0 10 | * @Package com.zephon.service 11 | * @date 2020/3/24 下午2:19 12 | * @Copyright © 13 | */ 14 | public interface IOrderService { 15 | List findAll(Integer page,Integer pageSize); 16 | Order findById(String id); 17 | 18 | void saveOrder(Order order); 19 | } 20 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/IPermissionService.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service; 2 | 3 | import com.zephon.domain.Permission; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author Zephon 9 | * @version V1.0 10 | * @Package com.zephon.service 11 | * @date 2020/3/27 下午2:58 12 | * @Copyright © 13 | */ 14 | public interface IPermissionService { 15 | 16 | List findAll(); 17 | 18 | void save(Permission permission); 19 | 20 | Permission findById(String id); 21 | 22 | void delete(String id); 23 | } 24 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/IProductService.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service; 2 | 3 | import com.zephon.domain.Product; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author Zephon 9 | * @version V1.0 10 | * @Package com.zephon.service 11 | * @date 2020/3/23 下午9:58 12 | * @Copyright © 13 | */ 14 | public interface IProductService { 15 | List findAll(Integer page,Integer pageSize); 16 | void save(Product product); 17 | 18 | Product findById(String id); 19 | 20 | void update(Product product); 21 | } 22 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/IRoleService.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service; 2 | 3 | import com.zephon.domain.Permission; 4 | import com.zephon.domain.Role; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author Zephon 10 | * @version V1.0 11 | * @Package com.zephon.service 12 | * @date 2020/3/27 下午2:36 13 | * @Copyright © 14 | */ 15 | public interface IRoleService { 16 | 17 | List findAll(); 18 | 19 | void save(Role role); 20 | 21 | List findOtherPermissionByRoleId(String roleId); 22 | 23 | void addPermissionsToRole(String roleId, String[] permissionIds); 24 | 25 | Role findById(String id); 26 | 27 | void delete(String id); 28 | } 29 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service; 2 | 3 | import com.zephon.domain.Role; 4 | import com.zephon.domain.UserInfo; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import java.io.IOException; 9 | import java.util.List; 10 | 11 | /** 12 | * @author Zephon 13 | * @version V1.0 14 | * @Package com.zephon.service 15 | * @date 2020/3/21 下午5:42 16 | * @Copyright © 17 | */ 18 | public interface IUserService { 19 | 20 | UserInfo findByUsername(String username); 21 | 22 | List findAll(Integer page,Integer pageSize); 23 | 24 | void save (UserInfo userInfo) throws Exception; 25 | 26 | UserInfo findById(String id); 27 | 28 | List findOtherRolesById(String id); 29 | 30 | void addRole(String userId, String[] roleIds); 31 | } 32 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/LogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service.impl; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.zephon.dao.ILogDao; 5 | import com.zephon.domain.SysLog; 6 | import com.zephon.service.ILogService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | import java.util.UUID; 12 | 13 | /** 14 | * @author Zephon 15 | * @version V1.0 16 | * @Package com.zephon.service.impl 17 | * @date 2020/3/28 下午1:17 18 | * @Copyright © 19 | */ 20 | @Service("logService") 21 | public class LogServiceImpl implements ILogService { 22 | @Autowired 23 | private ILogDao logDao; 24 | @Override 25 | public List findAll(Integer page, Integer pageSize) { 26 | PageHelper.startPage(page,pageSize); 27 | return logDao.findAll(); 28 | } 29 | 30 | @Override 31 | public void save(SysLog log) { 32 | log.setId(UUID.randomUUID().toString().replace("-","")); 33 | logDao.save(log); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/OrderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service.impl; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.zephon.dao.IOrderDao; 5 | import com.zephon.domain.Member; 6 | import com.zephon.domain.Order; 7 | import com.zephon.domain.Product; 8 | import com.zephon.domain.Traveller; 9 | import com.zephon.service.IOrderService; 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.List; 15 | 16 | /** 17 | * @author Zephon 18 | * @version V1.0 19 | * @Package com.zephon.service.impl 20 | * @date 2020/3/24 下午2:20 21 | * @Copyright © 22 | */ 23 | @Service("orderService") 24 | public class OrderServiceImpl implements IOrderService { 25 | @Autowired 26 | private IOrderDao orderDao; 27 | @Override 28 | public List findAll(Integer page,Integer pageSize) { 29 | PageHelper.startPage(page,pageSize); 30 | return orderDao.findAll(); 31 | } 32 | 33 | @Override 34 | public Order findById(String id) { 35 | return orderDao.findById(id); 36 | } 37 | 38 | @Override 39 | @Transactional 40 | public void saveOrder(Order order) { 41 | Order o = orderDao.findById(order.getId()); 42 | o.setOrderNum(order.getOrderNum()); 43 | o.setOrderTime(order.getOrderTime()); 44 | o.setProduct(order.getProduct()); 45 | o.setOrderDesc(order.getOrderDesc()); 46 | o.setMember(order.getMember()); 47 | o.setTravellers(order.getTravellers()); 48 | o.setPeopleCount(order.getTravellers().size()); 49 | o.setPayType(order.getPayType()); 50 | orderDao.saveOrder(o); 51 | Member member = o.getMember(); 52 | orderDao.saveMember(member); 53 | List travellers = o.getTravellers(); 54 | for (Traveller traveller : travellers) { 55 | orderDao.saveTraveller(traveller); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/PermissionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service.impl; 2 | 3 | import com.zephon.dao.IPermissionDao; 4 | import com.zephon.domain.Permission; 5 | import com.zephon.service.IPermissionService; 6 | import com.zephon.service.IProductService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | import java.util.List; 12 | import java.util.UUID; 13 | 14 | /** 15 | * @author Zephon 16 | * @version V1.0 17 | * @Package com.zephon.service.impl 18 | * @date 2020/3/27 下午2:58 19 | * @Copyright © 20 | */ 21 | @Service("permissionService") 22 | public class PermissionServiceImpl implements IPermissionService { 23 | @Autowired 24 | private IPermissionDao permissionDao; 25 | @Override 26 | public List findAll() { 27 | return permissionDao.findAll(); 28 | } 29 | 30 | @Override 31 | public void save(Permission permission) { 32 | permission.setId(UUID.randomUUID().toString().replace("-","")); 33 | permissionDao.save(permission); 34 | } 35 | 36 | @Override 37 | public Permission findById(String id) { 38 | return permissionDao.findById(id); 39 | } 40 | 41 | @Override 42 | @Transactional 43 | public void delete(String id) { 44 | permissionDao.delete(id); 45 | permissionDao.deleteFromRolePermission(id); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/ProductServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service.impl; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.zephon.dao.IProductDao; 5 | import com.zephon.domain.Product; 6 | import com.zephon.service.IProductService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | import java.util.UUID; 12 | 13 | /** 14 | * @author Zephon 15 | * @version V1.0 16 | * @Package com.zephon.service.impl 17 | * @date 2020/3/23 下午9:58 18 | * @Copyright © 19 | */ 20 | @Service("productService") 21 | public class ProductServiceImpl implements IProductService { 22 | @Autowired 23 | private IProductDao productDao; 24 | @Override 25 | public List findAll(Integer page,Integer pageSize) { 26 | PageHelper.startPage(page,pageSize); 27 | return productDao.findAll(); 28 | } 29 | 30 | @Override 31 | public void save(Product product) { 32 | product.setId(UUID.randomUUID().toString().replace("-","")); 33 | productDao.save(product); 34 | } 35 | 36 | @Override 37 | public Product findById(String id) { 38 | return productDao.findById(id); 39 | } 40 | 41 | @Override 42 | public void update(Product p) { 43 | Product product = productDao.findById(p.getId()); 44 | product.setProductNum(p.getProductNum()); 45 | product.setProductName(p.getProductName()); 46 | product.setCityName(p.getCityName()); 47 | product.setDepartureTime(p.getDepartureTime()); 48 | product.setProductPrice(p.getProductPrice()); 49 | product.setProductDesc(p.getProductDesc()); 50 | product.setProductStatus(p.getProductStatus()); 51 | productDao.update(product); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service.impl; 2 | 3 | import com.zephon.dao.IRoleDao; 4 | import com.zephon.domain.Permission; 5 | import com.zephon.domain.Role; 6 | import com.zephon.service.IRoleService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | import java.util.List; 12 | import java.util.UUID; 13 | 14 | /** 15 | * @author Zephon 16 | * @version V1.0 17 | * @Package com.zephon.service.impl 18 | * @date 2020/3/27 下午2:37 19 | * @Copyright © 20 | */ 21 | @Service("roleService") 22 | public class RoleServiceImpl implements IRoleService { 23 | @Autowired 24 | private IRoleDao roleDao; 25 | @Override 26 | public List findAll() { 27 | return roleDao.findAll(); 28 | } 29 | 30 | @Override 31 | public void save(Role role) { 32 | role.setId(UUID.randomUUID().toString().replace("-","")); 33 | roleDao.save(role); 34 | } 35 | 36 | @Override 37 | public List findOtherPermissionByRoleId(String roleId) { 38 | return roleDao.findOtherPermissionByRoleId(roleId); 39 | } 40 | 41 | @Override 42 | public void addPermissionsToRole(String roleId, String[] permissionIds) { 43 | for (String permissionId : permissionIds) { 44 | roleDao.addPermissionToRole(roleId,permissionId); 45 | } 46 | } 47 | 48 | @Override 49 | public Role findById(String id) { 50 | return roleDao.findById(id); 51 | } 52 | 53 | @Override 54 | @Transactional 55 | public void delete(String id) { 56 | roleDao.delete(id); 57 | roleDao.deleteFromUserRole(id); 58 | roleDao.deleteFromRolePermission(id); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zephon.service.impl; 2 | import com.github.pagehelper.PageHelper; 3 | import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; 4 | import com.zephon.dao.IUserDao; 5 | import com.zephon.domain.Role; 6 | import com.zephon.domain.UserInfo; 7 | 8 | import com.zephon.service.IUserService; 9 | import org.apache.shiro.crypto.hash.Md5Hash; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.web.multipart.MultipartFile; 13 | 14 | import java.io.IOException; 15 | import java.util.List; 16 | import java.util.UUID; 17 | 18 | /** 19 | * @author Zephon 20 | * @version V1.0 21 | * @Package com.zephon.service.impl 22 | * @date 2020/3/21 下午5:43 23 | * @Copyright © 24 | */ 25 | @Service("userService") 26 | public class UserServiceImpl implements IUserService { 27 | @Autowired 28 | private IUserDao userDao; 29 | @Override 30 | public UserInfo findByUsername(String username) { 31 | return userDao.findByUsername(username); 32 | } 33 | 34 | @Override 35 | public List findAll(Integer page,Integer pageSize) { 36 | PageHelper.startPage(page,pageSize); 37 | // 38 | // Integer pageLimit = (page-1)*pageSize; 39 | // List list = userDao.findAll(pageLimit,pageSize); 40 | // System.out.println(list); 41 | return userDao.findAll(); 42 | } 43 | 44 | @Override 45 | public void save(UserInfo userInfo) throws Exception { 46 | String password = userInfo.getPassword(); 47 | password = new Md5Hash(password, userInfo.getUsername(), 3).toString(); 48 | userInfo.setPassword(password); 49 | userInfo.setId(UUID.randomUUID().toString().replace("-","")); 50 | userDao.save(userInfo); 51 | } 52 | 53 | @Override 54 | public UserInfo findById(String id) { 55 | return userDao.findById(id); 56 | } 57 | 58 | @Override 59 | public List findOtherRolesById(String id) { 60 | return userDao.findOtherRolesById(id); 61 | } 62 | 63 | @Override 64 | public void addRole(String userId, String[] roleIds) { 65 | for (String roleId : roleIds) { 66 | userDao.addRole(userId,roleId); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Mon Apr 06 13:22:06 CST 2020 3 | version=1.0-SNAPSHOT 4 | groupId=com.zephon 5 | artifactId=ssm_project_service 6 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/zephon/service/impl/ProductServiceImpl.class 2 | com/zephon/service/IOrderService.class 3 | com/zephon/service/impl/PermissionServiceImpl.class 4 | com/zephon/service/impl/LogServiceImpl.class 5 | com/zephon/service/impl/RoleServiceImpl.class 6 | com/zephon/service/IRoleService.class 7 | com/zephon/service/impl/UserServiceImpl.class 8 | com/zephon/service/ILogService.class 9 | com/zephon/service/impl/OrderServiceImpl.class 10 | com/zephon/service/IProductService.class 11 | com/zephon/service/IUserService.class 12 | com/zephon/service/IPermissionService.class 13 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/LogServiceImpl.java 2 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/RoleServiceImpl.java 3 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/UserServiceImpl.java 4 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/ProductServiceImpl.java 5 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/ILogService.java 6 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/IPermissionService.java 7 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/IProductService.java 8 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/PermissionServiceImpl.java 9 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/IUserService.java 10 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/IRoleService.java 11 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/impl/OrderServiceImpl.java 12 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_service/src/main/java/com/zephon/service/IOrderService.java 13 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm_project/ssm_project_service/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -------------------------------------------------------------------------------- /ssm_project/ssm_project_service/target/ssm_project_service-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm_project/ssm_project_service/target/ssm_project_service-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ssm_project 7 | com.zephon 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | ssm_project_web 13 | 14 | 15 | com.zephon 16 | ssm_project_domain 17 | 1.0-SNAPSHOT 18 | compile 19 | 20 | 21 | com.zephon 22 | ssm_project_service 23 | 1.0-SNAPSHOT 24 | compile 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/java/com/zephon/aop/LogAop.java: -------------------------------------------------------------------------------- 1 | package com.zephon.aop; 2 | 3 | import com.zephon.domain.SysLog; 4 | import com.zephon.service.ILogService; 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.After; 7 | import org.aspectj.lang.annotation.Aspect; 8 | import org.aspectj.lang.annotation.Before; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Component; 11 | import javax.servlet.http.HttpServletRequest; 12 | import java.lang.reflect.Method; 13 | import java.util.Date; 14 | 15 | /** 16 | * @author Zephon 17 | * @version V1.0 18 | */ 19 | @Component 20 | @Aspect 21 | public class LogAop { 22 | @Autowired 23 | private HttpServletRequest request; 24 | @Autowired 25 | private ILogService logService; 26 | /** 27 | * 开始时间 28 | */ 29 | private Date visitTime; 30 | /** 31 | * 访问的类 32 | */ 33 | private Class cls; 34 | /** 35 | * 访问的方法 36 | */ 37 | private Method method; 38 | 39 | /** 40 | * 前置通知 41 | * 用于获取开始时间,执行的类是哪一个,执行的方法是哪一个 42 | * 43 | * @param jp 44 | */ 45 | @Before("execution(* com.zephon.controller.*.*(..))") 46 | public void doBefore(JoinPoint jp) throws NoSuchMethodException { 47 | visitTime = new Date(); 48 | cls = jp.getTarget().getClass(); 49 | String methodName = jp.getSignature().getName(); 50 | // 获取访问方法的参数 51 | Object[] args = jp.getArgs(); 52 | if (args == null || args.length == 0) { 53 | method = cls.getMethod(methodName); 54 | } else { 55 | Class[] classArgs = new Class[args.length]; 56 | for (int i = 0; i < args.length; i++) { 57 | classArgs[i] = args[i].getClass(); 58 | } 59 | try { 60 | method = cls.getMethod(methodName, classArgs); 61 | } catch (NoSuchMethodException e) { 62 | method = null; 63 | // e.printStackTrace(); 64 | } catch (SecurityException e) { 65 | e.printStackTrace(); 66 | } 67 | } 68 | } 69 | 70 | /** 71 | * 后置通知 72 | * 73 | * @param jp 74 | */ 75 | @After("execution(* com.zephon.controller.*.*(..))") 76 | public void doAfter(JoinPoint jp) throws Exception { 77 | // 获取执行时长 78 | long time = System.currentTimeMillis() - visitTime.getTime(); 79 | // 获取URL 80 | String url = ""; 81 | if (cls != null && method != null && cls != LogAop.class) { 82 | url = request.getRequestURI(); 83 | String ip = request.getRemoteAddr(); 84 | String username= (String) request.getSession().getAttribute("username"); 85 | 86 | if ("/ssm/logs".equals(url)) { 87 | return; 88 | } 89 | // 将日志相关信息封装到Syslog对象 90 | SysLog sysLog = new SysLog(); 91 | sysLog.setExecutionTime(time); 92 | sysLog.setIp(ip); 93 | sysLog.setUrl(url); 94 | sysLog.setUsername(username); 95 | sysLog.setVisitTime(visitTime); 96 | sysLog.setMethod("[类名] " + cls.getName() + "[方法名] " + method.getName()); 97 | // 调用 Service完成插入操作 98 | logService.save(sysLog); 99 | 100 | } 101 | 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/java/com/zephon/controller/LogController.java: -------------------------------------------------------------------------------- 1 | package com.zephon.controller; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.zephon.domain.SysLog; 5 | import com.zephon.domain.UserInfo; 6 | import com.zephon.entity.Result; 7 | import com.zephon.entity.ResultCode; 8 | import com.zephon.service.ILogService; 9 | import org.apache.shiro.authz.annotation.RequiresPermissions; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.GetMapping; 12 | import org.springframework.web.bind.annotation.RequestParam; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * @author Zephon 19 | * @version V1.0 20 | * @Package com.zephon.controller 21 | * @date 2020/3/28 下午1:15 22 | * @Copyright © 23 | */ 24 | @RestController 25 | public class LogController { 26 | @Autowired 27 | private ILogService logService; 28 | @GetMapping("/logs") 29 | @RequiresPermissions("/logs/findAll") 30 | public Result findAll(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "5") Integer limit) { 31 | List list = logService.findAll(page,limit); 32 | PageInfo pageInfo = new PageInfo(list); 33 | return new Result(ResultCode.SUCCESS, pageInfo); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/java/com/zephon/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.zephon.controller; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.zephon.domain.Order; 5 | import com.zephon.entity.Result; 6 | import com.zephon.entity.ResultCode; 7 | import com.zephon.service.IOrderService; 8 | import org.apache.shiro.authz.annotation.RequiresPermissions; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.GetMapping; 11 | import org.springframework.web.bind.annotation.PathVariable; 12 | import org.springframework.web.bind.annotation.PutMapping; 13 | import org.springframework.web.bind.annotation.RequestBody; 14 | import org.springframework.web.bind.annotation.RequestParam; 15 | import org.springframework.web.bind.annotation.RestController; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * @author Zephon 21 | * @version V1.0 22 | * @Package com.zephon.controller 23 | * @date 2020/3/24 下午2:17 24 | * @Copyright © 25 | */ 26 | @RestController 27 | public class OrderController { 28 | @Autowired 29 | private IOrderService orderService; 30 | 31 | @GetMapping("/orders") 32 | @RequiresPermissions("/orders") 33 | public Result findAll(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "5") Integer limit) { 34 | List list = orderService.findAll(page, limit); 35 | PageInfo pageInfo = new PageInfo(list); 36 | return new Result(ResultCode.SUCCESS, pageInfo); 37 | } 38 | @GetMapping("/order/{id}") 39 | @RequiresPermissions("/order/*") 40 | public Result findById(@PathVariable("id") String id){ 41 | Order order = orderService.findById(id); 42 | return new Result(ResultCode.SUCCESS,order); 43 | } 44 | 45 | @PutMapping("/order") 46 | @RequiresPermissions("/order") 47 | public Result saveOrder(@RequestBody Order order){ 48 | try { 49 | orderService.saveOrder(order); 50 | return new Result(ResultCode.SUCCESS); 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | return new Result(ResultCode.FAIL); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/java/com/zephon/controller/PermissionController.java: -------------------------------------------------------------------------------- 1 | package com.zephon.controller; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.zephon.domain.Permission; 5 | import com.zephon.entity.Result; 6 | import com.zephon.entity.ResultCode; 7 | import com.zephon.service.IPermissionService; 8 | import org.apache.shiro.authz.annotation.RequiresPermissions; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.DeleteMapping; 11 | import org.springframework.web.bind.annotation.GetMapping; 12 | import org.springframework.web.bind.annotation.PathVariable; 13 | import org.springframework.web.bind.annotation.PostMapping; 14 | import org.springframework.web.bind.annotation.RequestBody; 15 | import org.springframework.web.bind.annotation.RestController; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * @author Zephon 21 | * @version V1.0 22 | * @Package com.zephon.controller 23 | * @date 2020/3/27 下午2:55 24 | * @Copyright © 25 | */ 26 | @RestController 27 | public class PermissionController { 28 | @Autowired 29 | private IPermissionService permissionService; 30 | @GetMapping("/permissions") 31 | @RequiresPermissions("/permission/findAll") 32 | public Result findAll(){ 33 | List list = permissionService.findAll(); 34 | PageInfo pageInfo = new PageInfo(list); 35 | return new Result(ResultCode.SUCCESS,pageInfo); 36 | } 37 | @PostMapping("/permission") 38 | @RequiresPermissions("/permission/save") 39 | public Result save(@RequestBody Permission permission){ 40 | try { 41 | permissionService.save(permission); 42 | return new Result(ResultCode.SUCCESS); 43 | }catch (Exception e){ 44 | e.printStackTrace(); 45 | return new Result(ResultCode.PERMISSION_INFORMATION_ERROR); 46 | } 47 | } 48 | @GetMapping("/permission/{id}") 49 | @RequiresPermissions("/permission/findById") 50 | public Result findById(@PathVariable String id){ 51 | Permission permission = permissionService.findById(id); 52 | return new Result(ResultCode.SUCCESS,permission); 53 | } 54 | @DeleteMapping("/permission/{id}") 55 | @RequiresPermissions("/permission/delete") 56 | public Result delete(@PathVariable String id){ 57 | try { 58 | permissionService.delete(id); 59 | return new Result(ResultCode.SUCCESS); 60 | } catch (Exception e) { 61 | e.printStackTrace(); 62 | return new Result(ResultCode.FAIL); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/java/com/zephon/controller/ProductController.java: -------------------------------------------------------------------------------- 1 | package com.zephon.controller; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.zephon.domain.Product; 5 | import com.zephon.entity.Result; 6 | import com.zephon.entity.ResultCode; 7 | import com.zephon.service.IProductService; 8 | import com.zephon.utils.DateUtil; 9 | import org.apache.shiro.authz.annotation.RequiresPermissions; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.GetMapping; 12 | import org.springframework.web.bind.annotation.PathVariable; 13 | import org.springframework.web.bind.annotation.PostMapping; 14 | import org.springframework.web.bind.annotation.PutMapping; 15 | import org.springframework.web.bind.annotation.RequestBody; 16 | import org.springframework.web.bind.annotation.RequestParam; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import java.text.ParseException; 20 | import java.util.Date; 21 | import java.util.HashMap; 22 | import java.util.List; 23 | import java.util.Map; 24 | 25 | /** 26 | * @author Zephon 27 | * @version V1.0 28 | * @Package com.zephon.controller 29 | * @date 2020/3/23 下午9:56 30 | * @Copyright © 31 | */ 32 | @RestController 33 | public class ProductController { 34 | @Autowired 35 | private IProductService productService; 36 | 37 | @GetMapping("/products") 38 | @RequiresPermissions("/product/findAll") 39 | public Result findAll(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "5") Integer limit) { 40 | List list = productService.findAll(page, limit); 41 | PageInfo pageInfo = new PageInfo(list); 42 | // Map map = new HashMap<>(); 43 | // map.put("list",all); 44 | // map.put("total",all.size()); 45 | return new Result(ResultCode.SUCCESS, pageInfo); 46 | } 47 | 48 | @PostMapping("/product") 49 | @RequiresPermissions("/product/save") 50 | public Result save(@RequestBody Map map) { 51 | System.out.println(map); 52 | try { 53 | String departureTime = (String) map.get("departureTime"); 54 | Date date = DateUtil.string2Date(departureTime, "yyyy-MM-dd HH:mm"); 55 | Product product = new Product(); 56 | product.setProductNum(map.get("productNum")); 57 | product.setProductName(map.get("productName")); 58 | product.setCityName(map.get("cityName")); 59 | product.setDepartureTime(date); 60 | product.setProductPrice(Double.parseDouble(map.get("productPrice"))); 61 | product.setProductDesc(map.get("productDesc")); 62 | product.setProductStatus(Integer.parseInt(map.get("productStatus"))); 63 | productService.save(product); 64 | } catch (ParseException e) { 65 | e.printStackTrace(); 66 | return new Result(ResultCode.DATE_FORMAT_ERROR); 67 | } 68 | 69 | return new Result(ResultCode.SUCCESS); 70 | } 71 | 72 | @GetMapping("/product/{id}") 73 | @RequiresPermissions("/product/findById") 74 | public Result findById(@PathVariable("id") String id){ 75 | Product p = productService.findById(id); 76 | return new Result(ResultCode.SUCCESS,p); 77 | } 78 | @PutMapping("/product") 79 | @RequiresPermissions("/product/update") 80 | public Result update(@RequestBody Product product){ 81 | productService.update(product); 82 | return new Result(ResultCode.SUCCESS); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/java/com/zephon/controller/RoleController.java: -------------------------------------------------------------------------------- 1 | package com.zephon.controller; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.zephon.domain.Permission; 5 | import com.zephon.domain.Role; 6 | import com.zephon.entity.Result; 7 | import com.zephon.entity.ResultCode; 8 | import com.zephon.service.IRoleService; 9 | import org.apache.shiro.authz.annotation.RequiresPermissions; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.DeleteMapping; 12 | import org.springframework.web.bind.annotation.GetMapping; 13 | import org.springframework.web.bind.annotation.PathVariable; 14 | import org.springframework.web.bind.annotation.PostMapping; 15 | import org.springframework.web.bind.annotation.RequestBody; 16 | import org.springframework.web.bind.annotation.RequestParam; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | /** 23 | * @author Zephon 24 | * @version V1.0 25 | * @Package com.zephon.controller 26 | * @date 2020/3/27 下午2:34 27 | * @Copyright © 28 | */ 29 | @RestController 30 | public class RoleController { 31 | @Autowired 32 | private IRoleService roleService; 33 | @GetMapping("/roles") 34 | @RequiresPermissions("/role/findAll") 35 | public Result findAll(){ 36 | List list = roleService.findAll(); 37 | PageInfo pageInfo = new PageInfo(list); 38 | return new Result(ResultCode.SUCCESS,pageInfo); 39 | } 40 | 41 | @PostMapping("/role") 42 | @RequiresPermissions("/role/save") 43 | public Result save(@RequestBody Role role){ 44 | try{ 45 | roleService.save(role); 46 | return new Result(ResultCode.SUCCESS); 47 | }catch (Exception e){ 48 | e.printStackTrace(); 49 | return new Result(ResultCode.ROLE_INFORMATION_ERROR); 50 | } 51 | } 52 | @GetMapping("/role/permission/{id}") 53 | @RequiresPermissions("/role/findOtherPermissionByRoleId") 54 | public Result findOtherPermissionByRoleId(@PathVariable("id") String roleId){ 55 | List otherPermissions = roleService.findOtherPermissionByRoleId(roleId); 56 | return new Result(ResultCode.SUCCESS,otherPermissions); 57 | } 58 | 59 | @GetMapping("/role/permission") 60 | @RequiresPermissions("/role/addPermission") 61 | public Result addPermission(@RequestParam("roleId") String roleId,@RequestParam("permissionIds") String[] permissionIds){ 62 | System.out.println(roleId); 63 | System.out.println(Arrays.toString(permissionIds)); 64 | try { 65 | roleService.addPermissionsToRole(roleId,permissionIds); 66 | return new Result(ResultCode.SUCCESS); 67 | } catch (Exception e) { 68 | e.printStackTrace(); 69 | return new Result(ResultCode.SERVER_ERROR); 70 | } 71 | } 72 | @GetMapping("role/{id}") 73 | @RequiresPermissions("/role/findById") 74 | public Result findById(@PathVariable("id") String id){ 75 | Role role = roleService.findById(id); 76 | return new Result(ResultCode.SUCCESS,role); 77 | } 78 | 79 | @DeleteMapping("role/{id}") 80 | @RequiresPermissions("/role/delete") 81 | public Result delete(@PathVariable("id") String id){ 82 | try { 83 | roleService.delete(id); 84 | return new Result(ResultCode.SUCCESS); 85 | } catch (Exception e) { 86 | e.printStackTrace(); 87 | return new Result(ResultCode.FAIL); 88 | } 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/resources/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.cj.jdbc.Driver 2 | jdbc.url=jdbc:mysql:///ssm_project 3 | jdbc.username=root 4 | jdbc.password=123456 -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | #you cannot specify every priority with different file for log4j 2 | log4j.rootLogger=debug,stdout,info,debug,warn,error 3 | #log4j.rootLogger=info,stdout 4 | 5 | #console 6 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 7 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 8 | log4j.appender.stdout.layout.ConversionPattern= [%d{yyyy-MM-dd HH:mm:ss a}]:%p %l%m%n 9 | 10 | #info log 11 | log4j.logger.info=info 12 | log4j.appender.info=org.apache.log4j.DailyRollingFileAppender 13 | log4j.appender.info.DatePattern='_'yyyy-MM-dd'.log' 14 | log4j.appender.info.File=./src/com/zephon/log/error.log 15 | log4j.appender.info.Append=true 16 | log4j.appender.info.Threshold=INFO 17 | log4j.appender.info.layout=org.apache.log4j.PatternLayout 18 | log4j.appender.info.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread: %t][ Class:%c >> Method: %l ]%n%p:%m%n 19 | 20 | #debug log 21 | log4j.logger.debug=debug 22 | log4j.appender.debug=org.apache.log4j.DailyRollingFileAppender 23 | log4j.appender.debug.DatePattern='_'yyyy-MM-dd'.log' 24 | log4j.appender.debug.File=./src/com/zephon/log/error.log 25 | log4j.appender.debug.Append=true 26 | log4j.appender.debug.Threshold=DEBUG 27 | log4j.appender.debug.layout=org.apache.log4j.PatternLayout 28 | log4j.appender.debug.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread: %t][ Class:%c >> Method: %l ]%n%p:%m%n 29 | 30 | #warn log 31 | log4j.logger.warn=warn 32 | log4j.appender.warn=org.apache.log4j.DailyRollingFileAppender 33 | log4j.appender.warn.DatePattern='_'yyyy-MM-dd'.log' 34 | log4j.appender.warn.File=./src/com/zephon/log/error.log 35 | log4j.appender.warn.Append=true 36 | log4j.appender.warn.Threshold=WARN 37 | log4j.appender.warn.layout=org.apache.log4j.PatternLayout 38 | log4j.appender.warn.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread: %t][ Class:%c >> Method: %l ]%n%p:%m%n 39 | 40 | #error 41 | log4j.logger.error=error 42 | log4j.appender.error = org.apache.log4j.DailyRollingFileAppender 43 | log4j.appender.error.DatePattern='_'yyyy-MM-dd'.log' 44 | log4j.appender.error.File = ./src/com/zephon/log/error.log 45 | log4j.appender.error.Append = true 46 | log4j.appender.error.Threshold = ERROR 47 | log4j.appender.error.layout = org.apache.log4j.PatternLayout 48 | log4j.appender.error.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss a} [Thread: %t][ Class:%c >> Method: %l ]%n%p:%m%n -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/resources/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/resources/redis.properties: -------------------------------------------------------------------------------- 1 | #ip 2 | redis.host=127.0.0.1 3 | #端口 4 | redis.port=6379 5 | #密码 6 | #最大空闲数 7 | redis.maxIdle=100 8 | #最大连接数 9 | redis.maxActive=300 10 | #连接时最大的等待时间(毫秒) 11 | redis.maxWait=1500 12 | #在提取一个jedis实例时,是否提前进行验证操作;如果为true,则得到的jedis实例均是可用的 13 | redis.testOnBorrow=true -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/resources/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/resources/spring-redis.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 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 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/resources/spring-shiro.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | /user/login = anon 31 | 32 | /user/logout = anon 33 | /autherror = anon 34 | /** = authc 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | org.springframework.web.context.ContextLoaderListener 11 | 12 | 13 | 14 | contextConfigLocation 15 | 16 | classpath*:applicationContext.xml 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | dispatcherServlet 30 | org.springframework.web.servlet.DispatcherServlet 31 | 32 | contextConfigLocation 33 | classpath:spring-mvc.xml 34 | 35 | 1 36 | 37 | 38 | dispatcherServlet 39 | / 40 | 41 | 42 | 43 | 44 | characterEncodingFilter 45 | org.springframework.web.filter.CharacterEncodingFilter 46 | 47 | encoding 48 | utf-8 49 | 50 | 51 | 52 | characterEncodingFilter 53 | /* 54 | 55 | 56 | 57 | 58 | shiroFilter 59 | org.springframework.web.filter.DelegatingFilterProxy 60 | 61 | targetFilterLifecycle 62 | true 63 | 64 | 65 | 66 | shiroFilter 67 | /* 68 | 69 | 70 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/src/test/java/com/zephon/controller/test/JwtTest.java: -------------------------------------------------------------------------------- 1 | package com.zephon.controller.test; 2 | 3 | import com.zephon.domain.UserInfo; 4 | import com.zephon.utils.JwtUtil; 5 | import com.zephon.utils.RedisUtil; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.test.context.ContextConfiguration; 10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 11 | import org.springframework.test.context.junit4.SpringRunner; 12 | 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | /** 17 | * @author Zephon 18 | * @version V1.0 19 | * @Package com.zephon.controller.test 20 | * @date 2020/3/22 下午7:39 21 | * @Copyright © 22 | */ 23 | @RunWith(SpringJUnit4ClassRunner.class) 24 | @ContextConfiguration(locations = {"classpath:spring-redis.xml"}) 25 | public class JwtTest { 26 | @Autowired 27 | private RedisUtil redisUtil; 28 | @Test 29 | public void test(){ 30 | UserInfo user = new UserInfo(); 31 | user.setAvatar("alksdfjlkjasglasdf"); 32 | redisUtil.set("123",user); 33 | Object o = redisUtil.get("123"); 34 | System.out.println(o); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/classes/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.cj.jdbc.Driver 2 | jdbc.url=jdbc:mysql:///ssm_project 3 | jdbc.username=root 4 | jdbc.password=123456 -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | #you cannot specify every priority with different file for log4j 2 | log4j.rootLogger=debug,stdout,info,debug,warn,error 3 | #log4j.rootLogger=info,stdout 4 | 5 | #console 6 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 7 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 8 | log4j.appender.stdout.layout.ConversionPattern= [%d{yyyy-MM-dd HH:mm:ss a}]:%p %l%m%n 9 | 10 | #info log 11 | log4j.logger.info=info 12 | log4j.appender.info=org.apache.log4j.DailyRollingFileAppender 13 | log4j.appender.info.DatePattern='_'yyyy-MM-dd'.log' 14 | log4j.appender.info.File=./src/com/zephon/log/error.log 15 | log4j.appender.info.Append=true 16 | log4j.appender.info.Threshold=INFO 17 | log4j.appender.info.layout=org.apache.log4j.PatternLayout 18 | log4j.appender.info.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread: %t][ Class:%c >> Method: %l ]%n%p:%m%n 19 | 20 | #debug log 21 | log4j.logger.debug=debug 22 | log4j.appender.debug=org.apache.log4j.DailyRollingFileAppender 23 | log4j.appender.debug.DatePattern='_'yyyy-MM-dd'.log' 24 | log4j.appender.debug.File=./src/com/zephon/log/error.log 25 | log4j.appender.debug.Append=true 26 | log4j.appender.debug.Threshold=DEBUG 27 | log4j.appender.debug.layout=org.apache.log4j.PatternLayout 28 | log4j.appender.debug.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread: %t][ Class:%c >> Method: %l ]%n%p:%m%n 29 | 30 | #warn log 31 | log4j.logger.warn=warn 32 | log4j.appender.warn=org.apache.log4j.DailyRollingFileAppender 33 | log4j.appender.warn.DatePattern='_'yyyy-MM-dd'.log' 34 | log4j.appender.warn.File=./src/com/zephon/log/error.log 35 | log4j.appender.warn.Append=true 36 | log4j.appender.warn.Threshold=WARN 37 | log4j.appender.warn.layout=org.apache.log4j.PatternLayout 38 | log4j.appender.warn.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread: %t][ Class:%c >> Method: %l ]%n%p:%m%n 39 | 40 | #error 41 | log4j.logger.error=error 42 | log4j.appender.error = org.apache.log4j.DailyRollingFileAppender 43 | log4j.appender.error.DatePattern='_'yyyy-MM-dd'.log' 44 | log4j.appender.error.File = ./src/com/zephon/log/error.log 45 | log4j.appender.error.Append = true 46 | log4j.appender.error.Threshold = ERROR 47 | log4j.appender.error.layout = org.apache.log4j.PatternLayout 48 | log4j.appender.error.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss a} [Thread: %t][ Class:%c >> Method: %l ]%n%p:%m%n -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/classes/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/classes/redis.properties: -------------------------------------------------------------------------------- 1 | #ip 2 | redis.host=127.0.0.1 3 | #端口 4 | redis.port=6379 5 | #密码 6 | #最大空闲数 7 | redis.maxIdle=100 8 | #最大连接数 9 | redis.maxActive=300 10 | #连接时最大的等待时间(毫秒) 11 | redis.maxWait=1500 12 | #在提取一个jedis实例时,是否提前进行验证操作;如果为true,则得到的jedis实例均是可用的 13 | redis.testOnBorrow=true -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/classes/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/classes/spring-redis.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 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 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/classes/spring-shiro.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | /user/login = anon 31 | 32 | /user/logout = anon 33 | /autherror = anon 34 | /** = authc 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Mon Apr 06 13:22:09 CST 2020 3 | version=1.0-SNAPSHOT 4 | groupId=com.zephon 5 | artifactId=ssm_project_web 6 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/zephon/controller/PermissionController.class 2 | com/zephon/aop/LogAop.class 3 | com/zephon/controller/LogController.class 4 | com/zephon/controller/ProductController.class 5 | com/zephon/controller/OrderController.class 6 | com/zephon/shrio/UserRealm.class 7 | com/zephon/controller/RoleController.class 8 | com/zephon/controller/UserController.class 9 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_web/src/main/java/com/zephon/controller/ProductController.java 2 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_web/src/main/java/com/zephon/controller/LogController.java 3 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_web/src/main/java/com/zephon/aop/LogAop.java 4 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_web/src/main/java/com/zephon/controller/UserController.java 5 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_web/src/main/java/com/zephon/controller/PermissionController.java 6 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_web/src/main/java/com/zephon/controller/RoleController.java 7 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_web/src/main/java/com/zephon/shrio/UserRealm.java 8 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_web/src/main/java/com/zephon/controller/OrderController.java 9 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/zephon/controller/test/JwtTest.class 2 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /home/zephon/Desktop/基于vue+ssm的旅游网站后台管理系统/ssm_project/ssm_project_web/src/test/java/com/zephon/controller/test/JwtTest.java 2 | -------------------------------------------------------------------------------- /ssm_project/ssm_project_web/target/ssm_project_web-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zephon-H/vue-ssm-traveller-manage/cd8d893ab3296ae343f4f084b9a6a938e7e952b8/ssm_project/ssm_project_web/target/ssm_project_web-1.0-SNAPSHOT.jar --------------------------------------------------------------------------------