Преглед изворни кода

saas物联网: 新增 获取云飞气象站折线图接口

zhaiyifei пре 1 година
родитељ
комит
81b8c8c882

+ 41 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/qxz/controller/IotDeviceQxzController.java

@@ -1,8 +1,13 @@
 package com.yunfeiyun.agmp.iotm.device.qxz.controller;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yunfeiyun.agmp.common.core.domain.AjaxResult;
 import com.yunfeiyun.agmp.common.core.page.TableDataInfo;
 import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
 import com.yunfeiyun.agmp.iotm.common.controller.BaseController;
+import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseFunReqVo;
+import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceCommonService;
+import com.yunfeiyun.agmp.iotm.device.qxz.domain.IotDeviceQxzDataListReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceListReqVo;
 import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDeviceListResVo;
 import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
@@ -12,6 +17,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
 
@@ -26,6 +32,10 @@ public class IotDeviceQxzController extends BaseController {
     @Autowired
     private IIotDeviceService iIotDeviceService;
 
+    @Resource
+    private IotDeviceCommonService iotDeviceCommonService;
+
+
     /**
      * 气象站列表
      * @param reqVo
@@ -40,4 +50,35 @@ public class IotDeviceQxzController extends BaseController {
         List<IotDeviceListResVo> list = iIotDeviceService.selectIotDeviceListByType(reqVo);
         return getDataTable(list);
     }
+
+    /**
+     * 气象数据列表
+     * @param reqVo
+     * @return
+     */
+    @GetMapping("/data/list")
+    public TableDataInfo dataList(IotDeviceQxzDataListReqVo reqVo) {
+        // 因为最终查询不是第一个,所以分页不能放在这里
+//        startPage();
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("dataList");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        return getDataTable((IPage) iotDeviceCommonService.func(iotDeviceBaseFunReqVo));
+    }
+
+    /**
+     * 气象数据折线图列表
+     * @param reqVo
+     * @return
+     */
+    @GetMapping("/chart/list")
+    public AjaxResult chartList(IotDeviceQxzDataListReqVo reqVo) {
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("chartList");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        List<IotDeviceListResVo> list = (List<IotDeviceListResVo>) iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return AjaxResult.success(list);
+    }
 }

+ 41 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/qxz/domain/IotDeviceQxzDataListReqVo.java

@@ -0,0 +1,41 @@
+package com.yunfeiyun.agmp.iotm.device.qxz.domain;
+
+import lombok.Data;
+
+/**
+ * 设备基础对象 IotDevice
+ * 
+ * @author 杨晓辉
+ * @date 2024-01-04
+ */
+@Data
+public class IotDeviceQxzDataListReqVo
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 设备业务标识 */
+    private String devBid;
+
+    /** 客户id */
+    private String cId;
+
+    /** 开始时间 */
+    private String startTime;
+
+    /** 结束时间 */
+    private String endTime;
+
+    /**
+     * 数据形式  1 普通列表  2 图表用
+     */
+    private String dataType;
+
+    /**
+     * 导出类型
+     */
+    private String type;
+
+    private String isAsc;
+    private String orderByColumn;
+
+}

+ 9 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/qxz/domain/YfQxzChartDataDto.java

@@ -0,0 +1,9 @@
+package com.yunfeiyun.agmp.iotm.device.qxz.domain;
+
+import com.yunfeiyun.agmp.iot.common.domain.QxzChartDataDto;
+import lombok.Data;
+
+@Data
+public class YfQxzChartDataDto extends QxzChartDataDto {
+
+}

+ 132 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/qxz/service/impl/IotYfQxzServiceImpl.java

