Commit bcf9ac9a authored by JiangSN's avatar JiangSN

缴存总览查询crud改为公共方法

parent 604ba8f5
...@@ -3,41 +3,39 @@ ...@@ -3,41 +3,39 @@
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('newVisitis')"> <div class="card-panel" @click="handleSetLineChartData('newVisitis')">
<div class="card-panel-icon-wrapper icon-people"> <div class="card-panel-icon-wrapper icon-people">
<!-- <svg-icon icon-class="peoples" class-name="card-panel-icon" />-->
<svg-icon icon-class="visits" class-name="card-panel-icon" /> <svg-icon icon-class="visits" class-name="card-panel-icon" />
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
接口访问总 每日访问
</div> </div>
<count-to :start-val="0" :end-val="102400" :duration="2600" class="card-panel-num" /> <count-to :start-val="0" :end-val="this.visits" :duration="2600" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('messages')"> <div class="card-panel" @click="handleSetLineChartData('messages')">
<div class="card-panel-icon-wrapper icon-message"> <div class="card-panel-icon-wrapper icon-people">
<!-- <svg-icon icon-class="message" class-name="card-panel-icon" />--> <svg-icon icon-class="visits" class-name="card-panel-icon" />
<svg-icon icon-class="tree" class-name="card-panel-icon"/>
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
任务调度 每月访问量
</div> </div>
<count-to :start-val="0" :end-val="81212" :duration="3000" class="card-panel-num" /> <count-to :start-val="0" :end-val="this.totalview" :duration="3000" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('purchases')"> <div class="card-panel" @click="handleSetLineChartData('purchases')">
<div class="card-panel-icon-wrapper icon-money"> <div class="card-panel-icon-wrapper icon-message">
<svg-icon icon-class="money" class-name="card-panel-icon" /> <svg-icon icon-class="tree" class-name="card-panel-icon"/>
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
Purchases 任务调度
</div> </div>
<count-to :start-val="0" :end-val="9280" :duration="3200" class="card-panel-num" /> <count-to :start-val="0" :end-val="'----'" :duration="3200" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
...@@ -48,9 +46,9 @@ ...@@ -48,9 +46,9 @@
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
Shoppings
</div> </div>
<count-to :start-val="0" :end-val="13600" :duration="3600" class="card-panel-num" /> <count-to :start-val="0" :end-val="'----'" :duration="3600" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
...@@ -61,6 +59,16 @@ ...@@ -61,6 +59,16 @@
import CountTo from 'vue-count-to' import CountTo from 'vue-count-to'
export default { export default {
props: {
visits: {
type: String,
default: 0
},
totalview: {
type: String,
default: 0
},
},
components: { components: {
CountTo CountTo
}, },
......
<template>
<div class="crud-opts">
<el-button-group class="crud-opts-right">
<el-button
size="mini"
plain
type="info"
icon="el-icon-search"
@click="toggleSearch()"
/>
<el-button
size="mini"
icon="el-icon-refresh"
@click="crud.refresh()"
/>
<el-popover
placement="bottom-end"
width="150"
trigger="click"
>
<el-button
slot="reference"
size="mini"
icon="el-icon-s-grid"
>
<i
class="fa fa-caret-down"
aria-hidden="true"
/>
</el-button>
<el-checkbox
v-model="allColumnsSelected"
:indeterminate="allColumnsSelectedIndeterminate"
@change="handleCheckAllChange"
>
全选
</el-checkbox>
<el-checkbox
v-for="item in tableColumns"
:key="item.property"
v-model="item.visible"
@change="handleCheckedTableColumnsChange(item)"
>
{{ item.label }}
</el-checkbox>
</el-popover>
</el-button-group>
</div>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
function sortWithRef(src, ref) {
const result = Object.assign([], ref)
let cursor = -1
src.forEach(e => {
const idx = result.indexOf(e)
if (idx === -1) {
cursor += 1
result.splice(cursor, 0, e)
} else {
cursor = idx
}
})
return result
}
export default {
mixins: [crud()],
props: {
permission: {
type: Object,
default: () => { return {} }
},
hiddenColumns: {
type: Array,
default: () => { return [] }
},
ignoreColumns: {
type: Array,
default: () => { return [] }
}
},
data() {
return {
tableColumns: [],
allColumnsSelected: true,
allColumnsSelectedIndeterminate: false,
tableUnwatcher: null,
// 忽略下次表格列变动
ignoreNextTableColumnsChange: false
}
},
watch: {
'crud.props.table'() {
this.updateTableColumns()
this.tableColumns.forEach(column => {
if (this.hiddenColumns.indexOf(column.property) !== -1) {
column.visible = false
this.updateColumnVisible(column)
}
})
},
'crud.props.table.store.states.columns'() {
this.updateTableColumns()
}
},
created() {
this.crud.updateProp('searchToggle', true)
},
methods: {
updateTableColumns() {
const table = this.crud.getTable()
if (!table) {
this.tableColumns = []
return
}
let cols = null
const columnFilter = e => e && e.type === 'default' && e.property && this.ignoreColumns.indexOf(e.property) === -1
const refCols = table.columns.filter(columnFilter)
if (this.ignoreNextTableColumnsChange) {
this.ignoreNextTableColumnsChange = false
return
}
this.ignoreNextTableColumnsChange = false
const columns = []
const fullTableColumns = table.$children.map(e => e.columnConfig).filter(columnFilter)
cols = sortWithRef(fullTableColumns, refCols)
cols.forEach(config => {
const column = {
property: config.property,
label: config.label,
visible: refCols.indexOf(config) !== -1
}
columns.push(column)
})
this.tableColumns = columns
},
handleCheckAllChange(val) {
if (val === false) {
this.allColumnsSelected = true
return
}
this.tableColumns.forEach(column => {
if (!column.visible) {
column.visible = true
this.updateColumnVisible(column)
}
})
this.allColumnsSelected = val
this.allColumnsSelectedIndeterminate = false
},
handleCheckedTableColumnsChange(item) {
let totalCount = 0
let selectedCount = 0
this.tableColumns.forEach(column => {
++totalCount
selectedCount += column.visible ? 1 : 0
})
if (selectedCount === 0) {
this.crud.notify('请至少选择一列', CRUD.NOTIFICATION_TYPE.WARNING)
this.$nextTick(function() {
item.visible = true
})
return
}
this.allColumnsSelected = selectedCount === totalCount
this.allColumnsSelectedIndeterminate = selectedCount !== totalCount && selectedCount !== 0
this.updateColumnVisible(item)
},
updateColumnVisible(item) {
const table = this.crud.props.table
const vm = table.$children.find(e => e.prop === item.property)
const columnConfig = vm.columnConfig
if (item.visible) {
// 找出合适的插入点
const columnIndex = this.tableColumns.indexOf(item)
vm.owner.store.commit('insertColumn', columnConfig, columnIndex + 1, null)
} else {
vm.owner.store.commit('removeColumn', columnConfig, null)
}
this.ignoreNextTableColumnsChange = true
},
toggleSearch() {
this.crud.props.searchToggle = !this.crud.props.searchToggle
}
}
}
</script>
<style>
.crud-opts {
padding: 4px 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts .crud-opts-right {
margin-left: auto;
}
.crud-opts .crud-opts-right span {
float: left;
}
</style>
<!--分页-->
<template>
<el-pagination
:page-size.sync="page.size"
:total="page.total"
:current-page.sync="page.page"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="crud.sizeChangeHandler($event)"
@current-change="crud.pageChangeHandler"
/>
</template>
<script>
import { pagination } from '@crud/crud'
export default {
mixins: [pagination()]
}
</script>
<!--搜索与重置-->
<template>
<span>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="crud.toQuery">搜索</el-button>
<el-button v-if="crud.optShow.reset" class="filter-item" size="mini" type="warning" icon="el-icon-refresh-left" @click="crud.resetQuery()">重置</el-button>
</span>
</template>
<script>
import { crud } from '@crud/crud'
export default {
mixins: [crud()],
props: {
itemClass: {
type: String,
required: false,
default: ''
}
}
}
</script>
<template>
<div>
<el-button v-permission="permission.edit" :loading="crud.status.cu === 2" :disabled="disabledEdit" size="mini" type="primary" icon="el-icon-chat-line-square" @click="crud.toEdit(data)">
查看详情
</el-button>
<el-popover v-model="pop" v-permission="permission.del" placement="top" width="180" trigger="manual" @show="onPopoverShow" @hide="onPopoverHide">
<p>{{ msg }}</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="doCancel">取消</el-button>
<el-button :loading="crud.dataStatus[crud.getDataId(data)].delete === 2" type="primary" size="mini" @click="crud.doDelete(data)">确定</el-button>
</div>
<!-- 删除按钮,此页面只需要查询,所以注释-->
<!-- <el-button slot="reference" :disabled="disabledDle" type="danger" icon="el-icon-delete" size="mini" @click="toDelete" />-->
</el-popover>
</div>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
export default {
mixins: [crud()],
props: {
data: {
type: Object,
required: true
},
permission: {
type: Object,
required: true
},
disabledEdit: {
type: Boolean,
default: false
},
disabledDle: {
type: Boolean,
default: false
},
msg: {
type: String,
default: '确定删除本条数据吗?'
}
},
data() {
return {
pop: false
}
},
methods: {
doCancel() {
this.pop = false
this.crud.cancelDelete(this.data)
},
toDelete() {
this.pop = true
},
[CRUD.HOOK.afterDelete](crud, data) {
if (data === this.data) {
this.pop = false
}
},
onPopoverShow() {
setTimeout(() => {
document.addEventListener('click', this.handleDocumentClick)
}, 0)
},
onPopoverHide() {
document.removeEventListener('click', this.handleDocumentClick)
},
handleDocumentClick(event) {
this.pop = false
}
}
}
</script>
import { initData, download } from '@/api/data'
import { parseTime, downloadFile } from '@/utils/index'
import Vue from 'vue'
/**
* CRUD配置
* @author moxun
* @param {*} options <br>
* @return crud instance.
* @example
* 要使用多crud时,请在关联crud的组件处使用crud-tag进行标记,如:<jobForm :job-status="dict.job_status" crud-tag="job" />
*/
function CRUD(options) {
const defaultOptions = {
tag: 'default',
// id字段名
idField: 'id',
// 标题
title: '',
// 请求数据的url
url: '',
// 表格数据
data: [],
// 选择项
selections: [],
// 待查询的对象
query: {},
// 查询数据的参数
params: {},
// Form 表单
form: {},
// 重置表单
defaultForm: () => {},
// 排序规则,默认 id 降序, 支持多字段排序 ['id,desc', 'createTime,asc']
sort: ['id,desc'],
// 等待时间
time: 50,
// CRUD Method
crudMethod: {
add: (form) => {},
del: (id) => {},
edit: (form) => {},
get: (id) => {}
},
// 主页操作栏显示哪些按钮
optShow: {
add: true,
edit: true,
del: true,
download: true,
reset: true
},
// 自定义一些扩展属性
props: {},
// 在主页准备
queryOnPresenterCreated: true,
// 调试开关
debug: false
}
options = mergeOptions(defaultOptions, options)
const data = {
...options,
// 记录数据状态
dataStatus: {},
status: {
add: CRUD.STATUS.NORMAL,
edit: CRUD.STATUS.NORMAL,
// 添加或编辑状态
get cu() {
if (this.add === CRUD.STATUS.NORMAL && this.edit === CRUD.STATUS.NORMAL) {
return CRUD.STATUS.NORMAL
} else if (this.add === CRUD.STATUS.PREPARED || this.edit === CRUD.STATUS.PREPARED) {
return CRUD.STATUS.PREPARED
} else if (this.add === CRUD.STATUS.PROCESSING || this.edit === CRUD.STATUS.PROCESSING) {
return CRUD.STATUS.PROCESSING
}
throw new Error('wrong crud\'s cu status')
},
// 标题
get title() {
return this.add > CRUD.STATUS.NORMAL ? `新增${crud.title}` : this.edit > CRUD.STATUS.NORMAL ? `${crud.title}` : crud.title
}
},
msg: {
submit: '提交成功',
add: '新增成功',
edit: '编辑成功',
del: '删除成功'
},
page: {
// 页码
page: 0,
// 每页数据条数
size: 10,
// 总数据条数
total: 0
},
// 整体loading
loading: false,
// 导出的 Loading
downloadLoading: false,
// 删除的 Loading
delAllLoading: false
}
const methods = {
/**
* 通用的提示
*/
submitSuccessNotify() {
crud.notify(crud.msg.submit, CRUD.NOTIFICATION_TYPE.SUCCESS)
},
addSuccessNotify() {
crud.notify(crud.msg.add, CRUD.NOTIFICATION_TYPE.SUCCESS)
},
editSuccessNotify() {
crud.notify(crud.msg.edit, CRUD.NOTIFICATION_TYPE.SUCCESS)
},
delSuccessNotify() {
crud.notify(crud.msg.del, CRUD.NOTIFICATION_TYPE.SUCCESS)
},
// 搜索
toQuery() {
crud.page.page = 1
crud.refresh()
},
// 刷新
refresh() {
if (!callVmHook(crud, CRUD.HOOK.beforeRefresh)) {
return
}
return new Promise((resolve, reject) => {
crud.loading = true
// 请求数据
initData(crud.url, crud.getQueryParams()).then(data => {
const table = crud.getTable()
if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据
table.store.states.treeData = {}
table.store.states.lazyTreeNodeMap = {}
}
crud.page.total = data.totalElements
crud.data = data.content
crud.resetDataStatus()
// time 毫秒后显示表格
setTimeout(() => {
crud.loading = false
callVmHook(crud, CRUD.HOOK.afterRefresh)
}, crud.time)
resolve(data)
}).catch(err => {
crud.loading = false
reject(err)
})
})
},
/**
* 启动添加
*/
toAdd() {
crud.resetForm()
if (!(callVmHook(crud, CRUD.HOOK.beforeToAdd, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) {
return
}
crud.status.add = CRUD.STATUS.PREPARED
callVmHook(crud, CRUD.HOOK.afterToAdd, crud.form)
callVmHook(crud, CRUD.HOOK.afterToCU, crud.form)
},
/**
* 启动编辑
* @param {*} data 数据项
*/
toEdit(data) {
crud.resetForm(JSON.parse(JSON.stringify(data)))
if (!(callVmHook(crud, CRUD.HOOK.beforeToEdit, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) {
return
}
crud.status.edit = CRUD.STATUS.PREPARED
crud.getDataStatus(crud.getDataId(data)).edit = CRUD.STATUS.PREPARED
callVmHook(crud, CRUD.HOOK.afterToEdit, crud.form)
callVmHook(crud, CRUD.HOOK.afterToCU, crud.form)
},
/**
* 启动删除
* @param {*} data 数据项
*/
toDelete(data) {
crud.getDataStatus(crud.getDataId(data)).delete = CRUD.STATUS.PREPARED
},
/**
* 取消删除
* @param {*} data 数据项
*/
cancelDelete(data) {
if (!callVmHook(crud, CRUD.HOOK.beforeDeleteCancel, data)) {
return
}
crud.getDataStatus(crud.getDataId(data)).delete = CRUD.STATUS.NORMAL
callVmHook(crud, CRUD.HOOK.afterDeleteCancel, data)
},
/**
* 取消新增/编辑
*/
cancelCU() {
const addStatus = crud.status.add
const editStatus = crud.status.edit
if (addStatus === CRUD.STATUS.PREPARED) {
if (!callVmHook(crud, CRUD.HOOK.beforeAddCancel, crud.form)) {
return
}
crud.status.add = CRUD.STATUS.NORMAL
}
if (editStatus === CRUD.STATUS.PREPARED) {
if (!callVmHook(crud, CRUD.HOOK.beforeEditCancel, crud.form)) {
return
}
crud.status.edit = CRUD.STATUS.NORMAL
crud.getDataStatus(crud.getDataId(crud.form)).edit = CRUD.STATUS.NORMAL
}
crud.resetForm()
if (addStatus === CRUD.STATUS.PREPARED) {
callVmHook(crud, CRUD.HOOK.afterAddCancel, crud.form)
}
if (editStatus === CRUD.STATUS.PREPARED) {
callVmHook(crud, CRUD.HOOK.afterEditCancel, crud.form)
}
// 清除表单验证
if (crud.findVM('form').$refs['form']) {
crud.findVM('form').$refs['form'].clearValidate()
}
},
/**
* 提交新增/编辑
*/
submitCU() {
if (!callVmHook(crud, CRUD.HOOK.beforeValidateCU)) {
return
}
crud.findVM('form').$refs['form'].validate(valid => {
if (!valid) {
return
}
if (!callVmHook(crud, CRUD.HOOK.afterValidateCU)) {
return
}
if (crud.status.add === CRUD.STATUS.PREPARED) {
crud.doAdd()
} else if (crud.status.edit === CRUD.STATUS.PREPARED) {
crud.doEdit()
}
})
},
/**
* 执行添加
*/
doAdd() {
if (!callVmHook(crud, CRUD.HOOK.beforeSubmit)) {
return
}
crud.status.add = CRUD.STATUS.PROCESSING
crud.crudMethod.add(crud.form).then(() => {
crud.status.add = CRUD.STATUS.NORMAL
crud.resetForm()
crud.addSuccessNotify()
callVmHook(crud, CRUD.HOOK.afterSubmit)
crud.toQuery()
}).catch(() => {
crud.status.add = CRUD.STATUS.PREPARED
callVmHook(crud, CRUD.HOOK.afterAddError)
})
},
/**
* 执行编辑
*/
doEdit() {
if (!callVmHook(crud, CRUD.HOOK.beforeSubmit)) {
return
}
crud.status.edit = CRUD.STATUS.PROCESSING
crud.crudMethod.edit(crud.form).then(() => {
crud.status.edit = CRUD.STATUS.NORMAL
crud.getDataStatus(crud.getDataId(crud.form)).edit = CRUD.STATUS.NORMAL
crud.editSuccessNotify()
crud.resetForm()
callVmHook(crud, CRUD.HOOK.afterSubmit)
crud.refresh()
}).catch(() => {
crud.status.edit = CRUD.STATUS.PREPARED
callVmHook(crud, CRUD.HOOK.afterEditError)
})
},
/**
* 执行删除
* @param {*} data 数据项
*/
doDelete(data) {
let delAll = false
let dataStatus
const ids = []
if (data instanceof Array) {
delAll = true
data.forEach(val => {
ids.push(this.getDataId(val))
})
} else {
ids.push(this.getDataId(data))
dataStatus = crud.getDataStatus(this.getDataId(data))
}
if (!callVmHook(crud, CRUD.HOOK.beforeDelete, data)) {
return
}
if (!delAll) {
dataStatus.delete = CRUD.STATUS.PROCESSING
}
return crud.crudMethod.del(ids).then(() => {
if (delAll) {
crud.delAllLoading = false
} else dataStatus.delete = CRUD.STATUS.PREPARED
crud.dleChangePage(1)
crud.delSuccessNotify()
callVmHook(crud, CRUD.HOOK.afterDelete, data)
crud.refresh()
}).catch(() => {
if (delAll) {
crud.delAllLoading = false
} else dataStatus.delete = CRUD.STATUS.PREPARED
})
},
/**
* 通用导出
*/
doExport() {
crud.downloadLoading = true
download(crud.url + '/download', crud.getQueryParams()).then(result => {
downloadFile(result, crud.title + '数据', 'xlsx')
crud.downloadLoading = false
}).catch(() => {
crud.downloadLoading = false
})
},
/**
* 获取查询参数
*/
getQueryParams: function() {
// 清除参数无值的情况
Object.keys(crud.query).length !== 0 && Object.keys(crud.query).forEach(item => {
if (crud.query[item] === null || crud.query[item] === '') crud.query[item] = undefined
})
Object.keys(crud.params).length !== 0 && Object.keys(crud.params).forEach(item => {
if (crud.params[item] === null || crud.params[item] === '') crud.params[item] = undefined
})
return {
page: crud.page.page - 1,
size: crud.page.size,
sort: crud.sort,
...crud.query,
...crud.params
}
},
// 当前页改变
pageChangeHandler(e) {
crud.page.page = e
crud.refresh()
},
// 每页条数改变
sizeChangeHandler(e) {
crud.page.size = e
crud.page.page = 1
crud.refresh()
},
// 预防删除第二页最后一条数据时,或者多选删除第二页的数据时,页码错误导致请求无数据
dleChangePage(size) {
if (crud.data.length === size && crud.page.page !== 1) {
crud.page.page -= 1
}
},
// 选择改变
selectionChangeHandler(val) {
crud.selections = val
},
/**
* 重置查询参数
* @param {Boolean} toQuery 重置后进行查询操作
*/
resetQuery(toQuery = true) {
const defaultQuery = JSON.parse(JSON.stringify(crud.defaultQuery))
const query = crud.query
Object.keys(query).forEach(key => {
query[key] = defaultQuery[key]
})
// 重置参数
this.params = {}
if (toQuery) {
crud.toQuery()
}
},
/**
* 重置表单
* @param {Array} data 数据
*/
resetForm(data) {
const form = data || (typeof crud.defaultForm === 'object' ? JSON.parse(JSON.stringify(crud.defaultForm)) : crud.defaultForm.apply(crud.findVM('form')))
const crudFrom = crud.form
for (const key in form) {
if (crudFrom.hasOwnProperty(key)) {
crudFrom[key] = form[key]
} else {
Vue.set(crudFrom, key, form[key])
}
}
// add by ghl 2020-10-04 页面重复添加信息时,下拉框的校验会存在,需要找工取消
if (crud.findVM('form').$refs['form']) {
crud.findVM('form').$refs['form'].clearValidate()
}
},
/**
* 重置数据状态
*/
resetDataStatus() {
const dataStatus = {}
function resetStatus(datas) {
datas.forEach(e => {
dataStatus[crud.getDataId(e)] = {
delete: 0,
edit: 0
}
if (e.children) {
resetStatus(e.children)
}
})
}
resetStatus(crud.data)
crud.dataStatus = dataStatus
},
/**
* 获取数据状态
* @param {Number | String} id 数据项id
*/
getDataStatus(id) {
return crud.dataStatus[id]
},
/**
* 用于树形表格多选, 选中所有
* @param selection
*/
selectAllChange(selection) {
// 如果选中的数目与请求到的数目相同就选中子节点,否则就清空选中
if (selection && selection.length === crud.data.length) {
selection.forEach(val => {
crud.selectChange(selection, val)
})
} else {
crud.getTable().clearSelection()
}
},
/**
* 用于树形表格多选,单选的封装
* @param selection
* @param row
*/
selectChange(selection, row) {
// 如果selection中存在row代表是选中,否则是取消选中
if (selection.find(val => { return crud.getDataId(val) === crud.getDataId(row) })) {
if (row.children) {
row.children.forEach(val => {
crud.getTable().toggleRowSelection(val, true)
selection.push(val)
if (val.children) {
crud.selectChange(selection, val)
}
})
}
} else {
crud.toggleRowSelection(selection, row)
}
},
/**
* 切换选中状态
* @param selection
* @param data
*/
toggleRowSelection(selection, data) {
if (data.children) {
data.children.forEach(val => {
crud.getTable().toggleRowSelection(val, false)
if (val.children) {
crud.toggleRowSelection(selection, val)
}
})
}
},
findVM(type) {
return crud.vms.find(vm => vm && vm.type === type).vm
},
notify(title, type = CRUD.NOTIFICATION_TYPE.INFO) {
crud.vms[0].vm.$notify({
title,
type,
duration: 2500
})
},
updateProp(name, value) {
Vue.set(crud.props, name, value)
},
getDataId(data) {
return data[this.idField]
},
getTable() {
return this.findVM('presenter').$refs.table
},
attchTable() {
const table = this.getTable()
this.updateProp('table', table)
const that = this
table.$on('expand-change', (row, expanded) => {
if (!expanded) {
return
}
const lazyTreeNodeMap = table.store.states.lazyTreeNodeMap
row.children = lazyTreeNodeMap[crud.getDataId(row)]
if (row.children) {
row.children.forEach(ele => {
const id = crud.getDataId(ele)
if (that.dataStatus[id] === undefined) {
that.dataStatus[id] = {
delete: 0,
edit: 0
}
}
})
}
})
}
}
const crud = Object.assign({}, data)
// 可观测化
Vue.observable(crud)
// 附加方法
Object.assign(crud, methods)
// 记录初始默认的查询参数,后续重置查询时使用
Object.assign(crud, {
defaultQuery: JSON.parse(JSON.stringify(data.query)),
// 预留4位存储:组件 主页、头部、分页、表单,调试查看也方便找
vms: Array(4),
/**
* 注册组件实例
* @param {String} type 类型
* @param {*} vm 组件实例
* @param {Number} index 该参数内部使用
*/
registerVM(type, vm, index = -1) {
const vmObj = {
type,
vm: vm
}
if (index < 0) {
this.vms.push(vmObj)
return
}
if (index < 4) { // 内置预留vm数
this.vms[index] = vmObj
return
}
this.vms.length = Math.max(this.vms.length, index)
this.vms.splice(index, 1, vmObj)
},
/**
* 取消注册组件实例
* @param {*} vm 组件实例
*/
unregisterVM(type, vm) {
for (let i = this.vms.length - 1; i >= 0; i--) {
if (this.vms[i] === undefined) {
continue
}
if (this.vms[i].type === type && this.vms[i].vm === vm) {
if (i < 4) { // 内置预留vm数
this.vms[i] = undefined
} else {
this.vms.splice(i, 1)
}
break
}
}
}
})
// 冻结处理,需要扩展数据的话,使用crud.updateProp(name, value),以crud.props.name形式访问,这个是响应式的,可以做数据绑定
Object.freeze(crud)
return crud
}
// hook VM
function callVmHook(crud, hook) {
if (crud.debug) {
console.log('callVmHook: ' + hook)
}
const tagHook = crud.tag ? hook + '$' + crud.tag : null
let ret = true
const nargs = [crud]
for (let i = 2; i < arguments.length; ++i) {
nargs.push(arguments[i])
}
// 有些组件扮演了多个角色,调用钩子时,需要去重
const vmSet = new Set()
crud.vms.forEach(vm => vm && vmSet.add(vm.vm))
vmSet.forEach(vm => {
if (vm[hook]) {
ret = vm[hook].apply(vm, nargs) !== false && ret
}
if (tagHook && vm[tagHook]) {
ret = vm[tagHook].apply(vm, nargs) !== false && ret
}
})
return ret
}
function mergeOptions(src, opts) {
const optsRet = {
...src
}
for (const key in src) {
if (opts.hasOwnProperty(key)) {
optsRet[key] = opts[key]
}
}
return optsRet
}
/**
* 查找crud
* @param {*} vm
* @param {string} tag
*/
function lookupCrud(vm, tag) {
tag = tag || vm.$attrs['crud-tag'] || 'default'
// function lookupCrud(vm, tag) {
if (vm.$crud) {
const ret = vm.$crud[tag]
if (ret) {
return ret
}
}
return vm.$parent ? lookupCrud(vm.$parent, tag) : undefined
}
/**
* crud主页
*/
function presenter(crud) {
if (crud) {
console.warn('[CRUD warn]: ' + 'please use $options.cruds() { return CRUD(...) or [CRUD(...), ...] }')
}
return {
data() {
// 在data中返回crud,是为了将crud与当前实例关联,组件观测crud相关属性变化
return {
crud: this.crud
}
},
beforeCreate() {
this.$crud = this.$crud || {}
let cruds = this.$options.cruds instanceof Function ? this.$options.cruds() : crud
if (!(cruds instanceof Array)) {
cruds = [cruds]
}
cruds.forEach(ele => {
if (this.$crud[ele.tag]) {
console.error('[CRUD error]: ' + 'crud with tag [' + ele.tag + ' is already exist')
}
this.$crud[ele.tag] = ele
ele.registerVM('presenter', this, 0)
})
this.crud = this.$crud['defalut'] || cruds[0]
},
methods: {
parseTime
},
created() {
for (const k in this.$crud) {
if (this.$crud[k].queryOnPresenterCreated) {
this.$crud[k].toQuery()
}
}
},
destroyed() {
for (const k in this.$crud) {
this.$crud[k].unregisterVM('presenter', this)
}
},
mounted() {
// 如果table未实例化(例如使用了v-if),请稍后在适当时机crud.attchTable刷新table信息
if (this.$refs.table !== undefined) {
this.crud.attchTable()
}
}
}
}
/**
* 头部
*/
function header() {
return {
data() {
return {
crud: this.crud,
query: this.crud.query
}
},
beforeCreate() {
this.crud = lookupCrud(this)
this.crud.registerVM('header', this, 1)
},
destroyed() {
this.crud.unregisterVM('header', this)
}
}
}
/**
* 分页
*/
function pagination() {
return {
data() {
return {
crud: this.crud,
page: this.crud.page
}
},
beforeCreate() {
this.crud = lookupCrud(this)
this.crud.registerVM('pagination', this, 2)
},
destroyed() {
this.crud.unregisterVM('pagination', this)
}
}
}
/**
* 表单
*/
function form(defaultForm) {
return {
data() {
return {
crud: this.crud,
form: this.crud.form
}
},
beforeCreate() {
this.crud = lookupCrud(this)
this.crud.registerVM('form', this, 3)
},
created() {
this.crud.defaultForm = defaultForm
this.crud.resetForm()
},
destroyed() {
this.crud.unregisterVM('form', this)
}
}
}
/**
* crud
*/
function crud(options = {}) {
const defaultOptions = {
type: undefined
}
options = mergeOptions(defaultOptions, options)
return {
data() {
return {
crud: this.crud
}
},
beforeCreate() {
this.crud = lookupCrud(this)
this.crud.registerVM(options.type, this)
},
destroyed() {
this.crud.unregisterVM(options.type, this)
}
}
}
/**
* CRUD钩子
*/
CRUD.HOOK = {
/** 刷新 - 之前 */
beforeRefresh: 'beforeCrudRefresh',
/** 刷新 - 之后 */
afterRefresh: 'afterCrudRefresh',
/** 删除 - 之前 */
beforeDelete: 'beforeCrudDelete',
/** 删除 - 之后 */
afterDelete: 'afterCrudDelete',
/** 删除取消 - 之前 */
beforeDeleteCancel: 'beforeCrudDeleteCancel',
/** 删除取消 - 之后 */
afterDeleteCancel: 'afterCrudDeleteCancel',
/** 新建 - 之前 */
beforeToAdd: 'beforeCrudToAdd',
/** 新建 - 之后 */
afterToAdd: 'afterCrudToAdd',
/** 编辑 - 之前 */
beforeToEdit: 'beforeCrudToEdit',
/** 编辑 - 之后 */
afterToEdit: 'afterCrudToEdit',
/** 开始 "新建/编辑" - 之前 */
beforeToCU: 'beforeCrudToCU',
/** 开始 "新建/编辑" - 之后 */
afterToCU: 'afterCrudToCU',
/** "新建/编辑" 验证 - 之前 */
beforeValidateCU: 'beforeCrudValidateCU',
/** "新建/编辑" 验证 - 之后 */
afterValidateCU: 'afterCrudValidateCU',
/** 添加取消 - 之前 */
beforeAddCancel: 'beforeCrudAddCancel',
/** 添加取消 - 之后 */
afterAddCancel: 'afterCrudAddCancel',
/** 编辑取消 - 之前 */
beforeEditCancel: 'beforeCrudEditCancel',
/** 编辑取消 - 之后 */
afterEditCancel: 'afterCrudEditCancel',
/** 提交 - 之前 */
beforeSubmit: 'beforeCrudSubmitCU',
/** 提交 - 之后 */
afterSubmit: 'afterCrudSubmitCU',
afterAddError: 'afterCrudAddError',
afterEditError: 'afterCrudEditError'
}
/**
* CRUD状态
*/
CRUD.STATUS = {
NORMAL: 0,
PREPARED: 1,
PROCESSING: 2
}
/**
* CRUD通知类型
*/
CRUD.NOTIFICATION_TYPE = {
SUCCESS: 'success',
WARNING: 'warning',
INFO: 'info',
ERROR: 'error'
}
export default CRUD
export {
presenter,
header,
form,
pagination,
crud
}
...@@ -12,26 +12,26 @@ ...@@ -12,26 +12,26 @@
</div> </div>
<!--表单组件--> <!--表单组件-->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="100%" hight="100%"> <el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="100%" hight="100%">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="130px"> <el-form ref="form" :disabled="crud.status.CHECK" :model="form" :rules="rules" size="small" label-width="130px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-form-item label="证件类型" prop="zjlx"> <el-form-item label="证件类型" prop="zjlx">
<el-input v-model="form.zjlx" style="width: 370px" :disabled="true" /> <el-input v-model="form.zjlx" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple-light"> <div class="grid-content bg-purple-light">
<el-form-item label="证件号码" prop="zjhm"> <el-form-item label="证件号码" prop="zjhm">
<el-input v-model="form.zjhm" style="width: 370px" :disabled="true" /> <el-input v-model="form.zjhm" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-input v-model="form.status" type="textarea" style="width: 370px" :disabled="true" /> <el-input v-model="form.status" type="textarea" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
...@@ -40,13 +40,13 @@ ...@@ -40,13 +40,13 @@
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-form-item label="姓名" prop="xingming"> <el-form-item label="姓名" prop="xingming">
<el-input v-model.number="form.xingming" style="width: 370px;" :disabled="true" /> <el-input v-model.number="form.xingming" style="width: 370px;" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="插入日期" prop="crrq"> <el-form-item label="插入日期" prop="crrq">
<el-input v-model.number="form.crrq" style="width: 370px;" :disabled="true" /> <el-input v-model.number="form.crrq" style="width: 370px;" />
</el-form-item> </el-form-item>
<div class="grid-content bg-purple-light" /> <div class="grid-content bg-purple-light" />
</el-col> </el-col>
...@@ -55,22 +55,22 @@ ...@@ -55,22 +55,22 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-form-item label="证件类型" prop="zjlx"> <el-form-item label="开户中心编号" prop="KHZXBH">
<el-input v-model="form.zjlx" style="width: 370px" :disabled="true" /> <el-input v-model="form.KHZXBH" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple-light"> <div class="grid-content bg-purple-light">
<el-form-item label="单位地址" prop="xynr"> <el-form-item label="开户中心名称" prop="KHZXMC">
<el-input v-model="form.dom" style="width: 370px" :disabled="true" /> <el-input v-model="form.KHZXMC" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-form-item label="法人代表姓名" prop="name"> <el-form-item label="单位账号" prop="DWZH">
<el-input v-model="form.name" style="width: 370px" :disabled="true" /> <el-input v-model="form.DWZH" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
...@@ -78,22 +78,22 @@ ...@@ -78,22 +78,22 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-form-item label="统一社会信用代码" prop="uniscid"> <el-form-item label="个人账号" prop="GRZH">
<el-input v-model="form.uniscid" style="width: 370px" :disabled="true" /> <el-input v-model="form.GRZH" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple-light"> <div class="grid-content bg-purple-light">
<el-form-item label="成立日期" prop="estDate"> <el-form-item label="个人账户状态" prop="GRZHZT">
<el-input v-model="form.estDate" style="width: 370px" :disabled="true" /> <el-input v-model="form.GRZHZT" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-form-item label="注册资本" prop="name"> <el-form-item label="数据插入日期" prop="CRRQ">
<el-input v-model="form.regCap" style="width: 370px" :disabled="true" /> <el-input v-model="form.CRRQ" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
...@@ -101,38 +101,20 @@ ...@@ -101,38 +101,20 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-form-item label="经营(驻在)期限自" prop="opFrom"> <el-form-item label="报文返回日期" prop="ZXZWRQ">
<el-input v-model="form.opFrom" style="width: 370px" :disabled="true" /> <el-input v-model="form.ZXZWRQ" style="width: 370px" />
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple-light"> <div class="grid-content bg-purple-light">
<el-form-item label="经营(驻在)期限至" prop="opto">
<el-input v-model="form.opto" style="width: 370px" :disabled="true" />
</el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-form-item label="登记机关" prop="regOrgCn">
<el-input v-model="form.regOrgCn" style="width: 370px" :disabled="true" />
</el-form-item>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="登记登记状态" prop="regStateCn">
<el-input v-model="form.regStateCn" style="width: 370px" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="企业经营范围" prop="opScope">
<el-input v-model="form.opScope" type="textarea" style="width: 370px" :disabled="true" />
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer" style="text-align: center"> <div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" size="medium" @click="crud.cancelCU">确认</el-button> <el-button type="primary" size="medium" @click="crud.cancelCU">确认</el-button>
...@@ -140,10 +122,11 @@ ...@@ -140,10 +122,11 @@
</el-dialog> </el-dialog>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%" @selection-change="crud.selectionChangeHandler"> <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%" @selection-change="crud.selectionChangeHandler">
<el-table-column v-if="checkPer(['admin','serverDeploy:edit'])" label="操作" width="150px" align="center"> <el-table-column v-if="checkPer(['admin','serverDeploy:check'])" label="操作" width="150px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<udOperation <Retrieve
:data="scope.row" :data="scope.row"
:queryList="queryList"
:permission="permission" :permission="permission"
/> />
</template> </template>
...@@ -163,23 +146,39 @@ ...@@ -163,23 +146,39 @@
<script> <script>
import { testServerConnect } from '@/api/mnt/connect' import { testServerConnect } from '@/api/mnt/connect'
import CRUD, { presenter, header, form, crud } from './Crud/crud' import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from './Crud/RR.operation' import rrOperation from '@crud/RR.operation'
import udOperation from './Crud/UD.operation' import udOperation from '@crud/UD.operation'
import pagination from './Crud/Pagination' import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker' import DateRangePicker from '@/components/DateRangePicker'
import crudOperation from './Crud/CRUD.operation' import crudOperation from '@crud/CRUD.operation'
import Retrieve from "@crud/Retrieve";
const defaultForm = { id: null, name: null, ip: null, port: 22, account: 'root', password: null } const defaultForm = { id: null, name: null, ip: null, port: 22, account: 'root', password: null }
export default { export default {
name: 'Jczlcx', name: 'Jczlcx',
components: { pagination, rrOperation, udOperation, DateRangePicker, crudOperation }, components: {Retrieve, pagination, rrOperation, udOperation, DateRangePicker, crudOperation },
cruds() { cruds() {
return CRUD({ title: '缴存总览详情', url: 'api/JczlcxController', crudMethod: {}}) return CRUD({
title: '缴存总览详情',
url: 'api/JczlcxController',
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: true
},
})
}, },
mixins: [presenter(), header(), form(defaultForm), crud()], mixins: [presenter(), header(), form(defaultForm), crud()],
data() { data() {
return { return {
//明细请求参数
queryList: {
status:true,
url:"api/JczlcxController/QueryJczlcxFhmx",
id:""
},
// currView: 'index', // currView: 'index',
accountList: [], accountList: [],
accountMap: {}, accountMap: {},
...@@ -194,6 +193,14 @@ export default { ...@@ -194,6 +193,14 @@ export default {
} }
}, },
methods: { methods: {
testDigSeven(val){
console.log("val:"+val)
// this.queryList.push(val)
this.$http.get("http://localhost:8013/api/JczlcxController/QueryJczlcxFhmx?id=" + val.id).then(function (res) {
// console.log("this.queryList:"+ this.queryList)
// this.queryList.push(res.body.data[0])
});
},
testConnectServer() { testConnectServer() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
......
...@@ -15,19 +15,12 @@ ...@@ -15,19 +15,12 @@
*/ */
package me.zhengjie.controller; package me.zhengjie.controller;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.AnonymousAccess;
import me.zhengjie.service.JczlcxService; import me.zhengjie.service.JczlcxService;
import me.zhengjie.service.QyxxcxService;
import me.zhengjie.service.dto.JczlcxDeployQueryCriteria; import me.zhengjie.service.dto.JczlcxDeployQueryCriteria;
import me.zhengjie.service.dto.QyxxcxDeployQueryCriteria; import me.zhengjie.util.R;
import me.zhengjie.util.shengneiUtil;
import org.apache.http.impl.client.CloseableHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
...@@ -35,11 +28,10 @@ import org.springframework.http.ResponseEntity; ...@@ -35,11 +28,10 @@ import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat; import java.util.List;
import java.util.Date;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
//import static me.zhengjie.util.shengneiUtil.createSSLClientDefault; //import static me.zhengjie.util.shengneiUtil.createSSLClientDefault;
...@@ -64,4 +56,11 @@ public class JczlcxController { ...@@ -64,4 +56,11 @@ public class JczlcxController {
public ResponseEntity<Object> query(JczlcxDeployQueryCriteria criteria, Pageable pageable){ public ResponseEntity<Object> query(JczlcxDeployQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(jczlcxService.queryAll(criteria,pageable),HttpStatus.OK); return new ResponseEntity<>(jczlcxService.queryAll(criteria,pageable),HttpStatus.OK);
} }
@ApiOperation("缴存总览查询返回明细")
@RequestMapping("/QueryJczlcxFhmx")
public R QueryJczlcxFhmx(@RequestParam("id") String id) {
List<Map> visits = jczlcxService.QueryJczlcxFhmx(id);
return new R<>(visits);
}
} }
package me.zhengjie.service; package me.zhengjie.service;
import me.zhengjie.service.dto.JczlcxDeployQueryCriteria; import me.zhengjie.service.dto.JczlcxDeployQueryCriteria;
import me.zhengjie.service.dto.QyxxcxDeployQueryCriteria;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
public interface JczlcxService { public interface JczlcxService {
/** /**
* 分页查询 * 分页查询
...@@ -13,4 +15,5 @@ public interface JczlcxService { ...@@ -13,4 +15,5 @@ public interface JczlcxService {
*/ */
Object queryAll(JczlcxDeployQueryCriteria criteria, Pageable pageable); Object queryAll(JczlcxDeployQueryCriteria criteria, Pageable pageable);
List<Map> QueryJczlcxFhmx(String id);
} }
package me.zhengjie.serviceimpl; package me.zhengjie.serviceimpl;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import me.zhengjie.MybatisMapper.JczlcxMybatisMapper;
import me.zhengjie.domain.JczlcxDeploy; import me.zhengjie.domain.JczlcxDeploy;
import me.zhengjie.domain.QyxxcxDeploy;
import me.zhengjie.mapper.JczlcxMapper; import me.zhengjie.mapper.JczlcxMapper;
import me.zhengjie.mapper.QyxxcxMapper;
import me.zhengjie.repository.JczlcxDeployRepository; import me.zhengjie.repository.JczlcxDeployRepository;
import me.zhengjie.repository.QyxxcxDeployRepository;
import me.zhengjie.service.JczlcxService; import me.zhengjie.service.JczlcxService;
import me.zhengjie.service.QyxxcxService;
import me.zhengjie.service.dto.JczlcxDeployQueryCriteria; import me.zhengjie.service.dto.JczlcxDeployQueryCriteria;
import me.zhengjie.service.dto.QyxxcxDeployQueryCriteria;
import me.zhengjie.utils.PageUtil; import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp; import me.zhengjie.utils.QueryHelp;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/** /**
* @author Jing Xiduo * @author Jing Xiduo
* @date 2021-10-18 * @date 2021-10-18
...@@ -27,9 +26,15 @@ public class JczlcxServiceImpl implements JczlcxService { ...@@ -27,9 +26,15 @@ public class JczlcxServiceImpl implements JczlcxService {
private final JczlcxDeployRepository jczlcxDeployRepository; private final JczlcxDeployRepository jczlcxDeployRepository;
private final JczlcxMapper jczlcxMapper; private final JczlcxMapper jczlcxMapper;
private final JczlcxMybatisMapper jczlcxMybatisMapper;
@Override @Override
public Object queryAll(JczlcxDeployQueryCriteria criteria, Pageable pageable){ public Object queryAll(JczlcxDeployQueryCriteria criteria, Pageable pageable){
Page<JczlcxDeploy> page = jczlcxDeployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); Page<JczlcxDeploy> page = jczlcxDeployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(jczlcxMapper::toDto)); return PageUtil.toPage(page.map(jczlcxMapper::toDto));
} }
@Override
public List<Map> QueryJczlcxFhmx(String id) {
return jczlcxMybatisMapper.QueryJczlcxFhmx(id);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment