Ver Fonte

设备管理功能

luowei há 2 anos atrás
pai
commit
234c3cfcec

+ 105 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysDeviceController.java

@@ -0,0 +1,105 @@
+package com.xunmei.system.controller;
+
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+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.xunmei.common.log.annotation.Log;
+import com.xunmei.common.log.enums.BusinessType;
+import com.xunmei.common.security.annotation.RequiresPermissions;
+import com.xunmei.system.domain.SysDevice;
+import com.xunmei.system.service.ISysDeviceService;
+import com.xunmei.common.core.web.controller.BaseController;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.web.page.TableDataInfo;
+
+/**
+ * 【请填写功能名称】Controller
+ *
+ * @author xunmei
+ * @date 2023-08-22
+ */
+@Api(tags = {"SysDevice"})
+@RestController
+@RequestMapping("/device")
+public class SysDeviceController extends BaseController {
+    @Autowired
+    private ISysDeviceService sysDeviceService;
+
+    /**
+     * 查询【请填写功能名称】列表
+     */
+    @ApiOperation(value = "查询SysDevice列表")
+    @RequiresPermissions("system:device:list")
+    @GetMapping("/list")
+    public TableDataInfo list(SysDevice sysDevice) {
+
+        return sysDeviceService.selectPage(sysDevice);
+    }
+
+
+    /**
+     * 获取【请填写功能名称】详细信息
+     */
+    @ApiOperation(value = "获取SysDevice详细信息")
+    @RequiresPermissions("system:device:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(sysDeviceService.selectSysDeviceById(id));
+    }
+
+    /**
+     * 通过机构id获取主机列表
+     */
+    @ApiOperation(value = "通过机构id获取主机列表")
+    @RequiresPermissions("system:device:query")
+    @GetMapping(value = "/getHostByOrgId/{orgId}")
+    public AjaxResult getHostByOrgId(@PathVariable(value = "orgId", required = false) Long orgId) {
+        return success(sysDeviceService.getHostByOrgId(orgId));
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     */
+    @ApiOperation(value = "新增SysDevice")
+    @RequiresPermissions("system:device:add")
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysDevice sysDevice) {
+        return toAjax(sysDeviceService.insertSysDevice(sysDevice));
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     */
+    @ApiOperation(value = "修改SysDevice")
+    @RequiresPermissions("system:device:edit")
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysDevice sysDevice) {
+        return toAjax(sysDeviceService.updateSysDevice(sysDevice));
+    }
+
+    /**
+     * 删除【请填写功能名称】
+     */
+    @ApiOperation(value = "删除SysDevice")
+    @RequiresPermissions("system:device:remove")
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(sysDeviceService.deleteSysDeviceByIds(ids));
+    }
+}

+ 162 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/domain/SysDevice.java

@@ -0,0 +1,162 @@
+package com.xunmei.system.domain;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.xunmei.common.core.web.domain.BaseEntity;
+
+/**
+ * 【请填写功能名称】对象 sys_device
+ *
+ * @author xunmei
+ * @date 2023-08-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sys_device")
+@ApiModel(value = "SysDevice对象", description = "【请填写功能名称】")
+public class SysDevice extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 设备id
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long id;
+
+    /**
+     * 机构id
+     */
+    @ApiModelProperty(value = "机构id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long orgId;
+
+    /**
+     * 机构名字
+     */
+    @ApiModelProperty(value = "机构名字")
+    private String orgName;
+
+    /**
+     * 设备名称
+     */
+    @ApiModelProperty(value = "设备名称")
+    private String deviceName;
+
+    /**
+     * 资产类别
+     */
+    @ApiModelProperty(value = "资产类别")
+    private String assetType;
+
+    /**
+     * 设备分类
+     */
+    @ApiModelProperty(value = "设备分类")
+    private String deviceType;
+
+    /**
+     * 设备品牌
+     */
+    @ApiModelProperty(value = "设备品牌")
+    private String deviceBrand;
+
+    /**
+     * 验收日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "验收日期")
+    private Date checkTime;
+
+    /**
+     * 保修期限默认年
+     */
+    @ApiModelProperty(value = "保修期限默认年")
+    private String maintenanceTerm;
+
+    /**
+     * 0存在2删除
+     */
+    private String delFlag;
+
+    /**
+     * 主机id
+     */
+    @ApiModelProperty(value = "主机id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long hostId;
+
+    /**
+     * 通道号
+     */
+    @ApiModelProperty(value = "通道号")
+    private Long channel;
+
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+
+
+                .append("id", getId())
+
+
+                .append("orgId", getOrgId())
+
+
+                .append("orgName", getOrgName())
+
+
+                .append("deviceName", getDeviceName())
+
+
+                .append("assetType", getAssetType())
+
+
+                .append("deviceType", getDeviceType())
+
+
+                .append("deviceBrand", getDeviceBrand())
+
+
+                .append("checkTime", getCheckTime())
+
+
+                .append("maintenanceTerm", getMaintenanceTerm())
+
+
+                .append("createTime", getCreateTime())
+
+
+                .append("updateTime", getUpdateTime())
+
+
+                .append("createBy", getCreateBy())
+
+
+                .append("updateBy", getUpdateBy())
+
+
+                .append("delFlag", getDelFlag())
+
+
+                .append("hostId", getHostId())
+
+
+                .append("channel", getChannel())
+                .toString();
+    }
+}

