第一次提交
commit
7991fe68ab
|
|
@ -0,0 +1,7 @@
|
|||
wms/target/
|
||||
node_modules/
|
||||
wms-vue/node_modules/
|
||||
dist/
|
||||
.idea/
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"axios": "^1.3.4",
|
||||
"element-ui": "^2.9.2",
|
||||
"file-saver": "^2.0.2",
|
||||
"less-loader": "^11.1.0",
|
||||
"node-sass": "^8.0.0",
|
||||
"sass-loader": "^13.0.0",
|
||||
"style-loader": "^3.3.2",
|
||||
"vue-router": "^3.5.4",
|
||||
"vuex": "^3.0.0",
|
||||
"webpack": "^5.76.2",
|
||||
"xlsx": "^0.16.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# wms-vue
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "wms-vue",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^3.8.3",
|
||||
"vue": "^2.7.14",
|
||||
"element-ui": "^2.15.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.16",
|
||||
"@babel/eslint-parser": "^7.12.16",
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-vue": "^8.0.3",
|
||||
"vue-template-compiler": "^2.6.14"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "@babel/eslint-parser"
|
||||
},
|
||||
"rules": {
|
||||
}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<template>
|
||||
<div id="app">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
|
|
@ -0,0 +1,53 @@
|
|||
<template>
|
||||
<el-menu
|
||||
default-active="/home"
|
||||
style="height: 100vh;"
|
||||
class="el-menu-vertical-demo"
|
||||
background-color="#545c64"
|
||||
text-color="#fff"
|
||||
active-text-color="#ffd04b"
|
||||
:collapse="isCollapse"
|
||||
:collapse-transition="false"
|
||||
router
|
||||
>
|
||||
|
||||
<el-submenu index="/home">
|
||||
<template slot="title">
|
||||
<i class="el-icon-s-home"></i>
|
||||
<span slot="title">系统管理</span>
|
||||
</template>
|
||||
<el-menu-item index="/main">用户管理</el-menu-item>
|
||||
</el-submenu>
|
||||
|
||||
|
||||
<el-menu-item :index="'/'+item.menuClick" v-for="(item,i) in menu" :key="i">
|
||||
<i :class="item.menuIcon"> </i>
|
||||
<span slot="title">{{item.menuName}}</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Aside",
|
||||
data(){
|
||||
return{
|
||||
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
"menu":{
|
||||
get(){
|
||||
return this.$store.state.menu
|
||||
}
|
||||
}
|
||||
},
|
||||
props:{
|
||||
isCollapse:Boolean
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<template>
|
||||
<div style="display: flex;line-height: 60px;">
|
||||
<div style="margin-top: 8px;">
|
||||
<i :class="icon" style="font-size: 20px;cursor: pointer" @click="collapse"></i>
|
||||
</div>
|
||||
<div style="flex:1px;text-align: center;font-size: 34px;">
|
||||
<span>友仓WMS管理平台</span>
|
||||
</div>
|
||||
<el-dropdown>
|
||||
<span>{{ user.userName }}</span>
|
||||
<i class="el-icon-arrow-down" style="margin-left: 5px;"></i>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item @click.native="toUser">个人中心</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="logOut">退出登录</el-dropdown-item>
|
||||
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Header",
|
||||
data() {
|
||||
return {
|
||||
user: JSON.parse(sessionStorage.getItem('user'))
|
||||
}
|
||||
},
|
||||
props: {
|
||||
icon: String
|
||||
},
|
||||
methods: {
|
||||
toUser() {
|
||||
this.$router.push('/home')
|
||||
},
|
||||
logOut() {
|
||||
this.$confirm('您确认是否退出登录?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$router.replace('/login')
|
||||
sessionStorage.clear();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '已退出!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消操作'
|
||||
});
|
||||
});
|
||||
},
|
||||
collapse() {
|
||||
this.$emit('doCollapse')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$router.push('/home')
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<template>
|
||||
<el-descriptions class="margin-top" title="用户信息" :column="3" :size="size" border>
|
||||
<template slot="extra">
|
||||
<el-button type="primary" size="small">操作</el-button>
|
||||
</template>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-user"></i>
|
||||
用户名
|
||||
</template>
|
||||
{{ user.userName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-mobile-phone"></i>
|
||||
手机号
|
||||
</template>
|
||||
{{ user.phone }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-location-outline"></i>
|
||||
居住地
|
||||
</template>
|
||||
苏州市
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-tickets"></i>
|
||||
角色
|
||||
</template>
|
||||
<el-tag size="small">
|
||||
{{ user.roleId === 0 ? '超级管理员' : (user.roleId === 1 ? '管理员' : '用户') }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-office-building"></i>
|
||||
联系地址
|
||||
</template>
|
||||
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Home",
|
||||
data () {
|
||||
return {
|
||||
user: JSON.parse(sessionStorage.getItem('user')),
|
||||
size:''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<template>
|
||||
<el-container style="height: 100%; border: 1px solid #eee">
|
||||
<el-aside :width="aside_width" style="background-color: rgb(238, 241, 246);margin-left: -1px;">
|
||||
<Aside :isCollapse="isCollapse"></Aside>
|
||||
</el-aside>
|
||||
|
||||
<el-container style="height: 100%">
|
||||
<el-header style="text-align: right; font-size: 12px; height: 100%;border-bottom: rgba(168,168,168,0.3) 1px solid;">
|
||||
<Header @doCollapse="doCollapse" :icon="icon"></Header>
|
||||
</el-header>
|
||||
|
||||
<el-main style="height: 100%">
|
||||
<!-- <Main></Main>-->
|
||||
<router-view/>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Aside from "@/components/Aside.vue";
|
||||
import Header from "@/components/Header.vue";
|
||||
|
||||
export default {
|
||||
name: "Index",
|
||||
components: {Header, Aside},
|
||||
data(){
|
||||
return{
|
||||
isCollapse:false,
|
||||
aside_width:'200px',
|
||||
icon:'el-icon-s-fold',
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
doCollapse(){
|
||||
this.isCollapse=!this.isCollapse
|
||||
//如果展开
|
||||
if(!this.isCollapse){
|
||||
this.aside_width='200px';
|
||||
this.icon='el-icon-s-fold';
|
||||
}else{
|
||||
this.aside_width='64px';
|
||||
this.icon='el-icon-s-unfold';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style >
|
||||
/*.el-header {
|
||||
|
||||
color: #333;
|
||||
line-height: 60px;
|
||||
}
|
||||
|
||||
.el-aside {
|
||||
color: #333;
|
||||
}*/
|
||||
</style>
|
||||
|
|
@ -0,0 +1,264 @@
|
|||
<template>
|
||||
<div class="loginDiv">
|
||||
<div class="login-box">
|
||||
<h2>智能仓储WMS</h2>
|
||||
<form>
|
||||
|
||||
<div class="user-box">
|
||||
<input type="text" name="" required="" v-model="ruleForm.userNo" @keyup.enter="login"/>
|
||||
<label>账号</label>
|
||||
</div>
|
||||
<div class="user-box">
|
||||
<input type="password" name="" required="" v-model="ruleForm.passWord" @keyup.enter="login"/>
|
||||
<label>密码</label>
|
||||
</div>
|
||||
|
||||
<a href="javascript:"
|
||||
@click="login"
|
||||
>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
登录
|
||||
</a>
|
||||
|
||||
<a>注册 </a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "login",
|
||||
data() {
|
||||
return {
|
||||
ruleForm: {
|
||||
userNo: '',
|
||||
passWord: '',
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
login() {
|
||||
if (this.ruleForm.userNo == null || this.ruleForm.userNo.length <= 0) {
|
||||
this.$message({
|
||||
message: '请输入账号',
|
||||
type: 'error'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.ruleForm.passWord == null || this.ruleForm.passWord.length <= 0) {
|
||||
this.$message({
|
||||
message: '请输入密码',
|
||||
type: 'error'
|
||||
});
|
||||
return;
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在加载',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
this.$axios.post(this.$httpUrl + '/user/login', this.ruleForm).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
//存储
|
||||
sessionStorage.setItem("user", JSON.stringify(res.data.user))
|
||||
console.log(res.data.menu)
|
||||
this.$store.commit("setMenu",res.data.menu)
|
||||
//跳转页面
|
||||
this.$router.push('/index')
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log(err);
|
||||
})
|
||||
setTimeout(() => {
|
||||
loading.close();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.loginDiv {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background-image: url('~@/assets/login.jpeg');
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
background-size: 100% 100%;
|
||||
image-rendering: -webkit-crisp-edges;
|
||||
}
|
||||
|
||||
|
||||
.login-box {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 400px;
|
||||
padding: 40px;
|
||||
transform: translate(-50%, -50%);
|
||||
background: rgba(0, 0, 0, .5);
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 15px 25px rgba(0, 0, 0, .6);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.login-box h2 {
|
||||
margin: 0 0 30px;
|
||||
padding: 0;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login-box .user-box {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.login-box .user-box input {
|
||||
width: 100%;
|
||||
padding: 10px 0;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
margin-bottom: 30px;
|
||||
border: none;
|
||||
border-bottom: 1px solid #fff;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.login-box .user-box label {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding: 10px 0;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
pointer-events: none;
|
||||
transition: .5s;
|
||||
}
|
||||
|
||||
.login-box .user-box input:focus ~ label,
|
||||
.login-box .user-box input:valid ~ label {
|
||||
top: -20px;
|
||||
left: 0;
|
||||
color: #03e9f4;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.login-box form a {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 10px 20px;
|
||||
color: #03e9f4;
|
||||
font-size: 16px;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
overflow: hidden;
|
||||
transition: .5s;
|
||||
margin-top: 40px;
|
||||
letter-spacing: 4px
|
||||
}
|
||||
|
||||
.login-box a:hover {
|
||||
background: #03e9f4;
|
||||
color: #fff;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 5px #03e9f4,
|
||||
0 0 25px #03e9f4,
|
||||
0 0 50px #03e9f4,
|
||||
0 0 100px #03e9f4;
|
||||
}
|
||||
|
||||
.login-box a span {
|
||||
position: absolute;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.login-box a span:nth-child(1) {
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, #03e9f4);
|
||||
animation: btn-anim1 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes btn-anim1 {
|
||||
0% {
|
||||
left: -100%;
|
||||
}
|
||||
50%, 100% {
|
||||
left: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.login-box a span:nth-child(2) {
|
||||
top: -100%;
|
||||
right: 0;
|
||||
width: 2px;
|
||||
height: 100%;
|
||||
background: linear-gradient(180deg, transparent, #03e9f4);
|
||||
animation: btn-anim2 1s linear infinite;
|
||||
animation-delay: .25s
|
||||
}
|
||||
|
||||
@keyframes btn-anim2 {
|
||||
0% {
|
||||
top: -100%;
|
||||
}
|
||||
50%, 100% {
|
||||
top: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.login-box a span:nth-child(3) {
|
||||
bottom: 0;
|
||||
right: -100%;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: linear-gradient(270deg, transparent, #03e9f4);
|
||||
animation: btn-anim3 1s linear infinite;
|
||||
animation-delay: .5s
|
||||
}
|
||||
|
||||
@keyframes btn-anim3 {
|
||||
0% {
|
||||
right: -100%;
|
||||
}
|
||||
50%, 100% {
|
||||
right: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.login-box a span:nth-child(4) {
|
||||
bottom: -100%;
|
||||
left: 0;
|
||||
width: 2px;
|
||||
height: 100%;
|
||||
background: linear-gradient(360deg, transparent, #03e9f4);
|
||||
animation: btn-anim4 1s linear infinite;
|
||||
animation-delay: .75s
|
||||
}
|
||||
|
||||
@keyframes btn-anim4 {
|
||||
0% {
|
||||
bottom: -100%;
|
||||
}
|
||||
50%, 100% {
|
||||
bottom: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,470 @@
|
|||
<template>
|
||||
<div class="div1">
|
||||
|
||||
<div class="div2" style="padding-bottom: 10px">
|
||||
<div style="float: right">
|
||||
<el-select v-model="xb" clearable filterable placeholder="请选择性别" style="width: 100px">
|
||||
<el-option
|
||||
v-for="item in xbs"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-input v-model="name"
|
||||
placeholder="请输入姓名"
|
||||
style="width: 200px;margin-left: 5px"
|
||||
|
||||
class="input-with-select"
|
||||
@keyup.enter.native="queryUser">
|
||||
|
||||
<el-button class="el-input-group__prepend" slot="append" icon="el-icon-search" @click="queryUser"></el-button>
|
||||
</el-input>
|
||||
|
||||
<el-button type="success" icon="el-icon-refresh-left" style="margin-left: 5px;" @click="rest">重置</el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="div3" style="">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="add">新增</el-button>
|
||||
<el-button type="success" icon="el-icon-edit" @click="mod">编辑</el-button>
|
||||
<el-button type="danger" icon="el-icon-delete" @click="del">删除</el-button>
|
||||
<el-button type="warning" icon="el-icon-download" @click="exportExcel">导出</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<el-dialog :title="title"
|
||||
:visible.sync="centerDialogVisible"
|
||||
width="30%"
|
||||
:before-close="handleClose"
|
||||
center>
|
||||
<el-form ref="form"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="80px">
|
||||
|
||||
<el-form-item label="账号" prop="userNo">
|
||||
<el-input v-model="form.userNo" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="姓名" prop="userName">
|
||||
<el-input v-model="form.userName" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="年龄" prop="age">
|
||||
<el-input v-model.number="form.age" style="width: 300px;" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="性别">
|
||||
<el-radio-group v-model="form.sex">
|
||||
<el-radio label='1'>男</el-radio>
|
||||
<el-radio label='0'>女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="电话" prop="phone">
|
||||
<el-input v-model="form.phone" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelDialog">取 消</el-button>
|
||||
<el-button type="primary" @click="addUser">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<el-table
|
||||
:header-cell-style="{background:'#000',color:'#fff'}"
|
||||
:data="tableData"
|
||||
id="educe-table"
|
||||
ref="tableData"
|
||||
@selection-change="handleSelectionChange"
|
||||
@select="selectionRow"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed
|
||||
label="序号"
|
||||
v-if="false"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.id }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed
|
||||
label="账号"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-popover trigger="hover" placement="top">
|
||||
<p>账号: {{ scope.row.userNo }}</p>
|
||||
<p>电话: {{ scope.row.phone }}</p>
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag size="medium">{{ scope.row.userNo }}</el-tag>
|
||||
</div>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="姓名"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<span>{{ scope.row.userName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="年龄"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<span>{{ scope.row.age }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="电话"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<span>{{ scope.row.phone }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="性别"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag size="medium" :type="scope.row.sex ===0 ? 'primary' : 'success'">
|
||||
{{ scope.row.sex === 0 ? '女' : '男' }}
|
||||
</el-tag>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="角色"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag size="medium"
|
||||
:type="scope.row.roleId ===0 ? 'danger' : (scope.row.roleId ===1 ? 'primary':'success') ">
|
||||
{{ scope.row.roleId === 0 ? '超级管理员' : (scope.row.roleId === 1 ? '管理员' : '用户') }}
|
||||
</el-tag>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
label="操作"
|
||||
width="100">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button
|
||||
size="small"
|
||||
@click="handleEdit(scope.$index, scope.row)">编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="handleDelete(scope.$index, scope.row)">删除
|
||||
</el-button>-->
|
||||
<el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
|
||||
<el-button type="text" size="small" @click="editUser(scope.row)">编辑</el-button>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="pageNum"
|
||||
:page-sizes="[10, 50, 150, 200]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
import {outFile} from "@/util/excel.vue";
|
||||
|
||||
export default {
|
||||
name: "Main",
|
||||
data() {
|
||||
//验证账号
|
||||
let checkuserNo = (rule, value, callback) => {
|
||||
let id=0;
|
||||
if(this.form.id>0){
|
||||
id=this.form.id;
|
||||
}
|
||||
this.$axios.get(this.$httpUrl + '/user/queryuserNo?id='+id+'&userNo='+ this.form.userNo).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
callback(new Error(this.form.userNo + '账号已存在!'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log(err);
|
||||
})
|
||||
|
||||
|
||||
};
|
||||
return {
|
||||
tableData: [],
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
total: 3,
|
||||
name: '',
|
||||
xb: '',
|
||||
zh:'',
|
||||
xbs: [
|
||||
{
|
||||
value: '1',
|
||||
label: '男'
|
||||
},
|
||||
{
|
||||
value: '0',
|
||||
label: '女'
|
||||
}
|
||||
],
|
||||
form: {
|
||||
id: '',
|
||||
userNo: '',
|
||||
userName: '',
|
||||
passWord:'123456',
|
||||
age: '',
|
||||
sex: '1',
|
||||
phone: '',
|
||||
roleId: '2'
|
||||
},
|
||||
rules: {
|
||||
userNo: [
|
||||
{required: true, message: '请输入账号', trigger: 'blur'},
|
||||
{ validator: checkuserNo, trigger: 'blur' }
|
||||
],
|
||||
userName: [
|
||||
{required: true, message: '请输入姓名', trigger: 'blur'},
|
||||
],
|
||||
age: [
|
||||
{required: true, message: '年龄不能为空'},
|
||||
{type: 'number', message: '年龄必须为数字值'}
|
||||
]
|
||||
},
|
||||
multipleSelection:[],
|
||||
centerDialogVisible: false,
|
||||
title:''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleEdit(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`);
|
||||
this.pageNum = 1;
|
||||
this.pageSize = val;
|
||||
this.queryUser();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`);
|
||||
this.pageNum = val;
|
||||
this.queryUser();
|
||||
},
|
||||
queryUser() {
|
||||
//列表数据加载
|
||||
this.$axios.post(this.$httpUrl + '/user/queryUser', {
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
param: {
|
||||
name: this.name,
|
||||
xb: this.xb
|
||||
}
|
||||
}).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
this.tableData = res.data
|
||||
this.total = res.total
|
||||
} else {
|
||||
this.$message.error('获取数据失败');
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log(err);
|
||||
})
|
||||
},
|
||||
rest() {
|
||||
//表单重置
|
||||
this.name = '',
|
||||
this.xb = ''
|
||||
},
|
||||
add() {
|
||||
//点击新增按弹窗
|
||||
this.title="新增用户"
|
||||
this.centerDialogVisible = true;
|
||||
//重置表单信息
|
||||
this.$nextTick(() => {
|
||||
this.resetForm()
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs["form"].resetFields();
|
||||
this.$data.form=JSON.parse(JSON.stringify(this.$options.data().form))
|
||||
},
|
||||
handleClose(){
|
||||
//关闭对话框
|
||||
this.centerDialogVisible=false;
|
||||
this.form.sex='1';
|
||||
},
|
||||
cancelDialog(){
|
||||
//取消对话框
|
||||
this.centerDialogVisible=false;
|
||||
this.resetForm();
|
||||
this.form.sex='1';
|
||||
this.$refs.tableData.clearSelection()
|
||||
},
|
||||
addUser() {
|
||||
//新增用户
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
|
||||
this.$axios.post(this.$httpUrl + '/user/addorupdate', this.form).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success'
|
||||
});
|
||||
this.centerDialogVisible = false;//退出新增窗体
|
||||
this.queryUser();//刷新列表
|
||||
this.resetForm();
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log(err);
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
editUser(row){
|
||||
//编辑
|
||||
this.title="编辑用户"
|
||||
this.centerDialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.form=JSON.parse(JSON.stringify(row));
|
||||
this.form.sex=row.sex+''
|
||||
this.$refs.tableData.toggleRowSelection(row, true);//编辑时勾选
|
||||
})
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
let planIdList = [];
|
||||
for (let item of this.multipleSelection) {
|
||||
planIdList.push(item.id);
|
||||
}
|
||||
console.log(planIdList);
|
||||
},
|
||||
selectionRow(selection,row){
|
||||
|
||||
},
|
||||
mod(){
|
||||
//编辑
|
||||
if(this.$refs.tableData.selection.length==1){
|
||||
this.title="编辑用户"
|
||||
this.centerDialogVisible = true;
|
||||
for (let item of this.multipleSelection) {
|
||||
this.form=JSON.parse(JSON.stringify(item));
|
||||
this.form.sex=item.sex+''
|
||||
}
|
||||
}else{
|
||||
this.$message.error('请选中一条记录!');
|
||||
}
|
||||
},
|
||||
del(){
|
||||
//删除
|
||||
if(this.$refs.tableData.selection.length==0){
|
||||
this.$message.error('请至少选中一条记录!');
|
||||
}else{
|
||||
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let ids=[];
|
||||
for (let item of this.multipleSelection) {
|
||||
ids.push(item.id)
|
||||
}
|
||||
this.$axios.get(this.$httpUrl + '/user/deleteUser?ids='+ids.toString()).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success'
|
||||
});
|
||||
this.queryUser()//刷新数据
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log(err);
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
exportExcel(){
|
||||
this.fixs = false
|
||||
this.$nextTick(() => {
|
||||
outFile('educe-table', '(用户)')
|
||||
this.fixs = true
|
||||
})
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
this.queryUser();
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<template>
|
||||
<span>admin</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "admin"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<template>
|
||||
<span>user</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "user"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import ElementUI from 'element-ui';
|
||||
import 'element-ui/lib/theme-chalk/index.css';
|
||||
import './assets/global.css';
|
||||
import axios from "axios";
|
||||
import VueRouter from "vue-router";
|
||||
import router from "@/router/router";
|
||||
import store from "@/store/store";
|
||||
Vue.prototype.$axios=axios;
|
||||
Vue.prototype.$httpUrl='http://localhost:8081';
|
||||
Vue.config.productionTip = false;
|
||||
Vue.use(VueRouter)
|
||||
Vue.use(ElementUI,{size:'small'});
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: h => h(App),
|
||||
}).$mount('#app')
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
import VueRouter from "vue-router";
|
||||
|
||||
const routes=[
|
||||
{
|
||||
path:'/login',
|
||||
name:'login',
|
||||
component: () => import('../components/Login')
|
||||
},
|
||||
{
|
||||
path:'/index',
|
||||
name:'index',
|
||||
component: () => import('../components/Index'),
|
||||
children:[
|
||||
{
|
||||
path:'/home',
|
||||
name:'home',
|
||||
meta:{
|
||||
title:'首页'
|
||||
},
|
||||
component: () => import('../components/Home')
|
||||
},
|
||||
{
|
||||
path:'/admin',
|
||||
name:'admin',
|
||||
meta:{
|
||||
title:'超级管理员'
|
||||
},
|
||||
component: () => import('../components/admin/Admin')
|
||||
},
|
||||
{
|
||||
path:'/user',
|
||||
name:'user',
|
||||
meta:{
|
||||
title:'用户'
|
||||
},
|
||||
component: () => import('../components/user/User')
|
||||
},
|
||||
{
|
||||
path:'/admin',
|
||||
name:'admin',
|
||||
meta:{
|
||||
title:'管理员'
|
||||
},
|
||||
component: () => import('../components/admin/Admin')
|
||||
},
|
||||
{
|
||||
path:'/main',
|
||||
name:'main',
|
||||
meta:{
|
||||
title:'用户管理'
|
||||
},
|
||||
component: () => import('../components/Main')
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
const route=new VueRouter({
|
||||
mode:'history',
|
||||
routes
|
||||
})
|
||||
const VueRouterPush = VueRouter.prototype.push
|
||||
VueRouter.prototype.push = function push (to) {
|
||||
return VueRouterPush.call(this, to).catch(err => err)
|
||||
}
|
||||
|
||||
export default route;
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
vue.use(Vuex)
|
||||
export default new Vuex.Store({
|
||||
state:{
|
||||
menu:[]
|
||||
},
|
||||
mutations:{
|
||||
setMenu(state,menuList){
|
||||
state.menu=menuList
|
||||
}
|
||||
},
|
||||
getters:{
|
||||
getMenu(state){
|
||||
return state.menu
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FileSaver from 'file-saver'
|
||||
import XLSX from 'xlsx'
|
||||
|
||||
export default {
|
||||
|
||||
}
|
||||
// 定义导出Excel表格事件
|
||||
export function outFile(id, fileName) {
|
||||
|
||||
let fix = document.querySelector('.el-table__fixed');
|
||||
let wb;
|
||||
if(fix){ //判断要导出的节点中是否有fixed的表格,如果有,转换excel时先将该dom移除,然后append回去
|
||||
wb = XLSX.utils.table_to_book(document.querySelector('#' + id).removeChild(fix));
|
||||
document.querySelector('#' + id).appendChild(fix);
|
||||
}else{
|
||||
wb = XLSX.utils.table_to_book(document.querySelector('#' + id));
|
||||
}
|
||||
let wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
|
||||
try {
|
||||
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), fileName + '.xlsx')
|
||||
} catch (e) {
|
||||
if (typeof console !== 'undefined') console.log(e, wbout)
|
||||
}
|
||||
return wbout
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
const { defineConfig } = require('@vue/cli-service')
|
||||
module.exports = defineConfig({
|
||||
transpileDependencies: true,
|
||||
lintOnSave: false
|
||||
})
|
||||
Binary file not shown.
|
|
@ -0,0 +1,18 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.6.6</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.yc</groupId>
|
||||
<artifactId>wms</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>wms</name>
|
||||
<description>wms</description>
|
||||
<properties>
|
||||
<java.version>8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>8.0.32</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>3.4.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.spring4all</groupId>
|
||||
<artifactId>spring-boot-starter-swagger</artifactId>
|
||||
<version>1.5.1.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>3.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.yc.wms;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class WmsApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WmsApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.yc.wms.controller;
|
||||
|
||||
|
||||
import com.yc.wms.model.Menu;
|
||||
import com.yc.wms.service.MenuService;
|
||||
import com.yc.wms.until.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-07-07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/menu")
|
||||
public class MenuController {
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
/**
|
||||
* 查询菜单
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryMenu")
|
||||
public Result queryMenu(@RequestParam String roleId) {
|
||||
List list=menuService.lambdaQuery().like(Menu::getMenuRight,roleId).list();
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
package com.yc.wms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yc.wms.model.Menu;
|
||||
import com.yc.wms.model.User;
|
||||
import com.yc.wms.service.MenuService;
|
||||
import com.yc.wms.service.UserService;
|
||||
import com.yc.wms.until.QueryPageUtil;
|
||||
import com.yc.wms.until.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-03-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
/**
|
||||
* @return
|
||||
* 登录
|
||||
*/
|
||||
@PostMapping ("/login")
|
||||
public Result login(@RequestBody User user) {
|
||||
Result result = null;
|
||||
List<User> list= userService.lambdaQuery()
|
||||
.eq(User::getUserNo,user.getUserNo())
|
||||
.eq(User::getPassWord,user.getPassWord()).list();
|
||||
if(list.size()>0){
|
||||
List menulist=menuService.lambdaQuery().like(Menu::getMenuRight,list.get(0).getRoleId().toString()).list();
|
||||
HashMap map =new HashMap();
|
||||
map.put("user",list.get(0));
|
||||
map.put("menu",menulist);
|
||||
result=Result.success(map);
|
||||
}else{
|
||||
result=Result.fail("账号或密码输入有误!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @param查询用户
|
||||
*/
|
||||
@PostMapping("/queryUser")
|
||||
public Result queryUser(@RequestBody QueryPageUtil query) {
|
||||
HashMap map = query.getParam();
|
||||
String name = (String) map.get("name");
|
||||
String sex = (String) map.get("xb");
|
||||
Page<User> page = new Page<User>();
|
||||
page.setCurrent(query.getPageNum());
|
||||
page.setSize(query.getPageSize());
|
||||
System.out.println("当前页:" + query.getPageNum());
|
||||
System.out.println("条数:" + query.getPageSize());
|
||||
LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
if (name != null && name.length() > 0) {
|
||||
lambdaQueryWrapper.like(User::getUserName, name);
|
||||
}
|
||||
if (sex != null && sex.length() > 0) {
|
||||
lambdaQueryWrapper.like(User::getSex, sex);
|
||||
}
|
||||
IPage iPage = userService.QueryUser(page, lambdaQueryWrapper);
|
||||
|
||||
System.out.println(iPage.getTotal());
|
||||
System.out.println(iPage.getRecords());
|
||||
return Result.success(iPage.getTotal(), iPage.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @param新增或修改
|
||||
*/
|
||||
@PostMapping("/addorupdate")
|
||||
public Result addorupdate(@RequestBody User user) {
|
||||
Result results = null;
|
||||
boolean result = userService.saveOrUpdate(user);
|
||||
if (result) {
|
||||
results = Result.success();
|
||||
} else {
|
||||
results = Result.fail();
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @param删除用户
|
||||
*/
|
||||
@GetMapping("/deleteUser")
|
||||
public Result deleteUser(String ids) {
|
||||
Result result = null;
|
||||
if (ids != null && ids.length() > 0) {
|
||||
List<String> uersIds = Arrays.asList(ids.split(","));
|
||||
for (String id : uersIds) {
|
||||
userService.removeById(Integer.parseInt(id));
|
||||
}
|
||||
result = Result.success();
|
||||
} else {
|
||||
result = Result.fail("参数为null");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @param判断账号是否存在
|
||||
*/
|
||||
@GetMapping("/queryuserNo")
|
||||
public Result queryuserNo(@RequestParam String userNo, @RequestParam long id) {
|
||||
Result result = null;
|
||||
if (id > 0) {
|
||||
List<User> list = userService.lambdaQuery().eq(User::getUserNo, userNo).list();
|
||||
if (list.size() > 0) {
|
||||
if (list.get(0).getId() == id && list.get(0).getUserNo().equals(userNo)) {
|
||||
result = Result.fail();
|
||||
} else {
|
||||
result = Result.success(list);
|
||||
}
|
||||
} else {
|
||||
result = Result.fail();
|
||||
}
|
||||
} else {
|
||||
List list = userService.lambdaQuery().eq(User::getUserNo, userNo).list();
|
||||
if (list.size() > 0) {
|
||||
result = Result.success(list);
|
||||
} else {
|
||||
result = Result.fail();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.yc.wms.mapper;
|
||||
|
||||
import com.yc.wms.model.Menu;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-07-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface MenuMapper extends BaseMapper<Menu> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.yc.wms.mapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.yc.wms.model.User;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-03-04
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
List<User> Base_Column_List();
|
||||
|
||||
IPage QueryUser(IPage<User> page, @Param(Constants.WRAPPER) Wrapper wrapper);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.yc.wms.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-07-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="Menu对象", description="")
|
||||
public class Menu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "菜单编码")
|
||||
@TableField("menuCode")
|
||||
private String menuCode;
|
||||
|
||||
@ApiModelProperty(value = "菜单名称")
|
||||
@TableField("menuName")
|
||||
private String menuName;
|
||||
|
||||
@ApiModelProperty(value = "菜单级别")
|
||||
@TableField("menuLevel")
|
||||
private String menuLevel;
|
||||
|
||||
@ApiModelProperty(value = "菜单的父编号")
|
||||
@TableField("menuParentCode")
|
||||
private String menuParentCode;
|
||||
|
||||
@ApiModelProperty(value = "点击的触发的函数")
|
||||
@TableField("menuClick")
|
||||
private String menuClick;
|
||||
|
||||
@ApiModelProperty(value = "权限 0 超级管理员,1 管理员,2 用户 可以用逗号组合使用")
|
||||
@TableField("menuRight")
|
||||
private String menuRight;
|
||||
|
||||
@TableField("menuComponent")
|
||||
private String menuComponent;
|
||||
|
||||
@ApiModelProperty(value = "图标")
|
||||
@TableField("menuIcon")
|
||||
private String menuIcon;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.yc.wms.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-03-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="User对象", description="")
|
||||
public class User implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(type=IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@TableField("userNo")
|
||||
private String userNo;
|
||||
|
||||
@TableField("userName")
|
||||
private String userName;
|
||||
|
||||
@TableField("passWord")
|
||||
private String passWord;
|
||||
|
||||
private Integer age;
|
||||
|
||||
private Integer sex;
|
||||
|
||||
private String phone;
|
||||
|
||||
@TableField("roleId")
|
||||
private Integer roleId;
|
||||
|
||||
@TableField("isValid")
|
||||
private Boolean isValid=false;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.yc.wms.service;
|
||||
|
||||
import com.yc.wms.model.Menu;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-07-07
|
||||
*/
|
||||
public interface MenuService extends IService<Menu> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.yc.wms.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.yc.wms.model.User;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-03-04
|
||||
*/
|
||||
public interface UserService extends IService<User> {
|
||||
|
||||
public List<User> Base_Column_List();
|
||||
|
||||
public IPage QueryUser(IPage<User> page, Wrapper wrapper);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.yc.wms.service.impl;
|
||||
|
||||
import com.yc.wms.model.Menu;
|
||||
import com.yc.wms.mapper.MenuMapper;
|
||||
import com.yc.wms.service.MenuService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-07-07
|
||||
*/
|
||||
@Service
|
||||
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.yc.wms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.yc.wms.model.User;
|
||||
import com.yc.wms.mapper.UserMapper;
|
||||
import com.yc.wms.service.UserService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wms
|
||||
* @since 2023-03-04
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
|
||||
|
||||
@Autowired
|
||||
private UserMapper UserMapper;
|
||||
|
||||
@Override
|
||||
public List<User> Base_Column_List() {
|
||||
return UserMapper.Base_Column_List();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage QueryUser(IPage<User> page, Wrapper wrapper) {
|
||||
return UserMapper.QueryUser(page,wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
package com.yc.wms.until;
|
||||
|
||||
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class CodeGenerator {
|
||||
/**
|
||||
* <p>
|
||||
* 读取控制台内容
|
||||
* </p>
|
||||
*/
|
||||
public static String scanner(String tip) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
StringBuilder help = new StringBuilder();
|
||||
help.append("请输入" + tip + ":");
|
||||
System.out.println(help.toString());
|
||||
if (scanner.hasNext()) {
|
||||
String ipt = scanner.next();
|
||||
if (StringUtils.isNotBlank(ipt)) {
|
||||
return ipt;
|
||||
}
|
||||
}
|
||||
throw new MybatisPlusException("请输入正确的" + tip + "!");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
String projectPath = System.getProperty("user.dir")+"/wms";
|
||||
gc.setOutputDir(projectPath + "/src/main/java");
|
||||
gc.setAuthor("wms");
|
||||
gc.setOpen(false);
|
||||
gc.setSwagger2(true);
|
||||
gc.setBaseResultMap(true);
|
||||
gc.setBaseColumnList(true);
|
||||
gc.setServiceName("%sService");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl("jdbc:mysql://47.100.54.81:53306/wms?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=false&useOldAliasMetadataBehavior=true&autoReconnect=true&failOverReadOnly=false");
|
||||
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
|
||||
dsc.setUsername("root");
|
||||
dsc.setPassword("Youchain@56");
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
|
||||
pc.setParent("com.yc.wms")
|
||||
.setEntity("model")
|
||||
.setMapper("mapper")
|
||||
.setService("service")
|
||||
.setServiceImpl("service.impl")
|
||||
.setController("controller");
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 自定义配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
// to do nothing
|
||||
}
|
||||
};
|
||||
|
||||
// 如果模板引擎是 freemarker
|
||||
String templatePath = "/templates/mapper.xml.ftl";
|
||||
// 如果模板引擎是 velocity
|
||||
// String templatePath = "/templates/mapper.xml.vm";
|
||||
|
||||
// 自定义输出配置
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
// 自定义配置会被优先输出
|
||||
focList.add(new FileOutConfig(templatePath) {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
|
||||
return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
|
||||
+ "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
|
||||
}
|
||||
});
|
||||
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
|
||||
// 配置模板
|
||||
TemplateConfig templateConfig = new TemplateConfig();
|
||||
|
||||
// 配置自定义输出模板
|
||||
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
|
||||
// templateConfig.setEntity("templates/entity2.java");
|
||||
// templateConfig.setService();
|
||||
// templateConfig.setController();
|
||||
|
||||
templateConfig.setXml(null);
|
||||
mpg.setTemplate(templateConfig);
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
|
||||
//strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
|
||||
strategy.setEntityLombokModel(true);
|
||||
strategy.setRestControllerStyle(true);
|
||||
// 公共父类
|
||||
//strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
|
||||
// 写于父类中的公共字段
|
||||
//strategy.setSuperEntityColumns("id");
|
||||
strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
//strategy.setTablePrefix(pc.getModuleName() + "_");
|
||||
mpg.setStrategy(strategy);
|
||||
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.yc.wms.until;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class CorsConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
//是否发送Cookie
|
||||
.allowCredentials(true)
|
||||
//放行哪些原始域
|
||||
.allowedOriginPatterns("*")
|
||||
.allowedMethods(new String[]{"GET", "POST", "PUT", "DELETE"})
|
||||
.allowedHeaders("*")
|
||||
.exposedHeaders("*");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.yc.wms.until;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@MapperScan("com.yc.wms.mapper")
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.yc.wms.until;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Data
|
||||
public class QueryPageUtil {
|
||||
private static int PAGE_SIZE=20;
|
||||
private static int PAGE_NUM=1;
|
||||
|
||||
private int pageSize=PAGE_SIZE;
|
||||
private int pageNum=PAGE_NUM;
|
||||
|
||||
private HashMap param=new HashMap();
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.yc.wms.until;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Result {
|
||||
private int code;//编码
|
||||
private String msg;//内容
|
||||
private long total;//总记录数
|
||||
private Object data;//数据
|
||||
|
||||
|
||||
public static Result fail(){
|
||||
return result(400,"操作失败!",0,null);
|
||||
}
|
||||
|
||||
public static Result fail(String msg){
|
||||
return result(400,msg,0,null);
|
||||
}
|
||||
|
||||
public static Result success(){
|
||||
return result(200,"操作成功!",0,null);
|
||||
}
|
||||
|
||||
public static Result success(Object data){
|
||||
return result(200,"操作成功!",0,data);
|
||||
}
|
||||
|
||||
public static Result success(String msg,Object data){
|
||||
return result(200,msg,0,data);
|
||||
}
|
||||
|
||||
public static Result success(long total,Object data){
|
||||
return result(200,"操作成功!",total,data);
|
||||
}
|
||||
|
||||
public static Result result(int code,String msg,long total,Object data){
|
||||
Result rs=new Result();
|
||||
rs.setCode(code);
|
||||
rs.setMsg(msg);
|
||||
rs.setTotal(total);
|
||||
rs.setData(data);
|
||||
return rs;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
server:
|
||||
port: 8081
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://47.100.54.81:53306/wms?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=false&useOldAliasMetadataBehavior=true&autoReconnect=true&failOverReadOnly=false
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password: Youchain@56
|
||||
hikari:
|
||||
connection-timeout: 60000
|
||||
validation-timeout: 3000
|
||||
idle-timeout: 60000
|
||||
login-timeout: 5
|
||||
max-lifetime: 60000
|
||||
maximum-pool-size: 10
|
||||
minimum-idle: 10
|
||||
read-only: false
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yc.wms.mapper.MenuMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.yc.wms.model.Menu">
|
||||
<id column="id" property="id" />
|
||||
<result column="menuCode" property="menuCode" />
|
||||
<result column="menuName" property="menuName" />
|
||||
<result column="menuLevel" property="menuLevel" />
|
||||
<result column="menuParentCode" property="menuParentCode" />
|
||||
<result column="menuClick" property="menuClick" />
|
||||
<result column="menuRight" property="menuRight" />
|
||||
<result column="menuComponent" property="menuComponent" />
|
||||
<result column="menuIcon" property="menuIcon" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, menuCode, menuName, menuLevel, menuParentCode, menuClick, menuRight, menuComponent, menuIcon
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yc.wms.mapper.UserMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.yc.wms.model.User">
|
||||
<id column="id" property="id" />
|
||||
<result column="userNo" property="userNo" />
|
||||
<result column="userName" property="userName" />
|
||||
<result column="passWord" property="passWord" />
|
||||
<result column="age" property="age" />
|
||||
<result column="sex" property="sex" />
|
||||
<result column="phone" property="phone" />
|
||||
<result column="roleId" property="roleId" />
|
||||
<result column="isValid" property="isValid" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<select id="Base_Column_List" resultMap="BaseResultMap">
|
||||
select * from user
|
||||
</select>
|
||||
|
||||
<select id="QueryUser" resultType="com.yc.wms.model.User">
|
||||
select * from user ${ew.customSqlSegment} order by id desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.yc.wms;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class WmsApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
||||
Loading…
Reference in New Issue