Sfoglia il codice sorgente

`添加摄像机表`

wenhongquan 3 mesi fa
parent
commit
010442f01b

+ 63 - 0
plus-ui-ts/src/api/system/device/index.ts

@@ -0,0 +1,63 @@
+import request from '@/utils/request';
+import { AxiosPromise } from 'axios';
+import { DeviceVO, DeviceForm, DeviceQuery } from '@/api/system/device/types';
+
+/**
+ * 查询设备-摄像机列表
+ * @param query
+ * @returns {*}
+ */
+
+export const listDevice = (query?: DeviceQuery): AxiosPromise<DeviceVO[]> => {
+  return request({
+    url: '/system/device/list',
+    method: 'get',
+    params: query
+  });
+};
+
+/**
+ * 查询设备-摄像机详细
+ * @param id
+ */
+export const getDevice = (id: string | number): AxiosPromise<DeviceVO> => {
+  return request({
+    url: '/system/device/' + id,
+    method: 'get'
+  });
+};
+
+/**
+ * 新增设备-摄像机
+ * @param data
+ */
+export const addDevice = (data: DeviceForm) => {
+  return request({
+    url: '/system/device',
+    method: 'post',
+    data: data
+  });
+};
+
+/**
+ * 修改设备-摄像机
+ * @param data
+ */
+export const updateDevice = (data: DeviceForm) => {
+  return request({
+    url: '/system/device',
+    method: 'put',
+    data: data
+  });
+};
+
+/**
+ * 删除设备-摄像机
+ * @param id
+ */
+export const delDevice = (id: string | number | Array<string | number>) => {
+  return request({
+    url: '/system/device/' + id,
+    method: 'delete'
+  });
+};

+ 131 - 0
plus-ui-ts/src/api/system/device/types.ts

@@ -0,0 +1,131 @@
+export interface DeviceVO {
+  /**
+   * 编号
+   */
+  id: string | number;
+
+  /**
+   * 名称
+   */
+  name: string;
+
+  /**
+   * 方向
+   */
+  direction: string;
+
+  /**
+   * 桩号
+   */
+  zh: string;
+
+  /**
+   * 经度
+   */
+  lon: string;
+
+  /**
+   * 纬度
+   */
+  lat: string;
+
+  /**
+   * 扩展1
+   */
+  ext1: string;
+
+  /**
+   * 扩展2
+   */
+  ext2: string;
+
+}
+
+export interface DeviceForm extends BaseEntity {
+  /**
+   * 编号
+   */
+  id?: string | number;
+
+  /**
+   * 名称
+   */
+  name?: string;
+
+  /**
+   * 方向
+   */
+  direction?: string;
+
+  /**
+   * 桩号
+   */
+  zh?: string;
+
+  /**
+   * 经度
+   */
+  lon?: string;
+
+  /**
+   * 纬度
+   */
+  lat?: string;
+
+  /**
+   * 扩展1
+   */
+  ext1?: string;
+
+  /**
+   * 扩展2
+   */
+  ext2?: string;
+
+}
+
+export interface DeviceQuery extends PageQuery {
+
+  /**
+   * 名称
+   */
+  name?: string;
+
+  /**
+   * 方向
+   */
+  direction?: string;
+
+  /**
+   * 桩号
+   */
+  zh?: string;
+
+  /**
+   * 经度
+   */
+  lon?: string;
+
+  /**
+   * 纬度
+   */
+  lat?: string;
+
+  /**
+   * 扩展1
+   */
+  ext1?: string;
+
+  /**
+   * 扩展2
+   */
+  ext2?: string;
+
+    /**
+     * 日期范围参数
+     */
+    params?: any;
+}
+
+
+

+ 253 - 0
plus-ui-ts/src/views/system/device/index.vue

