试一下
This commit is contained in:
parent
93e373040f
commit
fc5e5fa66b
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"name": "vue3",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite --host 0.0.0.0",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"lint": "eslint . --fix"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@element-plus/icons-vue": "^2.3.2",
|
||||||
|
"@vueup/vue-quill": "1.2.0",
|
||||||
|
"axios": "^1.12.2",
|
||||||
|
"echarts": "^6.0.0",
|
||||||
|
"element-plus": "^2.11.3",
|
||||||
|
"js-cookie": "^3.0.5",
|
||||||
|
"moment": "^2.30.1",
|
||||||
|
"vue": "^3.5.21",
|
||||||
|
"vue-router": "^4.5.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.36.0",
|
||||||
|
"@vitejs/plugin-vue": "^6.0.1",
|
||||||
|
"eslint": "^9.36.0",
|
||||||
|
"eslint-plugin-vue": "^10.5.0",
|
||||||
|
"npm-check-updates": "^18.3.0",
|
||||||
|
"vite": "^7.1.7",
|
||||||
|
"vite-plugin-vue-devtools": "^8.0.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
import axios from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询博物馆简介列表
|
||||||
|
export function listMuseumIntro(query) {
|
||||||
|
return axios.get('/museumIntro/list',{
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询全部博物馆简介列表
|
||||||
|
export function listAllMuseumIntro(query) {
|
||||||
|
return axios.get('/museumIntro/listAll', {
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询博物馆简介详细
|
||||||
|
export function getMuseumIntro(museumName) {
|
||||||
|
return axios.get('/museumIntro/info/' + museumName)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增博物馆简介
|
||||||
|
export function addMuseumIntro(data) {
|
||||||
|
return axios.post('/museumIntro/add', {
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改博物馆简介
|
||||||
|
export function updateMuseumIntro(data) {
|
||||||
|
return axios.put('/museumIntro', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除博物馆简介
|
||||||
|
export function delMuseumIntro(museumName) {
|
||||||
|
return axios.delete('/museumIntro/' + museumName)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
import axios from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询藏品列表
|
||||||
|
export function listRelic(query) {
|
||||||
|
return axios.get('/relic/list',{
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询全部藏品列表
|
||||||
|
export function listAllRelic(query) {
|
||||||
|
return axios.get('/relic/listAll', {
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询藏品详细
|
||||||
|
export function getRelic(id) {
|
||||||
|
return axios.get('/relic/info/' + id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增藏品
|
||||||
|
export function addRelic(data) {
|
||||||
|
return axios.post('/relic/add', {
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改藏品
|
||||||
|
export function updateRelic(data) {
|
||||||
|
return axios.put('/relic', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除藏品
|
||||||
|
export function delRelic(id) {
|
||||||
|
return axios.delete('/relic/' + id)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
import axios from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询预约列表
|
||||||
|
export function listReservation(query) {
|
||||||
|
return axios.get('/reservation/list',{
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询全部预约列表
|
||||||
|
export function listAllReservation(query) {
|
||||||
|
return axios.get('/reservation/listAll', {
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询预约详细
|
||||||
|
export function getReservation(id) {
|
||||||
|
return axios.get('/reservation/info/' + id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增预约
|
||||||
|
export function addReservation(data) {
|
||||||
|
return axios.post('/reservation/add', {
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改预约
|
||||||
|
export function updateReservation(data) {
|
||||||
|
return axios.put('/reservation', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 审核预约
|
||||||
|
export function auditReservation(data) {
|
||||||
|
return axios.put('/reservation/audit', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除预约
|
||||||
|
export function delReservation(id) {
|
||||||
|
return axios.delete('/reservation/' + id)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
import axios from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询预约时段列表
|
||||||
|
export function listReservationTimeSlot(query) {
|
||||||
|
return axios.get('/reservationTimeSlot/list',{
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询全部预约时段列表
|
||||||
|
export function listAllReservationTimeSlot(query) {
|
||||||
|
return axios.get('/reservationTimeSlot/listAll', {
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询当天及往后7天的预约时段信息
|
||||||
|
export function listNext7Days() {
|
||||||
|
return axios.get('/reservationTimeSlot/listNext7Days')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询预约时段详细
|
||||||
|
export function getReservationTimeSlot(id) {
|
||||||
|
return axios.get('/reservationTimeSlot/info/' + id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增预约时段
|
||||||
|
export function addReservationTimeSlot(data) {
|
||||||
|
return axios.post('/reservationTimeSlot/add', {
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量新增预约时段(根据日期范围)
|
||||||
|
export function batchAddReservationTimeSlot(data) {
|
||||||
|
return axios.post('/reservationTimeSlot/batchAdd', {
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改预约时段
|
||||||
|
export function updateReservationTimeSlot(data) {
|
||||||
|
return axios.put('/reservationTimeSlot', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除预约时段
|
||||||
|
export function delReservationTimeSlot(id) {
|
||||||
|
return axios.delete('/reservationTimeSlot/' + id)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
import axios from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询游客预约明细列表
|
||||||
|
export function listReservationVisitor(query) {
|
||||||
|
return axios.get('/reservationVisitor/list',{
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询全部游客预约明细列表
|
||||||
|
export function listAllReservationVisitor(query) {
|
||||||
|
return axios.get('/reservationVisitor/listAll', {
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询游客预约明细详细
|
||||||
|
export function getReservationVisitor(id) {
|
||||||
|
return axios.get('/reservationVisitor/info/' + id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增游客预约明细
|
||||||
|
export function addReservationVisitor(data) {
|
||||||
|
return axios.post('/reservationVisitor/add', {
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改游客预约明细
|
||||||
|
export function updateReservationVisitor(data) {
|
||||||
|
return axios.put('/reservationVisitor', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除游客预约明细
|
||||||
|
export function delReservationVisitor(id) {
|
||||||
|
return axios.delete('/reservationVisitor/' + id)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 获取当前用户
|
||||||
|
export function getCurrentSysUser() {
|
||||||
|
return request({
|
||||||
|
url: '/sysUser/getCurrentSysUser',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改知识
|
||||||
|
export function updateSysUser(data) {
|
||||||
|
return request.put('/sysUser', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改密码方法
|
||||||
|
export function updatePwd(data) {
|
||||||
|
return request({
|
||||||
|
url: '/sysUser/updatePwd',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询用户列表
|
||||||
|
export function listSysUser(query) {
|
||||||
|
return request({
|
||||||
|
url: '/sysUser/list',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询全部用户列表
|
||||||
|
export function listAllSysUser(query) {
|
||||||
|
return request({
|
||||||
|
url: '/sysUser/listAll',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询用户详细
|
||||||
|
export function getSysUser(id) {
|
||||||
|
return request({
|
||||||
|
url: '/sysUser/info/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增用户
|
||||||
|
export function addSysUser(data) {
|
||||||
|
return request({
|
||||||
|
url: '/sysUser/add',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除用户
|
||||||
|
export function delSysUser(id) {
|
||||||
|
return request({
|
||||||
|
url: '/sysUser/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function registerTourist(data) {
|
||||||
|
return request({
|
||||||
|
url: '/sysUser/register',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
import axios from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询普通用户子列表
|
||||||
|
export function listTourist(query) {
|
||||||
|
return axios.get('/tourist/list',{
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询全部普通用户子列表
|
||||||
|
export function listAllTourist(query) {
|
||||||
|
return axios.get('/tourist/listAll', {
|
||||||
|
params: {
|
||||||
|
...query
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询普通用户子详细
|
||||||
|
export function getTourist(id) {
|
||||||
|
return axios.get('/tourist/info/' + id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增普通用户子
|
||||||
|
export function addTourist(data) {
|
||||||
|
return axios.post('/tourist/add', {
|
||||||
|
...data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改普通用户子
|
||||||
|
export function updateTourist(data) {
|
||||||
|
return axios.put('/tourist', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除普通用户子
|
||||||
|
export function delTourist(id) {
|
||||||
|
return axios.delete('/tourist/' + id)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
|
||||||
|
After Width: | Height: | Size: 276 B |
|
|
@ -0,0 +1,3 @@
|
||||||
|
@import './base.css';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { createApp } from 'vue'
|
||||||
|
import App from './App.vue'
|
||||||
|
import router from './router'
|
||||||
|
import '@/assets/main.css'
|
||||||
|
import ElementPlus from 'element-plus'
|
||||||
|
import 'element-plus/dist/index.css'
|
||||||
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
|
||||||
|
import locale from 'element-plus/es/locale/lang/zh-cn';
|
||||||
|
import './assets/css/apple-input.css'
|
||||||
|
|
||||||
|
import { parseTime } from './utils/common'
|
||||||
|
|
||||||
|
const app = createApp(App)
|
||||||
|
|
||||||
|
// 全局属性挂载
|
||||||
|
app.config.globalProperties.parseTime = parseTime
|
||||||
|
app.config.globalProperties.getFilePrefix = "/api/files/get?fileName="
|
||||||
|
|
||||||
|
// 注册图标全局组件
|
||||||
|
Object.keys(ElementPlusIconsVue).forEach((key) => {
|
||||||
|
app.component(key, ElementPlusIconsVue[key]);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use(router)
|
||||||
|
app.use(ElementPlus, {locale})
|
||||||
|
|
||||||
|
app.mount('#app')
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
import axios from 'axios'
|
||||||
|
import { tansParams } from './common'
|
||||||
|
import router from '@/router'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { getToken, removeToken} from './token'
|
||||||
|
|
||||||
|
|
||||||
|
// 创建axios实例
|
||||||
|
const service = axios.create({
|
||||||
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||||
|
baseURL: "/api",
|
||||||
|
// 超时
|
||||||
|
timeout: 60000
|
||||||
|
})
|
||||||
|
|
||||||
|
service.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||||
|
|
||||||
|
// 请求拦截器
|
||||||
|
service.interceptors.request.use(
|
||||||
|
config => {
|
||||||
|
// 是否需要设置 token
|
||||||
|
const isToken = (config.headers || {}).isToken === false
|
||||||
|
// 每次发送请求之前判断是否存在token
|
||||||
|
// 如果存在,则统一在http请求的header都加上token,这样后台根据token判断你的登录状态,进而判断是否有权限访问
|
||||||
|
if (getToken() && !isToken) {
|
||||||
|
config.headers['Authorization'] = getToken()
|
||||||
|
}
|
||||||
|
|
||||||
|
// get请求映射params参数
|
||||||
|
if (config.method === 'get' && config.params) {
|
||||||
|
let url = config.url + '?' + tansParams(config.params);
|
||||||
|
url = url.slice(0, -1);
|
||||||
|
config.params = {};
|
||||||
|
config.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
// post和put请求
|
||||||
|
if (config.method === 'post' || config.method === 'put') {
|
||||||
|
config.data = JSON.stringify(config.data)
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 响应拦截器
|
||||||
|
service.interceptors.response.use(
|
||||||
|
response => {
|
||||||
|
const res = response.data
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
|
if (res.code !== 200) {
|
||||||
|
if (res.code === 401) {
|
||||||
|
ElMessage.error("登录失效,请重新登录!")
|
||||||
|
removeToken(); // 删除本地token
|
||||||
|
router.push("/login")
|
||||||
|
return Promise.reject(new Error(res.message || 'Error'))
|
||||||
|
} else if (res.code === 403) {
|
||||||
|
ElMessage.error('无权访问!')
|
||||||
|
return Promise.reject(new Error(res.message || 'Error'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.log('err' + error) // for debug
|
||||||
|
if (error.status == 403) {
|
||||||
|
ElMessage.error('无权访问!')
|
||||||
|
} else {
|
||||||
|
ElMessage.error('服务异常!')
|
||||||
|
}
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export default service
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import Cookies from 'js-cookie'
|
||||||
|
|
||||||
|
const TokenKey = 'Admin-Token'
|
||||||
|
|
||||||
|
export function getToken() {
|
||||||
|
return Cookies.get(TokenKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setToken(token) {
|
||||||
|
return Cookies.set(TokenKey, token)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeToken() {
|
||||||
|
return Cookies.remove(TokenKey)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,397 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="账号" prop="username">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.username"
|
||||||
|
placeholder="请输入账号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="昵称" prop="nickname">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.nickname"
|
||||||
|
placeholder="请输入昵称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="角色" prop="role">
|
||||||
|
<el-select v-model="queryParams.role" placeholder="请选择角色" clearable style="width: 160px">
|
||||||
|
<el-option label="超级管理员" value="1" />
|
||||||
|
<el-option label="普通用户" value="2" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="userList">
|
||||||
|
<el-table-column label="账号" align="center" prop="username" />
|
||||||
|
<el-table-column label="昵称" align="center" prop="nickname" />
|
||||||
|
<el-table-column label="头像" align="center" prop="avatar">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-image
|
||||||
|
v-if="scope.row.avatar"
|
||||||
|
:src="getFilePrefix + scope.row.avatar"
|
||||||
|
:preview-src-list="[getFilePrefix + scope.row.avatar]"
|
||||||
|
preview-teleported
|
||||||
|
fit="cover"
|
||||||
|
style="width: 40px; height: 40px; border-radius: 50%; cursor: zoom-in"
|
||||||
|
/>
|
||||||
|
<span v-else>—</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="角色" align="center" prop="role">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag v-if="scope.row.role === '1'" type="danger">超级管理员</el-tag>
|
||||||
|
<el-tag v-else type="info">普通用户</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag v-if="scope.row.status === 0" type="success">正常</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.status === 1" type="warning">停用</el-tag>
|
||||||
|
<el-tag v-else type="info">待审核</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
v-if="scope.row.status === 0"
|
||||||
|
@click="toggleStatus(scope.row, 1)"
|
||||||
|
icon="CloseBold"
|
||||||
|
>停用</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
v-if="scope.row.status !== 0"
|
||||||
|
@click="toggleStatus(scope.row, 0)"
|
||||||
|
icon="CircleCheck"
|
||||||
|
>启用</el-button>
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
:current-page="queryParams.pageNum"
|
||||||
|
:page-sizes="[10, 20, 30, 50]"
|
||||||
|
:page-size="queryParams.pageSize"
|
||||||
|
layout="->, total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="total">
|
||||||
|
</el-pagination>
|
||||||
|
|
||||||
|
<el-dialog :title="title" v-model="open" width="650px" append-to-body :close-on-click-modal="false">
|
||||||
|
<el-form ref="userRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="账号" prop="username">
|
||||||
|
<el-input v-model="form.username" placeholder="请输入账号" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="昵称" prop="nickname">
|
||||||
|
<el-input v-model="form.nickname" placeholder="请输入昵称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="密码" prop="password" v-if="isAdd">
|
||||||
|
<el-input v-model="form.password" placeholder="请输入密码" type="password" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="角色" prop="role">
|
||||||
|
<el-select v-model="form.role" placeholder="请选择角色" style="width: 100%">
|
||||||
|
<el-option label="超级管理员" value="1" />
|
||||||
|
<el-option label="普通用户" value="2" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="form.status" placeholder="请选择状态" style="width: 100%">
|
||||||
|
<el-option label="正常" :value="0" />
|
||||||
|
<el-option label="停用" :value="1" />
|
||||||
|
<el-option label="待审核" :value="2" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="头像" prop="avatar">
|
||||||
|
<el-upload
|
||||||
|
action="/api/files/upload"
|
||||||
|
:headers="headers"
|
||||||
|
name="file"
|
||||||
|
:data="{filePath: 'avatar'}"
|
||||||
|
list-type="picture-card"
|
||||||
|
:file-list="avatarFileList"
|
||||||
|
:limit="1"
|
||||||
|
:on-success="handleAvatarSuccess"
|
||||||
|
:on-remove="handleAvatarRemove"
|
||||||
|
:on-exceed="handleAvatarExceed"
|
||||||
|
:before-upload="beforeAvatarUpload"
|
||||||
|
accept="image/*"
|
||||||
|
>
|
||||||
|
<el-icon><Plus /></el-icon>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="AdminUser">
|
||||||
|
import { ref, reactive, toRefs, getCurrentInstance } from 'vue';
|
||||||
|
import { listSysUser, getSysUser, addSysUser, updateSysUser, delSysUser } from "@/api/sysUser";
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
|
const userList = ref([]);
|
||||||
|
const open = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref([]);
|
||||||
|
const total = ref(0);
|
||||||
|
const title = ref("");
|
||||||
|
const headers = {};
|
||||||
|
|
||||||
|
const isAdd = ref(false)
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
username: null,
|
||||||
|
nickname: null,
|
||||||
|
role: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
username: [
|
||||||
|
{ required: true, message: "账号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
nickname: [
|
||||||
|
{ required: true, message: "昵称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
{ required: true, message: "密码不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
role: [
|
||||||
|
{ required: true, message: "角色不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
const avatarFileList = ref([]);
|
||||||
|
const getFilePrefix = proxy.getFilePrefix;
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
loading.value = true;
|
||||||
|
listSysUser(queryParams.value).then(response => {
|
||||||
|
userList.value = response.list;
|
||||||
|
total.value = response.total;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSizeChange(val) {
|
||||||
|
queryParams.value.pageSize = val;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCurrentChange(val) {
|
||||||
|
queryParams.value.pageNum = val;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
username: null,
|
||||||
|
nickname: null,
|
||||||
|
avatar: null,
|
||||||
|
password: null,
|
||||||
|
status: 0,
|
||||||
|
role: '2',
|
||||||
|
remark: null
|
||||||
|
};
|
||||||
|
const userRef = proxy.$refs["userRef"]
|
||||||
|
if (userRef) {
|
||||||
|
userRef.resetFields();
|
||||||
|
}
|
||||||
|
avatarFileList.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetQuery() {
|
||||||
|
const queryRef = proxy.$refs["queryRef"]
|
||||||
|
if (queryRef) {
|
||||||
|
queryRef.resetFields();
|
||||||
|
}
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
reset();
|
||||||
|
open.value = true;
|
||||||
|
title.value = "添加用户";
|
||||||
|
isAdd.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset();
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
getSysUser(_id).then(response => {
|
||||||
|
form.value = response.data;
|
||||||
|
open.value = true;
|
||||||
|
title.value = "修改用户";
|
||||||
|
isAdd.value = false;
|
||||||
|
avatarFileList.value = form.value.avatar ? [{ name: '头像', url: getFilePrefix + form.value.avatar }] : [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["userRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (isAdd.value) { // 添加
|
||||||
|
addSysUser(form.value).then(response => {
|
||||||
|
proxy.$message({
|
||||||
|
message: response.msg,
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
} else { // 更新
|
||||||
|
const payload = { ...form.value };
|
||||||
|
payload.password = undefined;
|
||||||
|
updateSysUser(payload).then(response => {
|
||||||
|
proxy.$message({
|
||||||
|
message: response.msg,
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDelete(row) {
|
||||||
|
proxy.$confirm('是否确认删除用户编号为"' + row.id + '"的数据项?').then(function() {
|
||||||
|
return delSysUser(row.id);
|
||||||
|
}).then(response => {
|
||||||
|
getList();
|
||||||
|
proxy.$message({
|
||||||
|
message: response.msg,
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleStatus(row, nextVal) {
|
||||||
|
const text = nextVal === 1 ? '是否要停用该用户?' : '是否要启用该用户?';
|
||||||
|
proxy.$confirm(text).then(function() {
|
||||||
|
return updateSysUser({ id: row.id, status: nextVal });
|
||||||
|
}).then(response => {
|
||||||
|
getList();
|
||||||
|
proxy.$message({
|
||||||
|
message: response.msg,
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAvatarSuccess(res, file, fileList) {
|
||||||
|
form.value.avatar = res;
|
||||||
|
avatarFileList.value = [{ name: file.name, url: getFilePrefix + form.value.avatar }];
|
||||||
|
const userRef = proxy.$refs["userRef"];
|
||||||
|
if (userRef) {
|
||||||
|
userRef.validateField('avatar');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAvatarRemove() {
|
||||||
|
form.value.avatar = null;
|
||||||
|
avatarFileList.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAvatarExceed(files, fileList) {
|
||||||
|
proxy.$message({
|
||||||
|
message: '只允许上传一张头像',
|
||||||
|
type: 'warning'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeAvatarUpload(file) {
|
||||||
|
const ok = file.size / 1024 / 1024 <= 5;
|
||||||
|
if (!ok) {
|
||||||
|
proxy.$message({
|
||||||
|
message: '图片大小不能超过5MB',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
getList();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.mb8 {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.el-upload--picture-card {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
.el-upload-list__item {
|
||||||
|
width: 100px !important;
|
||||||
|
height: 100px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,159 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card class="userInfoCard">
|
||||||
|
<h2 style="text-align: center">个人信息</h2>
|
||||||
|
<br>
|
||||||
|
<div class="avatar-div">
|
||||||
|
<el-upload
|
||||||
|
action="/api/files/upload"
|
||||||
|
:show-file-list="false"
|
||||||
|
:headers="headers"
|
||||||
|
name="file"
|
||||||
|
:data="{filePath: 'avatar'}"
|
||||||
|
:on-success="handleAvatarSuccess"
|
||||||
|
:before-upload="beforeAvatarUpload">
|
||||||
|
<div
|
||||||
|
class="avatar-uploader">
|
||||||
|
<img v-if="sysUser.avatar" :src="getFilePrefix + sysUser.avatar" style="width: 100%;"/>
|
||||||
|
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||||
|
</div>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
<el-descriptions
|
||||||
|
class="margin-top"
|
||||||
|
:column="1"
|
||||||
|
border
|
||||||
|
>
|
||||||
|
<el-descriptions-item label="用户账号">
|
||||||
|
<el-input v-model="sysUser.username" disabled/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="用户昵称">
|
||||||
|
<el-input v-model="sysUser.nickname" />
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="用户角色">
|
||||||
|
<el-tag v-if="sysUser.role === '1'" type="danger">超级管理员</el-tag>
|
||||||
|
<el-tag v-else type="info">普通用户</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="帐号状态">
|
||||||
|
<el-tag v-if="sysUser.status === 0" type="success">正常</el-tag>
|
||||||
|
<el-tag v-else-if="sysUser.status === 1" type="warning">停用</el-tag>
|
||||||
|
<el-tag v-else type="info">待审核</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注">
|
||||||
|
<el-input v-model="sysUser.remark" type="textarea" />
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<br>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<el-button type="primary" @click="updateSysUserInfo">更新个人信息</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, getCurrentInstance } from 'vue';
|
||||||
|
|
||||||
|
import { getCurrentSysUser, updateSysUser } from '@/api/sysUser';
|
||||||
|
import { getToken } from '@/utils/token';
|
||||||
|
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
|
const sysUser = ref({})
|
||||||
|
|
||||||
|
// 请求头信息
|
||||||
|
const headers = ref({
|
||||||
|
Authorization: getToken()
|
||||||
|
})
|
||||||
|
|
||||||
|
const getFilePrefix = proxy.getFilePrefix;
|
||||||
|
|
||||||
|
// 获取当前登录用户详情
|
||||||
|
function getCurrentSysUserInfo() {
|
||||||
|
getCurrentSysUser().then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
sysUser.value = res.data
|
||||||
|
} else {
|
||||||
|
proxy.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 头像上传成功后
|
||||||
|
function handleAvatarSuccess(response, uploadFile, uploadFiles) {
|
||||||
|
sysUser.value.avatar = response
|
||||||
|
Cookies.set('avatar', response)
|
||||||
|
updateSysUser(sysUser.value).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$message.success('头像更新成功')
|
||||||
|
} else {
|
||||||
|
proxy.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeAvatarUpload(file) {
|
||||||
|
const ok = file.size / 1024 / 1024 <= 5;
|
||||||
|
if (!ok) {
|
||||||
|
proxy.$message({
|
||||||
|
message: '图片大小不能超过5MB',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新个人信息
|
||||||
|
function updateSysUserInfo() {
|
||||||
|
updateSysUser(sysUser.value).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$message.success('个人信息更新成功')
|
||||||
|
} else {
|
||||||
|
proxy.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDate(val) {
|
||||||
|
if (!val) return '';
|
||||||
|
const d = new Date(val);
|
||||||
|
const yyyy = d.getFullYear();
|
||||||
|
const MM = String(d.getMonth() + 1).padStart(2, '0');
|
||||||
|
const DD = String(d.getDate()).padStart(2, '0');
|
||||||
|
const HH = String(d.getHours()).padStart(2, '0');
|
||||||
|
const mm = String(d.getMinutes()).padStart(2, '0');
|
||||||
|
const ss = String(d.getSeconds()).padStart(2, '0');
|
||||||
|
return `${yyyy}-${MM}-${DD} ${HH}:${mm}:${ss}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCurrentSysUserInfo()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.userInfoCard {
|
||||||
|
width: 500px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-div {
|
||||||
|
margin: 20px auto;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
line-height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-uploader {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
display:flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,288 @@
|
||||||
|
<template>
|
||||||
|
<div class="main">
|
||||||
|
<el-card class="login_box">
|
||||||
|
<div class="register-title">注册</div>
|
||||||
|
<br>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="formRules">
|
||||||
|
<!-- 头像 -->
|
||||||
|
<div class="avatar-div">
|
||||||
|
<el-upload
|
||||||
|
action="/api/files/upload"
|
||||||
|
:show-file-list="false"
|
||||||
|
name="file"
|
||||||
|
:data="{filePath: 'avatar'}"
|
||||||
|
:on-success="handleAvatarSuccess">
|
||||||
|
<div
|
||||||
|
class="avatar-uploader">
|
||||||
|
<img v-if="form.avatar" :src="getFilePrefix + form.avatar" style="max-width: 100%; max-height: 100%;"/>
|
||||||
|
|
||||||
|
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<el-form-item prop="username">
|
||||||
|
<el-input
|
||||||
|
type="text"
|
||||||
|
v-model="form.username"
|
||||||
|
placeholder="用户名"
|
||||||
|
style="width: 100%"
|
||||||
|
class="apple-input"
|
||||||
|
@keyup.enter="handleRegister()">
|
||||||
|
<template #prefix>
|
||||||
|
<el-icon><User /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item prop="password">
|
||||||
|
<el-input
|
||||||
|
class="apple-input"
|
||||||
|
type="password"
|
||||||
|
v-model="form.password"
|
||||||
|
placeholder="密码"
|
||||||
|
style="width: 100%"
|
||||||
|
@keyup.enter="handleRegister()">
|
||||||
|
<template #prefix>
|
||||||
|
<el-icon><Lock /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="nickname">
|
||||||
|
<el-input
|
||||||
|
type="text"
|
||||||
|
class="apple-input"
|
||||||
|
v-model="form.nickname"
|
||||||
|
placeholder="昵称"
|
||||||
|
style="width: 100%"
|
||||||
|
@keyup.enter="handleRegister()">
|
||||||
|
<template #prefix>
|
||||||
|
<el-icon><InfoFilled /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="tourist.realName">
|
||||||
|
<el-input
|
||||||
|
type="text"
|
||||||
|
class="apple-input"
|
||||||
|
v-model="form.tourist.realName"
|
||||||
|
placeholder="真实姓名"
|
||||||
|
style="width: 100%"
|
||||||
|
@keyup.enter="handleRegister()">
|
||||||
|
<template #prefix>
|
||||||
|
<el-icon><InfoFilled /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="tourist.idCard">
|
||||||
|
<el-input
|
||||||
|
type="text"
|
||||||
|
class="apple-input"
|
||||||
|
v-model="form.tourist.idCard"
|
||||||
|
placeholder="身份证号"
|
||||||
|
style="width: 100%"
|
||||||
|
@keyup.enter="handleRegister()">
|
||||||
|
<template #prefix>
|
||||||
|
<el-icon><Folder /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="tourist.phone">
|
||||||
|
<el-input
|
||||||
|
type="text"
|
||||||
|
class="apple-input"
|
||||||
|
v-model="form.tourist.phone"
|
||||||
|
placeholder="手机号"
|
||||||
|
style="width: 100%"
|
||||||
|
@keyup.enter="handleRegister()">
|
||||||
|
<template #prefix>
|
||||||
|
<el-icon><Iphone /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="tourist.email">
|
||||||
|
<el-input
|
||||||
|
type="text"
|
||||||
|
class="apple-input"
|
||||||
|
v-model="form.tourist.email"
|
||||||
|
placeholder="邮箱"
|
||||||
|
style="width: 100%"
|
||||||
|
@keyup.enter="handleRegister()">
|
||||||
|
<template #prefix>
|
||||||
|
<el-icon><Folder /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
class="login_btn"
|
||||||
|
type="success"
|
||||||
|
style="width: 100%"
|
||||||
|
@click="handleRegister()" >
|
||||||
|
注册
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
class="login_btn"
|
||||||
|
style="width: 100%"
|
||||||
|
link
|
||||||
|
@click="jumpLogin()" >
|
||||||
|
返回
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, getCurrentInstance } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
import { registerTourist } from '@/api/sysUser';
|
||||||
|
import { setToken } from '@/utils/token';
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
const getFilePrefix = proxy.getFilePrefix;
|
||||||
|
|
||||||
|
const formRef = ref();
|
||||||
|
|
||||||
|
// 使用 useRouter 创建一个 router 实例
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
id: null,
|
||||||
|
username: null,
|
||||||
|
nickname: null,
|
||||||
|
avatar: null,
|
||||||
|
password: null,
|
||||||
|
role: '2',
|
||||||
|
status: 0,
|
||||||
|
tourist: {
|
||||||
|
realName: null,
|
||||||
|
idCard: null,
|
||||||
|
phone: null,
|
||||||
|
email: null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const formRules = {
|
||||||
|
username: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
|
||||||
|
password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
|
||||||
|
nickname: [{ required: true, message: "昵称不能为空", trigger: "blur" }],
|
||||||
|
'tourist.realName': [{ required: true, message: "真实姓名不能为空", trigger: "blur" }],
|
||||||
|
'tourist.idCard': [{ required: true, message: "身份证号不能为空", trigger: "blur" }],
|
||||||
|
'tourist.phone': [{ required: true, message: "手机号不能为空", trigger: "blur" }],
|
||||||
|
'tourist.email': [{ required: true, message: "邮箱不能为空", trigger: "blur" }]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleRegister = () => {
|
||||||
|
formRef.value.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
registerTourist(form).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$message.success('注册成功,请登录')
|
||||||
|
router.push('/login')
|
||||||
|
} else {
|
||||||
|
proxy.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('验证失败')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function jumpLogin() {
|
||||||
|
proxy.$router.push('/login')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上传成功后
|
||||||
|
function handleAvatarSuccess(response, uploadFile, uploadFiles) {
|
||||||
|
form.avatar = response
|
||||||
|
proxy.$message.success('头像上传成功')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.main {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-image: url("@/assets/login-back.jpg");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
padding-right: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login_box{
|
||||||
|
width: 420px;
|
||||||
|
text-align: center;
|
||||||
|
/* 毛玻璃 */
|
||||||
|
/*
|
||||||
|
background: rgba(255, 255, 255, 0.6);
|
||||||
|
backdrop-filter: blur(20px);
|
||||||
|
border-radius: 15px;*/
|
||||||
|
/* 液态玻璃*/
|
||||||
|
/*
|
||||||
|
background: rgba(255, 255, 255, 0.25);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
-webkit-backdrop-filter: blur(10px);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.18);
|
||||||
|
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
|
||||||
|
border-radius: 15px;
|
||||||
|
*/
|
||||||
|
background: rgba(255, 255, 255, 0.25);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
-webkit-backdrop-filter: blur(10px);
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.4);
|
||||||
|
box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.2);
|
||||||
|
padding: 18px 18px 10px;
|
||||||
|
}
|
||||||
|
.login_box:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 12px 36px 0 rgba(31, 38, 135, 0.2);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.register-title { font-size: 24px; font-weight: 800; color: #1f1f1f; letter-spacing: 2px; }
|
||||||
|
:deep(.el-form-item) { margin-bottom: 12px; }
|
||||||
|
|
||||||
|
/* 头像上传样式 */
|
||||||
|
.avatar-div {
|
||||||
|
margin: 0 auto 18px;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid #BEBEBE;
|
||||||
|
line-height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-uploader {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
display:flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,304 @@
|
||||||
|
<template>
|
||||||
|
<div class="reserve-container">
|
||||||
|
<div class="intro">请选择参观日期与时段(可预约明日起7天内,含今日展示但不可预约)</div>
|
||||||
|
<div class="date-bar">
|
||||||
|
<div
|
||||||
|
class="date-chip"
|
||||||
|
v-for="d in dateRange"
|
||||||
|
:key="d.key"
|
||||||
|
:class="[{ active: d.key === selectedDateKey }, { disabled: d.isToday }]"
|
||||||
|
@click="!d.isToday && (selectedDateKey = d.key)"
|
||||||
|
>
|
||||||
|
<div class="d1">{{ d.label }}</div>
|
||||||
|
<div class="d2">{{ d.dateStr }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="slot-panel" v-loading="loading">
|
||||||
|
<div class="slot-empty" v-if="!slotsByDate[selectedDateKey] || slotsByDate[selectedDateKey].length === 0">暂无时段</div>
|
||||||
|
<div class="slot-grid" v-else>
|
||||||
|
<div class="slot-card" v-for="tp in timePoints[selectedDateKey]" :key="tp.key" :class="{ disabled: tp.disabled }">
|
||||||
|
<div class="slot-time">{{ tp.label }}</div>
|
||||||
|
<div class="slot-actions">
|
||||||
|
<el-button type="primary" size="large" :disabled="tp.disabled" @click="openReserve(tp)">预约</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog v-model="dialogOpen" title="添加游客信息" width="600px" append-to-body>
|
||||||
|
<el-form ref="visitorFormRef" :model="visitorForm">
|
||||||
|
<div class="visitor-list">
|
||||||
|
<div class="visitor-item" v-for="(v,idx) in visitorForm.visitors" :key="idx">
|
||||||
|
<div class="visitor-index">{{ idx + 1 }}</div>
|
||||||
|
<div class="visitor-fields">
|
||||||
|
<el-form-item :prop="'visitors.' + idx + '.realName'" :rules="[
|
||||||
|
{ required: true, message: '请输入姓名', trigger: 'blur' },
|
||||||
|
{ min: 1, max: 30, message: '长度1-30', trigger: 'blur' }
|
||||||
|
]">
|
||||||
|
<el-input v-model="v.realName" placeholder="姓名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :prop="'visitors.' + idx + '.idCard'" :rules="[
|
||||||
|
{ required: true, message: '请输入身份证号', trigger: 'blur' },
|
||||||
|
{ pattern: /^[1-9]\d{16}[\dXx]$/, message: '身份证号须18位,最后一位可为X', trigger: 'blur' }
|
||||||
|
]">
|
||||||
|
<el-input v-model="v.idCard" placeholder="身份证号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :prop="'visitors.' + idx + '.phone'" :rules="[
|
||||||
|
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||||
|
{ pattern: /^1\d{10}$/, message: '手机号须11位数字且以1开头', trigger: 'blur' }
|
||||||
|
]">
|
||||||
|
<el-input v-model="v.phone" placeholder="手机号" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="visitor-remove">
|
||||||
|
<el-button type="danger" plain @click="removeVisitor(idx)">删除</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="visitor-actions">
|
||||||
|
<el-button type="primary" plain @click="addVisitor">添加预约人</el-button>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitReserve">提 交</el-button>
|
||||||
|
<el-button @click="dialogOpen=false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted, reactive, getCurrentInstance } from 'vue'
|
||||||
|
import { listNext7Days } from '@/api/reservationTimeSlot'
|
||||||
|
import { addReservation } from '@/api/reservation'
|
||||||
|
import { getCurrentSysUser } from '@/api/sysUser'
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const dateRange = ref([])
|
||||||
|
const selectedDateKey = ref('')
|
||||||
|
const slotsByDate = ref({})
|
||||||
|
const timePoints = ref({})
|
||||||
|
const dialogOpen = ref(false)
|
||||||
|
const visitorFormRef = ref()
|
||||||
|
const visitorForm = reactive({ visitors: [{ realName: '', idCard: '', phone: '' }] })
|
||||||
|
const selectedTp = ref(null)
|
||||||
|
const currentUserId = ref(null)
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
function genDateRange() {
|
||||||
|
const today = new Date()
|
||||||
|
const arr = []
|
||||||
|
for (let i = 0; i <= 7; i++) {
|
||||||
|
const d = new Date(today)
|
||||||
|
d.setDate(today.getDate() + i)
|
||||||
|
const yyyy = d.getFullYear()
|
||||||
|
const MM = String(d.getMonth() + 1).padStart(2, '0')
|
||||||
|
const DD = String(d.getDate()).padStart(2, '0')
|
||||||
|
const key = `${yyyy}-${MM}-${DD}`
|
||||||
|
const weekday = ['日','一','二','三','四','五','六'][d.getDay()]
|
||||||
|
arr.push({ key, label: i === 0 ? '今天' : `周${weekday}`, dateStr: `${MM}-${DD}`, isToday: i === 0 })
|
||||||
|
}
|
||||||
|
dateRange.value = arr
|
||||||
|
selectedDateKey.value = arr[1]?.key || arr[0]?.key
|
||||||
|
}
|
||||||
|
|
||||||
|
function groupSlots(list) {
|
||||||
|
const map = {}
|
||||||
|
list.forEach(s => {
|
||||||
|
const d = normalizeDate(s)
|
||||||
|
if (!d) return
|
||||||
|
if (!map[d]) map[d] = []
|
||||||
|
map[d].push(s)
|
||||||
|
})
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildTimePoints() {
|
||||||
|
const res = {}
|
||||||
|
Object.keys(slotsByDate.value || {}).forEach(d => {
|
||||||
|
const arr = []
|
||||||
|
;(slotsByDate.value[d] || []).forEach(s => {
|
||||||
|
const pts = genHalfHourPoints(s)
|
||||||
|
const full = Number(s.currentPeople || 0) >= Number(s.maxPeople || 0)
|
||||||
|
const disabledBase = Number(s.status) !== 1 || full
|
||||||
|
pts.forEach(t => arr.push({ key: `${d}-${t}`, label: t, slotId: s.id, date: d, disabled: disabledBase }))
|
||||||
|
})
|
||||||
|
res[d] = arr
|
||||||
|
})
|
||||||
|
timePoints.value = res
|
||||||
|
}
|
||||||
|
|
||||||
|
function genHalfHourPoints(s) {
|
||||||
|
const start = parseToDateTime(s.date, s.startTime)
|
||||||
|
const end = parseToDateTime(s.date, s.endTime)
|
||||||
|
if (!start || !end || end <= start) return []
|
||||||
|
const out = []
|
||||||
|
let cur = new Date(start)
|
||||||
|
while (cur <= end) {
|
||||||
|
const HH = String(cur.getHours()).padStart(2, '0')
|
||||||
|
const mm = String(cur.getMinutes()).padStart(2, '0')
|
||||||
|
out.push(`${HH}:${mm}`)
|
||||||
|
cur = new Date(cur.getTime() + 30 * 60 * 1000)
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseToDateTime(dateStr, timeStr) {
|
||||||
|
if (!dateStr || !timeStr) return null
|
||||||
|
const t = typeof timeStr === 'string' && timeStr.length === 8 ? timeStr : getTimeStr(timeStr)
|
||||||
|
if (!t || t === '--:--') return null
|
||||||
|
return new Date(`${dateStr} ${t}:00`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeDate(s) {
|
||||||
|
if (typeof s.date === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(s.date)) {
|
||||||
|
return s.date
|
||||||
|
}
|
||||||
|
const val = s.startTime || s.endTime
|
||||||
|
if (!val) return ''
|
||||||
|
if (typeof val === 'string' && /^\d{4}-\d{2}-\d{2} /.test(val)) {
|
||||||
|
return val.slice(0, 10)
|
||||||
|
}
|
||||||
|
const d = new Date(val)
|
||||||
|
if (isNaN(d.getTime())) return ''
|
||||||
|
const yyyy = d.getFullYear()
|
||||||
|
const MM = String(d.getMonth() + 1).padStart(2, '0')
|
||||||
|
const DD = String(d.getDate()).padStart(2, '0')
|
||||||
|
return `${yyyy}-${MM}-${DD}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatTimeRange(s) {
|
||||||
|
const t1 = getTimeStr(s.startTime)
|
||||||
|
const t2 = getTimeStr(s.endTime)
|
||||||
|
return `${t1} - ${t2}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTimeStr(v) {
|
||||||
|
if (!v) return '--:--'
|
||||||
|
if (typeof v === 'string') {
|
||||||
|
// "HH:mm:ss" or "YYYY-MM-DD HH:mm:ss"
|
||||||
|
const m = v.match(/(\d{2}:\d{2})/)
|
||||||
|
return m ? m[1] : '--:--'
|
||||||
|
}
|
||||||
|
const d = new Date(v)
|
||||||
|
if (isNaN(d.getTime())) return '--:--'
|
||||||
|
const HH = String(d.getHours()).padStart(2, '0')
|
||||||
|
const mm = String(d.getMinutes()).padStart(2, '0')
|
||||||
|
return `${HH}:${mm}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadSlots() {
|
||||||
|
loading.value = true
|
||||||
|
listNext7Days().then(res => {
|
||||||
|
const list = Array.isArray(res) ? res : (res.data || res.list || [])
|
||||||
|
slotsByDate.value = groupSlots(Array.isArray(list) ? list : [])
|
||||||
|
buildTimePoints()
|
||||||
|
}).finally(() => (loading.value = false))
|
||||||
|
}
|
||||||
|
|
||||||
|
function openReserve(tp) {
|
||||||
|
if (tp?.disabled) return
|
||||||
|
selectedTp.value = tp
|
||||||
|
dialogOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function addVisitor() {
|
||||||
|
visitorForm.visitors.push({ realName: '', idCard: '', phone: '' })
|
||||||
|
}
|
||||||
|
function removeVisitor(idx) {
|
||||||
|
visitorForm.visitors.splice(idx, 1)
|
||||||
|
if (visitorForm.visitors.length === 0) visitorForm.visitors.push({ realName: '', idCard: '', phone: '' })
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitReserve() {
|
||||||
|
if (!selectedTp.value) return
|
||||||
|
const valid = await new Promise(resolve => {
|
||||||
|
if (visitorFormRef.value && visitorFormRef.value.validate) {
|
||||||
|
visitorFormRef.value.validate(v => resolve(v))
|
||||||
|
} else {
|
||||||
|
resolve(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!valid) return
|
||||||
|
// 构造整单预约入参(包含预约基础信息与游客明细),一次请求完成提交
|
||||||
|
const payload = {
|
||||||
|
userId: currentUserId.value,
|
||||||
|
timeSlotId: selectedTp.value.slotId,
|
||||||
|
reserveTime: `${selectedTp.value.label}:00`,
|
||||||
|
totalVisitors: visitorForm.visitors.length,
|
||||||
|
status: 0,
|
||||||
|
// 游客列表:默认 verifyStatus 为 0(未验证)
|
||||||
|
reservationVisitors: visitorForm.visitors.map(v => ({ realName: v.realName, idCard: v.idCard, phone: v.phone, verifyStatus: 0 }))
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res = await addReservation(payload)
|
||||||
|
if (res && Number(res.code) === 200) {
|
||||||
|
proxy.$message({ message: '预约提交成功,等待审核', type: 'success' })
|
||||||
|
dialogOpen.value = false
|
||||||
|
} else {
|
||||||
|
const msg = (res && res.msg) || '提交失败'
|
||||||
|
proxy.$message({ message: msg, type: 'error' })
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
proxy.$message({ message: '服务异常!', type: 'error' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
genDateRange()
|
||||||
|
loadSlots()
|
||||||
|
getCurrentSysUser().then(u => {
|
||||||
|
const data = u && (u.data || u)
|
||||||
|
currentUserId.value = data && (data.id || data.userId)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.reserve-container {
|
||||||
|
width: 80%;
|
||||||
|
margin: 24px auto 40px;
|
||||||
|
padding-top: 16px;
|
||||||
|
}
|
||||||
|
.intro {
|
||||||
|
color: #606266;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.date-bar {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.date-chip {
|
||||||
|
border: 1px solid #e7dfcf;
|
||||||
|
background: #f9f6f1;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.date-chip.active {
|
||||||
|
border-color: #8a2b2b;
|
||||||
|
box-shadow: 0 6px 14px rgba(138,43,43,0.12);
|
||||||
|
}
|
||||||
|
.date-chip.disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
.d1 { font-weight: 700; color: #2c1f1f; }
|
||||||
|
.d2 { font-size: 12px; color: #8a2b2b; }
|
||||||
|
.slot-panel { background: #fff; border: 1px solid #e7dfcf; border-radius: 12px; padding: 16px; }
|
||||||
|
.slot-empty { color: #909399; text-align: center; padding: 20px 0; }
|
||||||
|
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
|
||||||
|
.slot-card { background: #f9f6f1; border: 1px solid #e7dfcf; border-radius: 12px; padding: 12px; display: flex; align-items: center; justify-content: space-between; }
|
||||||
|
.slot-time { font-weight: 700; color: #2c1f1f; }
|
||||||
|
.slot-card.disabled { opacity: 0.6; }
|
||||||
|
.visitor-list { display: flex; flex-direction: column; gap: 8px; }
|
||||||
|
.visitor-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; background: #f9f6f1; border: 1px solid #e7dfcf; border-radius: 12px; padding: 12px; }
|
||||||
|
.visitor-index { width: 32px; height: 32px; border-radius: 999px; background: #8a2b2b; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
|
||||||
|
.visitor-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
|
||||||
|
.visitor-fields :deep(.el-input) { width: 100%; }
|
||||||
|
.visitor-remove { display: flex; align-items: center; }
|
||||||
|
.visitor-actions { margin-top: 10px; display: flex; justify-content: center; }
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
<template>
|
||||||
|
<div class="user-container">
|
||||||
|
<el-card class="user-card">
|
||||||
|
<div class="title">个人信息</div>
|
||||||
|
<div class="avatar-div">
|
||||||
|
<el-upload
|
||||||
|
action="/api/files/upload"
|
||||||
|
:show-file-list="false"
|
||||||
|
:headers="headers"
|
||||||
|
name="file"
|
||||||
|
:data="{filePath: 'avatar'}"
|
||||||
|
:on-success="handleAvatarSuccess"
|
||||||
|
:before-upload="beforeAvatarUpload">
|
||||||
|
<div class="avatar-uploader">
|
||||||
|
<img v-if="sysUser.avatar" :src="getFilePrefix + sysUser.avatar" style="width: 100%;" />
|
||||||
|
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||||
|
</div>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
<el-form :model="sysUser" label-width="96px" class="form-block">
|
||||||
|
<el-form-item label="用户账号">
|
||||||
|
<el-input v-model="sysUser.username" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户昵称">
|
||||||
|
<el-input v-model="sysUser.nickname" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-form :model="sysUser.tourist" label-width="96px" class="form-block">
|
||||||
|
<el-form-item label="真实姓名">
|
||||||
|
<el-input v-model="sysUser.tourist.realName" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="身份证号">
|
||||||
|
<el-input v-model="sysUser.tourist.idCard" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="手机号">
|
||||||
|
<el-input v-model="sysUser.tourist.phone" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="邮箱">
|
||||||
|
<el-input v-model="sysUser.tourist.email" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div class="actions">
|
||||||
|
<el-button type="primary" @click="updateSysUserInfo">更新个人信息</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, getCurrentInstance } from 'vue'
|
||||||
|
import { getCurrentSysUser, updateSysUser } from '@/api/sysUser'
|
||||||
|
import { getToken } from '@/utils/token'
|
||||||
|
import Cookies from 'js-cookie'
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const getFilePrefix = proxy.getFilePrefix
|
||||||
|
|
||||||
|
const sysUser = ref({ tourist: {} })
|
||||||
|
const createTimeText = ref('')
|
||||||
|
const updateTimeText = ref('')
|
||||||
|
|
||||||
|
const headers = ref({ Authorization: getToken() })
|
||||||
|
|
||||||
|
function formatDate(val) {
|
||||||
|
if (!val) return ''
|
||||||
|
const d = new Date(val)
|
||||||
|
if (isNaN(d.getTime())) return ''
|
||||||
|
const yyyy = d.getFullYear()
|
||||||
|
const MM = String(d.getMonth() + 1).padStart(2, '0')
|
||||||
|
const DD = String(d.getDate()).padStart(2, '0')
|
||||||
|
const HH = String(d.getHours()).padStart(2, '0')
|
||||||
|
const mm = String(d.getMinutes()).padStart(2, '0')
|
||||||
|
const ss = String(d.getSeconds()).padStart(2, '0')
|
||||||
|
return `${yyyy}-${MM}-${DD} ${HH}:${mm}:${ss}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCurrentSysUserInfo() {
|
||||||
|
getCurrentSysUser().then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
const d = res.data || {}
|
||||||
|
if (!d.tourist) d.tourist = {}
|
||||||
|
sysUser.value = d
|
||||||
|
createTimeText.value = formatDate(d.createTime)
|
||||||
|
updateTimeText.value = formatDate(d.updateTime)
|
||||||
|
} else {
|
||||||
|
proxy.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAvatarSuccess(response) {
|
||||||
|
sysUser.value.avatar = response
|
||||||
|
Cookies.set('avatar', response)
|
||||||
|
updateSysUser(sysUser.value).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$message.success('头像更新成功')
|
||||||
|
} else {
|
||||||
|
proxy.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeAvatarUpload() {}
|
||||||
|
|
||||||
|
function updateSysUserInfo() {
|
||||||
|
updateSysUser(sysUser.value).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$message.success('个人信息更新成功')
|
||||||
|
getCurrentSysUserInfo()
|
||||||
|
} else {
|
||||||
|
proxy.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getCurrentSysUserInfo()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.user-container { width: 80%; margin: 24px auto 40px; padding-top: 16px; }
|
||||||
|
.user-card { padding: 14px 16px; }
|
||||||
|
.title { font-size: 22px; font-weight: 800; color: #2c1f1f; text-align: center; margin-bottom: 8px; }
|
||||||
|
.sub-title { font-size: 16px; font-weight: 800; color: #2c1f1f; margin: 12px 0 8px; }
|
||||||
|
.form-block { max-width: 520px; margin: 0 auto; }
|
||||||
|
.avatar-div { margin: 10px auto 18px; width: 100px; height: 100px; border-radius: 50%; overflow: hidden; border: 1px solid #ccc; line-height: 100px; }
|
||||||
|
.avatar-uploader { width: 100px; height: 100px; display:flex; justify-content: center; align-items: center; }
|
||||||
|
.actions { display: flex; justify-content: center; margin-top: 12px; }
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
|
|
||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
vue(),
|
||||||
|
vueDevTools(),
|
||||||
|
],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
port: 9100,
|
||||||
|
// 配置转发规则
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'http://localhost:8848/amms', // 目标后端服务器地址 springboot
|
||||||
|
changeOrigin: true, // 是否改变源地址
|
||||||
|
rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径
|
||||||
|
// 其他可选配置...
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
<?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>3.3.3</version>
|
||||||
|
<relativePath/>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>org.example</groupId>
|
||||||
|
<artifactId>amms</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>amms</name>
|
||||||
|
<description>邺城博物馆管理系统</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>3.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 引入jwt包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
<version>0.9.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- redis 缓存操作 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.16.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- redis-data -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- redis-依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.amms.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RedisConfig {
|
||||||
|
// 配置redisTemplate
|
||||||
|
@Bean
|
||||||
|
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory){
|
||||||
|
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||||
|
redisTemplate.setConnectionFactory(factory);
|
||||||
|
|
||||||
|
// 设置key的序列化
|
||||||
|
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||||
|
// value的序列化
|
||||||
|
Jackson2JsonRedisSerializer jsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
|
||||||
|
redisTemplate.setValueSerializer(jsonRedisSerializer);
|
||||||
|
|
||||||
|
// Hash的key也采用StringRedisSerializer的序列化方式
|
||||||
|
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||||
|
redisTemplate.setHashValueSerializer(jsonRedisSerializer);
|
||||||
|
|
||||||
|
return redisTemplate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.amms.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.amms.domain.vo.Result;
|
||||||
|
import com.amms.domain.MuseumIntro;
|
||||||
|
import com.amms.service.IMuseumIntroService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 博物馆简介Controller
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/museumIntro")
|
||||||
|
public class MuseumIntroController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMuseumIntroService museumIntroService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询博物馆简介列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public PageInfo list(MuseumIntro museumIntro, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
List<MuseumIntro> museumIntros = museumIntroService.selectMuseumIntroList(museumIntro);
|
||||||
|
return new PageInfo(museumIntros);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部博物馆简介列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public List<MuseumIntro> listAll(MuseumIntro museumIntro) {
|
||||||
|
return museumIntroService.selectMuseumIntroList(museumIntro);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取博物馆简介详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/info/{museumName}")
|
||||||
|
public Result getInfo(@PathVariable("museumName") String museumName) {
|
||||||
|
return Result.success(museumIntroService.selectMuseumIntroByMuseumName(museumName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增博物馆简介
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result add(@RequestBody MuseumIntro museumIntro) {
|
||||||
|
return museumIntroService.insertMuseumIntro(museumIntro) > 0 ? Result.success("新增成功") : Result.error("新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改博物馆简介
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result update(@RequestBody MuseumIntro museumIntro) {
|
||||||
|
return museumIntroService.updateMuseumIntro(museumIntro) > 0 ? Result.success("修改成功") : Result.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除博物馆简介
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{museumName}")
|
||||||
|
public Result delete(@PathVariable String museumName) {
|
||||||
|
return museumIntroService.deleteMuseumIntroByMuseumName(museumName) > 0 ? Result.success("删除成功") : Result.error("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.amms.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.amms.domain.vo.Result;
|
||||||
|
import com.amms.domain.Relic;
|
||||||
|
import com.amms.service.IRelicService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 藏品Controller
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/relic")
|
||||||
|
public class RelicController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IRelicService relicService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询藏品列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public PageInfo list(Relic relic, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
List<Relic> relics = relicService.selectRelicList(relic);
|
||||||
|
return new PageInfo(relics);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部藏品列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public List<Relic> listAll(Relic relic) {
|
||||||
|
return relicService.selectRelicList(relic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取藏品详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/info/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(relicService.selectRelicById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增藏品
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result add(@RequestBody Relic relic) {
|
||||||
|
return relicService.insertRelic(relic) > 0 ? Result.success("新增成功") : Result.error("新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改藏品
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result update(@RequestBody Relic relic) {
|
||||||
|
return relicService.updateRelic(relic) > 0 ? Result.success("修改成功") : Result.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除藏品
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public Result delete(@PathVariable Long id) {
|
||||||
|
return relicService.deleteRelicById(id) > 0 ? Result.success("删除成功") : Result.error("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
package com.amms.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.amms.domain.vo.Result;
|
||||||
|
import com.amms.domain.Reservation;
|
||||||
|
import com.amms.service.IReservationService;
|
||||||
|
import com.amms.service.IReservationVisitorService;
|
||||||
|
import com.amms.domain.ReservationVisitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约Controller
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/reservation")
|
||||||
|
public class ReservationController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IReservationService reservationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IReservationVisitorService reservationVisitorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预约列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public PageInfo list(Reservation reservation, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
List<Reservation> reservations = reservationService.selectReservationList(reservation);
|
||||||
|
for (Reservation r : reservations) {
|
||||||
|
ReservationVisitor query = new ReservationVisitor();
|
||||||
|
query.setReservationId(r.getId());
|
||||||
|
List<ReservationVisitor> visitors = reservationVisitorService.selectReservationVisitorList(query);
|
||||||
|
r.setReservationVisitors(visitors);
|
||||||
|
}
|
||||||
|
return new PageInfo(reservations);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部预约列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public List<Reservation> listAll(Reservation reservation) {
|
||||||
|
List<Reservation> reservations = reservationService.selectReservationList(reservation);
|
||||||
|
for (Reservation r : reservations) {
|
||||||
|
ReservationVisitor query = new ReservationVisitor();
|
||||||
|
query.setReservationId(r.getId());
|
||||||
|
List<ReservationVisitor> visitors = reservationVisitorService.selectReservationVisitorList(query);
|
||||||
|
r.setReservationVisitors(visitors);
|
||||||
|
}
|
||||||
|
return reservations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预约详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/info/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
|
Reservation r = reservationService.selectReservationById(id);
|
||||||
|
if (r != null) {
|
||||||
|
ReservationVisitor query = new ReservationVisitor();
|
||||||
|
query.setReservationId(r.getId());
|
||||||
|
List<ReservationVisitor> visitors = reservationVisitorService.selectReservationVisitorList(query);
|
||||||
|
r.setReservationVisitors(visitors);
|
||||||
|
}
|
||||||
|
return Result.success(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预约
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result add(@RequestBody Reservation reservation) {
|
||||||
|
return reservationService.insertReservation(reservation) > 0 ? Result.success("新增成功") : Result.error("新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预约
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result update(@RequestBody Reservation reservation) {
|
||||||
|
return reservationService.updateReservation(reservation) > 0 ? Result.success("修改成功") : Result.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核预约
|
||||||
|
*
|
||||||
|
* 前端传入:id(预约ID)、status(审核状态:1通过 3驳回)、remark(可选审核备注)
|
||||||
|
* 审核通过时:
|
||||||
|
* 1)为整单生成核验二维码链接,存入 Reservation.qrCode 字段(扫码后整单游客核验状态置为1)
|
||||||
|
* 2)为每位游客生成个人核验二维码链接,存入 ReservationVisitor.visitorQrCode 字段(扫码后该游客核验状态置为1)
|
||||||
|
*/
|
||||||
|
@PutMapping("/audit")
|
||||||
|
public Result audit(@RequestBody Reservation reservation) {
|
||||||
|
if (reservation == null || reservation.getId() == null || reservation.getStatus() == null) {
|
||||||
|
return Result.error("参数不完整:缺少预约ID或审核状态");
|
||||||
|
}
|
||||||
|
return reservationService.auditReservation(reservation) > 0 ? Result.success("审核成功") : Result.error("审核失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整单核验:将该预约下所有游客核验状态置为1
|
||||||
|
*/
|
||||||
|
@GetMapping("/verifyAll/{reservationId}")
|
||||||
|
public Result verifyAll(@PathVariable("reservationId") Long reservationId) {
|
||||||
|
int n = reservationService.verifyAllVisitors(reservationId);
|
||||||
|
return n >= 0 ? Result.success("整单核验成功") : Result.error("整单核验失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游客个人核验:将该游客核验状态置为1
|
||||||
|
*/
|
||||||
|
@GetMapping("/verifyVisitor/{visitorId}")
|
||||||
|
public Result verifyVisitor(@PathVariable("visitorId") Long visitorId) {
|
||||||
|
int n = reservationService.verifyVisitor(visitorId);
|
||||||
|
if (n == 0) return Result.error("游客信息不存在或核验失败");
|
||||||
|
return Result.success("游客核验成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预约
|
||||||
|
*
|
||||||
|
* 同步删除该预约下的游客预约明细(reservation_visitor),保证数据一致性
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public Result delete(@PathVariable Long id) {
|
||||||
|
// 先删除当前预约ID下的所有游客明细
|
||||||
|
reservationVisitorService.deleteReservationVisitorsByReservationId(id);
|
||||||
|
return reservationService.deleteReservationById(id) > 0 ? Result.success("删除成功") : Result.error("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.amms.controller;
|
||||||
|
|
||||||
|
import com.amms.domain.dto.BatchAddReservationTimeSlotParam;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.amms.domain.vo.Result;
|
||||||
|
import com.amms.domain.ReservationTimeSlot;
|
||||||
|
import com.amms.service.IReservationTimeSlotService;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约时段Controller
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/reservationTimeSlot")
|
||||||
|
public class ReservationTimeSlotController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IReservationTimeSlotService reservationTimeSlotService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预约时段列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public PageInfo list(ReservationTimeSlot reservationTimeSlot, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
List<ReservationTimeSlot> reservationTimeSlots = reservationTimeSlotService.selectReservationTimeSlotList(reservationTimeSlot);
|
||||||
|
return new PageInfo(reservationTimeSlots);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部预约时段列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public List<ReservationTimeSlot> listAll(ReservationTimeSlot reservationTimeSlot) {
|
||||||
|
return reservationTimeSlotService.selectReservationTimeSlotList(reservationTimeSlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预约时段详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/info/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(reservationTimeSlotService.selectReservationTimeSlotById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预约时段
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result add(@RequestBody ReservationTimeSlot reservationTimeSlot) {
|
||||||
|
return reservationTimeSlotService.insertReservationTimeSlot(reservationTimeSlot) > 0 ? Result.success("新增成功") : Result.error("新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增预约时段(根据日期范围)
|
||||||
|
*/
|
||||||
|
@PostMapping("/batchAdd")
|
||||||
|
public Result batchAdd(@RequestBody BatchAddReservationTimeSlotParam param) {
|
||||||
|
int affected = reservationTimeSlotService.batchInsertReservationTimeSlots(
|
||||||
|
param.getStartDate(), param.getEndDate(), param.getStartTime(), param.getEndTime(), param.getMaxPeople(), param.getStatus()
|
||||||
|
);
|
||||||
|
return affected > 0 ? Result.success("新增成功") : Result.error("新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预约时段
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result update(@RequestBody ReservationTimeSlot reservationTimeSlot) {
|
||||||
|
return reservationTimeSlotService.updateReservationTimeSlot(reservationTimeSlot) > 0 ? Result.success("修改成功") : Result.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预约时段
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public Result delete(@PathVariable Long id) {
|
||||||
|
return reservationTimeSlotService.deleteReservationTimeSlotById(id) > 0 ? Result.success("删除成功") : Result.error("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当天及往后推7天的预约时段信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/listNext7Days")
|
||||||
|
public Result listNext7Days() {
|
||||||
|
List<ReservationTimeSlot> all = reservationTimeSlotService.selectReservationTimeSlotList(new ReservationTimeSlot());
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
LocalDate end = today.plusDays(7);
|
||||||
|
|
||||||
|
List<ReservationTimeSlot> filtered = all.stream().filter(slot -> {
|
||||||
|
Date date = extractDate(slot);
|
||||||
|
if (date == null) return false;
|
||||||
|
LocalDate ld = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||||
|
return (!ld.isBefore(today)) && (!ld.isAfter(end));
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return Result.success(filtered);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date extractDate(ReservationTimeSlot slot) {
|
||||||
|
try {
|
||||||
|
Method m = slot.getClass().getMethod("getDate");
|
||||||
|
Object v = m.invoke(slot);
|
||||||
|
if (v instanceof Date) return (Date) v;
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
try {
|
||||||
|
Method m = slot.getClass().getMethod("getStartTime");
|
||||||
|
Object v = m.invoke(slot);
|
||||||
|
if (v instanceof Date) return (Date) v;
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.amms.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.amms.domain.vo.Result;
|
||||||
|
import com.amms.domain.ReservationVisitor;
|
||||||
|
import com.amms.service.IReservationVisitorService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游客预约明细Controller
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/reservationVisitor")
|
||||||
|
public class ReservationVisitorController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IReservationVisitorService reservationVisitorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询游客预约明细列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public PageInfo list(ReservationVisitor reservationVisitor, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
List<ReservationVisitor> reservationVisitors = reservationVisitorService.selectReservationVisitorList(reservationVisitor);
|
||||||
|
return new PageInfo(reservationVisitors);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部游客预约明细列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public List<ReservationVisitor> listAll(ReservationVisitor reservationVisitor) {
|
||||||
|
return reservationVisitorService.selectReservationVisitorList(reservationVisitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取游客预约明细详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/info/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(reservationVisitorService.selectReservationVisitorById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增游客预约明细
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result add(@RequestBody ReservationVisitor reservationVisitor) {
|
||||||
|
return reservationVisitorService.insertReservationVisitor(reservationVisitor) > 0 ? Result.success("新增成功") : Result.error("新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改游客预约明细
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result update(@RequestBody ReservationVisitor reservationVisitor) {
|
||||||
|
return reservationVisitorService.updateReservationVisitor(reservationVisitor) > 0 ? Result.success("修改成功") : Result.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除游客预约明细
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public Result delete(@PathVariable Long id) {
|
||||||
|
return reservationVisitorService.deleteReservationVisitorById(id) > 0 ? Result.success("删除成功") : Result.error("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,125 @@
|
||||||
|
package com.amms.controller;
|
||||||
|
|
||||||
|
import com.amms.domain.SysUser;
|
||||||
|
import com.amms.domain.dto.LoginParam;
|
||||||
|
import com.amms.domain.dto.UpdatePwdParam;
|
||||||
|
import com.amms.domain.vo.Result;
|
||||||
|
import com.amms.security.SecurityUtils;
|
||||||
|
import com.amms.service.ISysUserService;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sysUser")
|
||||||
|
public class SysUserController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录方法
|
||||||
|
* @param loginParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/login")
|
||||||
|
public Result login(@RequestBody LoginParam loginParam) {
|
||||||
|
return sysUserService.login(loginParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public PageInfo list(SysUser sysUser, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
List<SysUser> sysUsers = sysUserService.selectSysUserList(sysUser);
|
||||||
|
return new PageInfo(sysUsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public List<SysUser> listAll() {
|
||||||
|
return sysUserService.selectSysUserList(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/info/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(sysUserService.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result add(@RequestBody SysUser sysUser) {
|
||||||
|
return sysUserService.insertSysUser(sysUser) > 0 ? Result.success() : Result.error("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/register")
|
||||||
|
public Result register(@RequestBody SysUser sysUser) {
|
||||||
|
return sysUserService.registerTourist(sysUser) > 0 ? Result.success("注册成功") : Result.error("注册失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody SysUser sysUser) {
|
||||||
|
return sysUserService.updateSysUser(sysUser) > 0 ? Result.success() : Result.error("更新失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public Result remove(@PathVariable Long id) {
|
||||||
|
return sysUserService.deleteSysUserById(id) > 0 ? Result.success() : Result.error("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getCurrentSysUser")
|
||||||
|
public Result getCurrentSysUser() {
|
||||||
|
SysUser currentUser = SecurityUtils.getCurrentUser(); // 当前登录用户
|
||||||
|
SysUser sysUser = sysUserService.selectById(currentUser.getId());
|
||||||
|
sysUser.setPassword(null);
|
||||||
|
return Result.success(sysUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改密码
|
||||||
|
* @param updatePwdParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/updatePwd")
|
||||||
|
public Result updatePwd(@RequestBody UpdatePwdParam updatePwdParam) {
|
||||||
|
SysUser currentUser = SecurityUtils.getCurrentUser(); // 当前登录用户
|
||||||
|
|
||||||
|
if(currentUser == null) {
|
||||||
|
return Result.error("用户不存在");
|
||||||
|
}
|
||||||
|
// 进行校验
|
||||||
|
if (StringUtils.hasText(updatePwdParam.getOldPwd())
|
||||||
|
&& StringUtils.hasText(updatePwdParam.getNewPwd())
|
||||||
|
&& StringUtils.hasText(updatePwdParam.getConfirmPwd())) {
|
||||||
|
boolean matches = passwordEncoder.matches(updatePwdParam.getOldPwd(), currentUser.getPassword()); // 旧密码对比
|
||||||
|
if (!matches) {
|
||||||
|
return Result.error("旧密码不正确!");
|
||||||
|
}
|
||||||
|
if (updatePwdParam.getNewPwd().equals(updatePwdParam.getConfirmPwd())) { // 新密码和确认密码一致
|
||||||
|
String newPwdEncode = passwordEncoder.encode(updatePwdParam.getNewPwd());
|
||||||
|
currentUser.setPassword(newPwdEncode);
|
||||||
|
int i = sysUserService.updateSysUser(currentUser);
|
||||||
|
if (i > 0) {
|
||||||
|
return Result.success("密码更新成功!");
|
||||||
|
} else {
|
||||||
|
return Result.error("密码更新失败!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Result.error("两次密码输入不一致");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Result.error("不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.amms.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.amms.domain.vo.Result;
|
||||||
|
import com.amms.domain.Tourist;
|
||||||
|
import com.amms.service.ITouristService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通用户子Controller
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/tourist")
|
||||||
|
public class TouristController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ITouristService touristService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询普通用户子列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public PageInfo list(Tourist tourist, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) {
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
List<Tourist> tourists = touristService.selectTouristList(tourist);
|
||||||
|
return new PageInfo(tourists);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部普通用户子列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public List<Tourist> listAll(Tourist tourist) {
|
||||||
|
return touristService.selectTouristList(tourist);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取普通用户子详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/info/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(touristService.selectTouristById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增普通用户子
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result add(@RequestBody Tourist tourist) {
|
||||||
|
return touristService.insertTourist(tourist) > 0 ? Result.success("新增成功") : Result.error("新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改普通用户子
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result update(@RequestBody Tourist tourist) {
|
||||||
|
return touristService.updateTourist(tourist) > 0 ? Result.success("修改成功") : Result.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除普通用户子
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public Result delete(@PathVariable Long id) {
|
||||||
|
return touristService.deleteTouristById(id) > 0 ? Result.success("删除成功") : Result.error("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
package com.amms.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 博物馆简介对象 museum_intro
|
||||||
|
*/
|
||||||
|
public class MuseumIntro {
|
||||||
|
|
||||||
|
/** 博物馆名称(主键) */
|
||||||
|
private String museumName;
|
||||||
|
|
||||||
|
/** 内容 */
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/** Logo地址 */
|
||||||
|
private String logoUrl;
|
||||||
|
|
||||||
|
/** 地址 */
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/** 联系电话 */
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/** 营业开始时间 */
|
||||||
|
@JsonFormat(pattern = "HH:mm:ss")
|
||||||
|
private Date openTime;
|
||||||
|
|
||||||
|
/** 营业结束时间 */
|
||||||
|
@JsonFormat(pattern = "HH:mm:ss")
|
||||||
|
private Date closeTime;
|
||||||
|
|
||||||
|
/** 更新者id */
|
||||||
|
private Long updater;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
public void setMuseumName(String museumName) {
|
||||||
|
this.museumName = museumName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMuseumName() {
|
||||||
|
return museumName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogoUrl(String logoUrl) {
|
||||||
|
this.logoUrl = logoUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogoUrl() {
|
||||||
|
return logoUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenTime(Date openTime) {
|
||||||
|
this.openTime = openTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getOpenTime() {
|
||||||
|
return openTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCloseTime(Date closeTime) {
|
||||||
|
this.closeTime = closeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCloseTime() {
|
||||||
|
return closeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setUpdater(Long updater) {
|
||||||
|
this.updater = updater;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdater() {
|
||||||
|
return updater;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "MuseumIntro{" +
|
||||||
|
"museumName=" + museumName +
|
||||||
|
", content=" + content +
|
||||||
|
", logoUrl=" + logoUrl +
|
||||||
|
", address=" + address +
|
||||||
|
", phone=" + phone +
|
||||||
|
", openTime=" + openTime +
|
||||||
|
", closeTime=" + closeTime +
|
||||||
|
", updateTime=" + updateTime +
|
||||||
|
", updater=" + updater +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,228 @@
|
||||||
|
package com.amms.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 藏品对象 relic
|
||||||
|
*/
|
||||||
|
public class Relic {
|
||||||
|
|
||||||
|
/** 藏品id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 名称 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 分类ID */
|
||||||
|
private Long categoryId;
|
||||||
|
|
||||||
|
/** 封面图地址 */
|
||||||
|
private String coverImageUrl;
|
||||||
|
|
||||||
|
/** 年代 */
|
||||||
|
private String age;
|
||||||
|
|
||||||
|
/** 材质 */
|
||||||
|
private String material;
|
||||||
|
|
||||||
|
/** 出土信息 */
|
||||||
|
private String excavationInfo;
|
||||||
|
|
||||||
|
/** 文物故事 */
|
||||||
|
private String story;
|
||||||
|
|
||||||
|
/** 3D/360°图地址 */
|
||||||
|
private String modelUrl;
|
||||||
|
|
||||||
|
/** 热门标识(0否 1是) */
|
||||||
|
private Long isHot;
|
||||||
|
|
||||||
|
/** 状态(0隐藏 1显示) */
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/** 创建者id */
|
||||||
|
private Long creator;
|
||||||
|
|
||||||
|
/** 更新者id */
|
||||||
|
private Long updater;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/** 分类信息 */
|
||||||
|
private ItemCategory categoryInfo;
|
||||||
|
|
||||||
|
/** 收藏信息 */
|
||||||
|
private List<ItemCollection> itemCollections;
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryId(Long categoryId) {
|
||||||
|
this.categoryId = categoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCategoryId() {
|
||||||
|
return categoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoverImageUrl(String coverImageUrl) {
|
||||||
|
this.coverImageUrl = coverImageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCoverImageUrl() {
|
||||||
|
return coverImageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(String age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaterial(String material) {
|
||||||
|
this.material = material;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaterial() {
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExcavationInfo(String excavationInfo) {
|
||||||
|
this.excavationInfo = excavationInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExcavationInfo() {
|
||||||
|
return excavationInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStory(String story) {
|
||||||
|
this.story = story;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStory() {
|
||||||
|
return story;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModelUrl(String modelUrl) {
|
||||||
|
this.modelUrl = modelUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModelUrl() {
|
||||||
|
return modelUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsHot(Long isHot) {
|
||||||
|
this.isHot = isHot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getIsHot() {
|
||||||
|
return isHot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Long status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setCreator(Long creator) {
|
||||||
|
this.creator = creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreator() {
|
||||||
|
return creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setUpdater(Long updater) {
|
||||||
|
this.updater = updater;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdater() {
|
||||||
|
return updater;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemCategory getCategoryInfo() {
|
||||||
|
return categoryInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryInfo(ItemCategory categoryInfo) {
|
||||||
|
this.categoryInfo = categoryInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemCollection> getItemCollections() {
|
||||||
|
return itemCollections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItemCollections(List<ItemCollection> itemCollections) {
|
||||||
|
this.itemCollections = itemCollections;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Relic{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name=" + name +
|
||||||
|
", categoryId=" + categoryId +
|
||||||
|
", coverImageUrl=" + coverImageUrl +
|
||||||
|
", age=" + age +
|
||||||
|
", material=" + material +
|
||||||
|
", excavationInfo=" + excavationInfo +
|
||||||
|
", story=" + story +
|
||||||
|
", modelUrl=" + modelUrl +
|
||||||
|
", isHot=" + isHot +
|
||||||
|
", status=" + status +
|
||||||
|
", createTime=" + createTime +
|
||||||
|
", creator=" + creator +
|
||||||
|
", updateTime=" + updateTime +
|
||||||
|
", updater=" + updater +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
package com.amms.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约对象 reservation
|
||||||
|
*/
|
||||||
|
public class Reservation {
|
||||||
|
|
||||||
|
/** 预约id(主表ID) */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 预约发起者id(关联sys_user.id) */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 预约发起者username*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/** 预约发起者nickname*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/** 预约时段id(关联reservation_time_slot.id) */
|
||||||
|
private Long timeSlotId;
|
||||||
|
|
||||||
|
/** 预约时段信息 */
|
||||||
|
private ReservationTimeSlot reservationTimeSlot;
|
||||||
|
|
||||||
|
/** 预约总人数(与明细表记录数一致) */
|
||||||
|
private Integer totalVisitors;
|
||||||
|
|
||||||
|
/** 预约时间 */
|
||||||
|
@JsonFormat(pattern = "HH:mm:ss")
|
||||||
|
private Date reserveTime;
|
||||||
|
|
||||||
|
/** 预约凭证二维码(整单唯一) */
|
||||||
|
private String qrCode;
|
||||||
|
|
||||||
|
/** 整单状态(0待审核 1已通过 2已取消 3已驳回) */
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/** 审核者id(关联sys_user.id) */
|
||||||
|
private Long updater;
|
||||||
|
|
||||||
|
/** 查询开始日期(根据预约时段的日期) */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date startDate;
|
||||||
|
|
||||||
|
/** 查询结束日期(根据预约时段的日期) */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date endDate;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/** 预约包含的游客信息*/
|
||||||
|
private List<ReservationVisitor> reservationVisitors;
|
||||||
|
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeSlotId(Long timeSlotId) {
|
||||||
|
this.timeSlotId = timeSlotId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTimeSlotId() {
|
||||||
|
return timeSlotId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalVisitors(Integer totalVisitors) {
|
||||||
|
this.totalVisitors = totalVisitors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTotalVisitors() {
|
||||||
|
return totalVisitors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQrCode(String qrCode) {
|
||||||
|
this.qrCode = qrCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQrCode() {
|
||||||
|
return qrCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Long status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setUpdater(Long updater) {
|
||||||
|
this.updater = updater;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdater() {
|
||||||
|
return updater;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReservationVisitor> getReservationVisitors() {
|
||||||
|
return reservationVisitors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservationVisitors(List<ReservationVisitor> reservationVisitors) {
|
||||||
|
this.reservationVisitors = reservationVisitors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReserveTime(Date reserveTime) {
|
||||||
|
this.reserveTime = reserveTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getReserveTime() {
|
||||||
|
return reserveTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(Date startDate) {
|
||||||
|
this.startDate = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(Date endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNickname() {
|
||||||
|
return nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNickname(String nickname) {
|
||||||
|
this.nickname = nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReservationTimeSlot getReservationTimeSlot() {
|
||||||
|
return reservationTimeSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservationTimeSlot(ReservationTimeSlot reservationTimeSlot) {
|
||||||
|
this.reservationTimeSlot = reservationTimeSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Reservation{" +
|
||||||
|
"id=" + id +
|
||||||
|
", userId=" + userId +
|
||||||
|
", timeSlotId=" + timeSlotId +
|
||||||
|
", totalVisitors=" + totalVisitors +
|
||||||
|
", qrCode=" + qrCode +
|
||||||
|
", status=" + status +
|
||||||
|
", createTime=" + createTime +
|
||||||
|
", updateTime=" + updateTime +
|
||||||
|
", updater=" + updater +
|
||||||
|
", remark=" + remark +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
package com.amms.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约时段对象 reservation_time_slot
|
||||||
|
*/
|
||||||
|
public class ReservationTimeSlot {
|
||||||
|
|
||||||
|
/** 时段id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 预约日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
/** 开始时间 */
|
||||||
|
@JsonFormat(pattern = "HH:mm:ss")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/** 结束时间 */
|
||||||
|
@JsonFormat(pattern = "HH:mm:ss")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/** 最大人数 */
|
||||||
|
private Integer maxPeople;
|
||||||
|
|
||||||
|
/** 已预约人数 */
|
||||||
|
private Integer currentPeople;
|
||||||
|
|
||||||
|
/** 状态(0不可约 1可约) */
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/** 创建者id */
|
||||||
|
private Long creator;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(Date startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(Date endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxPeople(Integer maxPeople) {
|
||||||
|
this.maxPeople = maxPeople;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaxPeople() {
|
||||||
|
return maxPeople;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentPeople(Integer currentPeople) {
|
||||||
|
this.currentPeople = currentPeople;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCurrentPeople() {
|
||||||
|
return currentPeople;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Long status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setCreator(Long creator) {
|
||||||
|
this.creator = creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreator() {
|
||||||
|
return creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ReservationTimeSlot{" +
|
||||||
|
"id=" + id +
|
||||||
|
", date=" + date +
|
||||||
|
", startTime=" + startTime +
|
||||||
|
", endTime=" + endTime +
|
||||||
|
", maxPeople=" + maxPeople +
|
||||||
|
", currentPeople=" + currentPeople +
|
||||||
|
", status=" + status +
|
||||||
|
", createTime=" + createTime +
|
||||||
|
", creator=" + creator +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
package com.amms.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游客预约明细对象 reservation_visitor
|
||||||
|
*/
|
||||||
|
public class ReservationVisitor {
|
||||||
|
|
||||||
|
/** 明细ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 预约id */
|
||||||
|
private Long reservationId;
|
||||||
|
|
||||||
|
/** 游客真实姓名 */
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
/** 游客身份证号(唯一标识游客) */
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
/** 游客手机号 */
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/** 游客个人入场二维码(可选,如分人验证) */
|
||||||
|
private String visitorQrCode;
|
||||||
|
|
||||||
|
/** 游客入场验证状态(0未验证 1已验证) */
|
||||||
|
private Long verifyStatus;
|
||||||
|
|
||||||
|
/** 入场验证时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date verifyTime;
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservationId(Long reservationId) {
|
||||||
|
this.reservationId = reservationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getReservationId() {
|
||||||
|
return reservationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRealName(String realName) {
|
||||||
|
this.realName = realName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRealName() {
|
||||||
|
return realName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdCard(String idCard) {
|
||||||
|
this.idCard = idCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdCard() {
|
||||||
|
return idCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisitorQrCode(String visitorQrCode) {
|
||||||
|
this.visitorQrCode = visitorQrCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVisitorQrCode() {
|
||||||
|
return visitorQrCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerifyStatus(Long verifyStatus) {
|
||||||
|
this.verifyStatus = verifyStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVerifyStatus() {
|
||||||
|
return verifyStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerifyTime(Date verifyTime) {
|
||||||
|
this.verifyTime = verifyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getVerifyTime() {
|
||||||
|
return verifyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ReservationVisitor{" +
|
||||||
|
"id=" + id +
|
||||||
|
", reservationId=" + reservationId +
|
||||||
|
", realName=" + realName +
|
||||||
|
", idCard=" + idCard +
|
||||||
|
", phone=" + phone +
|
||||||
|
", visitorQrCode=" + visitorQrCode +
|
||||||
|
", verifyStatus=" + verifyStatus +
|
||||||
|
", verifyTime=" + verifyTime +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,222 @@
|
||||||
|
package com.amms.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SysUser implements UserDetails {
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 用户账号 */
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/** 用户昵称 */
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/** 头像地址 */
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/** 密码 */
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/** 帐号状态(0正常 1停用) */
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/** 角色 */
|
||||||
|
private String role;
|
||||||
|
|
||||||
|
/** 创建者 */
|
||||||
|
private Long creator;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/** 更新者 */
|
||||||
|
private Long updater;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/** 删除标识 */
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
/** 游客信息 */
|
||||||
|
private Tourist tourist;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Override
|
||||||
|
public boolean isAccountNonExpired() {
|
||||||
|
return status == null || status == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Override
|
||||||
|
public boolean isAccountNonLocked() {
|
||||||
|
return status == null || status == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Override
|
||||||
|
public boolean isCredentialsNonExpired() {
|
||||||
|
return status == null || status == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return status == null || status == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNickname() {
|
||||||
|
return nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNickname(String nickname) {
|
||||||
|
this.nickname = nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvatar() {
|
||||||
|
return avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvatar(String avatar) {
|
||||||
|
this.avatar = avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(String role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreator() {
|
||||||
|
return creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreator(Long creator) {
|
||||||
|
this.creator = creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdater() {
|
||||||
|
return updater;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdater(Long updater) {
|
||||||
|
this.updater = updater;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDeleted() {
|
||||||
|
return deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeleted(Integer deleted) {
|
||||||
|
this.deleted = deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tourist getTourist() {
|
||||||
|
return tourist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTourist(Tourist tourist) {
|
||||||
|
this.tourist = tourist;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SysUser{" +
|
||||||
|
"id=" + id +
|
||||||
|
", username='" + username + '\'' +
|
||||||
|
", nickname='" + nickname + '\'' +
|
||||||
|
", avatar='" + avatar + '\'' +
|
||||||
|
", password='" + password + '\'' +
|
||||||
|
", status=" + status +
|
||||||
|
", role=" + role +
|
||||||
|
", creator=" + creator +
|
||||||
|
", createTime=" + createTime +
|
||||||
|
", updater=" + updater +
|
||||||
|
", updateTime=" + updateTime +
|
||||||
|
", remark='" + remark + '\'' +
|
||||||
|
", deleted=" + deleted +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.amms.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通用户子对象 tourist
|
||||||
|
*/
|
||||||
|
public class Tourist {
|
||||||
|
|
||||||
|
/** 用户id(与sys_user.id一致) */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 真实姓名 */
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
/** 身份证号 */
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
/** 手机号 */
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/** 邮箱 */
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRealName(String realName) {
|
||||||
|
this.realName = realName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRealName() {
|
||||||
|
return realName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdCard(String idCard) {
|
||||||
|
this.idCard = idCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdCard() {
|
||||||
|
return idCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Tourist{" +
|
||||||
|
"id=" + id +
|
||||||
|
", realName=" + realName +
|
||||||
|
", idCard=" + idCard +
|
||||||
|
", phone=" + phone +
|
||||||
|
", email=" + email +
|
||||||
|
", updateTime=" + updateTime +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.amms.domain.dto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录参数
|
||||||
|
*/
|
||||||
|
public class LoginParam {
|
||||||
|
|
||||||
|
/** 用户名 */
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/** 密码 */
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "LoginParam{" +
|
||||||
|
"username='" + username + '\'' +
|
||||||
|
", password='" + password + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.amms.domain.dto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改密码参数
|
||||||
|
*/
|
||||||
|
public class UpdatePwdParam {
|
||||||
|
|
||||||
|
/** 用户id */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 旧密码 */
|
||||||
|
private String oldPwd;
|
||||||
|
|
||||||
|
/** 新密码 */
|
||||||
|
private String newPwd;
|
||||||
|
|
||||||
|
/** 确认密码 */
|
||||||
|
private String confirmPwd;
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOldPwd() {
|
||||||
|
return oldPwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOldPwd(String oldPwd) {
|
||||||
|
this.oldPwd = oldPwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewPwd() {
|
||||||
|
return newPwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewPwd(String newPwd) {
|
||||||
|
this.newPwd = newPwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConfirmPwd() {
|
||||||
|
return confirmPwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfirmPwd(String confirmPwd) {
|
||||||
|
this.confirmPwd = confirmPwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "UpdatePwdParam{" +
|
||||||
|
"userId='" + userId + '\'' +
|
||||||
|
"oldPwd='" + oldPwd + '\'' +
|
||||||
|
", newPwd='" + newPwd + '\'' +
|
||||||
|
", confirmPwd='" + confirmPwd + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.amms.domain.vo;
|
||||||
|
|
||||||
|
public class Result {
|
||||||
|
|
||||||
|
/** 响应码 */
|
||||||
|
private int code;
|
||||||
|
|
||||||
|
/** 响应信息 */
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
/** 响应数据 */
|
||||||
|
private Object data;
|
||||||
|
|
||||||
|
public Result() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result(int code, String msg, Object data) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result success() {
|
||||||
|
return new Result(200, "success", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result success(String msg) {
|
||||||
|
return new Result(200, msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result success(Object data) {
|
||||||
|
return new Result(200, "success", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Result success(String msg, Object data) {
|
||||||
|
return new Result(200, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result error() {
|
||||||
|
return new Result(500, "error", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result error(String msg) {
|
||||||
|
return new Result(500, msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result error(String msg, Object data) {
|
||||||
|
return new Result(500, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result error(int code, String msg) {
|
||||||
|
return new Result(code, msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result error(int code, String msg, Object data) {
|
||||||
|
return new Result(code, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(Object data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Result{" +
|
||||||
|
"code='" + code + '\'' +
|
||||||
|
", msg='" + msg + '\'' +
|
||||||
|
", data=" + data +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.amms.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.amms.domain.MuseumIntro;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 博物馆简介Mapper接口
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MuseumIntroMapper {
|
||||||
|
/**
|
||||||
|
* 查询博物馆简介
|
||||||
|
*
|
||||||
|
* @param museumName 博物馆简介主键
|
||||||
|
* @return 博物馆简介
|
||||||
|
*/
|
||||||
|
public MuseumIntro selectMuseumIntroByMuseumName(String museumName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询博物馆简介列表
|
||||||
|
*
|
||||||
|
* @param museumIntro 博物馆简介
|
||||||
|
* @return 博物馆简介集合
|
||||||
|
*/
|
||||||
|
public List<MuseumIntro> selectMuseumIntroList(MuseumIntro museumIntro);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增博物馆简介
|
||||||
|
*
|
||||||
|
* @param museumIntro 博物馆简介
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertMuseumIntro(MuseumIntro museumIntro);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改博物馆简介
|
||||||
|
*
|
||||||
|
* @param museumIntro 博物馆简介
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateMuseumIntro(MuseumIntro museumIntro);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除博物馆简介
|
||||||
|
*
|
||||||
|
* @param museumName 博物馆简介主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteMuseumIntroByMuseumName(String museumName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.amms.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.amms.domain.Relic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 藏品Mapper接口
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RelicMapper {
|
||||||
|
/**
|
||||||
|
* 查询藏品
|
||||||
|
*
|
||||||
|
* @param id 藏品主键
|
||||||
|
* @return 藏品
|
||||||
|
*/
|
||||||
|
public Relic selectRelicById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询藏品列表
|
||||||
|
*
|
||||||
|
* @param relic 藏品
|
||||||
|
* @return 藏品集合
|
||||||
|
*/
|
||||||
|
public List<Relic> selectRelicList(Relic relic);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增藏品
|
||||||
|
*
|
||||||
|
* @param relic 藏品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertRelic(Relic relic);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改藏品
|
||||||
|
*
|
||||||
|
* @param relic 藏品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateRelic(Relic relic);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除藏品
|
||||||
|
*
|
||||||
|
* @param id 藏品主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteRelicById(Long id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.amms.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.amms.domain.Reservation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约Mapper接口
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ReservationMapper {
|
||||||
|
/**
|
||||||
|
* 查询预约
|
||||||
|
*
|
||||||
|
* @param id 预约主键
|
||||||
|
* @return 预约
|
||||||
|
*/
|
||||||
|
public Reservation selectReservationById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预约列表
|
||||||
|
*
|
||||||
|
* @param reservation 预约
|
||||||
|
* @return 预约集合
|
||||||
|
*/
|
||||||
|
public List<Reservation> selectReservationList(Reservation reservation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预约
|
||||||
|
*
|
||||||
|
* @param reservation 预约
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertReservation(Reservation reservation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预约
|
||||||
|
*
|
||||||
|
* @param reservation 预约
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateReservation(Reservation reservation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预约
|
||||||
|
*
|
||||||
|
* @param id 预约主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteReservationById(Long id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.amms.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.amms.domain.ReservationTimeSlot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约时段Mapper接口
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ReservationTimeSlotMapper {
|
||||||
|
/**
|
||||||
|
* 查询预约时段
|
||||||
|
*
|
||||||
|
* @param id 预约时段主键
|
||||||
|
* @return 预约时段
|
||||||
|
*/
|
||||||
|
public ReservationTimeSlot selectReservationTimeSlotById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预约时段列表
|
||||||
|
*
|
||||||
|
* @param reservationTimeSlot 预约时段
|
||||||
|
* @return 预约时段集合
|
||||||
|
*/
|
||||||
|
public List<ReservationTimeSlot> selectReservationTimeSlotList(ReservationTimeSlot reservationTimeSlot);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预约时段
|
||||||
|
*
|
||||||
|
* @param reservationTimeSlot 预约时段
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertReservationTimeSlot(ReservationTimeSlot reservationTimeSlot);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预约时段
|
||||||
|
*
|
||||||
|
* @param reservationTimeSlot 预约时段
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateReservationTimeSlot(ReservationTimeSlot reservationTimeSlot);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预约时段
|
||||||
|
*
|
||||||
|
* @param id 预约时段主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteReservationTimeSlotById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增预约时段
|
||||||
|
*/
|
||||||
|
public int batchInsertReservationTimeSlots(java.util.List<ReservationTimeSlot> list);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.amms.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.amms.domain.ReservationVisitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游客预约明细Mapper接口
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ReservationVisitorMapper {
|
||||||
|
/**
|
||||||
|
* 查询游客预约明细
|
||||||
|
*
|
||||||
|
* @param id 游客预约明细主键
|
||||||
|
* @return 游客预约明细
|
||||||
|
*/
|
||||||
|
public ReservationVisitor selectReservationVisitorById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询游客预约明细列表
|
||||||
|
*
|
||||||
|
* @param reservationVisitor 游客预约明细
|
||||||
|
* @return 游客预约明细集合
|
||||||
|
*/
|
||||||
|
public List<ReservationVisitor> selectReservationVisitorList(ReservationVisitor reservationVisitor);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据预约id查询预约游客信息
|
||||||
|
* @param reserveId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<ReservationVisitor> selectReservationVisitorListByReserveId(Long reserveId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增游客预约明细
|
||||||
|
*
|
||||||
|
* @param reservationVisitor 游客预约明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertReservationVisitor(ReservationVisitor reservationVisitor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改游客预约明细
|
||||||
|
*
|
||||||
|
* @param reservationVisitor 游客预约明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateReservationVisitor(ReservationVisitor reservationVisitor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除游客预约明细
|
||||||
|
*
|
||||||
|
* @param id 游客预约明细主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteReservationVisitorById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据预约ID批量删除游客预约明细
|
||||||
|
*
|
||||||
|
* @param reservationId 预约主表ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteReservationVisitorsByReservationId(Long reservationId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.amms.mapper;
|
||||||
|
|
||||||
|
import com.amms.domain.SysUser;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysUserMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户列表
|
||||||
|
* @param sysUser 用户
|
||||||
|
* @return 用户
|
||||||
|
*/
|
||||||
|
List<SysUser> selectSysUserList(SysUser sysUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户
|
||||||
|
* @param username 用户
|
||||||
|
* @return 用户
|
||||||
|
*/
|
||||||
|
SysUser selectByUsername(String username);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户
|
||||||
|
* @param id 用户
|
||||||
|
* @return 用户
|
||||||
|
*/
|
||||||
|
SysUser selectById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*
|
||||||
|
* @param sysUser 用户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertSysUser(SysUser sysUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*
|
||||||
|
* @param sysUser 用户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateSysUser(SysUser sysUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*
|
||||||
|
* @param id 用户主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteSysUserById(Long id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.amms.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.amms.domain.Tourist;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通用户子Mapper接口
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TouristMapper {
|
||||||
|
/**
|
||||||
|
* 查询普通用户子
|
||||||
|
*
|
||||||
|
* @param id 普通用户子主键
|
||||||
|
* @return 普通用户子
|
||||||
|
*/
|
||||||
|
public Tourist selectTouristById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询普通用户子列表
|
||||||
|
*
|
||||||
|
* @param tourist 普通用户子
|
||||||
|
* @return 普通用户子集合
|
||||||
|
*/
|
||||||
|
public List<Tourist> selectTouristList(Tourist tourist);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增普通用户子
|
||||||
|
*
|
||||||
|
* @param tourist 普通用户子
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertTourist(Tourist tourist);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改普通用户子
|
||||||
|
*
|
||||||
|
* @param tourist 普通用户子
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateTourist(Tourist tourist);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除普通用户子
|
||||||
|
*
|
||||||
|
* @param id 普通用户子主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteTouristById(Long id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.amms.security;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
|
import org.springframework.security.authentication.ProviderManager;
|
||||||
|
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
|
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableWebSecurity
|
||||||
|
public class SecurityConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JwtAuthenticationFilter jwtAuthenticationFilter;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserDetailsService sysUserDetailsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置过滤器链,对login接口放行
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||||
|
http.csrf(csrf -> csrf.disable());
|
||||||
|
// 放行login接口
|
||||||
|
http.authorizeHttpRequests(auth -> auth
|
||||||
|
.requestMatchers("/sysUser/login", "/sysUser/register").permitAll()
|
||||||
|
.requestMatchers("/files/**").permitAll()
|
||||||
|
.requestMatchers("/carousel/listAll").permitAll()
|
||||||
|
.requestMatchers("/museumIntro/listAll").permitAll()
|
||||||
|
.requestMatchers("/itemCategory/listAll").permitAll()
|
||||||
|
.requestMatchers("/relic/list", "/relic/listAll", "/relic/info/**").permitAll()
|
||||||
|
.requestMatchers("/announcement/listAll", "/announcement/info/**", "/announcement/touristList").permitAll()
|
||||||
|
.anyRequest().authenticated()
|
||||||
|
);
|
||||||
|
// 将过滤器添加到过滤器链中
|
||||||
|
// 将过滤器添加到 UsernamePasswordAuthenticationFilter 之前
|
||||||
|
http.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
|
||||||
|
return http.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AuthenticationManager:负责认证的
|
||||||
|
* DaoAuthenticationProvider:负责将 sysUserDetailsService、passwordEncoder融合起来送到AuthenticationManager中
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public AuthenticationManager authenticationManager() {
|
||||||
|
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||||
|
provider.setUserDetailsService(sysUserDetailsService);
|
||||||
|
provider.setPasswordEncoder(passwordEncoder());
|
||||||
|
// 将provider放置进 AuthenticationManager 中,包含进去
|
||||||
|
ProviderManager providerManager = new ProviderManager(provider);
|
||||||
|
|
||||||
|
return providerManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public PasswordEncoder passwordEncoder() {
|
||||||
|
return new BCryptPasswordEncoder();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.amms.security;
|
||||||
|
|
||||||
|
import com.amms.domain.SysUser;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SpringSecurity工具类
|
||||||
|
*/
|
||||||
|
public class SecurityUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前登录用户
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SysUser getCurrentUser() {
|
||||||
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
SysUser sysUser = null;
|
||||||
|
if (!authentication.getPrincipal().equals("anonymousUser")) {
|
||||||
|
sysUser = (SysUser) authentication.getPrincipal();
|
||||||
|
}
|
||||||
|
|
||||||
|
return sysUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.amms.security;
|
||||||
|
|
||||||
|
import com.amms.domain.SysUser;
|
||||||
|
import com.amms.mapper.SysUserMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SysUserDetailsService implements UserDetailsService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SpringSecurity会调用这个方法验证用户名和密码
|
||||||
|
* @param username 用户名
|
||||||
|
* @return
|
||||||
|
* @throws UsernameNotFoundException 用户不存在异常
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
|
|
||||||
|
// 根据用户名查询用户
|
||||||
|
SysUser sysUser = sysUserMapper.selectByUsername(username);
|
||||||
|
|
||||||
|
// 如果查到了用户,就返回一个SpringSecurity的UserDetails
|
||||||
|
if (sysUser != null) {
|
||||||
|
return sysUser;
|
||||||
|
} else {
|
||||||
|
throw new UsernameNotFoundException(username);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.amms.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.amms.mapper.MuseumIntroMapper;
|
||||||
|
import com.amms.domain.MuseumIntro;
|
||||||
|
import com.amms.service.IMuseumIntroService;
|
||||||
|
import com.amms.security.SecurityUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 博物馆简介Service业务层处理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MuseumIntroServiceImpl implements IMuseumIntroService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MuseumIntroMapper museumIntroMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询博物馆简介列表
|
||||||
|
*
|
||||||
|
* @param museumIntro 博物馆简介
|
||||||
|
* @return 博物馆简介
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<MuseumIntro> selectMuseumIntroList(MuseumIntro museumIntro) {
|
||||||
|
return museumIntroMapper.selectMuseumIntroList(museumIntro);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询博物馆简介
|
||||||
|
*
|
||||||
|
* @param museumName 博物馆简介主键
|
||||||
|
* @return 博物馆简介
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public MuseumIntro selectMuseumIntroByMuseumName(String museumName) {
|
||||||
|
return museumIntroMapper.selectMuseumIntroByMuseumName(museumName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增博物馆简介
|
||||||
|
*
|
||||||
|
* @param museumIntro 博物馆简介
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertMuseumIntro(MuseumIntro museumIntro) {
|
||||||
|
return museumIntroMapper.insertMuseumIntro(museumIntro);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改博物馆简介
|
||||||
|
*
|
||||||
|
* @param museumIntro 博物馆简介
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateMuseumIntro(MuseumIntro museumIntro) {
|
||||||
|
museumIntro.setUpdateTime(new Date());
|
||||||
|
museumIntro.setUpdater(SecurityUtils.getCurrentUser().getId());
|
||||||
|
return museumIntroMapper.updateMuseumIntro(museumIntro);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除博物馆简介信息
|
||||||
|
*
|
||||||
|
* @param museumName 博物馆简介主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteMuseumIntroByMuseumName(String museumName) {
|
||||||
|
return museumIntroMapper.deleteMuseumIntroByMuseumName(museumName);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.amms.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.amms.domain.ItemCollection;
|
||||||
|
import com.amms.mapper.ItemCollectionMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.amms.mapper.RelicMapper;
|
||||||
|
import com.amms.domain.Relic;
|
||||||
|
import com.amms.service.IRelicService;
|
||||||
|
import com.amms.security.SecurityUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 藏品Service业务层处理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RelicServiceImpl implements IRelicService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RelicMapper relicMapper;
|
||||||
|
@Autowired
|
||||||
|
private ItemCollectionMapper itemCollectionMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询藏品列表
|
||||||
|
*
|
||||||
|
* @param relic 藏品
|
||||||
|
* @return 藏品
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Relic> selectRelicList(Relic relic) {
|
||||||
|
return relicMapper.selectRelicList(relic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询藏品
|
||||||
|
*
|
||||||
|
* @param id 藏品主键
|
||||||
|
* @return 藏品
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Relic selectRelicById(Long id) {
|
||||||
|
Relic relic = relicMapper.selectRelicById(id);
|
||||||
|
// 如果登录用户信息不为空,查询收藏数据
|
||||||
|
if (SecurityUtils.getCurrentUser() != null && SecurityUtils.getCurrentUser().getId() != null) {
|
||||||
|
ItemCollection itemCollection = new ItemCollection();
|
||||||
|
itemCollection.setItemId(id);
|
||||||
|
itemCollection.setUserId(SecurityUtils.getCurrentUser().getId());
|
||||||
|
relic.setItemCollections(itemCollectionMapper.selectItemCollectionList(itemCollection));
|
||||||
|
}
|
||||||
|
return relic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增藏品
|
||||||
|
*
|
||||||
|
* @param relic 藏品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertRelic(Relic relic) {
|
||||||
|
relic.setCreateTime(new Date());
|
||||||
|
relic.setCreator(SecurityUtils.getCurrentUser().getId());
|
||||||
|
return relicMapper.insertRelic(relic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改藏品
|
||||||
|
*
|
||||||
|
* @param relic 藏品
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateRelic(Relic relic) {
|
||||||
|
relic.setUpdateTime(new Date());
|
||||||
|
relic.setUpdater(SecurityUtils.getCurrentUser().getId());
|
||||||
|
return relicMapper.updateRelic(relic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除藏品信息
|
||||||
|
*
|
||||||
|
* @param id 藏品主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteRelicById(Long id) {
|
||||||
|
return relicMapper.deleteRelicById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,168 @@
|
||||||
|
package com.amms.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import com.amms.mapper.ReservationMapper;
|
||||||
|
import com.amms.domain.Reservation;
|
||||||
|
import com.amms.service.IReservationService;
|
||||||
|
import com.amms.service.IReservationVisitorService;
|
||||||
|
import com.amms.domain.ReservationVisitor;
|
||||||
|
import com.amms.security.SecurityUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约Service业务层处理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ReservationServiceImpl implements IReservationService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReservationMapper reservationMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IReservationVisitorService reservationVisitorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预约列表
|
||||||
|
*
|
||||||
|
* @param reservation 预约
|
||||||
|
* @return 预约
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Reservation> selectReservationList(Reservation reservation) {
|
||||||
|
return reservationMapper.selectReservationList(reservation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预约
|
||||||
|
*
|
||||||
|
* @param id 预约主键
|
||||||
|
* @return 预约
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Reservation selectReservationById(Long id) {
|
||||||
|
return reservationMapper.selectReservationById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预约
|
||||||
|
*
|
||||||
|
* 1. 写入预约主表(设置 createTime)
|
||||||
|
* 2. 若携带 reservationVisitors,则同步逐一写入游客明细,并对齐 totalVisitors
|
||||||
|
* 3. 使用事务保证主表与明细写入的原子性
|
||||||
|
*
|
||||||
|
* @param reservation 预约
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int insertReservation(Reservation reservation) {
|
||||||
|
reservation.setCreateTime(new Date());
|
||||||
|
// 根据游客列表数量自动对齐整单人数
|
||||||
|
if (reservation.getReservationVisitors() != null) {
|
||||||
|
reservation.setTotalVisitors(reservation.getReservationVisitors().size());
|
||||||
|
}
|
||||||
|
int rows = reservationMapper.insertReservation(reservation);
|
||||||
|
if (rows > 0 && reservation.getReservationVisitors() != null) {
|
||||||
|
Long reservationId = reservation.getId();
|
||||||
|
// 逐一插入游客明细,绑定预约ID
|
||||||
|
for (ReservationVisitor v : reservation.getReservationVisitors()) {
|
||||||
|
v.setReservationId(reservationId);
|
||||||
|
reservationVisitorService.insertReservationVisitor(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预约
|
||||||
|
*
|
||||||
|
* @param reservation 预约
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateReservation(Reservation reservation) {
|
||||||
|
reservation.setUpdateTime(new Date());
|
||||||
|
reservation.setUpdater(SecurityUtils.getCurrentUser().getId());
|
||||||
|
return reservationMapper.updateReservation(reservation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预约信息
|
||||||
|
*
|
||||||
|
* @param id 预约主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteReservationById(Long id) {
|
||||||
|
return reservationMapper.deleteReservationById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核预约(通过/驳回)
|
||||||
|
*
|
||||||
|
* 审核通过时:
|
||||||
|
* 1)生成整单核验二维码链接写入 Reservation.qrCode
|
||||||
|
* 2)为每位游客生成个人核验二维码链接写入 ReservationVisitor.visitorQrCode
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public int auditReservation(Reservation reservation) {
|
||||||
|
if (reservation == null || reservation.getId() == null || reservation.getStatus() == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Long reservationId = reservation.getId();
|
||||||
|
|
||||||
|
// 审核通过:生成整单核验二维码链接
|
||||||
|
if (Long.valueOf(1).equals(reservation.getStatus())) {
|
||||||
|
String orderQr = "/reservation/verifyAll/" + reservationId;
|
||||||
|
reservation.setQrCode(orderQr);
|
||||||
|
|
||||||
|
// 为每位游客生成个人核验二维码链接
|
||||||
|
ReservationVisitor query = new ReservationVisitor();
|
||||||
|
query.setReservationId(reservationId);
|
||||||
|
List<ReservationVisitor> visitors = reservationVisitorService.selectReservationVisitorList(query);
|
||||||
|
for (ReservationVisitor v : visitors) {
|
||||||
|
String visitorQr = "/reservation/verifyVisitor/" + v.getId();
|
||||||
|
v.setVisitorQrCode(visitorQr);
|
||||||
|
reservationVisitorService.updateReservationVisitor(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reservation.setUpdateTime(new Date());
|
||||||
|
reservation.setUpdater(SecurityUtils.getCurrentUser().getId());
|
||||||
|
return reservationMapper.updateReservation(reservation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整单核验:将该预约下所有游客核验状态置为1
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public int verifyAllVisitors(Long reservationId) {
|
||||||
|
ReservationVisitor query = new ReservationVisitor();
|
||||||
|
query.setReservationId(reservationId);
|
||||||
|
List<ReservationVisitor> visitors = reservationVisitorService.selectReservationVisitorList(query);
|
||||||
|
Date now = new Date();
|
||||||
|
int cnt = 0;
|
||||||
|
for (ReservationVisitor v : visitors) {
|
||||||
|
v.setVerifyStatus(1L);
|
||||||
|
v.setVerifyTime(now);
|
||||||
|
cnt += reservationVisitorService.updateReservationVisitor(v);
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游客个人核验:将该游客核验状态置为1
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public int verifyVisitor(Long visitorId) {
|
||||||
|
ReservationVisitor v = reservationVisitorService.selectReservationVisitorById(visitorId);
|
||||||
|
if (v == null) return 0;
|
||||||
|
v.setVerifyStatus(1L);
|
||||||
|
v.setVerifyTime(new Date());
|
||||||
|
return reservationVisitorService.updateReservationVisitor(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,139 @@
|
||||||
|
package com.amms.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.amms.mapper.ReservationTimeSlotMapper;
|
||||||
|
import com.amms.domain.ReservationTimeSlot;
|
||||||
|
import com.amms.service.IReservationTimeSlotService;
|
||||||
|
import com.amms.security.SecurityUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约时段Service业务层处理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ReservationTimeSlotServiceImpl implements IReservationTimeSlotService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReservationTimeSlotMapper reservationTimeSlotMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预约时段列表
|
||||||
|
*
|
||||||
|
* @param reservationTimeSlot 预约时段
|
||||||
|
* @return 预约时段
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ReservationTimeSlot> selectReservationTimeSlotList(ReservationTimeSlot reservationTimeSlot) {
|
||||||
|
return reservationTimeSlotMapper.selectReservationTimeSlotList(reservationTimeSlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预约时段
|
||||||
|
*
|
||||||
|
* @param id 预约时段主键
|
||||||
|
* @return 预约时段
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ReservationTimeSlot selectReservationTimeSlotById(Long id) {
|
||||||
|
return reservationTimeSlotMapper.selectReservationTimeSlotById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预约时段
|
||||||
|
*
|
||||||
|
* @param reservationTimeSlot 预约时段
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertReservationTimeSlot(ReservationTimeSlot reservationTimeSlot) {
|
||||||
|
reservationTimeSlot.setCreateTime(new Date());
|
||||||
|
reservationTimeSlot.setCreator(SecurityUtils.getCurrentUser().getId());
|
||||||
|
return reservationTimeSlotMapper.insertReservationTimeSlot(reservationTimeSlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预约时段
|
||||||
|
*
|
||||||
|
* @param reservationTimeSlot 预约时段
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateReservationTimeSlot(ReservationTimeSlot reservationTimeSlot) {
|
||||||
|
return reservationTimeSlotMapper.updateReservationTimeSlot(reservationTimeSlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int batchInsertReservationTimeSlots(Date startDate, Date endDate, Date startTime, Date endTime, Integer maxPeople, Long status) {
|
||||||
|
if (startDate == null || endDate == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(startDate);
|
||||||
|
Long creator = SecurityUtils.getCurrentUser().getId();
|
||||||
|
Calendar calStart = Calendar.getInstance();
|
||||||
|
Calendar calEnd = Calendar.getInstance();
|
||||||
|
if (startTime != null) calStart.setTime(startTime);
|
||||||
|
if (endTime != null) calEnd.setTime(endTime);
|
||||||
|
while (!cal.getTime().after(endDate)) {
|
||||||
|
Calendar dayStart = (Calendar) cal.clone();
|
||||||
|
dayStart.set(Calendar.HOUR_OF_DAY, calStart.get(Calendar.HOUR_OF_DAY));
|
||||||
|
dayStart.set(Calendar.MINUTE, calStart.get(Calendar.MINUTE));
|
||||||
|
dayStart.set(Calendar.SECOND, calStart.get(Calendar.SECOND));
|
||||||
|
dayStart.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
Calendar dayEnd = (Calendar) cal.clone();
|
||||||
|
dayEnd.set(Calendar.HOUR_OF_DAY, calEnd.get(Calendar.HOUR_OF_DAY));
|
||||||
|
dayEnd.set(Calendar.MINUTE, calEnd.get(Calendar.MINUTE));
|
||||||
|
dayEnd.set(Calendar.SECOND, calEnd.get(Calendar.SECOND));
|
||||||
|
dayEnd.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
Date startDt = dayStart.getTime();
|
||||||
|
Date endDt = dayEnd.getTime();
|
||||||
|
|
||||||
|
ReservationTimeSlot query = new ReservationTimeSlot();
|
||||||
|
query.setDate(cal.getTime());
|
||||||
|
List<ReservationTimeSlot> existing = reservationTimeSlotMapper.selectReservationTimeSlotList(query);
|
||||||
|
|
||||||
|
if (existing != null && !existing.isEmpty()) {
|
||||||
|
ReservationTimeSlot slot = new ReservationTimeSlot();
|
||||||
|
slot.setId(existing.get(0).getId());
|
||||||
|
slot.setDate(cal.getTime());
|
||||||
|
slot.setStartTime(startDt);
|
||||||
|
slot.setEndTime(endDt);
|
||||||
|
slot.setMaxPeople(maxPeople);
|
||||||
|
slot.setStatus(status);
|
||||||
|
count += reservationTimeSlotMapper.updateReservationTimeSlot(slot);
|
||||||
|
} else {
|
||||||
|
ReservationTimeSlot slot = new ReservationTimeSlot();
|
||||||
|
slot.setDate(cal.getTime());
|
||||||
|
slot.setStartTime(startDt);
|
||||||
|
slot.setEndTime(endDt);
|
||||||
|
slot.setMaxPeople(maxPeople);
|
||||||
|
slot.setCurrentPeople(0);
|
||||||
|
slot.setStatus(status);
|
||||||
|
slot.setCreateTime(new Date());
|
||||||
|
slot.setCreator(creator);
|
||||||
|
count += reservationTimeSlotMapper.insertReservationTimeSlot(slot);
|
||||||
|
}
|
||||||
|
cal.add(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预约时段信息
|
||||||
|
*
|
||||||
|
* @param id 预约时段主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteReservationTimeSlotById(Long id) {
|
||||||
|
return reservationTimeSlotMapper.deleteReservationTimeSlotById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.amms.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.amms.mapper.ReservationVisitorMapper;
|
||||||
|
import com.amms.domain.ReservationVisitor;
|
||||||
|
import com.amms.service.IReservationVisitorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游客预约明细Service业务层处理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ReservationVisitorServiceImpl implements IReservationVisitorService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReservationVisitorMapper reservationVisitorMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询游客预约明细列表
|
||||||
|
*
|
||||||
|
* @param reservationVisitor 游客预约明细
|
||||||
|
* @return 游客预约明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ReservationVisitor> selectReservationVisitorList(ReservationVisitor reservationVisitor) {
|
||||||
|
return reservationVisitorMapper.selectReservationVisitorList(reservationVisitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询游客预约明细
|
||||||
|
*
|
||||||
|
* @param id 游客预约明细主键
|
||||||
|
* @return 游客预约明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ReservationVisitor selectReservationVisitorById(Long id) {
|
||||||
|
return reservationVisitorMapper.selectReservationVisitorById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增游客预约明细
|
||||||
|
*
|
||||||
|
* @param reservationVisitor 游客预约明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertReservationVisitor(ReservationVisitor reservationVisitor) {
|
||||||
|
return reservationVisitorMapper.insertReservationVisitor(reservationVisitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改游客预约明细
|
||||||
|
*
|
||||||
|
* @param reservationVisitor 游客预约明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateReservationVisitor(ReservationVisitor reservationVisitor) {
|
||||||
|
return reservationVisitorMapper.updateReservationVisitor(reservationVisitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除游客预约明细信息
|
||||||
|
*
|
||||||
|
* @param id 游客预约明细主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteReservationVisitorById(Long id) {
|
||||||
|
return reservationVisitorMapper.deleteReservationVisitorById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteReservationVisitorsByReservationId(Long reservationId) {
|
||||||
|
// 根据预约ID批量删除其下所有游客明细记录
|
||||||
|
return reservationVisitorMapper.deleteReservationVisitorsByReservationId(reservationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,197 @@
|
||||||
|
package com.amms.service.impl;
|
||||||
|
|
||||||
|
import com.amms.domain.SysUser;
|
||||||
|
import com.amms.domain.dto.LoginParam;
|
||||||
|
import com.amms.domain.vo.Result;
|
||||||
|
import com.amms.mapper.SysUserMapper;
|
||||||
|
import com.amms.mapper.TouristMapper;
|
||||||
|
import com.amms.security.JwtUtils;
|
||||||
|
import com.amms.service.ISysUserService;
|
||||||
|
import com.amms.util.RedisUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.AuthenticationException;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.amms.security.SecurityUtils;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SysUserServiceImpl implements ISysUserService {
|
||||||
|
|
||||||
|
private Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AuthenticationManager authenticationManager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JwtUtils jwtUtils;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisUtils redisUtils;
|
||||||
|
|
||||||
|
@Value("${token.expireTime}")
|
||||||
|
private Long expireTime;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TouristMapper touristMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录方法
|
||||||
|
* @param loginParam 登录参数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result login(LoginParam loginParam) {
|
||||||
|
UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken =
|
||||||
|
new UsernamePasswordAuthenticationToken(loginParam.getUsername(), loginParam.getPassword());
|
||||||
|
|
||||||
|
Authentication authenticate = null;
|
||||||
|
try {
|
||||||
|
authenticate = authenticationManager.authenticate(usernamePasswordAuthenticationToken);
|
||||||
|
} catch (AuthenticationException e) {
|
||||||
|
log.error("异常", e);
|
||||||
|
log.error("用户名或密码错误==>{}", loginParam);
|
||||||
|
return Result.error("用户名或密码错误!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 认证通过后,获取到登录的用户信息
|
||||||
|
Object principal = authenticate.getPrincipal();
|
||||||
|
SysUser loginUser = (SysUser) principal;
|
||||||
|
if (loginUser == null) {
|
||||||
|
return Result.error("用户名或密码错误!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成token,保存到redis中,并返回给前端token的id
|
||||||
|
String tokenId = UUID.randomUUID().toString();
|
||||||
|
|
||||||
|
// 将用户信息存储到redis中
|
||||||
|
redisUtils.set(tokenId, loginUser, expireTime, TimeUnit.MINUTES);
|
||||||
|
|
||||||
|
// 将tokenId通过JWT生成token,返回给前端
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("tokenId", tokenId);
|
||||||
|
|
||||||
|
String token = jwtUtils.createToken(map);
|
||||||
|
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
resultMap.put("token", token);
|
||||||
|
loginUser.setPassword(null);
|
||||||
|
resultMap.put("user", loginUser);
|
||||||
|
|
||||||
|
return Result.success("登录成功!", resultMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户列表
|
||||||
|
*
|
||||||
|
* @param sysUser 用户
|
||||||
|
* @return 用户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysUser> selectSysUserList(SysUser sysUser) {
|
||||||
|
return sysUserMapper.selectSysUserList(sysUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户
|
||||||
|
*
|
||||||
|
* @param username 用户
|
||||||
|
* @return 用户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUser selectByUsername(String username) {
|
||||||
|
return sysUserMapper.selectByUsername(username);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户详情
|
||||||
|
*
|
||||||
|
* @param id 用户
|
||||||
|
* @return 用户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUser selectById(Long id) {
|
||||||
|
return sysUserMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*
|
||||||
|
* @param sysUser 用户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSysUser(SysUser sysUser) {
|
||||||
|
// 添加创建时间
|
||||||
|
sysUser.setCreateTime(new Date());
|
||||||
|
// 添加创建人
|
||||||
|
sysUser.setCreator(SecurityUtils.getCurrentUser().getId());
|
||||||
|
return sysUserMapper.insertSysUser(sysUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*
|
||||||
|
* @param sysUser 用户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSysUser(SysUser sysUser) {
|
||||||
|
sysUser.setUpdateTime(new Date());
|
||||||
|
sysUser.setUpdater(SecurityUtils.getCurrentUser().getId());
|
||||||
|
int i = sysUserMapper.updateSysUser(sysUser);
|
||||||
|
|
||||||
|
if (i > 0) { // 如果修改成功,将redis中的用户信息和Security中的用户信息都更新
|
||||||
|
// 将用户信息放到SecurityContext中
|
||||||
|
SysUser fresh = sysUserMapper.selectById(sysUser.getId());
|
||||||
|
UsernamePasswordAuthenticationToken authentication =
|
||||||
|
new UsernamePasswordAuthenticationToken(fresh, null, null);
|
||||||
|
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int registerTourist(SysUser sysUser) {
|
||||||
|
sysUser.setCreateTime(new Date());
|
||||||
|
if (sysUser.getStatus() == null) sysUser.setStatus(0);
|
||||||
|
if (sysUser.getRole() == null) sysUser.setRole("2");
|
||||||
|
if (sysUser.getPassword() != null) {
|
||||||
|
sysUser.setPassword(passwordEncoder.encode(sysUser.getPassword()));
|
||||||
|
}
|
||||||
|
int i = sysUserMapper.insertSysUser(sysUser);
|
||||||
|
if (i > 0 && sysUser.getTourist() != null) {
|
||||||
|
sysUser.getTourist().setId(sysUser.getId());
|
||||||
|
return touristMapper.insertTourist(sysUser.getTourist()) > 0 ? 1 : 0;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*
|
||||||
|
* @param id 用户主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSysUserById(Long id) {
|
||||||
|
return sysUserMapper.deleteSysUserById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.amms.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.amms.mapper.TouristMapper;
|
||||||
|
import com.amms.domain.Tourist;
|
||||||
|
import com.amms.service.ITouristService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通用户子Service业务层处理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TouristServiceImpl implements ITouristService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TouristMapper touristMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询普通用户子列表
|
||||||
|
*
|
||||||
|
* @param tourist 普通用户子
|
||||||
|
* @return 普通用户子
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Tourist> selectTouristList(Tourist tourist) {
|
||||||
|
return touristMapper.selectTouristList(tourist);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询普通用户子
|
||||||
|
*
|
||||||
|
* @param id 普通用户子主键
|
||||||
|
* @return 普通用户子
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Tourist selectTouristById(Long id) {
|
||||||
|
return touristMapper.selectTouristById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增普通用户子
|
||||||
|
*
|
||||||
|
* @param tourist 普通用户子
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertTourist(Tourist tourist) {
|
||||||
|
return touristMapper.insertTourist(tourist);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改普通用户子
|
||||||
|
*
|
||||||
|
* @param tourist 普通用户子
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateTourist(Tourist tourist) {
|
||||||
|
tourist.setUpdateTime(new Date());
|
||||||
|
return touristMapper.updateTourist(tourist);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除普通用户子信息
|
||||||
|
*
|
||||||
|
* @param id 普通用户子主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteTouristById(Long id) {
|
||||||
|
return touristMapper.deleteTouristById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.amms.util;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class RedisUtils {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
public void set(String key, String value) {
|
||||||
|
redisTemplate.opsForValue().set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(String key, Object value, long timeout, TimeUnit unit) {
|
||||||
|
redisTemplate.opsForValue().set(key, value, timeout, unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T get(String key, Class<T> valueType) throws JsonProcessingException {
|
||||||
|
Object o = redisTemplate.opsForValue().get(key);
|
||||||
|
String s = JsonUtils.toJson(o);
|
||||||
|
return JsonUtils.fromJson(s, valueType);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?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.amms.mapper.MuseumIntroMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.amms.domain.MuseumIntro" id="MuseumIntroResult">
|
||||||
|
<result property="museumName" column="museum_name" />
|
||||||
|
<result property="content" column="content" />
|
||||||
|
<result property="logoUrl" column="logo_url" />
|
||||||
|
<result property="address" column="address" />
|
||||||
|
<result property="phone" column="phone" />
|
||||||
|
<result property="openTime" column="open_time" />
|
||||||
|
<result property="closeTime" column="close_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updater" column="updater" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectMuseumIntroVo">
|
||||||
|
select museum_name, content, logo_url, address, phone, open_time, close_time, update_time, updater from museum_intro
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectMuseumIntroList" parameterType="com.amms.domain.MuseumIntro" resultMap="MuseumIntroResult">
|
||||||
|
<include refid="selectMuseumIntroVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||||
|
<if test="logoUrl != null and logoUrl != ''"> and logo_url = #{logoUrl}</if>
|
||||||
|
<if test="address != null and address != ''"> and address = #{address}</if>
|
||||||
|
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||||
|
<if test="openTime != null "> and open_time = #{openTime}</if>
|
||||||
|
<if test="closeTime != null "> and close_time = #{closeTime}</if>
|
||||||
|
<if test="updater != null "> and updater = #{updater}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMuseumIntroByMuseumName" parameterType="String" resultMap="MuseumIntroResult">
|
||||||
|
<include refid="selectMuseumIntroVo"/>
|
||||||
|
where museum_name = #{museumName}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertMuseumIntro" parameterType="com.amms.domain.MuseumIntro">
|
||||||
|
insert into museum_intro
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="museumName != null">museum_name,</if>
|
||||||
|
<if test="content != null and content != ''">content,</if>
|
||||||
|
<if test="logoUrl != null">logo_url,</if>
|
||||||
|
<if test="address != null">address,</if>
|
||||||
|
<if test="phone != null">phone,</if>
|
||||||
|
<if test="openTime != null">open_time,</if>
|
||||||
|
<if test="closeTime != null">close_time,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="updater != null">updater,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="museumName != null">#{museumName},</if>
|
||||||
|
<if test="content != null and content != ''">#{content},</if>
|
||||||
|
<if test="logoUrl != null">#{logoUrl},</if>
|
||||||
|
<if test="address != null">#{address},</if>
|
||||||
|
<if test="phone != null">#{phone},</if>
|
||||||
|
<if test="openTime != null">#{openTime},</if>
|
||||||
|
<if test="closeTime != null">#{closeTime},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="updater != null">#{updater},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateMuseumIntro" parameterType="com.amms.domain.MuseumIntro">
|
||||||
|
update museum_intro
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="content != null and content != ''">content = #{content},</if>
|
||||||
|
<if test="logoUrl != null">logo_url = #{logoUrl},</if>
|
||||||
|
<if test="address != null">address = #{address},</if>
|
||||||
|
<if test="phone != null">phone = #{phone},</if>
|
||||||
|
<if test="openTime != null">open_time = #{openTime},</if>
|
||||||
|
<if test="closeTime != null">close_time = #{closeTime},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="updater != null">updater = #{updater},</if>
|
||||||
|
</trim>
|
||||||
|
where museum_name = #{museumName}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteMuseumIntroByMuseumName" parameterType="String">
|
||||||
|
delete from museum_intro where museum_name = #{museumName}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
<?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.amms.mapper.RelicMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.amms.domain.Relic" id="RelicResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="categoryId" column="category_id" />
|
||||||
|
<result property="coverImageUrl" column="cover_image_url" />
|
||||||
|
<result property="age" column="age" />
|
||||||
|
<result property="material" column="material" />
|
||||||
|
<result property="excavationInfo" column="excavation_info" />
|
||||||
|
<result property="story" column="story" />
|
||||||
|
<result property="modelUrl" column="model_url" />
|
||||||
|
<result property="isHot" column="is_hot" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="creator" column="creator" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updater" column="updater" />
|
||||||
|
<association property="categoryInfo" column="category_id" select="com.amms.mapper.ItemCategoryMapper.selectItemCategoryById"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectRelicVo">
|
||||||
|
select id, name, category_id, cover_image_url, age, material, excavation_info, story, model_url, is_hot, status, create_time, creator, update_time, updater from relic
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectRelicList" parameterType="com.amms.domain.Relic" resultMap="RelicResult">
|
||||||
|
<include refid="selectRelicVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
||||||
|
<if test="coverImageUrl != null and coverImageUrl != ''"> and cover_image_url = #{coverImageUrl}</if>
|
||||||
|
<if test="age != null and age != ''"> and age = #{age}</if>
|
||||||
|
<if test="material != null and material != ''"> and material = #{material}</if>
|
||||||
|
<if test="excavationInfo != null and excavationInfo != ''"> and excavation_info = #{excavationInfo}</if>
|
||||||
|
<if test="story != null and story != ''"> and story = #{story}</if>
|
||||||
|
<if test="modelUrl != null and modelUrl != ''"> and model_url = #{modelUrl}</if>
|
||||||
|
<if test="isHot != null "> and is_hot = #{isHot}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
<if test="creator != null "> and creator = #{creator}</if>
|
||||||
|
<if test="updater != null "> and updater = #{updater}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRelicById" parameterType="Long" resultMap="RelicResult">
|
||||||
|
<include refid="selectRelicVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertRelic" parameterType="com.amms.domain.Relic" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into relic
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="name != null and name != ''">name,</if>
|
||||||
|
<if test="categoryId != null">category_id,</if>
|
||||||
|
<if test="coverImageUrl != null and coverImageUrl != ''">cover_image_url,</if>
|
||||||
|
<if test="age != null">age,</if>
|
||||||
|
<if test="material != null">material,</if>
|
||||||
|
<if test="excavationInfo != null">excavation_info,</if>
|
||||||
|
<if test="story != null">story,</if>
|
||||||
|
<if test="modelUrl != null">model_url,</if>
|
||||||
|
<if test="isHot != null">is_hot,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="creator != null">creator,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="updater != null">updater,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
|
<if test="categoryId != null">#{categoryId},</if>
|
||||||
|
<if test="coverImageUrl != null and coverImageUrl != ''">#{coverImageUrl},</if>
|
||||||
|
<if test="age != null">#{age},</if>
|
||||||
|
<if test="material != null">#{material},</if>
|
||||||
|
<if test="excavationInfo != null">#{excavationInfo},</if>
|
||||||
|
<if test="story != null">#{story},</if>
|
||||||
|
<if test="modelUrl != null">#{modelUrl},</if>
|
||||||
|
<if test="isHot != null">#{isHot},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="creator != null">#{creator},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="updater != null">#{updater},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateRelic" parameterType="com.amms.domain.Relic">
|
||||||
|
update relic
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="name != null and name != ''">name = #{name},</if>
|
||||||
|
<if test="categoryId != null">category_id = #{categoryId},</if>
|
||||||
|
<if test="coverImageUrl != null and coverImageUrl != ''">cover_image_url = #{coverImageUrl},</if>
|
||||||
|
<if test="age != null">age = #{age},</if>
|
||||||
|
<if test="material != null">material = #{material},</if>
|
||||||
|
<if test="excavationInfo != null">excavation_info = #{excavationInfo},</if>
|
||||||
|
<if test="story != null">story = #{story},</if>
|
||||||
|
<if test="modelUrl != null">model_url = #{modelUrl},</if>
|
||||||
|
<if test="isHot != null">is_hot = #{isHot},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="creator != null">creator = #{creator},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="updater != null">updater = #{updater},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteRelicById" parameterType="Long">
|
||||||
|
delete from relic where id = #{id}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
<?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.amms.mapper.ReservationMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.amms.domain.Reservation" id="ReservationResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="username" column="username" />
|
||||||
|
<result property="nickname" column="nickname" />
|
||||||
|
<result property="timeSlotId" column="time_slot_id" />
|
||||||
|
<result property="totalVisitors" column="total_visitors" />
|
||||||
|
<result property="reserveTime" column="reserve_time" />
|
||||||
|
<result property="qrCode" column="qr_code" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updater" column="updater" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<association property="reservationTimeSlot" column="time_slot_id" select="com.amms.mapper.ReservationTimeSlotMapper.selectReservationTimeSlotById"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectReservationVo">
|
||||||
|
select r.id,
|
||||||
|
r.user_id,
|
||||||
|
u.username as username,
|
||||||
|
u.nickname as nickname,
|
||||||
|
r.time_slot_id,
|
||||||
|
r.total_visitors,
|
||||||
|
r.reserve_time,
|
||||||
|
r.qr_code,
|
||||||
|
r.status,
|
||||||
|
r.create_time,
|
||||||
|
r.update_time,
|
||||||
|
r.updater,
|
||||||
|
r.remark
|
||||||
|
from reservation r
|
||||||
|
left join sys_user u on r.user_id = u.id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectReservationList" parameterType="com.amms.domain.Reservation" resultMap="ReservationResult">
|
||||||
|
<include refid="selectReservationVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="userId != null "> and r.user_id = #{userId}</if>
|
||||||
|
<if test="username != null and username != ''"> and u.username like concat('%', #{username}, '%')</if>
|
||||||
|
<if test="nickname != null and nickname != ''"> and u.nickname like concat('%', #{nickname}, '%')</if>
|
||||||
|
<if test="timeSlotId != null "> and r.time_slot_id = #{timeSlotId}</if>
|
||||||
|
<if test="totalVisitors != null "> and r.total_visitors = #{totalVisitors}</if>
|
||||||
|
<if test="reserveTime != null "> and r.reserve_time = #{reserveTime}</if>
|
||||||
|
<if test="qrCode != null and qrCode != ''"> and r.qr_code = #{qrCode}</if>
|
||||||
|
<if test="status != null "> and r.status = #{status}</if>
|
||||||
|
<if test="updater != null "> and r.updater = #{updater}</if>
|
||||||
|
<if test="startDate != null">
|
||||||
|
and exists (
|
||||||
|
select 1 from reservation_time_slot ts
|
||||||
|
where ts.id = r.time_slot_id and ts.date <![CDATA[ >= ]]> #{startDate}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null">
|
||||||
|
and exists (
|
||||||
|
select 1 from reservation_time_slot ts
|
||||||
|
where ts.id = r.time_slot_id and ts.date <![CDATA[ <= ]]> #{endDate}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectReservationById" parameterType="Long" resultMap="ReservationResult">
|
||||||
|
<include refid="selectReservationVo"/>
|
||||||
|
where r.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertReservation" parameterType="com.amms.domain.Reservation" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into reservation
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="timeSlotId != null">time_slot_id,</if>
|
||||||
|
<if test="totalVisitors != null">total_visitors,</if>
|
||||||
|
<if test="reserveTime != null">reserve_time,</if>
|
||||||
|
<if test="qrCode != null">qr_code,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="updater != null">updater,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="timeSlotId != null">#{timeSlotId},</if>
|
||||||
|
<if test="totalVisitors != null">#{totalVisitors},</if>
|
||||||
|
<if test="reserveTime != null">#{reserveTime},</if>
|
||||||
|
<if test="qrCode != null">#{qrCode},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="updater != null">#{updater},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateReservation" parameterType="com.amms.domain.Reservation">
|
||||||
|
update reservation
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="timeSlotId != null">time_slot_id = #{timeSlotId},</if>
|
||||||
|
<if test="totalVisitors != null">total_visitors = #{totalVisitors},</if>
|
||||||
|
<if test="reserveTime != null">reserve_time = #{reserveTime},</if>
|
||||||
|
<if test="qrCode != null">qr_code = #{qrCode},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="updater != null">updater = #{updater},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteReservationById" parameterType="Long">
|
||||||
|
delete from reservation where id = #{id}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?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.amms.mapper.ReservationTimeSlotMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.amms.domain.ReservationTimeSlot" id="ReservationTimeSlotResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="date" column="date" />
|
||||||
|
<result property="startTime" column="start_time" />
|
||||||
|
<result property="endTime" column="end_time" />
|
||||||
|
<result property="maxPeople" column="max_people" />
|
||||||
|
<result property="currentPeople" column="current_people" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="creator" column="creator" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectReservationTimeSlotVo">
|
||||||
|
select id, date, start_time, end_time, max_people, current_people, status, create_time, creator from reservation_time_slot
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectReservationTimeSlotList" parameterType="com.amms.domain.ReservationTimeSlot" resultMap="ReservationTimeSlotResult">
|
||||||
|
<include refid="selectReservationTimeSlotVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="date != null "> and date = #{date}</if>
|
||||||
|
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||||
|
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||||
|
<if test="maxPeople != null "> and max_people = #{maxPeople}</if>
|
||||||
|
<if test="currentPeople != null "> and current_people = #{currentPeople}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
<if test="creator != null "> and creator = #{creator}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectReservationTimeSlotById" parameterType="Long" resultMap="ReservationTimeSlotResult">
|
||||||
|
<include refid="selectReservationTimeSlotVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertReservationTimeSlot" parameterType="com.amms.domain.ReservationTimeSlot" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into reservation_time_slot
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="date != null">date,</if>
|
||||||
|
<if test="startTime != null">start_time,</if>
|
||||||
|
<if test="endTime != null">end_time,</if>
|
||||||
|
<if test="maxPeople != null">max_people,</if>
|
||||||
|
<if test="currentPeople != null">current_people,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="creator != null">creator,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="date != null">#{date},</if>
|
||||||
|
<if test="startTime != null">#{startTime,jdbcType=TIME},</if>
|
||||||
|
<if test="endTime != null">#{endTime,jdbcType=TIME},</if>
|
||||||
|
<if test="maxPeople != null">#{maxPeople},</if>
|
||||||
|
<if test="currentPeople != null">#{currentPeople},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="creator != null">#{creator},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="batchInsertReservationTimeSlots" parameterType="java.util.List">
|
||||||
|
insert into reservation_time_slot (date, start_time, end_time, max_people, current_people, status, create_time, creator)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(#{item.date,jdbcType=DATE}, #{item.startTime,jdbcType=TIME}, #{item.endTime,jdbcType=TIME}, #{item.maxPeople}, #{item.currentPeople}, #{item.status}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.creator})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateReservationTimeSlot" parameterType="com.amms.domain.ReservationTimeSlot">
|
||||||
|
update reservation_time_slot
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="date != null">date = #{date},</if>
|
||||||
|
<if test="startTime != null">start_time = #{startTime,jdbcType=TIME},</if>
|
||||||
|
<if test="endTime != null">end_time = #{endTime,jdbcType=TIME},</if>
|
||||||
|
<if test="maxPeople != null">max_people = #{maxPeople},</if>
|
||||||
|
<if test="currentPeople != null">current_people = #{currentPeople},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="creator != null">creator = #{creator},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteReservationTimeSlotById" parameterType="Long">
|
||||||
|
delete from reservation_time_slot where id = #{id}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?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.amms.mapper.ReservationVisitorMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.amms.domain.ReservationVisitor" id="ReservationVisitorResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="reservationId" column="reservation_id" />
|
||||||
|
<result property="realName" column="real_name" />
|
||||||
|
<result property="idCard" column="id_card" />
|
||||||
|
<result property="phone" column="phone" />
|
||||||
|
<result property="visitorQrCode" column="visitor_qr_code" />
|
||||||
|
<result property="verifyStatus" column="verify_status" />
|
||||||
|
<result property="verifyTime" column="verify_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectReservationVisitorVo">
|
||||||
|
select id, reservation_id, real_name, id_card, phone, visitor_qr_code, verify_status, verify_time from reservation_visitor
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectReservationVisitorList" parameterType="com.amms.domain.ReservationVisitor" resultMap="ReservationVisitorResult">
|
||||||
|
<include refid="selectReservationVisitorVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="reservationId != null "> and reservation_id = #{reservationId}</if>
|
||||||
|
<if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
|
||||||
|
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
|
||||||
|
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||||
|
<if test="visitorQrCode != null and visitorQrCode != ''"> and visitor_qr_code = #{visitorQrCode}</if>
|
||||||
|
<if test="verifyStatus != null "> and verify_status = #{verifyStatus}</if>
|
||||||
|
<if test="verifyTime != null "> and verify_time = #{verifyTime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectReservationVisitorListByReserveId" parameterType="Long" resultMap="ReservationVisitorResult">
|
||||||
|
<include refid="selectReservationVisitorVo"/>
|
||||||
|
where reservation_id = #{reservationId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectReservationVisitorById" parameterType="Long" resultMap="ReservationVisitorResult">
|
||||||
|
<include refid="selectReservationVisitorVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertReservationVisitor" parameterType="com.amms.domain.ReservationVisitor" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into reservation_visitor
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="reservationId != null">reservation_id,</if>
|
||||||
|
<if test="realName != null and realName != ''">real_name,</if>
|
||||||
|
<if test="idCard != null and idCard != ''">id_card,</if>
|
||||||
|
<if test="phone != null and phone != ''">phone,</if>
|
||||||
|
<if test="visitorQrCode != null">visitor_qr_code,</if>
|
||||||
|
<if test="verifyStatus != null">verify_status,</if>
|
||||||
|
<if test="verifyTime != null">verify_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="reservationId != null">#{reservationId},</if>
|
||||||
|
<if test="realName != null and realName != ''">#{realName},</if>
|
||||||
|
<if test="idCard != null and idCard != ''">#{idCard},</if>
|
||||||
|
<if test="phone != null and phone != ''">#{phone},</if>
|
||||||
|
<if test="visitorQrCode != null">#{visitorQrCode},</if>
|
||||||
|
<if test="verifyStatus != null">#{verifyStatus},</if>
|
||||||
|
<if test="verifyTime != null">#{verifyTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateReservationVisitor" parameterType="com.amms.domain.ReservationVisitor">
|
||||||
|
update reservation_visitor
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="reservationId != null">reservation_id = #{reservationId},</if>
|
||||||
|
<if test="realName != null and realName != ''">real_name = #{realName},</if>
|
||||||
|
<if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
|
||||||
|
<if test="phone != null and phone != ''">phone = #{phone},</if>
|
||||||
|
<if test="visitorQrCode != null">visitor_qr_code = #{visitorQrCode},</if>
|
||||||
|
<if test="verifyStatus != null">verify_status = #{verifyStatus},</if>
|
||||||
|
<if test="verifyTime != null">verify_time = #{verifyTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteReservationVisitorById" parameterType="Long">
|
||||||
|
delete from reservation_visitor where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!-- 根据预约ID批量删除游客预约明细 -->
|
||||||
|
<delete id="deleteReservationVisitorsByReservationId" parameterType="Long">
|
||||||
|
delete from reservation_visitor where reservation_id = #{reservationId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
<?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.amms.mapper.SysUserMapper">
|
||||||
|
|
||||||
|
<resultMap id="SysUserResult" type="com.amms.domain.SysUser">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="username" property="username" />
|
||||||
|
<result column="nickname" property="nickname" />
|
||||||
|
<result column="avatar" property="avatar" />
|
||||||
|
<result column="password" property="password" />
|
||||||
|
<result column="status" property="status" />
|
||||||
|
<result column="role" property="role" />
|
||||||
|
<result column="creator" property="creator" />
|
||||||
|
<result column="create_time" property="createTime" />
|
||||||
|
<result column="updater" property="updater" />
|
||||||
|
<result column="update_time" property="updateTime" />
|
||||||
|
<result column="remark" property="remark" />
|
||||||
|
<result column="deleted" property="deleted" />
|
||||||
|
<association property="tourist" column="id" select="com.amms.mapper.TouristMapper.selectTouristById"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSql">
|
||||||
|
select id, username, nickname, avatar, password, status, role, creator, create_time, updater, update_time, remark, deleted from sys_user
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysUserList" parameterType="com.amms.domain.SysUser" resultMap="SysUserResult">
|
||||||
|
<include refid="selectSql" />
|
||||||
|
<where>
|
||||||
|
deleted != 1
|
||||||
|
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
|
||||||
|
<if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
|
||||||
|
<if test="role != null and role != ''"> and role = #{role}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByUsername" parameterType="String" resultMap="SysUserResult">
|
||||||
|
<include refid="selectSql" />
|
||||||
|
where username = #{username} and deleted != 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectById" parameterType="Long" resultMap="SysUserResult">
|
||||||
|
<include refid="selectSql" />
|
||||||
|
where id = #{id} and deleted != 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSysUser" parameterType="com.amms.domain.SysUser" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_user
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="username != null and username != ''">username,</if>
|
||||||
|
<if test="nickname != null and nickname != ''">nickname,</if>
|
||||||
|
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||||
|
<if test="password != null and password != ''">password,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="role != null and role != ''">role,</if>
|
||||||
|
<if test="creator != null">creator,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updater != null">updater,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="deleted != null">deleted,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="username != null and username != ''">#{username},</if>
|
||||||
|
<if test="nickname != null and nickname != ''">#{nickname},</if>
|
||||||
|
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||||
|
<if test="password != null and password != ''">#{password},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="role != null and role != ''">#{role},</if>
|
||||||
|
<if test="creator != null">#{creator},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updater != null">#{updater},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="deleted != null">#{deleted},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSysUser" parameterType="com.amms.domain.SysUser">
|
||||||
|
update sys_user
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="username != null and username != ''">username = #{username},</if>
|
||||||
|
<if test="nickname != null and nickname != ''">nickname = #{nickname},</if>
|
||||||
|
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||||
|
<if test="password != null and password != ''">password = #{password},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="role != null and role != ''">role = #{role},</if>
|
||||||
|
<if test="updater != null">updater = #{updater},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="deleted != null">deleted = #{deleted},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSysUserById" parameterType="Long">
|
||||||
|
delete from sys_user where id = #{id}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?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.amms.mapper.TouristMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.amms.domain.Tourist" id="TouristResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="realName" column="real_name" />
|
||||||
|
<result property="idCard" column="id_card" />
|
||||||
|
<result property="phone" column="phone" />
|
||||||
|
<result property="email" column="email" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectTouristVo">
|
||||||
|
select id, real_name, id_card, phone, email, update_time from tourist
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectTouristList" parameterType="com.amms.domain.Tourist" resultMap="TouristResult">
|
||||||
|
<include refid="selectTouristVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
|
||||||
|
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
|
||||||
|
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||||
|
<if test="email != null and email != ''"> and email = #{email}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTouristById" parameterType="Long" resultMap="TouristResult">
|
||||||
|
<include refid="selectTouristVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertTourist" parameterType="com.amms.domain.Tourist">
|
||||||
|
insert into tourist
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="realName != null">real_name,</if>
|
||||||
|
<if test="idCard != null">id_card,</if>
|
||||||
|
<if test="phone != null">phone,</if>
|
||||||
|
<if test="email != null">email,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="realName != null">#{realName},</if>
|
||||||
|
<if test="idCard != null">#{idCard},</if>
|
||||||
|
<if test="phone != null">#{phone},</if>
|
||||||
|
<if test="email != null">#{email},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateTourist" parameterType="com.amms.domain.Tourist">
|
||||||
|
update tourist
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="realName != null">real_name = #{realName},</if>
|
||||||
|
<if test="idCard != null">id_card = #{idCard},</if>
|
||||||
|
<if test="phone != null">phone = #{phone},</if>
|
||||||
|
<if test="email != null">email = #{email},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteTouristById" parameterType="Long">
|
||||||
|
delete from tourist where id = #{id}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE configuration
|
||||||
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
<configuration>
|
||||||
|
<!-- 全局参数 -->
|
||||||
|
<settings>
|
||||||
|
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||||
|
<setting name="cacheEnabled" value="true" />
|
||||||
|
<!-- 允许JDBC 支持自动生成主键 -->
|
||||||
|
<setting name="useGeneratedKeys" value="true" />
|
||||||
|
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||||
|
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||||
|
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||||
|
<setting name="logImpl" value="SLF4J" />
|
||||||
|
<!-- 使用驼峰命名法转换字段 -->
|
||||||
|
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||||
|
</settings>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
Loading…
Reference in New Issue