Gitea 1 year ago
parent 2ef9b39cf9
commit 81ecf23eaf
  1. 210
      ant-design-vue-jeecg/src/views/requiremententity/RequirementEntityList.vue
  2. 382
      ant-design-vue-jeecg/src/views/requiremententity/RequirementEntityList1.vue
  3. 133
      ant-design-vue-jeecg/src/views/requiremententity/modules/RequirementEntityForm.vue
  4. 60
      ant-design-vue-jeecg/src/views/requiremententity/modules/RequirementEntityModal.vue
  5. 84
      ant-design-vue-jeecg/src/views/requiremententity/modules/RequirementEntityModal__Style#Drawer.vue
  6. 171
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requiremententity/controller/RequirementEntityController.java
  7. 79
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requiremententity/entity/RequirementEntity.java
  8. 17
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requiremententity/mapper/RequirementEntityMapper.java
  9. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requiremententity/mapper/xml/RequirementEntityMapper.xml
  10. 14
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requiremententity/service/IRequirementEntityService.java
  11. 19
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requiremententity/service/impl/RequirementEntityServiceImpl.java

@ -0,0 +1,210 @@
<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="需求">
<j-dict-select-tag placeholder="请选择需求" v-model="queryParam.requirementId" dictCode="requirement_item,requirement_name,id"/>
</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.entityName"></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.entityEnName"></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 placeholder="请选择实体状态" v-model="queryParam.entityStatus" dictCode="entity_status"/>
</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>
</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>
<requirement-entity-modal ref="modalForm" @ok="modalFormOk"></requirement-entity-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import RequirementEntityModal from './modules/RequirementEntityModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
export default {
name: 'RequirementEntityList',
mixins:[JeecgListMixin, mixinDevice],
components: {
RequirementEntityModal
},
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: 'requirementId_dictText'
},
{
title:'名称',
align:"center",
dataIndex: 'entityName'
},
{
title:'英文名称',
align:"center",
dataIndex: 'entityEnName'
},
{
title:'实体描述',
align:"center",
dataIndex: 'entityDescribe',
scopedSlots: {customRender: 'htmlSlot'}
},
{
title:'实体状态',
align:"center",
dataIndex: 'entityStatus_dictText'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/requiremententity/requirementEntity/list",
delete: "/requiremententity/requirementEntity/delete",
deleteBatch: "/requiremententity/requirementEntity/deleteBatch",
exportXlsUrl: "/requiremententity/requirementEntity/exportXls",
importExcelUrl: "requiremententity/requirementEntity/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'requirementId',text:'需求',dictCode:'requirement_item,requirement_name,id'})
fieldList.push({type:'string',value:'entityName',text:'名称',dictCode:''})
fieldList.push({type:'string',value:'entityEnName',text:'英文名称',dictCode:''})
fieldList.push({type:'string',value:'entityDescribe',text:'实体描述',dictCode:''})
fieldList.push({type:'int',value:'entityStatus',text:'实体状态',dictCode:'entity_status'})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

@ -0,0 +1,382 @@
<template>
<a-modal
width="96%"
title="抽取对象"
:visible="visible"
:confirm-loading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
>
<div>
<span style="text-align: center;display:block;font-weight:bold;">需求名称{{tableName}}</span>
<j-vxe-table
ref="xTable"
:columns="columns"
:dataSource="dataSource"
:loading="loading"
height='auto'
toolbar
:toolbarConfig="toolbarConfig"
row-number
row-selection
keep-source
async-remove
:pagination="pagination"
style="margin-top: 8px;"
@pageChange="handlePageChange"
@added="added">
<template v-slot:toolbarSuffix>
<a style="
background: #e6f7ff;
color: red;
position: relative;
border: 1px solid #91d5ff;
padding: 6px 300px 8px 31px;
border-radius: 5px;">
注意: 编辑后请点击保存按钮保存数据</a>
<!-- <a-button type="primary" icon="rollback" @click="fanHui()">返回</a-button>-->
<!-- <p style="color: red;font-size: 16px"></p>-->
</template>
<template v-slot:action="props">
<a @click="submitForm(props)">保存</a>
<a-divider type="vertical"/>
<!-- <a @click="viewDetail(props.rowId)">详情</a>-->
<!-- <a-divider type="vertical"/>-->
<a-popconfirm title="确定删除吗?" @confirm="handleDelete(props.rowId)">
<a>删除</a>
</a-popconfirm>
</template>
</j-vxe-table>
</div>
</a-modal>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import {JVXETypes} from '@/components/jeecg/JVxeTable'
import {filterObj} from '@/utils/util'
import { httpAction, getAction } from '@/api/manage'
export default {
name: 'FieldxList',
mixins: [JeecgListMixin, mixinDevice],
components: {},
data() {
return {
description: '抽取对象管理页面',
tableid:'',
visible: false,
confirmLoading: false,
//
toolbarConfig: {
// add remove clearSelection
btn: ['add'],
},
//
loading: false,
//
pagination: {
//
current: 1,
//
pageSize: 10,
//
pageSizeOptions: ['10', '20', '30', '100', '200'],
// 0
total: 0,
showQuickJumper: true,
showSizeChanger: true,
id: null
},
// reload
reloadEffect:true,
//
columns: [
/*
如果留行号和可选择行的话 宽度得留给它12% 也就是还省88%的宽度
关于插槽 每个按钮留10%的宽度 如果有两个按钮 宽度就设为20% 按钮一般就两个字
*/
// {
// title: '', width: '100px', fixed: 'left', key: '',
// type: JVXETypes.normal,
// placeholder: '${title}',
// disabled: true,
// },
// {
// key: 'tableId_dictText', title: '', width: '6%',
// type: JVXETypes.normal,
// disabled: true,
// },
{
key: 'entityName', title: '名称', width: '16%',
type: JVXETypes.input,
validateRules: [{required: true, message: '${title}不能为空'},{unique:true,message:'${title}重复'}]
},
{
key: 'entityEnName', title: '英文名称', width: '16%',
type: JVXETypes.input,
validateRules: [{required: true, message: '${title}不能为空'},{unique:true,message:'${title}重复'}]
},
{
key: 'entityStatus', title: '实体状态', width: '16%',
type: JVXETypes.select,
dictCode:'entity_status',
defaultValue:0,
validateRules: [{required: true, message: '${title}不能为空'}]
},
// {
// key: 'verison', title: '', width: '18%',
// type: JVXETypes.input,
// dictCode:'yn',
// },
// {
// title: '',
// dataIndex: 'action',
// align: "center",
// fixed: "right",
// width: 147,
// scopedSlots: {customRender: 'action'}
// }
{
title: '操作',
key: 'action',
type: JVXETypes.slot,
fixed: 'right',
//
align: 'center',
minWidth: '10%',
slotName: 'action',
}
],
url: {
add: "/requiremententity/requirementEntity/add",
edit: "/requiremententity/requirementEntity/edit",
list: "/requiremententity/requirementEntity/list",
delete: "/requiremententity/requirementEntity/delete",
deleteBatch: "/requiremententity/requirementEntity/deleteBatch",
exportXlsUrl: "/requiremententity/requirementEntity/exportXls",
importExcelUrl: "/requiremententity/requirementEntity/importExcel",
},
dictOptions: {},
superFieldList: [],
//
loadRouteType: false,
isorterx: {
column: 'createTime',
order: 'asc',
},
tableName:'',
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
submitForm(props) {
//
this.$refs.xTable.validateTable().then(errMap => {
if (!errMap) {
this.model = Object.assign({}, props);
var str = props.rowId;
let httpurl = '';
let method = '';
if (str.search("row") !== -1) {
props.row.id ='';
console.log("新增")
httpurl += this.url.add;
method = 'post';
} else {
console.log("编辑")
httpurl += this.url.edit;
method = 'put';
}
props.row.requirementId = this.tableid;
console.log(props.row)
httpAction(httpurl, props.row, method).then((res) => {
if (res.success) {
if(method=="post"){
props.row.id =res.result.id;
}
this.$message.success(res.message);
this.$emit('ok');
} else {
this.$message.warning(res.message);
}
})
} else {
// errMap
//console.log(errMap.entityName.rule.message)
this.$message.error(errMap.entityName.rule.message);
}
});
},
//
added(event) {
//ref
// const values = this.$refs.xTable.getTableData()
// console.log(':', { values })
const {type, row, column, value, target} = event
console.log(event,"-------")
target.setValues([{
rowKey: row.id,
values: {tableId_dictText: this.tableName}
}])
},
//
async handleValueChange(event) {
//this.submitForm(event)
// console.log("//", event);
//const str = event.row.id;
let httpUrl = this.url.edit;
let method = 'put';
await httpAction(httpUrl, event.row, method).then((res) => {
if (res.success) {
this.$message.success(res.message);
this.$emit('ok');
} else {
this.$message.warning(res.message);
}
})
},
edit(record) {
this.model = Object.assign({}, record);
console.log(this.model)
//console.log(topicid);
this.queryParam.requirementId = this.model.requirementId;
this.tableid = this.model.requirementId
this.tableName=this.model.requirementId_dictText;
//console.log(this.queryParam.topicid);
this.loadData();
},
showModal() {
this.visible = true;
},
// handleOk(e) {
// this.ModalText = 'The modal will be closed after two seconds';
// this.confirmLoading = true;
// setTimeout(() => {
// this.visible = false;
// this.confirmLoading = false;
// }, 2000);
// },
handleOk(e) {
this.visible = false;
},
handleCancel(e) {
console.log('Clicked cancel button');
this.visible = false;
},
initDictConfig() {
},
//
loadParameter() {
if (this.loadRouteType === false) {
// this.id = this.$route.query.id;
console.log('this.id -----------------', this.id)
//this.styleId = this.id;
//this.biaoTi = this.$route.query.styleNames + "";
//console.log("**********id" + this.id);
this.loadRouteType = true;
}
},
//
loadData(arg) {
// 1
if (arg === 1) {
this.pagination.current = 1;
}
//
this.loadParameter();
var params = this.getQueryParams1();//
this.loading = true;
getAction(this.url.list, params).then(res => {
if (res.success) {
/*// 后台查询回来的 total数据总数量
this.pagination.total = res.result.total*/
// dataSource
this.dataSource = res.result.records || res.result;
console.log(this.dataSource, 'abc')
if (res.result.total) {
this.pagination.total = res.result.total;
} else {
this.pagination.total = 0;
}
//this.dataSource = res.result.records
} else {
this.$error({title: '主表查询失败', content: res.message})
}
}).finally(() => {
// loading
this.loading = false
})
},
//
handlePageChange(event) {
//
this.pagination.current = event.current
this.pagination.pageSize = event.pageSize
//
this.loadData()
},
getQueryParams1() {
//
let sqp = {}
if (this.superQueryParams) {
sqp['superQueryParams'] = encodeURI(this.superQueryParams)
sqp['superQueryMatchType'] = this.superQueryMatchType
}
var param = Object.assign(sqp, this.queryParam, this.isorterx, this.filters);
param.pageNo = this.pagination.current;
param.pageSize = this.pagination.pageSize;
//param.id = this.id
return filterObj(param);
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'tableId',text:'对应实体',dictCode:'tablex,table_name,id'})
fieldList.push({type:'string',value:'fieldName',text:'中文名称',dictCode:''})
fieldList.push({type:'string',value:'fieldEnName',text:'英文名称',dictCode:''})
fieldList.push({type:'sel_search',value:'type',text:'数据类型',dictTable:'', dictText:'', dictCode:'date_type'})
fieldList.push({type:'int',value:'length',text:'数据长度',dictCode:''})
fieldList.push({type:'int',value:'accuracy',text:'浮点精度',dictCode:''})
fieldList.push({type:'string',value:'format',text:'显示形式',dictCode:''})
fieldList.push({type:'int',value:'isPk',text:'是否主键',dictCode:''})
fieldList.push({type:'int',value:'isFk',text:'是否外键',dictCode:''})
fieldList.push({type:'string',value:'associateTable',text:'关联实体',dictCode:'tablex,table_name,id'})
fieldList.push({type:'string',value:'associateField',text:'关联字段',dictCode:'fieldx,field_name,id'})
fieldList.push({type:'int',value:'isNull',text:'是否为空',dictCode:''})
fieldList.push({type:'int',value:'isUniqueness',text:'是否重复',dictCode:''})
fieldList.push({type:'string',value:'rule',text:'字段规则',dictCode:''})
fieldList.push({type:'int',value:'status',text:'字段状态',dictCode:''})
fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''})
fieldList.push({type:'int',value:'verison',text:'版本号',dictCode:''})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

@ -0,0 +1,133 @@
<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="requirementId">
<j-dict-select-tag type="list" v-model="model.requirementId" dictCode="requirement_item,requirement_name,id" placeholder="请选择需求" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="entityName">
<a-input v-model="model.entityName" placeholder="请输入名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="英文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="entityEnName">
<a-input v-model="model.entityEnName" placeholder="请输入英文名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="实体描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="entityDescribe">
<j-editor v-model="model.entityDescribe" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="实体状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="entityStatus">
<j-dict-select-tag type="radio" v-model="model.entityStatus" dictCode="entity_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: 'RequirementEntityForm',
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: {
requirementId: [
{ required: true, message: '请输入需求!'},
],
entityName: [
{ required: true, message: '请输入名称!'},
],
entityEnName: [
{ required: true, message: '请输入英文名称!'},
],
},
url: {
add: "/requiremententity/requirementEntity/add",
edit: "/requiremententity/requirementEntity/edit",
queryById: "/requiremententity/requirementEntity/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="关闭">
<requirement-entity-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></requirement-entity-form>
</j-modal>
</template>
<script>
import RequirementEntityForm from './RequirementEntityForm'
export default {
name: 'RequirementEntityModal',
components: {
RequirementEntityForm
},
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">
<requirement-entity-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></requirement-entity-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 RequirementEntityForm from './RequirementEntityForm'
export default {
name: 'RequirementEntityModal',
components: {
RequirementEntityForm
},
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,171 @@
package org.jeecg.modules.demo.requiremententity.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.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.requiremententity.entity.RequirementEntity;
import org.jeecg.modules.demo.requiremententity.service.IRequirementEntityService;
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-07-10
* @Version: V1.0
*/
@Api(tags="需求实体抽取管理")
@RestController
@RequestMapping("/requiremententity/requirementEntity")
@Slf4j
public class RequirementEntityController extends JeecgController<RequirementEntity, IRequirementEntityService> {
@Autowired
private IRequirementEntityService requirementEntityService;
/**
* 分页列表查询
*
* @param requirementEntity
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "需求实体抽取管理-分页列表查询")
@ApiOperation(value="需求实体抽取管理-分页列表查询", notes="需求实体抽取管理-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(RequirementEntity requirementEntity,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<RequirementEntity> queryWrapper = QueryGenerator.initQueryWrapper(requirementEntity, req.getParameterMap());
Page<RequirementEntity> page = new Page<RequirementEntity>(pageNo, pageSize);
IPage<RequirementEntity> pageList = requirementEntityService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param requirementEntity
* @return
*/
@AutoLog(value = "需求实体抽取管理-添加")
@ApiOperation(value="需求实体抽取管理-添加", notes="需求实体抽取管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody RequirementEntity requirementEntity) {
requirementEntityService.save(requirementEntity);
return Result.OK(requirementEntity);
}
/**
* 编辑
*
* @param requirementEntity
* @return
*/
@AutoLog(value = "需求实体抽取管理-编辑")
@ApiOperation(value="需求实体抽取管理-编辑", notes="需求实体抽取管理-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody RequirementEntity requirementEntity) {
requirementEntityService.updateById(requirementEntity);
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) {
requirementEntityService.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.requirementEntityService.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) {
RequirementEntity requirementEntity = requirementEntityService.getById(id);
if(requirementEntity==null) {
return Result.error("未找到对应数据");
}
return Result.OK(requirementEntity);
}
/**
* 导出excel
*
* @param request
* @param requirementEntity
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, RequirementEntity requirementEntity) {
return super.exportXls(request, requirementEntity, RequirementEntity.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, RequirementEntity.class);
}
}

@ -0,0 +1,79 @@
package org.jeecg.modules.demo.requiremententity.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-07-10
* @Version: V1.0
*/
@Data
@TableName("requirement_entity")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="requirement_entity对象", description="需求实体抽取管理")
public class RequirementEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
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;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**需求id*/
@Excel(name = "需求id", width = 15, dictTable = "requirement_item", dicText = "requirement_name", dicCode = "id")
@Dict(dictTable = "requirement_item", dicText = "requirement_name", dicCode = "id")
@ApiModelProperty(value = "需求id")
private java.lang.String requirementId;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private java.lang.String entityName;
/**英文名称*/
@Excel(name = "英文名称", width = 15)
@ApiModelProperty(value = "英文名称")
private java.lang.String entityEnName;
/**实体描述*/
@Excel(name = "实体描述", width = 15)
@ApiModelProperty(value = "实体描述")
private java.lang.String entityDescribe;
/**实体状态*/
@Excel(name = "实体状态", width = 15, dicCode = "entity_status")
@Dict(dicCode = "entity_status")
@ApiModelProperty(value = "实体状态")
private java.lang.Integer entityStatus;
}

@ -0,0 +1,17 @@
package org.jeecg.modules.demo.requiremententity.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.demo.requiremententity.entity.RequirementEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 需求实体抽取管理
* @Author: jeecg-boot
* @Date: 2023-07-10
* @Version: V1.0
*/
public interface RequirementEntityMapper extends BaseMapper<RequirementEntity> {
}

@ -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.requiremententity.mapper.RequirementEntityMapper">
</mapper>

@ -0,0 +1,14 @@
package org.jeecg.modules.demo.requiremententity.service;
import org.jeecg.modules.demo.requiremententity.entity.RequirementEntity;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 需求实体抽取管理
* @Author: jeecg-boot
* @Date: 2023-07-10
* @Version: V1.0
*/
public interface IRequirementEntityService extends IService<RequirementEntity> {
}

@ -0,0 +1,19 @@
package org.jeecg.modules.demo.requiremententity.service.impl;
import org.jeecg.modules.demo.requiremententity.entity.RequirementEntity;
import org.jeecg.modules.demo.requiremententity.mapper.RequirementEntityMapper;
import org.jeecg.modules.demo.requiremententity.service.IRequirementEntityService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 需求实体抽取管理
* @Author: jeecg-boot
* @Date: 2023-07-10
* @Version: V1.0
*/
@Service
public class RequirementEntityServiceImpl extends ServiceImpl<RequirementEntityMapper, RequirementEntity> implements IRequirementEntityService {
}
Loading…
Cancel
Save