Browse Source

视频管理模块

hym 4 years ago
parent
commit
6da84d4c2b

+ 139 - 0
sms_water/src/main/java/com/huaxu/controller/CameraManageController.java

@@ -0,0 +1,139 @@
+package com.huaxu.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huaxu.entity.CameraManage;
+import com.huaxu.model.AjaxMessage;
+import com.huaxu.model.Pagination;
+import com.huaxu.model.ResultStatus;
+import com.huaxu.service.CameraManageService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * (CameraManage)控制层
+ *
+ * @author makejava
+ * @since 2020-11-26 10:25:12
+ */
+@RestController
+@RequestMapping("/cameraManage")
+@Api(tags = "摄像头管理")
+public class CameraManageController {
+    /**
+     * 服务对象
+     */
+    @Autowired
+    private CameraManageService cameraManageService;
+
+
+
+    /**
+     * 新增一条数据
+     *
+     * @param cameraManage 实体类
+     * @return Response对象
+     */
+    @RequestMapping(value = "insert", method = RequestMethod.POST)
+    @ApiOperation(value = "增加摄像头")
+    public AjaxMessage<Integer> insert(@ApiParam(value = "设置配置", required = true) @RequestBody CameraManage cameraManage) {
+        int result = cameraManageService.insert(cameraManage);
+        if(result==1){
+            return new AjaxMessage<>(ResultStatus.OK, result);
+        }else{
+            return new AjaxMessage<>(ResultStatus.ORG_INFO_ERROR, result);
+        }
+
+    }
+
+    /**
+     * 修改一条数据
+     *
+     * @param cameraManage 实体类
+     * @return Response对象
+     */
+    @RequestMapping(value = "update", method = RequestMethod.POST)
+    @ApiOperation(value = "修改摄像头")
+    public AjaxMessage<Integer> update(@ApiParam(value = "设置配置", required = true) @RequestBody CameraManage cameraManage) {
+        int result = cameraManageService.update(cameraManage);
+        if(result==1){
+            return new AjaxMessage<>(ResultStatus.OK, result);
+        }else{
+            return new AjaxMessage<>(ResultStatus.ORG_INFO_ERROR, result);
+        }
+
+    }
+
+    /**
+     * 删除一条数据
+     *
+     * @param ids 参数对象
+     * @return Response对象
+     */
+    @RequestMapping(value = "deleteAll", method = RequestMethod.POST)
+    @ApiOperation(value = "查询设施配置列表")
+    public AjaxMessage<Integer> deleteAll(@ApiParam(value = "删除的ids", required = true) @RequestBody List<Integer>ids) {
+        int result = cameraManageService.deleteAll(ids);
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+
+
+    /**
+     * 分页查询
+     *
+     * @param pageNum  偏移
+     * @param pageSize 条数
+     * @return Response对象
+     */
+    @RequestMapping(value = "selectPage", method = RequestMethod.POST)
+    @ApiOperation(value = "查询摄像头列表")
+    public AjaxMessage<Pagination<CameraManage>> selectPage(Integer pageNum, Integer pageSize,Integer companyId,
+                                                            Integer departMentId,Integer sceneId,String name) {
+        CameraManage cameraManage = new CameraManage();
+        cameraManage.setCompanyOrgId(companyId);
+        cameraManage.setDeptOrgId(departMentId);
+        cameraManage.setSceneId(sceneId);
+        cameraManage.setName(name);
+        IPage<CameraManage> iPage = new Page<>(pageNum, pageSize);
+        iPage = cameraManageService.selectPage(cameraManage, iPage);
+        Pagination<CameraManage> pages = new Pagination<>(iPage);
+        return new AjaxMessage<>(ResultStatus.OK, pages);
+    }
+    /**
+     * 查询场景树下的摄像头
+     *
+     * @param sceneId  场景id
+     * @param
+     * @return Response对象
+     */
+    @RequestMapping(value = "selectBySceneId", method = RequestMethod.POST)
+    @ApiOperation(value = "查询摄像头列表")
+    public AjaxMessage<List<CameraManage>> selectBySceneId(Integer sceneId) {
+        CameraManage cameraManage = new CameraManage();
+         cameraManage.setSceneId(sceneId);
+        List<CameraManage> cameraManages = cameraManageService.selectList(cameraManage);
+        return new AjaxMessage<>(ResultStatus.OK, cameraManages);
+    }
+    /**
+     * 获取单个摄像头信息
+     *
+     * @param id  主键id
+     * @param
+     * @return Response对象
+     */
+    @RequestMapping(value = "get", method = RequestMethod.POST)
+    @ApiOperation(value = "查询摄像头列表")
+    public AjaxMessage<CameraManage> selectById(Integer id) {
+        CameraManage cameraManage =cameraManageService.selectById(id);
+        return new AjaxMessage<>(ResultStatus.OK, cameraManage);
+    }
+
+}

+ 85 - 0
sms_water/src/main/java/com/huaxu/dao/CameraManageMapper.java

@@ -0,0 +1,85 @@
+package com.huaxu.dao;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.huaxu.entity.CameraManage;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * (CameraManage)表数据库访问层
+ *
+ * @author makejava
+ * @since 2020-11-26 10:25:13
+ */
+@Mapper
+public interface CameraManageMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    CameraManage selectById(Integer id);
+
+
+    /**
+     * 查询全部
+     *
+     * @return 对象列表
+     */
+    List<CameraManage> selectAll();
+
+    /**
+     * 通过实体作为筛选条件查询
+     *
+     * @param cameraManage 实例对象
+     * @return 对象列表
+     */
+    List<CameraManage> selectList(CameraManage cameraManage);
+
+    /**
+     * 新增数据
+     *
+     * @param cameraManage 实例对象
+     * @return 影响行数
+     */
+    int insert(CameraManage cameraManage);
+
+    /**
+     * 批量新增
+     *
+     * @param cameraManages 实例对象的集合
+     * @return 影响行数
+     */
+    int batchInsert(@Param("cameraManages") List<CameraManage> cameraManages);
+
+    /**
+     * 修改数据
+     *
+     * @param cameraManage 实例对象
+     * @return 影响行数
+     */
+    int update(CameraManage cameraManage);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+    /**
+     * 查询总数据数
+     *
+     * @return 数据总数
+     */
+    int count();
+
+    IPage<CameraManage> selectPage(IPage<CameraManage> page, CameraManage cameraManage);
+
+    int deleteAll(List<Integer> ids);
+}