@@ -0,0 +1,132 @@
+package com.yunfeiyun.agmp.iotm.device.qxz.service.impl;
+
+import com.alibaba.fastjson2.JSONArray;
+import com.yunfeiyun.agmp.common.utils.DateUtils;
+import com.yunfeiyun.agmp.common.utils.StringUtils;
+import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
+import com.yunfeiyun.agmp.iot.common.constant.device.ElementFactorUtil;
+import com.yunfeiyun.agmp.iot.common.constant.devicetype.ServiceNameConst;
+import com.yunfeiyun.agmp.iot.common.domain.*;
+import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
+import com.yunfeiyun.agmp.iot.common.service.MongoService;
+import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceBaseService;
+import com.yunfeiyun.agmp.iotm.device.common.service.impl.IotDeviceBaseServiceImpl;
+import com.yunfeiyun.agmp.iotm.device.qxz.domain.IotDeviceQxzDataListReqVo;
+import com.yunfeiyun.agmp.iotm.device.qxz.domain.YfQxzChartDataDto;
+import com.yunfeiyun.agmp.iotm.util.MongoUtil;
+import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
+import com.yunfeiyun.agmp.iotm.web.service.IIotDevicefactorService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.mongodb.core.aggregation.*;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service(value = ServiceNameConst.SERVICE_YF_QXZ)
+public class IotYfQxzServiceImpl extends IotDeviceBaseServiceImpl implements IotDeviceBaseService {
+
+    @Autowired
+    private MongoService mongoService;
+
+    @Autowired
+    private IIotDevicefactorService iotDevicefactorService;
+
+    @Autowired
+    private IIotDeviceService iotDeviceService;
+
+    /**
+     * 获取折线图数据列表接口
+     * @param reqVo
+     */
+    public List<IotQxzDataListRseVo> chartList(IotDeviceQxzDataListReqVo reqVo) {
+
+        //1、查出总条数 2、查出“符合条件的、当前页的”数据 3、json结构重组(如果需要的话) 4、附加 要素自定义 信息
+
+        String devBid = reqVo.getDevBid();
+        if(StringUtils.isEmpty(devBid)){
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备标识不能为空");
+        }
+
+        IotDevice findDevice = iotDeviceService.selectIotDeviceByDevBid(reqVo.getDevBid());
+
+        String startDate = reqVo.getStartTime();
+        String endDate = reqVo.getEndTime();
+        String unit = "day";
+
+        Criteria criteria = new Criteria().and("devBid").is(devBid);
+
+        //必须设置起止时间
+        if(StringUtils.isNotEmpty(startDate) && StringUtils.isNotEmpty(endDate)){
+            //限制 起止时间
+            criteria = criteria.andOperator(
+                    Criteria.where("time").gte(DateUtils.parseDate(startDate)),
+                    Criteria.where("time").lte(DateUtils.parseDate(endDate))
+            );
+            //选择 数据粒度
+            unit = MongoUtil.getDateTruncUnit(startDate, endDate);
+        }
+
+        MatchOperation matchOperation = Aggregation.match(criteria);
+
+        ProjectionOperation projectionOperation = Aggregation.project()
+                .and("eName").as("eName")
+                .and("eNum").as("eNum")
+                .and("eKey").as("eKey")
+                .andExpression("{$convert: {input: '$eValue', to: 'double', onError: -99, onNull: -99}}").as("eValue")
+                .andExpression("{$dateTrunc: {date: {$toDate: '$time'}, unit:'" + unit + "'}}").as("time");
+
+        GroupOperation groupOperation = Aggregation.group("eName", "eNum", "eKey")
+                .push("$$ROOT").as("data");
+
+        UnwindOperation unwindOperation = Aggregation.unwind("$data");
+        GroupOperation groupOperation2 = Aggregation.group("data.eName", "data.eNum", "data.eKey", "data.time")
+                .avg("data.eValue").as("eValue");
+
+        SortOperation sortOperation = Aggregation.sort(Sort.Direction.ASC, "_id.time");
+        JSONArray roundArray = new JSONArray();
+        roundArray.add("$eValue");
+        roundArray.add(2);
+        Map<String, Object> roundMap = new HashMap<>();
+        roundMap.put("$round", roundArray);
+        Map<String, Object> pushMapStr = new HashMap<>();
+        pushMapStr.put("$toString", roundMap);
+
+        Map<String, Object> pushMap = new HashMap<>();
+        pushMap.put("number", pushMapStr);
+        pushMap.put("time", "$_id.time");
+
+        GroupOperation groupOperation3 = Aggregation.group("_id.eName", "_id.eNum", "_id.eKey")
+                .push(pushMap).as("dataList");
+
+        ProjectionOperation projectionOperation2 = Aggregation.project()
+                .and("eName").as("eName")
+                .and("eNum").as("eNum")
+                .and("eKey").as("eKey")
+                .and("dataList").as("dataList");
+        SortOperation sortOperation2 = Aggregation.sort(Sort.Direction.ASC, "eKey");
+
+        Aggregation aggregation = Aggregation.newAggregation(
+                matchOperation,
+                projectionOperation,
+                groupOperation,
+                unwindOperation,
+                groupOperation2,
+                sortOperation,
+                groupOperation3,
+                projectionOperation2,
+                sortOperation2
+        );
+        List<QxzChartDataDto> dataList = mongoService.aggregate(IotYfqxzdata.class, aggregation, YfQxzChartDataDto.class);
+
+        //查出该设备的“自定义要素信息列表”
+        IotDevicefactor param = new IotDevicefactor();
+        param.setDevBid(devBid);
+        List<IotDevicefactor> factorList = iotDevicefactorService.selectIotDevicefactorList(param);
+        List<IotQxzDataListRseVo> iotXphChartListResVoList = ElementFactorUtil.qxzChartProcessData(dataList, factorList, findDevice, false);
+        return iotXphChartListResVoList;
+    }
+}

