2023-05-12-02-bug

master
喻忠伟 2 years ago
parent a208888ffb
commit 72873b58b0
  1. 471
      ant-design-vue-jeecg/src/views/sensor/SensorList.vue
  2. 300
      ant-design-vue-jeecg/src/views/sensor/modules/SensorForm.vue
  3. 652
      ant-design-vue-jeecg/src/views/team/StationList.vue
  4. 347
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/sensor/controller/SensorController.java
  5. 431
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java

@ -1,229 +1,244 @@
<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.sensorCode"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="车间">
<j-search-select-tag placeholder="请选择车间" v-model="queryParam.workshopId" dict="sys_depart,depart_name,id"/>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="工位">
<a-input placeholder="请输入工位" v-model="queryParam.stationId"></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.iiOsign" dictCode="ioinset"/>
</a-form-item>
</a-col>
</template>
<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>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</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>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<sensor-modal ref="modalForm" @ok="modalFormOk"></sensor-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import SensorModal from './modules/SensorModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
export default {
name: 'SensorList',
mixins:[JeecgListMixin, mixinDevice],
components: {
SensorModal
},
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: 'sensorCode'
},
{
title:'车间',
align:"center",
dataIndex: 'workshopId_dictText'
},
{
title:'网络地址',
align:"center",
dataIndex: 'sensorIp'
},
{
title:'工位',
align:"center",
dataIndex: 'stationId_dictText'
},
{
title:'进出标记',
align:"center",
dataIndex: 'iiOsign_dictText'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/sensor/sensor/list",
delete: "/sensor/sensor/delete",
deleteBatch: "/sensor/sensor/deleteBatch",
exportXlsUrl: "/sensor/sensor/exportXls",
importExcelUrl: "sensor/sensor/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:'sensorCode',text:'传感器编号',dictCode:''})
fieldList.push({type:'sel_search',value:'workshopId',text:'车间',dictTable:'sys_depart', dictText:'depart_name', dictCode:'id'})
fieldList.push({type:'string',value:'sensorIp',text:'网络地址',dictCode:''})
fieldList.push({type:'string',value:'stationId',text:'工位',dictCode:'station,station_name,id'})
fieldList.push({type:'popup',value:'station',text:'工位', popup:{code:'findgw',field:'id',orgFields:'id',destFields:'station_id'}})
fieldList.push({type:'string',value:'iiOsign',text:'进出标记',dictCode:'ioinset'})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
<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.sensorCode"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="车间">
<j-search-select-tag placeholder="请选择车间" v-model="queryParam.workshopId" dict="sys_depart,depart_name,id"/>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="工位">
<a-input placeholder="请输入工位" v-model="queryParam.stationId"></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.iiOsign" dictCode="ioinset"/>
</a-form-item>
</a-col>
</template>
<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>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</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>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<sensor-modal ref="modalForm" @ok="modalFormOk"></sensor-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import SensorModal from './modules/SensorModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
import { filterObj } from '@/utils/util';
export default {
name: 'SensorList',
mixins:[JeecgListMixin, mixinDevice],
components: {
SensorModal
},
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: 'sensorCode'
},
{
title:'车间',
align:"center",
dataIndex: 'workshopId_dictText'
},
{
title:'网络地址',
align:"center",
dataIndex: 'sensorIp'
},
{
title:'工位',
align:"center",
dataIndex: 'stationId_dictText'
},
{
title:'进出标记',
align:"center",
dataIndex: 'iiOsign_dictText'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/sensor/sensor/list",
delete: "/sensor/sensor/delete",
deleteBatch: "/sensor/sensor/deleteBatch",
exportXlsUrl: "/sensor/sensor/exportXls",
importExcelUrl: "sensor/sensor/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getQueryParams(arg) {
//
let sqp = {}
if (this.superQueryParams) {
sqp['superQueryParams'] = encodeURI(this.superQueryParams)
sqp['superQueryMatchType'] = this.superQueryMatchType
}
var param = Object.assign(sqp, this.queryParam, {}, this.filters)
param.field = this.getQueryField()
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
return filterObj(param)
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'sensorCode',text:'传感器编号',dictCode:''})
fieldList.push({type:'sel_search',value:'workshopId',text:'车间',dictTable:'sys_depart', dictText:'depart_name', dictCode:'id'})
fieldList.push({type:'string',value:'sensorIp',text:'网络地址',dictCode:''})
fieldList.push({type:'string',value:'stationId',text:'工位',dictCode:'station,station_name,id'})
fieldList.push({type:'popup',value:'station',text:'工位', popup:{code:'findgw',field:'id',orgFields:'id',destFields:'station_id'}})
fieldList.push({type:'string',value:'iiOsign',text:'进出标记',dictCode:'ioinset'})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