+ 148 - 0
sms_water/src/main/java/com/huaxu/entity/CameraManage.java

@@ -0,0 +1,148 @@
+package com.huaxu.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.huaxu.model.ProgramItem;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * (CameraManage)实体类
+ *
+ * @author makejava
+ * @since 2020-11-27 11:25:49
+ */
+@Data
+@ApiModel
+public class CameraManage implements Serializable {
+    private static final long serialVersionUID = 203195405503200754L;
+    /**
+     * 主键
+     */
+    @ApiModelProperty(value = "主键")
+    private Integer id;
+    /**
+     * 租户标识
+     */
+    @ApiModelProperty(value = "租户标识")
+    private String tenantId;
+    /**
+     * 公司id
+     */
+    @ApiModelProperty(value = "公司id")
+    private Integer companyOrgId;
+    /**
+     * 部门id
+     */
+    @ApiModelProperty(value = "部门id")
+    private Integer deptOrgId;
+    /**
+     * 场景id
+     */
+    @ApiModelProperty(value = "场景id")
+    private Integer sceneId;
+    /**
+     * 地址
+     */
+    @ApiModelProperty(value = "地址")
+    private String address;
+    /**
+     * 经纬度
+     */
+    @ApiModelProperty(value = "经纬度")
+    private String geo;
+    /**
+     * 预览url
+     */
+    @ApiModelProperty(value = "预览url")
+    private String palyUrl;
+    /**
+     * 回放url
+     */
+    @ApiModelProperty(value = "回放url")
+    private String replayUrl;
+    /**
+     * 萤石授权key
+     */
+    @ApiModelProperty(value = "萤石授权key")
+    private String appkey;
+    /**
+     * 密钥
+     */
+    @ApiModelProperty(value = "密钥")
+    private String scrert;
+    /**
+     * 创建人
+     */
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**
+     * 更新时间
+     */
+    @ApiModelProperty(value = "更新时间")
+    private Date dateUpdate;
+    /**
+     * 更新人
+     */
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date dateCreate;
+    /**
+     * 名称
+     */
+    @ApiModelProperty(value = "名称")
+    private String name;
+    /**
+     * 设备序列号,存在英文字母的设备序列号,字母需为大写
+     */
+    @ApiModelProperty(value = "设备序列号,存在英文字母的设备序列号,字母需为大写")
+    private String deviceSerial;
+    /**
+     * 通道号
+     */
+    @ApiModelProperty(value = "通道号")
+    private Integer channelNo;
+    /**
+     * 删除标识
+     */
+    @ApiModelProperty(value = "删除标识")
+    private Integer status;
+    /**
+     * 授权码
+     */
+    @ApiModelProperty(value = "授权码")
+    @TableField(exist = false)
+    private String token;
+    /**
+     * 部门名称
+     */
+    @ApiModelProperty(value = "部门名称")
+    @TableField(exist = false)
+    private String departName;
+    /**
+     * 公司名称
+     */
+    @ApiModelProperty(value = "公司名称")
+    @TableField(exist = false)
+    private String companyName;
+    /**
+     * 场景名称
+     */
+    @ApiModelProperty(value = "场景名称")
+    @TableField(exist = false)
+    private String sceneName;
+    /**
+     * 场景名称
+     */
+    @ApiModelProperty(value = "机构权限集合")
+    @TableField(exist = false)
+    private List<ProgramItem> items;
+}

