mengff
10 months ago
10 changed files with 937 additions and 82 deletions
@ -0,0 +1,53 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// 查询【请填写功能名称】列表
|
|||
export function listDevice(query) { |
|||
return request({ |
|||
url: '/system/device/list', |
|||
method: 'get', |
|||
params: query |
|||
}) |
|||
} |
|||
|
|||
// 查询【请填写功能名称】详细
|
|||
export function getDevice(id) { |
|||
return request({ |
|||
url: '/system/device/' + id, |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
// 新增【请填写功能名称】
|
|||
export function addDevice(data) { |
|||
return request({ |
|||
url: '/system/device', |
|||
method: 'post', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 修改【请填写功能名称】
|
|||
export function updateDevice(data) { |
|||
return request({ |
|||
url: '/system/device', |
|||
method: 'put', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 删除【请填写功能名称】
|
|||
export function delDevice(id) { |
|||
return request({ |
|||
url: '/system/device/' + id, |
|||
method: 'delete' |
|||
}) |
|||
} |
|||
|
|||
// 导出【请填写功能名称】
|
|||
export function exportDevice(query) { |
|||
return request({ |
|||
url: '/system/device/export', |
|||
method: 'get', |
|||
params: query |
|||
}) |
|||
} |
@ -0,0 +1,338 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
|||
<el-form-item label="设备桩号" prop="deviceNo"> |
|||
<el-input |
|||
v-model="queryParams.deviceNo" |
|||
placeholder="请输入设备桩号" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="设备名称" prop="deviceName"> |
|||
<el-input |
|||
v-model="queryParams.deviceName" |
|||
placeholder="请输入设备名称" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="设备IP" prop="deviceIp"> |
|||
<el-input |
|||
v-model="queryParams.deviceIp" |
|||
placeholder="请输入设备IP" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="方向" prop="direction"> |
|||
<el-input |
|||
v-model="queryParams.direction" |
|||
placeholder="请输入方向" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="厂家" prop="production"> |
|||
<el-input |
|||
v-model="queryParams.production" |
|||
placeholder="请输入厂家" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="型号" prop="model"> |
|||
<el-input |
|||
v-model="queryParams.model" |
|||
placeholder="请输入型号" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="网段" prop="network"> |
|||
<el-input |
|||
v-model="queryParams.network" |
|||
placeholder="请输入网段" |
|||
clearable |
|||
@keyup.enter.native="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
|||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-row :gutter="10" class="mb8"> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="primary" |
|||
plain |
|||
icon="el-icon-plus" |
|||
size="mini" |
|||
@click="handleAdd" |
|||
v-hasPermi="['system:device:add']" |
|||
>新增</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="success" |
|||
plain |
|||
icon="el-icon-edit" |
|||
size="mini" |
|||
:disabled="single" |
|||
@click="handleUpdate" |
|||
v-hasPermi="['system:device:edit']" |
|||
>修改</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="danger" |
|||
plain |
|||
icon="el-icon-delete" |
|||
size="mini" |
|||
:disabled="multiple" |
|||
@click="handleDelete" |
|||
v-hasPermi="['system:device:remove']" |
|||
>删除</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="warning" |
|||
plain |
|||
icon="el-icon-download" |
|||
size="mini" |
|||
@click="handleExport" |
|||
v-hasPermi="['system:device:export']" |
|||
>导出</el-button> |
|||
</el-col> |
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
|||
</el-row> |
|||
|
|||
<el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange"> |
|||
<el-table-column type="selection" width="55" align="center" /> |
|||
<el-table-column label="设备ID" align="center" prop="id" /> |
|||
<el-table-column label="设备桩号" align="center" prop="deviceNo" /> |
|||
<el-table-column label="设备名称" align="center" prop="deviceName" /> |
|||
<el-table-column label="设备IP" align="center" prop="deviceIp" /> |
|||
<el-table-column label="方向" align="center" prop="direction" /> |
|||
<el-table-column label="厂家" align="center" prop="production" /> |
|||
<el-table-column label="型号" align="center" prop="model" /> |
|||
<el-table-column label="网段" align="center" prop="network" /> |
|||
<el-table-column label="备注" align="center" prop="content" /> |
|||
<el-table-column label="设备类型" align="center" prop="type" /> |
|||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-edit" |
|||
@click="handleUpdate(scope.row)" |
|||
v-hasPermi="['system:device:edit']" |
|||
>修改</el-button> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-delete" |
|||
@click="handleDelete(scope.row)" |
|||
v-hasPermi="['system:device:remove']" |
|||
>删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<pagination |
|||
v-show="total>0" |
|||
:total="total" |
|||
:page.sync="queryParams.pageNum" |
|||
:limit.sync="queryParams.pageSize" |
|||
@pagination="getList" |
|||
/> |
|||
|
|||
<!-- 添加或修改【请填写功能名称】对话框 --> |
|||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
|||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
|||
<el-form-item label="设备桩号" prop="deviceNo"> |
|||
<el-input v-model="form.deviceNo" placeholder="请输入设备桩号" /> |
|||
</el-form-item> |
|||
<el-form-item label="设备名称" prop="deviceName"> |
|||
<el-input v-model="form.deviceName" placeholder="请输入设备名称" /> |
|||
</el-form-item> |
|||
<el-form-item label="设备IP" prop="deviceIp"> |
|||
<el-input v-model="form.deviceIp" placeholder="请输入设备IP" /> |
|||
</el-form-item> |
|||
<el-form-item label="方向" prop="direction"> |
|||
<el-input v-model="form.direction" placeholder="请输入方向" /> |
|||
</el-form-item> |
|||
<el-form-item label="厂家" prop="production"> |
|||
<el-input v-model="form.production" placeholder="请输入厂家" /> |
|||
</el-form-item> |
|||
<el-form-item label="型号" prop="model"> |
|||
<el-input v-model="form.model" placeholder="请输入型号" /> |
|||
</el-form-item> |
|||
<el-form-item label="网段" prop="network"> |
|||
<el-input v-model="form.network" placeholder="请输入网段" /> |
|||
</el-form-item> |
|||
<el-form-item label="备注"> |
|||
<editor v-model="form.content" :min-height="192"/> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="primary" @click="submitForm">确 定</el-button> |
|||
<el-button @click="cancel">取 消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { listDevice, getDevice, delDevice, addDevice, updateDevice } from "@/api/system/device"; |
|||
|
|||
export default { |
|||
name: "Device", |
|||
data() { |
|||
return { |
|||
// 遮罩层 |
|||
loading: true, |
|||
// 选中数组 |
|||
ids: [], |
|||
// 非单个禁用 |
|||
single: true, |
|||
// 非多个禁用 |
|||
multiple: true, |
|||
// 显示搜索条件 |
|||
showSearch: true, |
|||
// 总条数 |
|||
total: 0, |
|||
// 【请填写功能名称】表格数据 |
|||
deviceList: [], |
|||
// 弹出层标题 |
|||
title: "", |
|||
// 是否显示弹出层 |
|||
open: false, |
|||
// 查询参数 |
|||
queryParams: { |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
deviceNo: null, |
|||
deviceName: null, |
|||
deviceIp: null, |
|||
direction: null, |
|||
production: null, |
|||
model: null, |
|||
network: null, |
|||
content: null, |
|||
type: null |
|||
}, |
|||
// 表单参数 |
|||
form: {}, |
|||
// 表单校验 |
|||
rules: { |
|||
} |
|||
}; |
|||
}, |
|||
created() { |
|||
this.getList(); |
|||
}, |
|||
methods: { |
|||
/** 查询【请填写功能名称】列表 */ |
|||
getList() { |
|||
this.loading = true; |
|||
listDevice(this.queryParams).then(response => { |
|||
this.deviceList = response.rows; |
|||
this.total = response.total; |
|||
this.loading = false; |
|||
}); |
|||
}, |
|||
// 取消按钮 |
|||
cancel() { |
|||
this.open = false; |
|||
this.reset(); |
|||
}, |
|||
// 表单重置 |
|||
reset() { |
|||
this.form = { |
|||
id: null, |
|||
deviceNo: null, |
|||
deviceName: null, |
|||
deviceIp: null, |
|||
direction: null, |
|||
production: null, |
|||
model: null, |
|||
network: null, |
|||
content: null, |
|||
type: null |
|||
}; |
|||
this.resetForm("form"); |
|||
}, |
|||
/** 搜索按钮操作 */ |
|||
handleQuery() { |
|||
this.queryParams.pageNum = 1; |
|||
this.getList(); |
|||
}, |
|||
/** 重置按钮操作 */ |
|||
resetQuery() { |
|||
this.resetForm("queryForm"); |
|||
this.handleQuery(); |
|||
}, |
|||
// 多选框选中数据 |
|||
handleSelectionChange(selection) { |
|||
this.ids = selection.map(item => item.id) |
|||
this.single = selection.length!==1 |
|||
this.multiple = !selection.length |
|||
}, |
|||
/** 新增按钮操作 */ |
|||
handleAdd() { |
|||
this.reset(); |
|||
this.open = true; |
|||
this.title = "添加【请填写功能名称】"; |
|||
}, |
|||
/** 修改按钮操作 */ |
|||
handleUpdate(row) { |
|||
this.reset(); |
|||
const id = row.id || this.ids |
|||
getDevice(id).then(response => { |
|||
this.form = response.data; |
|||
this.open = true; |
|||
this.title = "修改【请填写功能名称】"; |
|||
}); |
|||
}, |
|||
/** 提交按钮 */ |
|||
submitForm() { |
|||
this.$refs["form"].validate(valid => { |
|||
if (valid) { |
|||
if (this.form.id != null) { |
|||
updateDevice(this.form).then(response => { |
|||
this.$modal.msgSuccess("修改成功"); |
|||
this.open = false; |
|||
this.getList(); |
|||
}); |
|||
} else { |
|||
addDevice(this.form).then(response => { |
|||
this.$modal.msgSuccess("新增成功"); |
|||
this.open = false; |
|||
this.getList(); |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
/** 删除按钮操作 */ |
|||
handleDelete(row) { |
|||
const ids = row.id || this.ids; |
|||
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() { |
|||
return delDevice(ids); |
|||
}).then(() => { |
|||
this.getList(); |
|||
this.$modal.msgSuccess("删除成功"); |
|||
}).catch(() => {}); |
|||
}, |
|||
/** 导出按钮操作 */ |
|||
handleExport() { |
|||
this.download('system/device/export', { |
|||
...this.queryParams |
|||
}, `device_${new Date().getTime()}.xlsx`) |
|||
} |
|||
} |
|||
}; |
|||
</script> |
@ -0,0 +1,105 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
import java.util.List; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import com.zc.business.domain.Device; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.PutMapping; |
|||
import org.springframework.web.bind.annotation.DeleteMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import com.ruoyi.common.annotation.Log; |
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.ruoyi.common.enums.BusinessType; |
|||
import com.ruoyi.common.utils.poi.ExcelUtil; |
|||
import com.ruoyi.common.core.page.TableDataInfo; |
|||
import com.zc.business.service.IDeviceService; |
|||
|
|||
/** |
|||
* 【请填写功能名称】Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-20 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/system/device") |
|||
public class DeviceController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private IDeviceService deviceService; |
|||
|
|||
/** |
|||
* 查询【请填写功能名称】列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('system:device:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(Device device) |
|||
{ |
|||
startPage(); |
|||
List<Device> list = deviceService.selectDeviceList(device); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出【请填写功能名称】列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('system:device:export')") |
|||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, Device device) |
|||
{ |
|||
List<Device> list = deviceService.selectDeviceList(device); |
|||
ExcelUtil<Device> util = new ExcelUtil<>(Device.class); |
|||
util.exportExcel(response, list, "【请填写功能名称】数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取【请填写功能名称】详细信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('system:device:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) |
|||
{ |
|||
return AjaxResult.success(deviceService.selectDeviceById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增【请填写功能名称】 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('system:device:add')") |
|||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody Device device) |
|||
{ |
|||
return toAjax(deviceService.insertDevice(device)); |
|||
} |
|||
|
|||
/** |
|||
* 修改【请填写功能名称】 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('system:device:edit')") |
|||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody Device device) |
|||
{ |
|||
return toAjax(deviceService.updateDevice(device)); |
|||
} |
|||
|
|||
/** |
|||
* 删除【请填写功能名称】 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('system:device:remove')") |
|||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) |
|||
{ |
|||
return toAjax(deviceService.deleteDeviceByIds(ids)); |
|||
} |
|||
} |
@ -1,65 +1,163 @@ |
|||
package com.zc.business.domain; |
|||
|
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import com.ruoyi.common.annotation.Excel; |
|||
import com.ruoyi.common.core.domain.BaseEntity; |
|||
|
|||
/** |
|||
* @author mengff |
|||
* @Date 2020/03/03 |
|||
* 【请填写功能名称】对象 device |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-20 |
|||
*/ |
|||
public class Device { |
|||
private long id; |
|||
public class Device extends BaseEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
public String getDeviceNo() { |
|||
return deviceNo; |
|||
/** 设备ID */ |
|||
private Long id; |
|||
|
|||
/** 设备桩号 */ |
|||
@Excel(name = "设备桩号") |
|||
private String deviceNo; |
|||
|
|||
/** 设备名称 */ |
|||
@Excel(name = "设备名称") |
|||
private String deviceName; |
|||
|
|||
/** 设备IP */ |
|||
@Excel(name = "设备IP") |
|||
private String deviceIp; |
|||
|
|||
/** 方向 */ |
|||
@Excel(name = "方向") |
|||
private String direction; |
|||
|
|||
/** 厂家 */ |
|||
@Excel(name = "厂家") |
|||
private String production; |
|||
|
|||
/** 型号 */ |
|||
@Excel(name = "型号") |
|||
private String model; |
|||
|
|||
/** 网段 */ |
|||
@Excel(name = "网段") |
|||
private String network; |
|||
|
|||
/** 备注 */ |
|||
@Excel(name = "备注") |
|||
private String content; |
|||
|
|||
/** 设备类型 */ |
|||
@Excel(name = "设备类型") |
|||
private String type; |
|||
|
|||
public void setId(Long id) |
|||
{ |
|||
this.id = id; |
|||
} |
|||
|
|||
public void setDeviceNo(String deviceNo) { |
|||
public Long getId() |
|||
{ |
|||
return id; |
|||
} |
|||
public void setDeviceNo(String deviceNo) |
|||
{ |
|||
this.deviceNo = deviceNo; |
|||
} |
|||
|
|||
public String getDeviceName() { |
|||
return deviceName; |
|||
public String getDeviceNo() |
|||
{ |
|||
return deviceNo; |
|||
} |
|||
|
|||
public void setDeviceName(String deviceName) { |
|||
public void setDeviceName(String deviceName) |
|||
{ |
|||
this.deviceName = deviceName; |
|||
} |
|||
|
|||
public String getDeviceIp() { |
|||
public String getDeviceName() |
|||
{ |
|||
return deviceName; |
|||
} |
|||
public void setDeviceIp(String deviceIp) |
|||
{ |
|||
this.deviceIp = deviceIp; |
|||
} |
|||
|
|||
public String getDeviceIp() |
|||
{ |
|||
return deviceIp; |
|||
} |
|||
public void setDirection(String direction) |
|||
{ |
|||
this.direction = direction; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "Device{" + |
|||
"id=" + id + |
|||
", deviceNo='" + deviceNo + '\'' + |
|||
", deviceName='" + deviceName + '\'' + |
|||
", deviceIp='" + deviceIp + '\'' + |
|||
'}'; |
|||
public String getDirection() |
|||
{ |
|||
return direction; |
|||
} |
|||
public void setProduction(String production) |
|||
{ |
|||
this.production = production; |
|||
} |
|||
|
|||
public Device(long id, String deviceNo, String deviceName, String deviceIp) { |
|||
this.id = id; |
|||
this.deviceNo = deviceNo; |
|||
this.deviceName = deviceName; |
|||
this.deviceIp = deviceIp; |
|||
public String getProduction() |
|||
{ |
|||
return production; |
|||
} |
|||
public void setModel(String model) |
|||
{ |
|||
this.model = model; |
|||
} |
|||
|
|||
public void setDeviceIp(String deviceIp) { |
|||
this.deviceIp = deviceIp; |
|||
public String getModel() |
|||
{ |
|||
return model; |
|||
} |
|||
public void setNetwork(String network) |
|||
{ |
|||
this.network = network; |
|||
} |
|||
|
|||
public String getType() { |
|||
return type; |
|||
public String getNetwork() |
|||
{ |
|||
return network; |
|||
} |
|||
public void setContent(String content) |
|||
{ |
|||
this.content = content; |
|||
} |
|||
|
|||
public void setType(String type) { |
|||
public String getContent() |
|||
{ |
|||
return content; |
|||
} |
|||
public void setType(String type) |
|||
{ |
|||
this.type = type; |
|||
} |
|||
|
|||
private String deviceNo; |
|||
private String deviceName; |
|||
private String deviceIp; |
|||
|
|||
private String type; |
|||
public String getType() |
|||
{ |
|||
return type; |
|||
} |
|||
|
|||
} |
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("deviceNo", getDeviceNo()) |
|||
.append("deviceName", getDeviceName()) |
|||
.append("deviceIp", getDeviceIp()) |
|||
.append("direction", getDirection()) |
|||
.append("production", getProduction()) |
|||
.append("model", getModel()) |
|||
.append("network", getNetwork()) |
|||
.append("content", getContent()) |
|||
.append("type", getType()) |
|||
.toString(); |
|||
} |
|||
} |
|||
|
@ -1,16 +1,61 @@ |
|||
package com.zc.business.mapper; |
|||
|
|||
import com.zc.business.domain.Device; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
import com.zc.business.domain.Device; |
|||
|
|||
/** |
|||
* @author mengff |
|||
* @Date 2024/01/04 |
|||
* 【请填写功能名称】Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-20 |
|||
*/ |
|||
@Repository |
|||
public interface DeviceMapper { |
|||
public interface DeviceMapper |
|||
{ |
|||
/** |
|||
* 查询【请填写功能名称】 |
|||
* |
|||
* @param id 【请填写功能名称】主键 |
|||
* @return 【请填写功能名称】 |
|||
*/ |
|||
Device selectDeviceById(Long id); |
|||
|
|||
/** |
|||
* 查询【请填写功能名称】列表 |
|||
* |
|||
* @param device 【请填写功能名称】 |
|||
* @return 【请填写功能名称】集合 |
|||
*/ |
|||
List<Device> selectDeviceList(Device device); |
|||
|
|||
/** |
|||
* 新增【请填写功能名称】 |
|||
* |
|||
* @param device 【请填写功能名称】 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDevice(Device device); |
|||
|
|||
/** |
|||
* 修改【请填写功能名称】 |
|||
* |
|||
* @param device 【请填写功能名称】 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDevice(Device device); |
|||
|
|||
/** |
|||
* 删除【请填写功能名称】 |
|||
* |
|||
* @param id 【请填写功能名称】主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDeviceById(Long id); |
|||
|
|||
List<Device> SelectList(); |
|||
} |
|||
/** |
|||
* 批量删除【请填写功能名称】 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDeviceByIds(Long[] ids); |
|||
} |
|||
|
@ -0,0 +1,63 @@ |
|||
package com.zc.business.service; |
|||
|
|||
|
|||
import com.zc.business.domain.Device; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 【请填写功能名称】Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-20 |
|||
*/ |
|||
public interface IDeviceService |
|||
{ |
|||
/** |
|||
* 查询【请填写功能名称】 |
|||
* |
|||
* @param id 【请填写功能名称】主键 |
|||
* @return 【请填写功能名称】 |
|||
*/ |
|||
public Device selectDeviceById(Long id); |
|||
|
|||
/** |
|||
* 查询【请填写功能名称】列表 |
|||
* |
|||
* @param device 【请填写功能名称】 |
|||
* @return 【请填写功能名称】集合 |
|||
*/ |
|||
List<Device> selectDeviceList(Device device); |
|||
|
|||
/** |
|||
* 新增【请填写功能名称】 |
|||
* |
|||
* @param device 【请填写功能名称】 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDevice(Device device); |
|||
|
|||
/** |
|||
* 修改【请填写功能名称】 |
|||
* |
|||
* @param device 【请填写功能名称】 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDevice(Device device); |
|||
|
|||
/** |
|||
* 批量删除【请填写功能名称】 |
|||
* |
|||
* @param ids 需要删除的【请填写功能名称】主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDeviceByIds(Long[] ids); |
|||
|
|||
/** |
|||
* 删除【请填写功能名称】信息 |
|||
* |
|||
* @param id 【请填写功能名称】主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDeviceById(Long id); |
|||
} |
@ -1,23 +0,0 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import com.zc.business.domain.Device; |
|||
import com.zc.business.mapper.DeviceMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author mengff |
|||
* @Date 2024/01/04 |
|||
*/ |
|||
@Service |
|||
public class DeviceService { |
|||
@Autowired |
|||
DeviceMapper deviceMapper; |
|||
|
|||
public List<Device> SelectList() { |
|||
return deviceMapper.SelectList(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import java.util.List; |
|||
|
|||
import com.zc.business.domain.Device; |
|||
import com.zc.business.mapper.DeviceMapper; |
|||
import com.zc.business.service.IDeviceService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
|
|||
/** |
|||
* 【请填写功能名称】Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-20 |
|||
*/ |
|||
@Service |
|||
public class DeviceServiceImpl implements IDeviceService |
|||
{ |
|||
@Autowired |
|||
private DeviceMapper deviceMapper; |
|||
|
|||
/** |
|||
* 查询【请填写功能名称】 |
|||
* |
|||
* @param id 【请填写功能名称】主键 |
|||
* @return 【请填写功能名称】 |
|||
*/ |
|||
@Override |
|||
public Device selectDeviceById(Long id) |
|||
{ |
|||
return deviceMapper.selectDeviceById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询【请填写功能名称】列表 |
|||
* |
|||
* @param device 【请填写功能名称】 |
|||
* @return 【请填写功能名称】 |
|||
*/ |
|||
@Override |
|||
public List<Device> selectDeviceList(Device device) |
|||
{ |
|||
return deviceMapper.selectDeviceList(device); |
|||
} |
|||
|
|||
/** |
|||
* 新增【请填写功能名称】 |
|||
* |
|||
* @param device 【请填写功能名称】 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertDevice(Device device) |
|||
{ |
|||
return deviceMapper.insertDevice(device); |
|||
} |
|||
|
|||
/** |
|||
* 修改【请填写功能名称】 |
|||
* |
|||
* @param device 【请填写功能名称】 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateDevice(Device device) |
|||
{ |
|||
return deviceMapper.updateDevice(device); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除【请填写功能名称】 |
|||
* |
|||
* @param ids 需要删除的【请填写功能名称】主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDeviceByIds(Long[] ids) |
|||
{ |
|||
return deviceMapper.deleteDeviceByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除【请填写功能名称】信息 |
|||
* |
|||
* @param id 【请填写功能名称】主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDeviceById(Long id) |
|||
{ |
|||
return deviceMapper.deleteDeviceById(id); |
|||
} |
|||
} |
@ -1,16 +1,96 @@ |
|||
<?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"> |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zc.business.mapper.DeviceMapper"> |
|||
|
|||
<resultMap id="BaseResultMap" type="com.zc.business.domain.Device"> |
|||
<result column="id" jdbcType="BIGINT" property="id"/> |
|||
<result column="device_no" jdbcType="VARCHAR" property="deviceNo"/> |
|||
<result column="device_name" jdbcType="VARCHAR" property="deviceName"/> |
|||
<result column="device_ip" jdbcType="VARCHAR" property="deviceIp"/> |
|||
|
|||
<resultMap type="Device" id="DeviceResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="deviceNo" column="device_no" /> |
|||
<result property="deviceName" column="device_name" /> |
|||
<result property="deviceIp" column="device_ip" /> |
|||
<result property="direction" column="direction" /> |
|||
<result property="production" column="production" /> |
|||
<result property="model" column="model" /> |
|||
<result property="network" column="network" /> |
|||
<result property="content" column="content" /> |
|||
<result property="type" column="type" /> |
|||
</resultMap> |
|||
|
|||
<select id="SelectList" resultType="com.zc.business.domain.Device"> |
|||
select * from device |
|||
<sql id="selectDeviceVo"> |
|||
select id, device_no, device_name, device_ip, direction, production, model, network, content, type from device |
|||
</sql> |
|||
|
|||
<select id="selectDeviceList" parameterType="Device" resultMap="DeviceResult"> |
|||
<include refid="selectDeviceVo"/> |
|||
<where> |
|||
<if test="deviceNo != null and deviceNo != ''"> and device_no = #{deviceNo}</if> |
|||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if> |
|||
<if test="deviceIp != null and deviceIp != ''"> and device_ip = #{deviceIp}</if> |
|||
<if test="direction != null and direction != ''"> and direction = #{direction}</if> |
|||
<if test="production != null and production != ''"> and production = #{production}</if> |
|||
<if test="model != null and model != ''"> and model = #{model}</if> |
|||
<if test="network != null and network != ''"> and network = #{network}</if> |
|||
<if test="content != null and content != ''"> and content = #{content}</if> |
|||
<if test="type != null and type != ''"> and type = #{type}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDeviceById" parameterType="Long" resultMap="DeviceResult"> |
|||
<include refid="selectDeviceVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertDevice" parameterType="Device" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into device |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="deviceNo != null">device_no,</if> |
|||
<if test="deviceName != null">device_name,</if> |
|||
<if test="deviceIp != null">device_ip,</if> |
|||
<if test="direction != null">direction,</if> |
|||
<if test="production != null">production,</if> |
|||
<if test="model != null">model,</if> |
|||
<if test="network != null">network,</if> |
|||
<if test="content != null">content,</if> |
|||
<if test="type != null">type,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="deviceNo != null">#{deviceNo},</if> |
|||
<if test="deviceName != null">#{deviceName},</if> |
|||
<if test="deviceIp != null">#{deviceIp},</if> |
|||
<if test="direction != null">#{direction},</if> |
|||
<if test="production != null">#{production},</if> |
|||
<if test="model != null">#{model},</if> |
|||
<if test="network != null">#{network},</if> |
|||
<if test="content != null">#{content},</if> |
|||
<if test="type != null">#{type},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDevice" parameterType="Device"> |
|||
update device |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="deviceNo != null">device_no = #{deviceNo},</if> |
|||
<if test="deviceName != null">device_name = #{deviceName},</if> |
|||
<if test="deviceIp != null">device_ip = #{deviceIp},</if> |
|||
<if test="direction != null">direction = #{direction},</if> |
|||
<if test="production != null">production = #{production},</if> |
|||
<if test="model != null">model = #{model},</if> |
|||
<if test="network != null">network = #{network},</if> |
|||
<if test="content != null">content = #{content},</if> |
|||
<if test="type != null">type = #{type},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDeviceById" parameterType="Long"> |
|||
delete from device where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDeviceByIds" parameterType="String"> |
|||
delete from device where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
Loading…
Reference in new issue