├── .gitignore
├── LICENSE
├── README.md
├── client
└── jvue-client
│ ├── .babelrc
│ ├── .editorconfig
│ ├── .eslintignore
│ ├── .eslintrc.js
│ ├── .postcssrc.js
│ ├── README.md
│ ├── build
│ ├── build.js
│ ├── check-versions.js
│ ├── logo.png
│ ├── utils.js
│ ├── vue-loader.conf.js
│ ├── webpack.base.conf.js
│ ├── webpack.dev.conf.js
│ └── webpack.prod.conf.js
│ ├── config
│ ├── dev.env.js
│ ├── index.js
│ └── prod.env.js
│ ├── gulp
│ └── index.js
│ ├── gulpfile.js
│ ├── index.html
│ ├── package-lock.json
│ ├── package.json
│ ├── src
│ ├── App.vue
│ ├── api
│ │ ├── api.js
│ │ └── index.js
│ ├── assets
│ │ ├── css
│ │ │ ├── common.css
│ │ │ ├── faicon.less
│ │ │ ├── font-awesome.min.css
│ │ │ └── index.js
│ │ ├── fonts
│ │ │ ├── FontAwesome.otf
│ │ │ ├── fontawesome-webfont.eot
│ │ │ ├── fontawesome-webfont.svg
│ │ │ ├── fontawesome-webfont.ttf
│ │ │ ├── fontawesome-webfont.woff
│ │ │ └── fontawesome-webfont.woff2
│ │ ├── images
│ │ │ ├── add.png
│ │ │ └── timg.jpg
│ │ └── logo.png
│ ├── common
│ │ ├── attributes
│ │ │ ├── en.js
│ │ │ └── zh_CN.js
│ │ ├── constants.js
│ │ ├── index.js
│ │ ├── messages
│ │ │ ├── en.js
│ │ │ └── zh_CN.js
│ │ ├── utility.js
│ │ └── validate.js
│ ├── components
│ │ ├── image
│ │ │ ├── MultiImage.vue
│ │ │ ├── SingleImage.vue
│ │ │ └── single_image.css
│ │ ├── index.js
│ │ ├── panel
│ │ │ └── HtmlPanel.vue
│ │ └── sys
│ │ │ └── Sec.vue
│ ├── filters
│ │ ├── bankFilter.js
│ │ ├── commonFilters.js
│ │ ├── dictData.js
│ │ ├── formatter.js
│ │ ├── index.js
│ │ └── urlFilter.js
│ ├── jslib
│ │ ├── ldf-img.js
│ │ └── preview.js
│ ├── main.js
│ ├── pages
│ │ ├── common
│ │ │ ├── index.vue
│ │ │ ├── main.vue
│ │ │ └── sysmain.vue
│ │ ├── error
│ │ │ ├── 403.vue
│ │ │ ├── 404.vue
│ │ │ └── index.vue
│ │ ├── home
│ │ │ └── index.vue
│ │ ├── loading.vue
│ │ ├── login.vue
│ │ ├── sys
│ │ │ ├── api
│ │ │ │ └── index.vue
│ │ │ ├── common
│ │ │ │ └── filters.js
│ │ │ ├── module
│ │ │ │ ├── add.vue
│ │ │ │ ├── detail.vue
│ │ │ │ ├── edit.vue
│ │ │ │ └── index.vue
│ │ │ ├── page
│ │ │ │ ├── add.vue
│ │ │ │ ├── edit.vue
│ │ │ │ └── index.vue
│ │ │ ├── role
│ │ │ │ ├── add.vue
│ │ │ │ ├── detail.vue
│ │ │ │ ├── edit.vue
│ │ │ │ ├── grant.vue
│ │ │ │ └── index.vue
│ │ │ └── segment
│ │ │ │ └── index.vue
│ │ └── user
│ │ │ ├── add.vue
│ │ │ ├── dept.vue
│ │ │ ├── edit.vue
│ │ │ └── index.vue
│ ├── router
│ │ ├── index.js
│ │ └── routers.js
│ └── vuet
│ │ ├── index.js
│ │ └── modules
│ │ ├── common.js
│ │ ├── sys.js
│ │ ├── sys
│ │ ├── sys-acl.js
│ │ ├── sys-api.js
│ │ ├── sys-module.js
│ │ ├── sys-page.js
│ │ ├── sys-role.js
│ │ └── sys-segment.js
│ │ ├── user.js
│ │ └── user
│ │ └── user-dept.js
│ └── static
│ ├── .gitkeep
│ └── img
│ ├── 404.png
│ └── logo-white.png
├── doc
├── JVUE权限说明.xlsx
├── README.md
├── 画面样式
│ ├── 模块管理.png
│ ├── 用户授权.png
│ └── 画面和菜单管理.png
└── 配置-linux-sample
│ ├── data
│ ├── deploy.sh
│ └── java-server
│ │ ├── conf
│ │ └── jvue
│ │ │ ├── application-prod.yml
│ │ │ ├── application.yml
│ │ │ └── logback-spring.xml
│ │ └── jvue-api-0.0.1-SNAPSHOT.conf
│ └── usr
│ └── local
│ └── nginx
│ └── conf
│ └── nginx.conf
└── server
├── doc
├── jvue-admin-data_mysql_2018-05-07.sql
├── jvue-admin-data_mysql_2018-09-20.sql
├── jvue-admin_mysql_2018-05-07.sql
└── jvue-admin_pg_2018-05-04.sql
└── jvue-api
├── pom.xml
└── src
├── main
├── java
│ ├── META-INF
│ │ └── MANIFEST.MF
│ └── net
│ │ └── ccfish
│ │ ├── common
│ │ ├── Delimiter.java
│ │ ├── JvueDataStatus.java
│ │ ├── OrderByUtils.java
│ │ ├── SearchUtils.java
│ │ ├── acl
│ │ │ ├── AclResc.java
│ │ │ └── CurrentUser.java
│ │ ├── entity
│ │ │ ├── BaseEntity.java
│ │ │ └── CodeItem.java
│ │ ├── enums
│ │ │ ├── MenuTypeEnum.java
│ │ │ └── YesOrNoEnum.java
│ │ ├── generator
│ │ │ ├── HySwaggerMapperPlugin.java
│ │ │ ├── MyMapperCommentGenerator.java
│ │ │ ├── MyPgMapperPlugin.java
│ │ │ └── README.txt
│ │ ├── mybatis
│ │ │ ├── BaseMapper.java
│ │ │ ├── PgBaseMapper.java
│ │ │ └── PgInsertMapper.java
│ │ └── web
│ │ │ ├── BaseModel.java
│ │ │ ├── PageParam.java
│ │ │ └── PagedModel.java
│ │ └── jvue
│ │ ├── JvueApiApplication.java
│ │ ├── aop
│ │ └── LogAspect.java
│ │ ├── autogen
│ │ ├── dao
│ │ │ ├── JvueApiMapper.java
│ │ │ ├── JvueDeptMapper.java
│ │ │ ├── JvueModuleMapper.java
│ │ │ ├── JvuePageMapper.java
│ │ │ ├── JvueRoleApiMapper.java
│ │ │ ├── JvueRoleMapper.java
│ │ │ ├── JvueRolePageMapper.java
│ │ │ ├── JvueRoleSegmentMapper.java
│ │ │ ├── JvueSegmentMapper.java
│ │ │ ├── JvueUserMapper.java
│ │ │ └── JvueUserRoleMapper.java
│ │ └── model
│ │ │ ├── JvueApi.java
│ │ │ ├── JvueDept.java
│ │ │ ├── JvueModule.java
│ │ │ ├── JvuePage.java
│ │ │ ├── JvueRole.java
│ │ │ ├── JvueRoleApi.java
│ │ │ ├── JvueRolePage.java
│ │ │ ├── JvueRoleSegment.java
│ │ │ ├── JvueSegment.java
│ │ │ ├── JvueUser.java
│ │ │ └── JvueUserRole.java
│ │ ├── config
│ │ ├── HazelCastConfigration.java
│ │ ├── JvueGlobalMethodSecurityConfiguration.java
│ │ ├── Swagger2Config.java
│ │ ├── WebArgumentResolverConfig.java
│ │ └── WebSecurityConfig.java
│ │ ├── domain
│ │ ├── dao
│ │ │ ├── JvueExDeptMapper.java
│ │ │ ├── JvueExPageMapper.java
│ │ │ ├── JvueExRoleApiMapper.java
│ │ │ ├── JvueExRolePageMapper.java
│ │ │ ├── JvueExRoleSegmentMapper.java
│ │ │ ├── JvueExUserMapper.java
│ │ │ └── JvueOauthUserMapper.java
│ │ └── model
│ │ │ ├── JvueDeptNodeItem.java
│ │ │ ├── JvueExDept.java
│ │ │ ├── JvueExPage.java
│ │ │ ├── JvueExRole.java
│ │ │ ├── JvueExRoleApi.java
│ │ │ ├── JvueExRolePage.java
│ │ │ ├── JvueExRoleSegment.java
│ │ │ ├── JvueExUser.java
│ │ │ ├── JvueOauthUser.java
│ │ │ └── JvueRoleItem.java
│ │ ├── rest
│ │ ├── AclResourceController.java
│ │ ├── AuthController.java
│ │ ├── JvueApiController.java
│ │ ├── JvueDeptController.java
│ │ ├── JvueModuleController.java
│ │ ├── JvuePageController.java
│ │ ├── JvueRoleController.java
│ │ ├── JvueSegmentController.java
│ │ ├── UserController.java
│ │ ├── UserRoleController.java
│ │ ├── VueController.java
│ │ ├── _BaseController.java
│ │ ├── pub
│ │ │ └── PubDictController.java
│ │ └── vm
│ │ │ ├── ReqLogin.java
│ │ │ ├── ReqPageApis.java
│ │ │ └── ReqRoleGrant.java
│ │ ├── security
│ │ ├── CurrentUserArgumentResolver.java
│ │ ├── EntryPointUnauthorizedHandler.java
│ │ ├── JvueMethodAclVoter.java
│ │ ├── JwtUserDetails.java
│ │ ├── OAuth2AuthenticationSuccessHandler.java
│ │ ├── RestAccessDeniedHandler.java
│ │ ├── RestAuthenticationFailureHandler.java
│ │ ├── RestAuthenticationSuccessHandler.java
│ │ ├── RestLogoutSuccessHandler.java
│ │ └── RoleAccessDecisionManager.java
│ │ ├── service
│ │ ├── AclResourceService.java
│ │ ├── JvueApiService.java
│ │ ├── JvueDeptService.java
│ │ ├── JvueModuleService.java
│ │ ├── JvueOAuth2UserService.java
│ │ ├── JvuePageService.java
│ │ ├── JvueRoleService.java
│ │ ├── JvueSegmentService.java
│ │ ├── JvueUserRoleService.java
│ │ ├── JvueUserService.java
│ │ ├── _AbstractService.java
│ │ ├── impl
│ │ │ ├── AclResourceServiceImpl.java
│ │ │ ├── JvueApiServiceImpl.java
│ │ │ ├── JvueDeptServiceImpl.java
│ │ │ ├── JvueModuleServiceImpl.java
│ │ │ ├── JvueOAuth2UserServiceImpl.java
│ │ │ ├── JvuePageServiceImpl.java
│ │ │ ├── JvueRoleServiceImpl.java
│ │ │ ├── JvueSegmentServiceImpl.java
│ │ │ ├── JvueUserRoleServiceImpl.java
│ │ │ ├── JvueUserServiceImpl.java
│ │ │ └── JwtUserDetailsServiceImpl.java
│ │ └── model
│ │ │ ├── JvueUserInfo.java
│ │ │ ├── ModuleAndPages.java
│ │ │ ├── PageRoleGrant.java
│ │ │ └── RolePageDetails.java
│ │ ├── startup
│ │ └── ApplicationStartup.java
│ │ └── vm
│ │ ├── AclResource.java
│ │ ├── ModuleAndPages.java
│ │ └── UserInfo.java
└── resources
│ ├── application-dev.yml
│ ├── application.yml
│ ├── logback-spring.xml
│ ├── mapper
│ └── jvue
│ │ ├── JvueExDeptMapper.xml
│ │ ├── JvueExPageMapper.xml
│ │ ├── JvueExRoleApiMapper.xml
│ │ ├── JvueExRolePageMapper.xml
│ │ ├── JvueExRoleSegmentMapper.xml
│ │ └── JvueExUserMapper.xml
│ └── templates
│ └── index.html
└── test
└── java
├── application-test.yml
├── hibernate.properties
└── net
└── ccfish
└── jvue
├── JvueApiApplicationTests.java
├── rest
└── test
│ └── AuthControllerTest.java
├── security
└── mock
│ └── MockCurrentUserArgumentResolver.java
└── service
├── impl
└── test
│ └── JwtUserDetailsServiceImplTest.java
└── test
└── XXXX.java
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.ear
17 | *.zip
18 | *.tar.gz
19 | *.rar
20 |
21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22 | hs_err_pid*
23 | /client/jvue-client/dist
24 | /client/jvue-client/node_modules
25 | /client/jvue-client/.idea
26 | /server/*.gitignore
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 ccfish yuan
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### 索引
2 | - [jvue-admin是什么?](#jvue-admin是什么)
3 | - [前端技术栈](#前端技术栈)
4 | - [后端技术栈](#后端技术栈)
5 | - [授权设计](#授权设计)
6 | - [测试地址](#测试地址)
7 |
8 | ### jvue-admin是什么
9 | 通过整合前端流行框架vue和相关组件,及后台的Spring boot,实现的权限管理及菜单动态生成最佳实践。
10 |
11 | ### 前端技术栈
12 | vue, vuet, element-ui, axios
13 |
14 | ### 后端技术栈
15 | spring boot, hazelcast, mybatis, postgresql, swagger2
16 | PS: 如果需要hibernate(jpa)和mysql版本的话,请参考分支[jvue-admin-jpa](https://github.com/ccfish86/jvue-admin/tree/jvue-admin-jpa)。此外:两个分支对应的数据库字段有些不一样。
17 |
18 | ### 授权设计
19 | 传统的Struts,SpringMVC或类似的MVC架构下,页面和接口的权限是并行的,有的是以类型区分,有的是混着来的。
20 | 本项目中,以画面为单位,把接口和画面项目(按钮/组件)等绑定到画面,在给角色授权时,直观的可授予对应的接口和按钮的权限。
21 | 页面权限和后台接口权限分开加载,前台权限不持续再占用后台JVM内存,后台Spring Security启动时通过URL去DB加载并绑定角色,用户登录后直接通过ROLE和Spring Security匹配访问权限。
22 | 后续,可以结合工具,通过excel把画面定义好生成对应的vue和JAVA代码,或者后台JAVA实现类似功能,提高开发效率和统一的命名。
23 |
24 | ### 测试地址
25 | 线上测试地址:[http://jvue.ccfish.net/](http://jvue.ccfish.net/)
26 | 管理员:admin/admin
27 | 普通用户:user/user
28 |
29 | PS: 正在努力开发中,预计春节以后会有一版Release
--------------------------------------------------------------------------------
/client/jvue-client/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["es2015", { "modules": false }],
4 | ["env", {
5 | "modules": false,
6 | "targets": {
7 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
8 | }
9 | }],
10 | "stage-2"
11 | ],
12 | "plugins": ["transform-vue-jsx", "transform-runtime"]
13 | }
14 |
--------------------------------------------------------------------------------
/client/jvue-client/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/client/jvue-client/.eslintignore:
--------------------------------------------------------------------------------
1 | /build/
2 | /config/
3 | /dist/
4 | /*.js
5 | /src/jslib/*.js
6 |
--------------------------------------------------------------------------------
/client/jvue-client/.eslintrc.js:
--------------------------------------------------------------------------------
1 | // https://eslint.org/docs/user-guide/configuring
2 |
3 | module.exports = {
4 | root: true,
5 | parserOptions: {
6 | parser: 'babel-eslint'
7 | },
8 | env: {
9 | browser: true,
10 | },
11 | extends: [
12 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
13 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
14 | 'plugin:vue/essential',
15 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md
16 | 'standard'
17 | ],
18 | // required to lint *.vue files
19 | plugins: [
20 | 'vue'
21 | ],
22 | // add your custom rules here
23 | rules: {
24 | // "off" -> 0 关闭规则
25 | // "warn" -> 1 开启警告规则
26 | //"error" -> 2 开启错误规则
27 | // allow async-await
28 | 'generator-star-spacing': 0,
29 | // allow debugger during development
30 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
31 | // allow no space before function
32 | 'space-before-function-paren ': 1
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/client/jvue-client/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | "postcss-import": {},
6 | "postcss-url": {},
7 | // to edit target browsers: use "browserslist" field in package.json
8 | "autoprefixer": {}
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/client/jvue-client/README.md:
--------------------------------------------------------------------------------
1 | # jvue-client
2 |
3 | > 基于VUE和SpringBoot的细粒度权限管理后台
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 |
17 | # build for production and view the bundle analyzer report
18 | npm run build --report
19 | ```
20 |
21 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
22 |
--------------------------------------------------------------------------------
/client/jvue-client/build/build.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | require('./check-versions')()
3 |
4 | process.env.NODE_ENV = 'production'
5 |
6 | const ora = require('ora')
7 | const rm = require('rimraf')
8 | const path = require('path')
9 | const chalk = require('chalk')
10 | const webpack = require('webpack')
11 | const config = require('../config')
12 | const webpackConfig = require('./webpack.prod.conf')
13 |
14 | const spinner = ora('building for production...')
15 | spinner.start()
16 |
17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18 | if (err) throw err
19 | webpack(webpackConfig, (err, stats) => {
20 | spinner.stop()
21 | if (err) throw err
22 | process.stdout.write(stats.toString({
23 | colors: true,
24 | modules: false,
25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
26 | chunks: false,
27 | chunkModules: false
28 | }) + '\n\n')
29 |
30 | if (stats.hasErrors()) {
31 | console.log(chalk.red(' Build failed with errors.\n'))
32 | process.exit(1)
33 | }
34 |
35 | console.log(chalk.cyan(' Build complete.\n'))
36 | console.log(chalk.yellow(
37 | ' Tip: built files are meant to be served over an HTTP server.\n' +
38 | ' Opening index.html over file:// won\'t work.\n'
39 | ))
40 | })
41 | })
42 |
--------------------------------------------------------------------------------
/client/jvue-client/build/check-versions.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const chalk = require('chalk')
3 | const semver = require('semver')
4 | const packageConfig = require('../package.json')
5 | const shell = require('shelljs')
6 |
7 | function exec (cmd) {
8 | return require('child_process').execSync(cmd).toString().trim()
9 | }
10 |
11 | const versionRequirements = [
12 | {
13 | name: 'node',
14 | currentVersion: semver.clean(process.version),
15 | versionRequirement: packageConfig.engines.node
16 | }
17 | ]
18 |
19 | if (shell.which('npm')) {
20 | versionRequirements.push({
21 | name: 'npm',
22 | currentVersion: exec('npm --version'),
23 | versionRequirement: packageConfig.engines.npm
24 | })
25 | }
26 |
27 | module.exports = function () {
28 | const warnings = []
29 |
30 | for (let i = 0; i < versionRequirements.length; i++) {
31 | const mod = versionRequirements[i]
32 |
33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
34 | warnings.push(mod.name + ': ' +
35 | chalk.red(mod.currentVersion) + ' should be ' +
36 | chalk.green(mod.versionRequirement)
37 | )
38 | }
39 | }
40 |
41 | if (warnings.length) {
42 | console.log('')
43 | console.log(chalk.yellow('To use this template, you must update following to modules:'))
44 | console.log()
45 |
46 | for (let i = 0; i < warnings.length; i++) {
47 | const warning = warnings[i]
48 | console.log(' ' + warning)
49 | }
50 |
51 | console.log()
52 | process.exit(1)
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/client/jvue-client/build/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/build/logo.png
--------------------------------------------------------------------------------
/client/jvue-client/build/vue-loader.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const utils = require('./utils')
3 | const config = require('../config')
4 | const isProduction = process.env.NODE_ENV === 'production'
5 | const sourceMapEnabled = isProduction
6 | ? config.build.productionSourceMap
7 | : config.dev.cssSourceMap
8 |
9 | module.exports = {
10 | loaders: utils.cssLoaders({
11 | sourceMap: sourceMapEnabled,
12 | extract: isProduction
13 | }),
14 | cssSourceMap: sourceMapEnabled,
15 | cacheBusting: config.dev.cacheBusting,
16 | transformToRequire: {
17 | video: ['src', 'poster'],
18 | source: 'src',
19 | img: 'src',
20 | image: 'xlink:href'
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/client/jvue-client/build/webpack.base.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const utils = require('./utils')
4 | const config = require('../config')
5 | const vueLoaderConfig = require('./vue-loader.conf')
6 |
7 | function resolve (dir) {
8 | return path.join(__dirname, '..', dir)
9 | }
10 |
11 | const createLintingRule = () => ({
12 | test: /\.(js|vue)$/,
13 | loader: 'eslint-loader',
14 | enforce: 'pre',
15 | include: [resolve('src'), resolve('test')],
16 | options: {
17 | formatter: require('eslint-friendly-formatter'),
18 | emitWarning: !config.dev.showEslintErrorsInOverlay
19 | }
20 | })
21 |
22 | module.exports = {
23 | context: path.resolve(__dirname, '../'),
24 | entry: {
25 | app: './src/main.js'
26 | },
27 | output: {
28 | path: config.build.assetsRoot,
29 | filename: '[name].js',
30 | publicPath: process.env.NODE_ENV === 'production'
31 | ? config.build.assetsPublicPath
32 | : config.dev.assetsPublicPath
33 | },
34 | externals: {
35 | // 'vue': 'Vue',
36 | // 'vue-router': 'VueRouter',
37 | 'axios':'axios'
38 | },
39 | resolve: {
40 | extensions: ['.js', '.vue', '.json'],
41 | alias: {
42 | 'vue$': 'vue/dist/vue.esm.js',
43 | '@': resolve('src'),
44 | }
45 | },
46 | module: {
47 | rules: [
48 | ...(config.dev.useEslint ? [createLintingRule()] : []),
49 | {
50 | test: /\.vue$/,
51 | loader: 'vue-loader',
52 | options: vueLoaderConfig
53 | },
54 | {
55 | test: /\.js$/,
56 | loader: 'babel-loader',
57 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
58 | },
59 | {
60 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
61 | loader: 'url-loader',
62 | options: {
63 | limit: 10000,
64 | name: utils.assetsPath('img/[name].[hash:7].[ext]')
65 | }
66 | },
67 | {
68 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
69 | loader: 'url-loader',
70 | options: {
71 | limit: 10000,
72 | name: utils.assetsPath('media/[name].[hash:7].[ext]')
73 | }
74 | },
75 | {
76 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
77 | loader: 'url-loader',
78 | options: {
79 | limit: 10000,
80 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
81 | }
82 | }
83 | ]
84 | },
85 | node: {
86 | // prevent webpack from injecting useless setImmediate polyfill because Vue
87 | // source contains it (although only uses it if it's native).
88 | setImmediate: false,
89 | // prevent webpack from injecting mocks to Node native modules
90 | // that does not make sense for the client
91 | dgram: 'empty',
92 | fs: 'empty',
93 | net: 'empty',
94 | tls: 'empty',
95 | child_process: 'empty'
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/client/jvue-client/config/dev.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const merge = require('webpack-merge')
3 | const prodEnv = require('./prod.env')
4 |
5 | module.exports = merge(prodEnv, {
6 | NODE_ENV: '"development"'
7 | })
8 |
--------------------------------------------------------------------------------
/client/jvue-client/config/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | // Template version: 1.3.1
3 | // see http://vuejs-templates.github.io/webpack for documentation.
4 |
5 | const path = require('path')
6 |
7 | module.exports = {
8 | dev: {
9 |
10 | // Paths
11 | assetsSubDirectory: 'static',
12 | assetsPublicPath: '/',
13 | proxyTable: {
14 | '/api': {
15 | // target: 'http://localhost:8080',
16 | target: 'https://jvue.ccfish.net',
17 | changeOrigin: true,
18 | pathRewrite: {
19 | '^/api': '/api'
20 | }
21 | },
22 | },
23 |
24 | // Various Dev Server settings
25 | host: 'localhost', // can be overwritten by process.env.HOST
26 | port: 80, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
27 | autoOpenBrowser: true,
28 | errorOverlay: true,
29 | notifyOnErrors: true,
30 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
31 |
32 | // Use Eslint Loader?
33 | // If true, your code will be linted during bundling and
34 | // linting errors and warnings will be shown in the console.
35 | useEslint: true,
36 | // If true, eslint errors and warnings will also be shown in the error overlay
37 | // in the browser.
38 | showEslintErrorsInOverlay: false,
39 |
40 | /**
41 | * Source Maps
42 | */
43 |
44 | // https://webpack.js.org/configuration/devtool/#development
45 | devtool: 'cheap-module-eval-source-map',
46 |
47 | // If you have problems debugging vue-files in devtools,
48 | // set this to false - it *may* help
49 | // https://vue-loader.vuejs.org/en/options.html#cachebusting
50 | cacheBusting: true,
51 |
52 | cssSourceMap: true
53 | },
54 |
55 | build: {
56 | // Template for index.html
57 | index: path.resolve(__dirname, '../dist/index.html'),
58 |
59 | // Paths
60 | assetsRoot: path.resolve(__dirname, '../dist'),
61 | assetsSubDirectory: 'static',
62 | assetsPublicPath: '/',
63 |
64 | /**
65 | * Source Maps
66 | */
67 |
68 | productionSourceMap: true,
69 | // https://webpack.js.org/configuration/devtool/#production
70 | devtool: '#source-map',
71 |
72 | // Gzip off by default as many popular static hosts such as
73 | // Surge or Netlify already gzip all static assets for you.
74 | // Before setting to `true`, make sure to:
75 | // npm install --save-dev compression-webpack-plugin
76 | productionGzip: true,
77 | productionGzipExtensions: ['js', 'css'],
78 |
79 | // Run the build command with an extra argument to
80 | // View the bundle analyzer report after build finishes:
81 | // `npm run build --report`
82 | // Set to `true` or `false` to always turn it on or off
83 | bundleAnalyzerReport: process.env.npm_config_report
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/client/jvue-client/config/prod.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | module.exports = {
3 | NODE_ENV: '"production"'
4 | }
5 |
--------------------------------------------------------------------------------
/client/jvue-client/gulp/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Liumin on 2017/6/26.
3 | */
4 | module.exports = {
5 | devTest: { // 部署到测试服务器上
6 | remotePath: '/data/nginx/html/hifipi-admin/', // 部署到服务器的路径
7 | host: '192.168.10.70', // ip地址
8 | user: 'root', // 帐号
9 | pass: 'root123', // 密码
10 | port: 22 // 端口
11 | },
12 | devDist: { // 部署正式服务器上
13 | remotePath: '/data/nginx/html/hifipi-admin/', // 部署到服务器的路径
14 | host: '192.168.10.70', // ip地址
15 | user: 'root', // 帐号
16 | pass: 'zB6ztj', // 密码
17 | port: 22 // 端口
18 | },
19 | distPath: '/dist/', // 程序编译的路径地址
20 | target: 'http://admin.hifipi.com/admin/' // 连接的服务器地址
21 | }
22 |
--------------------------------------------------------------------------------
/client/jvue-client/gulpfile.js:
--------------------------------------------------------------------------------
1 | const gulp = require('gulp')
2 | const path = require('path')
3 | const config = require('./gulp/')
4 | const buildConfig = require('./config/')
5 | const isEnv = process.env.NODE_ENV == 'production'
6 |
7 | /**
8 | * 清除生产目录文件
9 | */
10 | const del = require('del')
11 | gulp.task('clean', ['upload'], function (callback) {
12 | console.log('## 已经成功部署到服务器上')
13 | console.log('## 清除原来编译的代码')
14 | del(['.' + config.distPath], callback)
15 | })
16 |
17 | /**
18 | * 编译代码
19 | */
20 | const webpack = require('webpack')
21 | const webpackConfig = require('./build/webpack.prod.conf')
22 | gulp.task('build', function (callback) {
23 | console.log('## 代码编译开始')
24 | require('shelljs/global')
25 | var assetsPath = path.join(buildConfig.build.assetsRoot, buildConfig.build.assetsSubDirectory)
26 | rm('-rf', assetsPath)
27 | mkdir('-p', assetsPath)
28 | console.log('## 复制文件:static/*')
29 | cp('-R', 'static/*', assetsPath)
30 | webpack(webpackConfig, function (err, state) {
31 | console.log('## 代码编译完成')
32 | callback(err)
33 | })
34 | })
35 |
36 | /**
37 | * 编译代码,自动部署到服务器
38 | */
39 | const ftp = require('gulp-sftp')
40 | gulp.task('upload', ['build'], function (callback) {
41 | console.log('## 正在部署到服务器上')
42 | var dev = isEnv ? config.devDist : config.devTest
43 | console.log(dev)
44 | gulp.src('.' + config.distPath + '**')
45 | .pipe(ftp(Object.assign(dev, {callback})))
46 | })
47 |
48 | /**
49 | * 上传到测试服务器上
50 | */
51 | gulp.task('devTest', ['build', 'upload', 'clean'])
52 |
53 | /**
54 | * 上传到生产服务器上
55 | */
56 | gulp.task('devDist', ['build', 'upload', 'clean'])
57 |
--------------------------------------------------------------------------------
/client/jvue-client/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | JVUE-管理系统登录
8 |
9 |
10 |
11 |
12 |
13 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/client/jvue-client/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
13 |
22 |
--------------------------------------------------------------------------------
/client/jvue-client/src/api/index.js:
--------------------------------------------------------------------------------
1 | import * as api from './api'
2 | export default api
3 |
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/css/common.css:
--------------------------------------------------------------------------------
1 | #app{
2 | position: absolute;
3 | bottom: 0px;
4 | right: 0px;
5 | top: 0px;
6 | left: 0px;
7 | }
8 | div.content-wrapper {
9 | background-color: #FFF;
10 | box-sizing: border-box;
11 | padding: 5px;
12 | margin-top: 10px;
13 | min-height: 500px;
14 | }
15 | .container-form__mid {
16 | min-width: 400px;
17 | width: 45%;
18 | margin: 20px auto;
19 | }
20 | .container-table__footer {
21 | min-width: 350px;
22 | margin: 20px auto;
23 | }
24 | .container-table__footer__pagination{
25 | text-align: right;
26 | }
27 | /* ueditor 工具栏行高 */
28 | .edui-toolbar {
29 | line-height: 120%;
30 | min-width: 650px;
31 | }
32 | .el-form-item__content>.edui-default {
33 | min-width: 666px;
34 | }
35 | /* 避免显示的字段多的情况下,表格项目换行 */
36 | #app .el-table .cell, #app .el-table th>div {
37 | padding-left: 6px!important;
38 | padding-right: 5px!important;
39 | }
40 | .actions-top--edit{
41 | position: absolute;
42 | width: 50%;
43 | margin-top: -40px;
44 | margin-left: 30%;
45 | }
46 | .el-tag+.el-tag {
47 | margin-left: 5px;
48 | }
49 | .el-aside {
50 | background-color: #D3DCE6;
51 | color: #333;
52 | }
53 | #app>.el-container {
54 | min-height: 700px;
55 | }
56 | .small-form--edit .el-input {
57 | margin-right: 10px;
58 | width: 380px;
59 | vertical-align: top;
60 | }
61 | .el-table th{
62 | background-color:#eef1f6;
63 | color:black
64 | }
65 | .txt-small{
66 | font-size: 10pt;
67 | line-height: 150%;
68 | }
69 | .txt-left{
70 | text-align: left;
71 | }
72 | .txt-center{
73 | text-align: center;
74 | }
75 | .txt-b-info {
76 | padding: 10px;
77 | font-weight: bolder;
78 | color: #FFFFFF;
79 | background-color: #909399;
80 | }
81 |
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/css/faicon.less:
--------------------------------------------------------------------------------
1 | [class^="el-icon-fa"], [class*=" el-icon-fa"] {
2 | display: inline-block;
3 | font: normal normal normal 14px/1 FontAwesome!important;
4 | font-size: inherit;
5 | text-rendering: auto;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | };
9 | @import url("./font-awesome.min.css");
10 | // @import url("../../node_modules/font-awesome/less/font-awesome");
11 | @fa-css-prefix: el-icon-fa;
12 |
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/css/index.js:
--------------------------------------------------------------------------------
1 | import './common.css'
2 | import './faicon.less'
3 |
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/assets/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/assets/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/assets/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/assets/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/assets/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/images/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/assets/images/add.png
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/images/timg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/assets/images/timg.jpg
--------------------------------------------------------------------------------
/client/jvue-client/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/assets/logo.png
--------------------------------------------------------------------------------
/client/jvue-client/src/common/attributes/en.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/common/attributes/en.js
--------------------------------------------------------------------------------
/client/jvue-client/src/common/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-04-06.
3 | */
4 | import './validate'
5 |
6 | export * from './constants'
7 | export * from './utility'
8 |
--------------------------------------------------------------------------------
/client/jvue-client/src/common/messages/en.js:
--------------------------------------------------------------------------------
1 | export default {
2 | after: (field, [target]) => `The ${field} must be after ${target}.`,
3 | alpha_dash: (field) => `The ${field} may contain alpha-numeric characters as well as dashes and underscores.`,
4 | alpha_num: (field) => `The ${field} may only contain alpha-numeric characters.`,
5 | alpha_spaces: (field) => `The ${field} may only contain alphabetic characters as well as spaces.`,
6 | alpha: (field) => `The ${field} may only contain alphabetic characters.`,
7 | before: (field, [target]) => `The ${field} must be before ${target}.`,
8 | between: (field, [min, max]) => `The ${field} must be between ${min} and ${max}.`,
9 | confirmed: (field) => `The ${field} confirmation does not match.`,
10 | credit_card: (field) => `The ${field} is invalid.`,
11 | date_between: (field, [min, max]) => `The ${field} must be between ${min} and ${max}.`,
12 | date_format: (field, [format]) => `The ${field} must be in the format ${format}.`,
13 | decimal: (field, [decimals] = ['*']) => `The ${field} must be numeric and may contain ${decimals === '*' ? '' : decimals} decimal points.`,
14 | digits: (field, [length]) => `The ${field} must be numeric and exactly contain ${length} digits.`,
15 | dimensions: (field, [width, height]) => `The ${field} must be ${width} pixels by ${height} pixels.`,
16 | email: (field) => `The ${field} must be a valid email.`,
17 | ext: (field) => `The ${field} must be a valid file.`,
18 | image: (field) => `The ${field} must be an image.`,
19 | in: (field) => `The ${field} must be a valid value.`,
20 | ip: (field) => `The ${field} must be a valid ip address.`,
21 | max: (field, [length]) => `The ${field} may not be greater than ${length} characters.`,
22 | max_value: (field, [max]) => `The ${field} must be ${max} or less.`,
23 | mimes: (field) => `The ${field} must have a valid file type.`,
24 | min: (field, [length]) => `The ${field} must be at least ${length} characters.`,
25 | min_value: (field, [min]) => `The ${field} must be ${min} or more.`,
26 | not_in: (field) => `The ${field} must be a valid value.`,
27 | numeric: (field) => `The ${field} may only contain numeric characters.`,
28 | regex: (field) => `The ${field} format is invalid.`,
29 | required: (field) => `The ${field} is required.`,
30 | size: (field, [size]) => `The ${field} must be less than ${size} KB.`,
31 | url: (field) => `The ${field} is not a valid URL.`
32 | }
33 |
--------------------------------------------------------------------------------
/client/jvue-client/src/common/messages/zh_CN.js:
--------------------------------------------------------------------------------
1 | export default {
2 | after: (field, [target]) => `${field}必须在${target}之后`,
3 | alpha_dash: (field) => `${field}能够包含字母数字字符,包括破折号、下划线`,
4 | alpha_num: (field) => `${field}只能包含字母数字字符`,
5 | alpha_spaces: (field) => `${field}只能包含字母字符,包括空格`,
6 | alpha: (field) => `${field}只能包含字母字符`,
7 | before: (field, [target]) => `${field}必须在${target}之前`,
8 | between: (field, [min, max]) => `${field}必须在${min}-${max}之间`,
9 | confirmed: (field, [confirmedField]) => `${field}和${confirmedField}不一致`,
10 | date_between: (field, [min, max]) => `${field}必须在${min}和${max}之间`,
11 | date_format: (field, [format]) => `${field}必须在在${format}格式中`,
12 | decimal: (field, [decimals] = ['*']) => `${field}必须是数字的而且能够包含${decimals === '*' ? '' : decimals} 小数点`,
13 | digits: (field, [length]) => `${field}必须是数字,且精确到 ${length}数`,
14 | dimensions: (field, [width, height]) => `${field}必须是 ${width} 像素到 ${height} 像素`,
15 | email: (field) => `${field}必须是有效的邮箱`,
16 | ext: (field) => `${field}必须是有效的文件`,
17 | image: (field) => `${field}必须是图片`,
18 | in: (field) => `${field}必须是一个有效值`,
19 | ip: (field) => `${field}必须是一个有效的地址`,
20 | max: (field, [length]) => `${field}不能大于${length}字符`,
21 | mimes: (field) => `${field}必须是有效的文件类型`,
22 | min: (field, [length]) => `${field}必须至少有 ${length} 字符`,
23 | not_in: (field) => `${field}必须是一个有效值`,
24 | numeric: (field) => `${field}只能包含数字字符`,
25 | regex: (field) => `${field}格式无效`,
26 | required: (field) => `${field}是必须的`,
27 | size: (field, [size]) => `${field}必须小于 ${size} KB`,
28 | url: (field) => `${field}不是有效的url.`
29 | }
30 |
--------------------------------------------------------------------------------
/client/jvue-client/src/common/validate.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-01-07.
3 | */
4 | import Vue from 'vue'
5 | import Validator from 'vee-validate'
6 | import attributesEn from './attributes/en.js'
7 | import attributesZh from './attributes/zh_CN.js'
8 | import messagesEn from './messages/en.js'
9 | import messagesZh from './messages/zh_CN.js'
10 |
11 | const valConfig = {
12 | errorBagName: 'errors', // change if property conflicts.
13 | fieldsBagName: 'fieldBags',
14 | delay: 0,
15 | locale: 'zh_CN',
16 | dictionary: {
17 | en: {
18 | attributes: attributesEn,
19 | messages: messagesEn
20 | },
21 | zh_CN: {
22 | attributes: attributesZh,
23 | messages: messagesZh
24 | }
25 | },
26 | strict: true
27 | }
28 | Vue.use(Validator, valConfig)
29 |
--------------------------------------------------------------------------------
/client/jvue-client/src/components/image/single_image.css:
--------------------------------------------------------------------------------
1 | .single-image__tbar{
2 | margin: -35px 10px 0 0;
3 | z-index: 99;
4 | position: absolute;
5 | width: 200px;
6 | height: 35px;
7 |
8 | background-color: rgba(0,0,0,.4);
9 | display: -webkit-box;
10 | -webkit-box-align: center;
11 | -webkit-box-pack: justify;
12 | }
13 | .single-image__tbar > *{
14 | margin: 2px 10px
15 | }
16 | .single-image {
17 | display: inline-block;
18 | position: relative;
19 | /*padding-left: 10px;*/
20 | }
21 | .single-image__small {
22 | width: 33.3333%;
23 | min-width: 200px;
24 | height: 150px;
25 | border: dotted 1px gray;
26 | display: flex;
27 | text-align: center;
28 | vertical-align: middle;
29 | overflow: hidden;
30 | }
31 | .single-image__small img {
32 | margin: auto;
33 | max-width: 198px;
34 | max-height: 148px;
35 | display: inline-flex;
36 | }
37 | .blt-fullscreen {
38 | position: fixed;
39 | display: flex;
40 | flex-direction: row;
41 | background: #f1f1f1;
42 | left: 0;
43 | top: 0;
44 | width: 100%;
45 | height: 100%;
46 | text-align: center;
47 | vertical-align: middle;
48 | z-index: 9999;
49 | }
50 | .blt-fullscreen>img,
51 | .blt-image-container>img {
52 | display: inline-flex;
53 | margin: auto;
54 | max-width: 100%;
55 | max-height: 100%;
56 | }
57 | .blt-rt {
58 | top: 10px;
59 | right: 10px;
60 | position: fixed;
61 | display: table;
62 | z-index: 9999;
63 | }
64 |
--------------------------------------------------------------------------------
/client/jvue-client/src/components/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-02-17.
3 | */
4 | import singleImage from './image/SingleImage'
5 | import multiImage from './image/MultiImage'
6 | import sec from './sys/Sec'
7 | import htmlPanel from './panel/HtmlPanel.vue'
8 |
9 | export default {
10 | singleImage,
11 | multiImage,
12 | sec,
13 | htmlPanel
14 | }
15 |
--------------------------------------------------------------------------------
/client/jvue-client/src/components/panel/HtmlPanel.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
62 |
72 |
--------------------------------------------------------------------------------
/client/jvue-client/src/components/sys/Sec.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
43 |
--------------------------------------------------------------------------------
/client/jvue-client/src/filters/bankFilter.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-01-16.
3 | */
4 |
5 | export default {
6 | bankIcon (value) {
7 | try {
8 | let img = require('@/assets/images/banks/' + value + '.png')
9 | return img
10 | } catch (err) {
11 | return ''
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/client/jvue-client/src/filters/commonFilters.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-04-21.
3 | */
4 | // import Store from '../store/'
5 |
6 | const removeEmptyList = (value) => {
7 | if (value.children) {
8 | if (value.children.length === 0) {
9 | delete value.children
10 | } else {
11 | value.children.forEach(child => {
12 | removeEmptyList(child)
13 | })
14 | }
15 | }
16 | }
17 | const ALL_ROLES = {
18 | // 库管
19 | 'LM': 'role$19'
20 | }
21 | export default {
22 | filterEmpty: (value) => {
23 | if (value && value instanceof Array) {
24 | value.forEach(item => {
25 | removeEmptyList(item)
26 | })
27 | }
28 | return value
29 | },
30 | hasRole: (value, role, mark) => {
31 | if (ALL_ROLES[role]) {
32 | let roles = [] // Store.state.user.roles
33 | if (roles && roles.includes(ALL_ROLES[role])) {
34 | return value
35 | }
36 | return mark
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/client/jvue-client/src/filters/dictData.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-01-05.
3 | */
4 | // import store from '../store/'
5 | import vuet from '@/vuet/'
6 |
7 | export default {
8 | // v-model="model.code|regionName"
9 | regionData (value) {
10 | const dictList = vuet.getModule('common-region-list')
11 | if (!dictList.data) {
12 | return ''
13 | } else {
14 | return dictList.data[value]
15 | }
16 | },
17 | // v-model="model.code|dictName('{key}')"
18 | dictData (value, key) {
19 | const dictList = vuet.getModule('common-dict-codes')
20 | if (!dictList.data) {
21 | return ''
22 | } else {
23 | if (dictList.data[key]) {
24 | return dictList.data[key][String(value)]
25 | } else {
26 | return ''
27 | }
28 | }
29 | },
30 | // v-model="model.code|enumName('{key}')"
31 | enumData (value, key) {
32 | const dictList = vuet.getModule('common-dict-enums')
33 | if (!dictList.data) {
34 | return '?'
35 | } else {
36 | if (dictList.data[key]) {
37 | return dictList.data[key][String(value)]
38 | } else {
39 | return '-'
40 | }
41 | }
42 | },
43 | // v-model="model.code|enumsType('{key}')"
44 | enumsType (value, key) {
45 | let enumsType = JSON.parse(localStorage.getItem('enumsType'))
46 | return enumsType[key][value]
47 | },
48 | // v-model="model.code|enumsType('{index}')"
49 | codesType (value, index) {
50 | let codesType = JSON.parse(localStorage.getItem('codesType'))
51 | return codesType[index][value]
52 | },
53 | // v-model="model.code|enumsType('{index}')"
54 | regionsType (provinceWithCity) {
55 | let regionsType = JSON.parse(localStorage.getItem('regionsType'))
56 | let provinceName = ''
57 | let cityName = ''
58 | let index = provinceWithCity.indexOf(' ')
59 | for (let i = 0; i < regionsType.length; i++) {
60 | if (Number(regionsType[i].id) === Number(provinceWithCity.substr(0, index))) {
61 | provinceName = regionsType[i].name
62 | for (let a = 0; a < regionsType[i].child.length; a++) {
63 | if (Number(regionsType[i].child[a].id) === Number(provinceWithCity.substr(index + 1, provinceWithCity.length - 1))) {
64 | cityName = regionsType[i].child[a].name
65 | }
66 | }
67 | }
68 | }
69 |
70 | return provinceName + cityName
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/client/jvue-client/src/filters/formatter.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-01-08.
3 | */
4 | // currency
5 | import { utils } from '@/common/'
6 |
7 | export default {
8 | currencyCny (value) {
9 | if (value) {
10 | return '¥' + value.toFixed(2)
11 | } else {
12 | return '¥0'
13 | }
14 | },
15 | cutToDate (val) {
16 | if (val && val.length > 10) {
17 | return val.substr(0, 10)
18 | }
19 | return val
20 | },
21 | dateTimeFormat (value, format) {
22 | return utils.formatDate(value, format)
23 | },
24 | yesNo (value) {
25 | return value === 1 ? '是' : '否'
26 | },
27 | age (birthday) {
28 | if (birthday) {
29 | const now = new Date()
30 | const birthdaty = utils.toDate(birthday)
31 | return birthdaty ? Math.floor((now - birthdaty) / (24 * 3600 * 1000 * 30 * 12)) + '岁' : '-'
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/client/jvue-client/src/filters/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-01-05.
3 | */
4 |
5 | import Vue from 'vue'
6 | import DictData from './dictData'
7 | import UrlFilter from './urlFilter'
8 | import formaters from './formatter'
9 | import filters from './commonFilters'
10 | // import BankFilter from './bankFilter'
11 |
12 | Vue.filter('regionName', DictData.regionData)
13 | Vue.filter('dictName', DictData.dictData)
14 | Vue.filter('enumName', DictData.enumData)
15 | Vue.filter('enumsType', DictData.enumsType)
16 | Vue.filter('regionsType', DictData.regionsType)
17 | Vue.filter('codesType', DictData.codesType)
18 | Vue.filter('imageThum', UrlFilter.thum)
19 | Vue.filter('trimUrls', UrlFilter.trimUrls)
20 | Vue.filter('imageOri', UrlFilter.imageOri)
21 |
22 | Object.keys(formaters).forEach(key => {
23 | Vue.filter(key, formaters[key])
24 | })
25 |
26 | Object.keys(filters).forEach(key => {
27 | Vue.filter(key, filters[key])
28 | })
29 |
30 | export default {
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/client/jvue-client/src/filters/urlFilter.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-01-07.
3 | */
4 | import defaultImage from '@/assets/images/timg.jpg'
5 |
6 | const DEFAULT_ROOT = '//www.100902.com/'
7 | const DEFAULT_WIDTH = 100
8 | const DEFAULT_HEIGHT = 100
9 | const DEFAULT_IMAGE = defaultImage
10 |
11 | export default {
12 | thum (value, width, height, defaultImage) {
13 | if (value && value !== '') {
14 | if (value.match(/^https?:\/\/.+/g)) {
15 | if (value.indexOf(DEFAULT_ROOT) !== -1) {
16 | return value.replace(/^(.+)(_\d+x\d+)?(\.\w+)$/, '$1_' + (width || DEFAULT_WIDTH) + 'x' + (height || DEFAULT_HEIGHT) + '$3')
17 | } else {
18 | return value
19 | }
20 | } else if (value.match(/^data:.+;base64,(.+)$/)) {
21 | return value
22 | } else {
23 | return DEFAULT_ROOT + value.replace(/^(.+)(_\d+x\d+)?(\.\w+)$/, '$1_' + (width || DEFAULT_WIDTH) + 'x' + (height || DEFAULT_HEIGHT) + '$3')
24 | }
25 | } else {
26 | return DEFAULT_IMAGE
27 | }
28 | },
29 | trimUrls (urls) {
30 | if (urls === null) {
31 | return []
32 | }
33 | if (urls instanceof Array) {
34 | return urls.filter(url => url && url !== '')
35 | }
36 | if (urls instanceof String) {
37 | return [urls]
38 | }
39 | return urls
40 | },
41 | imageOri (value) {
42 | if (value && value !== '') {
43 | if (value.match(/^https?:\/\/.+/g)) {
44 | if (value.indexOf(DEFAULT_ROOT) !== -1) {
45 | return value.replace(/^(.+?)(_\d+x\d+)?(\.\w+)$/, '$1$3')
46 | } else {
47 | return value
48 | }
49 | } else if (value.match(/^data:.+;base64,(.+)$/)) {
50 | return value
51 | } else {
52 | return DEFAULT_ROOT + value
53 | }
54 | } else {
55 | return DEFAULT_IMAGE
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/client/jvue-client/src/jslib/preview.js:
--------------------------------------------------------------------------------
1 | const DEFAULT_ROOT = '//www.100902.com/'
2 |
3 | export class ImagePreview {
4 | constructor (url) {
5 | this.url = url
6 | }
7 | imageOri (value) {
8 | if (value && value !== '') {
9 | if (value.match(/^https?:\/\/.+/g)) {
10 | if (value.indexOf(DEFAULT_ROOT) !== -1) {
11 | return value.replace(/^(.+?)(_\d+x\d+)?(\.\w+)$/, '$1$3')
12 | } else {
13 | return value
14 | }
15 | } else if (value.match(/^data:.+;base64,(.+)$/)) {
16 | return value
17 | } else {
18 | return DEFAULT_ROOT + value
19 | }
20 | } else {
21 | return ''
22 | }
23 | }
24 | preview () {
25 | let image = this.imageOri(this.url)
26 | let fullDiv = `
27 |

28 |
点击关闭
29 |
`
30 | let dom = document.body || document.documentElement
31 | dom.insertAdjacentHTML('beforeEnd', fullDiv)
32 | let imagePreviewDiv = document.getElementById('image-preview')
33 | imagePreviewDiv.addEventListener('click', function () {
34 | imagePreviewDiv.parentNode.removeChild(imagePreviewDiv)
35 | })
36 | }
37 | }
38 |
39 | export default ImagePreview
40 |
--------------------------------------------------------------------------------
/client/jvue-client/src/main.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue'
4 | import App from './App'
5 | import vuet from './vuet/'
6 | import ElementUI from 'element-ui'
7 | import router from './router'
8 | import components from './components/'
9 | import 'element-ui/lib/theme-chalk/index.css'
10 | import 'nprogress/nprogress.css'
11 | import './common/'
12 | import './filters/'
13 | import './assets/css/'
14 | import './api/'
15 |
16 | Vue.config.productionTip = false
17 | Vue.use(ElementUI, {size: 'small', zIndex: 20000}) // 防止被ueditor挡住
18 |
19 | Object.keys(components).forEach((key) => {
20 | // 首字母大写
21 | let name = key.replace(/(\w)/, (v) => v.toUpperCase())
22 | Vue.component(`v${name}`, components[key])
23 | })
24 |
25 | /* eslint-disable no-new */
26 | global.app = new Vue({
27 | el: '#app',
28 | vuet,
29 | router,
30 | template: '',
31 | components: { App }
32 | })
33 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/common/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 | {{ item.meta.title }}
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
21 |
31 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/error/403.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 你对当前画面无操作权限,请确认
5 |
6 |
7 | URL: {{$route.redirectedFrom}}
8 |
9 |
10 |
11 |
13 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/error/404.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 | URL-link: {{$route.redirectedFrom}}
6 | URL-back: {{$route.redirectedFrom}}
7 |
8 |
9 |
10 |
24 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/error/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 返回首页
14 |
15 |
16 | 个人中心
17 |
18 |
19 |
20 |
21 |
22 |
28 |
31 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/home/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | home page
4 |
5 |
6 |
7 |
8 |
9 |
19 |
20 |
23 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/loading.vue:
--------------------------------------------------------------------------------
1 |
2 | loading page.
3 | 正在跳转
4 |
5 |
6 |
7 |
20 |
21 |
24 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/sys/api/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 | {{scope.row.pageId|pageName}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
31 |
32 |
33 |
34 |
66 |
67 |
70 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/sys/common/filters.js:
--------------------------------------------------------------------------------
1 | // import Vue from 'vue'
2 | import vuet from '@/vuet/'
3 | export default {
4 | moduleName (code) {
5 | const codeList = vuet.getModule('sys-module-names')
6 | if (!codeList.list) {
7 | return ''
8 | } else {
9 | for (let codeItem of codeList.list) {
10 | if (code === codeItem.code) {
11 | return codeItem.name
12 | }
13 | }
14 | return '-'
15 | }
16 | },
17 | pageName (code) {
18 | const codeList = vuet.getModule('sys-page-names')
19 | if (!codeList.list) {
20 | return ''
21 | } else {
22 | for (let codeItem of codeList.list) {
23 | if (code === codeItem.code) {
24 | return codeItem.name
25 | }
26 | }
27 | return '-'
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/sys/module/add.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 | 保存
13 | 取消
14 |
15 |
16 |
17 |
18 |
19 |
51 |
52 |
55 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/sys/module/detail.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
模块名:{{moduleDetail.detail.name}}
4 |
是否启用:{{moduleDetail.detail.enabled|enumName('yn')}}
5 |
***后续续追加一些其他方面的信息展示***
6 |
7 |
8 |
9 |
19 |
20 |
23 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/sys/module/edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 | 保存
13 | 取消
14 |
15 |
16 |
17 |
18 |
19 |
51 |
52 |
55 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/sys/role/add.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 | 保存
13 | 取消
14 |
15 |
16 |
17 |
18 |
19 |
53 |
54 |
57 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/sys/role/detail.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
角色名:{{roleDetail.detail.name}}
4 |
是否启用:{{roleDetail.detail.enabled|enumName('yn')}}
5 |
***后续续追加一些其他方面的信息展示***
6 |
7 |
8 |
9 |
19 |
20 |
23 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/sys/role/edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 | 保存
13 | 取消
14 |
15 |
16 |
17 |
18 |
19 |
53 |
54 |
57 |
--------------------------------------------------------------------------------
/client/jvue-client/src/pages/sys/segment/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 | {{scope.row.pageId|pageName}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
31 |
32 |
33 |
34 |
66 |
67 |
70 |
--------------------------------------------------------------------------------
/client/jvue-client/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import NProgress from 'nprogress'
4 | import Routers from './routers'
5 | import {utils} from '@/common/'
6 | import vuet from '@/vuet/'
7 |
8 | Vue.use(Router)
9 |
10 | NProgress.configure({showSpinner: false})
11 |
12 | // let initedMenu = false
13 | const router = new Router({
14 | routes: Routers,
15 | mode: 'history',
16 | base: '/admin/'
17 | })
18 | router.onReady(() => {
19 | // 处理刷新后,router重加载
20 | let userSelf = vuet.getModule('user-self')
21 | if (userSelf && userSelf.user) {
22 | userSelf.reloadRouters()
23 | }
24 | })
25 | router.afterEach(router => {
26 | let {meta} = router
27 | if (meta.title) {
28 | utils.setWindowTitle(meta.title + ':::JVUE管理系统')
29 | } else {
30 | utils.setWindowTitle('JVUE::管理系统')
31 | }
32 | NProgress.done()
33 | })
34 | router.beforeEach(({meta, path, name}, from, next) => {
35 | NProgress.start()
36 | // let {meta, path, name} = to
37 | let userSelf = vuet.getModule('user-self')
38 | // let { auth = true } = meta
39 | // if (userSelf.user && userSelf.user) {
40 | // // 已登录
41 | // // return next()
42 | // } else {
43 | // if (auth) {
44 | // return next({ path: '/login' })
45 | // } else {
46 | // // return next()
47 | // }
48 | // }
49 | if (meta && from.meta && (meta.moduleId !== from.meta.moduleId || userSelf.moduleId !== meta.moduleId)) {
50 | // 处理导航与画面同步
51 | userSelf.changeModule(meta.moduleId)
52 | }
53 | return next()
54 | })
55 | export default router
56 |
--------------------------------------------------------------------------------
/client/jvue-client/src/router/routers.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by Yuangui on 2017-08-09.
3 | */
4 |
5 | export default [
6 | {
7 | path: '/login',
8 | name: 'login',
9 | meta: {auth: false, title: '登录'},
10 | component: resolve => require(['@/pages/login'], resolve)
11 | },
12 | {
13 | path: '',
14 | name: 'loading',
15 | meta: {auth: false, title: '加载'},
16 | component: resolve => require(['@/pages/loading'], resolve)
17 | },
18 | {
19 | path: '/',
20 | name: 'main',
21 | meta: {title: '首页', active: 1},
22 | component: resolve => require(['@/pages/common/main'], resolve),
23 | children: [{
24 | path: 'home',
25 | meta: {auth: false, title: 'home'},
26 | name: 'home',
27 | component: resolve => require(['@/pages/home/index'], resolve)
28 | }]
29 | },
30 | {
31 | path: '/error',
32 | component: resolve => require(['@/pages/error/'], resolve),
33 | hidden: true,
34 | children: [
35 | {
36 | path: '404',
37 | meta: {auth: false, title: '404'},
38 | name: 'E404',
39 | component: resolve => require(['@/pages/error/404'], resolve)
40 | },
41 | {
42 | path: '403',
43 | meta: {auth: false, title: '403'},
44 | name: 'E403',
45 | component: resolve => require(['@/pages/error/403'], resolve)
46 | }
47 | ]
48 | }
49 | // ,
50 | // {
51 | // path: '*',
52 | // hidden: true,
53 | // redirect: {path: '/error/404'}
54 | // }
55 | ]
56 |
--------------------------------------------------------------------------------
/client/jvue-client/src/vuet/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/src/vuet/index.js
--------------------------------------------------------------------------------
/client/jvue-client/src/vuet/modules/sys.js:
--------------------------------------------------------------------------------
1 | // import ApiUtils from '@/api/'
2 |
3 | import module from './sys/sys-module'
4 |
5 | import role from './sys/sys-role'
6 | import page from './sys/sys-page'
7 | import api from './sys/sys-api'
8 | import segment from './sys/sys-segment'
9 | import acl from './sys/sys-acl'
10 |
11 | // import {utils} from '@/common/'
12 | export default {
13 | modules: {
14 | module,
15 | page,
16 | api,
17 | segment,
18 | acl,
19 | role
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/client/jvue-client/src/vuet/modules/sys/sys-acl.js:
--------------------------------------------------------------------------------
1 | import ApiUtils from '@/api/'
2 |
3 | export default {
4 | modules: {
5 | list: {
6 | data () {
7 | return {
8 | list: []
9 | }
10 | },
11 | async fetch () {
12 | const response = await ApiUtils.get('/api/acl')
13 | let {error, message, data = []} = response.data
14 | if (error === null) {
15 | this.list = data
16 | } else {
17 | Promise.reject(new Error(message))
18 | }
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/client/jvue-client/src/vuet/modules/sys/sys-api.js:
--------------------------------------------------------------------------------
1 | import ApiUtils from '@/api/'
2 |
3 | export default {
4 | modules: {
5 | list: {
6 | data () {
7 | return {
8 | searchForm: {
9 | page: 1,
10 | pageSize: 10,
11 | pageCount: 0,
12 | totalCount: 0
13 | },
14 | loading: false,
15 | list: []
16 | }
17 | },
18 | async fetch () {
19 | this.loading = true
20 | const param = {
21 | page: this.searchForm.page,
22 | pageSize: this.searchForm.pageSize
23 | }
24 |
25 | const response = await ApiUtils.get('/api/api', param)
26 | this.loading = false
27 | let {status, data = {}} = response
28 | if (status === 200 && data.error === null) {
29 | this.searchForm.page = data.pageNum
30 | this.searchForm.pageSize = data.pageSize
31 | this.searchForm.pageCount = data.pages
32 | this.searchForm.totalCount = data.total
33 | this.list = data.data || []
34 | }
35 | }
36 | },
37 | add: {},
38 | edit: {}
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/client/jvue-client/src/vuet/modules/sys/sys-segment.js:
--------------------------------------------------------------------------------
1 | import ApiUtils from '@/api/'
2 |
3 | export default {
4 | modules: {
5 | list: {
6 | data () {
7 | return {
8 | searchForm: {
9 | page: 1,
10 | pageSize: 10,
11 | pageCount: 0,
12 | totalCount: 0
13 | },
14 | loading: false,
15 | list: []
16 | }
17 | },
18 | async fetch () {
19 | this.loading = true
20 | const param = {
21 | page: this.searchForm.page,
22 | pageSize: this.searchForm.pageSize
23 | }
24 |
25 | const response = await ApiUtils.get('/api/segment', param)
26 | this.loading = false
27 | let {status, data = {}} = response
28 | if (status === 200 && data.error === null) {
29 | this.searchForm.page = data.pageNum
30 | this.searchForm.pageSize = data.pageSize
31 | this.searchForm.pageCount = data.pages
32 | this.searchForm.totalCount = data.total
33 | this.list = data.data || []
34 | }
35 | }
36 | },
37 | add: {},
38 | edit: {}
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/client/jvue-client/static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/static/.gitkeep
--------------------------------------------------------------------------------
/client/jvue-client/static/img/404.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/static/img/404.png
--------------------------------------------------------------------------------
/client/jvue-client/static/img/logo-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/client/jvue-client/static/img/logo-white.png
--------------------------------------------------------------------------------
/doc/JVUE权限说明.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/doc/JVUE权限说明.xlsx
--------------------------------------------------------------------------------
/doc/画面样式/模块管理.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/doc/画面样式/模块管理.png
--------------------------------------------------------------------------------
/doc/画面样式/用户授权.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/doc/画面样式/用户授权.png
--------------------------------------------------------------------------------
/doc/画面样式/画面和菜单管理.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ccfish86/jvue-admin/ddaa6bcaa2f3dbac0478e2a9929e967cd28b0f2c/doc/画面样式/画面和菜单管理.png
--------------------------------------------------------------------------------
/doc/配置-linux-sample/data/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo "[deploying jar for jvue-api]"
4 | if [ -e /data/jvue-api-0.0.1-SNAPSHOT.jar ]; then
5 | echo "deploy jvue-admin [jvue-api]"
6 | systemctl stop jvue-admin
7 | mv /data/jvue-api-0.0.1-SNAPSHOT.jar /data/java-server/ -f
8 | chmod +x /data/java-server/jvue-api-0.0.1-SNAPSHOT.jar
9 | systemctl start jvue-admin
10 | fi
11 |
12 | echo "[deploying done]"
13 |
--------------------------------------------------------------------------------
/doc/配置-linux-sample/data/java-server/conf/jvue/application-prod.yml:
--------------------------------------------------------------------------------
1 | spring:
2 |
3 | datasource:
4 | type: com.zaxxer.hikari.HikariDataSource
5 | url: jdbc:mysql://localhost:3306/jvue?useSSL=false&tinyInt1isBit=false&useUnicode=true&characterEncoding=UTF-8
6 | username: jvue
7 | password: ########################
8 |
9 | cache:
10 | type: hazelcast
11 | security:
12 | oauth2:
13 | client:
14 | registration:
15 | github:
16 | client-id: d27a35ace86b4bc26d76
17 | client-secret: ################################################
18 | client-name: jvue
19 | resources:
20 | static-locations:
21 | - classpath:/resources/
22 | - classpath:/static/
23 | - classpath:/public/
24 | - file:///data/nginx/
25 | logging:
26 | path: /data/java-server/logs
27 | file: /data/java-server/logs/jvue.log
28 | config: /data/java-server/conf/jvue/logback-spring.xml
29 | # hazelcast.spring.cache.prop
30 |
--------------------------------------------------------------------------------
/doc/配置-linux-sample/data/java-server/conf/jvue/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8080
3 |
4 | mybatis:
5 | mapper-locations:
6 | - classpath*:mapper/*.xml
7 | - classpath*:mapper/**/*.xml
8 | mapper:
9 | mappers:
10 | - net.ccfish.common.mybatis.BaseMapper
11 | - net.ccfish.common.mybatis.PgBaseMapper
12 | notEmpty: true
13 |
14 | spring:
15 | application:
16 | name: jvue-api
17 | profiles:
18 | active:
19 | - prod
20 | - swagger
21 | jackson:
22 | date-format: yyyy-MM-dd HH:mm:ss
23 | time-zone:
24 | GMT+8
25 | thymeleaf:
26 | enabled: true
--------------------------------------------------------------------------------
/doc/配置-linux-sample/data/java-server/conf/jvue/logback-spring.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | true
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/配置-linux-sample/data/java-server/jvue-api-0.0.1-SNAPSHOT.conf:
--------------------------------------------------------------------------------
1 | JAVA_OPTS="-Xmx512M -Xms256M -XX:MaxMetaspaceSize=128m -Dserver.port=8080 -Dspring.profiles.active=prod -Dspring.config.location=/data/java-server/conf/jvue/"
2 | #spring.config.location=/data/java-server/conf/jvue/
3 | #LOG_FILE=/data/java-server/logs/spring.log
4 | #LOG_FOLDER=/data/java-server/logs/
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/Delimiter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common;
6 |
7 | /**
8 | *
9 | * @author 袁贵
10 | * @version 1.0
11 | * @since 1.0
12 | */
13 | public abstract class Delimiter {
14 |
15 | public static final char COMMA = ',';
16 | }
17 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/JvueDataStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common;
6 |
7 | /**
8 | *
9 | * @author 袁贵
10 | * @version 1.0
11 | * @since 1.0
12 | */
13 | public abstract class JvueDataStatus {
14 |
15 | public static final int ENABLE_TRUE = 0x1;
16 | public static final int ENABLE_FALSE = 0x0;
17 |
18 | public static final int SUPER_USER_TRUE = 0x1;
19 | public static final int SUPER_USER_FALSE = 0x0;
20 | }
21 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/OrderByUtils.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.common;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 |
5 | /**
6 | *
7 | * @author 袁贵
8 | * @version 1.0
9 | * @since 1.0
10 | */
11 | public class OrderByUtils {
12 |
13 | static String ASC = "asc";
14 | static String DESC = "desc";
15 |
16 | public static String toString(String sort, int direction) {
17 |
18 | if (StringUtils.isBlank(sort)) {
19 | return StringUtils.EMPTY;
20 | }
21 |
22 | StringBuilder builder = new StringBuilder();
23 | builder.append(sort).append(StringUtils.SPACE).append(direction == 1 ? DESC : ASC);
24 |
25 | return builder.toString();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/SearchUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common;
6 |
7 | import java.text.ParseException;
8 | import java.util.Calendar;
9 | import java.util.Date;
10 |
11 | import org.apache.commons.lang3.time.DateUtils;
12 | import org.slf4j.Logger;
13 | import org.slf4j.LoggerFactory;
14 | import org.springframework.util.StringUtils;
15 |
16 | /**
17 | * 查询条件编辑
18 | *
19 | * @author 袁贵
20 | * @version 1.0
21 | * @since 1.0
22 | */
23 | public class SearchUtils {
24 |
25 | private static final String[] PARSE_PATTERNS = new String[]{"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss"};
26 |
27 | private static final Logger LOGGER = LoggerFactory.getLogger(SearchUtils.class);
28 |
29 | /**
30 | * 查询开始日期
31 | * @param date 日期("yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss")
32 | * @return 日期(0时0分)
33 | * @since 1.0
34 | */
35 | public static Date dayFrom(String date) {
36 | if (StringUtils.isEmpty(date)) {
37 | return null;
38 | }
39 | try {
40 | Date d = DateUtils.parseDate(date, PARSE_PATTERNS);
41 | return DateUtils.truncate(d, Calendar.DATE);
42 | } catch (ParseException e) {
43 | LOGGER.warn("日期转换错误{},{}", date, e.getMessage());
44 | }
45 | return null;
46 | }
47 |
48 | /**
49 | * 查询终止日期
50 | * @param date 日期("yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss")
51 | * @return 日期(次日0时0分)
52 | * @since 1.0
53 | */
54 | public static Date dayTo(String date) {
55 | if (StringUtils.isEmpty(date)) {
56 | return null;
57 | }
58 | try {
59 | Date d = DateUtils.parseDate(date, PARSE_PATTERNS);
60 | return DateUtils.ceiling(d, Calendar.DATE);
61 | } catch (ParseException e) {
62 | LOGGER.warn("日期转换错误{},{}", date, e.getMessage());
63 | }
64 | return null;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/acl/AclResc.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.common.acl;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | import org.springframework.security.access.annotation.Secured;
10 |
11 | /**
12 | * 定义接口信息,用于角色授权画面
13 | *
14 | * 需要后续处理的事项,有一部分字段,与Swagger2重复,仅需保留Swagger2定义的一部分,便于开发与维护
15 | *
16 | * @author 袁贵
17 | * @version 1.0
18 | * @since 1.0
19 | */
20 | @Target({ElementType.METHOD, ElementType.TYPE})
21 | @Retention(RetentionPolicy.RUNTIME)
22 | @Secured("ROLE_USER")
23 | @Documented
24 | public @interface AclResc {
25 |
26 | int id();// ACLResource 因为特殊原因不使用 id 自动增长,所以必须自定义ID ,并且不能重复
27 |
28 | // String code();
29 | //
30 | // String name();
31 | //
32 | // // 前后端分离,可能用不着
33 | // String homePage() default "";
34 |
35 | // 前后端分离,用不着
36 | // boolean isMenu() default false;
37 | }
38 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/acl/CurrentUser.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.common.acl;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * 用于处理当前用户登录
10 | *
11 | * @author yuangui
12 | * @version 1.0
13 | * @since 2018-07-18
14 | */
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Target(ElementType.PARAMETER)
17 | public @interface CurrentUser {
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/entity/BaseEntity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.entity;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * 包含了数据库通用字段的实体类
11 | *
12 | * @author 袁贵
13 | * @version 1.0
14 | * @since 1.0
15 | */
16 | public abstract class BaseEntity implements Serializable {
17 |
18 | private static final long serialVersionUID = -5045997629665306165L;
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/entity/CodeItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.entity;
6 |
7 | /**
8 | *
9 | * @author 袁贵
10 | * @version 1.0
11 | * @since 1.0
12 | */
13 | public class CodeItem {
14 |
15 | private T code;
16 | private String name;
17 |
18 | /**
19 | * @return the code
20 | */
21 | public T getCode() {
22 | return code;
23 | }
24 |
25 | /**
26 | * @param code the code to set
27 | */
28 | public void setCode(T code) {
29 | this.code = code;
30 | }
31 |
32 | /**
33 | * @return the name
34 | */
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | /**
40 | * @param name the name to set
41 | */
42 | public void setName(String name) {
43 | this.name = name;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/enums/MenuTypeEnum.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.enums;
6 |
7 | /**
8 | * 可能暂时没用到
9 | *
10 | * 对应到jvue_menu.type;后续可以通过这个定义画面的区域元素的权限
11 | *
12 | * @author 袁贵
13 | * @version 1.0
14 | * @since 1.0
15 | */
16 | public enum MenuTypeEnum {
17 | Menu,
18 | Page,
19 | Both
20 | }
21 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/enums/YesOrNoEnum.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.enums;
6 |
7 | /**
8 | *
9 | * @author 袁贵
10 | * @version 1.0
11 | * @since 1.0
12 | */
13 | public enum YesOrNoEnum {
14 | No,
15 | Yes
16 | }
17 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/generator/README.txt:
--------------------------------------------------------------------------------
1 | 扩展了mybatis生成,使之支持swagger和postgresql等比较特殊的情景。
2 | 其中Swagger注释相关的生成代码来源于gitee开源项目。
3 | 此包在运行时不需要。
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/mybatis/BaseMapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.mybatis;
6 |
7 | import java.util.List;
8 |
9 | import org.apache.ibatis.annotations.InsertProvider;
10 | import org.apache.ibatis.annotations.Options;
11 |
12 | import tk.mybatis.mapper.common.IdsMapper;
13 | import tk.mybatis.mapper.common.Mapper;
14 | import tk.mybatis.mapper.common.Marker;
15 | import tk.mybatis.mapper.provider.SpecialProvider;
16 |
17 | /**
18 | * Mapper for PostgreSql
19 | *
20 | * @author yuan
21 | * @version 1.0
22 | * @since 1.0
23 | */
24 | public interface BaseMapper extends Mapper, IdsMapper, Marker {
25 |
26 |
27 | @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
28 | @InsertProvider(type = SpecialProvider.class, method = "dynamicSQL")
29 | int insertList(List recordList);
30 | }
31 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/mybatis/PgBaseMapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.mybatis;
6 |
7 | import org.apache.ibatis.annotations.InsertProvider;
8 | import org.apache.ibatis.annotations.Options;
9 |
10 | import tk.mybatis.mapper.provider.base.BaseInsertProvider;
11 |
12 | /**
13 | * Mapper for PostgreSql
14 | *
15 | * @author yuan
16 | * @version 1.0
17 | * @since 1.0
18 | */
19 | public interface PgBaseMapper extends BaseMapper {
20 |
21 | /**
22 | * 保存一个实体,null的属性也会保存,不会使用数据库默认值
23 | *
24 | * @param record
25 | * @return
26 | */
27 | @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
28 | @InsertProvider(type = BaseInsertProvider.class, method = "dynamicSQL")
29 | int insert(T record);
30 |
31 | /**
32 | * 保存一个实体,null的属性不会保存,会使用数据库默认值
33 | *
34 | * @param record
35 | * @return
36 | */
37 | @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
38 | @InsertProvider(type = BaseInsertProvider.class, method = "dynamicSQL")
39 | int insertSelective(T record);
40 | }
41 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/mybatis/PgInsertMapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.mybatis;
6 |
7 | import org.apache.ibatis.annotations.InsertProvider;
8 | import org.apache.ibatis.annotations.Options;
9 |
10 | import tk.mybatis.mapper.common.base.BaseInsertMapper;
11 | import tk.mybatis.mapper.provider.base.BaseInsertProvider;
12 |
13 | /**
14 | * 通用Mapper接口,基础查询
15 | *
16 | * @param 不能为空
17 | * @author yuan
18 | */
19 | interface PgInsertMapper extends BaseInsertMapper {
20 |
21 | /**
22 | * 保存一个实体,null的属性也会保存,不会使用数据库默认值
23 | *
24 | * @param record
25 | * @return
26 | */
27 | @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
28 | @InsertProvider(type = BaseInsertProvider.class, method = "dynamicSQL")
29 | int insert(T record);
30 |
31 | /**
32 | * 保存一个实体,null的属性不会保存,会使用数据库默认值
33 | *
34 | * @param record
35 | * @return
36 | */
37 | @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
38 | @InsertProvider(type = BaseInsertProvider.class, method = "dynamicSQL")
39 | int insertSelective(T record);
40 | }
41 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/web/BaseModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2016 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.web;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * 各消息/服务间用通用Model
11 | *
12 | * @author 袁贵
13 | * @version 1.0
14 | * @since 1.0
15 | */
16 | public class BaseModel implements Serializable {
17 |
18 | private static final long serialVersionUID = 4518971185913581227L;
19 |
20 | /** status code */
21 | private String error;
22 |
23 | private String message;
24 |
25 | /** return data */
26 | private T data;
27 |
28 | /**
29 | * @return the data
30 | */
31 | public T getData() {
32 | return data;
33 | }
34 |
35 | /**
36 | * @param data the data to set
37 | */
38 | public BaseModel setData(T data) {
39 | this.data = data;
40 | return this;
41 | }
42 |
43 | /**
44 | * @return the error
45 | */
46 | public String getError() {
47 | return error;
48 | }
49 |
50 | /**
51 | * @param error the error to set
52 | */
53 | public void setError(String error) {
54 | this.error = error;
55 | }
56 |
57 | /**
58 | * @return the message
59 | */
60 | public String getMessage() {
61 | return message;
62 | }
63 |
64 | /**
65 | * @param message the message to set
66 | */
67 | public void setMessage(String message) {
68 | this.message = message;
69 | }
70 |
71 | public static BaseModel ok(T data) {
72 | return new BaseModel().setData(data);
73 | }
74 |
75 | public static BaseModel error(String error, String message) {
76 | BaseModel baseModel = new BaseModel<>();
77 | baseModel.setError(error);
78 | baseModel.setMessage(message);
79 | return baseModel;
80 | }
81 | public static BaseModel error(String message) {
82 | BaseModel baseModel = new BaseModel<>();
83 | baseModel.setError("1");
84 | baseModel.setMessage(message);
85 | return baseModel;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/web/PageParam.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.web;
6 |
7 | /**
8 | * 带分页的画面查询参数
9 | * @author 袁贵
10 | * @version 1.0
11 | * @since 1.0
12 | */
13 | public class PageParam {
14 |
15 | /** 使用PageHelper,页码从1开始 */
16 | int page = 0;
17 |
18 | /** 每页件数 */
19 | int pageSize = 20;
20 |
21 | String sort;
22 |
23 | int direction;
24 |
25 | /**
26 | * @return the page
27 | */
28 | public int getPage() {
29 | return page;
30 | }
31 |
32 | /**
33 | * @param page the page to set
34 | */
35 | public void setPage(int page) {
36 | this.page = page;
37 | }
38 |
39 | /**
40 | * @return the pageSize
41 | */
42 | public int getPageSize() {
43 | return pageSize;
44 | }
45 |
46 | /**
47 | * @param pageSize the pageSize to set
48 | */
49 | public void setPageSize(int pageSize) {
50 | this.pageSize = pageSize;
51 | }
52 |
53 | /**
54 | * @return the sort
55 | */
56 | public String getSort() {
57 | return sort;
58 | }
59 |
60 | /**
61 | * @param sort the sort to set
62 | */
63 | public void setSort(String sort) {
64 | this.sort = sort;
65 | }
66 |
67 | /**
68 | * @return the direction
69 | */
70 | public int getDirection() {
71 | return direction;
72 | }
73 |
74 | /**
75 | * @param direction the direction to set
76 | */
77 | public void setDirection(int direction) {
78 | this.direction = direction;
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/common/web/PagedModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2016 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.common.web;
6 |
7 | import java.util.List;
8 |
9 | import com.github.pagehelper.Page;
10 |
11 | /**
12 | * 各消息/服务间用通用Model
13 | *
14 | * @author 袁贵
15 | * @version 1.0
16 | * @since 1.0
17 | */
18 | public class PagedModel extends BaseModel> { //当前页
19 |
20 | private static final long serialVersionUID = -3398360572386723106L;
21 |
22 | private int pageNum;
23 | //每页的数量
24 | private int pageSize;
25 | // //当前页的数量
26 | // private int size;
27 | //总记录数
28 | private long total;
29 | // //总页数
30 | // private int pages;
31 |
32 | public int getPageNum() {
33 | return pageNum;
34 | }
35 |
36 | public void setPageNum(int pageNum) {
37 | this.pageNum = pageNum;
38 | }
39 |
40 | public int getPageSize() {
41 | return pageSize;
42 | }
43 |
44 | public void setPageSize(int pageSize) {
45 | this.pageSize = pageSize;
46 | }
47 |
48 | public int getSize() {
49 | // return size;
50 | return super.getData() == null?0:super.getData().size();
51 | }
52 |
53 | // public void setSize(int size) {
54 | // this.size = size;
55 | // }
56 | public long getTotal() {
57 | return total;
58 | }
59 |
60 | public void setTotal(long total) {
61 | this.total = total;
62 | }
63 |
64 | public long getPages() {
65 | // return pages;
66 | if (pageSize == 0 || total == 0) {
67 | return 0;
68 | }
69 | long pageMod = total % pageSize;
70 | long pageCount = total / pageSize;
71 | return pageMod == 0 ? pageCount : pageCount + 1;
72 | }
73 |
74 | /**
75 | * @param list
76 | * @return
77 | * @since 1.0
78 | */
79 | public static PagedModel from(Page list) {
80 | PagedModel pageList = new PagedModel<>();
81 | pageList.pageNum = list.getPageNum();
82 | pageList.pageSize = list.getPageSize();
83 | pageList.setTotal(list.getTotal());
84 | pageList.setData(list.getResult());
85 | return pageList;
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/JvueApiApplication.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.transaction.annotation.EnableTransactionManagement;
6 |
7 | import tk.mybatis.spring.annotation.MapperScan;
8 |
9 | @SpringBootApplication
10 | @EnableTransactionManagement
11 | @MapperScan(basePackages = {"net.ccfish.jvue.domain.dao", "net.ccfish.jvue.autogen.dao"})
12 | public class JvueApiApplication {
13 |
14 | public static void main(String[] args) {
15 | SpringApplication.run(JvueApiApplication.class, args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/aop/LogAspect.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.aop;
2 |
3 | import org.aspectj.lang.ProceedingJoinPoint;
4 | import org.aspectj.lang.annotation.Around;
5 | import org.aspectj.lang.annotation.Aspect;
6 | import org.aspectj.lang.annotation.Pointcut;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.context.annotation.Profile;
10 | import org.springframework.stereotype.Component;
11 |
12 |
13 | /**
14 | * Handler处理日志
15 | *
16 | * 仅在开发和测试环境中启用
17 | *
18 | * @author 袁贵
19 | * @version 1.0
20 | * @since 1.0
21 | */
22 | @Component
23 | @Aspect
24 | @Profile(value = {"dev", "test"})
25 | public class LogAspect {
26 |
27 | private static final Logger logger = LoggerFactory.getLogger(LogAspect.class);
28 |
29 | /**
30 | * 定义一个切入点. 解释下:
31 | *
32 | * ~ 第一个 * 代表任意修饰符及任意返回值. ~ 第二个 * 定义在web包或者子包 ~ 第三个 * 任意方法 ~ .. 匹配任意数量的参数.
33 | */
34 | @Pointcut("execution(* net.ccfish.jvue.**.*Controller.*(..))")
35 | public void logPointcut() {}
36 |
37 | @Around("logPointcut()")
38 | public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
39 | // LOG.debug("logPointcut " + joinPoint + "\t");
40 | long start = System.currentTimeMillis();
41 | try {
42 | logger.debug("[start] {}#{}", joinPoint.getTarget().getClass().getSimpleName(), joinPoint.getSignature().getName());
43 |
44 | // 输出参数
45 | Object[] objs = joinPoint.getArgs();
46 | for (Object obj : objs) {
47 |
48 | if (obj == null) {
49 | continue;
50 | }
51 |
52 | logger.trace("[param.other] :{}", obj);
53 | }
54 | Object result = joinPoint.proceed();
55 | return result;
56 | } catch (Throwable e) {
57 | throw e;
58 | } finally {
59 | long end = System.currentTimeMillis();
60 | logger.debug("[end] {}ms {}#{}", end - start, joinPoint.getTarget().getClass().getSimpleName(), joinPoint.getSignature().getName());
61 | }
62 |
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueApiMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueApi;
5 |
6 | public interface JvueApiMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueDeptMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.BaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueDept;
5 |
6 | public interface JvueDeptMapper extends BaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueModuleMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueModule;
5 |
6 | public interface JvueModuleMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvuePageMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvuePage;
5 |
6 | public interface JvuePageMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueRoleApiMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueRoleApi;
5 |
6 | public interface JvueRoleApiMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueRoleMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueRole;
5 |
6 | public interface JvueRoleMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueRolePageMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueRolePage;
5 |
6 | public interface JvueRolePageMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueRoleSegmentMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueRoleSegment;
5 |
6 | public interface JvueRoleSegmentMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueSegmentMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueSegment;
5 |
6 | public interface JvueSegmentMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueUserMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueUser;
5 |
6 | public interface JvueUserMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/autogen/dao/JvueUserRoleMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.autogen.dao;
2 |
3 | import net.ccfish.common.mybatis.PgBaseMapper;
4 | import net.ccfish.jvue.autogen.model.JvueUserRole;
5 |
6 | public interface JvueUserRoleMapper extends PgBaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/config/JvueGlobalMethodSecurityConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.config;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | import org.slf4j.Logger;
11 | import org.slf4j.LoggerFactory;
12 | import org.springframework.beans.factory.annotation.Autowired;
13 | import org.springframework.boot.autoconfigure.AutoConfigureAfter;
14 | import org.springframework.context.annotation.Configuration;
15 | import org.springframework.security.access.AccessDecisionManager;
16 | import org.springframework.security.access.AccessDecisionVoter;
17 | import org.springframework.security.access.vote.AffirmativeBased;
18 | import org.springframework.security.access.vote.AuthenticatedVoter;
19 | import org.springframework.security.access.vote.RoleVoter;
20 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
21 | import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;
22 |
23 | import net.ccfish.jvue.security.JvueMethodAclVoter;
24 |
25 | /**
26 | *
27 | * @author 袁贵
28 | * @version 1.0
29 | * @since 1.0
30 | */
31 | @Configuration
32 | @AutoConfigureAfter(WebSecurityConfig.class)
33 | @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
34 | public class JvueGlobalMethodSecurityConfiguration extends GlobalMethodSecurityConfiguration {
35 | private final Logger logger = LoggerFactory.getLogger(JvueGlobalMethodSecurityConfiguration.class);
36 |
37 | @Autowired
38 | private JvueMethodAclVoter jvueMethodAclVoter;
39 |
40 | @Override
41 | public AccessDecisionManager accessDecisionManager() {
42 |
43 | List> decisionVoters =
44 | new ArrayList>();
45 |
46 | decisionVoters.add(jvueMethodAclVoter);// 启用自定义投票器
47 | decisionVoters.add(new RoleVoter());
48 | decisionVoters.add(new AuthenticatedVoter());
49 |
50 | return new AffirmativeBased(decisionVoters);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/config/Swagger2Config.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.config;
6 |
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.context.annotation.Configuration;
9 | import org.springframework.context.annotation.Profile;
10 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
11 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
12 |
13 | import io.swagger.annotations.ApiOperation;
14 | import springfox.documentation.builders.ApiInfoBuilder;
15 | import springfox.documentation.builders.PathSelectors;
16 | import springfox.documentation.builders.RequestHandlerSelectors;
17 | import springfox.documentation.service.ApiInfo;
18 | import springfox.documentation.service.Contact;
19 | import springfox.documentation.spi.DocumentationType;
20 | import springfox.documentation.spring.web.plugins.Docket;
21 | import springfox.documentation.swagger2.annotations.EnableSwagger2;
22 |
23 | /**
24 | *
25 | * @author 袁贵
26 | * @version 1.0
27 | * @since 1.0
28 | */
29 | @Configuration()
30 | @EnableSwagger2
31 | @Profile("swagger")
32 | public class Swagger2Config extends WebMvcConfigurerAdapter {
33 |
34 | @Override
35 | public void addResourceHandlers(ResourceHandlerRegistry registry) {
36 | registry.addResourceHandler("swagger-ui.html")
37 | .addResourceLocations("classpath:/META-INF/resources/");
38 | registry.addResourceHandler("/webjars*")
39 | .addResourceLocations("classpath:/META-INF/resources/webjars/");
40 | }
41 |
42 | @Bean
43 | public Docket createRestApi() {
44 |
45 | return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
46 | // 扫描指定包中的swagger注解
47 | // .apis(RequestHandlerSelectors.basePackage("net.ccfish.jvue.rest"))
48 | // 扫描所有有注解的api,用这种方式更灵活
49 | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
50 | .paths(PathSelectors.any()).build();
51 |
52 | }
53 |
54 | private ApiInfo apiInfo() {
55 | return new ApiInfoBuilder().title("JVUE平台服务器端APIs")
56 | .license("MIT License")
57 | .licenseUrl("https://mit-license.org/")
58 | .description(
59 | "基础JVUE平台 RESTful 风格的接口文档,内容详细,极大的减少了前后端的沟通成本,同时确保代码与文档保持高度一致,极大的减少维护文档的时间。")
60 | .contact(new Contact("ccfish", "https://github.com/ccfish86/jvue-admin", "ccfish@ccfish.net"))
61 | .version("1.0.0").build();
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/config/WebArgumentResolverConfig.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.config;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.web.method.support.HandlerMethodArgumentResolver;
8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
9 |
10 | import net.ccfish.jvue.security.CurrentUserArgumentResolver;
11 |
12 | @Configuration
13 | public class WebArgumentResolverConfig implements WebMvcConfigurer {
14 |
15 | @Autowired
16 | private CurrentUserArgumentResolver userArgumentResolver;
17 |
18 | @Override
19 | public void addArgumentResolvers(List resolvers) {
20 | WebMvcConfigurer.super.addArgumentResolvers(resolvers);
21 | resolvers.add(userArgumentResolver);
22 | }
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/dao/JvueExDeptMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.domain.dao;
2 |
3 | import java.util.List;
4 |
5 | import net.ccfish.jvue.domain.model.JvueDeptNodeItem;
6 | import net.ccfish.jvue.domain.model.JvueExDept;
7 |
8 | /**
9 | *
10 | *
11 | * @author yuangui
12 | * @version 1.0
13 | * @since 2018-07-04
14 | */
15 | public interface JvueExDeptMapper {
16 |
17 | List search();
18 |
19 | List findTree();
20 | }
21 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/dao/JvueExPageMapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.dao;
6 |
7 | import java.util.List;
8 |
9 | import org.apache.ibatis.annotations.Param;
10 |
11 | import net.ccfish.jvue.domain.model.JvueExPage;
12 |
13 | /**
14 | *
15 | * @author 袁贵
16 | * @version 1.0
17 | * @since 1.0
18 | */
19 | public interface JvueExPageMapper {
20 |
21 | List findByModuleId(@Param("moduleIds")List moduleIds);
22 | }
23 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/dao/JvueExRoleApiMapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.dao;
6 |
7 | import java.util.List;
8 |
9 | import org.apache.ibatis.annotations.Param;
10 |
11 | import net.ccfish.jvue.domain.model.JvueExRoleApi;
12 |
13 | /**
14 | *
15 | * @author 袁贵
16 | * @version 1.0
17 | * @since 1.0
18 | */
19 | public interface JvueExRoleApiMapper {
20 |
21 | List selectByApi(@Param("apiCode") Integer apiCode);
22 | List selectByRole(@Param("roleIds") List roleIds);
23 | List selectApiByRoleAndModule(@Param("roleId") Integer roleIds, @Param("moduleId") Integer moduleId);
24 | }
25 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/dao/JvueExRolePageMapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.dao;
6 |
7 | import java.util.List;
8 |
9 | import org.apache.ibatis.annotations.Param;
10 |
11 | import net.ccfish.jvue.domain.model.JvueExPage;
12 |
13 | /**
14 | *
15 | * @author 袁贵
16 | * @version 1.0
17 | * @since 1.0
18 | */
19 | public interface JvueExRolePageMapper {
20 |
21 | List selectPageByRole(@Param("roleIds") List roleIds);
22 |
23 | List selectPageByRoleAndModule(@Param("roleId") Integer roleIds, @Param("moduleId") Integer moduleId);
24 | }
25 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/dao/JvueExRoleSegmentMapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.dao;
6 |
7 | import java.util.List;
8 |
9 | import org.apache.ibatis.annotations.Param;
10 |
11 | import net.ccfish.jvue.domain.model.JvueExRoleSegment;
12 |
13 | /**
14 | *
15 | * @author 袁贵
16 | * @version 1.0
17 | * @since 1.0
18 | */
19 | public interface JvueExRoleSegmentMapper {
20 |
21 | List selectSegmentByRole(@Param("roleIds") List roleIds);
22 |
23 | List selectSegmentByRoleAndModule(@Param("roleId") Integer roleIds, @Param("moduleId") Integer moduleId);
24 | }
25 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/dao/JvueExUserMapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.dao;
6 |
7 | import java.util.List;
8 |
9 | import org.apache.ibatis.annotations.Param;
10 |
11 | import net.ccfish.jvue.domain.model.JvueExRole;
12 | import net.ccfish.jvue.domain.model.JvueExUser;
13 |
14 | /**
15 | *
16 | * @author 袁贵
17 | * @version 1.0
18 | * @since 1.0
19 | */
20 | public interface JvueExUserMapper {
21 |
22 | JvueExUser findByUsername(@Param("username") String username);
23 |
24 | List searchUsers(@Param("username") String username);
25 |
26 | List selectRoles(@Param("userId") Long userId);
27 | }
28 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/dao/JvueOauthUserMapper.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.domain.dao;
2 |
3 | import net.ccfish.common.mybatis.BaseMapper;
4 | import net.ccfish.jvue.domain.model.JvueOauthUser;
5 |
6 | public interface JvueOauthUserMapper extends BaseMapper {
7 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueDeptNodeItem.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.domain.model;
2 |
3 | import java.util.List;
4 |
5 | import com.fasterxml.jackson.annotation.JsonInclude;
6 | import com.fasterxml.jackson.annotation.JsonInclude.Include;
7 |
8 | import net.ccfish.common.entity.CodeItem;
9 |
10 | public class JvueDeptNodeItem extends CodeItem {
11 |
12 | @JsonInclude(value = Include.NON_EMPTY)
13 | private List childs;
14 |
15 | public List getChilds() {
16 | return childs;
17 | }
18 |
19 | public void setChilds(List childs) {
20 | this.childs = childs;
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueExDept.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.domain.model;
2 |
3 | import java.util.List;
4 |
5 | import com.fasterxml.jackson.annotation.JsonInclude;
6 | import com.fasterxml.jackson.annotation.JsonInclude.Include;
7 |
8 | import net.ccfish.jvue.autogen.model.JvueDept;
9 |
10 | public class JvueExDept extends JvueDept {
11 |
12 | @JsonInclude(value = Include.NON_EMPTY)
13 | private List childs;
14 |
15 | public List getChilds() {
16 | return childs;
17 | }
18 |
19 | public void setChilds(List childs) {
20 | this.childs = childs;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueExPage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.model;
6 |
7 | import java.util.List;
8 |
9 | import com.fasterxml.jackson.annotation.JsonProperty;
10 |
11 | import net.ccfish.jvue.autogen.model.JvuePage;
12 |
13 | /**
14 | *
15 | * @author 袁贵
16 | * @version 1.0
17 | * @since 1.0
18 | */
19 | public class JvueExPage extends JvuePage {
20 |
21 | /**
22 | *
23 | */
24 | private static final long serialVersionUID = 3285166079344965584L;
25 |
26 | @JsonProperty("children")
27 | private List jvuePages;
28 |
29 | /**
30 | * @return the jvuePages
31 | */
32 | public List getJvuePages() {
33 | return jvuePages;
34 | }
35 |
36 | /**
37 | * @param jvuePages the jvuePages to set
38 | */
39 | public void setJvuePages(List jvuePages) {
40 | this.jvuePages = jvuePages;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueExRole.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.model;
6 |
7 | import org.springframework.security.core.GrantedAuthority;
8 |
9 | import net.ccfish.jvue.autogen.model.JvueRole;
10 |
11 | /**
12 | *
13 | * @author 袁贵
14 | * @version 1.0
15 | * @since 1.0
16 | */
17 | public class JvueExRole extends JvueRole implements GrantedAuthority {
18 |
19 | /**
20 | *
21 | */
22 | private static final long serialVersionUID = 323659480741765788L;
23 |
24 | /* (non-Javadoc)
25 | * @see org.springframework.security.core.GrantedAuthority#getAuthority()
26 | */
27 | @Override
28 | public String getAuthority() {
29 | return getName();
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueExRoleApi.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.model;
6 |
7 | import net.ccfish.jvue.autogen.model.JvueApi;
8 | import net.ccfish.jvue.autogen.model.JvueRole;
9 | import net.ccfish.jvue.autogen.model.JvueRoleApi;
10 |
11 | /**
12 | *
13 | * @author 袁贵
14 | * @version 1.0
15 | * @since 1.0
16 | */
17 | public class JvueExRoleApi extends JvueRoleApi {
18 |
19 | /**
20 | *
21 | */
22 | private static final long serialVersionUID = -1138621735187298157L;
23 |
24 | private JvueRole role;
25 | private JvueApi api;
26 |
27 | /**
28 | * @return the role
29 | */
30 | public JvueRole getRole() {
31 | return role;
32 | }
33 |
34 | /**
35 | * @param role the role to set
36 | */
37 | public void setRole(JvueRole role) {
38 | this.role = role;
39 | }
40 |
41 | /**
42 | * @return the api
43 | */
44 | public JvueApi getApi() {
45 | return api;
46 | }
47 |
48 | /**
49 | * @param api the api to set
50 | */
51 | public void setApi(JvueApi api) {
52 | this.api = api;
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueExRolePage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.model;
6 |
7 | import net.ccfish.jvue.autogen.model.JvueRolePage;
8 |
9 | /**
10 | *
11 | * @author 袁贵
12 | * @version 1.0
13 | * @since 1.0
14 | */
15 | public class JvueExRolePage extends JvueRolePage {
16 |
17 | /**
18 | *
19 | */
20 | private static final long serialVersionUID = -4377721433834950628L;
21 |
22 | private JvueExPage page;
23 |
24 | /**
25 | * @return the page
26 | */
27 | public JvueExPage getPage() {
28 | return page;
29 | }
30 |
31 | /**
32 | * @param page the page to set
33 | */
34 | public void setPage(JvueExPage page) {
35 | this.page = page;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueExRoleSegment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.model;
6 |
7 | import net.ccfish.jvue.autogen.model.JvueRoleSegment;
8 | import net.ccfish.jvue.autogen.model.JvueSegment;
9 |
10 | /**
11 | *
12 | * @author 袁贵
13 | * @version 1.0
14 | * @since 1.0
15 | */
16 | public class JvueExRoleSegment extends JvueRoleSegment {
17 |
18 | private JvueSegment segment;
19 |
20 | /**
21 | * @return the segment
22 | */
23 | public JvueSegment getSegment() {
24 | return segment;
25 | }
26 |
27 | /**
28 | * @param segment the segment to set
29 | */
30 | public void setSegment(JvueSegment segment) {
31 | this.segment = segment;
32 | }
33 |
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueExUser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.model;
6 |
7 | import java.util.List;
8 | import java.util.stream.Collectors;
9 |
10 | import net.ccfish.jvue.autogen.model.JvueUser;
11 |
12 | /**
13 | *
14 | * @author 袁贵
15 | * @version 1.0
16 | * @since 1.0
17 | */
18 | public class JvueExUser extends JvueUser {
19 |
20 | /**
21 | *
22 | */
23 | private static final long serialVersionUID = 7005756641716238160L;
24 |
25 | List roles;
26 |
27 | /**
28 | * @return the roles
29 | */
30 | public List getRoles() {
31 | return roles;
32 | }
33 |
34 | public List getRoleIds() {
35 | return roles.stream().map(role->role.getId()).collect(Collectors.toList());
36 | }
37 |
38 | /**
39 | * @param roles the roles to set
40 | */
41 | public void setRoles(List roles) {
42 | this.roles = roles;
43 | }
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueOauthUser.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.domain.model;
2 |
3 | import io.swagger.annotations.ApiModel;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import java.io.Serializable;
6 | import javax.persistence.*;
7 |
8 | @Table(name = "jvue_oauth_user")
9 | @ApiModel("JvueOauthUser()")
10 | public class JvueOauthUser implements Serializable {
11 | @Id
12 | @GeneratedValue(generator = "JDBC")
13 | @Column(name = "id", insertable = false, updatable = false)
14 | @ApiModelProperty(value = "", required = false)
15 | private Long id;
16 |
17 | @Column(name = "user_id")
18 | @ApiModelProperty(value = "", required = false)
19 | private Long userId;
20 |
21 | /**
22 | * 用户类型
23 | */
24 | @Column(name = "account_type")
25 | @ApiModelProperty(value = "用户类型", required = false)
26 | private String accountType;
27 |
28 | /**
29 | * 账号
30 | */
31 | @Column(name = "account_id")
32 | @ApiModelProperty(value = "账号", required = false)
33 | private String accountId;
34 |
35 | private static final long serialVersionUID = 1L;
36 |
37 | /**
38 | * @return id
39 | */
40 | public Long getId() {
41 | return id;
42 | }
43 |
44 | /**
45 | * @param id
46 | */
47 | public void setId(Long id) {
48 | this.id = id;
49 | }
50 |
51 | /**
52 | * @return user_id
53 | */
54 | public Long getUserId() {
55 | return userId;
56 | }
57 |
58 | /**
59 | * @param userId
60 | */
61 | public void setUserId(Long userId) {
62 | this.userId = userId;
63 | }
64 |
65 | /**
66 | * 获取用户类型
67 | *
68 | * @return account_type - 用户类型
69 | */
70 | public String getAccountType() {
71 | return accountType;
72 | }
73 |
74 | /**
75 | * 设置用户类型
76 | *
77 | * @param accountType 用户类型
78 | */
79 | public void setAccountType(String accountType) {
80 | this.accountType = accountType;
81 | }
82 |
83 | /**
84 | * 获取账号
85 | *
86 | * @return account_id - 账号
87 | */
88 | public String getAccountId() {
89 | return accountId;
90 | }
91 |
92 | /**
93 | * 设置账号
94 | *
95 | * @param accountId 账号
96 | */
97 | public void setAccountId(String accountId) {
98 | this.accountId = accountId;
99 | }
100 |
101 | public enum FieldEnum {
102 | ID("id", "id"), USER_ID("userId", "user_id"), ACCOUNT_TYPE("accountType", "account_type"),
103 | ACCOUNT_ID("accountId", "account_id");
104 |
105 | private String javaFieldName;
106 |
107 | private String dbFieldName;
108 |
109 | FieldEnum(String javaFieldName, String dbFieldName) {
110 | this.javaFieldName = javaFieldName;
111 | this.dbFieldName = dbFieldName;
112 | }
113 |
114 | public String javaFieldName() {
115 | return javaFieldName;
116 | }
117 |
118 | public String dbFieldName() {
119 | return dbFieldName;
120 | }
121 | }
122 | }
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/domain/model/JvueRoleItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.domain.model;
6 |
7 | import io.swagger.annotations.ApiModel;
8 | import io.swagger.annotations.ApiModelProperty;
9 | import net.ccfish.common.entity.CodeItem;
10 |
11 | /**
12 | *
13 | * @author 袁贵
14 | * @version 1.0
15 | * @since 1.0
16 | */
17 | @ApiModel("授权API/Segment")
18 | public class JvueRoleItem extends CodeItem {
19 |
20 | @ApiModelProperty("ID项目")
21 | private Integer id;
22 |
23 | public Integer getId() {
24 | return id;
25 | }
26 |
27 | public void setId(Integer id) {
28 | this.id = id;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/rest/AclResourceController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.rest;
6 |
7 | import java.util.List;
8 |
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.GetMapping;
11 | import org.springframework.web.bind.annotation.RequestMapping;
12 | import org.springframework.web.bind.annotation.RestController;
13 |
14 | import io.swagger.annotations.Api;
15 | import io.swagger.annotations.ApiOperation;
16 | import net.ccfish.common.acl.AclResc;
17 | import net.ccfish.common.web.BaseModel;
18 | import net.ccfish.jvue.service.AclResourceService;
19 | import net.ccfish.jvue.vm.AclResource;
20 |
21 | /**
22 | *
23 | * @author 袁贵
24 | * @version 1.0
25 | * @since 1.0
26 | */
27 | @RestController
28 | @RequestMapping("/api/acl")
29 | @Api(tags = "ACL管理")
30 | @AclResc(id = 5500)
31 | public class AclResourceController {
32 |
33 | @Autowired
34 | private AclResourceService aclResourceService;
35 |
36 | @AclResc(id = 1)
37 | @ApiOperation(value = "资源")
38 | @GetMapping("")
39 | public BaseModel> getResources() {
40 |
41 | List resources = aclResourceService.getAll();
42 |
43 | return new BaseModel>().setData(resources);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/rest/AuthController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.rest;
6 |
7 | import java.util.List;
8 |
9 | import org.slf4j.Logger;
10 | import org.slf4j.LoggerFactory;
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.web.bind.annotation.GetMapping;
13 | import org.springframework.web.bind.annotation.RequestMapping;
14 | import org.springframework.web.bind.annotation.RestController;
15 |
16 | import io.swagger.annotations.Api;
17 | import io.swagger.annotations.ApiOperation;
18 | import net.ccfish.common.JvueDataStatus;
19 | import net.ccfish.common.acl.CurrentUser;
20 | import net.ccfish.common.web.BaseModel;
21 | import net.ccfish.jvue.security.JwtUserDetails;
22 | import net.ccfish.jvue.service.JvuePageService;
23 | import net.ccfish.jvue.service.JvueRoleService;
24 | import net.ccfish.jvue.service.model.ModuleAndPages;
25 |
26 | /**
27 | * 登录
28 | * @author 袁贵
29 | * @version 1.0
30 | * @since 1.0
31 | */
32 | @RestController
33 | @RequestMapping("/api/")
34 | @Api(tags = "登录")
35 | public class AuthController {
36 |
37 | @Autowired
38 | private JvuePageService jvuePageService;
39 | @Autowired
40 | private JvueRoleService jvueRoleService;
41 |
42 | private Logger logger = LoggerFactory.getLogger(AuthController.class);
43 |
44 |
45 | /**
46 | * 用户菜单生成
47 | *
48 | * @param principal
49 | * @return
50 | * @since 1.0
51 | */
52 | @ApiOperation(value = "用户菜单")
53 | @GetMapping(value = "/auth/page")
54 | public BaseModel> getPage(@CurrentUser JwtUserDetails jwtUser) {
55 | // logger.info(principal.toString());
56 | if (jwtUser != null) {
57 | if (jwtUser.getSuperUser() == JvueDataStatus.SUPER_USER_TRUE) {
58 | // 返回所有菜单
59 | ModuleAndPages pages = jvuePageService.findModuleAndPage();
60 | return BaseModel.ok(pages);
61 | } else {
62 | // 返回用户菜单
63 | // 根据用户role和缓存中的role权限生成菜单
64 | List roles = jwtUser.getRoles();
65 | if (roles != null && !roles.isEmpty()) {
66 | ModuleAndPages pages = jvueRoleService.findModuleAndPage(roles);
67 | return BaseModel.ok(pages);
68 | } else {
69 | // return BaseModel.error("用户未授权");
70 | return BaseModel.ok(new ModuleAndPages<>());
71 | }
72 | }
73 | } else {
74 | logger.warn("无法获取登录信息");
75 | }
76 | return BaseModel.error("用户未授权");
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/rest/JvueApiController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.rest;
6 |
7 | import java.util.ArrayList;
8 | import java.util.Collection;
9 | import java.util.List;
10 |
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.web.bind.annotation.GetMapping;
13 | import org.springframework.web.bind.annotation.RequestMapping;
14 | import org.springframework.web.bind.annotation.RestController;
15 |
16 | import com.hazelcast.core.HazelcastInstance;
17 | import com.hazelcast.core.MultiMap;
18 |
19 | import io.swagger.annotations.Api;
20 | import io.swagger.annotations.ApiOperation;
21 | import net.ccfish.common.acl.AclResc;
22 | import net.ccfish.common.web.BaseModel;
23 | import net.ccfish.jvue.autogen.model.JvueApi;
24 | import net.ccfish.jvue.service.JvueApiService;
25 | import net.ccfish.jvue.service._AbstractService;
26 | import net.ccfish.jvue.vm.AclResource;
27 |
28 | /**
29 | * API相关
30 | *
31 | * @author 袁贵
32 | * @version 1.0
33 | * @since 1.0
34 | */
35 | @RestController
36 | @RequestMapping("/api/api")
37 | @AclResc(id = 5100)
38 | @Api(tags = "接口管理")
39 | public class JvueApiController implements _BaseController {
40 |
41 | @Autowired
42 | private JvueApiService jvueApiService;
43 |
44 | @Autowired
45 | private HazelcastInstance hazelcastInstance;
46 |
47 | /*
48 | * (non-Javadoc)
49 | *
50 | * @see com.hxxt.admin.rest._BaseController#baseService()
51 | */
52 | @Override
53 | public _AbstractService baseService() {
54 | return this.jvueApiService;
55 | }
56 |
57 | @GetMapping("resources")
58 | @ApiOperation(value = "资源")
59 | @AclResc(id = 11)
60 | public BaseModel> getResources() {
61 | MultiMap resourcesMap = hazelcastInstance.getMultiMap("acl-resource");
62 |
63 | Collection list = resourcesMap.values();
64 | return new BaseModel>().setData(new ArrayList<>(list));
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/rest/JvueModuleController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.rest;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.web.bind.annotation.GetMapping;
12 | import org.springframework.web.bind.annotation.RequestMapping;
13 | import org.springframework.web.bind.annotation.RestController;
14 |
15 | import io.swagger.annotations.Api;
16 | import io.swagger.annotations.ApiOperation;
17 | import net.ccfish.common.acl.AclResc;
18 | import net.ccfish.common.entity.CodeItem;
19 | import net.ccfish.common.web.BaseModel;
20 | import net.ccfish.jvue.autogen.model.JvueModule;
21 | import net.ccfish.jvue.service.JvueModuleService;
22 | import net.ccfish.jvue.service._AbstractService;
23 |
24 | /**
25 | * Module相关
26 | * @author 袁贵
27 | * @version 1.0
28 | * @since 1.0
29 | */
30 | @RestController
31 | @RequestMapping("/api/module")
32 | @AclResc(id = 5000)
33 | @Api(tags = "模块管理")
34 | public class JvueModuleController implements _BaseController {
35 |
36 | @Autowired
37 | private JvueModuleService jvueModuleService;
38 |
39 | /* (non-Javadoc)
40 | * @see com.hxxt.admin.rest._BaseController#baseService()
41 | */
42 | @Override
43 | public _AbstractService baseService() {
44 | return this.jvueModuleService;
45 | }
46 |
47 | @ApiOperation(value = "名字列表")
48 | @AclResc(id = 11)
49 | @GetMapping("/ext/names")
50 | public BaseModel>> names(){
51 | List modules = jvueModuleService.getAll();
52 | List> codeList = new ArrayList<>();
53 | for (JvueModule module: modules) {
54 | CodeItem CodeItem = new CodeItem<>();
55 | CodeItem.setCode(module.getId());
56 | CodeItem.setName(module.getName());
57 | codeList.add(CodeItem);
58 | }
59 | return new BaseModel>>().setData(codeList);
60 | }
61 | //
62 | // @Override
63 | // public BaseModel delete(@PathParam("id") Integer id) {
64 | // baseService().delete(id);
65 | // return new BaseModel().setData(id);
66 | // }
67 | }
68 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/rest/JvueSegmentController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.rest;
6 |
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import io.swagger.annotations.Api;
12 | import net.ccfish.common.acl.AclResc;
13 | import net.ccfish.jvue.autogen.model.JvueSegment;
14 | import net.ccfish.jvue.service.JvueSegmentService;
15 | import net.ccfish.jvue.service._AbstractService;
16 |
17 | /**
18 | * Segment相关
19 | * @author 袁贵
20 | * @version 1.0
21 | * @since 1.0
22 | */
23 | @RestController
24 | @RequestMapping("/api/segment")
25 | @AclResc(id = 5400)
26 | @Api(tags = "画面片段管理")
27 | public class JvueSegmentController implements _BaseController {
28 |
29 | @Autowired
30 | private JvueSegmentService jvueSegmentService;
31 |
32 | /* (non-Javadoc)
33 | * @see com.hxxt.admin.rest._BaseController#baseService()
34 | */
35 | @Override
36 | public _AbstractService baseService() {
37 | return this.jvueSegmentService;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/rest/UserRoleController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.rest;
6 |
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import io.swagger.annotations.Api;
12 | import net.ccfish.common.acl.AclResc;
13 | import net.ccfish.jvue.autogen.model.JvueUserRole;
14 | import net.ccfish.jvue.service.JvueUserRoleService;
15 | import net.ccfish.jvue.service._AbstractService;
16 |
17 | /**
18 | * 用户相关
19 | * @author 袁贵
20 | * @version 1.0
21 | * @since 1.0
22 | */
23 | @RestController
24 | @RequestMapping("/api/user-role")
25 | @AclResc(id = 4100)
26 | @Api(tags = "用户角色管理")
27 | public class UserRoleController implements _BaseController {
28 |
29 | @Autowired
30 | private JvueUserRoleService userRoleService;
31 |
32 | /* (non-Javadoc)
33 | * @see com.hxxt.admin.rest._BaseController#baseService()
34 | */
35 | @Override
36 | public _AbstractService baseService() {
37 | return this.userRoleService;
38 | }
39 |
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/rest/VueController.java:
--------------------------------------------------------------------------------
1 | package net.ccfish.jvue.rest;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.http.MediaType;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.servlet.ModelAndView;
9 |
10 | import net.ccfish.common.acl.CurrentUser;
11 | import net.ccfish.jvue.security.JwtUserDetails;
12 |
13 | @Controller
14 | public class VueController {
15 |
16 | private Logger logger = LoggerFactory.getLogger(getClass());
17 |
18 | @GetMapping(path = { "", "/", "/admin", "/admin/**" }, produces = {MediaType.TEXT_HTML_VALUE})
19 | public ModelAndView home(@CurrentUser JwtUserDetails jwtUser) {
20 | logger.debug("vue home {}", jwtUser);
21 | ModelAndView view = new ModelAndView("/index");
22 | return view;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/rest/_BaseController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2017 BLT, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.rest;
6 |
7 | import java.io.Serializable;
8 | import java.util.List;
9 |
10 | import org.slf4j.Logger;
11 | import org.slf4j.LoggerFactory;
12 | import org.springframework.web.bind.annotation.DeleteMapping;
13 | import org.springframework.web.bind.annotation.GetMapping;
14 | import org.springframework.web.bind.annotation.PathVariable;
15 | import org.springframework.web.bind.annotation.PostMapping;
16 | import org.springframework.web.bind.annotation.PutMapping;
17 | import org.springframework.web.bind.annotation.RequestBody;
18 |
19 | import com.github.pagehelper.Page;
20 |
21 | import io.swagger.annotations.ApiOperation;
22 | import net.ccfish.common.acl.AclResc;
23 | import net.ccfish.common.web.BaseModel;
24 | import net.ccfish.common.web.PageParam;
25 | import net.ccfish.common.web.PagedModel;
26 | import net.ccfish.jvue.service._AbstractService;
27 |
28 | /**
29 | *
30 | * @author 袁贵
31 | * @version 1.0
32 | * @since 1.0
33 | */
34 | public interface _BaseController {
35 |
36 | _AbstractService baseService();
37 |
38 | public static final Logger logger = LoggerFactory.getLogger(_BaseController.class);
39 |
40 | @GetMapping("")
41 | @AclResc(id = 1)
42 | @ApiOperation(value = "列表")
43 | default PagedModel list(PageParam pageParam) {
44 | List result = baseService().getAll(pageParam);
45 | return PagedModel.from((Page)result);
46 | }
47 |
48 | @AclResc(id = 2)
49 | @GetMapping("{id}")
50 | @ApiOperation(value = "详情")
51 | default BaseModel detail(@PathVariable("id") ID id) {
52 | T result = baseService().getOne(id);
53 | logger.debug("detail result: {}", result);
54 | return new BaseModel().setData(result);
55 | }
56 |
57 | @PostMapping("")
58 | @AclResc(id = 3)
59 | @ApiOperation(value = "追加")
60 | default BaseModel add(@RequestBody T data) {
61 | baseService().save(data);
62 | return new BaseModel().setData(data);
63 | }
64 |
65 | @PutMapping("{id}")
66 | @AclResc(id = 4)
67 | @ApiOperation(value = "更新")
68 | default BaseModel update(@PathVariable("id") ID id, @RequestBody T data) {
69 | baseService().update(id, data);
70 | return new BaseModel().setData(id);
71 | }
72 |
73 | @DeleteMapping("{id}")
74 | @AclResc(id = 5)
75 | @ApiOperation(value = "删除")
76 | default BaseModel delete(@PathVariable("id") ID id) {
77 | baseService().delete(id);
78 | return new BaseModel().setData(id);
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/server/jvue-api/src/main/java/net/ccfish/jvue/rest/pub/PubDictController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright © 2013-2019 BaoLaiTong, Co., Ltd. All Rights Reserved.
3 | */
4 |
5 | package net.ccfish.jvue.rest.pub;
6 |
7 | import java.util.LinkedHashMap;
8 | import java.util.Map;
9 |
10 | import org.springframework.web.bind.annotation.GetMapping;
11 | import org.springframework.web.bind.annotation.RequestMapping;
12 | import org.springframework.web.bind.annotation.RestController;
13 |
14 | import net.ccfish.common.enums.YesOrNoEnum;
15 | import net.ccfish.common.web.BaseModel;
16 |
17 | /**
18 | *
19 | * @author 袁贵
20 | * @version 1.0
21 | * @since 1.0
22 | */
23 | @RestController
24 | @RequestMapping("pub")
25 | public class PubDictController {
26 |
27 | @GetMapping("dict/enums")
28 | public BaseModel