+ 82 - 0
sms_water/src/main/java/com/huaxu/service/CameraManageService.java

@@ -0,0 +1,82 @@
+package com.huaxu.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.huaxu.entity.CameraManage;
+
+import java.util.List;
+
+/**
+ * (CameraManage)表服务接口
+ *
+ * @author makejava
+ * @since 2020-11-26 10:25:13
+ */
+public interface CameraManageService {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    CameraManage selectById(Integer id);
+
+
+    /**
+     * 查询全部
+     *
+     * @return 对象列表
+     */
+    List<CameraManage> selectAll();
+
+    /**
+     * 通过实体作为筛选条件查询
+     *
+     * @param cameraManage 实例对象
+     * @return 对象列表
+     */
+    List<CameraManage> selectList(CameraManage cameraManage);
+
+    /**
+     * 新增数据
+     *
+     * @param cameraManage 实例对象
+     * @return 影响行数
+     */
+    int insert(CameraManage cameraManage);
+
+    /**
+     * 批量新增
+     *
+     * @param cameraManages 实例对象的集合
+     * @return 影响行数
+     */
+    int batchInsert(List<CameraManage> cameraManages);
+
+    /**
+     * 修改数据
+     *
+     * @param cameraManage 实例对象
+     * @return 修改
+     */
+    int update(CameraManage cameraManage);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+    /**
+     * 查询总数据数
+     *
+     * @return 数据总数
+     */
+    int count();
+
+    IPage<CameraManage> selectPage(CameraManage cameraManage, IPage<CameraManage> page);
+
+    int deleteAll(List<Integer> ids);
+}

+ 240 - 0
sms_water/src/main/java/com/huaxu/service/impl/CameraManageServiceImpl.java