@ -1,147 +1,155 @@
<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="sensorCode">
<a-input v-model="model.sensorCode" placeholder="请输入传感器编号" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="车间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workshopId">
<j-search-select-tag v-model="model.workshopId" dict="sys_depart,depart_name,id" disabled/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="网络地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sensorIp">
<a-input v-model="model.sensorIp" placeholder="请输入网络地址" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="工位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="station">
<j-popup
v-model="model.station"
field="station"
org-fields="id,station_name,depart_id"
dest-fields="stationId,station,workshopId"
code="findgw"
:multi="true"
@input="popupCallback"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="进出标记" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="iiOsign">
<j-dict-select-tag type="list" v-model="model.iiOsign" dictCode="ioinset" 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: 'SensorForm',
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: {
sensorCode: [
{ required: true, message: '请输入传感器编号!'},
],
workshopId: [
{ required: true, message: '请输入车间!'},
],
sensorIp: [
{ required: true, message: '请输入网络地址!'},
],
iiOsign: [
{ required: true, message: '请输入进出标记!'},
],
},
url: {
add: "/sensor/sensor/add",
edit: "/sensor/sensor/edit",
queryById: "/sensor/sensor/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;
})
}
})
},
popupCallback(value,row){
this.model = Object.assign(this.model, row);
},
}
}
<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="sensorCode">
<a-input v-model="model.sensorCode" placeholder="请输入传感器编号" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="车间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workshopId">
<j-tree-select v-model="model.workshopId"
dict="sys_depart,depart_name,id"
pidField="parent_id"
placeholder="请选择车间"
condition='{"org_category":"2"}'
hasChildField="1"
>
</j-tree-select>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="网络地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sensorIp">
<a-input v-model="model.sensorIp" placeholder="请输入网络地址" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="工位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="station">
<!--<j-popup-->
<!--v-model="model.station"-->
<!--field="station"-->
<!--org-fields="id,station_name,depart_id"-->
<!--dest-fields="stationId,station,workshopId"-->
<!--code="findgw"-->
<!--:multi="true"-->
<!--@input="popupCallback"-->
<!--/>-->
<j-search-select-tag v-model="model.stationId" dict="station,station_name,id" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="进出标记" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="iiOsign">
<j-dict-select-tag type="list" v-model="model.iiOsign" dictCode="ioinset" 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: 'SensorForm',
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: {
sensorCode: [
{ required: true, message: '请输入传感器编号!'},
],
workshopId: [
{ required: true, message: '请输入车间!'},
],
sensorIp: [
{ required: true, message: '请输入网络地址!'},
],
iiOsign: [
{ required: true, message: '请输入进出标记!'},
],
},
url: {
add: "/sensor/sensor/add",
edit: "/sensor/sensor/edit",
queryById: "/sensor/sensor/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;
})
}
})
},
popupCallback(value,row){
this.model = Object.assign(this.model, row);
},
}
}
</script>