+ 15 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/qxz/service/impl/IotYfXphServiceImpl.java

@@ -0,0 +1,15 @@
+package com.yunfeiyun.agmp.iotm.device.qxz.service.impl;
+
+import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceBaseService;
+import com.yunfeiyun.agmp.iotm.device.common.service.impl.IotDeviceBaseServiceImpl;
+
+
+public class IotYfXphServiceImpl extends IotDeviceBaseServiceImpl implements IotDeviceBaseService {
+    public void list() {
+
+    };
+
+    public void list(Object a) {
+
+    };
+}

+ 19 - 0
src/main/java/com/yunfeiyun/agmp/iotm/util/MongoUtil.java

@@ -0,0 +1,19 @@
+package com.yunfeiyun.agmp.iotm.util;
+
+import com.yunfeiyun.agmp.common.utils.DateUtils;
+import com.yunfeiyun.agmp.common.utils.StringUtils;
+
+public class MongoUtil {
+    public static String getDateTruncUnit(String startDate,String endDate) {
+        String ret = "day";
+        if(StringUtils.isNotEmpty(startDate) && StringUtils.isNotEmpty(endDate)){
+            long diffTime = DateUtils.parseDate(endDate).getTime() - DateUtils.parseDate(startDate).getTime();
+            if(diffTime <= 48 * 60 * 60 * 1000){
+                ret = "minute";
+            }else if(diffTime <= 30L * 24 * 60 * 60 * 1000){
+                ret = "hour";
+            }
+        }
+        return ret;
+    }
+}

+ 64 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotDevicefactorMapper.java