@@ -0,0 +1,253 @@
+<template>
+  <div class="p-2">
+    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
+      <div v-show="showSearch" class="mb-[10px]">
+        <el-card shadow="hover">
+          <el-form ref="queryFormRef" :model="queryParams" :inline="true">
+            <el-form-item label="名称" prop="name">
+              <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item label="方向" prop="direction">
+              <el-input v-model="queryParams.direction" placeholder="请输入方向" clearable @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item label="桩号" prop="zh">
+              <el-input v-model="queryParams.zh" placeholder="请输入桩号" clearable @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item label="经度" prop="lon">
+              <el-input v-model="queryParams.lon" placeholder="请输入经度" clearable @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item label="纬度" prop="lat">
+              <el-input v-model="queryParams.lat" placeholder="请输入纬度" clearable @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
+              <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+            </el-form-item>
+          </el-form>
+        </el-card>
+      </div>
+    </transition>
+
+    <el-card shadow="never">
+      <template #header>
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:device:add']">新增</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:device:edit']">修改</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:device:remove']">删除</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:device:export']">导出</el-button>
+          </el-col>
+          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
+      </template>
+
+      <el-table v-loading="loading" border :data="deviceList" @selection-change="handleSelectionChange">
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="编号" align="center" prop="id" v-if="true" />
+        <el-table-column label="名称" align="center" prop="name" />
+        <el-table-column label="方向" align="center" prop="direction" />
+        <el-table-column label="桩号" align="center" prop="zh" />
+        <el-table-column label="经度" align="center" prop="lon" />
+        <el-table-column label="纬度" align="center" prop="lat" />
+        <el-table-column label="扩展1" align="center" prop="ext1" />
+        <el-table-column label="扩展2" align="center" prop="ext2" />
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          <template #default="scope">
+            <el-tooltip content="修改" placement="top">
+              <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:device:edit']"></el-button>
+            </el-tooltip>
+            <el-tooltip content="删除" placement="top">
+              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:device:remove']"></el-button>
+            </el-tooltip>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
+    </el-card>
+    <!-- 添加或修改设备-摄像机对话框 -->
+    <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
+      <el-form ref="deviceFormRef" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="名称" prop="name">
+          <el-input v-model="form.name" placeholder="请输入名称" />
+        </el-form-item>
+        <el-form-item label="方向" prop="direction">
+          <el-input v-model="form.direction" placeholder="请输入方向" />
+        </el-form-item>
+        <el-form-item label="桩号" prop="zh">
+          <el-input v-model="form.zh" placeholder="请输入桩号" />
+        </el-form-item>
+        <el-form-item label="经度" prop="lon">
+          <el-input v-model="form.lon" placeholder="请输入经度" />
+        </el-form-item>
+        <el-form-item label="纬度" prop="lat">
+          <el-input v-model="form.lat" placeholder="请输入纬度" />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
+          <el-button @click="cancel">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup name="Device" lang="ts">
+import { listDevice, getDevice, delDevice, addDevice, updateDevice } from '@/api/system/device';
+import { DeviceVO, DeviceQuery, DeviceForm } from '@/api/system/device/types';
+
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+
+const deviceList = ref<DeviceVO[]>([]);
+const buttonLoading = ref(false);
+const loading = ref(true);
+const showSearch = ref(true);
+const ids = ref<Array<string | number>>([]);
+const single = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+
+const queryFormRef = ref<ElFormInstance>();
+const deviceFormRef = ref<ElFormInstance>();
+
+const dialog = reactive<DialogOption>({
+  visible: false,
+  title: ''
+});
+
+const initFormData: DeviceForm = {
+  id: undefined,
+  name: undefined,
+  direction: undefined,
+  zh: undefined,
+  lon: undefined,
+  lat: undefined,
+  ext1: undefined,
+  ext2: undefined,
+}
+const data = reactive<PageData<DeviceForm, DeviceQuery>>({
+  form: {...initFormData},
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    name: undefined,
+    direction: undefined,
+    zh: undefined,
+    lon: undefined,
+    lat: undefined,
+    ext1: undefined,
+    ext2: undefined,
+    params: {
+    }
+  },
+  rules: {
+    id: [
+      { required: true, message: "编号不能为空", trigger: "blur" }
+    ],
+  }
+});
+
+const { queryParams, form, rules } = toRefs(data);
+
+/** 查询设备-摄像机列表 */
+const getList = async () => {
+  loading.value = true;
+  const res = await listDevice(queryParams.value);
+  deviceList.value = res.rows;
+  total.value = res.total;
+  loading.value = false;
+}
+
+/** 取消按钮 */
+const cancel = () => {
+  reset();
+  dialog.visible = false;
+}
+
+/** 表单重置 */
+const reset = () => {
+  form.value = {...initFormData};
+  deviceFormRef.value?.resetFields();
+}
+
+/** 搜索按钮操作 */
+const handleQuery = () => {
+  queryParams.value.pageNum = 1;
+  getList();
+}
+
+/** 重置按钮操作 */
+const resetQuery = () => {
+  queryFormRef.value?.resetFields();
+  handleQuery();
+}
+
+/** 多选框选中数据 */
+const handleSelectionChange = (selection: DeviceVO[]) => {
+  ids.value = selection.map(item => item.id);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+
+/** 新增按钮操作 */
+const handleAdd = () => {
+  reset();
+  dialog.visible = true;
+  dialog.title = "添加设备-摄像机";
+}
+
+/** 修改按钮操作 */
+const handleUpdate = async (row?: DeviceVO) => {
+  reset();
+  const _id = row?.id || ids.value[0]
+  const res = await getDevice(_id);
+  Object.assign(form.value, res.data);
+  dialog.visible = true;
+  dialog.title = "修改设备-摄像机";
+}
+
+/** 提交按钮 */
+const submitForm = () => {
+  deviceFormRef.value?.validate(async (valid: boolean) => {
+    if (valid) {
+      buttonLoading.value = true;
+      if (form.value.id) {
+        await updateDevice(form.value).finally(() =>  buttonLoading.value = false);
+      } else {
+        await addDevice(form.value).finally(() =>  buttonLoading.value = false);
+      }
+      proxy?.$modal.msgSuccess("操作成功");
+      dialog.visible = false;
+      await getList();
+    }
+  });
+}
+
+/** 删除按钮操作 */
+const handleDelete = async (row?: DeviceVO) => {
+  const _ids = row?.id || ids.value;
+  await proxy?.$modal.confirm('是否确认删除设备-摄像机编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
+  await delDevice(_ids);
+  proxy?.$modal.msgSuccess("删除成功");
+  await getList();
+}
+
+/** 导出按钮操作 */
+const handleExport = () => {
+  proxy?.download('system/device/export', {
+    ...queryParams.value
+  }, `device_${new Date().getTime()}.xlsx`)
+}
+
+onMounted(() => {
+  getList();
+});
+</script>

BIN
py/sg.docx


+ 105 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/TblDeviceController.java

@@ -0,0 +1,105 @@
+package org.dromara.system.controller;
+
+import java.util.List;
+
+import lombok.RequiredArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.*;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.excel.utils.ExcelUtil;
+import org.dromara.system.domain.vo.TblDeviceVo;
+import org.dromara.system.domain.bo.TblDeviceBo;
+import org.dromara.system.service.ITblDeviceService;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+
+/**
+ * 设备-摄像机
+ *
+ * @author Lion Li
+ * @date 2025-07-01
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/system/device")
+public class TblDeviceController extends BaseController {
+
+    private final ITblDeviceService tblDeviceService;
+
+    /**
+     * 查询设备-摄像机列表
+     */
+//    @SaCheckPermission("system:device:list")
+    @GetMapping("/list")
+    public TableDataInfo<TblDeviceVo> list(TblDeviceBo bo, PageQuery pageQuery) {
+        return tblDeviceService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出设备-摄像机列表
+     */
+//    @SaCheckPermission("system:device:export")
+    @Log(title = "设备-摄像机", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(TblDeviceBo bo, HttpServletResponse response) {
+        List<TblDeviceVo> list = tblDeviceService.queryList(bo);
+        ExcelUtil.exportExcel(list, "设备-摄像机", TblDeviceVo.class, response);
+    }
+
+    /**
+     * 获取设备-摄像机详细信息
+     *
+     * @param id 主键
+     */
+//    @SaCheckPermission("system:device:query")
+    @GetMapping("/{id}")
+    public R<TblDeviceVo> getInfo(@NotNull(message = "主键不能为空")
+                                     @PathVariable Long id) {
+        return R.ok(tblDeviceService.queryById(id));
+    }
+
+    /**
+     * 新增设备-摄像机
+     */
+//    @SaCheckPermission("system:device:add")
+    @Log(title = "设备-摄像机", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody TblDeviceBo bo) {
+        return toAjax(tblDeviceService.insertByBo(bo));
+    }
+
+    /**
+     * 修改设备-摄像机
+     */
+//    @SaCheckPermission("system:device:edit")
+    @Log(title = "设备-摄像机", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody TblDeviceBo bo) {
+        return toAjax(tblDeviceService.updateByBo(bo));
+    }
+
+    /**
+     * 删除设备-摄像机
+     *
+     * @param ids 主键串
+     */
+//    @SaCheckPermission("system:device:remove")
+    @Log(title = "设备-摄像机", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable Long[] ids) {
+        return toAjax(tblDeviceService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 66 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/TblDevice.java

@@ -0,0 +1,66 @@
+package org.dromara.system.domain;
+
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+
+/**
+ * 设备-摄像机对象 tbl_device
+ *
+ * @author Lion Li
+ * @date 2025-07-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("tbl_device")
+public class TblDevice extends BaseEntity {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 方向
+     */
+    private String direction;
+
+    /**
+     * 桩号
+     */
+    private String zh;
+
+    /**
+     * 经度
+     */
+    private String lon;
+
+    /**
+     * 纬度
+     */
+    private String lat;
+
+    /**
+     * 扩展1
+     */
+    private String ext1;
+
+    /**
+     * 扩展2
+     */
+    private String ext2;
+
+
+}

+ 65 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/TblDeviceBo.java

@@ -0,0 +1,65 @@
+package org.dromara.system.domain.bo;
+
+import org.dromara.system.domain.TblDevice;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import jakarta.validation.constraints.*;
+
+/**
+ * 设备-摄像机业务对象 tbl_device
+ *
+ * @author Lion Li
+ * @date 2025-07-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = TblDevice.class, reverseConvertGenerate = false)
+public class TblDeviceBo extends BaseEntity {
+
+    /**
+     * 编号
+     */
+    @NotNull(message = "编号不能为空", groups = { EditGroup.class })
+    private Long id;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 方向
+     */
+    private String direction;
+
+    /**
+     * 桩号
+     */
+    private String zh;
+
+    /**
+     * 经度
+     */
+    private String lon;
+
+    /**
+     * 纬度
+     */
+    private String lat;
+
+    /**
+     * 扩展1
+     */
+    private String ext1;
+
+    /**
+     * 扩展2
+     */
+    private String ext2;
+
+
+}

+ 80 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/TblDeviceVo.java

@@ -0,0 +1,80 @@
+package org.dromara.system.domain.vo;
+
+import org.dromara.system.domain.TblDevice;
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
+import org.dromara.common.excel.annotation.ExcelDictFormat;
+import org.dromara.common.excel.convert.ExcelDictConvert;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+
+
+/**
+ * 设备-摄像机视图对象 tbl_device
+ *
+ * @author Lion Li
+ * @date 2025-07-01
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = TblDevice.class)
+public class TblDeviceVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @ExcelProperty(value = "编号")
+    private Long id;
+
+    /**
+     * 名称
+     */
+    @ExcelProperty(value = "名称")
+    private String name;
+
+    /**
+     * 方向
+     */
+    @ExcelProperty(value = "方向")
+    private String direction;
+
+    /**
+     * 桩号
+     */
+    @ExcelProperty(value = "桩号")
+    private String zh;
+
+    /**
+     * 经度
+     */
+    @ExcelProperty(value = "经度")
+    private String lon;
+
+    /**
+     * 纬度
+     */
+    @ExcelProperty(value = "纬度")
+    private String lat;
+
+    /**
+     * 扩展1
+     */
+    @ExcelProperty(value = "扩展1")
+    private String ext1;
+
+    /**
+     * 扩展2
+     */
+    @ExcelProperty(value = "扩展2")
+    private String ext2;
+
+
+}

+ 15 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/TblDeviceMapper.java

@@ -0,0 +1,15 @@
+package org.dromara.system.mapper;
+
+import org.dromara.system.domain.TblDevice;
+import org.dromara.system.domain.vo.TblDeviceVo;
+import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
+
+/**
+ * 设备-摄像机Mapper接口
+ *
+ * @author Lion Li
+ * @date 2025-07-01
+ */
+public interface TblDeviceMapper extends BaseMapperPlus<TblDevice, TblDeviceVo> {
+
+}

+ 68 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ITblDeviceService.java

@@ -0,0 +1,68 @@
+package org.dromara.system.service;
+
+import org.dromara.system.domain.vo.TblDeviceVo;
+import org.dromara.system.domain.bo.TblDeviceBo;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 设备-摄像机Service接口
+ *
+ * @author Lion Li
+ * @date 2025-07-01
+ */
+public interface ITblDeviceService {
+
+    /**
+     * 查询设备-摄像机
+     *
+     * @param id 主键
+     * @return 设备-摄像机
+     */
+    TblDeviceVo queryById(Long id);
+
+    /**
+     * 分页查询设备-摄像机列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 设备-摄像机分页列表
+     */
+    TableDataInfo<TblDeviceVo> queryPageList(TblDeviceBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询符合条件的设备-摄像机列表
+     *
+     * @param bo 查询条件
+     * @return 设备-摄像机列表
+     */
+    List<TblDeviceVo> queryList(TblDeviceBo bo);
+
+    /**
+     * 新增设备-摄像机
+     *
+     * @param bo 设备-摄像机
+     * @return 是否新增成功
+     */
+    Boolean insertByBo(TblDeviceBo bo);
+
+    /**
+     * 修改设备-摄像机
+     *
+     * @param bo 设备-摄像机
+     * @return 是否修改成功
+     */
+    Boolean updateByBo(TblDeviceBo bo);
+
+    /**
+     * 校验并批量删除设备-摄像机信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 138 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/TblDeviceServiceImpl.java

@@ -0,0 +1,138 @@
+package org.dromara.system.service.impl;
+
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.dromara.system.domain.bo.TblDeviceBo;
+import org.dromara.system.domain.vo.TblDeviceVo;
+import org.dromara.system.domain.TblDevice;
+import org.dromara.system.mapper.TblDeviceMapper;
+import org.dromara.system.service.ITblDeviceService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * 设备-摄像机Service业务层处理
+ *
+ * @author Lion Li
+ * @date 2025-07-01
+ */
+@Slf4j
+@RequiredArgsConstructor
+@Service
+public class TblDeviceServiceImpl implements ITblDeviceService {
+
+    private final TblDeviceMapper baseMapper;
+
+    /**
+     * 查询设备-摄像机
+     *
+     * @param id 主键
+     * @return 设备-摄像机
+     */
+    @Override
+    public TblDeviceVo queryById(Long id){
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 分页查询设备-摄像机列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 设备-摄像机分页列表
+     */
+    @Override
+    public TableDataInfo<TblDeviceVo> queryPageList(TblDeviceBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<TblDevice> lqw = buildQueryWrapper(bo);
+        Page<TblDeviceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询符合条件的设备-摄像机列表
+     *
+     * @param bo 查询条件
+     * @return 设备-摄像机列表
+     */
+    @Override
+    public List<TblDeviceVo> queryList(TblDeviceBo bo) {
+        LambdaQueryWrapper<TblDevice> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<TblDevice> buildQueryWrapper(TblDeviceBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<TblDevice> lqw = Wrappers.lambdaQuery();
+        lqw.orderByAsc(TblDevice::getId);
+        lqw.like(StringUtils.isNotBlank(bo.getName()), TblDevice::getName, bo.getName());
+        lqw.eq(StringUtils.isNotBlank(bo.getDirection()), TblDevice::getDirection, bo.getDirection());
+        lqw.eq(StringUtils.isNotBlank(bo.getZh()), TblDevice::getZh, bo.getZh());
+        lqw.eq(StringUtils.isNotBlank(bo.getLon()), TblDevice::getLon, bo.getLon());
+        lqw.eq(StringUtils.isNotBlank(bo.getLat()), TblDevice::getLat, bo.getLat());
+        lqw.eq(StringUtils.isNotBlank(bo.getExt1()), TblDevice::getExt1, bo.getExt1());
+        lqw.eq(StringUtils.isNotBlank(bo.getExt2()), TblDevice::getExt2, bo.getExt2());
+        return lqw;
+    }
+
+    /**
+     * 新增设备-摄像机
+     *
+     * @param bo 设备-摄像机
+     * @return 是否新增成功
+     */
+    @Override
+    public Boolean insertByBo(TblDeviceBo bo) {
+        TblDevice add = MapstructUtils.convert(bo, TblDevice.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改设备-摄像机
+     *
+     * @param bo 设备-摄像机
+     * @return 是否修改成功
+     */
+    @Override
+    public Boolean updateByBo(TblDeviceBo bo) {
+        TblDevice update = MapstructUtils.convert(bo, TblDevice.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(TblDevice entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 校验并批量删除设备-摄像机信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteByIds(ids) > 0;
+    }
+}

+ 7 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/TblDeviceMapper.xml

@@ -0,0 +1,7 @@
+<?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.dromara.system.mapper.TblDeviceMapper">
+
+</mapper>