@@ -0,0 +1,240 @@
+package com.huaxu.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.huaxu.dao.CameraManageMapper;
+import com.huaxu.entity.CameraManage;
+import com.huaxu.model.LoginUser;
+import com.huaxu.model.ProgramItem;
+import com.huaxu.service.CameraManageService;
+import com.huaxu.util.OrgInfoUtil;
+import com.huaxu.util.RedisUtil;
+import com.huaxu.util.UserUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.*;
+
+/**
+ * (CameraManage表)服务实现类
+ *
+ * @author makejava
+ * @since 2020-11-26 10:25:14
+ */
+@Service("cameraManageService")
+public class CameraManageServiceImpl implements CameraManageService {
+    @Autowired
+    private CameraManageMapper cameraManageMapper;
+    @Autowired
+    private RedisUtil redisUtil;
+    @Autowired
+    private RestTemplate restTemplate;
+    @Autowired
+    private OrgInfoUtil util;
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    @Override
+    public CameraManage selectById(Integer id) {
+        CameraManage cameraManage = this.cameraManageMapper.selectById(id);
+        cameraManage.setToken(getToken(cameraManage.getAppkey(),cameraManage.getScrert()));
+        return cameraManage;
+    }
+
+
+    /**
+     * 查询所有
+     *
+     * @return 实例对象的集合
+     */
+    @Override
+    public List<CameraManage> selectAll() {
+        return this.cameraManageMapper.selectAll();
+    }
+
+    /**
+     * 根据条件查询
+     *
+     * @return 实例对象的集合
+     */
+    @Override
+    public List<CameraManage> selectList(CameraManage cameraManage) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        cameraManage.setTenantId(currentUser.getTenantId());
+        cameraManage.setItems(currentUser.getProgramItemList());
+        return this.cameraManageMapper.selectList(cameraManage);
+    }
+
+
+    /**
+     * 新增数据
+     *
+     * @param cameraManage 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public int insert(CameraManage cameraManage) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        cameraManage.setTenantId(currentUser.getTenantId());
+        if(!isOrgCorrect(cameraManage.getCompanyOrgId(),cameraManage.getDeptOrgId(),
+                currentUser.getProgramItemList())){
+            return 2;
+        }
+        cameraManage.setDateCreate(new Date());
+        cameraManage.setCreateBy(currentUser.getUsername());
+        this.cameraManageMapper.insert(cameraManage);
+
+        updateCameraName(cameraManage);
+
+        return 1;
+    }
+    private boolean isOrgCorrect(Integer companyId, Integer departmentId, List<ProgramItem>items){
+        boolean result=false;
+        Set<Integer>companyIds=new HashSet<>();
+        Set<Integer>departmentIds=new HashSet<>();
+        items.forEach(item->{
+            companyIds.add(item.getOrgCompanyId());
+            departmentIds.add(item.getOrgDeparmtmentId());
+        });
+        if(companyIds.contains(companyId)&&departmentIds.contains(departmentIds)){
+            result=true;
+        }
+
+        return result;
+    }
+    private void updateCameraName(CameraManage cameraManage){
+        String token = getToken(cameraManage.getAppkey(), cameraManage.getScrert());
+        HttpHeaders headers = new HttpHeaders();
+
+        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+
+        MultiValueMap<String, Object> params= new LinkedMultiValueMap<>();
+        params.add("accessToken",token);
+        params.add("deviceSerial",cameraManage.getDeviceSerial());
+        params.add("name",cameraManage.getName());
+        if(cameraManage.getChannelNo()==null){
+            cameraManage.setChannelNo(1);
+        }
+        params.add("channelNo",cameraManage.getChannelNo());
+        HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers);
+        String url="https://open.ys7.com/api/lapp/camera/name/update";
+        //String result = restTemplate.postForObject(url, "accessToken=at.d01poowjc4bwrwpyc3czs53nbc8m7v0a-39jm695wjp-14xe4rj-xbsmxw8en&deviceSerial=E40848837&deviceName=888&name=888&channelNo=1", String.class);
+        ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity(url, requestEntity, String.class);
+        String result=stringResponseEntity.getBody();
+
+
+    }
+    private String getToken (String appKey,String secret){
+        String token = redisUtil.get(appKey);
+        if(token==null){
+            HttpHeaders headers = new HttpHeaders();
+//  请勿轻易改变此提交方式,大部分的情况下,提交方式都是表单提交
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+//  封装参数,千万不要替换为Map与HashMap,否则参数无法传递
+            MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
+//  也支持中文
+            params.add("appKey",appKey);
+            params.add("appSecret",secret);
+            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
+//  执行HTTP请求
+            ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity("https://open.ys7.com/api/lapp/token/get", requestEntity, String.class);
+            JSONObject info = JSONObject.parseObject(stringResponseEntity.getBody());
+            JSONObject data = info.getJSONObject("data");
+            token=data.getString("accessToken");
+            long expireTime=data.getLong("expireTime");
+            redisUtil.set(appKey,token);
+            redisUtil.setExpire(appKey,expireTime-1000);
+        }
+
+        return token;
+    }
+
+    /**
+     * 批量新增
+     *
+     * @param cameraManages 实例对象的集合
+     * @return 生效的条数
+     */
+    @Override
+    public int batchInsert(List<CameraManage> cameraManages) {
+        return this.cameraManageMapper.batchInsert(cameraManages);
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param cameraManage 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public int update(CameraManage cameraManage) {
+
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        if(!isOrgCorrect(cameraManage.getCompanyOrgId(),cameraManage.getDeptOrgId(),
+                currentUser.getProgramItemList())){
+            return 2;
+        }
+        cameraManage.setDateUpdate(new Date());
+        cameraManage.setUpdateBy(currentUser.getUsername());
+        this.cameraManageMapper.update(cameraManage);
+        updateCameraName(cameraManage);
+        return 1;
+    }
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    @Override
+    public int deleteById(Integer id) {
+        return this.cameraManageMapper.deleteById(id);
+    }
+
+    /**
+     * 查询总数据数
+     *
+     * @return 数据总数
+     */
+    @Override
+    public int count() {
+        return this.cameraManageMapper.count();
+    }
+
+    /**
+     * 分页查询
+     *
+     * @return 对象列表
+     */
+    @Override
+    public IPage<CameraManage> selectPage(CameraManage cameraManage, IPage<CameraManage> page) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        cameraManage.setTenantId(currentUser.getTenantId());
+        cameraManage.setItems(currentUser.getProgramItemList());
+        Map<String, String> allOrgName = util.getAllOrgName();
+        IPage<CameraManage> cameraManageIPage = this.cameraManageMapper.selectPage(page, cameraManage);
+        cameraManageIPage.getRecords().forEach(record->{
+            record.setDepartName(allOrgName.get(String.valueOf(record.getDeptOrgId())));
+            record.setCompanyName(allOrgName.get(String.valueOf(record.getCompanyOrgId())));
+        });
+        return cameraManageIPage;
+    }
+
+    @Override
+    public int deleteAll(List<Integer> ids) {
+        cameraManageMapper.deleteAll(ids);
+        return 0;
+    }
+}