@ -1,319 +1,335 @@
<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="车间ID">-->
<!-- <a-input placeholder="请输入车间ID" v-model="queryParam.departId"></a-input>-->
<!-- </a-form-item>-->
<a-form-model-item label="车间名称">
<!-- <a-input placeholder="请输入部门编号" v-model="model.departId"/>-->
<j-select-depart placeholder="请选择车间" v-model="queryParam.departId"/>
</a-form-model-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="工位名称">
<a-input placeholder="请输入工位名称" v-model="queryParam.stationName"></a-input>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
</template>
<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>
<!-- <a @click="handleToggleSearch" style="margin-left: 8px">-->
<!-- {{ toggleSearchStatus ? '收起' : '展开' }}-->
<!-- <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
<!-- </a>-->
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 操作按钮区域 -->
<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>-->
<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"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
class="j-table-force-nowrap"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<span slot="toolsIds_dictText" slot-scope="text, record">
<a-popover>
<template slot="content">
<p>{{ text }}</p>
</template>
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{
text
}}</a>
</a-popover>
</span>
<span slot="machineIds_dictText" slot-scope="text, record">
<a-popover>
<template slot="content">
<p>{{ text }}</p>
</template>
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{
text
}}</a>
</a-popover>
</span>
<span slot="action1" slot-scope="text, record">
<a @click="jumpPage1(record)">管理</a>
</span>
<span slot="action2" slot-scope="text, record">
<a @click="jumpPage2(record)">管理</a>
</span>
<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="() => handleDelete2(record.id)">
<a>删除</a>
</a-popconfirm>
<a-divider type="vertical"/>
<a @click="up(record.id)">前移</a>
<a-divider type="vertical"/>
<a @click="down(record.id)">后移</a>
</span>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
<station-modal ref="modalForm" @ok="modalFormOk"></station-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import StationModal from './modules/StationModal'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {deleteAction, getAction} from "@api/manage";
export default {
name: "StationList",
mixins: [JeecgListMixin, mixinDevice],
components: {
StationModal
},
data() {
return {
description: '车间工位管理管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
/*{
title: '车间ID',
align: "center",
dataIndex: 'departId'
},*/
{
title: '车间名称',
align: "center",
dataIndex: 'departName'
},
{
title: '工位序号',
align: "center",
dataIndex: 'stationNum'
},
{
title: '工位名称',
align: "center",
dataIndex: 'stationName'
},
{
title: '设备',
align: "center",
dataIndex: 'machineIds_dictText',
scopedSlots: {customRender: 'machineIds_dictText'}
},
{
title: '工具',
align: "center",
dataIndex: 'toolsIds_dictText',
scopedSlots: {customRender: 'toolsIds_dictText'}
},
{
title: '备注',
align: "center",
dataIndex: 'description'
},
{
title: '工位设备模块',
dataIndex: 'action1',
align: "center",
// fixed: "right",
width: 80,
scopedSlots: {customRender: 'action1'}
},
{
title: '工位工具模块',
dataIndex: 'action2',
align: "center",
// fixed: "right",
width: 80,
scopedSlots: {customRender: 'action2'}
},
{
title: '操作',
dataIndex: 'action',
align: "center",
width: 60,
scopedSlots: {customRender: 'action'},
}
],
url: {
list: "/team/station/list",
queryIsCanDelete: "/team/station/queryIsCanDelete",
up: "/team/station/up",
down: "/team/station/down",
delete: "/team/station/delete",
deleteBatch: "/team/station/deleteBatch",
exportXlsUrl: "/team/station/exportXls",
importExcelUrl: "/team/station/importExcel",
},
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
methods: {
//
jumpPage1(record) {
this.$router.push({
path: '/team/StationMachineList',
query: { //
'stationId': record.id,
'stationName': record.stationName,
'stationNum': record.stationNum,
'departName': record.departName,
},
});
},
jumpPage2(record) {
this.$router.push({
path: '/team/StationToolList',
query: { //
'stationId': record.id,
'stationName': record.stationName,
'stationNum': record.stationNum,
'departName': record.departName,
},
});
},
handleDelete2: function (id) {
if (!this.url.queryIsCanDelete) {
this.$message.error("请设置url.delete属性!")
return
}
// let dataTotal = 0;
let param = {
id: id
}
getAction(this.url.queryIsCanDelete, param).then((res) => {
console.log("queryIsCanDelete res:" + JSON.stringify(res));
if (res.success) {
if (res.result > 0) {
this.$message.warning("暂不可删除,子模块正在使用!");
return;
} else {
var that = this;
deleteAction(that.url.delete, param).then((res) => {
if (res.success) {
//
that.reCalculatePage(1)
that.$message.success(res.message);
that.loadData();
} else {
that.$message.warning(res.message);
}
});
}
}
})
},
up(id) {
getAction(this.url.up, {id: id}).then((res) => {
if (res.success) {
this.loadData();
this.$message.success(res.message);
} else {
this.$message.warning(res.message);
}
})
},
down(id) {
getAction(this.url.down, {id: id}).then((res) => {
if (res.success) {
this.loadData();
this.$message.success(res.message);
} else {
this.$message.warning(res.message);
}
})
},
}
}
</script>
<!--<style scoped>-->
<!--@import '~@assets/less/common.less';-->
<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="车间ID">-->
<!-- <a-input placeholder="请输入车间ID" v-model="queryParam.departId"></a-input>-->
<!-- </a-form-item>-->
<a-form-model-item label="车间名称">
<!-- <a-input placeholder="请输入部门编号" v-model="model.departId"/>-->
<j-select-depart placeholder="请选择车间" v-model="queryParam.departId"/>
</a-form-model-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="工位名称">
<a-input placeholder="请输入工位名称" v-model="queryParam.stationName"></a-input>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
</template>
<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>
<!-- <a @click="handleToggleSearch" style="margin-left: 8px">-->
<!-- {{ toggleSearchStatus ? '收起' : '展开' }}-->
<!-- <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
<!-- </a>-->
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 操作按钮区域 -->
<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>-->
<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"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
class="j-table-force-nowrap"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<span slot="toolsIds_dictText" slot-scope="text, record">
<a-popover>
<template slot="content">
<p>{{ text }}</p>
</template>
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{
text
}}</a>
</a-popover>
</span>
<span slot="machineIds_dictText" slot-scope="text, record">
<a-popover>
<template slot="content">
<p>{{ text }}</p>
</template>
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{
text
}}</a>
</a-popover>
</span>
<span slot="action1" slot-scope="text, record">
<a @click="jumpPage1(record)">管理</a>
</span>
<span slot="action2" slot-scope="text, record">
<a @click="jumpPage2(record)">管理</a>
</span>
<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="() => handleDelete2(record.id)">
<a>删除</a>
</a-popconfirm>
<a-divider type="vertical"/>
<a @click="up(record.id)">前移</a>
<a-divider type="vertical"/>
<a @click="down(record.id)">后移</a>
</span>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
<station-modal ref="modalForm" @ok="modalFormOk"></station-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import StationModal from './modules/StationModal'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {deleteAction, getAction} from "@api/manage";
import { filterObj } from '@/utils/util';
export default {
name: "StationList",
mixins: [JeecgListMixin, mixinDevice],
components: {
StationModal
},
data() {
return {
description: '车间工位管理管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
/*{
title: '车间ID',
align: "center",
dataIndex: 'departId'
},*/
{
title: '车间名称',
align: "center",
dataIndex: 'departName'
},
{
title: '工位序号',
align: "center",
dataIndex: 'stationNum'
},
{
title: '工位名称',
align: "center",
dataIndex: 'stationName'
},
{
title: '设备',
align: "center",
dataIndex: 'machineIds_dictText',
scopedSlots: {customRender: 'machineIds_dictText'}
},
{
title: '工具',
align: "center",
dataIndex: 'toolsIds_dictText',
scopedSlots: {customRender: 'toolsIds_dictText'}
},
{
title: '备注',
align: "center",
dataIndex: 'description'
},
{
title: '工位设备模块',
dataIndex: 'action1',
align: "center",
// fixed: "right",
width: 80,
scopedSlots: {customRender: 'action1'}
},
{
title: '工位工具模块',
dataIndex: 'action2',
align: "center",
// fixed: "right",
width: 80,
scopedSlots: {customRender: 'action2'}
},
{
title: '操作',
dataIndex: 'action',
align: "center",
width: 60,
scopedSlots: {customRender: 'action'},
}
],
url: {
list: "/team/station/list",
queryIsCanDelete: "/team/station/queryIsCanDelete",
up: "/team/station/up",
down: "/team/station/down",
delete: "/team/station/delete",
deleteBatch: "/team/station/deleteBatch",
exportXlsUrl: "/team/station/exportXls",
importExcelUrl: "/team/station/importExcel",
},
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
methods: {
//
getQueryParams(arg) {
//
let sqp = {}
if (this.superQueryParams) {
sqp['superQueryParams'] = encodeURI(this.superQueryParams)
sqp['superQueryMatchType'] = this.superQueryMatchType
}
var param = Object.assign(sqp, this.queryParam, {}, this.filters)
param.field = this.getQueryField()
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
return filterObj(param)
},
//
jumpPage1(record) {
this.$router.push({
path: '/team/StationMachineList',
query: { //
'stationId': record.id,
'stationName': record.stationName,
'stationNum': record.stationNum,
'departName': record.departName,
},
});
},
jumpPage2(record) {
this.$router.push({
path: '/team/StationToolList',
query: { //
'stationId': record.id,
'stationName': record.stationName,
'stationNum': record.stationNum,
'departName': record.departName,
},
});
},
handleDelete2: function (id) {
if (!this.url.queryIsCanDelete) {
this.$message.error("请设置url.delete属性!")
return
}
// let dataTotal = 0;
let param = {
id: id
}
getAction(this.url.queryIsCanDelete, param).then((res) => {
console.log("queryIsCanDelete res:" + JSON.stringify(res));
if (res.success) {
if (res.result > 0) {
this.$message.warning("暂不可删除,子模块正在使用!");
return;
} else {
var that = this;
deleteAction(that.url.delete, param).then((res) => {
if (res.success) {
//
that.reCalculatePage(1)
that.$message.success(res.message);
that.loadData();
} else {
that.$message.warning(res.message);
}
});
}
}
})
},
up(id) {
getAction(this.url.up, {id: id}).then((res) => {
if (res.success) {
this.loadData();
this.$message.success(res.message);
} else {
this.$message.warning(res.message);
}
})
},
down(id) {
getAction(this.url.down, {id: id}).then((res) => {
if (res.success) {
this.loadData();
this.$message.success(res.message);
} else {
this.$message.warning(res.message);
}
})
},
}
}
</script>
<!--<style scoped>-->
<!--@import '~@assets/less/common.less';-->
<!--</style>-->

@ -1,173 +1,174 @@
package org.jeecg.modules.demo.sensor.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.sensor.entity.Sensor;
import org.jeecg.modules.demo.sensor.service.ISensorService;
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-02-10
* @Version: V1.0
*/
@Api(tags="传感器表")
@RestController
@RequestMapping("/sensor/sensor")
@Slf4j
public class SensorController extends JeecgController<Sensor, ISensorService> {
@Autowired
private ISensorService sensorService;
/**
* 分页列表查询
*
* @param sensor
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "传感器表-分页列表查询")
@ApiOperation(value="传感器表-分页列表查询", notes="传感器表-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(Sensor sensor,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Sensor> queryWrapper = QueryGenerator.initQueryWrapper(sensor, req.getParameterMap());
Page<Sensor> page = new Page<Sensor>(pageNo, pageSize);
IPage<Sensor> pageList = sensorService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param sensor
* @return
*/
@AutoLog(value = "传感器表-添加")
@ApiOperation(value="传感器表-添加", notes="传感器表-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody Sensor sensor) {
sensorService.save(sensor);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param sensor
* @return
*/
@AutoLog(value = "传感器表-编辑")
@ApiOperation(value="传感器表-编辑", notes="传感器表-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Sensor sensor) {
sensorService.updateById(sensor);
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) {
sensorService.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.sensorService.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) {
Sensor sensor = sensorService.getById(id);
if(sensor==null) {
return Result.error("未找到对应数据");
}
return Result.OK(sensor);
}
/**
* 导出excel
*
* @param request
* @param sensor
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Sensor sensor) {
return super.exportXls(request, sensor, Sensor.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, Sensor.class);
}
}
package org.jeecg.modules.demo.sensor.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.sensor.entity.Sensor;
import org.jeecg.modules.demo.sensor.service.ISensorService;
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-02-10
* @Version: V1.0
*/
@Api(tags="传感器表")
@RestController
@RequestMapping("/sensor/sensor")
@Slf4j
public class SensorController extends JeecgController<Sensor, ISensorService> {
@Autowired
private ISensorService sensorService;
/**
* 分页列表查询
*
* @param sensor
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "传感器表-分页列表查询")
@ApiOperation(value="传感器表-分页列表查询", notes="传感器表-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(Sensor sensor,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Sensor> queryWrapper = QueryGenerator.initQueryWrapper(sensor, req.getParameterMap());
Page<Sensor> page = new Page<Sensor>(pageNo, pageSize);
queryWrapper.orderByAsc("create_time");
IPage<Sensor> pageList = sensorService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param sensor
* @return
*/
@AutoLog(value = "传感器表-添加")
@ApiOperation(value="传感器表-添加", notes="传感器表-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody Sensor sensor) {
sensorService.save(sensor);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param sensor
* @return
*/
@AutoLog(value = "传感器表-编辑")
@ApiOperation(value="传感器表-编辑", notes="传感器表-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Sensor sensor) {
sensorService.updateById(sensor);
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) {
sensorService.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.sensorService.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) {
Sensor sensor = sensorService.getById(id);
if(sensor==null) {
return Result.error("未找到对应数据");
}
return Result.OK(sensor);
}
/**
* 导出excel
*
* @param request
* @param sensor
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Sensor sensor) {
return super.exportXls(request, sensor, Sensor.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, Sensor.class);
}
}

@ -1,215 +1,216 @@
package org.jeecg.modules.team.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.team.entity.Station;
import org.jeecg.modules.team.entity.StationMachine;
import org.jeecg.modules.team.entity.StationTool;
import org.jeecg.modules.team.service.IStationMachineService;
import org.jeecg.modules.team.service.IStationService;
import org.jeecg.modules.team.service.IStationToolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description: 车间工位管理
* @Author: jeecg-boot
* @Date: 2022-12-05
* @Version: V1.0
*/
@Slf4j
@Api(tags = "车间工位管理")
@RestController
@RequestMapping("/team/station")
public class StationController extends JeecgController<Station, IStationService> {
@Autowired
private IStationService stationService;
@Autowired
private ISysDepartService iSysDepartService;
@Autowired
private IStationToolService iStationToolService;
@Autowired
private IStationMachineService iStationMachineService;
/**
* 分页列表查询
*
* @param station
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "车间工位管理-分页列表查询")
@ApiOperation(value = "车间工位管理-分页列表查询", notes = "车间工位管理-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(Station station,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Station> queryWrapper = QueryGenerator.initQueryWrapper(station, req.getParameterMap());
Page<Station> page = new Page<Station>(pageNo, pageSize);
IPage<Station> pageList = stationService.page(page, queryWrapper);
if (!ObjectUtils.isEmpty(pageList.getRecords())) {
List<Station> records = pageList.getRecords();
//按工位序号顺序排序
Collections.sort(records, Comparator.comparingInt(Station::getStationNum));
List<String> ids = records.stream().map(o -> o.getDepartId()).collect(Collectors.toList());
List<SysDepart> departList = iSysDepartService.list(new LambdaQueryWrapper<SysDepart>().in(SysDepart::getId, ids));
records.stream().forEach(e -> {
List<StationTool> stationTools = iStationToolService.list(new LambdaQueryWrapper<StationTool>().eq(StationTool::getStationId, e.getId()));
e.setToolsIds(stationTools.stream().map(StationTool::getToolsId).collect(Collectors.joining(",")));
List<StationMachine> machineList = iStationMachineService.list(new LambdaQueryWrapper<StationMachine>().eq(StationMachine::getStationId, e.getId()));
e.setMachineIds(machineList.stream().map(StationMachine::getMachineId).collect(Collectors.joining(",")));
departList.forEach(j -> {
if (e.getDepartId().equals(j.getId())) {
e.setDepartName(j.getDepartName());
return;
}
});
});
}
return Result.OK(pageList);
}
@ApiOperation(value = "车间工位管理-查询车间工位能否删除", notes = "车间工位管理-查询车间工位能否删除")
@GetMapping(value = "/queryIsCanDelete")
public Result<?> queryIsCanDelete(Station station,
HttpServletRequest req) {
return Result.OK(stationService.queryIsCanDelete(station));
}
/**
* 添加
*
* @param station
* @return
*/
@AutoLog(value = "车间工位管理-添加")
@ApiOperation(value = "车间工位管理-添加", notes = "车间工位管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody Station station) {
stationService.save(station);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param station
* @return
*/
@AutoLog(value = "车间工位管理-编辑")
@ApiOperation(value = "车间工位管理-编辑", notes = "车间工位管理-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Station station) {
stationService.updateById(station);
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) {
stationService.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.stationService.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) {
Station station = stationService.getById(id);
return Result.OK(station);
}
/**
* 导出excel
*
* @param request
* @param station
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Station station) {
return super.exportXls(request, station, Station.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, Station.class);
}
@ApiOperation(value = "排序", notes = "排序")
@GetMapping(value = "/up")
public Result<?> up(@RequestParam(name = "id", required = true) String id) {
stationService.up(id);
return Result.OK();
}
@AutoLog(value = "排序")
@ApiOperation(value = "排序", notes = "排序")
@GetMapping(value = "/down")
public Result<?> down(@RequestParam(name = "id", required = true) String id) {
stationService.down(id);
return Result.OK();
}
}
package org.jeecg.modules.team.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.team.entity.Station;
import org.jeecg.modules.team.entity.StationMachine;
import org.jeecg.modules.team.entity.StationTool;
import org.jeecg.modules.team.service.IStationMachineService;
import org.jeecg.modules.team.service.IStationService;
import org.jeecg.modules.team.service.IStationToolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description: 车间工位管理
* @Author: jeecg-boot
* @Date: 2022-12-05
* @Version: V1.0
*/
@Slf4j
@Api(tags = "车间工位管理")
@RestController
@RequestMapping("/team/station")
public class StationController extends JeecgController<Station, IStationService> {
@Autowired
private IStationService stationService;
@Autowired
private ISysDepartService iSysDepartService;
@Autowired
private IStationToolService iStationToolService;
@Autowired
private IStationMachineService iStationMachineService;
/**
* 分页列表查询
*
* @param station
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "车间工位管理-分页列表查询")
@ApiOperation(value = "车间工位管理-分页列表查询", notes = "车间工位管理-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(Station station,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Station> queryWrapper = QueryGenerator.initQueryWrapper(station, req.getParameterMap());
Page<Station> page = new Page<Station>(pageNo, pageSize);
queryWrapper.orderByAsc("station_num");
IPage<Station> pageList = stationService.page(page, queryWrapper);
if (!ObjectUtils.isEmpty(pageList.getRecords())) {
List<Station> records = pageList.getRecords();
//按工位序号顺序排序
Collections.sort(records, Comparator.comparingInt(Station::getStationNum));
List<String> ids = records.stream().map(o -> o.getDepartId()).collect(Collectors.toList());
List<SysDepart> departList = iSysDepartService.list(new LambdaQueryWrapper<SysDepart>().in(SysDepart::getId, ids));
records.stream().forEach(e -> {
List<StationTool> stationTools = iStationToolService.list(new LambdaQueryWrapper<StationTool>().eq(StationTool::getStationId, e.getId()));
e.setToolsIds(stationTools.stream().map(StationTool::getToolsId).collect(Collectors.joining(",")));
List<StationMachine> machineList = iStationMachineService.list(new LambdaQueryWrapper<StationMachine>().eq(StationMachine::getStationId, e.getId()));
e.setMachineIds(machineList.stream().map(StationMachine::getMachineId).collect(Collectors.joining(",")));
departList.forEach(j -> {
if (e.getDepartId().equals(j.getId())) {
e.setDepartName(j.getDepartName());
return;
}
});
});
}
return Result.OK(pageList);
}
@ApiOperation(value = "车间工位管理-查询车间工位能否删除", notes = "车间工位管理-查询车间工位能否删除")
@GetMapping(value = "/queryIsCanDelete")
public Result<?> queryIsCanDelete(Station station,
HttpServletRequest req) {
return Result.OK(stationService.queryIsCanDelete(station));
}
/**
* 添加
*
* @param station
* @return
*/
@AutoLog(value = "车间工位管理-添加")
@ApiOperation(value = "车间工位管理-添加", notes = "车间工位管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody Station station) {
stationService.save(station);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param station
* @return
*/
@AutoLog(value = "车间工位管理-编辑")
@ApiOperation(value = "车间工位管理-编辑", notes = "车间工位管理-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Station station) {
stationService.updateById(station);
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) {
stationService.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.stationService.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) {
Station station = stationService.getById(id);
return Result.OK(station);
}
/**
* 导出excel
*
* @param request
* @param station
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Station station) {
return super.exportXls(request, station, Station.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, Station.class);
}
@ApiOperation(value = "排序", notes = "排序")
@GetMapping(value = "/up")
public Result<?> up(@RequestParam(name = "id", required = true) String id) {
stationService.up(id);
return Result.OK();
}
@AutoLog(value = "排序")
@ApiOperation(value = "排序", notes = "排序")
@GetMapping(value = "/down")
public Result<?> down(@RequestParam(name = "id", required = true) String id) {
stationService.down(id);
return Result.OK();
}
}

Loading…
Cancel
Save