@@ -0,0 +1,64 @@
+package com.yunfeiyun.agmp.iotm.web.mapper;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotDevicefactor;
+
+import java.util.List;
+
+
+/**
+ * 设备要素Mapper接口
+ * 
+ * @author 杨晓辉
+ * @date 2024-02-22
+ */
+public interface IotDevicefactorMapper 
+{
+    /**
+     * 查询设备要素
+     * 
+     * @param id 设备要素主键
+     * @return 设备要素
+     */
+    public IotDevicefactor selectIotDevicefactorById(Long id);
+
+    /**
+     * 查询设备要素列表
+     * 
+     * @param iotDevicefactor 设备要素
+     * @return 设备要素集合
+     */
+    public List<IotDevicefactor> selectIotDevicefactorList(IotDevicefactor iotDevicefactor);
+
+    /**
+     * 新增设备要素
+     * 
+     * @param iotDevicefactor 设备要素
+     * @return 结果
+     */
+    public int insertIotDevicefactor(IotDevicefactor iotDevicefactor);
+
+    /**
+     * 修改设备要素
+     * 
+     * @param iotDevicefactor 设备要素
+     * @return 结果
+     */
+    public int updateIotDevicefactor(IotDevicefactor iotDevicefactor);
+
+    /**
+     * 删除设备要素
+     * 
+     * @param id 设备要素主键
+     * @return 结果
+     */
+    public int deleteIotDevicefactorById(Long id);
+    public int deleteIotDevicefactorByDevBid(String devBid);
+
+    /**
+     * 批量删除设备要素
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteIotDevicefactorByIds(Long[] ids);
+}

+ 63 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotDevicefactorService.java

@@ -0,0 +1,63 @@
+package com.yunfeiyun.agmp.iotm.web.service;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotDevicefactor;
+
+import java.util.List;
+
+/**
+ * 设备要素Service接口
+ * 
+ * @author 杨晓辉
+ * @date 2024-02-22
+ */
+public interface IIotDevicefactorService 
+{
+    /**
+     * 查询设备要素
+     * 
+     * @param id 设备要素主键
+     * @return 设备要素
+     */
+    public IotDevicefactor selectIotDevicefactorById(Long id);
+
+    /**
+     * 查询设备要素列表
+     * 
+     * @param iotDevicefactor 设备要素
+     * @return 设备要素集合
+     */
+    public List<IotDevicefactor> selectIotDevicefactorList(IotDevicefactor iotDevicefactor);
+
+    /**
+     * 新增设备要素
+     * 
+     * @param iotDevicefactor 设备要素
+     * @return 结果
+     */
+    public int insertIotDevicefactor(IotDevicefactor iotDevicefactor);
+
+    /**
+     * 修改设备要素
+     * 
+     * @param iotDevicefactor 设备要素
+     * @return 结果
+     */
+    public int updateIotDevicefactor(IotDevicefactor iotDevicefactor);
+
+    /**
+     * 批量删除设备要素
+     * 
+     * @param ids 需要删除的设备要素主键集合
+     * @return 结果
+     */
+    public int deleteIotDevicefactorByIds(Long[] ids);
+
+    /**
+     * 删除设备要素信息
+     * 
+     * @param id 设备要素主键
+     * @return 结果
+     */
+    public int deleteIotDevicefactorById(Long id);
+    public int deleteIotDevicefactorByDevBid(String id);
+}

+ 102 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotDevicefactorServiceImpl.java

@@ -0,0 +1,102 @@
+package com.yunfeiyun.agmp.iotm.web.service.impl;
+
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
+import com.yunfeiyun.agmp.iot.common.domain.IotDevicefactor;
+import com.yunfeiyun.agmp.iotm.web.mapper.IotDevicefactorMapper;
+import com.yunfeiyun.agmp.iotm.web.service.IIotDevicefactorService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 设备要素Service业务层处理
+ * 
+ * @author 杨晓辉
+ * @date 2024-02-22
+ */
+@Service
+public class IotDevicefactorServiceImpl implements IIotDevicefactorService
+{
+    @Autowired
+    private IotDevicefactorMapper iotDevicefactorMapper;
+
+    /**
+     * 查询设备要素
+     * 
+     * @param id 设备要素主键
+     * @return 设备要素
+     */
+    @Override
+    public IotDevicefactor selectIotDevicefactorById(Long id)
+    {
+        return iotDevicefactorMapper.selectIotDevicefactorById(id);
+    }
+
+    /**
+     * 查询设备要素列表
+     * 
+     * @param iotDevicefactor 设备要素
+     * @return 设备要素
+     */
+    @Override
+    public List<IotDevicefactor> selectIotDevicefactorList(IotDevicefactor iotDevicefactor)
+    {
+        iotDevicefactor.setTid(SecurityUtils.getTid());
+        return iotDevicefactorMapper.selectIotDevicefactorList(iotDevicefactor);
+    }
+
+    /**
+     * 新增设备要素
+     * 
+     * @param iotDevicefactor 设备要素
+     * @return 结果
+     */
+    @Override
+    public int insertIotDevicefactor(IotDevicefactor iotDevicefactor)
+    {
+        return iotDevicefactorMapper.insertIotDevicefactor(iotDevicefactor);
+    }
+
+    /**
+     * 修改设备要素
+     * 
+     * @param iotDevicefactor 设备要素
+     * @return 结果
+     */
+    @Override
+    public int updateIotDevicefactor(IotDevicefactor iotDevicefactor)
+    {
+        return iotDevicefactorMapper.updateIotDevicefactor(iotDevicefactor);
+    }
+
+    /**
+     * 批量删除设备要素
+     * 
+     * @param ids 需要删除的设备要素主键
+     * @return 结果
+     */
+    @Override
+    public int deleteIotDevicefactorByIds(Long[] ids)
+    {
+        return iotDevicefactorMapper.deleteIotDevicefactorByIds(ids);
+    }
+
+    /**
+     * 删除设备要素信息
+     * 
+     * @param id 设备要素主键
+     * @return 结果
+     */
+    @Override
+    public int deleteIotDevicefactorById(Long id)
+    {
+        return iotDevicefactorMapper.deleteIotDevicefactorById(id);
+    }
+
+    @Override
+    public int deleteIotDevicefactorByDevBid(String devBid)
+    {
+        return iotDevicefactorMapper.deleteIotDevicefactorByDevBid(devBid);
+    }
+}

+ 109 - 0
src/main/resources/mapper/IotDevicefactorMapper.xml

@@ -0,0 +1,109 @@
+<?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.yunfeiyun.agmp.iotm.web.mapper.IotDevicefactorMapper">
+    
+    <resultMap type="IotDevicefactor" id="IotDevicefactorResult">
+        <result property="id"    column="id"    />
+        <result property="dfBid"    column="dfBid"    />
+        <result property="devBid"    column="devBid"    />
+        <result property="dfCode"    column="dfCode"    />
+        <result property="dfAddress"    column="dfAddress"    />
+        <result property="dfName"    column="dfName"    />
+        <result property="dfDisplayname"    column="dfDisplayname"    />
+        <result property="dfDisable"    column="dfDisable"    />
+        <result property="dfCreatedDate"    column="dfCreatedDate"    />
+        <result property="dfCreator"    column="dfCreator"    />
+        <result property="dfModifieddate"    column="dfModifieddate"    />
+        <result property="dfModifier"    column="dfModifier"    />
+    </resultMap>
+
+    <sql id="selectIotDevicefactorVo">
+        select id, dfBid, devBid, dfCode,dfAddress, dfName, dfDisplayname, dfDisable, dfCreatedDate, dfCreator, dfModifieddate, dfModifier from IotDevicefactor
+    </sql>
+
+    <select id="selectIotDevicefactorList" parameterType="IotDevicefactor" resultMap="IotDevicefactorResult">
+        <include refid="selectIotDevicefactorVo"/>
+        <where>
+            tid = #{tid}
+            <if test="dfBid != null  and dfBid != ''"> and dfBid = #{dfBid}</if>
+            <if test="devBid != null  and devBid != ''"> and devBid = #{devBid}</if>
+            <if test="dfCode != null  and dfCode != ''"> and dfCode = #{dfCode}</if>
+            <if test="dfAddress != null  and dfAddress != ''"> and dfAddress = #{dfAddress}</if>
+            <if test="dfName != null  and dfName != ''"> and dfName like concat('%', #{dfName}, '%')</if>
+            <if test="dfDisplayname != null  and dfDisplayname != ''"> and dfDisplayname like concat('%', #{dfDisplayname}, '%')</if>
+            <if test="dfCreatedDate != null  and dfCreatedDate != ''"> and dfCreatedDate = #{dfCreatedDate}</if>
+            <if test="dfCreator != null  and dfCreator != ''"> and dfCreator = #{dfCreator}</if>
+            <if test="dfModifieddate != null  and dfModifieddate != ''"> and dfModifieddate = #{dfModifieddate}</if>
+            <if test="dfModifier != null  and dfModifier != ''"> and dfModifier = #{dfModifier}</if>
+        </where>
+    </select>
+    
+    <select id="selectIotDevicefactorById" parameterType="Long" resultMap="IotDevicefactorResult">
+        <include refid="selectIotDevicefactorVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertIotDevicefactor" parameterType="IotDevicefactor" useGeneratedKeys="true" keyProperty="id">
+        insert into IotDevicefactor
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="dfBid != null">dfBid,</if>
+            <if test="devBid != null">devBid,</if>
+            <if test="dfCode != null">dfCode,</if>
+            <if test="dfAddress != null">dfAddress,</if>
+            <if test="dfName != null">dfName,</if>
+            <if test="dfDisplayname != null">dfDisplayname,</if>
+            <if test="dfDisable != null">dfDisable,</if>
+            <if test="dfCreatedDate != null">dfCreatedDate,</if>
+            <if test="dfCreator != null">dfCreator,</if>
+            <if test="dfModifieddate != null">dfModifieddate,</if>
+            <if test="dfModifier != null">dfModifier,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="dfBid != null">#{dfBid},</if>
+            <if test="devBid != null">#{devBid},</if>
+            <if test="dfCode != null">#{dfCode},</if>
+            <if test="dfAddress != null">#{dfAddress},</if>
+            <if test="dfName != null">#{dfName},</if>
+            <if test="dfDisplayname != null">#{dfDisplayname},</if>
+            <if test="dfDisable != null">#{dfDisable},</if>
+            <if test="dfCreatedDate != null">#{dfCreatedDate},</if>
+            <if test="dfCreator != null">#{dfCreator},</if>
+            <if test="dfModifieddate != null">#{dfModifieddate},</if>
+            <if test="dfModifier != null">#{dfModifier},</if>
+         </trim>
+    </insert>
+
+    <update id="updateIotDevicefactor" parameterType="IotDevicefactor">
+        update IotDevicefactor
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="dfBid != null">dfBid = #{dfBid},</if>
+            <if test="devBid != null">devBid = #{devBid},</if>
+            <if test="dfCode != null">dfCode = #{dfCode},</if>
+            <if test="dfAddress != null">dfAddress = #{dfAddress},</if>
+            <if test="dfName != null">dfName = #{dfName},</if>
+            <if test="dfDisplayname != null">dfDisplayname = #{dfDisplayname},</if>
+            <if test="dfCreatedDate != null">dfCreatedDate = #{dfCreatedDate},</if>
+            <if test="dfCreator != null">dfCreator = #{dfCreator},</if>
+            <if test="dfModifieddate != null">dfModifieddate = #{dfModifieddate},</if>
+            <if test="dfModifier != null">dfModifier = #{dfModifier},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteIotDevicefactorById" parameterType="Long">
+        delete from IotDevicefactor where id = #{id}
+    </delete>
+
+    <delete id="deleteIotDevicefactorByDevBid" parameterType="String">
+        delete from IotDevicefactor where devBid = #{devBid}
+    </delete>
+
+    <delete id="deleteIotDevicefactorByIds" parameterType="String">
+        delete from IotDevicefactor where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>