parent
d07b18d695
commit
80ddae183d
23 changed files with 1992 additions and 1 deletions
@ -0,0 +1,343 @@ |
||||
<template> |
||||
<a-card :bordered="false"> |
||||
<!-- 查询区域 --> |
||||
<div class="table-page-search-wrapper"> |
||||
<a-form layout="inline" @keyup.enter.native="searchQuery"> |
||||
<a-row :gutter="24"> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="中文名称"> |
||||
<a-input placeholder="中文名称" v-model="queryParam.functionTemplateName"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="英文名称"> |
||||
<a-input placeholder="英文名称" v-model="queryParam.functionTemplateEnName"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="功能类型"> |
||||
<j-dict-select-tag type="list" v-model="queryParam.functionType" dictCode="function_type" placeholder="请选择功能类型"/> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="任务状态"> |
||||
<j-dict-select-tag type="list" v-model="queryParam.workStatus" dictCode="work_status" placeholder="请选择任务状态" /> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button> |
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> |
||||
</span> |
||||
</a-col> |
||||
</a-row> |
||||
</a-form> |
||||
</div> |
||||
<!-- 查询区域-END --> |
||||
|
||||
<!-- 操作按钮区域 --> |
||||
<div class="table-operator"> |
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> |
||||
<a-button type="primary" icon="download" @click="handleExportXls('功能模板管理')">导出</a-button> |
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
||||
<a-button type="primary" icon="import">导入</a-button> |
||||
</a-upload> |
||||
<!-- 高级查询区域 --> |
||||
<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>--> |
||||
<!-- <a-dropdown v-if="selectedRowKeys.length > 0">--> |
||||
<!-- <a-menu slot="overlay">--> |
||||
<!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>--> |
||||
<!-- </a-menu>--> |
||||
<!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>--> |
||||
<!-- </a-dropdown>--> |
||||
<a-button @click="fanhui" type="primary" icon="rollback">返回</a-button> |
||||
</div> |
||||
|
||||
<!-- table区域-begin --> |
||||
<div> |
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 |
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> |
||||
</div> |
||||
|
||||
<a-table |
||||
ref="table" |
||||
size="middle" |
||||
:scroll="{x:true}" |
||||
bordered |
||||
rowKey="id" |
||||
:columns="columns" |
||||
:dataSource="dataSource" |
||||
:pagination="ipagination" |
||||
:loading="loading" |
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
||||
class="j-table-force-nowrap" |
||||
@change="handleTableChange"> |
||||
|
||||
<template slot="htmlSlot" slot-scope="text"> |
||||
<div v-html="text"></div> |
||||
</template> |
||||
<template slot="imgSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> |
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
||||
</template> |
||||
<template slot="fileSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
||||
<a-button |
||||
v-else |
||||
:ghost="true" |
||||
type="primary" |
||||
icon="download" |
||||
size="small" |
||||
@click="downloadFile(text)"> |
||||
下载 |
||||
</a-button> |
||||
</template> |
||||
|
||||
<span slot="action" slot-scope="text, record"> |
||||
<a @click="handleEdit(record)">编辑</a> |
||||
|
||||
<a-divider type="vertical" /> |
||||
|
||||
<a @click="handleDetail(record)">详情</a> |
||||
<a-divider type="vertical" /> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<function-template-modal ref="modalForm" @ok="modalFormOk"></function-template-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import FunctionTemplateModal from './modules/FunctionTemplateModal' |
||||
import {getAction} from "@api/manage"; |
||||
import {filterObj} from "@/utils/util"; |
||||
export default { |
||||
name: 'FunctionTemplateList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
FunctionTemplateModal |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '功能模板管理管理页面', |
||||
// 表头 |
||||
columns: [ |
||||
{ |
||||
title: '#', |
||||
dataIndex: '', |
||||
key:'rowIndex', |
||||
width:60, |
||||
align:"center", |
||||
customRender:function (t,r,index) { |
||||
return parseInt(index)+1; |
||||
} |
||||
}, |
||||
{ |
||||
title:'模块模板类型', |
||||
align:"center", |
||||
dataIndex: 'modulextypeId_dictText' |
||||
}, |
||||
{ |
||||
title:'中文名称', |
||||
align:"center", |
||||
dataIndex: 'functionTemplateName' |
||||
}, |
||||
{ |
||||
title:'英文名称', |
||||
align:"center", |
||||
dataIndex: 'functionTemplateEnName' |
||||
}, |
||||
{ |
||||
title:'功能编码', |
||||
align:"center", |
||||
dataIndex: 'functionTemplateCode' |
||||
}, |
||||
{ |
||||
title:'功能类型', |
||||
align:"center", |
||||
dataIndex: 'functionTemplateType_dictText' |
||||
}, |
||||
{ |
||||
title:'功能描述', |
||||
align:"center", |
||||
dataIndex: 'functionTemplateDescribe' |
||||
}, |
||||
{ |
||||
title:'分析图', |
||||
align:"center", |
||||
dataIndex: 'diagrams', |
||||
scopedSlots: {customRender: 'imgSlot'} |
||||
}, |
||||
// { |
||||
// title:'用户角色', |
||||
// align:"center", |
||||
// dataIndex: 'userRole_dictText' |
||||
// }, |
||||
// { |
||||
// title:'责任人', |
||||
// align:"center", |
||||
// dataIndex: 'managerUsers_dictText' |
||||
// }, |
||||
{ |
||||
title:'任务等级', |
||||
align:"center", |
||||
dataIndex: 'workLevel_dictText' |
||||
}, |
||||
{ |
||||
title:'任务状态', |
||||
align:"center", |
||||
dataIndex: 'workStatus_dictText' |
||||
}, |
||||
{ |
||||
title:'发布时间', |
||||
align:"center", |
||||
dataIndex: 'publishTime' |
||||
}, |
||||
{ |
||||
title:'开始时间', |
||||
align:"center", |
||||
dataIndex: 'startTime', |
||||
customRender:function (text) { |
||||
return !text?"":(text.length>10?text.substr(0,10):text) |
||||
} |
||||
}, |
||||
{ |
||||
title:'任务时长', |
||||
align:"center", |
||||
dataIndex: 'duration' |
||||
}, |
||||
{ |
||||
title:'创建人', |
||||
align:"center", |
||||
dataIndex: 'createBy_dictText' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/functiontemplate/functionTemplate/list", |
||||
delete: "/functiontemplate/functionTemplate/delete", |
||||
deleteBatch: "/functiontemplate/functionTemplate/deleteBatch", |
||||
exportXlsUrl: "/functiontemplate/functionTemplate/exportXls", |
||||
importExcelUrl: "functiontemplate/functionTemplate/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
loadRouteType:false, |
||||
queryParam:{}, |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
fanhui(){ |
||||
this.$router.push({ |
||||
/*返回产品*/ |
||||
path: '/src/views/moduletype/ModuleTypeList', |
||||
}); |
||||
}, |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'modulextypeId',text:'模块模板类型id',dictCode:''}) |
||||
fieldList.push({type:'string',value:'functionTemplateName',text:'中文名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'functionTemplateEnName',text:'英文名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'functionTemplateCode',text:'功能编码',dictCode:''}) |
||||
fieldList.push({type:'int',value:'functionTemplateType',text:'功能类型',dictCode:''}) |
||||
fieldList.push({type:'string',value:'functionTemplateDescribe',text:'功能描述',dictCode:''}) |
||||
fieldList.push({type:'string',value:'diagrams',text:'分析图',dictCode:''}) |
||||
fieldList.push({type:'sel_user',value:'userRole',text:'用户角色'}) |
||||
fieldList.push({type:'sel_user',value:'managerUsers',text:'责任人'}) |
||||
fieldList.push({type:'int',value:'workLevel',text:'任务等级',dictCode:''}) |
||||
fieldList.push({type:'int',value:'workStatus',text:'任务状态',dictCode:''}) |
||||
fieldList.push({type:'datetime',value:'publishTime',text:'发布时间'}) |
||||
fieldList.push({type:'date',value:'startTime',text:'开始时间'}) |
||||
fieldList.push({type:'double',value:'duration',text:'任务时长',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
}, |
||||
loadParameter() { |
||||
if (this.loadRouteType === false) { |
||||
this.id = this.$route.query.type; |
||||
// console.log("***********想看看") |
||||
this.loadRouteType = true; |
||||
} |
||||
}, |
||||
loadData(arg) { |
||||
if (!this.url.list) { |
||||
this.$message.error("请设置url.list属性!"); |
||||
return |
||||
} |
||||
//加载数据 若传入参数1则加载第一页的内容 |
||||
if (arg === 1) { |
||||
this.ipagination.current = 1; |
||||
} |
||||
this.loadParameter(); |
||||
var params = this.getQueryParams();//查询条件 |
||||
this.loading = true; |
||||
getAction(this.url.list, params).then((res) => { |
||||
if (res.success) { |
||||
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ |
||||
this.dataSource = res.result.records || res.result; |
||||
if (res.result.total) { |
||||
this.ipagination.total = res.result.total; |
||||
} else { |
||||
this.ipagination.total = 0; |
||||
} |
||||
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ |
||||
} else { |
||||
this.$message.warning(res.message) |
||||
} |
||||
}).finally(() => { |
||||
this.loading = false |
||||
}) |
||||
}, |
||||
getQueryParams() { |
||||
//获取查询条件 |
||||
let sqp = {} |
||||
if (this.superQueryParams) { |
||||
sqp['superQueryParams'] = encodeURI(this.superQueryParams) |
||||
sqp['superQueryMatchType'] = this.superQueryMatchType |
||||
} |
||||
var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters); |
||||
param.field = this.getQueryField(); |
||||
param.pageNo = this.ipagination.current; |
||||
param.pageSize = this.ipagination.pageSize; |
||||
//param.id=this.id; |
||||
param.modulextypeId = this.$route.query.type; |
||||
return filterObj(param); |
||||
}, |
||||
searchReset() { |
||||
this.queryParam='' |
||||
this.loadData(); |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,223 @@ |
||||
<template> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<j-form-container :disabled="formDisabled"> |
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
||||
<a-row> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="中文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionTemplateName"> |
||||
<a-input v-model="model.functionTemplateName" placeholder="请输入中文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="英文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionTemplateEnName"> |
||||
<a-input v-model="model.functionTemplateEnName" placeholder="请输入英文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="功能类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionTemplateType"> |
||||
<j-dict-select-tag type="list" v-model="model.functionTemplateType" dictCode="function_type" placeholder="请选择功能类型" @change="functionxbianma"/> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="功能编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionTemplateCode"> |
||||
<a-input v-model="model.functionTemplateCode" placeholder="请输入功能编码" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="用户角色" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userRole"> |
||||
<j-select-user-by-dep v-model="model.userRole" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="责任人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="managerUsers"> |
||||
<j-select-user-by-dep v-model="model.managerUsers" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="任务等级" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workLevel"> |
||||
<j-dict-select-tag type="list" v-model="model.workLevel" dictCode="work_level" placeholder="请选择任务等级" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="任务时长" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="duration">--> |
||||
<!-- <a-input-number v-model="model.duration" placeholder="请输入任务时长" style="width: 100%" />--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="功能描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionTemplateDescribe"> |
||||
<a-input v-model="model.functionTemplateDescribe" placeholder="请输入功能描述" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="分析图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="diagrams"> |
||||
<j-image-upload isMultiple v-model="model.diagrams" ></j-image-upload> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
|
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="任务状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workStatus">--> |
||||
<!-- <j-dict-select-tag type="list" v-model="model.workStatus" dictCode="" placeholder="请选择任务状态" />--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="发布时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="publishTime">--> |
||||
<!-- <j-date placeholder="请选择发布时间" v-model="model.publishTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startTime">--> |
||||
<!-- <j-date placeholder="请选择开始时间" v-model="model.startTime" style="width: 100%" />--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
|
||||
</a-row> |
||||
</a-form-model> |
||||
</j-form-container> |
||||
</a-spin> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { httpAction, getAction } from '@/api/manage' |
||||
import { validateDuplicateValue } from '@/utils/util' |
||||
import { validateDuplicateValue1 } from '@/utils/util' |
||||
|
||||
export default { |
||||
name: 'FunctionTemplateForm', |
||||
components: { |
||||
}, |
||||
props: { |
||||
//表单禁用 |
||||
disabled: { |
||||
type: Boolean, |
||||
default: false, |
||||
required: false |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
model:{ |
||||
|
||||
}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
modulextypeId: [ |
||||
{ required: true, message: '请输入模块模板类型id!'}, |
||||
], |
||||
functionTemplateName: [ |
||||
{ required: true, message: '请输入中文名称!'}, |
||||
{ validator: (rule, value, callback) => validateDuplicateValue1('function_template', 'function_template_name', value, this.model.id,this.moduleid, callback)}, |
||||
], |
||||
functionTemplateEnName: [ |
||||
{ required: true, message: '请输入英文名称!'}, |
||||
{ validator: (rule, value, callback) => validateDuplicateValue1('function_template', 'function_template_en_name', value, this.model.id,this.moduleid, callback)}, |
||||
], |
||||
functionTemplateCode: [ |
||||
{ required: true, message: '请输入功能编码!'}, |
||||
], |
||||
functionTemplateType: [ |
||||
{ required: true, message: '请输入功能类型!'}, |
||||
], |
||||
workLevel: [ |
||||
{ required: true, message: '请输入任务等级!'}, |
||||
], |
||||
workStatus: [ |
||||
{ required: true, message: '请输入任务状态!'}, |
||||
], |
||||
}, |
||||
url: { |
||||
add: "/functiontemplate/functionTemplate/add", |
||||
edit: "/functiontemplate/functionTemplate/edit", |
||||
queryById: "/functiontemplate/functionTemplate/queryById" |
||||
}, |
||||
moduleid:'', |
||||
modulecode:'后期替换', |
||||
} |
||||
}, |
||||
computed: { |
||||
formDisabled(){ |
||||
return this.disabled |
||||
}, |
||||
}, |
||||
created () { |
||||
this.moduleid=this.$route.query.type |
||||
this.model.modulextypeId=this.$route.query.type; |
||||
//备份model原始值 |
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
||||
|
||||
}, |
||||
methods: { |
||||
functionxbianma(){ |
||||
if(this.model.functionTemplateType==0){ |
||||
this.model.functionTemplateCode=this.modulecode+"列表" |
||||
} |
||||
else if(this.model.functionTemplateType==1){ |
||||
this.model.functionTemplateCode=this.modulecode+"增加" |
||||
} |
||||
else if(this.model.functionTemplateType==2){ |
||||
this.model.functionTemplateCode=this.modulecode+"删除" |
||||
} |
||||
else if(this.model.functionTemplateType==3){ |
||||
this.model.functionTemplateCode=this.modulecode+"修改" |
||||
} |
||||
else if(this.model.functionTemplateType==4){ |
||||
this.model.functionTemplateCode=this.modulecode+"查看" |
||||
} |
||||
else if(this.model.functionTemplateType==5){ |
||||
this.model.functionTemplateCode=this.modulecode+"导入" |
||||
} |
||||
else if(this.model.functionTemplateType==6){ |
||||
this.model.functionTemplateCode=this.modulecode+"导出" |
||||
} |
||||
else { |
||||
this.model.functionTemplateCode=this.modulecode+"其他" |
||||
} |
||||
|
||||
}, |
||||
add () { |
||||
this.edit(this.modelDefault); |
||||
}, |
||||
edit (record) { |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
}, |
||||
submitForm () { |
||||
const that = this; |
||||
// 触发表单验证 |
||||
this.$refs.form.validate(valid => { |
||||
if (valid) { |
||||
that.confirmLoading = true; |
||||
let httpurl = ''; |
||||
let method = ''; |
||||
if(!this.model.id){ |
||||
httpurl+=this.url.add; |
||||
method = 'post'; |
||||
}else{ |
||||
httpurl+=this.url.edit; |
||||
method = 'put'; |
||||
} |
||||
httpAction(httpurl,this.model,method).then((res)=>{ |
||||
if(res.success){ |
||||
that.$message.success(res.message); |
||||
that.$emit('ok'); |
||||
}else{ |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,60 @@ |
||||
<template> |
||||
<j-modal |
||||
:title="title" |
||||
:width="width" |
||||
:visible="visible" |
||||
switchFullscreen |
||||
@ok="handleOk" |
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
||||
@cancel="handleCancel" |
||||
cancelText="关闭"> |
||||
<function-template-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></function-template-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import FunctionTemplateForm from './FunctionTemplateForm' |
||||
export default { |
||||
name: 'FunctionTemplateModal', |
||||
components: { |
||||
FunctionTemplateForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:'', |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}) |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,84 @@ |
||||
<template> |
||||
<a-drawer |
||||
:title="title" |
||||
:width="width" |
||||
placement="right" |
||||
:closable="false" |
||||
@close="close" |
||||
destroyOnClose |
||||
:visible="visible"> |
||||
<function-template-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></function-template-form> |
||||
<div class="drawer-footer"> |
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> |
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> |
||||
</div> |
||||
</a-drawer> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import FunctionTemplateForm from './FunctionTemplateForm' |
||||
|
||||
export default { |
||||
name: 'FunctionTemplateModal', |
||||
components: { |
||||
FunctionTemplateForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}); |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
/** Button按钮间距 */ |
||||
.ant-btn { |
||||
margin-left: 30px; |
||||
margin-bottom: 30px; |
||||
float: right; |
||||
} |
||||
.drawer-footer{ |
||||
position: absolute; |
||||
bottom: -8px; |
||||
width: 100%; |
||||
border-top: 1px solid #e8e8e8; |
||||
padding: 10px 16px; |
||||
text-align: right; |
||||
left: 0; |
||||
background: #fff; |
||||
border-radius: 0 0 2px 2px; |
||||
} |
||||
</style> |
@ -0,0 +1,238 @@ |
||||
<template> |
||||
<a-card :bordered="false"> |
||||
<!-- 查询区域 --> |
||||
<div class="table-page-search-wrapper"> |
||||
<a-form layout="inline" @keyup.enter.native="searchQuery"> |
||||
<a-row :gutter="24"> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="模板名称"> |
||||
<a-input placeholder="模板名称" v-model="queryParam.modulextypeName"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="模板状态"> |
||||
<j-dict-select-tag type="list" v-model="queryParam.modulextypeStatus" dictCode="modulextype_status" placeholder="请选择模板状态" /> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button> |
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> |
||||
</span> |
||||
</a-col> |
||||
</a-row> |
||||
</a-form> |
||||
</div> |
||||
<!-- 查询区域-END --> |
||||
|
||||
<!-- 操作按钮区域 --> |
||||
<div class="table-operator"> |
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> |
||||
<a-button type="primary" icon="download" @click="handleExportXls('模块模板类型')">导出</a-button> |
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
||||
<a-button type="primary" icon="import">导入</a-button> |
||||
</a-upload> |
||||
<!-- 高级查询区域 --> |
||||
<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>--> |
||||
<!-- <a-dropdown v-if="selectedRowKeys.length > 0">--> |
||||
<!-- <a-menu slot="overlay">--> |
||||
<!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>--> |
||||
<!-- </a-menu>--> |
||||
<!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>--> |
||||
<!-- </a-dropdown>--> |
||||
</div> |
||||
|
||||
<!-- table区域-begin --> |
||||
<div> |
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 |
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> |
||||
</div> |
||||
|
||||
<a-table |
||||
ref="table" |
||||
size="middle" |
||||
:scroll="{x:true}" |
||||
bordered |
||||
rowKey="id" |
||||
:columns="columns" |
||||
:dataSource="dataSource" |
||||
:pagination="ipagination" |
||||
:loading="loading" |
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
||||
class="j-table-force-nowrap" |
||||
@change="handleTableChange"> |
||||
|
||||
<template slot="htmlSlot" slot-scope="text"> |
||||
<div v-html="text"></div> |
||||
</template> |
||||
<template slot="imgSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> |
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
||||
</template> |
||||
<template slot="fileSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
||||
<a-button |
||||
v-else |
||||
:ghost="true" |
||||
type="primary" |
||||
icon="download" |
||||
size="small" |
||||
@click="downloadFile(text)"> |
||||
下载 |
||||
</a-button> |
||||
</template> |
||||
<template slot="htmlSlot" slot-scope="text, record"> |
||||
<!-- <div v-html="text"></div>--> |
||||
<a @click="functionx(record)">功能模板</a> |
||||
</template> |
||||
|
||||
<span slot="action" slot-scope="text, record"> |
||||
<a @click="qian(record)">前移</a> |
||||
|
||||
<a-divider type="vertical" /> |
||||
<a @click="hou(record)">后移</a> |
||||
|
||||
<a-divider type="vertical" /> |
||||
<a @click="handleEdit(record)">编辑</a> |
||||
|
||||
<a-divider type="vertical" /> |
||||
|
||||
<a @click="handleDetail(record)">详情</a> |
||||
<a-divider type="vertical" /> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<module-type-modal ref="modalForm" @ok="modalFormOk"></module-type-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import ModuleTypeModal from './modules/ModuleTypeModal' |
||||
import {getAction} from "../../api/manage"; |
||||
|
||||
export default { |
||||
name: 'ModuleTypeList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
ModuleTypeModal |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '模块模板类型管理页面', |
||||
// 表头 |
||||
columns: [ |
||||
{ |
||||
title: '#', |
||||
dataIndex: '', |
||||
key:'rowIndex', |
||||
width:60, |
||||
align:"center", |
||||
customRender:function (t,r,index) { |
||||
return parseInt(index)+1; |
||||
} |
||||
}, |
||||
{ |
||||
title:'名称', |
||||
align:"center", |
||||
dataIndex: 'modulextypeName' |
||||
}, |
||||
{ |
||||
title:'排序', |
||||
align:"center", |
||||
dataIndex: 'modulextypeOrder' |
||||
}, |
||||
{ |
||||
title:'模板状态', |
||||
align:"center", |
||||
dataIndex: 'modulextypeStatus_dictText' |
||||
}, |
||||
{ |
||||
title: '管理', |
||||
dataIndex: 'htmlSlot', |
||||
align: "center", |
||||
fixed: "right", |
||||
width: 147, |
||||
scopedSlots: {customRender: 'htmlSlot'} |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/moduletype/moduleType/list", |
||||
delete: "/moduletype/moduleType/delete", |
||||
deleteBatch: "/moduletype/moduleType/deleteBatch", |
||||
exportXlsUrl: "/moduletype/moduleType/exportXls", |
||||
importExcelUrl: "moduletype/moduleType/importExcel", |
||||
qian:"moduletype/moduleType/qian", |
||||
hou:"moduletype/moduleType/hou", |
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
functionx(record){ |
||||
this.$router.push({ |
||||
path: '/src/views/functiontemple/FunctionTemplateList', |
||||
query: {type: record.id} |
||||
}) |
||||
}, |
||||
qian(record){ |
||||
getAction(this.url.qian,{id:record.id}).then((res)=>{ |
||||
if (res.success) { |
||||
this.$message.success(res.result); |
||||
this.loadData(); |
||||
}else{ |
||||
this.$message.warning(res.message); |
||||
} |
||||
}) |
||||
}, |
||||
hou(record){ |
||||
getAction(this.url.hou,{id:record.id}).then((res)=>{ |
||||
if (res.success) { |
||||
this.$message.success(res.result); |
||||
this.loadData(); |
||||
}else{ |
||||
this.$message.warning(res.message); |
||||
} |
||||
}) |
||||
}, |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'modulextypeName',text:'名称',dictCode:''}) |
||||
fieldList.push({type:'int',value:'modulextypeOrder',text:'排序',dictCode:''}) |
||||
fieldList.push({type:'int',value:'modulextypeStatus',text:'模板状态',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,120 @@ |
||||
<template> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<j-form-container :disabled="formDisabled"> |
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
||||
<a-row> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modulextypeName"> |
||||
<a-input v-model="model.modulextypeName" placeholder="请输入名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
|
||||
<a-col :span="24"> |
||||
<a-form-model-item label="模板状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modulextypeStatus"> |
||||
<j-dict-select-tag type="list" v-model="model.modulextypeStatus" dictCode="modulextype_status" placeholder="请选择模板状态" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
</a-row> |
||||
</a-form-model> |
||||
</j-form-container> |
||||
</a-spin> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { httpAction, getAction } from '@/api/manage' |
||||
import { validateDuplicateValue } from '@/utils/util' |
||||
|
||||
export default { |
||||
name: 'ModuleTypeForm', |
||||
components: { |
||||
}, |
||||
props: { |
||||
//表单禁用 |
||||
disabled: { |
||||
type: Boolean, |
||||
default: false, |
||||
required: false |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
model:{ |
||||
modulextypeStatus:1 |
||||
}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
modulextypeName: [ |
||||
{ required: true, message: '请输入名称!'}, |
||||
], |
||||
modulextypeOrder: [ |
||||
{ required: true, message: '请输入排序!'}, |
||||
], |
||||
modulextypeStatus: [ |
||||
{ required: true, message: '请输入模板状态!'}, |
||||
], |
||||
}, |
||||
url: { |
||||
add: "/moduletype/moduleType/add", |
||||
edit: "/moduletype/moduleType/edit", |
||||
queryById: "/moduletype/moduleType/queryById" |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
formDisabled(){ |
||||
return this.disabled |
||||
}, |
||||
}, |
||||
created () { |
||||
//备份model原始值 |
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.edit(this.modelDefault); |
||||
}, |
||||
edit (record) { |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
}, |
||||
submitForm () { |
||||
const that = this; |
||||
// 触发表单验证 |
||||
this.$refs.form.validate(valid => { |
||||
if (valid) { |
||||
that.confirmLoading = true; |
||||
let httpurl = ''; |
||||
let method = ''; |
||||
if(!this.model.id){ |
||||
httpurl+=this.url.add; |
||||
method = 'post'; |
||||
}else{ |
||||
httpurl+=this.url.edit; |
||||
method = 'put'; |
||||
} |
||||
httpAction(httpurl,this.model,method).then((res)=>{ |
||||
if(res.success){ |
||||
that.$message.success(res.message); |
||||
that.$emit('ok'); |
||||
}else{ |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,60 @@ |
||||
<template> |
||||
<j-modal |
||||
:title="title" |
||||
:width="width" |
||||
:visible="visible" |
||||
switchFullscreen |
||||
@ok="handleOk" |
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
||||
@cancel="handleCancel" |
||||
cancelText="关闭"> |
||||
<module-type-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></module-type-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import ModuleTypeForm from './ModuleTypeForm' |
||||
export default { |
||||
name: 'ModuleTypeModal', |
||||
components: { |
||||
ModuleTypeForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:'', |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}) |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,84 @@ |
||||
<template> |
||||
<a-drawer |
||||
:title="title" |
||||
:width="width" |
||||
placement="right" |
||||
:closable="false" |
||||
@close="close" |
||||
destroyOnClose |
||||
:visible="visible"> |
||||
<module-type-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></module-type-form> |
||||
<div class="drawer-footer"> |
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> |
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> |
||||
</div> |
||||
</a-drawer> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import ModuleTypeForm from './ModuleTypeForm' |
||||
|
||||
export default { |
||||
name: 'ModuleTypeModal', |
||||
components: { |
||||
ModuleTypeForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}); |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
/** Button按钮间距 */ |
||||
.ant-btn { |
||||
margin-left: 30px; |
||||
margin-bottom: 30px; |
||||
float: right; |
||||
} |
||||
.drawer-footer{ |
||||
position: absolute; |
||||
bottom: -8px; |
||||
width: 100%; |
||||
border-top: 1px solid #e8e8e8; |
||||
padding: 10px 16px; |
||||
text-align: right; |
||||
left: 0; |
||||
background: #fff; |
||||
border-radius: 0 0 2px 2px; |
||||
} |
||||
</style> |
@ -0,0 +1,190 @@ |
||||
package org.jeecg.modules.demo.functiontemplate.controller; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
import java.io.IOException; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.net.URLDecoder; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
import org.apache.shiro.SecurityUtils; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import org.jeecg.common.system.vo.LoginUser; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
import org.jeecg.modules.demo.functiontemplate.entity.FunctionTemplate; |
||||
import org.jeecg.modules.demo.functiontemplate.service.IFunctionTemplateService; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil; |
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
||||
import org.jeecgframework.poi.excel.entity.ExportParams; |
||||
import org.jeecgframework.poi.excel.entity.ImportParams; |
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
import com.alibaba.fastjson.JSON; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.jeecg.common.aspect.annotation.AutoLog; |
||||
|
||||
/** |
||||
* @Description: 功能模板管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="功能模板管理") |
||||
@RestController |
||||
@RequestMapping("/functiontemplate/functionTemplate") |
||||
@Slf4j |
||||
public class FunctionTemplateController extends JeecgController<FunctionTemplate, IFunctionTemplateService> { |
||||
@Autowired |
||||
private IFunctionTemplateService functionTemplateService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param functionTemplate |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "功能模板管理-分页列表查询") |
||||
@ApiOperation(value="功能模板管理-分页列表查询", notes="功能模板管理-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(FunctionTemplate functionTemplate, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
// QueryWrapper<FunctionTemplate> queryWrapper = QueryGenerator.initQueryWrapper(functionTemplate, req.getParameterMap());
|
||||
QueryWrapper<FunctionTemplate> queryWrapper=new QueryWrapper<>(); |
||||
queryWrapper.eq("modulextype_id",functionTemplate.getModulextypeId()); |
||||
if(functionTemplate.getFunctionTemplateName()!=null){ |
||||
queryWrapper.like("function_template_name",functionTemplate.getFunctionTemplateName()); |
||||
} |
||||
if(functionTemplate.getFunctionTemplateEnName()!=null){ |
||||
queryWrapper.like("function_template_en_name",functionTemplate.getFunctionTemplateEnName()); |
||||
} |
||||
if(functionTemplate.getWorkStatus()!=null){ |
||||
queryWrapper.eq("work_status",functionTemplate.getWorkStatus()); |
||||
} |
||||
if(functionTemplate.getFunctionTemplateType()!=null){ |
||||
queryWrapper.eq("function_template_type",functionTemplate.getFunctionTemplateType()); |
||||
} |
||||
Page<FunctionTemplate> page = new Page<FunctionTemplate>(pageNo, pageSize); |
||||
IPage<FunctionTemplate> pageList = functionTemplateService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param functionTemplate |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "功能模板管理-添加") |
||||
@ApiOperation(value="功能模板管理-添加", notes="功能模板管理-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody FunctionTemplate functionTemplate) { |
||||
LoginUser loginUser=(LoginUser) SecurityUtils.getSubject().getPrincipal(); |
||||
functionTemplate.setCreateBy(loginUser.getId()); |
||||
functionTemplateService.save(functionTemplate); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param functionTemplate |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "功能模板管理-编辑") |
||||
@ApiOperation(value="功能模板管理-编辑", notes="功能模板管理-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody FunctionTemplate functionTemplate) { |
||||
functionTemplateService.updateById(functionTemplate); |
||||
return Result.OK("编辑成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "功能模板管理-通过id删除") |
||||
@ApiOperation(value="功能模板管理-通过id删除", notes="功能模板管理-通过id删除") |
||||
@DeleteMapping(value = "/delete") |
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
||||
functionTemplateService.removeById(id); |
||||
return Result.OK("删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除 |
||||
* |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "功能模板管理-批量删除") |
||||
@ApiOperation(value="功能模板管理-批量删除", notes="功能模板管理-批量删除") |
||||
@DeleteMapping(value = "/deleteBatch") |
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
||||
this.functionTemplateService.removeByIds(Arrays.asList(ids.split(","))); |
||||
return Result.OK("批量删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id查询 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "功能模板管理-通过id查询") |
||||
@ApiOperation(value="功能模板管理-通过id查询", notes="功能模板管理-通过id查询") |
||||
@GetMapping(value = "/queryById") |
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
||||
FunctionTemplate functionTemplate = functionTemplateService.getById(id); |
||||
if(functionTemplate==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(functionTemplate); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param functionTemplate |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, FunctionTemplate functionTemplate) { |
||||
return super.exportXls(request, functionTemplate, FunctionTemplate.class, "功能模板管理"); |
||||
} |
||||
|
||||
/** |
||||
* 通过excel导入数据 |
||||
* |
||||
* @param request |
||||
* @param response |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
||||
return super.importExcel(request, response, FunctionTemplate.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,121 @@ |
||||
package org.jeecg.modules.demo.functiontemplate.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.util.Date; |
||||
import java.math.BigDecimal; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* @Description: 功能模板管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("function_template") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="function_template对象", description="功能模板管理") |
||||
public class FunctionTemplate implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**主键*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "主键") |
||||
private java.lang.String id; |
||||
/**创建人*/ |
||||
@ApiModelProperty(value = "创建人") |
||||
@Dict(dictTable = "sys_user",dicCode = "id",dicText = "realname") |
||||
private java.lang.String createBy; |
||||
/**创建日期*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "创建日期") |
||||
private java.util.Date createTime; |
||||
/**更新人*/ |
||||
@ApiModelProperty(value = "更新人") |
||||
private java.lang.String updateBy; |
||||
/**更新日期*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "更新日期") |
||||
private java.util.Date updateTime; |
||||
/**模块模板类型id*/ |
||||
@Excel(name = "模块模板类型id", width = 15) |
||||
@ApiModelProperty(value = "模块模板类型id") |
||||
@Dict(dictTable = "module_type",dicCode = "id",dicText = "modulextype_name") |
||||
private java.lang.String modulextypeId; |
||||
/**中文名称*/ |
||||
@Excel(name = "中文名称", width = 15) |
||||
@ApiModelProperty(value = "中文名称") |
||||
private java.lang.String functionTemplateName; |
||||
/**英文名称*/ |
||||
@Excel(name = "英文名称", width = 15) |
||||
@ApiModelProperty(value = "英文名称") |
||||
private java.lang.String functionTemplateEnName; |
||||
/**功能编码*/ |
||||
@Excel(name = "功能编码", width = 15) |
||||
@ApiModelProperty(value = "功能编码") |
||||
private java.lang.String functionTemplateCode; |
||||
/**功能类型*/ |
||||
@Excel(name = "功能类型", width = 15) |
||||
@ApiModelProperty(value = "功能类型") |
||||
@Dict(dicCode = "function_type") |
||||
private java.lang.Integer functionTemplateType; |
||||
/**功能描述*/ |
||||
@Excel(name = "功能描述", width = 15) |
||||
@ApiModelProperty(value = "功能描述") |
||||
private java.lang.String functionTemplateDescribe; |
||||
/**分析图*/ |
||||
@Excel(name = "分析图", width = 15) |
||||
@ApiModelProperty(value = "分析图") |
||||
private java.lang.String diagrams; |
||||
/**用户角色*/ |
||||
@Excel(name = "用户角色", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@ApiModelProperty(value = "用户角色") |
||||
private java.lang.String userRole; |
||||
/**责任人*/ |
||||
@Excel(name = "责任人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@ApiModelProperty(value = "责任人") |
||||
private java.lang.String managerUsers; |
||||
/**任务等级*/ |
||||
@Excel(name = "任务等级", width = 15) |
||||
@ApiModelProperty(value = "任务等级") |
||||
@Dict(dicCode = "work_level") |
||||
private java.lang.Integer workLevel; |
||||
/**任务状态*/ |
||||
@Excel(name = "任务状态", width = 15) |
||||
@ApiModelProperty(value = "任务状态") |
||||
@Dict(dicCode = "work_status") |
||||
private java.lang.Integer workStatus; |
||||
/**发布时间*/ |
||||
@Excel(name = "发布时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "发布时间") |
||||
private java.util.Date publishTime; |
||||
/**开始时间*/ |
||||
@Excel(name = "开始时间", width = 15, format = "yyyy-MM-dd") |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd") |
||||
@ApiModelProperty(value = "开始时间") |
||||
private java.util.Date startTime; |
||||
/**任务时长*/ |
||||
@Excel(name = "任务时长", width = 15) |
||||
@ApiModelProperty(value = "任务时长") |
||||
private java.lang.Double duration; |
||||
} |
@ -0,0 +1,17 @@ |
||||
package org.jeecg.modules.demo.functiontemplate.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.jeecg.modules.demo.functiontemplate.entity.FunctionTemplate; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: 功能模板管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface FunctionTemplateMapper extends BaseMapper<FunctionTemplate> { |
||||
|
||||
} |
@ -0,0 +1,5 @@ |
||||
<?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="org.jeecg.modules.demo.functiontemplate.mapper.FunctionTemplateMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
package org.jeecg.modules.demo.functiontemplate.service; |
||||
|
||||
import org.jeecg.modules.demo.functiontemplate.entity.FunctionTemplate; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @Description: 功能模板管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface IFunctionTemplateService extends IService<FunctionTemplate> { |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package org.jeecg.modules.demo.functiontemplate.service.impl; |
||||
|
||||
import org.jeecg.modules.demo.functiontemplate.entity.FunctionTemplate; |
||||
import org.jeecg.modules.demo.functiontemplate.mapper.FunctionTemplateMapper; |
||||
import org.jeecg.modules.demo.functiontemplate.service.IFunctionTemplateService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 功能模板管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class FunctionTemplateServiceImpl extends ServiceImpl<FunctionTemplateMapper, FunctionTemplate> implements IFunctionTemplateService { |
||||
|
||||
} |
@ -0,0 +1,236 @@ |
||||
package org.jeecg.modules.demo.moduletype.controller; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
import java.io.IOException; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.net.URLDecoder; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
import org.apache.shiro.SecurityUtils; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import org.jeecg.common.system.vo.LoginUser; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
import org.jeecg.modules.demo.moduletype.entity.ModuleType; |
||||
import org.jeecg.modules.demo.moduletype.service.IModuleTypeService; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil; |
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
||||
import org.jeecgframework.poi.excel.entity.ExportParams; |
||||
import org.jeecgframework.poi.excel.entity.ImportParams; |
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
import com.alibaba.fastjson.JSON; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.jeecg.common.aspect.annotation.AutoLog; |
||||
|
||||
/** |
||||
* @Description: 模块模板类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="模块模板类型") |
||||
@RestController |
||||
@RequestMapping("/moduletype/moduleType") |
||||
@Slf4j |
||||
public class ModuleTypeController extends JeecgController<ModuleType, IModuleTypeService> { |
||||
@Autowired |
||||
private IModuleTypeService moduleTypeService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param moduleType |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "模块模板类型-分页列表查询") |
||||
@ApiOperation(value="模块模板类型-分页列表查询", notes="模块模板类型-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(ModuleType moduleType, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
//QueryWrapper<ModuleType> queryWrapper = QueryGenerator.initQueryWrapper(moduleType, req.getParameterMap());
|
||||
QueryWrapper<ModuleType> queryWrapper=new QueryWrapper<>(); |
||||
queryWrapper.orderByAsc("modulextype_order"); |
||||
if(moduleType.getModulextypeName()!=null&&moduleType.getModulextypeName().length()>0){ |
||||
queryWrapper.like("modulextype_name",moduleType.getModulextypeName()); |
||||
} |
||||
if(moduleType.getModulextypeStatus()!=null){ |
||||
queryWrapper.eq("modulextype_status",moduleType.getModulextypeStatus()); |
||||
} |
||||
Page<ModuleType> page = new Page<ModuleType>(pageNo, pageSize); |
||||
IPage<ModuleType> pageList = moduleTypeService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param moduleType |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "模块模板类型-添加") |
||||
@ApiOperation(value="模块模板类型-添加", notes="模块模板类型-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody ModuleType moduleType) { |
||||
//添加用户id
|
||||
LoginUser principal = (LoginUser)SecurityUtils.getSubject().getPrincipal(); |
||||
moduleType.setCreateBy(principal.getId()); |
||||
//设置排序
|
||||
Integer sort=moduleTypeService.getLastOne(); |
||||
if(sort==null){ |
||||
moduleType.setModulextypeOrder(1); |
||||
}else{ |
||||
moduleType.setModulextypeOrder(sort+1); |
||||
} |
||||
moduleTypeService.save(moduleType); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param moduleType |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "模块模板类型-编辑") |
||||
@ApiOperation(value="模块模板类型-编辑", notes="模块模板类型-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody ModuleType moduleType) { |
||||
moduleTypeService.updateById(moduleType); |
||||
return Result.OK("编辑成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "模块模板类型-通过id删除") |
||||
@ApiOperation(value="模块模板类型-通过id删除", notes="模块模板类型-通过id删除") |
||||
@DeleteMapping(value = "/delete") |
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
||||
Integer sort=moduleTypeService.getLastOne(); |
||||
if(sort==null){ |
||||
return Result.error("数据异常!!!"); |
||||
} |
||||
ModuleType byId = moduleTypeService.getById(id); |
||||
if(byId.getModulextypeOrder()!=sort){ |
||||
return Result.error("请迁移至最后一个再进行删除!!!"); |
||||
} |
||||
moduleTypeService.removeById(id); |
||||
return Result.OK("删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除 |
||||
* |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "模块模板类型-批量删除") |
||||
@ApiOperation(value="模块模板类型-批量删除", notes="模块模板类型-批量删除") |
||||
@DeleteMapping(value = "/deleteBatch") |
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
||||
this.moduleTypeService.removeByIds(Arrays.asList(ids.split(","))); |
||||
return Result.OK("批量删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id查询 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "模块模板类型-通过id查询") |
||||
@ApiOperation(value="模块模板类型-通过id查询", notes="模块模板类型-通过id查询") |
||||
@GetMapping(value = "/queryById") |
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
||||
ModuleType moduleType = moduleTypeService.getById(id); |
||||
if(moduleType==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(moduleType); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param moduleType |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, ModuleType moduleType) { |
||||
return super.exportXls(request, moduleType, ModuleType.class, "模块模板类型"); |
||||
} |
||||
|
||||
/** |
||||
* 通过excel导入数据 |
||||
* |
||||
* @param request |
||||
* @param response |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
||||
return super.importExcel(request, response, ModuleType.class); |
||||
} |
||||
|
||||
@GetMapping(value = "/qian") |
||||
public Result<?> qian(@RequestParam(name="id",required=true) String id) { |
||||
ModuleType moduleType = moduleTypeService.getById(id); |
||||
//先找到当前这个id对应的sort,获取它的前一个,进行一下交换即可
|
||||
List<ModuleType> list=moduleTypeService.selectQTwo(moduleType.getModulextypeOrder()); |
||||
if(list==null||list.size()<=1){ |
||||
return Result.error("当前已是第一条,无法前移!!"); |
||||
} |
||||
ModuleType moduleType1=list.get(1); |
||||
int a=moduleType1.getModulextypeOrder(); |
||||
moduleType1.setModulextypeOrder(list.get(0).getModulextypeOrder()); |
||||
moduleTypeService.saveOrUpdate(moduleType1); |
||||
moduleType.setModulextypeOrder(a); |
||||
moduleTypeService.saveOrUpdate(moduleType); |
||||
//理论上只用查询排序小于的第一条就够了,查多了一条,无所谓。
|
||||
return Result.OK("前移成功!!"); |
||||
} |
||||
@GetMapping(value = "/hou") |
||||
public Result<?> hou(@RequestParam(name="id",required=true) String id) { |
||||
ModuleType moduleType = moduleTypeService.getById(id); |
||||
//先找到当前这个id对应的sort,获取它的前一个,进行一下交换即可
|
||||
List<ModuleType> list=moduleTypeService.selectHTwo(moduleType.getModulextypeOrder()); |
||||
if(list==null||list.size()<=1){ |
||||
return Result.error("当前已是最后一条,无法后移!!"); |
||||
} |
||||
ModuleType moduleType1=list.get(1); |
||||
int a=moduleType1.getModulextypeOrder(); |
||||
moduleType1.setModulextypeOrder(list.get(0).getModulextypeOrder()); |
||||
moduleTypeService.saveOrUpdate(moduleType1); |
||||
moduleType.setModulextypeOrder(a); |
||||
moduleTypeService.saveOrUpdate(moduleType); |
||||
//理论上只用查询排序小于的第一条就够了,查多了一条,无所谓。
|
||||
return Result.OK("后移成功!!"); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,68 @@ |
||||
package org.jeecg.modules.demo.moduletype.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.util.Date; |
||||
import java.math.BigDecimal; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* @Description: 模块模板类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("module_type") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="module_type对象", description="模块模板类型") |
||||
public class ModuleType implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**主键*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "主键") |
||||
private java.lang.String id; |
||||
/**创建人*/ |
||||
@ApiModelProperty(value = "创建人") |
||||
@Dict(dictTable = "sys_user",dicCode = "id",dicText = "realname") |
||||
private java.lang.String createBy; |
||||
/**创建日期*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "创建日期") |
||||
private java.util.Date createTime; |
||||
/**更新人*/ |
||||
@ApiModelProperty(value = "更新人") |
||||
private java.lang.String updateBy; |
||||
/**更新日期*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "更新日期") |
||||
private java.util.Date updateTime; |
||||
/**名称*/ |
||||
@Excel(name = "名称", width = 15) |
||||
@ApiModelProperty(value = "名称") |
||||
private java.lang.String modulextypeName; |
||||
/**排序*/ |
||||
@Excel(name = "排序", width = 15) |
||||
@ApiModelProperty(value = "排序") |
||||
private java.lang.Integer modulextypeOrder; |
||||
/**模板状态*/ |
||||
@Excel(name = "模板状态", width = 15) |
||||
@ApiModelProperty(value = "模板状态") |
||||
@Dict(dicCode = "modulextype_status") |
||||
private java.lang.Integer modulextypeStatus; |
||||
} |
@ -0,0 +1,24 @@ |
||||
package org.jeecg.modules.demo.moduletype.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.jeecg.modules.demo.moduletype.entity.ModuleType; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: 模块模板类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ModuleTypeMapper extends BaseMapper<ModuleType> { |
||||
|
||||
@Select("select modulextype_order from module_type order by modulextype_order desc limit 0,1") |
||||
Integer getLastOne(); |
||||
@Select("SELECT * FROM module_type WHERE modulextype_order<=#{sort} ORDER BY modulextype_order DESC LIMIT 0,2") |
||||
List<ModuleType> selectQTwo(@Param("sort") Integer sort); |
||||
@Select("SELECT * FROM module_type WHERE modulextype_order>=#{sort} ORDER BY modulextype_order LIMIT 0,2") |
||||
List<ModuleType> selectHTwo(@Param("sort") Integer sort); |
||||
} |
@ -0,0 +1,5 @@ |
||||
<?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="org.jeecg.modules.demo.moduletype.mapper.ModuleTypeMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,21 @@ |
||||
package org.jeecg.modules.demo.moduletype.service; |
||||
|
||||
import org.jeecg.modules.demo.moduletype.entity.ModuleType; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Description: 模块模板类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface IModuleTypeService extends IService<ModuleType> { |
||||
|
||||
Integer getLastOne(); |
||||
|
||||
List<ModuleType> selectQTwo(Integer modulextypeOrder); |
||||
|
||||
List<ModuleType> selectHTwo(Integer modulextypeOrder); |
||||
} |
@ -0,0 +1,38 @@ |
||||
package org.jeecg.modules.demo.moduletype.service.impl; |
||||
|
||||
import org.jeecg.modules.demo.moduletype.entity.ModuleType; |
||||
import org.jeecg.modules.demo.moduletype.mapper.ModuleTypeMapper; |
||||
import org.jeecg.modules.demo.moduletype.service.IModuleTypeService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Description: 模块模板类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-05-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ModuleTypeServiceImpl extends ServiceImpl<ModuleTypeMapper, ModuleType> implements IModuleTypeService { |
||||
|
||||
@Autowired |
||||
ModuleTypeMapper moduleTypeMapper; |
||||
@Override |
||||
public Integer getLastOne() { |
||||
return moduleTypeMapper.getLastOne(); |
||||
} |
||||
|
||||
@Override |
||||
public List<ModuleType> selectQTwo(Integer modulextypeOrder) { |
||||
return moduleTypeMapper.selectQTwo(modulextypeOrder); |
||||
} |
||||
|
||||
@Override |
||||
public List<ModuleType> selectHTwo(Integer modulextypeOrder) { |
||||
return moduleTypeMapper.selectHTwo(modulextypeOrder); |
||||
} |
||||
} |
Loading…
Reference in new issue