lchao hace 1 año
padre
commit
97b0268df1

+ 98 - 0
zhsq_qk-admin/src/main/java/zhsq_qk/web/controller/system/SysCameraController.java

@@ -0,0 +1,98 @@
+package zhsq_qk.web.controller.system;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+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 zhsq_qk.common.annotation.Log;
+import zhsq_qk.common.core.controller.BaseController;
+import zhsq_qk.common.core.domain.AjaxResult;
+import zhsq_qk.common.enums.BusinessType;
+import zhsq_qk.system.domain.SysCamera;
+import zhsq_qk.system.service.ISysCameraService;
+import zhsq_qk.common.utils.poi.ExcelUtil;
+import zhsq_qk.common.core.page.TableDataInfo;
+
+/**
+ * 摄像头Controller
+ *
+ * @author lc
+ * @date 2024-05-30
+ */
+@RestController
+@RequestMapping("/system/camera")
+public class SysCameraController extends BaseController {
+    @Autowired
+    private ISysCameraService sysCameraService;
+
+/**
+ * 查询摄像头列表
+ */
+@PreAuthorize("@ss.hasPermi('system:camera:list')")
+@GetMapping("/list")
+    public TableDataInfo list(SysCamera sysCamera) {
+        startPage();
+        List<SysCamera> list = sysCameraService.selectSysCameraList(sysCamera);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出摄像头列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:export')")
+    @Log(title = "摄像头", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, SysCamera sysCamera) {
+        List<SysCamera> list = sysCameraService.selectSysCameraList(sysCamera);
+        ExcelUtil<SysCamera> util = new ExcelUtil<SysCamera>(SysCamera. class);
+        util.exportExcel(response, list, "摄像头数据");
+    }
+
+    /**
+     * 获取摄像头详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(sysCameraService.selectSysCameraById(id));
+    }
+
+    /**
+     * 新增摄像头
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:add')")
+    @Log(title = "摄像头", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysCamera sysCamera) {
+        return toAjax(sysCameraService.insertSysCamera(sysCamera));
+    }
+
+    /**
+     * 修改摄像头
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:edit')")
+    @Log(title = "摄像头", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysCamera sysCamera) {
+        return toAjax(sysCameraService.updateSysCamera(sysCamera));
+    }
+
+    /**
+     * 删除摄像头
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:remove')")
+    @Log(title = "摄像头", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(sysCameraService.deleteSysCameraByIds(ids));
+    }
+}

+ 95 - 0
zhsq_qk-system/src/main/java/zhsq_qk/system/domain/SysCamera.java

@@ -0,0 +1,95 @@
+package zhsq_qk.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import zhsq_qk.common.annotation.Excel;
+import zhsq_qk.common.core.domain.BaseEntity;
+
+/**
+ * 摄像头对象 sys_camera
+ *
+ * @author lc
+ * @date 2024-05-30
+ */
+public class SysCamera extends BaseEntity
+        {
+private static final long serialVersionUID = 1L;
+
+        /** 主键id */
+        private Long id;
+
+        /** 归属派出所 */
+                @Excel(name = "归属派出所")
+        private String ascriptionStation;
+
+        /** 点位具体位置 */
+                @Excel(name = "点位具体位置")
+        private String address;
+
+        /** 经度 */
+                @Excel(name = "经度")
+        private String longitude;
+
+        /** 纬度 */
+                @Excel(name = "纬度")
+        private String latitude;
+
+        /** 类型 */
+                @Excel(name = "类型")
+        private String buildType;
+
+        public void setId(Long id) {
+            this.id = id;
+        }
+
+        public Long getId() {
+            return id;
+        }
+        public void setAscriptionStation(String ascriptionStation) {
+            this.ascriptionStation = ascriptionStation;
+        }
+
+        public String getAscriptionStation() {
+            return ascriptionStation;
+        }
+        public void setAddress(String address) {
+            this.address = address;
+        }
+
+        public String getAddress() {
+            return address;
+        }
+        public void setLongitude(String longitude) {
+            this.longitude = longitude;
+        }
+
+        public String getLongitude() {
+            return longitude;
+        }
+        public void setLatitude(String latitude) {
+            this.latitude = latitude;
+        }
+
+        public String getLatitude() {
+            return latitude;
+        }
+        public void setBuildType(String buildType) {
+            this.buildType = buildType;
+        }
+
+        public String getBuildType() {
+            return buildType;
+        }
+
+@Override
+public String toString() {
+    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+        .append("id", getId())
+        .append("ascriptionStation", getAscriptionStation())
+        .append("address", getAddress())
+        .append("longitude", getLongitude())
+        .append("latitude", getLatitude())
+        .append("buildType", getBuildType())
+            .toString();
+}
+}

+ 61 - 0
zhsq_qk-system/src/main/java/zhsq_qk/system/mapper/SysCameraMapper.java

@@ -0,0 +1,61 @@
+package zhsq_qk.system.mapper;
+
+import java.util.List;
+
+import zhsq_qk.system.domain.SysCamera;
+
+/**
+ * 摄像头Mapper接口
+ *
+ * @author lc
+ * @date 2024-05-30
+ */
+public interface SysCameraMapper {
+    /**
+     * 查询摄像头
+     *
+     * @param id 摄像头主键
+     * @return 摄像头
+     */
+    public SysCamera selectSysCameraById(Long id);
+
+    /**
+     * 查询摄像头列表
+     *
+     * @param sysCamera 摄像头
+     * @return 摄像头集合
+     */
+    public List<SysCamera> selectSysCameraList(SysCamera sysCamera);
+
+    /**
+     * 新增摄像头
+     *
+     * @param sysCamera 摄像头
+     * @return 结果
+     */
+    public int insertSysCamera(SysCamera sysCamera);
+
+    /**
+     * 修改摄像头
+     *
+     * @param sysCamera 摄像头
+     * @return 结果
+     */
+    public int updateSysCamera(SysCamera sysCamera);
+
+    /**
+     * 删除摄像头
+     *
+     * @param id 摄像头主键
+     * @return 结果
+     */
+    public int deleteSysCameraById(Long id);
+
+    /**
+     * 批量删除摄像头
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteSysCameraByIds(Long[] ids);
+}

+ 61 - 0
zhsq_qk-system/src/main/java/zhsq_qk/system/service/ISysCameraService.java

@@ -0,0 +1,61 @@
+package zhsq_qk.system.service;
+
+import java.util.List;
+
+import zhsq_qk.system.domain .SysCamera;
+
+/**
+ * 摄像头Service接口
+ *
+ * @author lc
+ * @date 2024-05-30
+ */
+public interface ISysCameraService {
+    /**
+     * 查询摄像头
+     *
+     * @param id 摄像头主键
+     * @return 摄像头
+     */
+    public SysCamera selectSysCameraById(Long id);
+
+    /**
+     * 查询摄像头列表
+     *
+     * @param sysCamera 摄像头
+     * @return 摄像头集合
+     */
+    public List<SysCamera> selectSysCameraList(SysCamera sysCamera);
+
+    /**
+     * 新增摄像头
+     *
+     * @param sysCamera 摄像头
+     * @return 结果
+     */
+    public int insertSysCamera(SysCamera sysCamera);
+
+    /**
+     * 修改摄像头
+     *
+     * @param sysCamera 摄像头
+     * @return 结果
+     */
+    public int updateSysCamera(SysCamera sysCamera);
+
+    /**
+     * 批量删除摄像头
+     *
+     * @param ids 需要删除的摄像头主键集合
+     * @return 结果
+     */
+    public int deleteSysCameraByIds(Long[] ids);
+
+    /**
+     * 删除摄像头信息
+     *
+     * @param id 摄像头主键
+     * @return 结果
+     */
+    public int deleteSysCameraById(Long id);
+}

+ 86 - 0
zhsq_qk-system/src/main/java/zhsq_qk/system/service/impl/SysCameraServiceImpl.java

@@ -0,0 +1,86 @@
+package zhsq_qk.system.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import zhsq_qk.system.mapper.SysCameraMapper;
+import zhsq_qk.system.domain.SysCamera;
+import zhsq_qk.system.service.ISysCameraService;
+
+/**
+ * 摄像头Service业务层处理
+ *
+ * @author lc
+ * @date 2024-05-30
+ */
+@Service
+public class SysCameraServiceImpl implements ISysCameraService {
+    @Autowired
+    private SysCameraMapper sysCameraMapper;
+
+    /**
+     * 查询摄像头
+     *
+     * @param id 摄像头主键
+     * @return 摄像头
+     */
+    @Override
+    public SysCamera selectSysCameraById(Long id) {
+        return sysCameraMapper.selectSysCameraById(id);
+    }
+
+    /**
+     * 查询摄像头列表
+     *
+     * @param sysCamera 摄像头
+     * @return 摄像头
+     */
+    @Override
+    public List<SysCamera> selectSysCameraList(SysCamera sysCamera) {
+        return sysCameraMapper.selectSysCameraList(sysCamera);
+    }
+
+    /**
+     * 新增摄像头
+     *
+     * @param sysCamera 摄像头
+     * @return 结果
+     */
+    @Override
+    public int insertSysCamera(SysCamera sysCamera) {
+            return sysCameraMapper.insertSysCamera(sysCamera);
+    }
+
+    /**
+     * 修改摄像头
+     *
+     * @param sysCamera 摄像头
+     * @return 结果
+     */
+    @Override
+    public int updateSysCamera(SysCamera sysCamera) {
+        return sysCameraMapper.updateSysCamera(sysCamera);
+    }
+
+    /**
+     * 批量删除摄像头
+     *
+     * @param ids 需要删除的摄像头主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysCameraByIds(Long[] ids) {
+        return sysCameraMapper.deleteSysCameraByIds(ids);
+    }
+
+    /**
+     * 删除摄像头信息
+     *
+     * @param id 摄像头主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysCameraById(Long id) {
+        return sysCameraMapper.deleteSysCameraById(id);
+    }
+}

+ 113 - 0
zhsq_qk-system/src/main/resources/mapper/system/SysCameraMapper.xml

@@ -0,0 +1,113 @@
+<?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="zhsq_qk.system.mapper.SysCameraMapper">
+
+    <resultMap type="SysCamera" id="SysCameraResult">
+            <result property="id" column="id"/>
+            <result property="ascriptionStation" column="ascription_station"/>
+            <result property="address" column="address"/>
+            <result property="longitude" column="longitude"/>
+            <result property="latitude" column="latitude"/>
+            <result property="buildType" column="build_type"/>
+    </resultMap>
+
+    <sql id="selectSysCameraVo">
+        select id, ascription_station, address, longitude, latitude, build_type
+        from sys_camera
+    </sql>
+
+    <select id="selectSysCameraList" parameterType="SysCamera" resultMap="SysCameraResult">
+        <include refid="selectSysCameraVo"/>
+        <where>
+                        <if test="ascriptionStation != null  and ascriptionStation != ''">
+                            and ascription_station = #{ascriptionStation}
+                        </if>
+                        <if test="address != null  and address != ''">
+                            and address = #{address}
+                        </if>
+                        <if test="longitude != null  and longitude != ''">
+                            and longitude = #{longitude}
+                        </if>
+                        <if test="latitude != null  and latitude != ''">
+                            and latitude = #{latitude}
+                        </if>
+                        <if test="buildType != null  and buildType != ''">
+                            and build_type = #{buildType}
+                        </if>
+        </where>
+    </select>
+
+    <select id="selectSysCameraById" parameterType="Long"
+            resultMap="SysCameraResult">
+            <include refid="selectSysCameraVo"/>
+            where id = #{id}
+    </select>
+
+    <insert id="insertSysCamera" parameterType="SysCamera">
+        insert into sys_camera
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test="id != null">id,
+                    </if>
+                    <if test="ascriptionStation != null">ascription_station,
+                    </if>
+                    <if test="address != null">address,
+                    </if>
+                    <if test="longitude != null">longitude,
+                    </if>
+                    <if test="latitude != null">latitude,
+                    </if>
+                    <if test="buildType != null">build_type,
+                    </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test="id != null">#{id},
+                    </if>
+                    <if test="ascriptionStation != null">#{ascriptionStation},
+                    </if>
+                    <if test="address != null">#{address},
+                    </if>
+                    <if test="longitude != null">#{longitude},
+                    </if>
+                    <if test="latitude != null">#{latitude},
+                    </if>
+                    <if test="buildType != null">#{buildType},
+                    </if>
+        </trim>
+    </insert>
+
+    <update id="updateSysCamera" parameterType="SysCamera">
+        update sys_camera
+        <trim prefix="SET" suffixOverrides=",">
+                    <if test="ascriptionStation != null">ascription_station =
+                        #{ascriptionStation},
+                    </if>
+                    <if test="address != null">address =
+                        #{address},
+                    </if>
+                    <if test="longitude != null">longitude =
+                        #{longitude},
+                    </if>
+                    <if test="latitude != null">latitude =
+                        #{latitude},
+                    </if>
+                    <if test="buildType != null">build_type =
+                        #{buildType},
+                    </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteSysCameraById" parameterType="Long">
+        delete
+        from sys_camera where id = #{id}
+    </delete>
+
+    <delete id="deleteSysCameraByIds" parameterType="String">
+        delete from sys_camera where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>