ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCameraUserPostionController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ard-work/src/main/java/com/ruoyi/device/camera/domain/ArdCameraUserPostion.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCameraUserPostionMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCameraUserPostionService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCameraUserPostionServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ard-work/src/main/resources/mapper/device/ArdCameraUserPostionMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCameraUserPostionController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,123 @@ package com.ruoyi.device.camera.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.ruoyi.common.annotation.Anonymous; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; 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.device.camera.domain.ArdCameraUserPostion; import com.ruoyi.device.camera.service.IArdCameraUserPostionService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * ç¨æ·é¢è§ä½ç½®Controller * * @author åèä¹ * @date 2024-05-08 */ @Api(tags = "ç¨æ·é¢è§ä½ç½®") @RestController @RequestMapping("/camera/postion") public class ArdCameraUserPostionController extends BaseController { @Autowired private IArdCameraUserPostionService ardCameraUserPostionService; /** * æ¥è¯¢ç¨æ·é¢è§ä½ç½®å表 */ @PreAuthorize("@ss.hasPermi('camera:postion:list')") @GetMapping("/list") public TableDataInfo list(ArdCameraUserPostion ardCameraUserPostion) { startPage(); List<ArdCameraUserPostion> list = ardCameraUserPostionService.selectArdCameraUserPostionList(ardCameraUserPostion); return getDataTable(list); } /** * 导åºç¨æ·é¢è§ä½ç½®å表 */ @PreAuthorize("@ss.hasPermi('camera:postion:export')") @Log(title = "ç¨æ·é¢è§ä½ç½®", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ArdCameraUserPostion ardCameraUserPostion) { List<ArdCameraUserPostion> list = ardCameraUserPostionService.selectArdCameraUserPostionList(ardCameraUserPostion); ExcelUtil<ArdCameraUserPostion> util = new ExcelUtil<ArdCameraUserPostion>(ArdCameraUserPostion.class); util.exportExcel(response, list, "ç¨æ·é¢è§ä½ç½®æ°æ®"); } /** * è·åç¨æ·é¢è§ä½ç½®è¯¦ç»ä¿¡æ¯ */ @PreAuthorize("@ss.hasPermi('camera:postion:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") String id) { return success(ardCameraUserPostionService.selectArdCameraUserPostionById(id)); } /** * è·åç¨æ·é¢è§ç¸æºè¯¦ç»ä¿¡æ¯ */ @ApiOperation("è·åç¨æ·é¢è§ç¸æºè¯¦ç»ä¿¡æ¯") //@PreAuthorize("@ss.hasPermi('camera:postion:query')") @GetMapping(value = "/getCameraInfo/{position}") public AjaxResult getCameraInfo(@PathVariable("position") String position) { return success(ardCameraUserPostionService.selectArdCameraUserPostionByPosition(position)); } /** * æ°å¢ç¨æ·é¢è§ä½ç½® */ @ApiOperation("æ°å¢ç¨æ·é¢è§ä½ç½®") @ApiOperationSupport(includeParameters = {"ardCameraUserPostion.cameraId", "ardCameraUserPostion.chanNo","ardCameraUserPostion.position"}) //@PreAuthorize("@ss.hasPermi('camera:postion:add')") @Log(title = "ç¨æ·é¢è§ä½ç½®", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ArdCameraUserPostion ardCameraUserPostion) { return toAjax(ardCameraUserPostionService.insertArdCameraUserPostion(ardCameraUserPostion)); } /** * ä¿®æ¹ç¨æ·é¢è§ä½ç½® */ @PreAuthorize("@ss.hasPermi('camera:postion:edit')") @Log(title = "ç¨æ·é¢è§ä½ç½®", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ArdCameraUserPostion ardCameraUserPostion) { return toAjax(ardCameraUserPostionService.updateArdCameraUserPostion(ardCameraUserPostion)); } /** * å é¤ç¨æ·é¢è§ä½ç½® */ @PreAuthorize("@ss.hasPermi('camera:postion:remove')") @Log(title = "ç¨æ·é¢è§ä½ç½®", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) { return toAjax(ardCameraUserPostionService.deleteArdCameraUserPostionByIds(ids)); } } ard-work/src/main/java/com/ruoyi/device/camera/domain/ArdCameraUserPostion.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,104 @@ package com.ruoyi.device.camera.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; /** * ç¨æ·é¢è§ä½ç½®å¯¹è±¡ ard_camera_user_postion * * @author åèä¹ * @date 2024-05-08 */ public class ArdCameraUserPostion extends BaseEntity { private static final long serialVersionUID = 1L; /** ä¸»é® */ private String id; /** ç¸æºID */ @Excel(name = "ç¸æºID") private String cameraId; /** ééå· */ @Excel(name = "ééå·") private Integer chanNo; /** ç¨æ·ID */ @Excel(name = "ç¨æ·ID") private String userId; /** ä½ç½®æ è¯ */ @Excel(name = "ä½ç½®æ è¯") private String position; /** ä½ç½®æ è¯ */ private ArdCameras ardCameras; public ArdCameras getArdCameras() { return ardCameras; } public void setArdCameras(ArdCameras ardCameras) { this.ardCameras = ardCameras; } public void setId(String id) { this.id = id; } public String getId() { return id; } public void setCameraId(String cameraId) { this.cameraId = cameraId; } public String getCameraId() { return cameraId; } public void setChanNo(Integer chanNo) { this.chanNo = chanNo; } public Integer getChanNo() { return chanNo; } public void setUserId(String userId) { this.userId = userId; } public String getUserId() { return userId; } public void setPosition(String position) { this.position = position; } public String getPosition() { return position; } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) .append("cameraId", getCameraId()) .append("chanNo", getChanNo()) .append("userId", getUserId()) .append("position", getPosition()) .toString(); } } ard-work/src/main/java/com/ruoyi/device/camera/mapper/ArdCameraUserPostionMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,69 @@ package com.ruoyi.device.camera.mapper; import java.util.List; import com.ruoyi.device.camera.domain.ArdCameraUserPostion; import com.ruoyi.device.camera.domain.ArdCameras; /** * ç¨æ·é¢è§ä½ç½®Mapperæ¥å£ * * @author åèä¹ * @date 2024-05-08 */ public interface ArdCameraUserPostionMapper { /** * æ¥è¯¢ç¨æ·é¢è§ä½ç½® * * @param id ç¨æ·é¢è§ä½ç½®ä¸»é® * @return ç¨æ·é¢è§ä½ç½® */ public ArdCameraUserPostion selectArdCameraUserPostionById(String id); /** * æ¥è¯¢ç¨æ·é¢è§ç¸æºä¿¡æ¯ * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½®ä¸»é® * @return ç¨æ·é¢è§ä½ç½® */ public ArdCameras selectArdCameraUserPostionByPosition(ArdCameraUserPostion ardCameraUserPostion); /** * æ¥è¯¢ç¨æ·é¢è§ä½ç½®å表 * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½® * @return ç¨æ·é¢è§ä½ç½®éå */ public List<ArdCameraUserPostion> selectArdCameraUserPostionList(ArdCameraUserPostion ardCameraUserPostion); /** * æ°å¢ç¨æ·é¢è§ä½ç½® * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½® * @return ç»æ */ public int insertArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion); /** * ä¿®æ¹ç¨æ·é¢è§ä½ç½® * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½® * @return ç»æ */ public int updateArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion); /** * å é¤ç¨æ·é¢è§ä½ç½® * * @param id ç¨æ·é¢è§ä½ç½®ä¸»é® * @return ç»æ */ public int deleteArdCameraUserPostionById(String id); /** * æ¹éå é¤ç¨æ·é¢è§ä½ç½® * * @param ids éè¦å é¤çæ°æ®ä¸»é®éå * @return ç»æ */ public int deleteArdCameraUserPostionByIds(String[] ids); } ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCameraUserPostionService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,68 @@ package com.ruoyi.device.camera.service; import java.util.List; import com.ruoyi.device.camera.domain.ArdCameraUserPostion; import com.ruoyi.device.camera.domain.ArdCameras; /** * ç¨æ·é¢è§ä½ç½®Serviceæ¥å£ * * @author åèä¹ * @date 2024-05-08 */ public interface IArdCameraUserPostionService { /** * æ¥è¯¢ç¨æ·é¢è§ä½ç½® * * @param id ç¨æ·é¢è§ä½ç½®ä¸»é® * @return ç¨æ·é¢è§ä½ç½® */ public ArdCameraUserPostion selectArdCameraUserPostionById(String id); /** * æ¥è¯¢ç¨æ·é¢è§ç¸æºä¿¡æ¯ * * @param position ç¨æ·é¢è§ä½ç½® * @return ç¨æ·é¢è§ä½ç½® */ public ArdCameras selectArdCameraUserPostionByPosition(String position); /** * æ¥è¯¢ç¨æ·é¢è§ä½ç½®å表 * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½® * @return ç¨æ·é¢è§ä½ç½®éå */ public List<ArdCameraUserPostion> selectArdCameraUserPostionList(ArdCameraUserPostion ardCameraUserPostion); /** * æ°å¢ç¨æ·é¢è§ä½ç½® * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½® * @return ç»æ */ public int insertArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion); /** * ä¿®æ¹ç¨æ·é¢è§ä½ç½® * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½® * @return ç»æ */ public int updateArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion); /** * æ¹éå é¤ç¨æ·é¢è§ä½ç½® * * @param ids éè¦å é¤çç¨æ·é¢è§ä½ç½®ä¸»é®éå * @return ç»æ */ public int deleteArdCameraUserPostionByIds(String[] ids); /** * å é¤ç¨æ·é¢è§ä½ç½®ä¿¡æ¯ * * @param id ç¨æ·é¢è§ä½ç½®ä¸»é® * @return ç»æ */ public int deleteArdCameraUserPostionById(String id); } ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCameraUserPostionServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,110 @@ package com.ruoyi.device.camera.service.impl; import java.util.List; import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.device.camera.domain.ArdCameras; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.device.camera.mapper.ArdCameraUserPostionMapper; import com.ruoyi.device.camera.domain.ArdCameraUserPostion; import com.ruoyi.device.camera.service.IArdCameraUserPostionService; /** * ç¨æ·é¢è§ä½ç½®Serviceä¸å¡å±å¤ç * * @author åèä¹ * @date 2024-05-08 */ @Service public class ArdCameraUserPostionServiceImpl implements IArdCameraUserPostionService { @Autowired private ArdCameraUserPostionMapper ardCameraUserPostionMapper; /** * æ¥è¯¢ç¨æ·é¢è§ä½ç½® * * @param id ç¨æ·é¢è§ä½ç½®ä¸»é® * @return ç¨æ·é¢è§ä½ç½® */ @Override public ArdCameraUserPostion selectArdCameraUserPostionById(String id) { return ardCameraUserPostionMapper.selectArdCameraUserPostionById(id); } @Override public ArdCameras selectArdCameraUserPostionByPosition(String position) { ArdCameraUserPostion ardCameraUserPostion = new ArdCameraUserPostion(); ardCameraUserPostion.setUserId(SecurityUtils.getUserId()); ardCameraUserPostion.setPosition(position); ArdCameras ardCameras = ardCameraUserPostionMapper.selectArdCameraUserPostionByPosition(ardCameraUserPostion); return ardCameras; } /** * æ¥è¯¢ç¨æ·é¢è§ä½ç½®å表 * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½® * @return ç¨æ·é¢è§ä½ç½® */ @Override public List<ArdCameraUserPostion> selectArdCameraUserPostionList(ArdCameraUserPostion ardCameraUserPostion) { return ardCameraUserPostionMapper.selectArdCameraUserPostionList(ardCameraUserPostion); } /** * æ°å¢ç¨æ·é¢è§ä½ç½® * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½® * @return ç»æ */ @Override public int insertArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion) { ardCameraUserPostion.setUserId(SecurityUtils.getUserId()); List<ArdCameraUserPostion> ardCameraUserPostions = ardCameraUserPostionMapper.selectArdCameraUserPostionList(ardCameraUserPostion); if (ardCameraUserPostions.size() > 0) { return ardCameraUserPostionMapper.updateArdCameraUserPostion(ardCameraUserPostion); } else { ardCameraUserPostion.setId(IdUtils.simpleUUID()); return ardCameraUserPostionMapper.insertArdCameraUserPostion(ardCameraUserPostion); } } /** * ä¿®æ¹ç¨æ·é¢è§ä½ç½® * * @param ardCameraUserPostion ç¨æ·é¢è§ä½ç½® * @return ç»æ */ @Override public int updateArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion) { return ardCameraUserPostionMapper.updateArdCameraUserPostion(ardCameraUserPostion); } /** * æ¹éå é¤ç¨æ·é¢è§ä½ç½® * * @param ids éè¦å é¤çç¨æ·é¢è§ä½ç½®ä¸»é® * @return ç»æ */ @Override public int deleteArdCameraUserPostionByIds(String[] ids) { return ardCameraUserPostionMapper.deleteArdCameraUserPostionByIds(ids); } /** * å é¤ç¨æ·é¢è§ä½ç½®ä¿¡æ¯ * * @param id ç¨æ·é¢è§ä½ç½®ä¸»é® * @return ç»æ */ @Override public int deleteArdCameraUserPostionById(String id) { return ardCameraUserPostionMapper.deleteArdCameraUserPostionById(id); } } ard-work/src/main/resources/mapper/device/ArdCameraUserPostionMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,148 @@ <?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.ruoyi.device.camera.mapper.ArdCameraUserPostionMapper"> <resultMap type="ArdCameras" id="ArdCamerasResult"> <result property="id" column="id"/> <result property="name" column="name"/> <result property="ip" column="ip"/> <result property="port" column="port"/> <result property="rtspPort" column="rtsp_port"/> <result property="username" column="username"/> <result property="password" column="password"/> <result property="gdtype" column="gdtype"/> <result property="factory" column="factory"/> <result property="chanNum" column="channel"/> <result property="longitude" column="longitude"/> <result property="latitude" column="latitude"/> <result property="altitude" column="altitude"/> <result property="userId" column="user_id"/> <result property="deptId" column="dept_id"/> <result property="camHeading" column="cam_heading"/> <result property="camPitch" column="cam_pitch"/> <result property="camRoll" column="cam_roll"/> <result property="camNear" column="cam_near"/> <result property="camFar" column="cam_far"/> <result property="camAspectratio" column="cam_aspectratio"/> <result property="camDepth" column="cam_depth"/> <result property="camFov" column="cam_fov"/> <result property="loginId" column="login_id"/> <result property="operatorId" column="operator_id"/> <result property="operatorExpired" column="operator_expired"/> <result property="camMaxVisibleDistance" column="cam_max_visible_distance"/> <result property="camAlarmGuideEnable" column="cam_alarm_guide_enable"/> <result property="state" column="state"/> <result property="towerId" column="tower_id"/> <collection property="channelList" ofType="ArdChannel"> <result property="id" column="c_id"/> <result property="name" column="c_name"/> <result property="chanNo" column="c_chan_no"/> <result property="deviceId" column="c_device_id"/> </collection> </resultMap> <resultMap type="ArdCameraUserPostion" id="ArdCameraUserPostionResult"> <result property="id" column="id" /> <result property="cameraId" column="camera_id" /> <result property="chanNo" column="chan_no" /> <result property="userId" column="user_id" /> <result property="position" column="position" /> </resultMap> <sql id="selectArdCameraUserPostionVo"> select id, camera_id, chan_no, user_id, position from ard_camera_user_postion </sql> <select id="selectArdCameraUserPostionList" parameterType="ArdCameraUserPostion" resultMap="ArdCameraUserPostionResult"> <include refid="selectArdCameraUserPostionVo"/> <where> <if test="userId != null and userId != ''"> and user_id = #{userId}</if> <if test="position != null and position != ''"> and position = #{position}</if> </where> </select> <select id="selectArdCameraUserPostionByPosition" parameterType="ArdCameraUserPostion" resultMap="ArdCamerasResult"> SELECT c.id, c.name, c.ip, c.port, c.rtsp_port, c.username, c.password, c.gdtype, c.factory, c.channel, c.longitude, c.latitude, c.altitude, c.user_id, c.dept_id, c.login_id, c.cam_heading, c.cam_pitch, c.cam_roll, c.cam_near, c.cam_far, c.cam_aspectratio, c.cam_depth, c.cam_fov, c.operator_id, c.operator_expired, c.cam_max_visible_distance, c.cam_alarm_guide_enable, c.state, c.tower_id, aaa.id as c_id, aaa.device_id as c_device_id, aaa.name as c_name, aaa.chan_no as c_chan_no FROM ard_camera_user_postion p LEFT JOIN ard_cameras c ON c.id = p.camera_id LEFT JOIN ard_channel aaa on c.id = aaa.device_id where p.user_id = #{userId} and p.position = #{position} </select> <select id="selectArdCameraUserPostionById" parameterType="String" resultMap="ArdCameraUserPostionResult"> <include refid="selectArdCameraUserPostionVo"/> where id = #{id} </select> <insert id="insertArdCameraUserPostion" parameterType="ArdCameraUserPostion"> insert into ard_camera_user_postion <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">id,</if> <if test="cameraId != null">camera_id,</if> <if test="chanNo != null">chan_no,</if> <if test="userId != null">user_id,</if> <if test="position != null">position,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if> <if test="cameraId != null">#{cameraId},</if> <if test="chanNo != null">#{chanNo},</if> <if test="userId != null">#{userId},</if> <if test="position != null">#{position},</if> </trim> </insert> <update id="updateArdCameraUserPostion" parameterType="ArdCameraUserPostion"> update ard_camera_user_postion <trim prefix="SET" suffixOverrides=","> <if test="cameraId != null">camera_id = #{cameraId},</if> <if test="chanNo != null">chan_no = #{chanNo},</if> <if test="userId != null">user_id = #{userId},</if> <if test="position != null">position = #{position},</if> </trim> where position = #{position} and user_id = #{userId} </update> <delete id="deleteArdCameraUserPostionById" parameterType="String"> delete from ard_camera_user_postion where id = #{id} </delete> <delete id="deleteArdCameraUserPostionByIds" parameterType="String"> delete from ard_camera_user_postion where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> </mapper>