+ 324 - 0
sms_water/src/main/resources/mapper/CameraManageMapper.xml

@@ -0,0 +1,324 @@
+<?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.huaxu.dao.CameraManageMapper">
+    <!-- 结果集 -->
+    <resultMap type="com.huaxu.entity.CameraManage" id="CameraManageMap">
+        <result property="id" column="ID" jdbcType="INTEGER"/>
+        <result property="tenantId" column="TENANT_ID" jdbcType="VARCHAR"/>
+        <result property="companyOrgId" column="COMPANY_ORG_ID" jdbcType="INTEGER"/>
+        <result property="deptOrgId" column="DEPT_ORG_ID" jdbcType="INTEGER"/>
+        <result property="sceneId" column="SCENE_ID" jdbcType="INTEGER"/>
+        <result property="address" column="address" jdbcType="VARCHAR"/>
+        <result property="geo" column="geo" jdbcType="VARCHAR"/>
+        <result property="palyUrl" column="PALY_URL" jdbcType="VARCHAR"/>
+        <result property="replayUrl" column="REPLAY_URL" jdbcType="VARCHAR"/>
+        <result property="appkey" column="APPKEY" jdbcType="VARCHAR"/>
+        <result property="scrert" column="SCRERT" jdbcType="VARCHAR"/>
+        <result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
+        <result property="dateUpdate" column="DATE_UPDATE" jdbcType="TIMESTAMP"/>
+        <result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
+        <result property="dateCreate" column="DATE_CREATE" jdbcType="TIMESTAMP"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="deviceSerial" column="device_serial" jdbcType="VARCHAR"/>
+        <result property="channelNo" column="channel_no" jdbcType="INTEGER"/>
+        <result property="status" column="status" jdbcType="INTEGER"/>
+        <result property="sceneName" column="SCENE_NAME" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!-- 基本字段 -->
+    <sql id="Base_Column_List">
+        a.ID, a.TENANT_ID, a.COMPANY_ORG_ID, a.DEPT_ORG_ID, SCENE_ID, a.address, geo, PALY_URL, REPLAY_URL, APPKEY, SCRERT, a.CREATE_BY, a.DATE_UPDATE, a.UPDATE_BY, a.DATE_CREATE, a.name, device_serial, channel_no    </sql>
+
+    <!-- 查询单个 -->
+    <select id="selectById" resultMap="CameraManageMap">
+        select
+        <include refid="Base_Column_List"/>
+        from sms_camera_manage a
+        where ID = #{id}
+    </select>
+
+
+    <!-- 查询全部 -->
+    <select id="selectAll" resultMap="CameraManageMap">
+        select
+        <include refid="Base_Column_List"/>
+        from sms_camera_manage
+    </select>
+
+    <!--通过实体作为筛选条件查询-->
+    <select id="selectList" resultMap="CameraManageMap">
+        select
+        <include refid="Base_Column_List"/>
+        from sms_camera_manage a
+        <where>
+            a.status=1
+            <if test="items != null">
+                and (a.COMPANY_ORG_ID in
+                <foreach item="item" index="index" collection="items" open="(" separator="," close=")">
+                    <if test="item.orgCompanyId!= null">
+
+                        #{item.orgCompanyId}
+                    </if>
+
+                </foreach>
+                or a.DEPT_ORG_ID in
+                <foreach item="item" index="index" collection="items" open="(" separator="," close=")">
+                    <if test="item.orgDeparmtmentId!= null">
+
+                        #{item.orgDeparmtmentId}
+                    </if>
+
+                </foreach>
+                )
+            </if>
+            <if test="id != null">
+                and ID = #{id}
+            </if>
+            <if test="tenantId != null and tenantId != ''">
+                and TENANT_ID = #{tenantId}
+            </if>
+            <if test="companyOrgId != null">
+                and COMPANY_ORG_ID = #{companyOrgId}
+            </if>
+            <if test="deptOrgId != null">
+                and DEPT_ORG_ID = #{deptOrgId}
+            </if>
+            <if test="sceneId != null">
+                and SCENE_ID = #{sceneId}
+            </if>
+            <if test="address != null and address != ''">
+                and address = #{address}
+            </if>
+            <if test="geo != null and geo != ''">
+                and geo = #{geo}
+            </if>
+            <if test="palyUrl != null and palyUrl != ''">
+                and PALY_URL = #{palyUrl}
+            </if>
+            <if test="replayUrl != null and replayUrl != ''">
+                and REPLAY_URL = #{replayUrl}
+            </if>
+            <if test="appkey != null and appkey != ''">
+                and APPKEY = #{appkey}
+            </if>
+            <if test="scrert != null and scrert != ''">
+                and SCRERT = #{scrert}
+            </if>
+            <if test="createBy != null and createBy != ''">
+                and CREATE_BY = #{createBy}
+            </if>
+            <if test="dateUpdate != null">
+                and DATE_UPDATE = #{dateUpdate}
+            </if>
+            <if test="updateBy != null and updateBy != ''">
+                and UPDATE_BY = #{updateBy}
+            </if>
+            <if test="dateCreate != null">
+                and DATE_CREATE = #{dateCreate}
+            </if>
+            <if test="name != null and name != ''">
+                and name = #{name}
+            </if>
+            <if test="deviceSerial != null and deviceSerial != ''">
+                and device_serial = #{deviceSerial}
+            </if>
+            <if test="channelNo != null">
+                and channel_no = #{channelNo}
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+        </where>
+    </select>
+
+    <!-- 新增所有列 -->
+    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
+        insert into sms_camera_manage(ID, TENANT_ID, COMPANY_ORG_ID, DEPT_ORG_ID, SCENE_ID, address, geo, PALY_URL,
+                                      REPLAY_URL, APPKEY, SCRERT, CREATE_BY, DATE_UPDATE, UPDATE_BY, DATE_CREATE, name,
+                                      device_serial, channel_no, status)
+        values (#{id}, #{tenantId}, #{companyOrgId}, #{deptOrgId}, #{sceneId}, #{address}, #{geo}, #{palyUrl},
+                #{replayUrl}, #{appkey}, #{scrert}, #{createBy}, #{dateUpdate}, #{updateBy}, #{dateCreate}, #{name},
+                #{deviceSerial}, #{channelNo}, #{status})
+    </insert>
+
+    <!-- 批量新增 -->
+    <insert id="batchInsert">
+        insert into sms_camera_manage(ID, TENANT_ID, COMPANY_ORG_ID, DEPT_ORG_ID, SCENE_ID, address, geo, PALY_URL,
+        REPLAY_URL, APPKEY, SCRERT, CREATE_BY, DATE_UPDATE, UPDATE_BY, DATE_CREATE, name, device_serial, channel_no,
+        status)
+        values
+        <foreach collection="cameraManages" item="item" index="index" separator=",">
+            (
+            #{item.id}, #{item.tenantId}, #{item.companyOrgId}, #{item.deptOrgId}, #{item.sceneId}, #{item.address},
+            #{item.geo}, #{item.palyUrl}, #{item.replayUrl}, #{item.appkey}, #{item.scrert}, #{item.createBy},
+            #{item.dateUpdate}, #{item.updateBy}, #{item.dateCreate}, #{item.name}, #{item.deviceSerial},
+            #{item.channelNo}, #{item.status} )
+        </foreach>
+    </insert>
+
+    <!-- 通过主键修改数据 -->
+    <update id="update">
+        update sms.sms_camera_manage
+        <set>
+            <if test="tenantId != null and tenantId != ''">
+                TENANT_ID = #{tenantId},
+            </if>
+            <if test="companyOrgId != null">
+                COMPANY_ORG_ID = #{companyOrgId},
+            </if>
+            <if test="deptOrgId != null">
+                DEPT_ORG_ID = #{deptOrgId},
+            </if>
+            <if test="sceneId != null">
+                SCENE_ID = #{sceneId},
+            </if>
+            <if test="address != null and address != ''">
+                address = #{address},
+            </if>
+            <if test="geo != null and geo != ''">
+                geo = #{geo},
+            </if>
+            <if test="palyUrl != null and palyUrl != ''">
+                PALY_URL = #{palyUrl},
+            </if>
+            <if test="replayUrl != null and replayUrl != ''">
+                REPLAY_URL = #{replayUrl},
+            </if>
+            <if test="appkey != null and appkey != ''">
+                APPKEY = #{appkey},
+            </if>
+            <if test="scrert != null and scrert != ''">
+                SCRERT = #{scrert},
+            </if>
+            <if test="createBy != null and createBy != ''">
+                CREATE_BY = #{createBy},
+            </if>
+            <if test="dateUpdate != null">
+                DATE_UPDATE = #{dateUpdate},
+            </if>
+            <if test="updateBy != null and updateBy != ''">
+                UPDATE_BY = #{updateBy},
+            </if>
+            <if test="dateCreate != null">
+                DATE_CREATE = #{dateCreate},
+            </if>
+            <if test="name != null and name != ''">
+                name = #{name},
+            </if>
+            <if test="deviceSerial != null and deviceSerial != ''">
+                device_serial = #{deviceSerial},
+            </if>
+            <if test="channelNo != null">
+                channel_no = #{channelNo},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+        </set>
+        where ID = #{id}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete
+        from sms_camera_manage
+        where ID = #{id}
+    </delete>
+
+    <!-- 总数 -->
+    <select id="count" resultType="int">
+        select count(*)
+        from sms_camera_manage
+    </select>
+    <select id="selectPage" resultMap="CameraManageMap">
+        select
+        <include refid="Base_Column_List"/> ,b.SCENE_NAME
+        from sms_camera_manage a join sms_scene b on a.SCENE_ID=b.ID
+        <where>
+            a.status=1
+            <if test="cameraManage.items != null">
+                and (a.COMPANY_ORG_ID in
+                <foreach item="item" index="index" collection="cameraManage.items" open="(" separator="," close=")">
+                    <if test="item.orgCompanyId!= null">
+
+                        #{item.orgCompanyId}
+                    </if>
+
+                </foreach>
+                or a.DEPT_ORG_ID in
+                <foreach item="item" index="index" collection="cameraManage.items" open="(" separator="," close=")">
+                    <if test="item.orgDeparmtmentId!= null">
+
+                        #{item.orgDeparmtmentId}
+                    </if>
+
+                </foreach>
+                )
+            </if>
+            <if test="cameraManage.id != null">
+                and ID = #{cameraManage.id}
+            </if>
+            <if test="cameraManage.tenantId != null and cameraManage.tenantId != ''">
+                and a.TENANT_ID = #{cameraManage.tenantId}
+            </if>
+            <if test="cameraManage.companyOrgId != null">
+                and a.COMPANY_ORG_ID = #{cameraManage.companyOrgId}
+            </if>
+            <if test="cameraManage.deptOrgId != null">
+                and a.DEPT_ORG_ID = #{cameraManage.deptOrgId}
+            </if>
+            <if test="cameraManage.sceneId != null">
+                and SCENE_ID = #{cameraManage.sceneId}
+            </if>
+            <if test="cameraManage.address != null and cameraManage.address != ''">
+                and a.address = #{cameraManage.address}
+            </if>
+            <if test="cameraManage.geo != null and cameraManage.geo != ''">
+                and geo = #{cameraManage.geo}
+            </if>
+            <if test="cameraManage.palyUrl != null and cameraManage.palyUrl != ''">
+                and PALY_URL = #{cameraManage.palyUrl}
+            </if>
+            <if test="cameraManage.replayUrl != null and cameraManage.replayUrl != ''">
+                and REPLAY_URL = #{cameraManage.replayUrl}
+            </if>
+            <if test="cameraManage.appkey != null and cameraManage.appkey != ''">
+                and APPKEY = #{cameraManage.appkey}
+            </if>
+            <if test="cameraManage.scrert != null and cameraManage.scrert != ''">
+                and SCRERT = #{cameraManage.scrert}
+            </if>
+            <if test="cameraManage.createBy != null and cameraManage.createBy != ''">
+                and a.CREATE_BY = #{cameraManage.createBy}
+            </if>
+            <if test="cameraManage.dateUpdate != null">
+                and DATE_UPDATE = #{cameraManage.dateUpdate}
+            </if>
+            <if test="cameraManage.updateBy != null and cameraManage.updateBy != ''">
+                and UPDATE_BY = #{cameraManage.updateBy}
+            </if>
+            <if test="cameraManage.dateCreate != null">
+                and DATE_CREATE = #{cameraManage.dateCreate}
+            </if>
+            <if test="cameraManage.name != null and cameraManage.name != ''">
+                and name LIKE concat('%',#{cameraManage.name},'%')
+            </if>
+            <if test="cameraManage.deviceSerial != null and cameraManage.deviceSerial != ''">
+                and device_serial = #{cameraManage.deviceSerial}
+            </if>
+            <if test="cameraManage.channelNo != null">
+                and channel_no = #{cameraManage.channelNo}
+            </if>
+            <if test="cameraManage.status != null">
+                and status = #{cameraManage.status}
+            </if>
+        </where>
+    </select>
+    <update id="deleteAll">
+        update sms_camera_manage set STATUS=0 where STATUS=1 and ID in
+        <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </update>
+
+</mapper>