+ 71 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysDeviceMapper.java

@@ -0,0 +1,71 @@
+package com.xunmei.system.mapper;
+
+import java.util.List;
+
+import com.xunmei.system.domain.SysDevice;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ *
+ * @author xunmei
+ * @date 2023-08-22
+ */
+@Mapper
+public interface SysDeviceMapper extends BaseMapper<SysDevice> {
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public SysDevice selectSysDeviceById(Long id);
+
+    /**
+     * 根据机构查出所有的视频主机
+     * @param orgId
+     * @return
+     */
+    public List<SysDevice> getHostByOrgId(Long orgId);
+
+    /**
+     * 查询【请填写功能名称】列表
+     *
+     * @param sysDevice 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<SysDevice> selectSysDeviceList(SysDevice sysDevice);
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param sysDevice 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertSysDevice(SysDevice sysDevice);
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param sysDevice 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateSysDevice(SysDevice sysDevice);
+
+    /**
+     * 删除【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteSysDeviceById(Long id);
+
+    /**
+     * 批量删除【请填写功能名称】
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteSysDeviceByIds(Long[] ids);
+}

+ 74 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysDeviceService.java

@@ -0,0 +1,74 @@
+package com.xunmei.system.service;
+
+import java.util.List;
+
+import com.xunmei.system.domain.SysDevice;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.web.page.TableDataInfo;
+
+/**
+ * 【请填写功能名称】Service接口
+ *
+ * @author xunmei
+ * @date 2023-08-22
+ */
+public interface ISysDeviceService extends IService<SysDevice> {
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public SysDevice selectSysDeviceById(Long id);
+
+    public List<SysDevice> getHostByOrgId(Long orgId);
+
+    /**
+     * 查询【请填写功能名称】列表
+     *
+     * @param sysDevice 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<SysDevice> selectSysDeviceList(SysDevice sysDevice);
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param sysDevice 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertSysDevice(SysDevice sysDevice);
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param sysDevice 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateSysDevice(SysDevice sysDevice);
+
+    /**
+     * 批量删除【请填写功能名称】
+     *
+     * @param ids 需要删除的【请填写功能名称】主键集合
+     * @return 结果
+     */
+    public int deleteSysDeviceByIds(Long[] ids);
+
+    /**
+     * 删除【请填写功能名称】信息
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteSysDeviceById(Long id);
+
+    /**
+     * 查询【请填写功能名称】分页数据
+     *
+     * @param sysDevice 查询条件对象
+     * @return Page
+     */
+    public TableDataInfo selectPage(SysDevice sysDevice);
+}

+ 152 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDeviceServiceImpl.java

@@ -0,0 +1,152 @@
+package com.xunmei.system.service.impl;
+
+import java.util.List;
+
+import com.xunmei.common.core.utils.DateUtils;
+import com.xunmei.common.security.utils.SecurityUtils;
+import com.xunmei.system.api.domain.SysOrg;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.xunmei.system.service.ISysOrgService;
+
+import java.util.Arrays;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.system.mapper.SysDeviceMapper;
+import com.xunmei.system.domain.SysDevice;
+import com.xunmei.system.service.ISysDeviceService;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ *
+ * @author xunmei
+ * @date 2023-08-22
+ */
+@Service
+public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice> implements ISysDeviceService {
+    @Autowired
+    private SysDeviceMapper sysDeviceMapper;
+    @Autowired
+    private ISysOrgService orgService;
+
+    @Override
+    public TableDataInfo selectPage(SysDevice sysDevice) {
+        //未删除
+        sysDevice.setDelFlag("0");
+        Page<SysDevice> page;
+        //分页
+        if (sysDevice.getPageNum() != null && sysDevice.getPageSize() != null) {
+            page = new Page<>(sysDevice.getPageNum(), sysDevice.getPageSize());
+        } else {
+            page = new Page<>();
+        }
+        //查询条件
+        QueryWrapper<SysDevice> query = new QueryWrapper<>(sysDevice);
+        //下穿
+        if (sysDevice.getCheckSub()) {
+            List<Long> ids = orgService.selectCheckSubOrgIdList(sysDevice.getOrgId());
+            //清空前端传递的org_id
+            sysDevice.setOrgId(null);
+            //添加in条件
+            query.in("org_id", ids);
+        }
+        //时间范围查询
+        if (sysDevice.getParams().get("beginTime") != null && sysDevice.getParams().get("endTime") != null) {
+            query.between("create_time", sysDevice.getParams().get("beginTime"), sysDevice.getParams().get("endTime"));
+        }
+        //获取数据
+        page = sysDeviceMapper.selectPage(page, query);
+        //抓换为TableDataInfo适配前端
+        TableDataInfo tableDataInfo = new TableDataInfo();
+        tableDataInfo.setMsg("操作成功");
+        tableDataInfo.setCode(200);
+        tableDataInfo.setTotal(page.getTotal());
+        tableDataInfo.setRows(page.getRecords());
+        return tableDataInfo;
+
+
+    }
+
+
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public SysDevice selectSysDeviceById(Long id) {
+        return sysDeviceMapper.selectById(id);
+    }
+
+    @Override
+    public List<SysDevice> getHostByOrgId(Long orgId) {
+        return sysDeviceMapper.getHostByOrgId(orgId);
+    }
+
+    /**
+     * 查询【请填写功能名称】列表
+     *
+     * @param sysDevice 【请填写功能名称】
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public List<SysDevice> selectSysDeviceList(SysDevice sysDevice) {
+        return sysDeviceMapper.selectList(new QueryWrapper<>(sysDevice));
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param sysDevice 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int insertSysDevice(SysDevice sysDevice) {
+        sysDevice.setCreateTime(DateUtils.getNowDate());
+        sysDevice.setCreateBy(SecurityUtils.getUsername());
+        SysOrg sysOrg = orgService.selectSysOrgById(sysDevice.getOrgId());
+        sysDevice.setOrgName(sysOrg.getName());
+        return sysDeviceMapper.insert(sysDevice);
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param sysDevice 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int updateSysDevice(SysDevice sysDevice) {
+        sysDevice.setUpdateTime(DateUtils.getNowDate());
+        sysDevice.setUpdateBy(SecurityUtils.getUsername());
+        SysOrg sysOrg = orgService.selectSysOrgById(sysDevice.getOrgId());
+        sysDevice.setOrgName(sysOrg.getName());
+        return sysDeviceMapper.updateById(sysDevice);
+    }
+
+    /**
+     * 批量删除【请填写功能名称】
+     *
+     * @param ids 需要删除的【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysDeviceByIds(Long[] ids) {
+        return sysDeviceMapper.deleteBatchIds(Arrays.asList((ids)));
+    }
+
+    /**
+     * 删除【请填写功能名称】信息
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysDeviceById(Long id) {
+        return sysDeviceMapper.deleteById(id);
+    }
+}

+ 230 - 0
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysDeviceMapper.xml

@@ -0,0 +1,230 @@
+<?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.xunmei.system.mapper.SysDeviceMapper">
+
+    <resultMap type="com.xunmei.system.domain.SysDevice" id="SysDeviceResult">
+        <result property="id" column="id"/>
+        <result property="orgId" column="org_id"/>
+        <result property="orgName" column="org_name"/>
+        <result property="deviceName" column="device_name"/>
+        <result property="assetType" column="asset_type"/>
+        <result property="deviceType" column="device_type"/>
+        <result property="deviceBrand" column="device_brand"/>
+        <result property="checkTime" column="check_time"/>
+        <result property="maintenanceTerm" column="maintenance_term"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="hostId" column="host_id"/>
+        <result property="channel" column="channel"/>
+    </resultMap>
+
+    <sql id="selectSysDeviceVo">
+        select id,
+               org_id,
+               org_name,
+               device_name,
+               asset_type,
+               device_type,
+               device_brand,
+               check_time,
+               maintenance_term,
+               create_time,
+               update_time,
+               create_by,
+               update_by,
+               del_flag,
+               host_id,
+               channel
+        from sys_device
+    </sql>
+
+    <select id="selectSysDeviceList" parameterType="com.xunmei.system.domain.SysDevice"
+            resultMap="SysDeviceResult">
+        <include refid="selectSysDeviceVo"/>
+        <where>
+            <if test="orgId != null ">
+                and org_id = #{orgId}
+            </if>
+            <if test="orgName != null  and orgName != ''">
+                and org_name like concat('%', #{orgName}, '%')
+            </if>
+            <if test="deviceName != null  and deviceName != ''">
+                and device_name like concat('%', #{deviceName}, '%')
+            </if>
+            <if test="assetType != null  and assetType != ''">
+                and asset_type = #{assetType}
+            </if>
+            <if test="deviceType != null  and deviceType != ''">
+                and device_type = #{deviceType}
+            </if>
+            <if test="deviceBrand != null  and deviceBrand != ''">
+                and device_brand = #{deviceBrand}
+            </if>
+            <if test="checkTime != null ">
+                and check_time = #{checkTime}
+            </if>
+            <if test="maintenanceTerm != null  and maintenanceTerm != ''">
+                and maintenance_term = #{maintenanceTerm}
+            </if>
+            <if test="hostId != null ">
+                and host_id = #{hostId}
+            </if>
+            <if test="channel != null ">
+                and channel = #{channel}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectSysDeviceById" parameterType="Long"
+            resultMap="SysDeviceResult">
+        <include refid="selectSysDeviceVo"/>
+        where id = #{id}
+    </select>
+    <select id="getHostByOrgId" resultType="com.xunmei.system.domain.SysDevice">
+        <include refid="selectSysDeviceVo"/>
+        WHERE
+        org_id =#{orgId} and del_flag='0' and device_type='0'
+    </select>
+
+    <insert id="insertSysDevice" parameterType="com.xunmei.system.domain.SysDevice">
+        insert into sys_device
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,
+            </if>
+            <if test="orgId != null">org_id,
+            </if>
+            <if test="orgName != null">org_name,
+            </if>
+            <if test="deviceName != null">device_name,
+            </if>
+            <if test="assetType != null">asset_type,
+            </if>
+            <if test="deviceType != null">device_type,
+            </if>
+            <if test="deviceBrand != null">device_brand,
+            </if>
+            <if test="checkTime != null">check_time,
+            </if>
+            <if test="maintenanceTerm != null">maintenance_term,
+            </if>
+            <if test="createTime != null">create_time,
+            </if>
+            <if test="updateTime != null">update_time,
+            </if>
+            <if test="createBy != null">create_by,
+            </if>
+            <if test="updateBy != null">update_by,
+            </if>
+            <if test="delFlag != null">del_flag,
+            </if>
+            <if test="hostId != null">host_id,
+            </if>
+            <if test="channel != null">channel,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},
+            </if>
+            <if test="orgId != null">#{orgId},
+            </if>
+            <if test="orgName != null">#{orgName},
+            </if>
+            <if test="deviceName != null">#{deviceName},
+            </if>
+            <if test="assetType != null">#{assetType},
+            </if>
+            <if test="deviceType != null">#{deviceType},
+            </if>
+            <if test="deviceBrand != null">#{deviceBrand},
+            </if>
+            <if test="checkTime != null">#{checkTime},
+            </if>
+            <if test="maintenanceTerm != null">#{maintenanceTerm},
+            </if>
+            <if test="createTime != null">#{createTime},
+            </if>
+            <if test="updateTime != null">#{updateTime},
+            </if>
+            <if test="createBy != null">#{createBy},
+            </if>
+            <if test="updateBy != null">#{updateBy},
+            </if>
+            <if test="delFlag != null">#{delFlag},
+            </if>
+            <if test="hostId != null">#{hostId},
+            </if>
+            <if test="channel != null">#{channel},
+            </if>
+        </trim>
+    </insert>
+
+    <update id="updateSysDevice" parameterType="com.xunmei.system.domain.SysDevice">
+        update sys_device
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="orgId != null">org_id =
+                #{orgId},
+            </if>
+            <if test="orgName != null">org_name =
+                #{orgName},
+            </if>
+            <if test="deviceName != null">device_name =
+                #{deviceName},
+            </if>
+            <if test="assetType != null">asset_type =
+                #{assetType},
+            </if>
+            <if test="deviceType != null">device_type =
+                #{deviceType},
+            </if>
+            <if test="deviceBrand != null">device_brand =
+                #{deviceBrand},
+            </if>
+            <if test="checkTime != null">check_time =
+                #{checkTime},
+            </if>
+            <if test="maintenanceTerm != null">maintenance_term =
+                #{maintenanceTerm},
+            </if>
+            <if test="createTime != null">create_time =
+                #{createTime},
+            </if>
+            <if test="updateTime != null">update_time =
+                #{updateTime},
+            </if>
+            <if test="createBy != null">create_by =
+                #{createBy},
+            </if>
+            <if test="updateBy != null">update_by =
+                #{updateBy},
+            </if>
+            <if test="delFlag != null">del_flag =
+                #{delFlag},
+            </if>
+            <if test="hostId != null">host_id =
+                #{hostId},
+            </if>
+            <if test="channel != null">channel =
+                #{channel},
+            </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteSysDeviceById" parameterType="Long">
+        delete
+        from sys_device
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteSysDeviceByIds" parameterType="String">
+        delete from sys_device where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>